Search…
Framework v8
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:
# Enable transaction costs
import sigtech.framework as sig
env = sig.init()
env['IGNORE_T_COSTS'] = False
See also

v8.5.0 (Jul 2022)

Optional parameter max_absolute_delta for delta hedging strategies

Adds optional float parameter max_absolute_delta to DeltaHedgingStrategy class.
max_absolute_delta defaults to None. If supplied, max_absolute_delta is the maximal allowed hedged delta at any moment in time, in the same units as delta (basis points for swaptions; number of underlying units for regular options).
See also

Diagnostic functions for cross-currency swaps

This release adds 3 diagnostic functions to the CrossCurrencySwap class:
  • swap_metrics
  • coupon_payment_dates
  • swap_details
See the API Reference for more information.
See also

Retrieve swap quotes from swap quote groups

This release adds functionality to retrieve swap quotes from swap quote groups:
# Retrieve swap quotes from swap quote groups
import sigtech.framework as sig
env = sig.init()
for curr in ['EUR', 'GBP', 'USD']:
group = sig.obj.get(f'{curr} SWAP QUOTE GROUP')
names = group.query_instrument_names()
print(names)
for n in names:
obj = sig.obj.get(n)
print(n, obj.tenor, obj.group_name, obj.float_day_count, obj.fixed_day_count, obj.float_frequency, obj.fixed_frequency, obj.interest_rate_index_object)
print(obj.intraday_history(period=dtm.timedelta(minutes=1)))

Bug fixes

Framework v8.5.0:
  • Checks that at least one valid value is present before calculating weighted stock factors in a basket strategy.
  • Shows Costs & Slippage in PnL breakdown when transaction costs are off.
  • Allows creation of cross-currency swaps that start in the past, ensuring that resettable cross-currency swaps work post-maturity.
  • Successfully validates futures expiry dates when expiry_month_offset > 0.
  • Checks for strike when required for rolling options.
  • Fixes an issue with get_single_stock_strategy when most_liquid=True and a list of tickers or exchange tickers is provided.
  • Fixes multiple issues with the DataCredibilityAdapter class.

v8.4.0 (Jul 2022)

In this release

Simulations now handle intraday data series

The simulation adapter now handles intraday data series. You can use the same functions to provide the framework with transformed market data.
See also

Add method holiday_data to all Calendar objects

For all Calendar objects, method holiday_data returns a time series with holiday information:
import sigtech.framework as sig
env = sig.init()
sig.obj.get('AUD CALENDAR').holiday_data()

Add RollingSwaption to sigtech.framework imports

When you import the SigTech framework under the standard alias, sig, you can now refer to the RollingSwaption class with sig.RollingSwaption:
import sigtech.framework as sig
# sig.RollingSwaption is available

List cached keys and strategies

Adds new methods:
  • StrategyService.list_keys
  • StrategyService.list_strategies
  • DataFrameService.list_keys
To list available keys and strategies in StrategyService:
stratserv = sig.env().strategy_service()
available_keys = stratserv.list_keys()
available_keys = stratserv.list_strategies()
To list available keys in DataFrameService:
dfserv = sig.env().dataframe_service()
available_keys = dfserv.list_keys()
By default, returned values are filtered to those compatible with the environment.
See also

Add resettable notional option to cross-currency swaps

Adds parameters to CrossCurrencySwap class:
  • use_notional_reset
  • ignore_future_notional_reset
Supported only for floating-floating swaps.

Bug fixes

Framework v8.4.0:
  • Strategies
    • reinvestment_strategy_overrides can now be either a datetime or a date.
    • Fixes a bug with time series indicies in basket strategies.
  • Swaps
    • Removes cross-currency coupons between valuation and settlement date.
  • Futures
    • Fixes a Copp-Clarke parsing error in 'PP INDEX' and 'KC COMDTY'.
    • Fixes a type error when computing exchange open/close from Copp-Clarke data.
    • For rolling futures, makes the rolling_table a property, calculated at request.
    • Fixes issue with SyntheticFXCross.
    • Fixes an issue with curve default data points in calculating forward rates.
  • Intraday
    • Fixes IndexError in intraday_history method
  • Data adapter, utilities, and services
    • Updates credibility aggregation logic in the DataCredibilityAdapter class.
    • Resolves pandas warning about fragmented DataFrame.
    • Resolves an issue with sig.obj.get_many_with_history for Bonds.
    • Raises an exception when fetching a non-existent key from the DataFrame Service.
    • HolidayCalendar.get_names now replaces deprecated Calendar.get_names.

