1: Your first SigTech strategy#

Start Research#

1. Start the research environment#

Click the Research tab and, accepting the default settings, start the research environment.

2. Create a new notebook#

Click the “Python” button to open a new notebook.

Hint: Read our overview of JupyterLab if you’ve not used it before.

An equity investment strategy in four code blocks#

Let’s go through building a strategy on the SigTech platform. In your new notebook, run the following code blocks:

1. Set up environment#

Every time you open a new notebook on the SigTech platform, you’ll need to set up the environment. This involves running some code to import any necessary libraries and initialize the environment.

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

# Initalize the environment
sig.init();

2. Choose the financial instrument#

You can find data for financial instruments on the SigTech platform’s Data browser. Each instrument comes with a code snippet, which you can use to get the data into your environment.

The example below pulls data into your environment using the object name 1481752.SINGLE_STOCK.TRADABLE, which refers to the AIRBNB stock listed on the Long Term Exchange.

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

3. Define the strategy#

To make the equity investment strategy, you can use ReinvestmentStrategy: one of SigTech’s building blocks, which are shortcuts for rapidly creating and customising common strategies. Building blocks can be combined into more complex strategies composed of multiple sub-strategies.

The strategy we’re working on requires some parameters, which you can set accordingly.

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

4. Run the strategy and view its performance#

Once you’ve defined the strategy, run it to generate a visualization plotting its performance.

my_rs.plot.performance()

Play about with the interactive widget to explore different aspects of your strategy’s performance.

đź‘· Your turn: customize the strategy#

Make sure you understand SigTech basics by customizing this strategy:

1. Choose a different instrument#

The example above uses an AIRBNB instrument. Look through SigTech’s Data browser to find another instrument and try building a strategy with that instead.

i. Find a futures instrument you’re interested in.

ii. Click VIEW DETAILS, then the CODE EXAMPLE tab 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#

Add ? to any object to get its docstring, which tells you information about the object’s functionality.

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: Docstrings are part of our API reference and are aimed at advanced users. Don’t worry if it seems unclear to you right now—you’ll get the hang of it as you become more familiar with SigTech.