Skip to content

Commit 45df308

Browse files
api
1 parent f8a740f commit 45df308

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

unittest_binance_websocket_api.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -634,19 +634,26 @@ def test_live_api_ws(self):
634634
return_response=True)
635635
print(f"current_average_price: {current_average_price}\r\n")
636636
order_book = ubwam.api.spot.get_order_book(stream_id=api_stream, symbol=market, limit=2, return_response=True)
637-
print(f"Orderbook: {order_book}\r\n")
637+
if type(order_book) is not bool:
638+
print(f"Orderbook, lastUpdateId={order_book['result']['lastUpdateId']}: {order_book['result']['asks']}, "
639+
f"{order_book['result']['bids']}\r\n")
638640
aggregate_trades = ubwam.api.spot.get_aggregate_trades(stream_id=api_stream, symbol=market, return_response=True)
639-
print(f"aggregate_trades: {aggregate_trades['result'][:5]}\r\n")
641+
if type(aggregate_trades) is not bool:
642+
print(f"aggregate_trades: {aggregate_trades['result'][:5]}\r\n")
640643
historical_trades = ubwam.api.spot.get_historical_trades(stream_id=api_stream, symbol=market,
641644
return_response=True)
642-
print(f"historical_trades: {historical_trades['result'][:5]}\r\n")
645+
if type(historical_trades) is not bool:
646+
print(f"historical_trades: {historical_trades['result'][:5]}\r\n")
643647
recent_trades = ubwam.api.spot.get_recent_trades(stream_id=api_stream, symbol=market, return_response=True)
644-
print(f"recent_trades: {recent_trades['result'][:5]}\r\n")
648+
if type(recent_trades) is not bool:
649+
print(f"recent_trades: {recent_trades['result'][:5]}\r\n")
645650
klines = ubwam.api.spot.get_klines(stream_id=api_stream, symbol=market, interval="1m", return_response=True)
646-
print(f"A few klines: {klines['result'][:5]}\r\n")
651+
if type(klines) is not bool:
652+
print(f"A few klines: {klines['result'][:5]}\r\n")
647653
ui_klines = ubwam.api.spot.get_ui_klines(stream_id=api_stream, symbol=market, interval="1d",
648654
return_response=True)
649-
print(f"A few ui_klines: {ui_klines['result'][:5]}\r\n")
655+
if type(ui_klines) is not bool:
656+
print(f"A few ui_klines: {ui_klines['result'][:5]}\r\n")
650657
ubwam.api.spot.get_listen_key(stream_id=api_stream)
651658
ubwam.api.spot.get_server_time(stream_id=api_stream)
652659
ubwam.api.spot.get_account_status(stream_id=api_stream)

0 commit comments

Comments
 (0)