Persisting Spread Strategy Variables Across Restarts in VeighNa
Summary
The discussion explains that VeighNa 2.7 does not provide built-in save-and-restore support for variables in spread trading strategies, even though CTA strategies have a dedicated data file. As a workaround, a community reply suggests saving selected values to a JSON file when the strategy stops and loading them when it starts, using the framework’s JSON utility functions in the strategy lifecycle hooks.
The example demonstrates the general approach for one variable: read its stored value during startup and write its current value during shutdown. The post does not cover how to handle missing files, malformed data, multiple variables, or interruptions that prevent the stop hook from running. Users would need to adapt and validate the persistence logic for their own strategy state.
Key ideas
- VeighNa 2.7 does not provide built-in persistence for spread strategy variables.
- A strategy can load saved values in its startup hook and write them in its shutdown hook.
- The suggested approach stores selected variables in a JSON file using framework utilities.
- The example does not explain recovery from missing or invalid files or unexpected shutdowns.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.