Sub topic 1
Where the Money Goes: Exchange, Market, and Network Costs
Prerequisites
This chapter assumes you know the following:
- What a cryptocurrency and a blockchain transaction are, at a basic level.
- What an exchange's buy and sell screen looks like.
- Percentages and basis points. One basis point (bp) is 0.01%, so 20 bps is 0.20%.
- Optionally, how to read short Python snippets. Every snippet here can be run as shown.
This is the first chapter. It gives you the map. Later chapters cover each cost in detail.
Why one trade has many prices
An exchange screen usually shows one number, such as "fee: 0.20%". That number is rarely what a trade costs you. Between the money you deposit and the coins you end up holding in your own wallet, you can pay three kinds of cost:
- Exchange costs. These are charges the venue states openly: trading fees, deposit and withdrawal fees, and fees on products such as instant buy.
- Market costs. These are not billed as a line item. They show up as a worse price than the one you expected: the bid-ask spread, slippage, and markups built into a quoted price.
- Network costs. These are fees paid to the blockchain's validators or miners for including your transaction in a block. You pay them when you move coins on-chain, and the exchange often passes them on.
Different people receive each cost. The exchange keeps the first. Other traders, or the exchange acting as your counterparty, earn the second. Block producers collect the third. This matters because you reduce each cost by a different method.
Layer 1: Exchange costs
Exchange costs are the easiest to find, because they are published in a fee schedule. Four are common:
- Trading fee. A percentage of the trade's notional value (price times quantity). It usually depends on whether your order adds liquidity (maker) or removes it (taker), and on your 30-day volume tier.
- Conversion or instant-buy fee. A simple "buy" button may show a small or zero fee. The price it quotes can still include a markup over the market price.
- Fiat deposit and withdrawal fees. Card payments tend to cost more than bank transfers. Some methods are free.
- Crypto withdrawal fee. Usually a flat amount per asset and network, set by the exchange. It is related to, but not the same as, the actual on-chain fee.
Fees are quoted in basis points or percent, so convert them to the quote currency before comparing:
def fee(notional, rate_bps):
return notional * rate_bps / 10_000
notional = 5_000.0
maker_fee = fee(notional, 10) # 0.10% -> 5.0
taker_fee = fee(notional, 20) # 0.20% -> 10.0
print(maker_fee, taker_fee)The rates here are illustrative, not any real venue's schedule. The point is that the same $5,000 order can cost twice as much as a taker.
Layer 2: Market costs
Market costs come from how prices are formed. Most spot venues match orders in an order book: a list of buy orders (bids) and sell orders (asks), each at a price and size. Three effects follow from it:
- Spread. The gap between the best bid and the best ask. If you buy immediately you pay near the ask. If you sell immediately you receive near the bid.
- Slippage. If your order is larger than the size at the best price, it fills against the next levels and the average price gets worse.
- Markup. Some products quote you a price that is not read from the order book at all, so the cost is hidden inside the price.
A useful reference is the mid price, the average of best bid and best ask. Measuring costs against it puts spread, slippage and markup on one scale.
Layer 3: Network costs
A blockchain has limited space in each block, and users bid for it. The fee you pay depends on demand at that moment, not on the value of your transfer. Moving $50 and $50,000 can cost the same.
How the fee is calculated depends on the chain:
- Bitcoin charges a fee rate (satoshis per virtual byte) times your transaction's size.
- EVM chains such as Ethereum charge gas used times a gas price, which has a protocol-set base fee plus an optional tip.
GWEI = 10**9
WEI_PER_ETH = 10**18
def evm_fee_eth(gas_used, base_fee_gwei, priority_fee_gwei, max_fee_gwei):
gas_price_gwei = min(max_fee_gwei, base_fee_gwei + priority_fee_gwei)
return gas_used * gas_price_gwei * GWEI / WEI_PER_ETH
# A plain ETH transfer uses 21,000 gas.
print(evm_fee_eth(21_000, 20, 2, 50)) # 21,000 * 22 gwei, about 0.000462 ETH
def btc_fee_sats(vsize_vbytes, fee_rate_sat_per_vb):
return vsize_vbytes * fee_rate_sat_per_vb
# A typical 1-input, 2-output native SegWit transaction is roughly 141 vB.
print(btc_fee_sats(141, 10)) # 1410 satoshisIf you only trade inside an exchange, you pay no network fee, because the exchange updates its own internal ledger. The network fee appears when you deposit or withdraw coins on-chain.
Putting the layers together
To compare options you need one number. Convert every cost to basis points of the trade's notional value, then add them. The sum is the effective cost.
This script prices a $5,000 taker buy followed by a withdrawal. The spread is 2 bps, and you cross half of it relative to the mid price. The slippage and the withdrawal fee are assumed values.
def to_bps(amount_usd, notional):
return amount_usd / notional * 10_000
notional = 5_000.0
costs_usd = {
"trading fee (20 bps taker)": notional * 20 / 10_000,
"half spread (2 bps spread)": notional * (2 / 2) / 10_000,
"slippage (3 bps)": notional * 3 / 10_000,
"withdrawal fee (flat)": 4.0,
}
total = sum(costs_usd.values())
for name, usd in costs_usd.items():
print(f"{name}: {usd:.2f} USD = {to_bps(usd, notional):.1f} bps")
print(f"total: {total:.2f} USD = {to_bps(total, notional):.1f} bps")The output shows $16.00, or 32 bps. The trading fee is the largest item at 20 bps. The flat withdrawal fee is only 8 bps here, but it would be 80 bps on a $500 trade. Flat costs weigh more on small trades, and percentage costs weigh more on large ones.
Common errors
- Reading only the headline fee. A venue with a 0% fee can cost more than one with 0.10% if its quoted prices include a wide markup.
- Ignoring the spread. A buy followed by a sell crosses the full spread, even if no fee is charged on either side.
- Assuming a market order fills at the displayed price. The displayed price is the price of the top level only. Larger orders walk deeper.
- Treating the withdrawal fee as the network fee. The exchange sets its fee in advance. It may be higher or lower than what the chain charges when your transaction is sent.
- Comparing numbers in different units. Mixing percent, basis points, gwei and satoshis causes arithmetic errors. Convert to one quote currency, or to basis points, first.
- Forgetting that costs depend on conditions. Spread, slippage and network fees widen when markets are volatile or busy. Costs measured on a quiet day understate the busy-day cost.
What the rest of the tutorial covers
The following chapters take each layer in turn. First you will read an order book and see how maker and taker orders, fee tiers, spread and slippage work. Then comes instant-buy pricing and fiat fees. After that come the mechanics of network fees on Bitcoin and EVM chains, and why exchange withdrawal fees differ from on-chain fees. Finally you will add everything into a round-trip cost and look at practical ways to reduce it.
Exercise
You buy $2,000 of a coin as a taker at 25 bps, with a 4 bps spread (you cross half of it against the mid price) and 2 bps of slippage. You then withdraw it for a flat $3 withdrawal fee. What is the total cost in USD and in bps of the $2,000?
Show answer
The trading fee is 2,000 x 25 / 10,000 = $5.00. The half spread is 2 bps, which is $0.40. The slippage is 2 bps, which is $0.40. The withdrawal fee is $3.00. The total is $8.80, which is 8.80 / 2,000 x 10,000 = 44 bps. The flat withdrawal fee accounts for 15 bps of this, so it would matter more on a smaller trade.
Exercise
Name the layer (exchange, market or network) for each cost, and say who receives it: the taker fee, the bid-ask spread, and the fee paid to send a Bitcoin transaction.
Show answer
The taker fee is an exchange cost and the exchange receives it. The bid-ask spread is a market cost and the trader on the other side of your fill receives it. The Bitcoin transaction fee is a network cost and the miner who includes the transaction in a block receives it.