enzoampil / fastquant

fastquant — Backtest and optimize your ML trading strategies with only 3 lines of code!
MIT License
1.48k stars 236 forks source link

[BUG] pypi.org hosted fastquant 0.1.8.1 breaks due to json_normalize (fix already in master) #423

Open icasimpan opened 1 year ago

icasimpan commented 1 year ago

Problem description

More of an issue with the version in pypi.org than a current bug, already fixed in commit https://github.com/enzoampil/fastquant/commit/df6d605f2c9b6b147fdf5f4f8f958953ce71076b

Example


from fastquant import get_pse_data, backtest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/icasimpan/code/isolate/env/lib/python3.11/site-packages/fastquant/__init__.py", line 2, in <module>
    from .disclosures import *
  File "/home/icasimpan/code/isolate/env/lib/python3.11/site-packages/fastquant/disclosures/__init__.py", line 4, in <module>
    from fastquant.disclosures.pse import DisclosuresPSE
  File "/home/icasimpan/code/isolate/env/lib/python3.11/site-packages/fastquant/disclosures/pse.py", line 24, in <module>
    from pandas.io.json import json_normalize
ImportError: cannot import name 'json_normalize' from 'pandas.io.json' (/home/icasimpan/code/isolate/env/lib/python3.11/site-packages/pandas/io/json/__init__.py)

Expected behavior

It's not supposed to break. Fixed the issue same as what was done in https://github.com/enzoampil/fastquant/commit/df6d605f2c9b6b147fdf5f4f8f958953ce71076b and the module worked fine.

Workaround

Simply install using the master branch instead of using pypi version:

git clone git@github.com:enzoampil/fastquant.git
python -m pip install -e ./fastquant

Environment

jjjrmy commented 9 months ago

after you use the workaround, I am getting error ImportError: cannot import name 'backtest' from 'fastquant' (unknown location)

Any suggestions?

kbalsamy commented 6 months ago

after you use the workaround, I am getting error ImportError: cannot import name 'backtest' from 'fastquant' (unknown location)

Any suggestions?

just restart the kernel. it will work