tastyware/tastytrade

Greeks Request

Closed this issue · 1 comments

I'm attempting to perform a REST query to get the state of the Greeks for a list of contracts.
I created a list of symbols such as:

modded_subs_list = ['.SPXW231113C3550', '.SPXW231113P3550', '.SPXW231113C3600', '.SPXW231113P3600', '.SPXW231113C3650']

I pulled them directly from the streamer_symbol field from each of the get_option_chain() results.
This is the code I'm using to request the Greeks.

subbed_greeks = session.get_event(
    event_type=EventType.GREEKS, symbols=modded_subs_list)

but the error I get is:

content = response.json()['error']
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Please advise.

edit:
I also tried to use the symbols field for:

['SPXW  231113C03550000', 'SPXW  231113P03550000', 'SPXW  231113C03600000', 'SPXW  231113P03600000', 'SPXW  231113C03650000']

to pass into the get_event(Greeks) function but they failed with the same JSON decode error.

Figured it out. Cloned the repo and checked the response, was getting a 414 for too long of a URL for the server to process. The limit for a rest query is around 400 contracts at a time.