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
|
from bfxapi import Client
|
||||||
|
|
||||||
bfx = Client(
|
bfx = Client(
|
||||||
logLevel='INFO',
|
logLevel='DEBUG',
|
||||||
# Verifies that the local orderbook is up to date
|
# Verifies that the local orderbook is up to date
|
||||||
# with the bitfinex servers
|
# with the bitfinex servers
|
||||||
manageOrderBooks=True
|
manageOrderBooks=True
|
||||||
@@ -23,9 +23,9 @@ def log_update(data):
|
|||||||
def log_snapshot(data):
|
def log_snapshot(data):
|
||||||
print ("Initial book: {}".format(data))
|
print ("Initial book: {}".format(data))
|
||||||
|
|
||||||
def start():
|
async def start():
|
||||||
bfx.ws.subscribe('book', 'tBTCUSD')
|
await bfx.ws.subscribe('book', 'tBTCUSD')
|
||||||
bfx.ws.subscribe('book', 'tETHUSD')
|
# bfx.ws.subscribe('book', 'tETHUSD')
|
||||||
|
|
||||||
bfx.ws.on('connected', start)
|
bfx.ws.on('connected', start)
|
||||||
bfx.ws.run()
|
bfx.ws.run()
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ def log_candle(candle):
|
|||||||
def log_trade(trade):
|
def log_trade(trade):
|
||||||
print ("New trade: {}".format(trade))
|
print ("New trade: {}".format(trade))
|
||||||
|
|
||||||
def start():
|
async def start():
|
||||||
bfx.ws.subscribe('candles', 'tBTCUSD', timeframe='1m')
|
await bfx.ws.subscribe('candles', 'tBTCUSD', timeframe='1m')
|
||||||
bfx.ws.subscribe('trades', 'tBTCUSD')
|
await bfx.ws.subscribe('trades', 'tBTCUSD')
|
||||||
|
|
||||||
bfx.ws.on('connected', start)
|
bfx.ws.on('connected', start)
|
||||||
bfx.ws.run()
|
bfx.ws.run()
|
||||||
|
|||||||
Reference in New Issue
Block a user