Streaming Future Options Price Data With TD Ameritrade API In Python
Description
Here's how to quickly get real time streaming quotes for future options from the TD Ameritrade API in Python.
0:38 open the docs
1:07 import modules
1:26 authenticate and connect to TD API
1:50 create a queue to store data from stream
2:13 instantiate the queue
2:21 overview of read_stream() function
2:45 create a handler for the data
3:06 add handler
3:37 add level one futures options sub
3:43 add future option contract name to sub/unsub function
4:18 review close_stream() function
4:47 subscribe to future options data stream
5:00 unsubscribe from stream
After you've successfully set up your connection to the API, the most particular part is getting the correct contract name.
If you've seen the futures real time streaming video, you'll notice that the future option contract name is very different than the futures contract name.
For the futures contract, you might see a name like "/ESU22" but for a futures option contract you might see a name like "./EW1U22C3950"
Note, the name begins with a period.
Here's all the code from the video
https://github.com/AdamGetbags/streamingQuotesTDA/blob/main/streamingFuturesOptionsQuotesTDA.py https://github.com/AdamGetbags/streamingQuotesTDA/blob/main/secretsTDA.py
TDA API Documentation
https://tda-api.readthedocs.io/en/latest/streaming.html
TD for Developers
https://developer.tdameritrade.com/
- - -
Follow the podcast and join our larger community on Youtube to receive value on all things finance and technology!
https://www.youtube.com/c/adamgetbags
If you love the content, buy me a coffee!
https://www.buymeacoffee.com/adamgetbags
Keep up with me!
https://www.instagram.com/damgetbags
https://twitter.com/damgetbags
- - -
Need some ideas for your project portfolio?
Check out how to get historical option price data in Python from the Polygon API.
https://youtu.be/87O9qxfMJ-g
Here's how to quickly get crypto data in Python from the CoinGecko API
Here's how to create a SQL database from a Pandas DataFrame in Python
- - -
DISCLAIMER: The Information on Async Finance is provided for education and informational purposes only, without any express or implied warranty of any kind, including warranties of accuracy, completeness, or fitness for any particular purpose. The Information contained in or provided from or through Async Finance is not intended to be and does not constitute financial advice, investment recommendations, investment advice, trading advice, or any other advice. The Information on Async Finance is general in nature and is not specific to you the User or anyone else. You should not make any decision, financial, investment, trading, or otherwise, based on any of The Information presented on Async Finance without undertaking independent due diligence and consultation with a professional broker or financial advisory.