alvarobartt / investpy

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

investpy not working . #463

Closed ajit1310 closed 2 years ago

ajit1310 commented 2 years ago

alvarobartt ,

I am not sure this is with me only . I think whole investpy not working now .

File "C:\Python38\lib\site-packages\investpy\stocks.py", line 559, in get_stock_historical_data raise ConnectionError("ERR#0015: error " + str(req.status_code) + ", try again later.") ConnectionError: ERR#0015: error 429, try again later.

alvarobartt commented 2 years ago

Hi @ajit1310 I've tested it as you mentioned in a previous issue and it works for me, so you may need to stop sending requests for some hours so that your IP gets removed from the backlist, as currently you're blocked by Investing.com 😢 So either try using a VPN or just wait until you're free to send more requests...

And for the next time you send requests as a suggestion, just try to limit the time between requests so that Investing.com doesn't blackslists your IP again!

nuwandwo commented 2 years ago

Hi @ajit1310 I've tested it as you mentioned in a previous issue and it works for me, so you may need to stop sending requests for some hours so that your IP gets removed from the backlist, as currently you're blocked by Investing.com 😢 So either try using a VPN or just wait until you're free to send more requests...

And for the next time you send requests as a suggestion, just try to limit the time between requests so that Investing.com doesn't blackslists your IP again!

@alvarobartt Can you please help me on this !! . I do have same issue .

image

alvarobartt commented 2 years ago

Hi @nuwandwo, as I said that's because you sent way too many requests in a short period of time and Investing.com blocked your IP 😕 Because I tried it myself and it worked!

See the code below:

>>> import investpy
>>> search_result = investpy.search_quotes(text="RILP", products=["stocks"], countries=["sri lanka"], n_results=1)
>>> print(search_result)
{"id_": 1162297, "name": "R I L Property PLC", "symbol": "RILP", "country": "sri lanka", "tag": "/equities/r-i-l-property-plc", "pair_type": "stocks", "exchange": "Colombo"}
>>> data = search_result.retrieve_historical_data(from_date="26/10/2020", to_date="26/10/2021")
>>> data
            Open  High  Low  Close   Volume  Change Pct
Date                                                   
2020-10-26   6.6   7.5  6.5    7.2  3306295        1.41
2020-10-27   7.4   7.7  7.2    7.4  3919987        2.78
2020-10-28   7.5   7.5  6.8    7.2  2922617       -2.70
2020-10-29   7.2   7.6  6.9    7.6  2735177        5.56
2020-11-02   7.5   7.8  7.2    7.7  2961735        1.32
...          ...   ...  ...    ...      ...         ...
2021-10-18   8.8   8.9  8.5    8.7  2819871       -1.14
2021-10-21   8.7   8.7  8.4    8.6  2696871       -1.15
2021-10-22   8.6   8.7  8.5    8.7  1576936        1.16
2021-10-25   8.7   8.7  8.5    8.7  1771671        0.00
2021-10-26   8.6   8.8  8.6    8.8  1126513        1.15

[240 rows x 6 columns]