alvarobartt / investpy

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

Unable to get Italian ETFs data #225

Open RobertoPaolinelli opened 4 years ago

RobertoPaolinelli commented 4 years ago

Hello, I'm trying to fetch italian ETF and I always come into an error

df = investpy.get_etf_recent_data(etf='WisdomTree Physical Gold',country='italy') Traceback (most recent call last): File "", line 1, in File "C:\Users\rpao\AppData\Local\Programs\Python\Python38-32\lib\site-packages\investpy\etfs.py", line 279, in get_etf_recent_data raise RuntimeError("ERR#0019: etf " + etf + " not found, check if it is correct.") RuntimeError: ERR#0019: etf wisdomtree physical gold not found, check if it is correct.

Anyway: wouldn't it be better using ISIN code or ticker (symbol)?

Thank you very much

P.S. With italian stocks it has worked

MrDrinkwater commented 3 years ago

I'm also having problems to retrieve ETF data.

For instance, the SPDR® MSCI World UCITS ETF (SPPW) https://www.investing.com/etfs/spdr-msci-world-ucits-lse-usd?cid=1165086

ETF = investpy.get_etf_historical_data(etf = 'SPWW', country = 'germany', from_date='01/01/2020', to_date='31/12/2020')

I always get this error: RuntimeError: ERR#0019: etf spww not found in germany, check if it is correct.

I tried using fund name, isin, wkn and symbol, but without success. What one should pass to the get_etf_historical_data function?

rick-62 commented 3 years ago

investpy relies on static CSVs for names, symbols and investing.com urls etc. These CSVs are under resources in the code. Check them out to verify the name you are using for the ETF, and what is available.

Unfortunately SPWW is not available. Instead you would need to use SWRD for the Milan/Amsterdam stock exchange. The data looks the same on investing.com. The ISIN and currency are the same.

RobertoPaolinelli commented 3 years ago

investpy relies on static CSVs for names, symbols and investing.com urls etc. These CSVs are under resources in the code. Check them out to verify the name you are using for the ETF, and what is available.

Thank you for your kind reply: I will check it! How often is the CSV updated? Can every contributor update it?

Best Regards

rick-62 commented 3 years ago

@RobertoPaolinelli

I had a look at the CSVs and looks like they were last updated about 10 months ago, but the most stable release was August 2020. I don't see why we couldn't contribute, although it's unclear where the data originated from, and whether they have been generated automatically.

I'd recommend also specifying the stock_exchange as an additional argument, if possible. This would ensure you have the best chance of selecting the most relevant ETF. As far as I am aware there is no way to specify the currency, so sometimes you may end up with the wrong currency.

RobertoPaolinelli commented 3 years ago

@rick-62 I agree. It looks like this project is nearly still...

Il giorno mar 26 gen 2021 alle ore 21:32 rick-62 @.***> ha scritto:

@RobertoPaolinelli https://github.com/RobertoPaolinelli

I had a look at the CSVs and looks like they were last updated about 10 months ago, but the most stable release was August 2020. I don't see why we couldn't contribute, although it's unclear where the data originated from, and whether they have been generated automatically.

I'd recommend also specifying the stock_exchange as an additional argument, if possible. This would ensure you have the best chance of selecting the most relevant ETF. As far as I am aware there is no way to specify the currency, so sometimes you may end up with the wrong currency.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alvarobartt/investpy/issues/225#issuecomment-767810030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKVDVHSMTDWZQFXPC46KTS34RG7ANCNFSM4SB7B56A .

-- Ing. Roberto Paolinelli Electronics Engineering & Consulting P.IVA (Vat Number): IT 02643190420 Tel: +39 347/5308468

http*://*it.linkedin.com/in/RobertoPaolinelli http://it.linkedin.com/in/RobertoPaolinelli

skype: roberto_paolinelli

alvarobartt commented 3 years ago

Hi @RobertoPaolinelli, @MrDrinkwater, and @rick-62, I'm sorry to hear that you are having so many problems, the frequency update of the data is still an ongoing issue for us and we are working so as to solve it in order to provide a way to automatically update the data let's say once a month or so, but it's a hard thing to do as Investing.com data indexing is not complete, and, so on, hard to retrieve.

Anyway, just to let you know that you can always use investpy.search_quotes() function to retrieve all the data available in Investing.com in a transparent way. Here's how to use it [investpy.search_quotes() - Wiki](https://github.com/alvarobartt/investpy/wiki/investpy.search_quotes()).

:pushpin: For your concrete example it should be something similar to:

import investpy

for search_result in investpy.search_quotes(text="WisdomTree Physical Gold", products=["etfs"], countries=["Italy"]):
    print(search_result)
    historical_data = search_result.retrieve_historical_data(from_date="01/01/2020", to_date="01/01/2021")
    print(historical_data.head())

Note that the input text can be anything, as this function uses Investing.com search engine, which means that you can input anything you like you do on the Investing.com website.

Hope this was useful to you! :star:

RobertoPaolinelli commented 3 years ago

Thank you so much for kind reply We will try it asap Best Regards

Il giorno ven 26 mar 2021 alle ore 10:35 Álvaro Bartolomé < @.***> ha scritto:

Hi @RobertoPaolinelli https://github.com/RobertoPaolinelli, @MrDrinkwater https://github.com/MrDrinkwater, and @rick-62 https://github.com/rick-62, I'm sorry to hear that you are having so many problems, the frequency update of the data is still an ongoing issue for us and we are working so as to solve it in order to provide a way to automatically update the data let's say once a month or so, but it's a hard thing to do as Investing.com data indexing is not complete, and, so on, hard to retrieve.

Anyway, just to let you know that you can always use investpy.search_quotes() function to retrieve all the data available in Investing.com in a transparent way. Here's how to use it investpy.search_quotes()

📌 For your concrete example it should be something similar to:

import investpy

for search_result in investpy.search_quotes(text="WisdomTree Physical Gold", products=["etfs"], countries=["Italy"]):

print(search_result)

historical_data = search_result.retrieve_historical_data(from_date="01/01/2020", to_date="01/01/2021")

print(historical_data.head())

Note that the input text can be anything, as this function uses Investing.com search engine, which means that you can input anything you like you do on the Investing.com website.

Hope this was useful to you! ⭐

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alvarobartt/investpy/issues/225#issuecomment-808072576, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKVDSMXJX5Z4F7IY53GALTFRIPPANCNFSM4SB7B56A .

-- Ing. Roberto Paolinelli Electronics Engineering & Consulting P.IVA (Vat Number): IT 02643190420 Tel: +39 347/5308468

http*://*it.linkedin.com/in/RobertoPaolinelli http://it.linkedin.com/in/RobertoPaolinelli

skype: roberto_paolinelli

eracle commented 3 years ago

Hi there, @alvarobartt unfortunately this too seems to be broken, here's the output:

{"id_": 951523, "name": "WisdomTree Physical Gold - EUR Daily Hedged", "symbol": "GBSE", "country": "italy", "tag": "/etfs/etfs-eur-daily-hedged-phys-gold-mi", "pair_type": "etfs", "exchange": "Milan"}
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-32-5a90d7489cc9> in <module>()
      4     print(search_result)
      5     historical_data = search_result.retrieve_historical_data(from_date="01/01/2020", to_date="01/01/2021")
----> 6     print(historical_data.head())

AttributeError: 'NoneType' object has no attribute 'head'