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?
-
@rezhak21 Hi, good question, yes, you can!
Please take a look at the documentation at:
https://quantiacs.com/documentation/en/reference/evaluation.html#stateful-multi-pass-backtesting
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:
https://quantiacs.com/documentation/en/reference/evaluation.html#stateful-multi-pass-backtesting
and let us know.
-
@support great, thank you, yes, this is what I was looking for