investopedia_simulator_api icon indicating copy to clipboard operation
investopedia_simulator_api copied to clipboard

Add better error handling for unquotable stocks.

Open jcdocka opened this issue 4 years ago • 2 comments

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?

jcdocka avatar Dec 06 '20 23:12 jcdocka

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)

dchrostowski avatar Feb 18 '21 07:02 dchrostowski

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

jcdocka avatar Mar 18 '21 00:03 jcdocka