Transaction cost
This page shows how transactions costs can be altered.
When running strategies, transactions costs are not considered by default. You can include transactions costs by running the following code.
There are default transaction costs defined either on the TradePricer
class or on the instrument class. These can be overridden when the environment is initialised.
A transaction cost model can be set by its instrument classname, its instrument group or its individual ticker. If the transaction model is not defined in the register, it defaults to the model defined on the instrument class.
The parameters used in the transaction cost can be updated or a new transaction model with new models can be passed.
The overrides passed are a dictionary with the following keys:
Class name
Group ticker
Instrument ticker
The values of the dictionary are a tuple with the first value being the name of the transaction model to use and the second any parameters the model might use.
Specifically, we can assign transaction cost models to instruments based on the following criteria:
Class name, such as
SingleStock
,Future
orCommodityFuture
.Group ticker, such as
ES COMDTY FUTURES GROUP
orUS GOVT BOND GROUP
.Instrument ticker, such as
1000045.SINGLE_STOCK.TRADABLE
,ESH18 COMDTY
orUS 2.5 2006/10/31 GOVT
.
Note: the above criteria is ordered by ascending specificity of scope.
Learn more: Example notebooks
Environment
This section will import relevant internal and external libraries, as well as setting up the platform environment.
Learn more: Environment setup
Transaction cost models available by default
A number of basic transaction cost models are available on the platform—they need to be passed calibrated parameters to function.
Background
Some glossary terms:
Cost versus arrival price (): represents the cost incurred on a trade, expressed as a percentage of price. Example: if and bid, or ask, price is £ 35.22, then cost incurred would be ca. £ 0.07.
Participation rate (): where is the order size, in units, and is a measure of the average daily volume, in units. is the proportion of the daily volume that is constituted by this trade.
Cost of transacting () is typically characterised as containing three parts:
Note: trade cost () = instant impact + temporary impact + permanent impact
Instant impact: cost incurred immediately, such as crossing the bid/offer spread or incurring slippage.
Temporary impact: adverse market price movement during the execution of the trade.
Permanent impact: difference in market price before and after the trade.
The temporary and permanent impacts are sometimes grouped together under the market impact.
Fixed commission
Applies a fixed commission to the trade, irrespective of quantity traded or price of instrument:
Result: applies a fixed 6.50 units of cost to the trade, in the currency of the trade.
Fixed cost (fixed spread from mid)
Applies a fixed cost from the mid of the instrument:
Result: applies a cost of 2 units of currency from the mid of the instrument.
Fixed relative cost (percentage spread from mid)
Applies a fixed cost relative to the mid of the instrument. 0.01
would equate to a charge of 1% of mid.
Result: applies a cost of 20 bps spread from mid to the trade.
Square-root market impact model
Cost is represented as only a market impact, expressed as:
Where is the daily volatility of returns and where and are some constants of . Sotiropoulos et. al (2018) suggest and for the U.S. equity markets.
This model can also be thought of as a spread varying with volatility (the 𝑐𝜎cσ term) and proportional to the participation rate raised to some power (theterm).
Usage 1:
Result: applies a cost of where and .
Usage 2:
Result: applies a cost of , where , and daily volatility is set to 1.2%.
Combined model (square-root market impact plus spread relative to mid)
Cost is represented as a combination of a spread and a market impact:
Usage:
Result: applies a cost of where , and . This would be equivalent to a 40 bps spread plus a square-root market impact type cost with the given values for and .
Building your own transaction cost model
Clients often have detailed and specific transaction cost data and models and wish to integrate these into the platform. The SigTech platform's flexible transaction cost API makes this as simple as building a method that takes inputs and returns a final trade price.
Anatomy of a transaction cost model
When a trade is to be executed, the platform goes through the following steps:
Using the instrument name, look in
T_COST_OVERRIDES
for a given method to run and parameters to pass to mentioned method. If none found, fall back to the default set of methods.Run the method with the parameters stored in
T_COST_OVERRIDES
.Inside method: execute instructions inside method, having access to all information stored in the parent class (more information below).
Inside method: return the price at which the trade will be executed.
Book trade at price .
A client's custom transaction cost model would need to be called by this method and make use of the inputs given by the parent class.
Creating a transaction cost model
Creating a transaction cost model is as simple as defining a new method and attaching this method to either the TradePricer
, for non-FX instruments, or FxPricer
, for FX instruments:
The custom transaction cost model is saved and can be set in the sig.config.T_COST_OVERRIDES
:
The model takes one parameter, namely multiple
, which is passed in through a dictionary.
Inputs: information available to a custom transaction cost model
A custom transaction cost model can make use of any of the properties existing in the parent class, TradePricer
:
Instrument name to trade
datetime
of tradeQuantity to trade
Currency of trade
Transaction type, such as outright and roll.
Tip: to see a full list, view the source code for TradePricer
by querying sig.TradePricer??
.
FX-specific transaction costs
The FX spot and forward transaction costs can be customised using the same T_COST_OVERRIDES
dictionary.
Due to how the FX time series is cached in the platform, the transaction costs applied to FX instruments are done so through the FxPricer
class, rather than the TradePricer
.
Note: transaction costs set in this way act on the entire history rather than one time point, which is the main difference.
Note: only spread_from_mid
is currently supported.
Set by currency cross
This sets the EURUSD pair to use the spread_from_mid
transaction model passing the parameter 0.0005
. This results in a 5 bps, or 0.05%, transaction cost (from mid) being applied.
Use case: custom option transaction cost model
The default behaviour is to take the bid/ask from the market vol surface data. The following is an example of doing the same with an override and how to apply a custom spread to the vol.
Adding the transaction cost methods
Two new transaction cost methods are added to the TradePricer
in the following example:
Note: once they are added they can then be used as an override in the environment configuration.
Testing the costs
Once the config is initialised with the overrides, these costs are applied throughout the framework.
The following code block shows how to retrieve the prices used on examples of EURGBP
and GBPUSD
options. The vol surface will be loaded for the first pricing of an option in each group.
EURUSD
GBPUSD
Querying the transaction cost model
The TradePricer interface allows you to get the information about the transaction cost model applied to a given instrument:
Last updated