alvarobartt / investpy

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

unidecode in get_fund_information makes fund naming inconsistent with funds in "funds" DataFrame #313

Closed romanminkoff closed 3 years ago

romanminkoff commented 3 years ago

Reproducer: investpy.get_fund_information("öhman Global Growth", "sweden") Error signature: ERR#0019: fund ohman global growth not found, check if it is correct. investing.com link: https://www.investing.com/funds/ohman-global-growth-company-profile

Problematic lines in funds.py: fund = unidecode(fund.strip().lower()) # << here unidecode replaces "ö"->"o" if fund not in list(funds['name'].str.lower()): # << however funds DataFrame contains "öhman Global Growth" name (with original "ö") raise RuntimeError("ERR#0019: fund " + fund + " not found, check if it is correct.")

Not sure if unidecode is really needed (default in python 3+). Majority of funds are not affected. Funds with "special characters" should probably keep original name for consistency reasons - and they do in funds DataFrame.

alvarobartt commented 3 years ago

Hi @romanminkoff, I get your point, but so as to make it simpler I just decided to "unidecode" everything so that you get the same information either introducing öhman Global Growth or ohman Global Growth, even though as you say, I may have messed up the static files so some cases those don't match! 😩

Let me check this later today and then I'll release the fixed investpy v1.0.4 release 🔥 Thanks for spotting this issue!

romanminkoff commented 3 years ago

Thank you!

alvarobartt commented 3 years ago

@romanminkoff, you can already install the new version as mentioned in https://twitter.com/alvarobartt/status/1377220835342176258 :fire:

pip install investpy==1.0.4

Hope this was useful to you! :sparkles: