科技美学

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.0 Error

Traceback (most recent call last):
  File "D:/PycharmProjects/dbpower.backtrader.001/app/main_machine_learning.py", line 191, in <module>
    img = cerebro.plot(style='line', plotdist=0.1, grid=True)
  File "D:\PycharmProjects\dbpower.backtrader.001\app\venv\lib\site-packages\backtrader\cerebro.py", line 991, in plot
    start=start, end=end, use=use)
  File "D:\PycharmProjects\dbpower.backtrader.001\app\venv\lib\site-packages\backtrader\plot\plot.py", line 119, in plot
    if not strategy.datas:
AttributeError: 'OptReturn' object has no attribute 'datas'

  'OptReturn' object has no attribute 'datas'

 

2.0 Fix

cerebro = bt.Cerebro(stdstats=True, cheat_on_open=True, optreturn=False)

  optreturn=False

posted on 2023-10-12 15:47  chankuang  阅读(245)  评论(0编辑  收藏  举报