Sub topic 4
Spot markets
This chapter assumes you have read the order book chapters. You should know what bids, asks, makers, takers and slippage are. It also assumes you can read basic Python. Spot is the baseline for the rest of the tutorial. Futures and perpetual swaps are defined by how they differ from it, and their prices are anchored to it.
What "spot" means
A spot market trades an asset for immediate delivery at the current price. If you buy 1 BTC on a spot market, you end up owning 1 BTC. You can hold it, withdraw it, or sell it later. Nothing expires, nothing is borrowed, and nobody can liquidate you.
Every spot trade has two legs that settle together:
- You receive the base asset, the thing being bought (BTC in BTC/USDT).
- You deliver the quote asset, the thing used to pay (USDT in BTC/USDT).
The price is the amount of quote per one unit of base. A spot trade is an exchange of ownership, and the rest of the derivatives stack depends on that fact.
Where settlement actually happens
"Immediate" depends on where the trade takes place. There are two common cases.
Centralized exchange (CEX)
On a centralized exchange, your balance is a number in the exchange's internal database. When your order matches, the exchange subtracts quote from one account and adds base to another, atomically. No blockchain transaction happens. This is why fills are fast and why trading fees can be low.
The consequence is that your balance is a claim against the exchange, not coins in a wallet you control. Ownership becomes on-chain ownership only when you withdraw. The risks are insolvency, freezes and hacks, which are counterparty risks.
On-chain spot (DEX)
On a decentralized exchange, the swap is a blockchain transaction, and settlement is final when the transaction is confirmed. Many DEXs use an automated market maker (AMM) instead of an order book. An AMM prices trades from the ratio of two assets held in a liquidity pool. You never wait for a counterparty, but your price depends on pool size. You also pay network fees, and your transaction can be reordered by others.
A minimal settlement model
The following code models the internal-ledger settlement a centralized exchange performs. It checks that both sides can pay, then moves both legs together. Decimal avoids floating-point rounding errors in money.
from decimal import Decimal as D
def settle_spot(balances, buyer, seller, qty, price,
buyer_fee_rate, seller_fee_rate):
"""Settle a BTC/USDT trade. Fees are charged in the quote asset."""
notional = qty * price
buyer_pays = notional * (1 + buyer_fee_rate)
seller_gets = notional * (1 - seller_fee_rate)
if balances[buyer]["USDT"] < buyer_pays:
raise ValueError("buyer has insufficient USDT")
if balances[seller]["BTC"] < qty:
raise ValueError("seller has insufficient BTC")
balances[buyer]["USDT"] -= buyer_pays
balances[buyer]["BTC"] += qty
balances[seller]["BTC"] -= qty
balances[seller]["USDT"] += seller_gets
balances = {
"alice": {"BTC": D("0"), "USDT": D("70000")},
"bob": {"BTC": D("1"), "USDT": D("0")},
}
# Alice is the taker (0.1% fee). Bob is the maker (0.05% fee).
settle_spot(balances, "alice", "bob", D("1"), D("60000"),
D("0.001"), D("0.0005"))
for name, assets in balances.items():
print(name, {k: f"{v:.2f}" for k, v in assets.items()})Alice ends with 1 BTC and 9,940.00 USDT. Bob ends with 0 BTC and 59,970.00 USDT. The 90 USDT difference between what Alice paid and what Bob received is the exchange's fee revenue. The check before the transfers matters. Spot trading is fully funded, so an order that you cannot pay for in full is rejected. Derivatives relax this rule by letting you post only a fraction of the notional as margin.
Market structure details that cause errors
Pairs, tick size and lot size
Each pair has rules. The tick size is the smallest allowed price increment. The lot size (or step size) is the smallest allowed quantity increment. There is also a minimum notional, the smallest order value the exchange accepts. Orders that violate these rules are rejected. A common bug in trading scripts is sending a price like 60000.123 to a market with a 0.01 tick. Round to the step before you submit.
The quote currency matters
BTC/USDT and BTC/USD are different markets. USDT is a stablecoin, a token meant to track one dollar but issued by a private company. The price of BTC/USDT therefore contains a small, changing USDT/USD factor. In normal times that factor is near 1. During stress, a stablecoin can trade below its peg, and the same BTC trades at different dollar-equivalent prices on different pairs.
Fragmentation and arbitrage
The same asset trades on many venues at once, each with its own order book. Prices differ by small amounts. Traders who buy on the cheaper venue and sell on the more expensive one push the prices together. The gap persists when moving funds is slow, withdrawals are limited, or capital is stuck on one venue. A later chapter uses this: a perpetual swap's index price is typically a weighted average of spot prices from several venues, so one thin book cannot move it much.
Depth and quoted volume
A spot book's depth determines slippage for large orders. Reported 24-hour volume is not a reliable measure of depth. Some venues inflate volume through wash trading, where the same party trades with itself. Check the actual order book and the spread before you size an order.
Spot compared with the products that follow
| Feature | Spot | Dated future | Perpetual swap |
|---|---|---|---|
| What you get | The asset itself | A contract on its price | A contract on its price |
| Funding of the trade | Pay full notional | Post margin only | Post margin only |
| Expiry | None | Fixed date | None |
| Liquidation | No | Yes | Yes |
| Holding cost | None (apart from custody) | Built into the futures price | Funding payments |
| Short exposure | Needs borrowed coins | Open a short contract | Open a short contract |
Spot has no leverage by default. Many exchanges offer margin trading on spot pairs, where you borrow quote or base from a lending pool. That adds interest costs and liquidation risk, and it is closer to a derivative than to plain spot.
Spot is also asymmetric. You can profit from a falling price only if you already hold the asset and sell it, or if you borrow it first. This is one reason derivatives exist, and the next chapter takes that up.
Key points
- Spot trades exchange base for quote and transfer ownership at once.
- On a CEX, settlement is an internal ledger update, and on-chain ownership comes only with withdrawal.
- On a DEX, settlement is a blockchain transaction priced by a pool or a book.
- Spot is fully funded and cannot be liquidated, but it still has price risk, custody risk and quote-currency risk.
- Spot prices from many venues feed the index price used by derivatives.
Exercise
Carol buys 0.5 BTC at 40,000 USDT as a taker with a 0.1% fee charged in USDT. How much USDT does she pay in total, and what does she receive?
Show answer
Notional = 0.5 × 40,000 = 20,000 USDT. The fee is 0.1% of 20,000 = 20 USDT, so she pays 20,020 USDT in total and receives 0.5 BTC.
Exercise
A trader says, "I own 2 BTC on an exchange, so the coins are in my wallet." What is wrong with this statement, and what action changes it?
Show answer
The balance is an entry in the exchange's internal ledger, so the trader holds a claim on the exchange rather than coins they control. Withdrawing to a self-custody wallet creates on-chain ownership, which removes the exchange's counterparty risk.