Closed guberm closed 3 years ago
Can you check whether you updated the investpy
version or not? As I checked everything and it worked properly...
Thanks! :+1:
C:\Users\michael.guber>pip install --upgrade git+https://github.com/alvarobartt/investpy.git@master Collecting git+https://github.com/alvarobartt/investpy.git@master Cloning https://github.com/alvarobartt/investpy.git (to revision master) to c:\users\michael.guber\appdata\local\temp\pip-req-build-03y9ofsj Running command git clone -q https://github.com/alvarobartt/investpy.git 'C:\Users\michael.guber\AppData\Local\Temp\pip-req-build-03y9ofsj' Requirement already satisfied: Unidecode>=1.1.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\unidecode-1.2.0-py3.9.egg (from investpy==1.0.6) (1.2.0) Requirement already satisfied: setuptools>=41.2.0 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from investpy==1.0.6) (56.0.0) Requirement already satisfied: numpy>=1.17.2 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\numpy-1.20.2-py3.9-win-amd64.egg (from investpy==1.0.6) (1.20.2) Requirement already satisfied: pandas>=0.25.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from investpy==1.0.6) (1.2.4) Requirement already satisfied: lxml>=4.4.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\lxml-4.6.3-py3.9-win-amd64.egg (from investpy==1.0.6) (4.6.3) Requirement already satisfied: requests>=2.22.0 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from investpy==1.0.6) (2.25.1) Requirement already satisfied: pytz>=2019.3 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\pytz-2021.1-py3.9.egg (from investpy==1.0.6) (2021.1) Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\python_dateutil-2.8.1-py3.9.egg (from pandas>=0.25.1->investpy==1.0.6) (2.8.1) Requirement already satisfied: six>=1.5 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\six-1.15.0-py3.9.egg (from python-dateutil>=2.7.3->pandas>=0.25.1->investpy==1.0.6) (1.15.0) Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (4.0.0) Requirement already satisfied: idna<3,>=2.5 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (2.10) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (1.26.4) Requirement already satisfied: certifi>=2017.4.17 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (2020.12.5)
And still not working after that? 🤨 Let me check it in a while then, but both the tests that I manually run and the pytest
ones seem to be working fine...
Very strange :-( did you try to run my query?
Yes, indeed check this out:
Python 3.6.12 |Anaconda, Inc.| (default, Sep 8 2020, 17:50:39)
[GCC Clang 10.0.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import investpy
>>> data = investpy.technical.moving_averages(name='WELL', country='Canada', product_type='stock', interval='daily')
>>> data
period sma_value sma_signal ema_value ema_signal
0 5 7.648 sell 7.591 sell
1 10 7.623 sell 7.595 sell
2 20 7.568 sell 7.691 sell
3 50 8.100 sell 7.817 sell
4 100 7.798 sell 7.590 sell
5 200 6.782 buy 6.659 buy
C:\Users\michael.guber>pip install --upgrade git+https://github.com/alvarobartt/investpy.git@master WARNING: Value for scheme.headers does not match. Please report this to https://github.com/pypa/pip/issues/9617 distutils: c:\users\michael.guber\appdata\local\programs\python\python39\Include\UNKNOWN sysconfig: c:\users\michael.guber\appdata\local\programs\python\python39\Include WARNING: Additional context: user = False home = None root = None prefix = None Collecting git+https://github.com/alvarobartt/investpy.git@master Cloning https://github.com/alvarobartt/investpy.git (to revision master) to c:\users\michael.guber\appdata\local\temp\pip-req-build-an3iwk8p Running command git clone -q https://github.com/alvarobartt/investpy.git 'C:\Users\michael.guber\AppData\Local\Temp\pip-req-build-an3iwk8p' Requirement already satisfied: Unidecode>=1.1.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\unidecode-1.2.0-py3.9.egg (from investpy==1.0.6) (1.2.0) Requirement already satisfied: setuptools>=41.2.0 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from investpy==1.0.6) (56.0.0) Requirement already satisfied: numpy>=1.17.2 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\numpy-1.20.2-py3.9-win-amd64.egg (from investpy==1.0.6) (1.20.2) Requirement already satisfied: pandas>=0.25.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from investpy==1.0.6) (1.2.4) Requirement already satisfied: lxml>=4.4.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\lxml-4.6.3-py3.9-win-amd64.egg (from investpy==1.0.6) (4.6.3) Requirement already satisfied: requests>=2.22.0 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from investpy==1.0.6) (2.25.1) Requirement already satisfied: pytz>=2019.3 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\pytz-2021.1-py3.9.egg (from investpy==1.0.6) (2021.1) Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\python_dateutil-2.8.1-py3.9.egg (from pandas>=0.25.1->investpy==1.0.6) (2.8.1) Requirement already satisfied: six>=1.5 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\six-1.15.0-py3.9.egg (from python-dateutil>=2.7.3->pandas>=0.25.1->investpy==1.0.6) (1.15.0) Requirement already satisfied: certifi>=2017.4.17 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (2020.12.5) Requirement already satisfied: idna<3,>=2.5 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (2.10) Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (4.0.0) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages (from requests>=2.22.0->investpy==1.0.6) (1.26.4) WARNING: Value for scheme.headers does not match. Please report this to https://github.com/pypa/pip/issues/9617 distutils: c:\users\michael.guber\appdata\local\programs\python\python39\Include\UNKNOWN sysconfig: c:\users\michael.guber\appdata\local\programs\python\python39\Include WARNING: Additional context: user = False home = None root = None prefix = None
C:\Users\michael.guber>python 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 data = investpy.technical.moving_averages(name='WELL', country='Canada', product_type='stock', interval='daily') Traceback (most recent call last): File "
", line 1, in File "c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\investpy\technical.py", line 273, in moving_averages if name not in list(data[check].apply(unidecode).str.lower()): File "c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\pandas\core\series.py", line 4138, in apply mapped = lib.map_infer(values, f, convert=convert_dtype) File "pandas_libs\lib.pyx", line 2467, in pandas._libs.lib.map_infer File "c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\unidecode-1.2.0-py3.9.egg\unidecode__init__.py", line 66, in unidecode_expect_ascii bytestring = string.encode('ASCII') AttributeError: 'float' object has no attribute 'encode'
I did the update, but still getting the error :-( sorry for that
I'm not sure if that relevant, but you didn't update technical.py and stock.py
Traceback (most recent call last): File "c:\Users\michael.guber\Desktop\investpy0.py", line 48, in <module> techData = get_stock_tech_data(stock_symb, intervalS, type, countryS) File "c:\Users\michael.guber\Desktop\investpy0.py", line 40, in get_stock_tech_data techData = investpy.technical.moving_averages(name='WELL', country='Canada', product_type='stock', interval='daily') File "c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\investpy\technical.py", line 273, in moving_averages if name not in list(data[check].apply(unidecode).str.lower()): File "c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\pandas-1.2.3-py3.9-win-amd64.egg\pandas\core\series.py", line 4138, in apply mapped = lib.map_infer(values, f, convert=convert_dtype) File "pandas\_libs\lib.pyx", line 2467, in pandas._libs.lib.map_infer File "c:\users\michael.guber\appdata\local\programs\python\python39\lib\site-packages\unidecode-1.2.0-py3.9.egg\unidecode\__init__.py", line 66, in unidecode_expect_ascii bytestring = string.encode('ASCII') AttributeError: 'float' object has no attribute 'encode'
Thank you for your work
Originally posted by @guberm in https://github.com/alvarobartt/investpy/issues/346#issuecomment-820389804