Skip to content

add Algorithmic Transaction Cost Analysis models #54

@jaymon0703

Description

@jaymon0703

Algorithmic Transaction Cost Analysis

In Chapter 3 of "The Science of Algorithmic Trading and Portfolio Management," Robert Kissell, Ph.D covers a few models that may be worth implementing in blotter especially considering the extent to which blotter is used in the industry for post-trade analysis. Models eligible for inclusion are:

1. Implementation Shortfall

(first draft is complete and merged into 54_algotca)

Implementation Shortfall is a measure that represents the total cost of executing the investment idea. Implementation Shortfall is calculated as the difference between the paper return of a portfolio where all shares are assumed to have transacted at the manager's decision price and the actual return of the portfolio using actual transaction prices and shares executed.

is the total number of shares to trade. This should be made available as a parameter, with a reasonable default of simply what was executed, which assumes entire share allocation was transacted and the opportunity cost (below) will be zero.

is the manager's decision price. We should make this available as a param value to be specified by the user, with a reasonable default such as the Arrival Price.

is the price at the end of period n. This should be made available as a parameter as well (since it is the mid-price at the end of the trading horizon), with a suitable default perhaps being the price of the last executed transaction.

Actual portfolio return is the difference between the actual ending portfolio value and the value that was required to acquire the portfolio minus all fees.

represents the total number of shares in the portfolio

is the ending portfolio value

is the price paid to acquire the portfolio

Implementation Shortfall can be implemented in 4 ways:

  1. Assuming Complete Execution, in which case trading horizon end price for the opportunity cost (relevant for the Paper Return) is irrelevant, and Paper Return will be invalid.

  1. Using an Opportunity Cost (Perold 1988) component, where not all shares originally allocated for trading are finally executed. Opportunity Cost is the cost of not executing a portion of the originally allocated shares (S) for execution. This could be due to limit price constraints or a lack of liquidity. The formulation for Opportunity Cost is below:

The Implementation Shortfall formulation of Perold (1988) can be written as:

  1. Expanded Implementation Shortfall (Wayne Wagner)

Wayne Wagner's implementation categorizes costs into delay, trading and opportunity related costs. Assuming is the decision price, is the price when trading begins (ideally mid-point of bid-ask spread on this timestamp, when first child order enters the market...aka Arrival Price) and is the price at the end of trading. Then the Expanded IS can be written as:

If you substitute this price into Perold's IS, then IS can be written as:

This formula can be re-written into their separate delay, trading and opportunity cost related components as follow:

where each term (excluding fees) reflects the delay, trading and opportunity cost components respectively.

  1. Market Activity IS, which assumes the analyst is unaware of the manager's decision price. This should be our default method, and could be validated against the existence of a parameter for the decision price. For this method, we cut the first term off the Expanded IS implementation in order to assess only market activity IS:

Taking all the above into account, we should at a minimum have different methods for implementing Implementation Shortfall, with a parameter value for method=c("Complete", "Perold", "Wagner", "Market").

2. Trading Cost/Arrival Cost

See Step 1 in model # 9!

3. Trading Price Performance

Identical to Trading/Arrival Cost except underperformance against benchmark (ie. Arrival Price) is a negative value and outperformance is a positive value.

4. Benchmark Price Performance

Benchmark prices could be anything from Open (for arrival price) to Close (for index funds or otherwise using EOD prices for valuation), or Next Day Open/Close to ascertain permanent v temporary market impact. "Benchmark Price Performance Measures are the simplest of the TCA performance evaluation techniques."

5. VWAP Benchmark

Positive value indicates better performance, negative value indicates underperformance.

3 drawbacks: 1. The larger the order the closer the execution will be to VWAP, 2. where large block trades occur these could skew the results especially where executing algo is not able to participate as is normally the case for block trades, 3. not a useful comparison across stocks or different days for the same stock.

Execution quality as measured against VWAP should be considered in terms of the stock-specific spread. A 10bp underperformance for a stock with an average 20bp spread is worse than a 30bp underperformance for a stock with a 100bp average spread. Jeffrey Mazar and @braverock's obmodeling package may come in handy here.

3 Common variations (of which only the 3rd may need elaborating) include 1. Full-day VWAP, 2. Interval VWAP and 3. VWAP to EOD - typically used to compare performance of an execution which finished early, assuming broker had free reign to determine when to finish the order.

6. Participation Weighted Price (PWP) Benchmark

A variation of the VWAP benchmark in which the objective is to compare performance of the average execution with a likely realize price had the trader participated with a specific percentage of volume during the duration of the order.

Using an example, Kissell explains the PWP Benchmark assuming 100k shares are transacted, and specified participation rate is 20%, then PWP-20% benchmark price is computed as the volume weighted average price for the first 500k shares (100k/20%) that traded from the time the order arrived.

PWP Price = volume weighted price of the first PWP shares starting at the arrival time t_0

This benchmark suffers the same limitations as for VWAP in that the metric is not comparable between stocks or across days for the same stock. Also, the benchmark is subject to manipulation thanks to the potentially slowly dissipating temporary impact of an order, keeping the price inflated for larger buy orders or lower for larger sell orders to the benefit of the benchmark.

7. Relative Performance Measure

A percentile ranking of trading activity, this measure is preferable to the VWAP benchmark as it can be used to compare performance across stocks, days and different volatilities. The RPM measure can be mapped to a score:

RPM Quality
0-20% Poor
20-40% Fair
40-60% Average
60-80% Good
80-100% Excellent

8. Pre-Trade Benchmark

This benchmark is used to evaluate performance based on what was expected to occur. Of course any difference between what did occur and what was expected to occur could be beyond the control of the trader (e.g. price momentum, changing liquidity conditions etc). These are accounted for with the below z-score and market-adjusted cost analyses.

Pre-Trade Difference = Estimated Arrival Cost - Actual Arrival Cost

9. Index-Adjusted Performance Metric

Step 1: Compute Arrival Cost

Step 2: Compute Index Cost

Step 3: Compute Index Adjusted Cost

10. Z-Score Evaluation Metric

11. Market Cost Adjusted Z-Score

In addition to modelling TCA Kissell also covers models for comparing performance across algorithms by determining whether or not they are equivalent using non-parametric tests, including:

Paired Samples

  • Sign Test
  • Wilcoxon Signed Rank Test

Independent Samples

  • Median Test
  • Mann-Whitney U Test

Distribution Analysis

  • Chi-Square
  • Kolmogorov-Smirnov goodness of fit

There will almost certainly be opportunity to add Market Impact models to blotter but these will be opened as separate issues. We will add notes for Market Impact models in this issue, since there is a branch prefixed with the number of this issue (#54) which we would like to use for the duration of the GSoC 2019 project which addresses this issue.

Kissell ends off chapter 3 with the following statement which sums up the intention of this issue very nicely: "Transaction cost analysis remains an essential ingredient to achieve best execution. When administered properly, improved stock selection and reduced costs have proven to boost portfolio performance. As such, advancement of TCA models is an essential catalyst to further develop the algorithmic trading and market efficiency space."

Market Impact Models

Market impact is defined as the price impact on a financial instrument as the result of an order or a trade. The impact is broadly categorized into 2 components: Temporary Price Impact and Permanent Price Impact. Temporary impact is a function of order urgency. In order to trade a relatively larger amount of an instrument the trader will have to increase/decrease price for buy/sell orders. This a fundamental implication of Demand-Supply equilibrium. Permanent price impact would transpire where the act of a participant trading a particular stock in a particular direction leaks information to the market. The most obvious example of permanent price impact is with company announcements of earnings, or M&A announcements. For example, when AB InBev announced they were making a bid for SAB Miller the price in ZAR implied an almost 20% premium to the prevailing market price and the market adjusted immediately, accounting for the probability that the acquisition still needed regulatory approval. In these instances the information that led to the permanent price impact was an official announcement to the market by the company concerned. In the case of "market impact models" and permanent price impact the act of disclosing order volume on the order book by an informed trader could result in permanent price impact if the signal is picked up by other participants.

Modeling market impact is heavily biased by assumptions due to the fact that one's impact on the market cannot be observed in isolation to the impact without one's participation in the market. This is otherwise referred to as the Heisenberg uncertainty principle of Finance.

According to Kissell, there are 10 essential properties of a market impact model:

  1. Impact costs increase with size. Relatively larger orders with more likely leak information, or indicate increasing demand or supply, resulting the shift in demand or supply curves.
  2. Impact costs increase with volatility. Volatility serves as a proxy for price elasticity.
  3. Impact costs depend on trading strategy. More aggressive strategies will incur larger impact due to immediacy of trading at a larger relative percentage of volume (POV). Trading at a slower rate will have less impact, but more market risk. This is the "trader's dilemma" which is managing the trade-off between trading as urgently as possible and incurring the resulting impact cost, or slowing down the trade rate to reduce the impact costs but increasing the likelihood that future trading will occur at a worse price than what is currently available.
  4. Impact costs are dependent on market conditions and trading patterns. Stocks with larger average daily volumes (ADV) will incur relatively lower impact costs for the same volume than less liquid stocks.
  5. Impact costs have a temporary and permanent component.
  6. Impact costs are inversely dependent on market cap. This is a generalization but can be a proxy for liquidity and volatility. In other works stocks with bigger market caps will be larger index constituents and therefore have more active participants buying and selling interests in the company which should reduce the relative price volatility.
  7. Trading costs increase with spreads. This is intuitive if you consider the cost for trading immediately is crossing a bid-ask spread. The larger the spread the larger the impact cost. Generally less liquid stocks will have larger spreads.

Kissell mentions other factors but these are most likely covered above already in some shape or form.

Kissell elaborates on 2 types of models in Chapter 4 - Market Impact Models. 1. Almgren and Chriss, 2. I-Star. The AC model is a path-dependent approach in that it makes cost estimates based on the actual sequence of trades. Kissell refers to this as a bottom-up approach. The I* model by Kissell & Malamut is a top-down approach. Kissell mentions calculating the cost of the entire order first and the allocating to trade periods based on the actual trade schedule. TODO: understand whether the I model can be used with public data alone, and as a pre-trade benchmark.*

We will cover summaries of both models below:

Almgren and Chriss

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions