mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 23:04:21 +01:00
Add optional dead man switch to websocket
This commit is contained in:
@@ -85,11 +85,12 @@ class BfxWebsocket(GenericWebsocket):
|
||||
20061: 'Websocket server resync complete'
|
||||
}
|
||||
|
||||
def __init__(self, API_KEY=None, API_SECRET=None, host='wss://api.bitfinex.com/ws/2',
|
||||
onSeedCandleHook=None, onSeedTradeHook=None, manageOrderBooks=False, logLevel='INFO', *args, **kwargs):
|
||||
def __init__(self, API_KEY=None, API_SECRET=None, host='wss://api.bitfinex.com/ws/2', manageOrderBooks=False,
|
||||
dead_man_switch=False, logLevel='INFO', *args, **kwargs):
|
||||
self.API_KEY=API_KEY
|
||||
self.API_SECRET=API_SECRET
|
||||
self.manageOrderBooks = manageOrderBooks
|
||||
self.dead_man_switch = dead_man_switch
|
||||
self.pendingOrders = {}
|
||||
self.orderBooks = {}
|
||||
|
||||
@@ -344,6 +345,8 @@ class BfxWebsocket(GenericWebsocket):
|
||||
|
||||
async def _ws_authenticate_socket(self):
|
||||
jdata = generate_auth_payload(self.API_KEY, self.API_SECRET)
|
||||
if self.dead_man_switch:
|
||||
jdata['dms'] = 4
|
||||
await self.ws.send(json.dumps(jdata))
|
||||
|
||||
async def on_open(self):
|
||||
|
||||
Reference in New Issue
Block a user