Closed dougbrowning closed 8 months ago
I tried looking at the web requests for this in a browser. If I enter that symbol in the quote bar at the bottom of the webpage, it says "Please enter a valid symbol." If I enter that symbol on the All-In-One Trade Ticket page, it says "Quotes are unavailable. Only limit/stop limit orders are accepted." and "This account is not approved to trade options." This is not surprising, since I never had any reason to get approved to trade options in my Schwab accounts. So I may not be able to help debug this. I even tried changing the AccountRegType from S1 to S3 with no change in the result.
Coincidentally, the internal browser request to the relevant url returns 500: InternalServerError "Server Error - Error while getting quotes", which is similar to the error message returned from the code that you posted in the other thread.
What happens when you try getting this quote in the All-In-One Trade Ticket on the webpage? Do you perhaps only have one account approved for options? In that case, maybe the request would need to be sure to specify that account. Just throwing out ideas.
Thanks a lot. This was working before he changed the code to _V2 so I think it is the code and not my account.
I eventually found the place on the website other than the order ticket that retrieves options quotes using the same endpoint/url as the code (Research -> Options, enter a symbol on that page, click on Options just below that entry box, then click on a particular bid or ask). There I noticed that their request uses three spaces between SPY and the option specification. I tried that, and it works for me regardless of my options access (and with any different number of spaces it fails with the same error that you received regardless of my options access):
api.quote_v2(["SPY 240216C00475000"])
After some additional trial and error, it looks like the option specification must start at the seventh character with spaces in between, i.e.:
api.quote_v2(["F 240216C00012000"])
api.quote_v2(["TSLA 240216C00255000"])
Yes that is what I had. As I keep testing it sometimes brings me back a quote and sometimes I just get this. Well pretty much it works the first run then stops working and I just get back blank.
from quotes = api.quote_v2(["SPY 231226C00475000"]) pprint.pprint(quotes) I get ([''], False)
The code you pasted does not have three species between SPY and 231226C00475000, so it's not clear that you tried what I suggested.
If your comments aren't preserving your exact code, it would be helpful if you would double check those as you post so we can figure this out.
Yes looks like it removed the extra spaces. It is exactly 3. It worked the first try then stops.
`quotes = api.quote_v2(["SPY 231226C00475000"])
pprint.pprint(quotes)`
Strange. I'm unable to reproduce any errors with api.quote_v2(["SPY 231226C00475000"])
, even with repeated calls. I've tried calling it in a for loop with a delay, in a for loop without a delay, and several times in an IPython session. I tried with a fresh install of v0.3.5 in a fresh miniconda python 3.12 environment, as well as in a python 3.9 environment that has a variety of other packages installed.
Sorry I couldn't help.
Ok I think i see what is going on it is getting back only my roth ira now and not both my accounts in the login like it was before. Any ideas how to fix that? account_info = api.get_account_info() pprint.pprint(account_info)
Not sure if that is part of the problem but the call option you posted initially was with expiration on december 19th 2023 and you posted on december 22 2023. By then, the option call already expired.
I guess you must not see closed cases posts so repost.
I see the difference now. The options are what stopped working quotes = api.quote_v2(["SPY 231219C00474000"]) does not work quotes = api.quote_v2(["SPY"]) does work.
Did you change the format for options?
thanks