mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
examples: fix subscribe func
This commit is contained in:
@@ -5,7 +5,7 @@ sys.path.append('../')
|
||||
from bfxapi import Client
|
||||
|
||||
bfx = Client(
|
||||
logLevel='INFO',
|
||||
logLevel='DEBUG',
|
||||
# Verifies that the local orderbook is up to date
|
||||
# with the bitfinex servers
|
||||
manageOrderBooks=True
|
||||
@@ -23,9 +23,9 @@ def log_update(data):
|
||||
def log_snapshot(data):
|
||||
print ("Initial book: {}".format(data))
|
||||
|
||||
def start():
|
||||
bfx.ws.subscribe('book', 'tBTCUSD')
|
||||
bfx.ws.subscribe('book', 'tETHUSD')
|
||||
async def start():
|
||||
await bfx.ws.subscribe('book', 'tBTCUSD')
|
||||
# bfx.ws.subscribe('book', 'tETHUSD')
|
||||
|
||||
bfx.ws.on('connected', start)
|
||||
bfx.ws.run()
|
||||
|
||||
@@ -20,9 +20,9 @@ def log_candle(candle):
|
||||
def log_trade(trade):
|
||||
print ("New trade: {}".format(trade))
|
||||
|
||||
def start():
|
||||
bfx.ws.subscribe('candles', 'tBTCUSD', timeframe='1m')
|
||||
bfx.ws.subscribe('trades', 'tBTCUSD')
|
||||
async def start():
|
||||
await bfx.ws.subscribe('candles', 'tBTCUSD', timeframe='1m')
|
||||
await bfx.ws.subscribe('trades', 'tBTCUSD')
|
||||
|
||||
bfx.ws.on('connected', start)
|
||||
bfx.ws.run()
|
||||
|
||||
Reference in New Issue
Block a user