Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Create a simple basket strategy that maintains specific weightings for different instruments.
In SigTech's Research environment, create a new notebook and run the following seven code blocks:
As you'll need to use the start and end dates multiple times, store them as variables:
RollingFutureStrategy
instancesCreate multiple RollingFutureStrategy
instances—one for each instrument listed above. Create them using this function:
RollingFutureStrategy
instances inside a dictionaryBuild the RollingFutureStrategy
instances and store them inside a dictionary:
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 three RollingFutureStrategy
instances created above:
Add more instruments and define each instrument's weighting in the strategy.
Learn how to create, test and customise a simple strategy based on a single equity instrument.
In SigTech's Research environment, create a new notebook and run the following code blocks:
Hint: Read our overview of JupyterLab if you've not used it before.
The object name 1000045.SINGLE_STOCK.TRADABLE refers to the Apple Computers stock listed on the NASDAQ. You can find other financial instruments in the SigTech platform's Data section (see below).
Make sure you understand SigTech basics by customising this strategy:
The example above uses an Apple instrument. Browse SigTech's Data to find another equity instrument and try building a strategy with that instead.
i. Find an equity instrument you're interested in:
ii. Click VIEW DETAILS to obtain the correct object name for referring to it in code:
Try running the strategy over a different historical period by changing the start_date
and end_date
.
?
to view docstringsRun the following code to view the docstring corresponding to the instrument you're using in this strategy:
Run the following code to view the docstring corresponding to the RollingFutureStrategy
building block:
Tip: add .?
to any object to get its docstring. Docstrings are part of our API reference and are aimed at advanced users. Don't worry if much of it is unclear to you right now.
Learn how to create, test and customise a simple strategy based on a single commodity future instrument.
In SigTech's Research environment, create a new notebook and run the following three code blocks:
Make sure you understand SigTech basics by customising this strategy:
The example above uses a coffee futures instrument. Browse SigTech's Data to find another futures instrument and try building a strategy with that instead.
The code in this page only works with futures data.
i. Find an instrument you're interested in:
ii. Click VIEW DETAILS to obtain the correct object name for referring to it in code:
Try running the strategy over a different historical period by changing the start_date
and end_date
.
?
to view docstringsRun the following code to view the docstring corresponding to the instrument you're using in this strategy:
Run the following code to view the docstring corresponding to the RollingFutureStrategy
building block:
Tip: add .?
to any object to get its docstring.. Docstrings are part of our API reference and are aimed at advanced users. Don't worry if much of it is unclear to you right now.
To build on your RollingFutureStrategy, add signals to take long or short positions during different time periods.
RollingFutureStrategy
againThe first few code blocks are very close to what you already used in the previous two tutorials:
RollingFutureStrategy
Every RollingFutureStrategy
instance has a history, in the format of a simple table of dates and values:
The signals
series you've just created has all the same dates as the history of your RollingFutureStrategy
, but the values are now reset to 0. In the next step you will repopulate the values with signals—indicators of what position to take.
A signal of 1
indicates a 100% long position, while a signal of -1
indicates a 100% short position. Set a signal of -1
for the first four months of each year in the time period, and 1
for the final four months of each year, assuming there is a strategic rationale for this relating to seasonal market activity:
For future steps to work, signals
needs to be in DataFrame format and have the exact same name as your RollingFutureStrategy
instance. This name-sharing allows the SignalStrategy
instance to reference the relevant RollingFutureStrategy
instance:
SignalStrategy
Try a different set of signals.
Note: the table is a Series. Run my_rfs.history?
to see this confirmed in its docstring.
New to SigTech?
Please switch to the Framework v8 User Guide.
This version of the SigTech User Guide is no longer maintained.
Please see the Framework v8 User Guide for updates.
Welcome to the SigTech User Guide. SigTech provides next-gen technology for quantitative multi-asset research and investment. The SigTech platform includes the SigTech Framework of Python-based analytics tools, a catalogue of clean, curated data from multiple sources, and GUI environments for managing research and production. For more on the value that SigTech provides, see SigTech.com.
This User Guide provides introductions and reference material explaining vital SigTech concepts and workflows. It supplements the API Reference, example notebooks and framework source code in helping you make the most of the SigTech platform.
SigTech requires some basic Python knowledge—variables, functions, lists, dictionaries and loops. You can learn about these in any good introduction to Python.
You also need to know the basics of using JupyterLab—see our JupyterLab overview.
Create a simple basket strategy that maintains specific weightings for two different equity instruments.
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:
Note that for this tutorial we will need the pandas library:
As you'll need to use the start and end dates multiple times, store them as variables:
This time, you will define two ReinvestmentStrategy
instances—one for the Apple stock and one for the S&P 500 ETF.
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:
From a simple plot it looks like this strategy has performed well.
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:
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.
Build a signal strategy that uses multiple instruments
RollingFutureStrategy
setupThe first few code blocks are very close to what you already used to create multi-instrument Rolling Future Strategy in tutorial 4.
Note that for this tutorial we will need the pandas library:
RollingFutureStrategy
functionRollingFutureStrategy
instances to a dictionaryThis 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:
SignalStrategy
This step is identical to defining a single-instrument SignalStrategy, except for the reference to the new DataFrame:
Add additional instruments
Try a different set of signals.