Search…
New framework version
Released in May 2022, SigTech framework v8 provides faster calculations, TensorFlow support, and the latest features of Python and pandas.
To try out the new framework:
  1. 2.
    Set up a Research environment.
    • At Framework Version, select V8-Latest.
v7 release notes have moved.
See Release notes | SigTech framework v7 for information about older versions of the framework.
On this page

Important changes in v8

SigTech framework v8 ignores transaction costs by default.
To enable transaction costs, initialize the framework environment and then set the IGNORE_T_COSTS environment variable to False:
1
# Enable transaction costs
2
3
import sigtech.framework as sig
4
env = sig.init()
5
env['IGNORE_T_COSTS'] = False
Copied!
See also

v8.1.0 (Jun 2022)

In this release

Improve chart formatting in notebook files

In notebook (.ipynb) files, after initializing the framework environment, you can enable improved chart formatting.
To enable improved chart formatting in notebook files:
1
# Enable improved chart formatting in notebook files
2
3
import sigtech.framework as sig
4
env = sig.init()
5
6
sig.set_plot_mode()
Copied!
See also

Retrieve spot dollar duration series

For a RollingFutureStrategy or RFPriceIndex with underlying BondFuture or InterestRateFuture, spot_dv01 returns a series of spot dollar duration (DV01) values for the history of the instrument:
1
# Retrieve spot dollar duration values
2
3
ty = sig.RFPriceIndex(
4
currency='USD',
5
start_date=dtm.date(2020,1,4),
6
contract_code='TY',
7
contract_sector='COMDTY',
8
rolling_rule='front',
9
front_offset='-6:-5')
10
ty.spot_dv01()
Copied!
See also

Add position targets for CVaR and VaR

Add position targets for Conditional Variable at Risk (CVaR) and Value at Risk (VaR) to strategies.
To add a position target for CVaR, call strat.add_position_target with parameter unit_type='HISTORICAL_CVAR':
1
# Add a position target for CVaR
2
3
class MyStrategy(sig.DailyStrategy):
4
def strategy_initialization(self, dt):
5
self.add_position_target(
6
dtm.date(2021,7,10),
7
instrument_name='1003331.SINGLE_STOCK.TRADABLE',
8
units=0.5,
9
unit_type='HISTORICAL_CVAR'
10
)
Copied!
To add a position target for VaR, call strat.add_position_target with parameter unit_type='HISTORICAL_VAR':
1
# Add a position target for VaR
2
3
class MyStrategy(sig.DailyStrategy):
4
def strategy_initialization(self, dt):
5
self.add_position_target(
6
dtm.date(2021,7,10),
7
instrument_name='1003331.SINGLE_STOCK.TRADABLE',
8
units=0.5,
9
unit_type='HISTORICAL_VAR'
10
)
Copied!
See also

v8.0.0 (May 2022)

In this release

New features and package upgrades

TensorFlow support

From version 8.0, the SigTech framework supports TensorFlow 2.8.0.
To install TensorFlow in Jupyter Lab:
  1. 1.
    In the SigTech Research environment, create or open a Jupyter Lab workspace.
    At Set up your Research environment > Framework version, select V8-latest.
  2. 2.
    In a notebook, install and import TensorFlow:
    1
    # Install and import TensorFlow
    2
    3
    !pip install tensorflow
    4
    import tensorflow as tf
    5
    print("TensorFlow version:", tf.__version__)
    Copied!
See also

Python package upgrades

To support newer features of Python, pandas, TensorFlow, and other packages, SigTech framework v8 upgrades the version requirement of the following dependencies:
Package
v7 requirement (Python 3.7.10)
v8 requirement (Python 3.9)
cvxpy
1.0.15
1.1.18
matplotlib
3.2.2
3.5.1
numpy
1.18.4
1.22.2
pandas
1.0.5
1.4.1
scipy
1.5.4
1.8.0
scikit-learn
0.23.2
1.0.2
Breaking changes in pandas upgrade
For pandas data frames indexed by a pandas DatetimeIndex, DataFrame.loc is no longer subscriptable with a basic Python datetime.date object. Instead, use pandas.to_datetime to convert a Python date object to a pandas datetime object:
1
# `DataFrame.loc` not subscriptable with `datetime.date` in pandas 1.4
2
# Use `pd.to_datetime` to convert `datetime.date` to pandas datetime object
3
4
import pandas as pd
5
import numpy as np
6
import datetime as dtm
7
8
index = pd.date_range(dtm.date(2021, 1, 1), dtm.date(2021, 1, 31))
9
10
df = pd.DataFrame(
11
index = index,
12
data = {'Zeros': np.zeros(len(index))},
13
)
14
15
# Not supported in pandas 1.4
16
# df.loc[dtm.date(2021, 1, 1)]
17
18
df.loc[pd.to_datetime(dtm.date(2021, 1, 1))]
Copied!
See also

