Analyze Trading Execution Results

This example shows how to conduct post-trade analysis using transaction cost analysis from the Kissell Research Group. Post-trade analysis includes implementation shortfall, alpha capture, benchmark costs, broker value add, and Z-Score. For details about these metrics, seePost-Trade Analysis Metrics Definitions. You can use post-trade analysis to evaluate portfolio returns and profits. You can measure performance of brokers and algorithms.

To access the example code, enteredit KRGPostTradeAnalysisExample.mat the command line.

Retrieve Market-Impact Parameters and Load Transaction Data

Retrieve the market-impact data from the Kissell Research Group FTP site. Connect to the FTP site using theftpfunction with a user name and password. Navigate to theMI_Parametersfolder and retrieve the market-impact data in theMI_Encrypted_Parameters.csvfile.miDatacontains 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 objectk.

k = krg(miData);

Load the example dataPostTradeDatafrom the fileKRGExampleData.mat, which is included with the Trading Toolbox™.

loadKRGExampleData.matPostTradeData

For a description of the example data, seeKissell Research Group Data Sets.

Determine Implementation Shortfall Costs

Determine the components of the implementation shortfall costs in basis points. The components are:

  • Fixed costISFixed

  • Delay costISDelayCost

  • Execution costISExecutionCost

  • Opportunity costISOpportunityCost

For details about the cost components, seePost-Trade Analysis Metrics Definitions.

PostTradeData。ISDollars =...PostTradeData。OrderShares .* PostTradeData.ISDecisionPrice; PostTradeData.ISFixed =...PostTradeData。ISFixedDollars ./ PostTradeData.ISDollars*10000; PostTradeData.ISDelayCost =...PostTradeData。OrderShares .*...(PostTradeData.ISArrivalPrice-PostTradeData.ISDecisionPrice).*...PostTradeData。SideIndicator。/ PostTradeData.ISDollars*1000; PostTradeData.ISExecutionCost =...PostTradeData。TradedShares .*...(PostTradeData.AvgExecPrice-PostTradeData.ISArrivalPrice).*...PostTradeData。SideIndicator。/ PostTradeData.ISDollars*1000; PostTradeData.ISOpportunityCost =...(PostTradeData.OrderShares-PostTradeData.TradedShares).*...(PostTradeData.ISEndPrice-PostTradeData.ISArrivalPrice).*...PostTradeData。SideIndicator。/ PostTradeData.ISDollars*1000;

Determine the total implementation shortfall costISCost.

PostTradeData。ISCost = PostTradeData.ISFixed +...PostTradeData。ISDelayCost + PostTradeData.ISExecutionCost +...PostTradeData。ISOpportunityCost;

Determine Profit

Determine the alpha captureAlpha_CapturePct. Divide realized profitAlpha_Realizedby potential profitAlpha_TotalPeriod.

PostTradeData。Alpha_Realized =...(PostTradeData.ISEndPrice-PostTradeData.AvgExecPrice).*...PostTradeData。TradedShares .* PostTradeData.SideIndicator ./...(PostTradeData.TradedShares .* PostTradeData.ISArrivalPrice)*10000; PostTradeData.Alpha_TotalPeriod =...(PostTradeData.ISEndPrice-PostTradeData.ISArrivalPrice).*...PostTradeData。TradedShares .* PostTradeData.SideIndicator ./...(PostTradeData.TradedShares .* PostTradeData.ISArrivalPrice)*10000; lenAlpha_Realized = length(PostTradeData.Alpha_Realized); PostTradeData.Alpha_CapturePct = zeros(lenAlpha_Realized,1);forii = 1:lenAlpha_RealizedifPostTradeData。Alpha_TotalPeriod(ii) > 0 PostTradeData.Alpha_CapturePct(ii) =...PostTradeData。Alpha_Realized(ii) ./...PostTradeData。Alpha_TotalPeriod(ii);elsePostTradeData。Alpha_CapturePct(ii) =...-(PostTradeData.Alpha_Realized(ii) -...PostTradeData。Alpha_TotalPeriod(ii)) ./...PostTradeData。Alpha_TotalPeriod(ii);endend

Determine Benchmark and Trading Costs

Determine benchmark costs in basis points. Here, the benchmark prices are:

  • Close price of the previous dayPrevClose_Cost

  • Open priceOpen_Cost

  • Close priceClose_Cost

  • Arrival costArrival_Cost

  • Period VWAPPeriodVWAP_Cost

PostTradeData。PrevClose_Cost =...(PostTradeData.AvgExecPrice-PostTradeData.PrevClose).*...PostTradeData。SideIndicator ./ PostTradeData.PrevClose*10000; PostTradeData.Open_Cost =...(PostTradeData.AvgExecPrice-PostTradeData.Open).*...PostTradeData。SideIndicator ./ PostTradeData.Open*10000; PostTradeData.Close_Cost = (PostTradeData.AvgExecPrice-PostTradeData.Close).*...PostTradeData。SideIndicator ./ PostTradeData.Close*10000; PostTradeData.Arrival_Cost = (PostTradeData.AvgExecPrice-...PostTradeData。ArrivalPrice).*...PostTradeData。SideIndicator ./ PostTradeData.ArrivalPrice*10000; PostTradeData.PeriodVWAP_Cost = (PostTradeData.AvgExecPrice-...PostTradeData。PeriodVWAP).*...PostTradeData。SideIndicator。/ PostTradeData.PeriodVWAP*10000;

Estimate market-impactmiCostand timing risktrcosts.

PostTradeData。Size = PostTradeData.TradedShares ./ PostTradeData.ADV; PostTradeData.Price = PostTradeData.ArrivalPrice; PostTradeData.miCost = marketImpact(k,PostTradeData); PostTradeData.tr = timingRisk(k,PostTradeData);

Determine Broker Value Add and Z-Score

Determine the broker value add using the arrival cost and market impact.

PostTradeData。ValueAdd = (PostTradeData.Arrival_Cost-PostTradeData.miCost) * -1;

Determine the Z-Score using the broker value add and timing risk.

PostTradeData。zScore = PostTradeData.ValueAdd./PostTradeData.tr;

For details about the preceding calculations, contact the Kissell Research Group.

See Also

||

Related Topics