Sub topic 16
Computing the Total Cost of a Trade
Assume you understand percentages, basis points, order books, and the difference between a blockchain transaction and an exchange trade. This chapter combines those pieces into one effective cost.
The cost model
A trade can cost more than the exchange’s displayed trading fee. For a buy followed by a later sell, include:
- Trading fees paid on both sides.
- The bid-ask spread crossed when taking liquidity.
- Slippage caused by consuming several order-book levels.
- Any instant-buy markup or conversion charge.
- Deposit, withdrawal, or network fees when moving funds.
A useful approximation for a round trip is:
total cost ≈ spread + buy fee + sell fee
+ buy slippage + sell slippage
+ deposit and withdrawal costsFor comparison, express percentage costs in basis points. One basis point is 0.01%, so 20 basis points is 0.20%.
Worked example
Suppose an asset has a best bid of 99.80 and a best ask of 100.00. The midpoint is 99.90.
The spread is:
(100.00 - 99.80) / 99.90 × 10,000 ≈ 20 basis pointsAssume the exchange charges a 20-basis-point taker fee on each side. Your market buy also has 3 basis points of slippage, and your later market sell has another 3 basis points.
| Cost component | Basis points |
|---|---|
| Spread | 2 |
| Buy fee | 20 |
| Sell fee | 20 |
| Buy slippage | 3 |
| Sell slippage | 3 |
| Total | 48 |
The round trip therefore needs to earn about 48 basis points before it breaks even, ignoring taxes and funding costs.
The spread is crossed once across the complete buy-and-sell cycle. Each trading fee and each slippage estimate applies separately to one side.
def round_trip_cost_bps(spread_bps, fee_bps_each_side, slippage_bps_each_side=0.0):
return spread_bps + 2 * fee_bps_each_side + 2 * slippage_bps_each_side
taker_cost = round_trip_cost_bps(2, 20, 3)
maker_cost = round_trip_cost_bps(0, 10, 0)
print(f"Taker round trip: {taker_cost:.1f} bps")
print(f"Maker round trip: {maker_cost:.1f} bps")This prints 48 basis points for the taker example. The maker example is cheaper only if the resting orders fill and the market does not move away.
Adding deposits and withdrawals
Network costs usually belong to the transfer, not to the exchange trade itself. Add them in the currency in which they are charged.
For example, if a withdrawal costs 0.0005 ETH and ETH is worth 2,000 dollars, its dollar cost is:
0.0005 × 2,000 = 1 dollarDivide that dollar amount by the trade’s notional value to convert it into a comparable percentage or basis-point cost. Do not assume the exchange’s withdrawal charge equals the exact fee paid to miners or validators. The exchange may batch transactions, subsidize them, or add a service margin.
A decision rule
Compare the total effective cost, not just the advertised fee. A lower-fee venue with a wide spread or shallow order book can be more expensive than a higher-fee venue with better liquidity.
Exercise
A round trip has a 6-basis-point spread, a 15-basis-point fee on each side, and 4 basis points of slippage on each side. What is the estimated total cost?
Show answer
6 + (2 × 15) + (2 × 4) = 44 basis points.