Open jkshah opened 5 years ago
I have also had this issue. I think it narrows down to the filters item['rhs_tradability'] == 'tradable'
in options.py. If you look at the result from find_tradable_options_for_stock()
almost every "rhs_tradability" key is "untradable", therefore getting filtered out. I've done a little research for what "rhs_tradability" is (which is different from the "tradability" key), and no one online really seems to have an idea. My recommendation would be to change "rhs_tradability" to just use the "tradability" key, just so it works.
This issue is on the last day(expiration date) RH does NOT allow anyone to open a new position. The current design of find option / helper code - could NOT return. Instead for every option on last day of expiration date - the API can return "Last day cannot open position since it is NOT tradable. Secondly, when the API is with option "effect: close", we can do lookup for the id on the list of open positions and close. Have potential fix - will commit it over weekend shortly.
@shobnaren awesome. If I can make a suggestion, the function should return a dictionary with the key/value pair of 'details':'last day cannot open blah blah'. Just to keep it consistent with the rest of the api. I believe whenever there is an issue with a request, robinhood always returns the info under the 'details' key
Yes more than that if we are considering our robin_stocks as library only and any application to use it.. we can create custom exceptions - which will force the client application (uses robin_stocks library) to handle it better.
Will discuss with you on the same for the commit for next week. will add enhancement for the same.
I am doing the following which I think is valid but the API returns None
robin_stocks.options.find_options_for_stock_by_expiration("MSFT","2019-07-26",optionType="call")
Found Additional pages. Loading page 2 ... Loading page 3 ... Loading page 4 ... Loading page 5 ... Loading page 6 ... Out[101]: [None]