Test a whole strategy against the same strategy run on randomized data.
strategy(...inputs) must return a backtest engine output of shape (T, 4)
or a portfolio output of shape (T, K, 4) (or a pipeline {values, index}
holding one). method is "bars" (permute the OHLC inputs at ohlc),
"returns" (permute the price input at price), or "shift" (rotate the
feature inputs at columns by one random offset). With bars and returns,
mode is "log", "diff", or "level", and other inputs move with their bar
unless listed in fixed; the input at volume is moved and, with
volumeMode: "notional", rescaled to keep the traded amount.
Each input is a series of T values or a (T, K) panel of K assets (an
NdArray or T rows of K values); a panel reaches the strategy as an NdArray.
Each randomized copy applies one time permutation to every asset, so the
correlation between assets is kept. Mirrors Python's strategy_test; the
same seed gives the same randomized inputs.
Test a whole strategy against the same strategy run on randomized data.
strategy(...inputs)must return a backtest engine output of shape (T, 4) or a portfolio output of shape (T, K, 4) (or a pipeline{values, index}holding one).methodis"bars"(permute the OHLC inputs atohlc),"returns"(permute the price input atprice), or"shift"(rotate the feature inputs atcolumnsby one random offset). With bars and returns,modeis "log", "diff", or "level", and other inputs move with their bar unless listed infixed; the input atvolumeis moved and, withvolumeMode: "notional", rescaled to keep the traded amount.Each input is a series of T values or a (T, K) panel of K assets (an NdArray or T rows of K values); a panel reaches the strategy as an NdArray. Each randomized copy applies one time permutation to every asset, so the correlation between assets is kept. Mirrors Python's
strategy_test; the same seed gives the same randomized inputs.