Vary the strategy allocation during backtest

The idea is to dynamically reduce the allocation to a bad-performing strategy and vice versa.
Per my experience in the moonshot the cumulative return is invisible in "prices_to_signals" thus it is not possible but I would like to hear your opinion.

Also I wonder if it is possible in zipline.

Thank you.

After generating your preliminary signals in prices_to_signals, you can call signals_to_target_weights, target_weights_to_positions, and position_to_gross_returns from within prices_to_signals to get the returns for the preliminary signals, then use the returns to calculate a rolling performance metric (percent return or Sharpe ratio or whatever) that can then be applied as an additional filter to the preliminary signals, and return those filtered signals from prices_to_signals.

1 Like