Open boi-led-egg opened 5 years ago
A small update with more info. I dug into the code, specifically https://github.com/jmfernandes/robin_stocks/blob/master/robin_stocks/options.py#L262 added print(item) before get_option_market_data_by_id(where it fails inside) Also added skipping the cycle if that request was unsuccessful, to see what other items look like. Here's what a failed item looks like:
"issue_date": "1987-01-12",
"tradability": "tradable",
"strike_price": "150.0000",
"state": "active",
"url": "https://api.robinhood.com/options/instruments/35f92590-b047-4a7a-8256-30e470da4c48/",
"expiration_date": "2019-11-22",
"created_at": "2019-11-20T01:05:50.822956Z",
"chain_id": "9b27bd90-041d-4994-8934-4fac29c00ceb",
"updated_at": "2019-11-20T01:05:50.822964Z",
"rhs_tradability": "untradable",
"type": "call",
"chain_symbol": "JPM",
"min_ticks": {
"cutoff_price": "3.00",
"below_tick": "0.01",
"above_tick": "0.05"
},
"id": "35f92590-b047-4a7a-8256-30e470da4c48"
}
All other were successful, they had item like this:
{
"issue_date": "1987-01-12",
"tradability": "tradable",
"strike_price": "149.0000",
"state": "active",
"url": "https://api.robinhood.com/options/instruments/0903ac21-6d94-455a-b74d-c3372638aef9/",
"expiration_date": "2019-11-22",
"created_at": "2019-11-12T01:04:31.785395Z",
"chain_id": "9b27bd90-041d-4994-8934-4fac29c00ceb",
"updated_at": "2019-11-12T01:04:31.785402Z",
"rhs_tradability": "untradable",
"type": "call",
"chain_symbol": "JPM",
"min_ticks": {
"cutoff_price": "3.00",
"below_tick": "0.01",
"above_tick": "0.05"
},
"id": "0903ac21-6d94-455a-b74d-c3372638aef9"
}
The failed one has "updated_at": "2019-11-20T01:05:50.822964Z", all others have this much older. I live in Pacific Time zone, and it's Nov 19, 23:28 right now. I guess that time is UTC. Don't know if it can cause any troubles, but that's the only significant difference in input data.
Oh, and this is what RobinHood itself showing for this option(strike price 150) https://drive.google.com/open?id=1cfLvnGVx33kfwO6ipKBnu0RqoXpHXfH3 Not much.
Thanks for bringing this to my attention. Will look into it.
Has there been any fix to this? I'm running into the same issue. Do I just need to run my code in the morning or something?
@stephen-nguyen do you still get this error when using the new find_options_by_expiration() function?
@stephen-nguyen do you still get this error when using the new find_options_by_expiration() function?
I'm still getting the error
Sometimes, for some stocks find_options_for_list_of_stocks_by_expiration_date function would fail. For example:
Result:
It would work on one day, but not the other. Would work with other symbols just fine. I have robin-stocks==0.9.9.5, Python 3.6.8 right now.