Closed xmagcx closed 1 year ago
Hello! Can you provide me with the full error message so I can look into it?
Seems to be working just fine from my side.
sure, i also attached the source code that i am using error.log
from financetoolkit import Toolkit
companies = Toolkit(['AAPL', 'MSFT'], api_key="f127ecd7b9084a166e1a7c853a7ef195")
enterprise = companies.get_enterprise()
historical_data = companies.get_historical_data(start='2000-01-01', end='2020-01-01')
balance_sheet_statement = companies.get_balance_sheet_statement()
profitability_ratios = companies.ratios.collect_profitability_ratios()
profitability_ratios.loc['AAPL']
Got it, will fix tomorrow!
This issue has been resolved. This is due to you being on an older version of Python. You are on 3.8 while the typing requirements are added in 3.10. I've made a temporary repository that will work (https://pypi.org/project/financetoolkit/1.0.2/) and it is made in such a way if you now will do pip install financetoolkit -U
it will update to this version.
However, note that from now on, all future package versions will be based on Python 3.10 and onwards. I would recommend upgrading your Python distribution to get access to the newest features in due time.
(test_python38) jeroenbouma@Jeroens-MacBook-Pro FinanceToolkit % pip install financetoolkit
Collecting financetoolkit
Using cached financetoolkit-1.0.2-py2.py3-none-any.whl (42 kB)
Installing collected packages: financetoolkit
Successfully installed financetoolkit-1.0.2
(test_python38) jeroenbouma@Jeroens-MacBook-Pro FinanceToolkit % pip install pandas
Collecting pandas
Using cached pandas-2.0.2-cp38-cp38-macosx_11_0_arm64.whl (10.7 MB)
Collecting pytz>=2020.1
Using cached pytz-2023.3-py2.py3-none-any.whl (502 kB)
Collecting numpy>=1.20.3
Using cached numpy-1.24.3-cp38-cp38-macosx_11_0_arm64.whl (13.8 MB)
Collecting python-dateutil>=2.8.2
Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting tzdata>=2022.1
Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB)
Collecting six>=1.5
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pytz, tzdata, six, numpy, python-dateutil, pandas
Successfully installed numpy-1.24.3 pandas-2.0.2 python-dateutil-2.8.2 pytz-2023.3 six-1.16.0 tzdata-2023.3
(test_python38) jeroenbouma@Jeroens-MacBook-Pro FinanceToolkit % python
Python 3.8.16 (default, Mar 1 2023, 21:18:45)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from financetoolkit import Toolkit
>>> Toolkit(['AAPL', 'TSLA'], 'API_KEY').get_balance_sheet_statement()
<stdin>:1: DeprecationWarning: This version of the Finance Toolkit is depreciated. Finance Toolkit 1.0.3 and onwards require Python 3.10 and higher. Please update to the latest version of Python and the Finance Toolkit.
date 2018 2019 2020 2021 2022
AAPL Cash and Cash Equivalents 25913000000 48844000000 38016000000 34940000000 23646000000
Short Term Investments 40388000000 51713000000 52927000000 27699000000 24658000000
Cash and Short Term Investments 66301000000 100557000000 90943000000 62639000000 48304000000
Accounts Receivable 48995000000 45804000000 37445000000 51506000000 60932000000
Inventory 3956000000 4106000000 4061000000 6580000000 4946000000
... ... ... ... ... ...
TSLA Minority Interest 1390361000 1492000000 1454000000 1394000000 1194000000
Total Liabilities and Equity 29739614000 34309000000 52148000000 62131000000 82338000000
Total Investments 0 0 0 131000000 5932000000
Total Debt 13827271000 13419000000 11739000000 6834000000 3099000000
Net Debt 10141653000 7151000000 -7645000000 -10742000000 -19086000000
[86 rows x 5 columns]
>>> exit()
(test_python38) jeroenbouma@Jeroens-MacBook-Pro FinanceToolkit % conda list
# packages in environment at /Users/jeroenbouma/miniconda3/envs/test_python38:
#
# Name Version Build Channel
ca-certificates 2023.05.30 hca03da5_0
financetoolkit 1.0.2 pypi_0 pypi
libcxx 14.0.6 h848a8c0_0
libffi 3.4.4 hca03da5_0
ncurses 6.4 h313beb8_0
numpy 1.24.3 pypi_0 pypi
openssl 1.1.1t h1a28f6b_0
pandas 2.0.2 pypi_0 pypi
pip 23.0.1 py38hca03da5_0
python 3.8.16 hc0d8a6c_3
python-dateutil 2.8.2 pypi_0 pypi
pytz 2023.3 pypi_0 pypi
readline 8.2 h1a28f6b_0
setuptools 67.8.0 py38hca03da5_0
six 1.16.0 pypi_0 pypi
sqlite 3.41.2 h80987f9_0
tk 8.6.12 hb8d0fd4_0
tzdata 2023.3 pypi_0 pypi
wheel 0.38.4 py38hca03da5_0
xz 5.4.2 h80987f9_0
zlib 1.2.13 h5a0b063_0
(test_python38) jeroenbouma@Jeroens-MacBook-Pro FinanceToolkit %
What's the feature that should be improved? example 1: TypeError: unsupported operand type(s) for |: 'type' and 'types.GenericAlias'
Describe how you would like the feature improved
Possibly describe the ideal way to improve this If you have thought about how you would do it, add it here.
Additional information pip list asttokens 2.2.1 backcall 0.2.0 colorama 0.4.6 comm 0.1.3 debugpy 1.6.7 decorator 5.1.1 executing 1.2.0 financedatabase 2.1.0 financetoolkit 1.0.0 importlib-metadata 6.6.0 ipykernel 6.23.1 ipython 8.14.0 jedi 0.18.2 jupyter_client 8.2.0 jupyter_core 5.3.0 matplotlib-inline 0.1.6 nest-asyncio 1.5.6 numpy 1.24.3 packaging 23.1 pandas 2.0.2 parso 0.8.3 pickleshare 0.7.5 pip 23.1.2 platformdirs 3.5.1 prompt-toolkit 3.0.38 psutil 5.9.5 pure-eval 0.2.2 Pygments 2.15.1 python-dateutil 2.8.2 pytz 2023.3 pywin32 306 pyzmq 25.1.0 setuptools 49.2.1 six 1.16.0 stack-data 0.6.2 tornado 6.3.2 traitlets 5.9.0 typing_extensions 4.6.3 tzdata 2023.3 wcwidth 0.2.6 zipp 3.15.0