mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Fix docstring, comment typos
This commit is contained in:
@@ -37,6 +37,8 @@ class DepositAddress:
|
|||||||
return DepositAddress(method, currency, address)
|
return DepositAddress(method, currency, address)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' Allow us to print the Transfer object in a pretty format '''
|
"""
|
||||||
|
Allow us to print the Transfer object in a pretty format
|
||||||
|
"""
|
||||||
text = "DepositAddress <{} method={} currency={}>"
|
text = "DepositAddress <{} method={} currency={}>"
|
||||||
return text.format(self.address, self.method, self.currency)
|
return text.format(self.address, self.method, self.currency)
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ class Notification:
|
|||||||
return basic
|
return basic
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' Allow us to print the Notification object in a pretty format '''
|
"""
|
||||||
|
Allow us to print the Notification object in a pretty format
|
||||||
|
"""
|
||||||
text = "Notification <'{}' ({}) - {} notify_info={}>"
|
text = "Notification <'{}' ({}) - {} notify_info={}>"
|
||||||
return text.format(self.notify_type, self.status, self.text, self.notify_info)
|
return text.format(self.notify_type, self.status, self.text, self.notify_info)
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class Order:
|
|||||||
"""
|
"""
|
||||||
Check if the order is still open
|
Check if the order is still open
|
||||||
|
|
||||||
@return bool: Ture if order open else False
|
@return bool: True if order open else False
|
||||||
"""
|
"""
|
||||||
return self.is_open_bool
|
return self.is_open_bool
|
||||||
|
|
||||||
@@ -230,7 +230,9 @@ class Order:
|
|||||||
return self.is_confirmed_bool
|
return self.is_confirmed_bool
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' Allow us to print the Order object in a pretty format '''
|
"""
|
||||||
|
Allow us to print the Order object in a pretty format
|
||||||
|
"""
|
||||||
text = "Order <'{}' amount_orig={} amount_filled={} mts_create={} status='{}' id={}>"
|
text = "Order <'{}' amount_orig={} amount_filled={} mts_create={} status='{}' id={}>"
|
||||||
return text.format(self.symbol, self.amount_orig, self.amount_filled,
|
return text.format(self.symbol, self.amount_orig, self.amount_filled,
|
||||||
self.mts_create, self.status, self.id)
|
self.mts_create, self.status, self.id)
|
||||||
|
|||||||
@@ -100,7 +100,9 @@ class Position:
|
|||||||
lev, pid, mtsc, mtsu, ptype, coll, coll_min, meta)
|
lev, pid, mtsc, mtsu, ptype, coll, coll_min, meta)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' Allow us to print the Trade object in a pretty format '''
|
"""
|
||||||
|
Allow us to print the Trade object in a pretty format
|
||||||
|
"""
|
||||||
text = "Position '{}' {} x {} <status='{}' pl={}>"
|
text = "Position '{}' {} x {} <status='{}' pl={}>"
|
||||||
return text.format(self.symbol, self.base_price, self.amount,
|
return text.format(self.symbol, self.base_price, self.amount,
|
||||||
self.status, self.profit_loss)
|
self.status, self.profit_loss)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Subscription:
|
|||||||
"""
|
"""
|
||||||
Object used to represent an individual subscription to the websocket.
|
Object used to represent an individual subscription to the websocket.
|
||||||
This class also exposes certain functions which helps to manage the subscription
|
This class also exposes certain functions which helps to manage the subscription
|
||||||
such as unsibscribe and subscribe.
|
such as unsubscribe and subscribe.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, socket, channel_name, symbol, key=None, timeframe=None, **kwargs):
|
def __init__(self, socket, channel_name, symbol, key=None, timeframe=None, **kwargs):
|
||||||
@@ -49,7 +49,7 @@ class Subscription:
|
|||||||
|
|
||||||
async def unsubscribe(self):
|
async def unsubscribe(self):
|
||||||
"""
|
"""
|
||||||
Send an unsubscription request to the bitfinex socket
|
Send an un-subscription request to the bitfinex socket
|
||||||
"""
|
"""
|
||||||
if not self.is_subscribed():
|
if not self.is_subscribed():
|
||||||
raise Exception("Subscription is not subscribed to websocket")
|
raise Exception("Subscription is not subscribed to websocket")
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ class Transfer:
|
|||||||
return Transfer(mts, wallet_from, wallet_to, currency_from, currency_to, amount)
|
return Transfer(mts, wallet_from, wallet_to, currency_from, currency_to, amount)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' Allow us to print the Transfer object in a pretty format '''
|
"""
|
||||||
|
Allow us to print the Transfer object in a pretty format
|
||||||
|
"""
|
||||||
text = "Transfer <{} from {} ({}) to {} ({}) mts={}>"
|
text = "Transfer <{} from {} ({}) to {} ({}) mts={}>"
|
||||||
return text.format(self.amount, self.wallet_from, self.currency_from,
|
return text.format(self.amount, self.wallet_from, self.currency_from,
|
||||||
self.wallet_to, self.currency_to, self.mts)
|
self.wallet_to, self.currency_to, self.mts)
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ class Withdraw:
|
|||||||
return Withdraw(w_id, method, wallet, amount)
|
return Withdraw(w_id, method, wallet, amount)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
''' Allow us to print the Withdraw object in a pretty format '''
|
"""
|
||||||
|
Allow us to print the Withdraw object in a pretty format
|
||||||
|
"""
|
||||||
text = "Withdraw <id={} from {} ({}) amount={} fee={}>"
|
text = "Withdraw <id={} from {} ({}) amount={} fee={}>"
|
||||||
return text.format(self.id, self.wallet, self.method, self.amount,
|
return text.format(self.id, self.wallet, self.method, self.amount,
|
||||||
self.fee)
|
self.fee)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from .helpers import (create_stubbed_client, ws_publish_connection_init, ws_publ
|
|||||||
async def test_ws_creates_new_socket():
|
async def test_ws_creates_new_socket():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
client.ws.ws_capacity = 5
|
client.ws.ws_capacity = 5
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# create a bunch of websocket subscriptions
|
# create a bunch of websocket subscriptions
|
||||||
for symbol in ['tXRPBTC', 'tLTCUSD']:
|
for symbol in ['tXRPBTC', 'tLTCUSD']:
|
||||||
@@ -25,12 +25,12 @@ async def test_ws_creates_new_socket():
|
|||||||
async def test_ws_uses_authenticated_socket():
|
async def test_ws_uses_authenticated_socket():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
client.ws.ws_capacity = 2
|
client.ws.ws_capacity = 2
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# create a bunch of websocket subscriptions
|
# create a bunch of websocket subscriptions
|
||||||
for symbol in ['tXRPBTC', 'tLTCUSD', 'tETHBTC', 'tBTCUSD', 'tETHUSD', 'tLTCBTC']:
|
for symbol in ['tXRPBTC', 'tLTCUSD', 'tETHBTC', 'tBTCUSD', 'tETHUSD', 'tLTCBTC']:
|
||||||
await client.ws.subscribe('candles', symbol, timeframe='1m')
|
await client.ws.subscribe('candles', symbol, timeframe='1m')
|
||||||
# publsh connection created message on socket (0 by default)
|
# publish connection created message on socket (0 by default)
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# send auth accepted (on socket by default)
|
# send auth accepted (on socket by default)
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from .helpers import create_stubbed_client, ws_publish_connection_init, ws_publi
|
|||||||
async def test_checksum_generation():
|
async def test_checksum_generation():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
symbol = "tXRPBTC"
|
symbol = "tXRPBTC"
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# publish checksum flag accepted
|
# publish checksum flag accepted
|
||||||
await ws_publish_conf_accepted(client.ws, 131072)
|
await ws_publish_conf_accepted(client.ws, 131072)
|
||||||
@@ -37,7 +37,7 @@ async def test_checksum_generation():
|
|||||||
async def test_checksum_really_samll_numbers_generation():
|
async def test_checksum_really_samll_numbers_generation():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
symbol = "tVETBTC"
|
symbol = "tVETBTC"
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# publish checksum flag accepted
|
# publish checksum flag accepted
|
||||||
await ws_publish_conf_accepted(client.ws, 131072)
|
await ws_publish_conf_accepted(client.ws, 131072)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from .helpers import (create_stubbed_client, ws_publish_auth_accepted, ws_publis
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_submit_order():
|
async def test_submit_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -25,7 +25,7 @@ async def test_submit_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_submit_update_order():
|
async def test_submit_update_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -44,7 +44,7 @@ async def test_submit_update_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_submit_cancel_order():
|
async def test_submit_cancel_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -59,7 +59,7 @@ async def test_submit_cancel_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_events_on_new_order():
|
async def test_events_on_new_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -94,7 +94,7 @@ async def test_events_on_new_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_events_on_cancel_order():
|
async def test_events_on_cancel_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -114,7 +114,7 @@ async def test_events_on_cancel_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_closed_callback_on_submit_order_closed():
|
async def test_closed_callback_on_submit_order_closed():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -131,7 +131,7 @@ async def test_closed_callback_on_submit_order_closed():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_confirmed_callback_on_submit_order_closed():
|
async def test_confirmed_callback_on_submit_order_closed():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -147,7 +147,7 @@ async def test_confirmed_callback_on_submit_order_closed():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_confirmed_callback_on_submit_new_order():
|
async def test_confirmed_callback_on_submit_new_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -163,7 +163,7 @@ async def test_confirmed_callback_on_submit_new_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_confirmed_callback_on_submit_order_update():
|
async def test_confirmed_callback_on_submit_order_update():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -179,7 +179,7 @@ async def test_confirmed_callback_on_submit_order_update():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_confirmed_callback_on_submit_cancel_order():
|
async def test_confirmed_callback_on_submit_cancel_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
@@ -195,7 +195,7 @@ async def test_confirmed_callback_on_submit_cancel_order():
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_confirmed_callback_on_submit_cancel_group_order():
|
async def test_confirmed_callback_on_submit_cancel_group_order():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
## send auth accepted
|
## send auth accepted
|
||||||
await ws_publish_auth_accepted(client.ws)
|
await ws_publish_auth_accepted(client.ws)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from .helpers import (create_stubbed_client, ws_publish_connection_init, EventWa
|
|||||||
async def test_submit_subscribe():
|
async def test_submit_subscribe():
|
||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
symb = 'tXRPBTC'
|
symb = 'tXRPBTC'
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
|
|
||||||
# Create new subscription to orderbook
|
# Create new subscription to orderbook
|
||||||
@@ -42,7 +42,7 @@ async def test_event_subscribe():
|
|||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
symb = 'tXRPBTC'
|
symb = 'tXRPBTC'
|
||||||
pair = 'XRPBTC'
|
pair = 'XRPBTC'
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# create a new subscription
|
# create a new subscription
|
||||||
await client.ws.subscribe('trades', symb)
|
await client.ws.subscribe('trades', symb)
|
||||||
@@ -60,7 +60,7 @@ async def test_submit_unsubscribe():
|
|||||||
client = create_stubbed_client()
|
client = create_stubbed_client()
|
||||||
symb = 'tXRPBTC'
|
symb = 'tXRPBTC'
|
||||||
pair = 'XRPBTC'
|
pair = 'XRPBTC'
|
||||||
# publsh connection created message
|
# publish connection created message
|
||||||
await ws_publish_connection_init(client.ws)
|
await ws_publish_connection_init(client.ws)
|
||||||
# create new subscription to trades
|
# create new subscription to trades
|
||||||
await client.ws.subscribe('trades', symb)
|
await client.ws.subscribe('trades', symb)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ def generate_auth_payload(API_KEY, API_SECRET):
|
|||||||
"""
|
"""
|
||||||
Generate a signed payload
|
Generate a signed payload
|
||||||
|
|
||||||
@return json Oject headers
|
@return json Object headers
|
||||||
"""
|
"""
|
||||||
nonce = _gen_nonce()
|
nonce = _gen_nonce()
|
||||||
authMsg, sig = _gen_signature(API_KEY, API_SECRET, nonce)
|
authMsg, sig = _gen_signature(API_KEY, API_SECRET, nonce)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ def formatter_message(message, use_color = True):
|
|||||||
|
|
||||||
def format_word(message, word, color_seq, bold=False, underline=False):
|
def format_word(message, word, color_seq, bold=False, underline=False):
|
||||||
"""
|
"""
|
||||||
Surround the fiven word with a sequence
|
Surround the given word with a sequence
|
||||||
"""
|
"""
|
||||||
replacer = color_seq + word + RESET_SEQ
|
replacer = color_seq + word + RESET_SEQ
|
||||||
if underline:
|
if underline:
|
||||||
@@ -47,9 +47,9 @@ def format_word(message, word, color_seq, bold=False, underline=False):
|
|||||||
return message.replace(word, replacer)
|
return message.replace(word, replacer)
|
||||||
|
|
||||||
class Formatter(logging.Formatter):
|
class Formatter(logging.Formatter):
|
||||||
'''
|
"""
|
||||||
This Formatted simply colors in the levelname i.e 'INFO', 'DEBUG'
|
This Formatted simply colors in the levelname i.e 'INFO', 'DEBUG'
|
||||||
'''
|
"""
|
||||||
def __init__(self, msg, use_color = True):
|
def __init__(self, msg, use_color = True):
|
||||||
logging.Formatter.__init__(self, msg)
|
logging.Formatter.__init__(self, msg)
|
||||||
self.use_color = use_color
|
self.use_color = use_color
|
||||||
@@ -66,10 +66,10 @@ class Formatter(logging.Formatter):
|
|||||||
return logging.Formatter.format(self, record)
|
return logging.Formatter.format(self, record)
|
||||||
|
|
||||||
class CustomLogger(logging.Logger):
|
class CustomLogger(logging.Logger):
|
||||||
'''
|
"""
|
||||||
This adds extra logging functions such as logger.trade and also
|
This adds extra logging functions such as logger.trade and also
|
||||||
sets the logger to use the custom formatter
|
sets the logger to use the custom formatter
|
||||||
'''
|
"""
|
||||||
FORMAT = "[$BOLD%(name)s$RESET] [%(levelname)s] %(message)s"
|
FORMAT = "[$BOLD%(name)s$RESET] [%(levelname)s] %(message)s"
|
||||||
COLOR_FORMAT = formatter_message(FORMAT, True)
|
COLOR_FORMAT = formatter_message(FORMAT, True)
|
||||||
TRADE = 50
|
TRADE = 50
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ class BfxWebsocket(GenericWebsocket):
|
|||||||
Unsubscribe from the channel with the given chanId
|
Unsubscribe from the channel with the given chanId
|
||||||
|
|
||||||
# Attributes
|
# Attributes
|
||||||
@param onComplete: function called when the bitfinex websocket resoponds with
|
@param onComplete: function called when the bitfinex websocket responds with
|
||||||
a signal that confirms the subscription has been unsubscribed to
|
a signal that confirms the subscription has been unsubscribed to
|
||||||
"""
|
"""
|
||||||
return await self.subscriptionManager.unsubscribe(*args, **kwargs)
|
return await self.subscriptionManager.unsubscribe(*args, **kwargs)
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class GenericWebsocket:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Starte the websocket connection. This functions spawns the initial socket
|
Start the websocket connection. This functions spawns the initial socket
|
||||||
thread and connection.
|
thread and connection.
|
||||||
"""
|
"""
|
||||||
self._start_new_socket()
|
self._start_new_socket()
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ class OrderManager:
|
|||||||
self.bfxapi._emit('order_closed', order)
|
self.bfxapi._emit('order_closed', order)
|
||||||
|
|
||||||
async def build_from_order_snapshot(self, raw_ws_data):
|
async def build_from_order_snapshot(self, raw_ws_data):
|
||||||
'''
|
"""
|
||||||
Rebuild the user orderbook based on an incoming snapshot
|
Rebuild the user orderbook based on an incoming snapshot
|
||||||
'''
|
"""
|
||||||
osData = raw_ws_data[2]
|
osData = raw_ws_data[2]
|
||||||
self.open_orders = {}
|
self.open_orders = {}
|
||||||
for raw_order in osData:
|
for raw_order in osData:
|
||||||
@@ -206,10 +206,7 @@ class OrderManager:
|
|||||||
|
|
||||||
@param orderId: the id of the order that you want to update
|
@param orderId: the id of the order that you want to update
|
||||||
@param onConfirm: function called when the bitfinex websocket receives signal that the
|
@param onConfirm: function called when the bitfinex websocket receives signal that the
|
||||||
order
|
order was confirmed
|
||||||
was confirmed
|
|
||||||
@param onClose: function called when the bitfinex websocket receives signal that the order
|
|
||||||
was closed due to being filled or cancelled
|
|
||||||
"""
|
"""
|
||||||
self._create_callback(orderId, onConfirm, self.pending_cancel_confirm_callbacks)
|
self._create_callback(orderId, onConfirm, self.pending_cancel_confirm_callbacks)
|
||||||
await self.bfxapi._send_auth_command('oc', {'id': orderId})
|
await self.bfxapi._send_auth_command('oc', {'id': orderId})
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class SubscriptionManager:
|
|||||||
# unsubscribe first and call callback to subscribe
|
# unsubscribe first and call callback to subscribe
|
||||||
await self.unsubscribe(chan_id, re_sub)
|
await self.unsubscribe(chan_id, re_sub)
|
||||||
else:
|
else:
|
||||||
# already unsibscribed, so just subscribe
|
# already unsubscribed, so just subscribe
|
||||||
await sub.subscribe()
|
await sub.subscribe()
|
||||||
|
|
||||||
def channel_count(self):
|
def channel_count(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user