Lesson 4.4: Transaction costs and capacity
Learn what trading costs: spread, fees, slippage and impact, the square-root law, how turnover drags on a Sharpe ratio, and how much money a strategy can run.
By the end of this lesson you will be able to list the explicit and implicit costs of trading, estimate the market impact of an order from its size, volatility and the day's volume using the square-root rule, work out how costs and turnover reduce a strategy's return and Sharpe ratio, find the break-even and the best trade size for a strategy and so its capacity, and test a backtest against doubled costs. You will show that an order of 1 per cent of a day's volume in a stock with 2 per cent daily volatility costs about 20 basis points of impact, that a strategy that turns its capital over 12 times a year at 10 basis points a trade loses 1.2 percentage points a year and drops from a Sharpe ratio of 1.0 to 0.85, and that a strategy with a 40-basis-point gross edge per round trip makes its most profit at 0.25 per cent of daily volume, where impact has taken two thirds of what was left after fixed costs. You should have read Lessons 1.4 on costs, 3.3 on signals and 4.1 on backtest design. The mathematics is percentages, basis points and a square root. This course is education about how markets and research work, not investment advice.
Every earlier lesson in this module has pointed at costs and then moved on. Here we take them head on, because for a large share of strategies the costs decide the whole question. A signal that predicts a few basis points per trade can be a gold mine if you can trade it for nothing and worthless if you cannot. And costs are the one part of a backtest that gets worse as you succeed, because the more money you run, the more you move the market against yourself. A basis point, as before, is one hundredth of a percentage point: 0.01 per cent.
Where the costs come from
Cost · What it is · How it behavesBrokerage and exchange fees · Charges for placing and clearing a trade · Small, mostly proportional to the amount traded
Taxes and statutory charges · In India, charges such as the securities transaction tax, stamp duty and GST on brokerage · Set by government and exchanges, and they change, so look up the current rates when you model. They can be a large share of the cost of a high-turnover strategy
The bid-ask spread · You buy at the offer and sell at the bid, so a round trip pays the whole spread · Depends on the stock's liquidity: tight in large caps, wide in small ones
Slippage · The gap between the price you expected when you decided and the price you got · Grows with volatility, delay and order size
Market impact · Your own order pushes the price against you while it executes · Grows with the size of the order relative to the market's volume
Delay and opportunity cost · The price moves between the signal and the fill, or an order does not fill at all · Matters for slow, patient orders
Financing and borrow · Interest on leverage, and the fee to borrow shares for a short · Accrues with every day a position is held
Data, technology and people · Fixed costs of running the operation · Matter for the whole business, not for a single trade
The first three are fairly predictable and the middle ones are hard to estimate, so a good cost model takes care over slippage and impact and does not simply add up the fees. Lesson 1.4 explained the spread and the cost of crossing it. Here we concentrate on what happens as trades get bigger.
Market impact and the square-root law
When you buy, you use up the best offers and the price rises while you are buying. Part of the move is temporary, as liquidity returns after your order, and part is permanent, because your order carries information that the market takes on board. The cost you suffer is the difference between the price at which you decided and your average fill.
Empirical studies of large orders, by researchers such as Bence Tóth, Jean-Philippe Bouchaud and others, find a pattern across markets that is widely used in practice: impact grows roughly with the square root of the order size, not in proportion to it. A common rule of thumb for the impact of an order of size Q in an asset with daily volume V and daily volatility σ is
impact ≈ Y × σ × √(Q ÷ V)
where Q ÷ V is the participation, your order as a share of the day's volume, and Y is a constant of order one that you calibrate to your own market and execution style. We take Y = 1 for the examples. It is a rule of thumb, not a law of nature, and real impact depends on the stock, the time of day and how patiently you trade.
Worked example 1. A stock has a daily volatility of 2 per cent, or 200 basis points. You buy an amount equal to 1 per cent of the day's volume. The impact is 200 × √0.01 = 200 × 0.1 = 20 basis points. Raise the order to 5 per cent of the volume and it is 200 × √0.05 = 45 basis points. At 20 per cent it is 89 basis points.
Order as a share of daily volume · Estimated impact (σ = 2% a day, Y = 1)0.25% · 10 basis points
1% · 20 basis points
5% · 45 basis points
10% · 63 basis points
20% · 89 basis points
The square root has two consequences. First, impact per unit traded grows with size: doubling the order raises the total impact cost of the order by a factor of 2 × √2 = 2.8, not 2. Second, patience pays: splitting a large order into many small ones over the day spreads it across more volume, lowering the participation of each piece. That is the idea behind execution algorithms such as TWAP and VWAP, which trade in line with time or with the day's volume. Lesson 5.4 covers execution in more detail.
Costs and turnover: the annual drag
For a strategy, what matters is the cost per trade multiplied by how often you trade. Turnover is the amount traded in a year, one way, divided by the capital. A turnover of 12 means you traded the equivalent of your whole capital twelve times in the year.
Worked example 2. A strategy earns 8 per cent a year before costs with a volatility of 8 per cent, a Sharpe ratio of 1.0. Each one-way trade costs 10 basis points, all in. At a turnover of 12 times a year, the annual cost is 12 × 10 = 120 basis points, or 1.2 per cent. The net return is 6.8 per cent and the Sharpe ratio is 6.8 ÷ 8 = 0.85. At a turnover of 50 times a year the cost is 5.0 per cent, the net return 3.0 per cent and the Sharpe ratio 0.375. The strategy would break even, with zero net return, at a turnover of 80 times a year. Lesson 4.1's example, which traded 41 per cent of the book each day, was turning over about 103 times a year, which is why 5 basis points were enough to take away more than half of its return.
This is why costs reward slow signals. Two strategies with the same gross Sharpe ratio are not equal if one turns over ten times as much. When you compare signals, compare them net of the cost they would incur at their own turnover.
Capacity: how much money can the strategy run?
A strategy has a capacity: the amount of capital beyond which adding more money reduces, and then eliminates, the profit. The reason is impact, which grows with your size. Take a strategy that makes a gross edge of 40 basis points per round trip, buying and then selling. Its fixed costs, the spread and fees, take 10 basis points per round trip, leaving 30. Impact then takes more as you scale. A round trip pays impact twice, in and out, so at a participation q the round-trip impact is 2 × σ × √q, which for σ = 200 basis points is 400 × √q.
Worked example 3. The net edge per round trip is 30 − 400 × √q basis points.
Order as a share of daily volume · Round-trip impact · Net edge per round trip0.1% · 12.6 · 17.4
0.25% · 20.0 · 10.0
0.5% · 28.3 · 1.7
1% · 40.0 · −10.0
2% · 56.6 · −26.6
The edge is erased at q = (30 ÷ 400)² = 0.5625 per cent of daily volume. That is the break-even size, and any bigger and each trade loses money. But the best size is smaller. Total profit is proportional to the size traded times the net edge per unit, q × (30 − 400 × √q). Setting its derivative to zero gives √q = 30 ÷ (1.5 × 400) = 0.05, so q = 0.25 per cent, and the net edge there is 30 − 400 × 0.05 = 10 basis points. This is a general result for the square-root law: at the profit-maximising size, impact has taken two thirds of the edge left after fixed costs, and the net edge per trade is a third of it. Running bigger than that increases the trade size but reduces total profit.
In rupees, suppose a stock trades ₹50 crore a day. An order of 0.25 per cent of that is ₹12.5 lakh. A strategy that trades 100 such names at this size places ₹12.5 crore of orders per round of trading. That figure, scaled by how often you trade, is the strategy's capacity. It is small compared with a large fund, which is why large funds trade in liquid markets, hold for longer, or run many strategies in parallel.
Use your own numbers to find the break-even and the best participation for your strategy.
Putting costs into a backtest
1. Use a cost model, not a single number. A cost per trade that depends on the spread of each stock, on volatility and on the participation is far better than a flat 5 basis points.
2. Be conservative. If you are unsure, assume costs higher than you expect. A strategy that cannot survive pessimistic costs is not robust.
3. Test sensitivity. Rerun with costs doubled, and with costs halved. The result should not depend on a fine detail of the cost estimate.
4. Cap the size. Do not let the simulation trade more than a few per cent of a day's volume in a name, and say what the cap is.
5. Include financing and borrow. Shorts cost money to hold, and some cannot be borrowed.
6. Measure real costs when you trade. The standard measure is implementation shortfall: the difference between the price at the moment you decided to trade and the average price you got, plus any commissions, as a proportion of the decision price. Suppose you decide to buy at ₹500.00 and fill on average at ₹500.60 with fees of ₹0.05. The shortfall is (0.60 + 0.05) ÷ 500 = 13 basis points. Compare it with your model. If the real cost is persistently higher, your backtest was too generous.
7. Control turnover directly. A no-trade band, which skips a trade unless the target position has moved by more than a threshold, can cut turnover by a large amount for a small loss of signal. Slower signals and netting offsetting trades across strategies do the same.
The code below builds the impact table, the cost drag, the capacity curve, and the implementation shortfall example.
python
import numpy as np
1. square-root impact for a stock with 2% daily volatility (200 basis points), Y = 1
volbp = 200
for q in (0.0025, 0.01, 0.05, 0.10, 0.20):
print(f"{q 100:>5.2f}% of daily volume -> impact {volbp np.sqrt(q):5.1f} bp")
2. annual cost drag and Sharpe ratio
gross, vol, bp = 8.0, 8.0, 10
for turnover in (12, 50):
cost = turnover bp / 100
print("turnover", turnover, "cost", cost, "% | net", gross - cost, "% | Sharpe", round((gross - cost) / vol, 3))
print("break-even turnover", gross 100 / bp)
3. capacity: 40 bp gross edge per round trip, 10 bp fixed costs
alpha, fixed = 40.0, 10.0
def netedge(q):
return alpha - fixed - 2 volbp np.sqrt(q)
for q in (0.001, 0.0025, 0.005, 0.01, 0.02):
print(f"{q 100:.2f}% of volume: round-trip impact {2 volbp np.sqrt(q):5.1f} bp, net edge {netedge(q):6.1f} bp")
breakeven = ((alpha - fixed) / (2 volbp)) 2
best = ((alpha - fixed) / (3 volbp)) 2
print("break-even size", round(breakeven 100, 4), "% | best size", round(best 100, 4), "% | net edge at best size", round(netedge(best), 1), "bp")
check by brute force that the best size maximises size times net edge
grid = np.linspace(0.0001, 0.01, 100000)
print("brute-force best size", round(float(grid[np.argmax(grid netedge(grid))] 100), 4), "%")
in rupees: a stock trading Rs 50 crore a day, order at the best size
advcrore = 50
print("order size at best participation: Rs", round(advcrore best 100, 1), "lakh")
4. implementation shortfall
decision, fill, fees = 500.00, 500.60, 0.05
print("implementation shortfall", round((fill - decision + fees) / decision 1e4, 1), "bp")
Common mistakes
A flat cost per trade for every stock. Costs depend on liquidity, volatility and size, and a flat number is wrong for most of the universe.
Assuming impact is proportional to size. It rises with the square root, so a small test trade understates the cost of a large one.
Ignoring turnover. A cost of 5 basis points looks small until the strategy trades the book every day.
Backtesting at a size you could not trade. A position that is 20 per cent of a day's volume moves the market.
Forgetting taxes, borrow and financing. For high-turnover or short strategies they are a large share of the total.
Comparing gross Sharpe ratios. A fast signal with the same gross Sharpe ratio as a slow one is worth much less.
Believing the backtest's cost estimate without measuring. Compare with realised implementation shortfall once you trade.
Scaling a strategy that works at a small size. Capacity is finite, and returns fall as you grow.
Maximising size, not profit. Beyond the best size, more size earns less.
Key takeaways
Costs are explicit (fees, taxes, brokerage) and implicit (spread, slippage, impact, delay, borrow). The implicit ones are larger and harder to estimate.
Impact rises roughly with the square root of order size: impact ≈ Y × σ × √(Q ÷ V). With a daily volatility of 2 per cent, an order of 1 per cent of volume costs about 20 basis points and 5 per cent costs 45.
The annual cost is turnover times the cost per trade. At 12 times a year and 10 basis points it is 1.2 per cent and cuts a Sharpe ratio from 1.0 to 0.85. At 50 times it takes the Sharpe ratio to 0.375, and at 80 times it removes the return.
Compare signals after costs at their own turnover. Slow signals have an advantage, and a no-trade band cuts turnover cheaply.
Capacity is limited by impact. For a 40-basis-point edge with 10 of fixed costs, the break-even size is 0.56 per cent of daily volume and the profit-maximising size is 0.25 per cent, where the net edge is 10 basis points, one third of the 30 left after fixed costs.
Build a cost model that depends on the stock and the size, cap participation, test with doubled costs and measure the real implementation shortfall.
A strategy that works only at a small size or with generous costs is a research result, not a business.
Check yourself
1. A stock has a daily volatility of 1.5 per cent. Using the square-root rule with Y = 1, what is the impact of an order of 4 per cent of the day's volume?
150 basis points × √0.04 = 150 × 0.2 = 30 basis points.
2. A strategy earns 12 per cent gross with a volatility of 10 per cent, turns over 40 times a year and pays 8 basis points a one-way trade. What is its net Sharpe ratio?
Cost = 40 × 8 = 320 basis points = 3.2 per cent. Net return = 8.8 per cent. Sharpe = 8.8 ÷ 10 = 0.88, down from 1.2.
3. You double the size of an order. By what factor does the total impact cost of the order rise under the square-root rule?
The impact per unit rises by √2 = 1.41, and there are twice the units, so the total rises by 2 × 1.41 = 2.83 times.
4. A strategy has a gross edge of 30 basis points per round trip, fixed costs of 6, and trades stocks with a daily volatility of 1.5 per cent. What is the break-even participation?
Net before impact is 24. Round-trip impact is 2 × 150 × √q = 300√q. Setting 24 = 300√q gives √q = 0.08 and q = 0.0064, or 0.64 per cent of daily volume.
5. Your backtest assumed 5 basis points of cost, and your implementation shortfall in live trading averages 14. What should you do?
Rebuild the cost model from the live data, rerun the backtest and see whether the strategy still works. A persistent gap means the backtest overstated the result.
Try this
Set aside forty-five minutes. You need Python, a spreadsheet, or the simulators of this lesson.
1. Choose a liquid and an illiquid share. Find the average daily volume and the daily volatility of each.
2. Use the square-root rule to estimate the impact of an order of ₹10 lakh, ₹1 crore and ₹10 crore in each. At what size does the impact reach 25 basis points?
3. Take a strategy you built earlier, and measure its turnover in times capital per year. Compute its annual cost at 5, 10 and 20 basis points a trade.
4. Use the first simulator to find the turnover at which your strategy's net return is zero.
5. Use the second simulator with your strategy's gross edge to find the break-even and the best participation, and convert the best size into rupees for your stocks.
6. Rerun your backtest with costs doubled and with a participation cap of 2 per cent of daily volume. How much of the Sharpe ratio is left?
7. Write a short note: the cost model, the turnover, the net result, the capacity in rupees and the assumption that you are least sure of.
A good result is a cost model with its assumptions listed, a net Sharpe ratio under normal and doubled costs, and a capacity estimate in rupees for the strategy. That completes the backtesting module. The next module turns to the main families of strategies themselves, beginning with trend following and momentum.
Read more
Robert Almgren and Neil Chriss's 2000 paper "Optimal Execution of Portfolio Transactions" in the Journal of Risk is the classic treatment of trading fast against trading slow. Bence Tóth and co-authors' 2011 paper "Anomalous Price Impact and the Critical Nature of Liquidity in Financial Markets" in Physical Review X documents the square-root law, and Jean-Philippe Bouchaud, Julius Bonart, Jonathan Donier and Martin Gould's book Trades, Quotes and Prices develops it. Robert Kissell's The Science of Algorithmic Trading and Portfolio Management is a practitioner's guide to cost models and implementation shortfall. Richard Grinold and Ronald Kahn's Active Portfolio Management discusses costs and the trade-off with signal speed.
Tags: Quant Trader Transaction costs Market impact Capacity Slippage