alvarobartt / investpy

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

"Hang Seng TECH" indics not found in investpy.indices.get_indices(country='hong kong') #536

Open jimmylai-hk opened 2 years ago

jimmylai-hk commented 2 years ago

Hi,

FIrst of all, many thanks for your excellent contribution.

I'm able to find the Hang Seng TECH indics in the link below.

https://www.investing.com/indices/hang-seng-tech-historical-data

and able to see the the overview by using the following API.

investpy.indices.get_indices_overview('hong kong', as_json=False, n_results=10)

Below is the extracted result.

8 | hong kong | Hang Seng TECH | 4527.83 | 4613.66 | 4455.17 | -210.10 | -4.43% | HKD

However, when I use the following API, it cannot get the corresponding item

investpy.indices.get_indices(country='hong kong')

i.e. No such item related to Hang Seng Tech

and using the following cannot get the data

investpy.indices.get_index_historical_data('Hang Seng TECH', 'hong kong', '1/1/2022', '3/1/2022', as_json=False, order='ascending', interval='Daily')

The error message as follow.


RuntimeError Traceback (most recent call last)

in () ----> 1 investpy.indices.get_index_historical_data('Hang Seng TECH', 'hong kong', '1/1/2022', '3/1/2022', as_json=False, order='ascending', interval='Daily') ~\Anaconda3\lib\site-packages\investpy\indices.py in get_index_historical_data(index, country, from_date, to_date, as_json, order, interval) 511 512 if index not in list(indices['name'].apply(unidecode).str.lower()): --> 513 raise RuntimeError("ERR#0045: index " + index + " not found, check if it is correct.") 514 515 full_name = indices.loc[(indices['name'].apply(unidecode).str.lower() == index).idxmax(), 'full_name'] RuntimeError: ERR#0045: index hang seng tech not found, check if it is correct.