mhallsmoore / qstrader

QuantStart.com - QSTrader backtesting simulation engine.
https://www.quantstart.com/qstrader/
MIT License
2.88k stars 856 forks source link

Install problem: urgent help needed #281

Closed zf480 closed 4 years ago

zf480 commented 5 years ago

I first met several problems when installing all required packages and then open the requirement file, installing each package separately.

However, later I met this problem:

(qstraderp3) bash-3.2$ python buy_and_hold_backtest.py Traceback (most recent call last): File "buy_and_hold_backtest.py", line 7, in from qstrader.trading_session import TradingSession File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/qstrader/trading_session.py", line 12, in from .statistics.tearsheet import TearsheetStatistics File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/qstrader/statistics/tearsheet.py", line 15, in import seaborn as sns File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/seaborn/init.py", line 17, in from .widgets import * File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/seaborn/widgets.py", line 8, in from ipywidgets import interact, FloatSlider, IntSlider File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/ipywidgets/init.py", line 20, in from IPython import get_ipython File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/init.py", line 48, in from .core.application import Application File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/core/application.py", line 24, in from IPython.core import release, crashhandler File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/core/crashhandler.py", line28, in from IPython.core import ultratb File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/core/ultratb.py", line 117,in from IPython.utils import path as util_path File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/utils/path.py", line 19, in from IPython.utils.process import system File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/utils/process.py", line 19,in from ._process_posix import system, getoutput, arg_split, check_pid File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/IPython/utils/_process_posix.py", line 24, in import pexpect File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/pexpect/init.py", line 75, in from .pty_spawn import spawn, spawnu File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 15, in from .spawnbase import SpawnBase File "/Users/pwl1972/venv/qstraderp3/lib/python3.7/site-packages/pexpect/spawnbase.py", line 218 def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False): ^ SyntaxError: invalid syntax

It's quite hard to believe that it fails because of invalid syntax. Anyone met similar problems before? I used Anaconda and python3.7

zf480 commented 5 years ago

After creating a python 3.4 environment, this problem is perfectly solved. However, when run the test file, there is no tearsheet result. I can see the return and sharpe ratio though.

JamesKBowler commented 5 years ago

https://github.com/mhallsmoore/qstrader/issues/215

mhallsmoore commented 4 years ago

Hi @zf480,

I pushed up some changes to the codebase yesterday to ensure compatibility with Python 3.5, 3.6 and 3.7. In addition threquirements.txt file has been updated for the latest versions of the dependencies.

In terms of the tearsheet disappearing there was a slight design issue in the code that prevented the tearsheet from 'blocking' the rest of the backtest process. This has now been modified such that the tearsheet displays by default, allowing you to save a figure.

Regards,

Mike.