v8.2.0 (Jun 2022)

In this release

Define and use instrument group labels

Use instrument group labels to return grouped PnL and weights results.
You can group by predefined labels, or define your own.
To view available predefined labels, use sig.list_labels—See API Reference | sig.list_labels.
To group PnL and weights by predefined instrument group label 'CURRENCY':
# Group PnL and weights by 'CURRENCY'
import sigtech.framework as sig
env=sig.init()
strat = sig.default_strategy_objects.rolling_futures.es_index_front()
strat.analytics.pnl_breakdown(label='CURRENCY')
strat.inspect.weights_df(label='CURRENCY')
strat.positions.get_exposure_weight(label='CURRENCY')
You can also define your own group labels. For example:
import sigtech.framework as sig
env=sig.init()
def currency_label_method(instrument_name):
return sig.obj.get(instrument_name).currency
sig.register_labelling_method('MY_CURRENCY_LABEL', currency_label_method)
To get an instrument group label for a particular instrument, use sig.get_label:
# Get instrument group label for a particular instrument
print(sig.get_label('CURRENCY', 'ESZ20 INDEX'))
print(sig.get_label('MY_CURRENCY_LABEL', 'ESZ20 INDEX'))
See also

MacroEconomicFix method history_df replaces macro

In sig.instruments.fixes.MacroEconomicFix, v8.2 deprecates the macro method and replaces it with history_df. This change makes method names more consistent between instrument types.
Convert your code to use history_df instead of macro:
# Replace deprecated method `macro` with `history_df`
import sigtech.framework as sig
env = sig.init()
# Deprecated in v8.2
# print(sig.obj.get('ECO PPP OECD US MACROECONOMICFIX').macro())
print(sig.obj.get('ECO PPP OECD US MACROECONOMICFIX').history_df())
See also

Enable overnight index cross currency swaps

v8.2 enables overnight index swaps (OIS) when creating cross currency (XCCY) swaps.
To create an OIS XCCY swap, pass is_ois=True when creating a CrossCurrencySwap. Optionally, pass ois_params—a dictionary with additional OIS parameters. See API Reference | CrossCurrencySwap for the details.
# Create an OIS XCCY swap
import sigtech.framework as sig
env = sig.init()
my_ois_xccy_swap = sig.CrossCurrencySwap(
currency='JPY',
pay_currency='USD',
trade_date=dtm.date(2018, 6, 15),
tenor='2Y',
is_ois=True,
# ois_params={...}
)
See also

Improved live streaming of intraday data

SigTech framework v8.2 improves intraday market data streaming. Subscribing to live market data now gives all updates since midnight, ensuring that no intraday data is missed.
This improvement is automatic upon subscription; you don't need to do anything differently to use it.
See also

Futures

Add settlement times to futures groups

In sig.FuturesContractGroup, property settlement_time gives the time of day when the futures price was generated.
This change allows product-specific settlement times for futures groups.
To get the settlement time for a futures group:
# Get settlement time for futures group
import sigtech.framework as sig
env = sig.init()
future = sig.obj.get('CLZ22 COMDTY')
print(future.group().settlement_time)
print(future.valuation_dt(env.asofdate))
See also

Date parameter d in FuturesContractGroup.active_contract defaults to today

In sig.instruments.FuturesContractGroup.active_contract, date parameter d is now optional, and defaults to datetime.date.today.
# Date param in FCG.active_contract is optional
import datetime as dtm
import sigtech.framework as sig
env = sig.init()
group = sig.obj.get('ES INDEX FUTURES GROUP')
# Equivalent
print(group.active_contract(dtm.date.today()))
print(group.active_contract())
See also

Futures contract groups use Copp-Clarke session data in open and close times for futures exchange

