mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44:22 +01:00
examples/ws: add derivative status updates example
This commit is contained in:
committed by
Jacob Plaster
parent
ac20a7530a
commit
ef3dfe1d40
23
bfxapi/examples/ws/subscribe_derivative_status.py
Normal file
23
bfxapi/examples/ws/subscribe_derivative_status.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
|
||||
from bfxapi import Client
|
||||
|
||||
bfx = Client(
|
||||
logLevel='INFO'
|
||||
)
|
||||
|
||||
@bfx.ws.on('error')
|
||||
def log_error(err):
|
||||
print ("Error: {}".format(err))
|
||||
|
||||
@bfx.ws.on('status_update')
|
||||
def log_msg(msg):
|
||||
print (msg)
|
||||
|
||||
async def start():
|
||||
await bfx.ws.subscribe_derivative_status('tBTCF0:USTF0')
|
||||
|
||||
bfx.ws.on('connected', start)
|
||||
bfx.ws.run()
|
||||
Reference in New Issue
Block a user