Saving weights and using them for trading
I want to use the allocation weights I define at point in time "t" at point in time "t+1". I tried using your multi-pass backtester, but without any success. How can I do that? Can I save the state of my simulation between iterations?
support last edited by
@rezhak21 Hi, good question, yes, you can!
Please take a look at the documentation at:
When you use multi-pass backtesting you have to define a strategy function which loads the data and returns allocation weights for a fixed point in time. The "default" behavior of the backester does not save the state of the simulation between iterations, normally this choice is safe and fast as it allows for parallel processing.
If you want to preserve the state, you have to pass two arguments to the function: the data and the "state". "state" should be a dictionary containing the variables and the values which should be persistent across iterations. The function should then return allocation weights and the updated state.
Please try the example at:
and let us know.
@support great, thank you, yes, this is what I was looking for