mhallsmoore / qstrader

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

AttributeError: 'bool' object has no attribute 'not_empty' #209

Closed cqiaoYc closed 8 months ago

cqiaoYc commented 7 years ago

My python version is 3.6. When I ran intraday_ml_backtest.py, got:

Running Backtest... Traceback (most recent call last): File "D:/python_study/AdvancedAlgorithmicTrading/intraday_ml_backtest.py", line 108, in main() File "D:\ProgramData\Anaconda3\lib\site-packages\click\core.py", line 722, in call return self.main(args, kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "D:\ProgramData\Anaconda3\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "D:\ProgramData\Anaconda3\lib\site-packages\click\core.py", line 535, in invoke return callback(args, **kwargs) File "D:/python_study/AdvancedAlgorithmicTrading/intraday_ml_backtest.py", line 105, in main run(config, testing, tickers, filename) File "D:/python_study/AdvancedAlgorithmicTrading/intraday_ml_backtest.py", line 77, in run results = backtest.start_trading(testing=testing) File "D:\ProgramData\Anaconda3\lib\site-packages\qstrader\trading_session.py", line 156, in start_trading self._run_session() File "D:\ProgramData\Anaconda3\lib\site-packages\qstrader\trading_session.py", line 123, in _run_session event = self.events_queue.get(False) File "D:\ProgramData\Anaconda3\lib\queue.py", line 158, in get with self.not_empty: AttributeError: 'bool' object has no attribute 'not_empty'

What's wrong? Python libs version?

enriqueromualdez commented 7 years ago

Hi @cqiaoYc,

Not sure if this will help, but I did run into issues when I ran this with Python 3.6. I was recommended to use an older Anaconda Distribution (I used 4.2) to downgrade my Python version to 3.5. All issues were solved after that.

Hope this helps!

cqiaoYc commented 7 years ago

@enriqueromualdez, thank you!

enriqueromualdez commented 7 years ago

@cqiaoYc You're welcome! If the fix worked, would you mind closing this issue as well? Thanks!

cqiaoYc commented 7 years ago

I switched to Python3 5, but the trouble still exists.

enriqueromualdez commented 7 years ago

Hi @cqiaoYc ,

I think this may have something to do with the format of the intraday_ml_backtest.py file. Has it been configured to run on existing build of QSTrader?

cqiaoYc commented 7 years ago

SQTrader was installed by pip.

cqiaoYc commented 7 years ago

conf in main(): testing=False config=settings.DEFAULT_CONFIG_FILENAME config = settings.from_file(config, testing)

config=SettingsDefault()

run(config, testing, tickers, filename)

===============

chillliang commented 7 years ago

@cqiaoYc I'm having a similar 'no attribute' problem with the .py files (#220). I was wondering if you've found any resolution to this yet?