investopedia_simulator_api
investopedia_simulator_api copied to clipboard
Add better error handling for unquotable stocks.
Some stocks that I search using quote come back as either "unable to parse quote" e.g. GMBL,WW,XYF, etc. or "unable to get quote for" e.g. TCTL, TTAC
Thoughts?
Sorry it took me a while to look into this. So I attempted to get quotes for the 5 stocks you mentioned there. I was able to get quotes back for GMBL, WW, and XYF and got parse failures on TCTL and TTAC.
I'm blaming the failures for TCTL and TTAC on Investopedia. If you go and try to order TCTL or TTAC on their site, no results show up..
Can you reproduce your issue? Here's basically what I did to test your issue. GMBL, WW, and XYF returned quotes as expected, and TCTL and TTAC did not, also as expected.
client = InvestopediaApi(credentials)
p = client.portfolio
quotes_to_test = ['GMBL','WW','XYF','TCTL','TTAC']
for quote in quotes_to_test:
try:
result = client.get_stock_quote(quote)
if result is not None:
print(result.__dict__)
except Exception as err:
print(err)
Attached is the list of stocks I could not get to parse. I checked a couple of these the way you did, via the trade (they did not show up), but they did have a quote page for them, which is weird.
parse.txt