Closed oda9 closed 3 years ago
Hi @oda9, you can just do the following to retrieve all the SearchObj
for the tickers you want to, using Investing.com search engine:
import investpy
results = list()
tickers = ["2631", "2982", "4060", "7356"]
for ticker in tickers:
try:
search_results = investpy.search_quotes(text=ticker, products=["stocks"], countries=["japan"], n_results=1)
print(search_results[0]) # DeprecationWarning: in investpy v1.0.4 if `n_results=1` just one result will be returned, not a list
results.append(search_results[0])
except Exception as e:
print(e)
continue
recent = results[0].retrieve_recent_data()
historical = results[0].retrieve_historical_data(from_date="01/01/2020", to_date="01/01/2021")
information = results[0].retrieve_information()
Then with each SearchObj
result, you can retrieve the recent data, historical data, or the information. For more information please check [investpy.search_quotes
wiki](https://github.com/alvarobartt/investpy/wiki/investpy.search_quotes()).
Let me know whether this worked for you or not! 🤗
If the solution provided above worked for you, please feel free to close this issue! 🤗
Thank you, @alvarobartt . There's just one problem.
2982,4060,7356 was able to retrieve the data.
However, 2631 was not able to retrieve the data.
2631is a Japanese ETF.
Are there different acquisition methods for ETFs?
Sure! You can either remove the products=['stocks']
or update it with products=['stocks', 'etfs']
. I shared that piece of code with you because referring to the original message I thought those were just stocks 👍🏻
P.S. Feel free to update any of the parameters, or don't use any in case you are using unique identifiers, let's say that those IDs are unique for Japan, you should be able to:
import investpy
search_results = investpy.search_quotes(text='whatever id', countries=['japan'], n_results=10)
Thank you, @alvarobartt .
I think I can get the data from this.
Thank you so much.
Hello there Stock prices of some Japanese stocks cannot be retrieved using "get_stock_historical_data" and "get_stock_recent_data".
Examples of codes that cannot be retrieved 2631 2982 4060 7356
How can I get the data?