alvarobartt / investpy

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

Value Error with Get_stock_financial_summary #316

Open ducanh95pro opened 3 years ago

ducanh95pro commented 3 years ago

When I use function Investpy.Get_stock_financial_summary for a Vietnamese Stock, this error appeared: invalid literal for int() with base 10. Could someone please fix this, I think this one only appear to Vn stocks. Thanks in advance.

alvarobartt commented 3 years ago

Hi @ducanh95pro I was about to merge dev into master, but if you give me the details of the investpy call that you are using I'll be able to reproduce the issue and solve it before releasing the new version.

Thank you! :hugs:

ducanh95pro commented 3 years ago

This is the code i used to retrieve financial data for a Vietnamese company investpy.stocks.get_stock_financial_summary('vic','vietnam', summary_type='income_statement', period='annual')

alvarobartt commented 3 years ago

Thank you I'll check this rn before releasing the new version! 👍🏻

BTW you can simplify the function call to:

import investpy

result = investpy.get_stock_financial_summary(stock='vic',
                                              country='vietnam',
                                              summary_type='income_statement',
                                              period='annual')
ducanh95pro commented 3 years ago

By the way,

When i Call

investpy.get_stock_information('vic','vietnam')

This Error showed up:

ERR#0015: error 406, try again later.

This may be due to the fact that I have sent so many requests before and got blocked. Is there any way to address this or just simply wait until the block is removed,

Many Thanks

alvarobartt commented 3 years ago

Yes, sending too many calls will result in a block, this just happens for Investing.com Stocks. Apparently, there's nothing we can do to solve it, besides sending fewer requests (increase interval between requests) or use a rotating proxy, a VPN, or something similar.

You can search for 406 in the issues tab, as some users proposed intermediate solutions to this issue.

P.S. I'm already working on the original issue you opened! :muscle:

ducanh95pro commented 3 years ago

Cheers.

Thanks so much

alvarobartt commented 3 years ago

Hi again @ducanh95pro, this is what I get when I send the same request as you:

>>> import investpy
>>> result = investpy.get_stock_financial_summary(stock='vic',
...                                               country='vietnam',
...                                               summary_type='income_statement',
...                                               period='annual')
>>> result
            Total Revenue  Gross Profit  Operating Income  Net Income
Date                                                                 
2020-12-31    110462372.0   17281215.00       14601226.00  5126982.00
2019-12-31    130036014.0   37551217.00       15756406.00  7545915.00
2018-12-31    121894401.0   28950675.00       13615228.00  3823739.00
2017-12-31     89350048.6   26553721.64        9445186.69  4462411.67
alvarobartt commented 3 years ago

Are you sure that vic was the stock that you were using whenever you ran into that error? Can you please check? Thank you :+1: