alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.59k stars 374 forks source link

tickers exist on website but impossible to find with api #535

Open BWF88 opened 2 years ago

BWF88 commented 2 years ago

Hi, thanks for this great tool. I was looking around in the HK equity market and noticed that some tickers are recognized on the website but can't download the historical data using the api . For example, LI Auto Inc's ticker is 2015 and it is recognized on the investing.com website. But when I try to download the data with the api using python, I get the following error message: ERR#0018: stock 2015 not found, check if it is correct.

I'm not sure if this is due to a formatting problem or if it's more complex, but maybe other people would have similar issues so decided to raise a ticket.

OGsiji commented 2 years ago

Same here; this thread might help [((https://stackoverflow.com/questions/65323421/python-investpy-package-to-get-data-of-nifty50-index-get-stock-historical-dat))]

You can do a searching by the country using their api

OGsiji commented 2 years ago

ymyke commented 2 years ago

I wrote the tessa package to help with issues such as these. See here: https://github.com/alvarobartt/investpy/issues/557

In your case you could do:

from tessa import search, price_history
r = search("2015")
print(r["investing_searchobj_perfect"])
prices, currency = price_history(r["investing_searchobj_perfect"][1], "searchobj")