jessecooper / pyetrade

Python E-Trade API Wrapper
GNU General Public License v3.0
205 stars 96 forks source link

get_quote for an option call returns the put #83

Closed AdoNunes closed 1 year ago

AdoNunes commented 1 year ago

I am requesting a quote for an option call but insteall I get the put:

market_session.get_quote(['LOVE:2023:07:21:C:30'],resp_format='json')['QuoteResponse']['QuoteData'][0]['Product']

returns me: {'symbol': 'LOVE', 'securityType': 'OPTN', 'callPut': 'PUT', 'expiryYear': 2023, 'expiryMonth': 7, 'expiryDay': 21, 'strikePrice': 30.0}

how is it possible? Am I doing something wrong?

AdoNunes commented 1 year ago

I found the issue: market_session.get_quote(['LOVE:2023:07:21:anything:30'],resp_format='json')['QuoteResponse']['QuoteData'][0]['Product'] any value except Call will return a Put, probably there is a condition if == "Call" else Put :) so to get a call you have to spell it out: 'LOVE:2023:07:21:Call:30'