Environment setup#
This tutorial guides you through configuring an environment within the SigTech platform before you begin your analysis.
Prerequisites#
This page assumes you have started a research environment on the Sigtech platform. If you have not:
Login to Sigtech.
Select Research.
Select the workspace you want to initialize a research environment in. To configure a new workspace, refer to [Workspaces](/user-interface/workspaces.
Configure your research environment using the Set up your Research Environment window.
Select Start Research Environment.
Open an instance of your preferred IDE.
Import our framework#
You are required to import the sigtech.framework
library.
import sigtech.framework as sig
Import additional python libraries#
Import any python libraries you require. For example:
import datetime as dtm
import pandas as pd
import numpy as np
import seaborn as sns
If you attempt to import a library and encounter the ModuleNotFoundError, you will need to install the library in your research environment. See [Python packages](/user-interface/python-packages#third-party-python-packages for more information.
To see the complete list of libraries you can import without installing, run help('modules')
. To see a list of the supported libraries and versions run %pip install
. Please note that %pip install
does not show all supported Python libraries.
Initialize your environment#
After importing the necessary libraries, you must initialize your environment. Initialization is performed with the command sig.init()
.
sig.init(env_date=dtm.datetime(2020, 7, 1, 11))
# this sets the env_date to July 1st 2020, at 11:00am
Configuration parameters#
The following parameters can be used during environment initialization:
Parameter |
Default |
Description |
---|---|---|
|
|
A Python date, datetime or string, for example |
|
|
A Python date, datetime or string, for example |
|
|
The log level determines the type of log message to display and the granularity of information to provide the user. For a list of the different |
Arguments for log_level
#
When configuring your environment, the log_level
argument lets you set log messages and exactly what kind of information is displayed. There are four log levels:
'ERROR'
- displays error messages that are fatal to the code operation.'WARNING'
- displays information that can explain application oddities or issues. These issues are not ‘fatal’ and will not disrupt the code.Selecting this level will cause both
'ERROR'
and'WARNING'
messages to be displayed.
'DEBUG'
- displays information that is diagnostically helpful. For example, a debug message could be'stopping Strategy Service'
.Selecting this level will cause
'ERROR'
,'WARNING'
and'DEBUG'
messages to all be displayed..
'INFO'
- displays all useful information such as configuration assumptions, success messages, etc.This level displays all
log_level
messages.
Post initialization configuration#
After the initialization of the environment, several additional configurations can be made.
In the following code block, FORCE_OFFSETTING_OTC_TRADES
and TM_TIMEZONE
have been included:
sig.config.set(sig.config.FORCE_OFFSETTING_OTC_TRADES, True)
sig.config.set(sig.config.TM_TIMEZONE, 'Europe/London')
The following parameters can be used to further configure the environment:
Parameter |
Default value |
Explanation |
---|---|---|
|
|
Determines whether to use calendars to build the history schedule of instruments. |
|
|
Determines whether to provide values for missing data points. If |
|
|
Determines whether to ignore transaction costs when running strategies. |
|
|
Determines whether to treat all orders individually by disabling transaction cost netting. |
|
|
Sets number of days before gathering data following a corporate action. |
|
|
Determines whether to ignore corporate actions with no adjustment factor or resulting stock symbol. |
|
|
Sets trading manager calendar. |
|
|
Sets trading manager timezone. |
|
|
Sets trading manager opening time. |
|
|
Sets trading manager closing time. |
|
|
Sets data point defaults according to Trading Manager Calendar. |
|
|
Determines valuation when intraday data is available. If |
|
|
Sets list of data points to prioritize over others. |
|
|
Facilitates overriding of transaction cost values. |
|
|
Determines whether to warn user if default transaction costs are used. |
|
|
Determines discounting instrument to be used for base currency discounting in FX forwards. Can be a curve of overnight index. |
|
|
Sets base currency to use in FX forward market. |
|
|
Sets order of the spline interpolation used by the point based FX forward market. |
|
|
Determines whether to force the rounding of all units for strategy generated orders. |
|
F |
Determines whether to force entry into offsetting trades for FX forwards and other initial zero-value trades when trading out of them. |
|
|
Override dividend tax for equity groups. |
|
|
Configure data providers. List of pairs: regex matching instrument names, |
|
|
Dict of splits occurring in futures groups to consider when constructing rolling future strategies. |
|
|
Sets a date before which no history for any instrument will be returned. |
|
|
Determines whether to restrict time series data retrieval to a specified data provider. |
|
|
Sets time between the decision and execution of an FX Spot transaction. |
|
|
Trades FX pairs directly, as opposed to triangulating through USD. |
Re-initializing your environment#
Note: to destroy your configured environment and clear the cache in preparation for initializing a new environment, use sig.de_init()
.
Sometimes, you may want to re-initialize an environment with new parameters. Attempts to re-initialize an already initialized environment will produce different behaviour based on the value of the repeat_mode
parameter. This parameter controls how the environment behaves if init()
is called more than once (i.e. you reinitialize an environment). The three repeat_mode
options are as follows:
'reinit'
- runs thede_init()
command (destroying the environment) and then runsinit()
again (creating a new environment).'error'
- if a secondinit()
command is called, this command is terminated and an error is displayed explaining why.'warning'
- the secondinit()
command is allowed to finish and a warning is displayed that another environment has been created.
Note: Entering sig.de_init
followed by sig.init()
performs the same function as sig.init(repeat_mode='reinit'
).
These behaviors are described in the code block below:
sig.init()
# The environment is now initialized
sig.init()
# The call above has no effect (default is 'warning')
sig.init(repeat_mode='reinit')
# The call above destroys the current environment and creates a new one
sig.init(repeat_mode='error')
# The execution terminates with an error