New strategy performance visualization

To display an interactive visualization of a strategy's performance, use plot.performance:
1
# Display interactive strategy performance visualization
2
3
import sigtech.framework as sig
4
import datetime as dtm
5
env = sig.init()
6
7
strat = sig.ReinvestmentStrategy(
8
currency='USD',
9
start_date=dtm.date(2021, 1, 1),
10
underlyer='1000045.SINGLE_STOCK.TRADABLE',
11
)
12
strat.plot.performance()
Copied!
In SigTech framework v8, plot.performance uses a new visualization with improved interface design and UX controls. The v8 framework also adds a Share button to the interface, so you can share the visualization as an image or embed the interactive chart anywhere on the web.
Use the v7 performance visualization in v8
To use the v7 performance visualization in v8, pass fallback=True to Strategy.plot.performance:
1
# Use v7 strategy performance visualization in v8
2
3
import sigtech.framework as sig
4
import datetime as dtm
5
env = sig.init()
6
7
strat = sig.ReinvestmentStrategy(
8
currency='USD',
9
start_date=dtm.date(2021, 1, 1),
10
underlyer='1000045.SINGLE_STOCK.TRADABLE',
11
)
12
strat.plot.performance(fallback=True)
Copied!
plot.performance no longer accepts deprecated inline parameter
Passing the deprecated inline parameter to plot.performance raises an error in v8. Remove the inline parameter from calls to plot.performance:
1
# Remove `inline` parameter from calls to `plot.performance`
2
3
import sigtech.framework as sig
4
import datetime as dtm
5
env = sig.init()
6
7
strat = sig.ReinvestmentStrategy(
8
currency='USD',
9
start_date=dtm.date(2021, 1, 1),
10
underlyer='1000045.SINGLE_STOCK.TRADABLE',
11
)
12
13
# Raises `TypeError` in v8
14
# strat.plot.performance(inline=True)
15
16
# Works correctly in v8
17
strat.plot.performance()
Copied!
See also

Changes to the framework environment

Initialize and configure the framework environment

To initialize the v8 framework environment, use sig.init:
1
# Initialize the SigTech framework
2
3
import sigtech.framework as sig
4
env = sig.init()
Copied!
In the example above, env points to the configured environment that sig.init creates.
Re-initialize the framework environment
By default, calling sig.init when the framework is already initialized has no effect in v8. To destroy the existing configured environment and initialize a new one, pass repeat_mode='reinit':
1
# Re-initialize the SigTech framework
2
3
import sigtech.framework as sig
4
env = sig.init()
5
6
# No effect on configured environment
7
env = sig.init()
8
9
# Destroys existing configured environment; initializes new one
10
env = sig.init(repeat_mode='reinit')
Copied!
See also
Configure the framework environment
You can change the framework environment configuration settings immediately after calling sig.init:
1
# Change framework environment config settings
2
3
import sigtech.framework as sig
4
import datetime as dtm
5
6
settings = [
7
('TM_TIMEZONE', 'Australia/Sydney'),
8
('TM_CALENDAR', 'SYDNEYB CALENDAR'),
9
('TM_INTRADAY_OUT_OF_HOURS', True),
10
]
11
12
env = sig.init()
13
for (setting, value) in settings:
14
env[setting] = value
Copied!
See also

Environment property _quant_bridge replaced by quant_bridge

The configured environment has a property that refers to the quant analytics library.
  • In v7, the configured environment's quant library property was _quant_bridge.
  • In v8, the configured environment's quant library property is quant_bridge. Using the v7 property name raises an error in v8.
See also

Changes to default configured environment settings

Version 8 of the SigTech framework changes the following default environment configuration settings:
Setting
Property name
v7 default
v8 default
'TM_CALENDAR'
London Christmas
None
'IGNORE_T_COSTS'
False
True
'AUTOMATIC_MARGIN_CLEANUP'
False
True
'DEFAULT_RS_START_DATE'
Jan 02, 2008
Jan 02, 2009
See also
Trading calendar
The v7 framework set the trading calendar to the London Christmas calendar by default. The v8 framework does not set a trading calendar.
You can set a trading calendar immediately after you call sig.init. To set the trading calendar to the London Christmas calendar:
1
# Set a trading calendar
2
3
import sigtech.framework as sig
4
env = sig.init()
5
env['TM_CALENDAR'] = 'London,CHR CALENDAR'
Copied!
See also
Ignore transaction costs
The v7 framework assigned a transaction cost model and calculated transaction costs by default. The v8 framework also assigns a transaction cost model, but ignores transaction costs by default.
To calculate transaction costs for new and existing strategies in v8, enable transaction costs immediately after you call sig.init:
1
# Enable transaction costs
2
3
import sigtech.framework as sig
4
env = sig.init()
5
env['IGNORE_T_COSTS'] = False
Copied!
See also
Auto manage custom strategy margins
The v7 framework automatically managed end-of-day margin cleanup for SigTech building blocks. However, if you built a custom strategy that directly traded an instrument with margins, you needed to schedule margin cleanup yourself.
The v8 framework automatically manages end-of-day margin cleanup for all strategies. When building new custom strategies in v8, you no longer need to schedule margin cleanup.
If you are troubleshooting performance issues in a custom strategy, switching off automatic end-of-day margin cleanup might help in some cases.
To switch off automatic end-of-day margin cleanup for custom strategies:
1
# Switch off automatic end-of-day margin cleanup for custom strategies
2
3
import sigtech.framework as sig
4
env = sig.init()
5
6
env['AUTOMATIC_MARGIN_CLEANUP'] = False
Copied!
See also
Single-stock strategy history start date
When you retrieve a single stock strategy with sig.get_single_stock_strategy, the framework caps the start date of the strategy's history to the DEFAULT_RS_START_DATE environment configuration setting.
The v7 framework set DEFAULT_RS_START_DATE to Jan 02, 2008. The v8 framework sets DEFAULT_RS_START_DATE to Jan 02, 2009. This change avoids possible conversion problems with older data.
You don't need to change your code unless you want sig.get_single_stock_strategy to include data from before Jan 02, 2009.
If you want sig.get_single_stock_strategy to include data from before Jan 02, 2009, change the DEFAULT_RS_START_DATE environment configuration setting immediately after you initialize the framework.
For example, to set DEFAULT_RS_START_DATE to Jan 02, 2008:
1
# Set `DEFAULT_RS_START_DATE` to Jan 02, 2008
2
3
import sigtech.framework as sig
4
import datetime as dtm
5
6
env = sig.init()
7
env[sig.config.DEFAULT_RS_START_DATE] = dtm.date(2008, 1, 2)
Copied!
See also

Changes to the magnitude of Greek variables

Greek variables indicate risk assumptions for options and swaptions.
SigTech framework v8 changes the magnitude of some Greek variables to follow market conventions. Modify your custom strategy classes where necessary to adjust for the changes.

Options

For equity index options, commodity options, and FX options, the magnitudes of Greek variables have changed as follows:
Variable
v7 magnitude
v8 magnitude
Indicates
Vega
100%
1%
Option price sensitivity to change in underlying asset price volatility
Gamma
100%
1% of underlying asset price
Delta sensitivity to change in underlying asset price
Dollar Gamma
50% of underlying asset price (including pnl explain scaling factor of 0.5)
1% of underlying asset price
Dollar Delta sensitivity to change in underlying asset price
See also

Swaptions

For swaptions, the magnitudes of Greek variables have changed as follows:
Variable
v7 magnitude
v8 magnitude
Indicates
Vega
10,000bps
1bps
Swaption price sensitivity to change in underlying asset price volatility
Delta
10,000bps
1bps
Swaption price sensitivity to a change in swap rate
Gamma
10,000^2 bps
1bps
Delta sensitivity to a change in swap rate
See also

New syntax for custom classes

SigTech framework v8 introduces new type syntax and object instantiation hooks for custom classes that extend SigTech classes.
1
# Define a custom strategy in v8
2
3
from typing import Optional, List
4
from typing_extensions import Literal
5
from sigtech.framework.strategies.strategy import Strategy
6
7
class NewStyle(Strategy):
8
__aliases__ = {'b': 'another_b'}
9
10
a: Optional[int] = 100
11
b: float = 3.0
12
c: List[str]
13
d: Literal['long', 'short'] = 'long'
Copied!
Convert your existing custom classes to the v8 syntax, and use the updated v8 syntax when defining new custom classes.
See also

Deprecations

To improve the performance and quality of the framework codebase, v8 deprecates some classes, methods, and properties. This section describes how to update your code for v8.
Using deprecated functionality raises an error in v8.
Update your code to remove deprecated functionality and use the v8 equivalents in the following sections.
In this section

Deprecations in sig.analytics

In sig.analytics, v8 deprecates and replaces the following classes:
Module
Deprecated v7 class
Replacement v8 class
optimization.optimizer
FactorOptimizer
Optimizer
optimization.optimization_problem
FactorOptimizationProblem
OptimizationProblem
performance.performance_report
TsPerformance
PerformanceReport
performance.performance_report
CustomReport
PerformanceReport
See also