In v8.2, futures contract groups use Copp-Clarke trading session data, if it's available, to determine the exchange opening and closing times for futures.
This change is automatic; you don't need to do anything differently to use it.
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:
# Enable improved chart formatting in notebook files
import sigtech.framework as sig
env = sig.init()
sig.set_plot_mode()
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:
# Retrieve spot dollar duration values
ty = sig.RFPriceIndex(
currency='USD',
start_date=dtm.date(2020,1,4),
contract_code='TY',
contract_sector='COMDTY',
rolling_rule='front',
front_offset='-6:-5')
ty.spot_dv01()
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':
# Add a position target for CVaR
class MyStrategy(sig.DailyStrategy):
def strategy_initialization(self, dt):
self.add_position_target(
dtm.date(2021,7,10),
instrument_name='1003331.SINGLE_STOCK.TRADABLE',
units=0.5,
unit_type='HISTORICAL_CVAR'
)
To add a position target for VaR, call strat.add_position_target with parameter unit_type='HISTORICAL_VAR':
# Add a position target for VaR
class MyStrategy(sig.DailyStrategy):
def strategy_initialization(self, dt):
self.add_position_target(
dtm.date(2021,7,10),
instrument_name='1003331.SINGLE_STOCK.TRADABLE',
units=0.5,
unit_type='HISTORICAL_VAR'
)
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:
    # Install and import TensorFlow
    !pip install tensorflow
    import tensorflow as tf
    print("TensorFlow version:", tf.__version__)
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:
# `DataFrame.loc` not subscriptable with `datetime.date` in pandas 1.4
# Use `pd.to_datetime` to convert `datetime.date` to pandas datetime object
import pandas as pd
import numpy as np
import datetime as dtm
index = pd.date_range(dtm.date(2021, 1, 1), dtm.date(2021, 1, 31))
df = pd.DataFrame(
index = index,
data = {'Zeros': np.zeros(len(index))},
)
# Not supported in pandas 1.4
# df.loc[dtm.date(2021, 1, 1)]
df.loc[pd.to_datetime(dtm.date(2021, 1, 1))]
See also

New strategy performance visualization

To display an interactive visualization of a strategy's performance, use plot.performance:
# Display interactive strategy performance visualization
import sigtech.framework as sig
import datetime as dtm
env = sig.init()
strat = sig.ReinvestmentStrategy(
currency='USD',
start_date=dtm.date(2021, 1, 1),
underlyer='1000045.SINGLE_STOCK.TRADABLE',
)
strat.plot.performance()
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:
# Use v7 strategy performance visualization in v8
import sigtech.framework as sig
import datetime as dtm
env = sig.init()
strat = sig.ReinvestmentStrategy(
currency='USD',
start_date=dtm.date(2021, 1, 1),
underlyer='1000045.SINGLE_STOCK.TRADABLE',
)
strat.plot.performance(fallback=True)
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:
# Remove `inline` parameter from calls to `plot.performance`
import sigtech.framework as sig
import datetime as dtm
env = sig.init()
strat = sig.ReinvestmentStrategy(
currency='USD',
start_date=dtm.date(2021, 1, 1),
underlyer='1000045.SINGLE_STOCK.TRADABLE',
)
# Raises `TypeError` in v8
# strat.plot.performance(inline=True)
# Works correctly in v8
strat.plot.performance()
See also

Changes to the framework environment

Initialize and configure the framework environment

To initialize the v8 framework environment, use sig.init:
# Initialize the SigTech framework
import sigtech.framework as sig
env = sig.init()
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':
# Re-initialize the SigTech framework
import sigtech.framework as sig
env = sig.init()
# No effect on configured environment
env = sig.init()
# Destroys existing configured environment; initializes new one
env = sig.init(repeat_mode='reinit')
See also
Configure the framework environment
You can change the framework environment configuration settings immediately after calling sig.init:
# Change framework environment config settings
import sigtech.framework as sig
import datetime as dtm
settings = [
('TM_TIMEZONE', 'Australia/Sydney'),
('TM_CALENDAR', 'SYDNEYB CALENDAR'),
('TM_INTRADAY_OUT_OF_HOURS', True),
]
env = sig.init()
for (setting, value) in settings:
env[setting] = value
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:
# Set a trading calendar
import sigtech.framework as sig
env = sig.init()
env['TM_CALENDAR'] = 'London,CHR CALENDAR'
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:
# Enable transaction costs
import sigtech.framework as sig
env = sig.init()
env['IGNORE_T_COSTS'] = False
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:
# Switch off automatic end-of-day margin cleanup for custom strategies
import sigtech.framework as sig
env = sig.init()
env['AUTOMATIC_MARGIN_CLEANUP'] = False
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:
# Set `DEFAULT_RS_START_DATE` to Jan 02, 2008
import sigtech.framework as sig
import datetime as dtm
env = sig.init()
env[sig.config.DEFAULT_RS_START_DATE] = dtm.date(2008, 1, 2)
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.
# Define a custom strategy in v8
from typing import Optional, List
from typing_extensions import Literal
from sigtech.framework.strategies.strategy import Strategy
class NewStyle(Strategy):
__aliases__ = {'b': 'another_b'}
a: Optional[int] = 100
b: float = 3.0
c: List[str]
d: Literal['long', 'short'] = 'long'
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