From d238c6bb7cb31ec32549b19df2ed36495298487a Mon Sep 17 00:00:00 2001 From: Jacob Plaster Date: Tue, 27 Nov 2018 15:13:06 +0000 Subject: [PATCH] examples: fix subscribe func --- bfxapi/examples/subscribe_orderbook.py | 8 ++++---- bfxapi/examples/subscribe_trades_candles.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bfxapi/examples/subscribe_orderbook.py b/bfxapi/examples/subscribe_orderbook.py index d8e94d3..153fef5 100644 --- a/bfxapi/examples/subscribe_orderbook.py +++ b/bfxapi/examples/subscribe_orderbook.py @@ -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() diff --git a/bfxapi/examples/subscribe_trades_candles.py b/bfxapi/examples/subscribe_trades_candles.py index 6900c87..1b1dd27 100644 --- a/bfxapi/examples/subscribe_trades_candles.py +++ b/bfxapi/examples/subscribe_trades_candles.py @@ -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()