This example shows how to evaluate changes in trading costs due to liquidity, volatility, and market sensitivity to order flow and trades. With transaction cost analysis from the Kissell Research Group, you can simulate the trading cost environment for a collection of stocks. Sensitivity analysis enables you to estimate future trading costs for different market conditions to determine the appropriate portfolio contents that meet the needs of the investors.
Here, evaluate changes in trading costs due to decreasing average daily volume by 50% and doubling volatility. The example data uses the percentage of volume (POV) trade strategy.
To access the example code, enter edit KRGSensitivityAnalysisExample.m
at
the command line.
Retrieve the market-impact data from the Kissell Research Group
FTP site. Connect to the FTP site using the ftp
function
with a user name and password. Navigate to the MI_Parameters
folder
and retrieve the market-impact data in the MI_Encrypted_Parameters.csv
file. miData
contains
the encrypted market-impact date, code, and parameters.
f = ftp('ftp.kissellresearch.com','username','pwd'); mget(f,'MI_Encrypted_Parameters.csv'); close(f) miData = readtable('MI_Encrypted_Parameters.csv','delimiter', ... ',','ReadRowNames',false,'ReadVariableNames',true);
Create a Kissell Research Group transaction cost analysis object
k
.
k = krg(miData);
Load the example data from the file KRGExampleData.mat
,
which is included with the Trading
Toolbox™.
load KRGExampleData.mat
For a description of the example data, see Kissell Research Group Data Sets.
Estimate initial trading costs using the example data TradeData
.
The trading costs are:
Instantaneous trading cost itc
Market-impact cost mi
Timing risk tr
Price appreciation pa
Group all four trading costs into a numeric matrix initTCA
.
itc = iStar(k,TradeData); mi = marketImpact(k,TradeData); tr = timingRisk(k,TradeData); pa = priceAppreciation(k,TradeData); initTCA = [itc mi tr pa];
Set variables to create the scenario. Here, the scenario decreases average daily volume by 50% and doubles volatility. The stock price, volume, estimated alpha, and trade strategy remain unchanged from the example data. You can modify the values of these variables to create different scenarios. The fields are:
Average daily volume
Volatility
Stock price
Volume
Alpha estimate
POV trade strategy
Trade time trade strategy
adjADV = 0.5; adjVolatility = 2.0; adjPrice = 1.0; adjVolume = 1.0; adjAlpha = 1.0; adjPOV = 1.0; adjTradeTime = 1.0;
Adjust the example data based on the scenario variables.
TradeDataAdj = TradeData; TradeDataAdj.Size = TradeData.Size .* (1./adjADV); TradeDataAdj.ADV = TradeData.ADV .* adjADV; TradeDataAdj.Volatility = TradeData.Volatility .* adjVolatility; TradeDataAdj.Price = TradeData.Price .* adjPrice; TradeDataAdj.Alpha_bp = TradeData.Alpha_bp .* adjAlpha;
TradeDataAdj
contains the adjusted data.
Size doubles because average daily volume decreases by 50%.
Convert POV trade strategy to the trade time trade strategy.
[~,povFlag,timeFlag] = krg.krgDataFlags(TradeData); if povFlag TradeDataAdj.POV = TradeData.POV.*adjPOV; TradeDataAdj.TradeTime = TradeDataAdj.Size .* ... ((1-TradeDataAdj.POV) ./ TradeDataAdj.POV) .* (1./adjVolume); elseif timeFlag TradeDataAdj.TradeTime = tradedata.TradeTime .* adjTradeTime; TradeDataAdj.POV = TradeDataAdj.Size ./ ... (TradeDataAdj.Size + TradeDataAdj.TradeTime .* adjVolume); end
Estimate the trading costs based on the adjusted data. The numeric
matrix newTCA
contains the trading costs for the
scenario.
itc = iStar(k,TradeDataAdj); mi = marketImpact(k,TradeDataAdj); tr = timingRisk(k,TradeDataAdj); pa = priceAppreciation(k,TradeDataAdj); newTCA = [itc mi tr pa];
Subtract the trading costs from the scenario from the initial trading costs.
rawWI = newTCA - initTCA; wi = table(rawWI(:,1),rawWI(:,2),rawWI(:,3),rawWI(:,4), ... 'VariableNames',{'ITC','MI','TR','PA'});
The table wi
contains the full impact of
this scenario on the trading costs.
Display trading costs for the first three rows in wi
.
wi(1:3,:)
ans = ITC MI TR PA ______ ______ ______ _____ 43.05 0.65 290.80 -9.49 408.29 124.52 443.16 8.47 80.92 13.79 114.97 0.93
The variables in wi
are:
Instantaneous trading cost
Market-impact cost
Timing risk
Price appreciation
For details about the preceding calculations, contact the Kissell Research Group.
iStar
| krg
| marketImpact
| priceAppreciation
| timingRisk