Navigation

    Backtrader Community

    • Register
    • 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/

    optimization and sharperatio and periodstats analyzers

    General Code/Help
    2
    2
    117
    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.
    • M
      momentum last edited by

      Hi,

      when I am using SharpeRatio or PeriodStats analyzers with optimization, I get the following error

      TypeError: __init__() missing 9 required positional arguments: 'status', 'dt', 'barlen', 'size', 'price', 'value', 'pnl', 'pnlcomm', and 'tz'
      

      Both analyzers are based on TimeReturn which does not give any error if added as analyzer.

      Any feedback would be really helpful.

      Thanks

      1 Reply Last reply Reply Quote 1
      • André Tavares
        André Tavares last edited by

        Include the code in TradeHistory Class:

        def __reduce__(self):
            return (self.__class__, (self.status.status, self.status.dt, self.status.barlen, self.status.size,
                                     self.status.price, self.status.value, self.status.pnl, self.status.pnlcomm,
                                     self.status.tz,))
        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }