Parameter Passing

ptunneyptunney Posts: 246
edited July 2019 in FAQs

If you have written a strategy and are at the point of refining your model you may wish to take advantage of Parameter Passing.

This allows you to change parameters on the NEW TEST form.

# Adding the __init__ callback will result in a new field on the NEW TEST backtest form. Place the data you wish to pass into this field as a dictionary
# In this case you could put {'RVOLLimit':2.5,'MinPrice':7.50}
# This lets you run mroe quickly submit multiple backtests with different parameters 

from cloudquant.interfaces import Strategy

class ParameterPassing(Strategy):

    @classmethod
    def is_symbol_qualified(cls, symbol, md, service, account):
        return symbol=="SPY"

    def __init__(self, **params)
        if params is not None:
            self.RVOLLim = params['RVOLLimit']
            self.minprice = params['MinPrice']
        else:
            self.RVOLLim = 1.0
            self.minprice = 0.50 

    def on_start(self, md, order, service, account):
        print self.RVOLLim,self.minprice

Under the name of your script will be a params box, enter your params as a Dictionary.

Sign In or Register to comment.