examples: fix subscribe func

This commit is contained in:
Jacob Plaster
2018-11-27 15:13:06 +00:00
parent 378aeb21e8
commit d238c6bb7c
2 changed files with 7 additions and 7 deletions

View File

@@ -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()

View File

@@ -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()