1: Your first SigTech strategy

Learn how to create, test and customise a simple strategy based on a single equity instrument.

An equity investment strategy in three code blocks

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.

1. Set up environment

# Import necessary libraries
import sigtech.framework as sig
import datetime as dtm

# Initalise the environment
sig.init();

2. Choose the instrument

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).

my_stock = sig.obj.get("1000045.SINGLE_STOCK.TRADABLE")

3. Define the strategy

my_rs = sig.ReinvestmentStrategy(
    # The instrument to be used in this strategy
    underlyer=my_stock.name,

    # Define the historical period to run the strategy in   
    start_date=dtm.date(2018, 1, 1),
    end_date=dtm.date(2021, 12, 31),
    
    # Use the currency corresponding to this instrument
    currency=my_stock.currency,
    
    # Set the initial cash to be invested
    initial_cash = 1000,
)

3. Run the strategy and view its performance

my_rs.plot.performance(inline=True)

👷Your turn: customise the strategy

Make sure you understand SigTech basics by customising this strategy:

1. Choose a different instrument

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:

2. Use a different historical period

Try running the strategy over a different historical period by changing the start_date and end_date.

3. Append ? to view docstrings

Run the following code to view the docstring corresponding to the instrument you're using in this strategy:

my_stock?

Run the following code to view the docstring corresponding to the RollingFutureStrategy building block:

sig.ReinvestmentStrategy?

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.

Last updated