Code examples


Depth and Breadth

The SIGTech platform has built-in solutions to many common problems faced by quant researchers and traders alike - this page shows some of the key ways in which the platform saves users time.

Rolling Futures

Futures are a liquid and cheap way to gain exposure to a wide range of assets. However they must be rolled on a periodic basis to avoid expiry or triggering delivery.

In a few lines of code, users can create a continuous exposure to e.g. the front month of the E-Mini S&P500 futures, rolled over two days starting from the fifth day before expiry.

sig.RollingFutureStrategy(
 currency="USD",
 contract_code="ES",
 contract_sector="INDEX",
 rolling_rule="front",
 front_offset="-5:-3",
)

Interest Rate Swaps

The SIGTech platform aims to model the full lifecycle of each instrument, including, but not limited to, dividends and corporate actions for equities, coupons for bonds and daily variation margin for futures.

Owing to the data available and level of detail of the modeling, users are able to construct a wide range of complex listed and OTC instruments and trade these in a portfolio. Good examples are interest rate swaps and total return swaps.

The code snippet below builds a EUR IR swap with a fixed rate of 5% annual (30/360).

sig.InterestRateSwap(
 currency="EUR",
 trade_date=dtm.date(2017, 4, 14),
 start_date=dtm.date(2017, 1, 5),
 tenor=dtm.date(2022, 7, 5),
 fixed_rate=0.05,
)

Total Return Swaps

The example below builds a USD-denominated total return swap with the S&P500 Index as the underlying with a monthly reset financing rate of fed funds plus 200bps.

sig.TotalReturnSwap(
 currency="USD",
 trade_date=dtm.date(2017, 2, 6),
 maturity=dtm.date(2020, 10, 1),
 instrument_name="SPXT INDEX",
 financing_ticker=("FEDL01 INDEX", "1M"),
 financing_spread=200,
)

Options

One of the key strengths of the SIGTech platform is its comprehensive support for options, both vanilla and exotic.

Common options strategies such as straddles, strangles, butterflies can be quickly constructed in just a few lines of code. Users can then easily calculate and visualise the greeks over time.

The example below builds a USD-denominated EURUSD 3-month FX straddle at 35 delta, sized to target 500 vega and rolled every three months.

sig.Straddle(
 start_date=dtm.date(2019, 1, 3),
 currency="USD",
 group_name="EURUSD OTC OPTION GROUP",
 strike=0.35,
 strike_type="Delta",
 target_type="Vega",
 target_quantity=500.0,
 rolling_frequencies=["3M"],
 maturity="3M",
)

Generic Signal Strategy

Quant trading starts with a signal, and it is often desirable to keep that signal in its raw form for as long as possible before using it to generate portfolio allocations.

The SIGTech platform supports this workflow by separating the signal logic from the trading logic and providing a straightforward way of creating a robust, reliable backtest from a signal.

The snippet below builds a GBP-denominated strategy using a user-provided signal, rebalanced to the signal weights every week on a Monday. The conversion from signal values to portfolio weights is handled by a user-created allocation function and the total leverage is set to 250%.

sig.SignalStrategy(
 currency="GBP",
 signal_name="SIGNAL B3P4X2",
 rebalance_frequency="1W-MON",
 allocation_function=my_signal_to_weights_method,
 leverage=2.5,
)

FX Hedging

Another common problem in quant trading is the need to hedge the currency exposures of a strategy into a base currency using FX forwards.

The SIGTech platform handles this seamlessly by allowing users to put any arbitrary strategy built on the platform inside an FX forward hedging wrapper.

In the below example, a GBP-denominated strategy is hedged into USD with 1-month FX forwards. The FX hedge rebalance threshold is set to 2% and the FX exposure rebalance threshold is set to 1%.

sig.FXForwardHedgingStrategy(
 currency="USD",
 strategy_name="GBP LONG VALUE PREMIA AK429KC",
 hedging_tenor="1M",
 exposure_rebalance_threshold=0.01,
 hedge_rebalance_threshold=0.02,
)