Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Got an exception when using some analyzers

    General Code/Help
    3
    3
    523
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      winplusx last edited by

      When I use cerebro.optstrategy(...) and cerebro.run(), I got an exception if using some analyzers( PeriodStats, SharpeRatio) :

      File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 917, in _bootstrap_inner
      self.run()
      File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 865, in run
      self._target(*self._args, **self._kwargs)
      File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\multiprocessing\pool.py", line 470, in _handle_results
      task = get()
      File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\multiprocessing\connection.py", line 251, in recv
      return _ForkingPickler.loads(buf.getbuffer())
      AttributeError: Can't get attribute 'Lines_LineSeries_LineIterator_DataAccessor_ObserverBase_Observer_DataTrades_5991202d0983450997d03f799478a7ad' on <module 'backtrader.lineseries' from 'c:\users\kaima\source\repos\PythonHello\PythonHello\env37\lib\site-packages\backtrader\lineseries.py'>

      1 Reply Last reply Reply Quote 0
      • Robin Dhillon
        Robin Dhillon last edited by

        Common issue, essentially means no line data is being received through the function. there might be a error in the way you are calling some attributes. if you post your code, it will help identify the problem better.

        1 Reply Last reply Reply Quote 0
        • B
          backtrader administrators last edited by

          Disable stdstats=False in Cerebro. Essentially your code is breaking something, and that's only the symptom.

          Docs - Cerebro

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors