atreadw1492 / yahoo_fin

Scrape stock price history from new (Spring 2017) Yahoo Finance layout
MIT License
286 stars 125 forks source link

get_quote_data() Error on REITs #45

Closed smartelli3000 closed 3 years ago

smartelli3000 commented 3 years ago

When using get_quote_data() to get information of a REIT I'm getting this error: 'IndexError: list index out of range'

When I manually request this information directly from the site("https://query1.finance.yahoo.com/v7/finance/quote?symbols=") I get: '{"quoteResponse":{"result":[],"error":null}}'

What are your thoughts to work around this issue? Thanks

smartelli3000 commented 3 years ago

I solved this issue. The devil is in the ticker notation. I was searching 'AP.UN.TO', and was getting an error. It worked when I searched 'AP-UN.TO'.

This is because yahoo finance has it as '-UN', not '.UN'.

Hope this helps someone in the future.