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



  • 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



  • 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,))

Log in to reply
 

});