alvarobartt / investpy

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

Getting the error for some symbols #374

Closed guberm closed 3 years ago

guberm commented 3 years ago

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import investpy investpy.technical.moving_averages(name='tnt_u', country='canada', product_type='stock', interval='daily') period sma_value sma_signal ema_value ema_signal 0 5 7.23 buy 7.24 buy 1 10 7.22 buy 7.22 buy 2 20 7.16 buy 7.17 buy 3 50 7.01 buy 6.99 buy 4 100 6.68 buy 6.75 buy 5 200 6.32 buy 6.56 buy

investpy.technical.moving_averages(name='fcr_u', country='canada', product_type='stock', interval='daily') Traceback (most recent call last): File "", line 1, in File "c:\WSTradingPythonScripts\investpy\technical.py", line 274, in moving_averages raise ValueError("ERR#0122: introduced name does not exist in the introduced country (if required).") ValueError: ERR#0122: introduced name does not exist in the introduced country (if required).

2021-05-15_12-51-00

alvarobartt commented 3 years ago

Hi @guberm, thanks for spotting this issue!

In this case, the issue is obviously missing data in the static CSV files, but I think that I can easily solve it by replacing the static CSV files with the Investing.com search engine for the technical functions in investpy, so that the symbols are searched in Investing.com rather than just among the static ones!

I'll create a new branch of master named static-files-deprecation so as to stop relying on the static files as updating them is not that straightforward...

Thanks again for this proposal, the investpy.technical functions will be the first functions where I test this new approach, so this means that if everything goes as expected later this week you will have a new investpy release available so that you can give me feedback about this new approach! 👍🏻

alvarobartt commented 3 years ago

Hi @guberm! I'll be solving this in the next release investpy v1.0.7 so that you can retrieve the technical indicators of every financial product available in Investing.com through investpy.search_quotes, lets say something similar to the following piece of code:

import investpy

isin = 'IE00BDQZ5152'
search_result = investpy.search_quotes(text=isin, n_results=1)

indicators = search_result.retrieve_technical_indicators()
guberm commented 3 years ago

@alvarobartt thanks, do you have an expected date for the release?

alvarobartt commented 3 years ago

Sure @guberm it will be later this week, so as to get notified of all the updates make sure to check the current milestone's progress, and if you want more details/insights feel free to follow me on Twitter at https://twitter.com/alvarobartt

guberm commented 3 years ago

@alvarobartt you are the best, thanks :-)

alvarobartt commented 3 years ago

Hi @guberm I'm glad to inform you that this feature has already been developed in the dev branch as part of the current milestone before the investpy v1.0.7 release, so this feature will be available later this weekend so you just need to stay tuned for updates :fire:

The intended usage of this new functionality integrated with investpy.search_quotes() will be as it follows:

>>> import investpy
>>> data = investpy.search_quotes('bbva', products=['funds'], n_results=1)
>>> tech = data.retrieve_technical_indicators()
>>> tech
              indicator           signal     value
0               RSI(14)              buy   61.0810
1            STOCH(9,6)          neutral   48.7880
2          STOCHRSI(14)       overbought  100.0000
3           MACD(12,26)          neutral    0.0000
4               ADX(14)       overbought  100.0000
5           Williams %R       overbought    0.0000
6               CCI(14)       overbought  215.0252
7               ATR(14)  less_volatility    0.0053
8        Highs/Lows(14)              buy    0.0172
9   Ultimate Oscillator       overbought   72.1490
10                  ROC              buy    2.2470
11  Bull/Bear Power(13)              buy    0.0316

Note that the previous function investpy.technical_indicators() was retrieving those indicators based on the static files information, that is a little bit outdated, so using investpy.search_quotes() you'll get the latest information for every single financial product available in Investing.com. Also note that previously the column containing the technical indicator name was named 'technical_indicator' whilst now it's been renamed to 'indicator'.

Thanks for your support! :+1:

alvarobartt commented 3 years ago

Hi @guberm, the new release is already out! :fire:

You can already install it using either pip install investpy==1.0.7 or just update the current version that you are using with pip install investpy --upgrade. Thanks a lot for your support! :+1:

For more information about this new release, you should check investpy v1.0.7 Release :balloon: