Closed arthur1993 closed 3 years ago
Hi @arthur1993 :fire:
As you may know, the investpy.search_quotes()
function uses the Investing.com search engine so as to retrieve any financial product, but as you may know, the investpy.get_funds_historical_data()
(applies to any data retrieval function in investpy
) retrieves the information from Investing.com based on the IDs stored in the static CSV files.
That means that investpy.search_quotes()
contains ALL the information available at Investing.com while all the other functions just some of them, since the Investing.com indexing is tricky and it's hard to keep the script up to date...
So I highly recommend you to just use the investpy.search_quotes()
function if the financial product you are looking for is not available in the static CSV files (the error you shared above).
:pushpin: Make sure that you are using the latest investpy version! investpy v1.0.6
Also, in order to retrieve either the recent data, historical data, or the information, you can use the SearchObj
class methods! Here's an example of how to do that:
import investpy
search_result = investpy.search_quotes(text='XIN', products=['stocks'], countries=['United States'], n_results=1)
recent_data = search_result.retrieve_recent_data()
historical_data = search_result.retrieve_historical_data(from_date='01/01/2020', to_date='01/01/2021')
information = search_result.retrieve_information()
To further explore the functionality of investpy.search_quotes()
please check [Wiki - investpy.search_quotes()](https://github.com/alvarobartt/investpy/wiki/investpy.search_quotes())
Please find below a simple case illustrated. The symbol "XIN" is returned by the
search_quotes
method, butget_stock_recent_data
is unable to get data for this it.After having a look at the code behind both method I realized one (
search_quotes
) was directly relying on the search results of Investying, while another one (get_stock_recent_data
) was relying directly on thestocks.csv
file. In my opinion this shouldn't happen, only a single source of data should exist across the whole module.