Framework v8
Search
K

Framework v7

This page is about a previous version of the SigTech framework.
Please see Release notes | SigTech framework v8: Latest for information on the latest framework version.
Pages in this category
On this page

v7.40.0 - v7.48.0 (Dec 2021 - Apr 2022)

In this section

v7.48.0 (11 Apr 2022)

Custom trade sizing methods now available

You can now define your own custom sizing methods in terms of quantities. Previously, custom sizing was only available via the traded instrument. The below code block demonstrates how to define a custom sizing method.
import sigtech.framework as sig
import datetime as dtm
def percent_sizing(instrument_name, units, dt):
return units / 100.0
sig.register_sizing_method('PERCENT', percent_sizing)
class MyStrategy(sig.DailyStrategy):
def strategy_initialization(self, dt):
# Order 200% of the stock
self.add_position_target(dtm.date(2021,7,10),
instrument_name='1003331.SINGLE_STOCK.TRADABLE',
units=200.0,
unit_type='PERCENT'
)
strat = MyStrategy(
currency='USD',
start_date=dtm.date(2021,7,1)
)

Default configuration now available for single stock strategy start date

Previously, retrieving single stock strategies via the sig.get_single_stock_strategy call would allow you to specify a minimum start date or revert to a default. You can now configure this default via the environment flag DEFAULT_RS_START_DATE. The following code block demonstrates this new functionality.
import sigtech.framework as sig
import datetime as dtm
# After intitializing your environment...
sig.env()[sig.config.DEFAULT_RS_START_DATE] = dtm.date(2009, 1, 2)

Rolling options strategies can now target notional values based on NAV

Previously, rolling option strategies would allow either a fixed target at each roll or a custom value. You can now set the target to scale with the size of the strategy via the target_type parameter. This parameter takes two values:
  • StrikeNotionalAsProportionOfNAV
  • SpotNotionalAsProportionOfNAV
The following code block demonstrates this added functionality using a rolling option straddle.
import sigtech.framework as sig
import datetime as dtm
import seaborn as sns
sns.set(rc={'figure.figsize': (18, 6)})
# Create option group
equity_option_group = sig.obj.get('SPX INDEX OTC OPTION GROUP')
# Create strategy
straddle = sig.Straddle(
currency = equity_option_group.underlying.currency,
start_date = dtm.date(2018, 10, 1),
group_name = equity_option_group.name,
strike_type = 'Delta',
strike = 0.5,
maturity = '3M',
rolling_frequencies = ['1M'],
target_quantity = 1, # 100% of strategy value
target_type = 'StrikeNotionalAsProportionOfNAV', # 'SpotNotionalAsProportionOfNAV' also available
close_out_at_roll = True,
)
# Query and plot performance
straddle.history().plot();

Drawdown plot added to the performance report

The performance report now includes a drawdown plot with additional enhancements.

v7.46.0 (07 Mar 2022)

Calculate the approximate return of a signal strategy

You can now calculate the approximate return of a signal strategy based on its weights, without having to construct the entire strategy. This allows you to perform multiple evaluations quickly and efficiently. The following code block demonstrates this new functionality.
import sigtech.framework as sig
import datetime as dtm
import numpy as np
from sigtech.framework.default_strategy_objects.rolling_futures import es_index_front
signal_ts = np.sign(es_index_front().history())
signal = sig.signal_library.from_ts(signal_ts.to_frame(es_index_front().name))
st=sig.SignalStrategy(
currency="USD",
start_date=dtm.date(2018, 3, 1),
signal_name=signal.name,
rebalance_frequency="1W",
include_trading_costs=False,
total_return=False,
unit_type='WEIGHT'
)
st.approx_return().plot()

v7.45.0 (24 Feb 2022)

Add expected returns to portfolio optimisations

You can now add your own estimates of expected returns when using the PortfolioOptimizer. Previously, functionality had been limited to the historical mean returns. Whilst this is still the default behaviour, you now have the option of using proprietary models for stock predictions and inputting your expectations into the optimisation framework during portfolio construction.
The following code block compares the previous and new approaches.
import sigtech.framework as sig
import pandas as pd
import numpy as np
stocks = ['A', 'B']
dates = pd.date_range('2020-01-01', freq='b', periods=20)
returns = pd.DataFrame(np.random.normal(1, 1e-3, (len(dates), len(stocks))), index=dates, columns=stocks)
expected_returns = pd.Series([1,2], index=stocks)
po = sig.PortfolioOptimizer().require_weights_l2_penalty().require_maximum_return(expected_returns=expected_returns)
po.calculate_weights(returns)

New IntradaySignalStrategy building block added

The new IntradaySignalStrategy building block clones the functionality of the existing SignalStrategy class but sets the defaults of certain parameters to intraday-focused values. This offers a more efficient way of creating intraday strategies.
The default parameters are: use_signal_for_rebalance_dates=True, t0_execution=True, execution_delay='5 minutes'.
The following code block demonstrates the use of this new building block.
import sigtech.framework as sig
import datetime as dtm
intraday_signal = pd.DataFrame(
{'ECZ22 CURNCY': [1, 0, 1]},
index = [dtm.datetime(2021,1,5, 21, 0, 0),
dtm.datetime(2021,1,5, 21, 0, 1),
dtm.datetime(2021,1,5, 21, 0, 2)]
)
intraday_strategy = sig.IntradaySignalStrategy(
currency='USD',
signal_name=sig.signal_library.from_ts(intraday_signal).name,
start_date=intraday_signal.first_valid_index()
)
intraday_strategy.build()

New SigMaster method creates customised universes on different dates

The new SIGMaster method get_universe_generator() returns an object offering the same filtering capabilities as SIGMaster but can also be applied to a customised universe across different dates.
Applying the filter using apply() returns a {date: universe} dictionary. The following code block demonstrates this added functionality.
import sigtech.framework as sig
import datetime as dtm
env = sig.init()
sm = env.sig_master()
# Get universe generator (same syntax as SIGMaster)
ug = sm.get_universe_generator()
ug = ug.filter(value='US', column='EXCHANGE_COUNTRY_ISO2', op='==')
ug = ug.filter(value='Technology', column='TRBC_ECONOMIC_SECTOR', op='==')
# Apply filters on specific dates
dates = [dtm.date(2022, 2, 2), dtm.date(2022, 3, 2)]
universes = ug.apply(dates)
This dictionary can be used as an input for the EquityUniverseFilter for more advanced filtering operations.
# Use as input for EquityUniverseFilter
euf = sig.EquityUniverseFilter(universes)

New methods for bulk data retrieval during strategy construction

You can now retrieve bulk data in advance when building strategies. This allows for the construction of a large number of strategies in one go, rather than building them individually.
The following code block demonstrates the use of these new methods in the specific case of reinvestment strategies.
import sigtech.framework as sig
env = sig.init()
env.set_shared_memory(False)
const = sig.obj.get('DAX INDEX').constituents_dict()
# Turn the list of tickers into a list of ready-built reinvestment strategies
sig.get_single_stock_strategy(list(const.values())[0])
A more general approach is offered by sig.calc_history(list_of_strategies). This retrieves all of the data used by the listed strategies and then runs those strategies.
This functionality replaces the existing DAGs methods.

Functions added to convert factor exposures to stock weights

More predefined functions have been added to convert factor exposures to stock weights when using the EquityFactorBasket.
Functions to weight stocks by their market cap or cumulative factor score are accessible through sig.EquityFactorBasket.AVAILABLE_FACTOR_TO_WEIGHT_FUNCTIONS.
You now have the option of combining factor scores after normalisation (z_score=True) and/or only take the long leg (rather than both long & short legs) when ranking stocks using the proportion keyword by passing long_only=True.
The following code block demonstrates these new functions.
import sigtech.framework as sig
import pandas as pd
dates = pd.bdate_range("2021-06-01", "2021-06-30", freq='b')
equity_filter = sig.EquityUniverseFilter('SX5E INDEX')
equity_filter.add('MARKETCAP', 'top', 20, 'Daily')
universe = equity_filter.apply_filter(dates)
all_tickers = list(set().union(*universe.to_dict().values()))
sig.get_single_stock_strategy(all_tickers)
factor_exposures = sig.FactorExposures()
factor_exposures.add_raw_factor_timeseries('Size', history_field='MARKETCAP')
factor_exposures.add_raw_factor_timeseries('Volume', history_field='Volume')
size_strategy_v1 = sig.EquityFactorBasket(
universe_filter=universe,
universe_mapping={s: f'{s} REINV STRATEGY' for s in all_tickers},
factor_exposure_generator=factor_exposures,
currency="USD",
start_date=dates[0],
end_date=dates[-1],
rebalance_frequency="1BD",
factors_to_weight_kwargs={'proportion': 0.1, 'factor_weights': {'Size': -1, 'Volume': -1}, 'long_only': False, "z_score": True},
factors_to_weight_function=sig.EquityFactorBasket.AVAILABLE_FACTOR_TO_WEIGHT_FUNCTIONS.FACTOR_WEIGHTED
)

v7.44.0 (07 Feb 2022)

New argument added to the initialisation function

Previously, attempting to initialise your environment more than once - with init() - would terminate the notebook execution and generate a long error message. This error message has been simplified and an additional argument - repeat_mode - has been added to the init() function. Attempts to initialise an already initialised environment will produce different behaviours based on the value of repeat_mode:
  • 'reinit' - Destroys the current environment and creates a new one. A warning message explaining these actions is printed
  • 'error' - The execution terminates and a clearer error message is printed
  • 'warning' - A warning is printed and the init() has no effect (default)
These behaviours are described in the code block below:
import sigtech.framework as sig
sig.init()
# The environment is now initialised
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

Delta Hedging Rebalance Dates

When hedging an option using the DeltaHedgingStrategy, you can now choose for hedge adjustments to occur only on dates when the options are rolled. This can be achieved by setting the rebalance_hedge_on_roll parameter to True. This reduces turnover from the hedge rebalancing and concentrates trading on the same day for both the options strategy and hedge. However, the delta will not be exactly hedged between trades. The below code block demonstrates the use of this new functionality.
import sigtech.framework as sig
import datetime as dtm
underlying = sig.RollingOption(
currency="USD",
start_date=dtm.date(2017, 1, 1),
end_date=dtm.date(2017,12,1),
group_name="SPX INDEX OTC OPTION GROUP",
option_type="Call",
maturity="3M",
rolling_frequencies=["1M"],
strike_type="SPOT",
strike="SPOT+10%",
ticker='USD SPX TEST DHS CALL RO'
)
strat = sig.DeltaHedgingStrategy(
currency="USD",
start_date=underlying.start_date,
end_date=underlying.end_date,
option_strategy_name=underlying.name,
hedging_instrument_type="ETF",
rebalance_hedge_on_roll=True
)
You can also pass a list of dates to rebalance the hedge on, using the custom_hedge_dates parameter. The below code block demonstrates this new feature.
import sigtech.framework as sig
import pandas as pd
import datetime as dtm
underlying = sig.RollingOption(
currency="USD",
start_date=dtm.date(2017, 1, 1),
end_date=dtm.date(2017,12,1),
group_name="SPX INDEX OTC OPTION GROUP",
option_type="Call",
maturity="3M",
rolling_frequencies=["1M"],
strike_type="SPOT",
strike="SPOT+10%",
ticker='USD SPX TEST DHS CALL RO'
)
custom_dates = [
underlying.start_date + pd.tseries.offsets.BDay(2),
dtm.date(2017, 5, 10),
dtm.date(2017, 10, 2)
]
strat = sig.DeltaHedgingStrategy(
currency="USD",
start_date=underlying.start_date,
end_date=underlying.end_date,
option_strategy_name=underlying.name,
hedging_instrument_type="ETF",
custom_hedge_dates=custom_dates
)

New threshold function added to SignalStrategy for rebalancing

The SIGNALCHANGE function has been added to the AVAILABLE_THRESHOLD_FUNCTIONS for the SignalStrategy. When applied, the function will trigger a rebalance if the signal value changes. This replaces the previous approach which would rebalance an instrument regardless of whether or not the signal value had changed.
The following code block demonstrates the use of this new function.
import sigtech.framework as sig
import numpy as np
import pandas as pd
import datetime as dtm
import sigtech.framework.signal.library as signal_lib
from sigtech.framework.signal.signal_strategy import SignalStrategy
from sigtech.framework.default_strategy_objects.rolling_futures import es_index_front
signal_ts = np.sign(es_index_front().history())
signal_obj = signal_lib.from_ts(signal_ts.to_frame(es_index_front().name))
strategy_w_threshold = sig.SignalStrategy(
currency='USD',
start_date=dtm.datetime(2010, 1, 4),
end_date=dtm.datetime(2012, 2, 6),
signal_name=signal_obj.name,
use_signal_for_rebalance_dates=True,
threshold_function=sig.SignalStrategy.AVAILABLE_THRESHOLD_FUNCTIONS.SIGNAL_CHANGE,
)

v7.43.0 (26 Jan 2022)

Back-adjusted futures prices now available

You now have the ability to work with back-adjusted futures series in order to avoid triggering spurious trading signals during the roll. The following code block demonstrates this functionality by setting the back_adjusted parameter to True.
import sigtech.framework as sig
import numpy as np
import pandas as pd
pi = sig.RFPriceIndex(
currency='USD',
start_date=dtm.date(2019, 1, 1),
end_date=dtm.date(2020, 6, 4),
contract_code='C ',
contract_sector='Comdty',
front_offset='-4:-1',
back_adjusted=True
)

v7.42.0 (21 Jan 2022)

Custom aggregation metrics added to EquityUniverseFilter

You can now access the full set of methods and properties available for a single stock when implementing custom aggregation metrics via the EquityUniverseFilter. These new capabilities are accessible by passing an additional argument - stock_obj - to the aggregation function.
The code block below demonstrates the use of this new functionality.
import sigtech.framework as sig
import datetime as dtm
def compute_rolling_volatility(ts, stock_obj):
# ts may not be used
adjusted_prices = stock_obj.adjusted_price_history(True, True)
return 1 / adjusted_prices.pct_change().dropna().rolling(window=21).std()
euf = sig.EquityUniverseFilter('SPX INDEX')
euf.add('Volume', 'top', 5, 'Daily', compute_rolling_volatility)

v7.41.0 (18 Jan 2022)

New functionality for hedging FX forwards

A new parameter has been added to the FXForwardHedgingStrategy class which allows you to hedge using multiple FX Forwards in different currencies. By setting the use_holdings_for_hedge_ccy parameter to True, the currencies of the bottom level assets in your strategy will be hedged in proportion to their respective weights.
This replaces the previous approach of hedging the total value of the strategy in its currency into the FXForwardHedgingStrategy currency. This change allows for a better hedge of complex, multi-currency strategies. The below code block demonstrates the construction of a strategy using the use_holdings_for_hedge_ccy parameter.
import sigtech.framework as sig
import datetime as dtm
import pandas as pd
import numpy as np
sp500_rfs = sig.default_strategy_objects.rolling_futures.es_index_front()
ftse_rfs = sig.default_strategy_objects.rolling_futures.z_index_front()
underlying_strat = sig.BasketStrategy(
currency = 'EUR',
constituent_names = [sp500_rfs.name, ftse_rfs.name],
weights = [0.5, 0.5],
start_date = dtm.date(2020,1,1),
rebalance_frequency = '1W'
)
hedged_strat = sig.FXForwardHedgingStrategy(
currency = 'AUD',
strategy_name = underlying_strat.name,
hedging_tenor = '1M',
use_holdings_for_hedge_ccy = True,
start_date = underlying_strat.start_date,
hedge_rebalance_threshold = 0.1,
exposure_rebalance_threshold = 0.1
)
As hedges are applied after orders are placed, this added functionality may not be suitable for high turnover strategies.

Execution points parameter added

A new option ('EXECUTION_PTS') has been added for the type of strategy time points. This gives the times where orders are executed on all levels in the strategy. This can be used as an input to interactive_portfolio_table, historic_positions and strategy_dt_list.
Example:
import sigtech.framework as sig
import datetime as dtm
# Use default strategy
es = sig.default_strategy_objects.rolling_futures.es_index_front()
# Example of retrieving execution times
execution_times = es.strategy_dt_list('EXECUTION_PTS')
# Example of obtaining positions at execution times
positions_df = es.inspect.historic_positions('EXECUTION_PTS')
# Example of using execution times in portfolio table
es.plot.portfolio_table('EXECUTION_PTS', start_dt=dtm.date(2019,1,1), end_dt=dtm.date(2020,1,1))

Custom roll schedule added to RollingFXForward

The RollingFXForwardStrategy now allows you to input a rolling frequency or a custom roll schedule . In particular it allows for the monthly or daily roll of longer term forwards. This replaces the previous approach which restricted you to a roll offset from the forward maturity.
The below code block demonstrates the use of the rolling_frequencies parameter - set to roll monthly - when trading a 3 month rolling EUR USD forward.
import sigtech.framework as sig
import datetime as dtm
rfxs1 = sig.RollingFXForwardStrategy(
long_currency="EUR",
currency="USD",
forward_tenor="3M",
start_date=dtm.date(2010, 9, 15),
rolling_frequencies=['1M'],
)
This can be contrasted with the use of the custom_roll_datesparameter which allows you to specify a particular roll schedule. The following code block demonstrates the use of this parameter, setting a schedule containing only two dates.
import sigtech.framework as sig
import datetime as dtm
rfxs2 = sig.RollingFXForwardStrategy(
long_currency="EUR",
currency="USD",
forward_tenor="3M",
start_date=dtm.date(2010, 9, 15),
custom_roll_dates=[dtm.date(2010, 10, 18), dtm.date(2011, 10, 25)],
)

New functionality added to the PerformanceReport

Two new views have been added to the PerformanceReport which allow for the inclusion of currency based metrics. The following code block demonstrates how to include these new views.
import sigtech.framework as sig
import datetime as dtm
import pandas as pd
rfs = sig.RollingFutureStrategy(
currency='USD',
start_date=dtm.date(2020,1,1),
contract_code='ES',
contract_sector='INDEX',
rolling_rule='front',
fixed_contracts=1
)
rfs.build()
dates = pd.date_range('2021-01-04', '2021-12-01', freq='1W-MON')
sig.PerformanceReport(rfs, views=[sig.View.SUMMARY_SINGLE_CCY, sig.View.SUMMARY_ROLLING_CCY_SERIES], dates=dates).report()
The new aum argument allows you to pass a representative AUM figure. This is useful in strategies where initial_cash=0 as it avoids dividing by zero. Following on from the above code block, the use of this new argument is demonstrated below.
sig.PerformanceReport(rfs, dates=dates, views=[sig.View.SUMMARY_SINGLE]).report()
first_contract = sig.obj.get(rfs.rolling_table.rolled_in_contract.iloc[0])
first_contract_value = first_contract.history().asof(rfs.start_date.strftime("%Y-%m-%d")) * first_contract.contract_size
sig.PerformanceReport(
rfs,
dates=dates,
views=[sig.View.SUMMARY_SINGLE],
aum=first_contract_value
).report()
In addition, you can now generate a PerformanceReport with compounded metrics by passing compound_metrics=True . The below code block demonstrates this feature by building on the examples provided above.
sig.PerformanceReport(
rfs,
dates=dates[-5:],
views=[sig.View.SUMMARY_ROLLING_SERIES],
aum=first_contract_value,
compound_metrics=True
).report()

New technical indicators added to the platform

A new set of indicators (MACD, KDJ, RSI, BOLL, WR, ADX) for the technical analysis of price movements has been added to sigtech.framework.signal.library.technical_indictors.

v7.40.0 (20 Dec 2021)

New methods available for defining and applying custom risk measures when sizing a strategy

It is now possible to define a custom risk measure and use it to size positions in a strategy. The addition of a new parameter - sizing_method - and a new option - CUSTOM - for the existing unit_type parameter replaces the previously used PV01 mechanism for sizing swaps. The following code block describes this new functionality, where the ‘pv01_to_notional' method is defined on rates instruments - like swaps - to trade PV01.
self.add_position_target(dt, underlying, target_units,
unit_type='CUSTOM',
sizing_method='pv01_to_notional')
This method can be used as part of building a custom strategy. Please see our Custom strategies page to learn more.

Wider range of swap data now available via Default Universe datasets

The extension of the DefaultUniverses functionality allows for easy access and caching of returns series for single stocks, as well as returns, PV01, and rates for forward starting swaps.
The following code block demonstrates the retrieval of a single stock strategy returns series for specific stock tickers:
from sigtech.framework.experimental.default_universes import DefaultUniverses
du = DefaultUniverses(local_path='du_cache', force_local=True)
df_stocks = du.universe(
'Specific Stocks',
tickers=[
'1000045.SINGLE_STOCK.TRADABLE',
'1001962.SINGLE_STOCK.TRADABLE'
]
)
This can be contrasted with the code block below which demonstrates the retrieval of data for a USD 5Y swap starting in 3 months and a USD 3Y swap starting immediately:
df_swaps = du.universe(
'Fair Swap Rates',
tickers=['USD 3Mx5Y', 'USD 3Y']
)

Additional parameters added to the Basket Strategy

The BasketStrategy has been extended to include: 1) unit types used for weights, and 2) long-short constituent conversion.
The parameters added to the strategy are:
  • convert_long_short_weight: Determines if the strategy applies long-short conversion (default is False)
  • use_db_for_short_version: Determines if the long-short conversion examines the object cache for the same short strategy (default is False)
  • unit_type: Sets the units used for weighting (default is 'WEIGHT')
The below code block demonstrates the use of these new features.
import sigtech.framework as sig
import datetime as dtm
from sigtech.framework.default_strategy_objects.rolling_futures import cl_comdty_f_0, co_comdty_f_0
b = sig.BasketStrategy(
currency='USD',
start_date=dtm.datetime(2013, 12, 16),
end_date=dtm.datetime(2014, 1, 15),
constituent_names=[
cl_comdty_f_0().name,
co_comdty_f_0().name,
],
weights=[0.5, -0.25],
rebalance_frequency='EOM',
convert_long_short_weight=True,
)

v7.30.0 - v7.38.0 (Oct 2021 - Dec 2021)

In this section

v7.38.0 (13 Dec 2021)

Greater Flexibility when Retrieving Futures Contracts

The new get_future_curve method allows users to retrieve all of the contracts within a FuturesContractGroup with a price on the requested date. This creates a more efficient process by removing the need to search for contracts expiring after the specified date.
Python
Output
import sigtech.framework as sig
g = sig.obj.get('CL COMDTY FUTURES GROUP')
g.get_future_curve(dtm.date(2020,1,1))
contract value expiry days
0 CLG20 COMDTY 61.06 2020-01-21 20
1 CLH20 COMDTY 60.77 2020-02-20 50
2 CLJ20 COMDTY 60.41 2020-03-20 79
3 CLK20 COMDTY 59.97 2020-04-21 111
4 CLM20 COMDTY 59.44 2020-05-19 139
... ... ... ... ...
128 CLV30 COMDTY 52.84 2030-09-20 3915
129 CLX30 COMDTY 52.84 2030-10-22 3947
130 CLZ30 COMDTY 52.84 2030-11-20 3976
131 CLF31 COMDTY 52.84 2030-12-19 4005
132 CLG31 COMDTY 52.84 2031-01-21 4038
133 rows × 4 columns
Once the required contracts have been retrieved, the plot_curve_on_dates __ and plot_end_on_curve_on_dates methods allow users to generate visualisations of all available contract prices.
Python
Output
import sigtech.framework as sig
import pandas as pd
g = sig.obj.get('CL COMDTY FUTURES GROUP')
g.curve_plots.plot_curve_on_dates(pd.date_range('2015-01-01', '2021-11-22', freq='Y'))

New Credit Index Trading Strategy Available

Users now have the ability to construct strategies that trade credit index instruments, with the introduction of the RollingCreditIndexStrategy. This added functionality also allows for the reinvestment of coupons. The following code block demonstrates how this strategy can be built:
from sigtech.framework.strategies.rolling_credit_index_strategy import RollingCreditIndexStrategy
import datetime as dtm
s = RollingCreditIndexStrategy(
start_date=dtm.date(2013, 12, 1),
end_date=dtm.date(2021, 2, 10),
index='XOVER',
tenor='5Y',
currency='EUR',
reinvestment_mode='Coupon',
rebalance_frequency='3M',
roll_offset_days=0
)
s.history().plot();

v7.37.0 (03 Dec 2021)

New Function for Swaption Volatility Data

Users can now retrieve daily, at-the-money swaption normal volatility data. This data is available for both rolling and fixed expiry swaptions.
If you would like to access SigTech's swaptions data, please contact [email protected].

Extra Features Added to the Rolling Swap Strategy

New functionality has been added which allows for the retrieval of:
  • The daily spot or forward swap fair rate
  • The swap's DV01
  • The daily P&L for entering a fair swap on the previous day and holding it for one day.
The below code block demonstrates the use of the fair_swap_rate:
Python
Output
import sigtech.framework as sig
import datetime as dtm
sig.InterestRateSwapGroup.fair_swap_rate(
'USD',
'5y',
dtm.date(2017, 4, 1),
dtm.date(2017, 4, 10)
)
Rate 5Y PV01 5Y PnL 5Y
2017-04-03 1.976200 0.000480 NaN
2017-04-04 2.006050 0.000479 -0.001398
2017-04-05 1.968100 0.000480 0.001853
2017-04-06 1.975799 0.000480 -0.000249
2017-04-07 2.026850 0.000479 -0.002421
2017-04-10 1.997280 0.000479 0.001444

Retrieve the Most Liquid Stock from a Given Ticker

The get_most_liquid_stock function has been added to the platform. The function returns the most liquid stock within a specified tradable ticker, exchange ticker, or list of tickers. The following code block demonstrates the use of the function.
import sigtech.framework as sig
from sigtech.framework.equities.liquidity_indicators import LiquidityIndicators
sig.get_most_liquid_stock(
exchange_ticker='AAPL',
rolling_window=30,
liquidity_function=LiquidityIndicators.rolling_dollar_vol,
filters={'EXCHANGE_COUNTRY_ISO2': ['US']}
)

Strike Optimisation now Available for Options

A new function has been added which allows users to search for the option strike at a given price level. This facilitates price-targeted investing. The code block below demonstrates the use of this new functionality.
import sigtech.framework as sig
import datetime as dtm
spx_g = sig.obj.get('SPX INDEX OTC OPTION GROUP')
# Find the strike of a 1-year call option that was worth $20.0 on 2021-10-15
spx_g.strike_from_price(20.0, dtm.date(2021, 10, 15), '1Y', 'Call')

Time and Timezone Optionality now Available for Instrument Time Series

Users now have the option of including the time and UTC timezone when calling the history() method on financial instruments. The below code block demonstrates this new functionality.