selnomeria Feb 7th, 2020 (edited) 74 in 212 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import requests
- from td.client import TDClient
- TDSession = TDClient(account_number = 'xxxxxxxxxxxxx',
- account_password = 'xxxxxxxxxxxxxxx',
- consumer_id = 'xxxxxxxxxxxxxxxx',
- redirect_uri = 'http://localhost'
- # Login to the session
- # Create a streaming sesion
- TDStreamingClient = TDSession.create_streaming_session()
- TDStreamingClient.timesale(service = 'TIMESALE_EQUITY', symbols = ['AMZN'], fields = [0,1,2,3])
- for request in TDStreamingClient.data_requests['requests']:
- # Stream it.
- data = TDStreamingClient.stream()
RAW Paste Data