Main Content

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, see Post-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, enter edit KRGPostTradeAnalysisExample.m at 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 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 PostTradeData from the file KRGExampleData.mat, which is included with the Datafeed Toolbox™.

load KRGExampleData.mat PostTradeData

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

Determine Implementation Shortfall Costs

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

  • Fixed cost ISFixed

  • Delay cost ISDelayCost

  • Execution cost ISExecutionCost

  • Opportunity cost ISOpportunityCost

For details about the cost components, see Post-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 cost ISCost.

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

Determine Profit

Determine the alpha capture Alpha_CapturePct. Divide realized profit Alpha_Realized by potential profit Alpha_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);
for ii = 1:lenAlpha_Realized
    if PostTradeData.Alpha_TotalPeriod(ii) > 0
        PostTradeData.Alpha_CapturePct(ii) = ...
        PostTradeData.Alpha_Realized(ii) ./ ...
        PostTradeData.Alpha_TotalPeriod(ii);
    else
        PostTradeData.Alpha_CapturePct(ii) = ...
        -(PostTradeData.Alpha_Realized(ii) - ...
        PostTradeData.Alpha_TotalPeriod(ii)) ./ ...
        PostTradeData.Alpha_TotalPeriod(ii);
    end
end

Determine Benchmark and Trading Costs

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

  • Close price of the previous day PrevClose_Cost

  • Open price Open_Cost

  • Close price Close_Cost

  • Arrival cost Arrival_Cost

  • Period VWAP PeriodVWAP_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-impact miCost and timing risk tr costs.

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