alexgolec/tda-api

Options Time And Sales

Closed this issue · 3 comments

Please read the bug submission guidelines before submitting a bug.

Not following guidelines may result in your bug being ignored and/or closed.

Description of Bug
timesale_options_subs() does not return the options data. I am requesting during live market hours.

Code to Reproduce

from tda.auth import easy_client
from tda.client import Client
from tda.streaming import StreamClient

import asyncio
import pandas as pd


client = easy_client(
    api_key="IFGR3RGYT3YTV4L3V433YL43Y43L4V3Y",  #Fake
    redirect_uri="https://localhost",
    token_path="token.pickle")
stream_client = StreamClient(client, account_id=123456789)

def order_book_handler(msg):
    df = pd.DataFrame(msg["content"])
    print (df)

async def read_stream():
    await stream_client.login()
    await stream_client.quality_of_service(StreamClient.QOSLevel.EXPRESS)
    await stream_client.timesale_options_subs(['SPY'])

    stream_client.add_timesale_options_handler(order_book_handler)

    while True:
        await stream_client.handle_message()

try:
    asyncio.get_event_loop().run_until_complete(read_stream())
except KeyboardInterrupt:
    print("Stopped")

Expected Behavior
Should return data in Pandas DataFrame.

Actual Behavior
Does not return anything.

Error/Exception Log, If Applicable
See here to learn how to turn on debug logging: https://tda-api.readthedocs.io/en/latest/help.html

Does this give sufficient explanation? Please let me know If you want me to provide more details.

Unfortunately, options time and sales data does not appear to be available at the moment. Streams will connect but to date no one I know of has ever received any data.

Thanks for letting me know, Alex. I tried many things.