Deprecations in sig.infra.calendar

In sig.infra.calendar, v8 deprecates and replaces the following classes:
Module
Deprecated v7 class
Replacement v8 class
business_calendar
Calendar
CustomCalendar
calendar
Calendar
HolidayCalendar
See also

Deprecations in sig.instruments

Deprecated type-checking methods
In sig.instruments, v8 deprecates the following type-checking methods:
Module
Class
Method
base
Instrument
is_future
base
Instrument
is_synthetic_swap
base
Instrument
is_equity_swap
base
Instrument
is_bond_repo
base
Instrument
is_bond_swap
base
Instrument
is_ir_swap
base
Instrument
is_index_swap
base
Instrument
is_ir_bh_swap
base
Instrument
is_tr_swap
base
Instrument
is_bond
base
Instrument
is_fx_forward
base
Instrument
is_order
base
Instrument
is_equity_single_stock
base
Instrument
is_etf
bonds
BondBase
is_bond
bonds
GovernmentBondRepo
is_bond_repo
bonds
GovernmentBondSwap
is_bond_swap
fx_otc
FXForward
is_fx_forward
index_swap
IndexSwap
is_index_swap
ir_otc
InterestRateSwap
is_ir_swap
The deprecated type-checking methods are not replaced in v8. Instead, use the built-in Python function isinstance to check the type of an object:
1
# Use `isinstance` to check type of an object
2
3
import sigtech.framework as sig
4
from sigtech.framework.instruments import Instrument
5
from sigtech.framework.instruments.equities import EquityInstrument
6
7
env = sig.init()
8
9
obj = sig.obj.get('1000045.SINGLE_STOCK.TRADABLE')
10
11
print(isinstance(instr, Instrument))
12
print(isinstance(instr, EquityInstrument))
Copied!
See also
Other deprecated instruments methods
In sig.instruments, v8 also deprecates the following methods and properties:
Module
Deprecated v7 method or property
Replacement v8 method or property
base
ContractGroup.contract_product_type
ContractGroup.item_product_type
base
HistoricalFrameworkObject.underlying_str
HistoricalFrameworkObject.asset_description
fixes
IntradayFix.underlying_name
Not replaced
lme_otc
create_lme_forward
LMEUtils.create_lme_forward
options
CommodityFutureOption.underlying_name
Not replaced
options
OptionBase.pnl_breakdown
OptionBase.pnl_explain
See also

Deprecations in sig.strategies

Classes
In sig.strategies, v8 deprecates and replaces the following classes:
Module
Deprecated v7 class
Replacement v8 class
basket_strategies
DynamicGlobalBasket
BasketStrategy
fx_forward_rolling_strategy
FXForwardRollingStrategy
RollingFXForwardStrategy
fx_forward_rolling_strategy
DynamicFXForwardRollingStrategy
DynamicRollingFXForwardStrategy
See also
Methods
In sig.strategies, v8 deprecates and replaces the following methods:
Module
Deprecated v7 method
Replacement v8 method
reinvestment_strategy
get_single_stock_strategy_name_parallel
get_single_stock_strategy
reinvestment_strategy
get_reinvestment_strategy
get_single_stock_strategy
rolling_bond_strategy
RollingBondStrategy.get_roll_schedule
RollingBondStrategy.rolling_schedule
See also
Decorators
In sig.strategies, v8 deprecates and replaces the following decorators:
Module
Deprecated v7 decorator
Replacement v8 decorator
runner.metaflow.decorators.function_flow
FunctionFlow
FunctionJob
runner.metaflow.decorators.strategy_flow
StrategyFlow
StrategyJob
See also

Deprecations in the Strategy class

In sig.strategies, v8 deprecates the following methods in the strategy.Strategy class:
Module
Deprecated v7 method
Replacement v8 method
strategy
Strategy.clean_up_margin
Strategy.add_margin_cleanup
strategy
Strategy.get_object
sig.obj.get
Note: You might not need to use Strategy.add_margin_cleanup.
By default, v8 automatically manages end-of-day margins in custom strategies. See Changes to the framework environment on this page.
See also
Strategy.analytics interface
In v8, the Strategy.analytics interface replaces the following deprecated methods:
  • Strategy.excess_return_history
  • Strategy.pnl_breakdown
  • Strategy.turnover
  • Strategy.intraday_turnover
  • Strategy.cash_turnover
  • Strategy.turnover_stats
  • Strategy.approximate_rounding_impact
  • Strategy.approximate_rounding_summary
  • Strategy.relative_attribution
  • Strategy.total_return_valuation_history
