mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Add new_order (coroutine) websocket authenticated input. Fix bug in BfxWebsocketClient.__require_websocket_authentication decorator.
This commit is contained in:
@@ -105,15 +105,18 @@ class BfxWebsocketClient(object):
|
|||||||
await bucket.close(code=code, reason=reason)
|
await bucket.close(code=code, reason=reason)
|
||||||
|
|
||||||
def __require_websocket_authentication(function):
|
def __require_websocket_authentication(function):
|
||||||
@_require_websocket_connection
|
|
||||||
async def wrapper(self, *args, **kwargs):
|
async def wrapper(self, *args, **kwargs):
|
||||||
if self.authentication == False:
|
if self.authentication == False:
|
||||||
raise WebsocketAuthenticationRequired("To perform this action you need to authenticate using your API_KEY and API_SECRET.")
|
raise WebsocketAuthenticationRequired("To perform this action you need to authenticate using your API_KEY and API_SECRET.")
|
||||||
|
|
||||||
await function(self, *args, **kwargs)
|
await _require_websocket_connection(function)(self, *args, **kwargs)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
@__require_websocket_authentication
|
||||||
|
async def new_order(self, data):
|
||||||
|
await self.websocket.send(json.dumps([ 0, "on", None, data ]))
|
||||||
|
|
||||||
def __bucket_open_signal(self, index):
|
def __bucket_open_signal(self, index):
|
||||||
if all(bucket.websocket != None and bucket.websocket.open == True for bucket in self.buckets):
|
if all(bucket.websocket != None and bucket.websocket.open == True for bucket in self.buckets):
|
||||||
self.event_emitter.emit("open")
|
self.event_emitter.emit("open")
|
||||||
|
|||||||
Reference in New Issue
Block a user