6. Multi-instrument signal strategy
Build a signal strategy that uses multiple instruments
A multi-asset signal strategy
1. Multi-instrument RollingFutureStrategy
setup
RollingFutureStrategy
setupThe first few code blocks are very close to what you already used to create multi-instrument Rolling Future Strategy in tutorial 4.
Set up environment
Note that for this tutorial we will need the pandas library:
Define instruments, time period, and RollingFutureStrategy
function
RollingFutureStrategy
functionAdd the RollingFutureStrategy
instances to a dictionary
RollingFutureStrategy
instances to a dictionary2. Loop to create multi-instrument DataFrame of signals
This following code is very similar to that used in the previous tutorial, except you're using a loop to create signals for multiple instruments, and combining them into a single DataFrame:
3. Define SignalStrategy
SignalStrategy
This step is identical to defining a single-instrument SignalStrategy, except for the reference to the new DataFrame:
4. View performance
👷Your turn: customise the strategy
Add additional instruments
Try a different set of signals.
Last updated