See also
Strategy.inspect interface
In v8, the Strategy.inspect interface replaces the following deprecated methods:
  • Strategy.evaluate_trades
  • Strategy.evaluate_positions
  • Strategy.historic_positions
  • Strategy.display_holdings
  • Strategy.display_run_details
  • Strategy.positions_df
  • Strategy.weights_df
  • Strategy.cash_df
  • Strategy.bottom_positions_df
  • Strategy.bottom_cash_df
  • Strategy.timeline_data
  • Strategy.tree_df
See also
Strategy.plot interface
In v8, the Strategy.plot interface replaces the following deprecated methods:
  • Strategy.interactive_tree_plot
  • Strategy.interactive_portfolio_table()
  • Strategy.interactive_timeline_plot()
  • Strategy.interactive_performance
In the Strategy.plot.performance method, the parameter inline is deprecated.
See also
DailyStrategy replaces some deprecated functionality in Strategy
In v8, the DailyStrategy class replaces some deprecated functionality in the Strategy class.
To update your code for v8, extend DailyStrategy instead of Strategy, and replace the deprecated methods below with their v8 equivalents.
  • The following methods are deprecated in the Strategy class, but implemented in DailyStrategy:
    Deprecated v7 method
    Replacement v8 method
    Strategy.add_method
    DailyStrategy.add_method
    Strategy.add_position_target
    DailyStrategy.add_position_target
    Strategy.add_trade
    DailyStrategy.add_trade
    Strategy.add_break_point
    DailyStrategy.add_break_point
    Strategy.add_fx_spot_trade
    DailyStrategy.add_fx_spot_trade
    Strategy.size_date_from_decision_dt
    DailyStrategy.size_date_from_decision_dt
    Strategy.size_dt_from_date
    DailyStrategy.size_dt_from_date
    Strategy.size_date_from_date
    DailyStrategy.size_date_from_date
    Strategy._decision_time
    DailyStrategy._decision_time
    Strategy._decision_tzinfo
    DailyStrategy._decision_tzinfo
    Strategy.size_time
    DailyStrategy.size_time
    Strategy.size_tzinfo
    DailyStrategy.size_tzinfo
    Strategy.execution_time
    DailyStrategy.execution_time
    Strategy.execution_tzinfo
    DailyStrategy.execution_tzinfo
    Strategy._size_dt_from_decision_dt_
    DailyStrategy._size_dt_from_decision_dt_
    Strategy._instrument_execution_dt_from_datetime
    DailyStrategy._instrument_execution_dt_from_datetime
    Strategy.decision_dt_from_execution_dt
    DailyStrategy.decision_dt_from_execution_dt
    Strategy.decision_dt_from_date
    DailyStrategy.decision_dt_from_date
  • Use DailyStrategy.add_method instead of the following methods:
    • Strategy.add_method
    • Strategy.add_processor
    • Strategy.add_processor_with_priority
  • Use DailyStrategy.add_position_target instead of the following methods:
    • Strategy.add_position_target
    • Strategy.set_position
    • Strategy.set_weight
  • Use DailyStrategy.add_trade instead of the following methods:
    • Strategy.add_trade
    • Strategy.add_position
    • Strategy.ir_swap_trade
    • Strategy.tr_swap_trade
    • Strategy.index_swap_trade
    • Strategy.fx_forward_trade
    • Strategy.lme_forward_trade
    • Strategy.lme_spread_trade
    • Strategy.index_forward_trade
    • Strategy.brl_swap_trade
    • Strategy.credit_index_trade
    • Strategy.xccy_swap_trade
  • Use DailyStrategy.add_break_point instead of the following methods:
    • Strategy.add_break_point
    • Strategy.stop_processing
  • Use DailyStrategy.add_fx_spot_trade instead of the following methods:
    • Strategy.add_fx_spot_trade
    • Strategy.fx_spot_trade
See also

Deprecations in other modules

SigTech framework v8 also deprecates the following methods and properties:
Module
Deprecated method or property
Replacement method or property
sig.config.config
ConfiguredEnvironment._quant_bridge
ConfiguredEnvironment.quant_bridge
sig.infra.analytics.fx.cross
FXCross.is_flipped_cross
FXCross.is_flipped
sig.indices.tradable_index
IntradayInstrument.intraday_db_field
Not replaced
sig.signal.library.allocation
factor_optimized_allocations
optimized_allocations
sig.sig_master
SIGMasterBase.filter_to_last_corporate_event
SIGMasterBase.filter_to_last_pit_record
See also
Last modified 11d ago