For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Save optimization results for plotting



  • I am not an expert in python so the question maybe naive.

    Following the example I am able to print out the optimization results.

        def stop(self):
            self.log('(SAR AF MAX %.3f) (SAR AF %.3f) Ending Value %.2f' %
                     (self.p.sar_afmax, self.p.sar_af, self.broker.getvalue()))
    

    ....
    2007-12-31, (SAR AF MAX 0.190) (SAR AF 0.004) Ending Value 1043106.09
    2007-12-31, (SAR AF MAX 0.190) (SAR AF 0.005) Ending Value 1043106.09
    2007-12-31, (SAR AF MAX 0.190) (SAR AF 0.006) Ending Value 1201288.27
    2007-12-31, (SAR AF MAX 0.190) (SAR AF 0.007) Ending Value 997203.68
    ....

    Is there an easy way to export those results for plotting, for example?

    I have tried to look in what is returned in:

    # Run over everything
        results = cerebro.run(maxcpus=1)
    
    In [33]: results[2][0].p.sar_af
    Out[33]: 0.01
    
    In [34]: results[2][0].p.sar_afmax
    Out[34]: 0.03
    

    but did not find how to extract the ending value of the broker for each set of parameters.


  • administrators

    @dmitry-hits said in Save optimization results for plotting:

    Is there an easy way to export those results for plotting, for example?

    Not really. Plotting was meant to plot single-run results. You could always pickle the results, but that won't help with plotting
    them.

    @dmitry-hits said in Save optimization results for plotting:

    but did not find how to extract the ending value of the broker for each set of parameters.

    Save the result during the stop method of the strategy.


Log in to reply
 

});