def initialize(context): context.asset = symbol('AAPL') # Explicitly set the commission to the "old" value until we can # rebuild example data. # github.com/quantopian/gateway/blob/master/tests/resources/ # rebuild_example_data#L105 context.set_commission(commission.PerShare(cost=.0075, min_trade_cost=1.0))
def initialize(algo, eps=1, window_length=5): algo.stocks = STOCKS algo.sids = [algo.symbol(symbol) for symbol in algo.stocks] algo.m = len(algo.stocks) algo.price = {} algo.b_t = np.ones(algo.m) / algo.m algo.last_desired_port = np.ones(algo.m) / algo.m algo.eps = eps algo.init = True algo.days = 0 algo.window_length = window_length algo.set_commission(commission.PerShare(cost=0, min_trade_cost=1.0))
def initialize(context): attach_pipeline(make_pipeline(), 'my_pipeline') # Rebalance each day. In daily mode, this is equivalent to putting # `rebalance` in our handle_data, but in minute mode, it's equivalent to # running at the start of the day each day. schedule_function(rebalance, date_rules.every_day()) # Explicitly set the commission to the "old" value until we can # rebuild example data. # github.com/quantopian/gateway/blob/master/tests/resources/ # rebuild_example_data#L105 context.set_commission(commission.PerShare(cost=.0075, min_trade_cost=1.0))