alvarobartt / investpy

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

get_stock_information returning error #460

Closed mesoclever closed 2 years ago

mesoclever commented 2 years ago

The get_stock_information function is returning an error for a particular stock.

import investpy

# working fine
data = investpy.get_stock_information('HWAJ','south africa')
print(data)

# error
data = investpy.get_stock_information('IAPJ','south africa')
print(data)

Output

 Stock Symbol  Prev. Close Todays Range Revenue  Open 52 wk Range EPS  Volume Market Cap Dividend (Yield)  Average Vol. (3m) P/E Ratio Beta 1-Year Change  Shares Outstanding Next Earnings Date
0         HWAJ         51.0        51-51       -  51.0         0-0   -     0.0      1.28M         N/A(N/A)             5088.0         -    -        56.86%         183757366.0                  -
Traceback (most recent call last):
  File "/home/zar/code/python/test5.py", line 6, in <module>
    data = investpy.get_stock_information('IAPJ','south africa')
  File "/home/zar/.local/lib/python3.9/site-packages/investpy/stocks.py", line 1101, in get_stock_information
    raise ConnectionError("ERR#0015: error " + str(req.status_code) + ", try again later.")
ConnectionError: ERR#0015: error 404, try again later.
alvarobartt commented 2 years ago

Hi @suracoza, thanks for reporting this issue :hugs:

Let me check it and I'll share the outcome later with you!

alvarobartt commented 2 years ago

BTW could you test the function above with the following piece of code instead?

import investpy

search_result = investpy.search_quotes(text="IAPJ", products=["stocks"], countries=["south africa"], n_results=1)
print(search_result)
information = search_result.retrieve_information()
print(information)
alvarobartt commented 2 years ago

OK, it does work with the last piece of code that I sent you, I just need to test the function above, but since that function is directly using the static files (that haven't been updated in a while) some information there may be wrong. So on, I'll study this in the background, but feel free to re-open this issue if you have more information about it!