alvarobartt / investpy

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

RuntimeError: ERR#0004: data retrieval error while scraping. #394

Closed jundaaaaa closed 3 years ago

jundaaaaa commented 3 years ago

I was trying to pull some historical data from Equities and I hit the above error. Upon checking, I believe it could be due to bad request pull but not so sure. The following code was used to pull the data.

investpy.get_stock_historical_data(stock='GENT', country='Malaysia', from_date='01/01/2000', to_date='11/06/2021')

alvarobartt commented 3 years ago

Hi @jundaaaaa I've just tested the function call that you sent and it works like charm! See below:

>>> import investpy
>>> data = investpy.get_stock_historical_data(stock='GENT', country='Malaysia', from_date='01/01/2000', to_date='11/06/2021') 
>>> data
             Open   High    Low  Close    Volume Currency
Date                                                     
2011-08-15  10.10  10.16  10.08  10.14   6486200      MYR
2011-08-16  10.18  10.24  10.02  10.10   3161900      MYR
2011-08-17  10.10  10.10  10.02  10.04   5405500      MYR
2011-08-18  10.14  10.14   9.97   9.98   5352500      MYR
2011-08-19   9.85   9.85   9.65   9.70  11566900      MYR
...           ...    ...    ...    ...       ...      ...
2021-06-04   5.09   5.10   5.01   5.06   6568300      MYR
2021-06-08   5.10   5.21   5.09   5.18  11113000      MYR
2021-06-09   5.16   5.24   5.11   5.14   6606000      MYR
2021-06-10   5.15   5.20   5.12   5.15   3689300      MYR
2021-06-11   5.14   5.19   5.10   5.13   3250900      MYR

[2408 rows x 6 columns]

So the issue is probably from your side, probably due to an outdated investpy version, so please make sure that you install the latest version which is investpy v1.0.6 :fire:

pip install investpy --upgrade