-
-
Notifications
You must be signed in to change notification settings - Fork 341
Closed
Description
Description of Bug
The example listed in docs/streaming.rst will not display any data because it is subscribing to nasdaq_book_subs but adding a handler for add_timesale_options_handler. Also recommend re-organizing the code to make it a bit easier to reconnect to the Websocket without re-adding handlers.
Expected Behavior
Expected example to add handler to: add_nasdaq_book_handler
Actual Behavior
No data is generated
from tda.auth import easy_client
from tda.client import Client
from tda.streaming import StreamClient
import asyncio
import json
client = easy_client(
api_key='APIKEY',
redirect_uri='https://localhost',
token_path='/tmp/token.pickle')
stream_client = StreamClient(client, account_id=1234567890)
stream_client.add_nasdaq_book_handler(
lambda msg: print(json.dumps(msg, indent=4)))
async def read_stream():
await stream_client.login()
await stream_client.quality_of_service(StreamClient.QOSLevel.EXPRESS)
await stream_client.nasdaq_book_subs(['GOOG'])
while True:
await stream_client.handle_message()
asyncio.get_event_loop().run_until_complete(read_stream())
Metadata
Metadata
Assignees
Labels
No labels