-
Notifications
You must be signed in to change notification settings - Fork 193
Description
pybit = "5.11.0"
from time import sleep
from pybit.unified_trading import WebSocket
ws = WebSocket(
channel_type='private',
api_key="*****",
api_secret="*****",
testnet=False,
demo=True
)
def event_handler(event):
print(event)
ws.fast_execution_stream(callback=event_handler)
while True:
sleep(1)Traceback (most recent call last):
File "/Users/hero/PycharmProjects/ai-trading/analyzer/example/ws_subscribe.py", line 19, in
ws.fast_execution_stream(callback=event_handler)
File "/Users/hero/PycharmProjects/ai-trading/.venv/lib/python3.12/site-packages/pybit/unified_trading.py", line 159, in fast_execution_stream
self.subscribe(topic, callback)
File "/Users/hero/PycharmProjects/ai-trading/.venv/lib/python3.12/site-packages/pybit/_websocket_stream.py", line 348, in subscribe
subscription_args = prepare_subscription_args(symbol)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hero/PycharmProjects/ai-trading/.venv/lib/python3.12/site-packages/pybit/_websocket_stream.py", line 341, in prepare_subscription_args
for single_symbol in list_of_symbols:
^^^^^^^^^^^^^^^
TypeError: 'bool' object is not iterable
Maybe need design if condition?
def prepare_subscription_args(list_of_symbols):
"""
Prepares the topic for subscription by formatting it with the
desired symbols.
"""
if topic in self.standard_private_topics: # Maybe need if topic in self.standard_private_topics + self.other_private_topics
# private topics do not support filters
return [topic]
topics = []
for single_symbol in list_of_symbols:
topics.append(topic.format(symbol=single_symbol))
return topics