2. Simple equity basket strategy
Create a simple basket strategy that maintains specific weightings for two different equity instruments.
A multi-instrument equity strategy in seven steps
In this example, you will create a simple basket strategy to hedge investment in Apple stock against market risk. The basket strategy will long Apple and short S&P 500 ETF.
In SigTech's Research environment, create a new notebook and run the following code blocks:
1. Set up environment
Note that for this tutorial we will need the pandas library:
2. Define historical period
As you'll need to use the start and end dates multiple times, store them as variables:
3. Define strategies and instruments
This time, you will define two ReinvestmentStrategy
instances—one for the Apple stock and one for the S&P 500 ETF.
4. Build the BasketStrategy
BasketStrategy
The BasketStrategy
building block is a strategy of strategies—it is a container for managing multiple sub-strategies.
With the following code build a BasketStrategy
to manage the two ReinvestmentStrategy
instances created above:
5. Analyse performance in different ways
Plot the strategy's return
From a simple plot it looks like this strategy has performed well.
Compare the strategy's return against a benchmark
As you will see from running this code, the return of your basket strategy is much worse than just investing in the Apple stock alone:
Compare the strategy's risk against a benchmark
Running the following two blocks of code will reveal deeper insights about the performance of both your basket strategy and the Apple stock. If you look at market risk instead of return, you can see that your basket strategy has partially hedged against market risk.
Add an additional instrument and indicate whether to long or short it.
Last updated