Sub topic 2
Order types, makers and takers, and fees
This chapter assumes you know what an order book is: resting bids and asks, the best bid and ask, and the spread. You should also be comfortable with percentages and with reading short Python functions. It covers how an order's instructions decide whether you pay or earn liquidity fees, and how fees change the economics of leveraged trades. Slippage and depth have their own chapter.
Makers and takers
An order is a taker order if it matches against resting orders the moment it arrives. It removes liquidity from the book. An order is a maker order if it rests in the book and a later order matches it. It adds liquidity.
The same order can be either. A limit buy at 60,000 is a maker order if the best ask is 60,010. It is a taker order if the best ask is 59,990, because it crosses the spread and fills immediately. Your role is decided by the book at the moment of arrival, not by the order type name.
A single order can be both. If a large limit buy fills partly on arrival and the remainder rests, the first part is charged the taker fee and the later part the maker fee.
Core order types
| Order type | What it does | Typical role |
|---|---|---|
| Market | Buys or sells at the best available prices until the quantity is filled | Always taker |
| Limit | Fills only at your price or better; the rest waits in the book | Maker, or taker if it crosses |
| Stop-market | Becomes a market order when a trigger price is reached | Taker when triggered |
| Stop-limit | Becomes a limit order when a trigger price is reached | Depends on the limit price |
| Take-profit | A stop in the profitable direction, used to close a position | Same as stop types |
| Post-only | A limit order that is rejected if it would take liquidity | Always maker |
| Reduce-only | An order that can only shrink an existing position | Either |
A market order guarantees execution but not price. A limit order guarantees price but not execution. Most trading errors come from picking the wrong side of that trade-off for the situation.
Time in force
Time in force says how long an order may live and whether partial fills are acceptable.
- GTC (good till cancelled): rests until it fills or you cancel it.
- IOC (immediate or cancel): fills whatever it can right now and cancels the remainder.
- FOK (fill or kill): fills completely right now or not at all.
- Post-only: rests in the book or is rejected. It never takes liquidity.
The function below applies these rules to a buy order against a small ask side. It is a simplified model, but it shows each rule's effect.
def match_buy(asks, qty, limit, tif):
"""asks: list of (price, size) sorted from lowest price. Returns (fills, status)."""
if tif == "POST_ONLY":
if asks and asks[0][0] <= limit:
return [], "rejected: would take liquidity"
return [], "resting"
available = sum(size for price, size in asks if price <= limit)
if tif == "FOK" and available < qty:
return [], "cancelled: cannot fill completely"
fills, left = [], qty
for price, size in asks:
if price > limit or left <= 0:
break
take = min(size, left)
fills.append((price, round(take, 8)))
left = round(left - take, 8)
if left == 0:
return fills, "filled"
if tif == "IOC":
return fills, "partial: remainder cancelled"
return fills, "partial: remainder resting"
asks = [(60010, 0.3), (60020, 0.4), (60050, 1.0)]
for tif in ["GTC", "IOC", "FOK", "POST_ONLY"]:
print(tif, match_buy(asks, 1.0, 60025, tif))With a limit of 60,025, only the first two levels (0.7 in total) are eligible. GTC fills 0.7 and leaves 0.3 resting at 60,025. IOC fills the same 0.7 and drops the rest. FOK cancels everything because 1.0 is not available. Post-only is rejected because the best ask of 60,010 is already at or below the limit.
Stop orders and trigger prices
A stop order sits outside the order book until its trigger condition is met. Only then does it enter the book as a market or limit order. Three details cause most surprises.
- Trigger source. On derivatives venues you usually choose whether the trigger watches the last traded price, the mark price, or the index price. The mark price is harder to move with one trade, so a mark-price stop is less likely to fire on a brief spike. The next chapters on index and mark price explain how these prices are built.
- Gap risk. A stop-market order fills at whatever the book offers after triggering. In a fast move this can be far from the trigger. A stop-limit order controls the price but can fail to fill at all if the market moves through your limit. That leaves you holding a position you meant to exit.
- Visibility. Most venues hold stops on their own servers. Your stop does not rest in the visible book, so it provides no liquidity and pays taker fees when it fires as a market order.
A reduce-only flag protects exits. Without it, a stop to close a long position that fires after you already closed manually could open a new short position.
Fees
Exchanges charge a percentage of the trade's notional value, which is quantity times price. Fees apply separately on entry and on exit, and they are charged on every fill, including liquidations.
Two features shape the schedule:
- Maker-taker pricing. Takers pay more than makers because they consume liquidity. Some venues pay makers a rebate, a negative fee, for resting orders.
- Tiers. Fees often fall as your 30-day trading volume or your holdings of the exchange token rise.
The rates below are made up for illustration. Check the current schedule of the venue you use.
| Product | Maker fee | Taker fee | Charged in |
|---|---|---|---|
| Spot | 0.10% | 0.10% | Asset received, or quote currency |
| Linear perpetual | 0.02% | 0.055% | Quote currency (such as USDT) |
| Inverse perpetual | 0.02% | 0.055% | Base coin (such as BTC) |
Spot fees are often taken from the asset you receive. Buying 1 BTC at 0.10% may leave you with 0.999 BTC. Derivatives fees come out of your margin balance, in the contract's settlement currency.
Fees on a round trip
The next code computes the cost of opening and closing a 0.5 BTC linear long, entering at 60,000 and exiting at 66,000. It uses the illustrative rates above.
def fee(qty, price, rate):
return qty * price * rate
qty, entry, exit_price = 0.5, 60000, 66000
gross = qty * (exit_price - entry)
taker_both = fee(qty, entry, 0.00055) + fee(qty, exit_price, 0.00055)
maker_in_taker_out = fee(qty, entry, 0.0002) + fee(qty, exit_price, 0.00055)
print("gross pnl:", gross)
print("fees, taker both ways:", round(taker_both, 2), "net:", round(gross - taker_both, 2))
print("fees, maker in, taker out:", round(maker_in_taker_out, 2), "net:", round(gross - maker_in_taker_out, 2))The gross profit is 3,000. Taker fees on both sides cost 34.65, which leaves 2,965.35. Entering as a maker lowers the fees to 24.15. The difference looks small on one trade but compounds across many.
Fees and leverage
Fees are charged on notional, not on your margin. At 10x leverage, a taker round trip of about 0.11% of notional costs about 1.1% of your margin. The price must move that far in your favor just to break even.
def breakeven_move(entry_rate, exit_rate):
"""Approximate price move, as a fraction of price, needed to cover both fees."""
return entry_rate + exit_rate
def fee_as_share_of_margin(entry_rate, exit_rate, leverage):
return breakeven_move(entry_rate, exit_rate) * leverage
print(breakeven_move(0.00055, 0.00055))
print(fee_as_share_of_margin(0.00055, 0.00055, 10))
print(fee_as_share_of_margin(0.00055, 0.00055, 50))At 50x the same round trip costs about 5.5% of margin. Fees therefore matter more as leverage rises, and they matter most for strategies that trade often.
Common errors
- Assuming a limit order is always a maker. A limit price that crosses the spread is a taker order. Use post-only if you need the maker rate and would rather be rejected than pay more.
- Ignoring partial fills. A GTC order that fills halfway leaves you with a smaller position than planned and an open order still on the book. Check both.
- Using stop-limit as a safety net. If the market gaps through the limit, the stop never fills. Use stop-market when exiting matters more than the exact price.
- Forgetting funding and fees are separate. Trading fees are paid at each fill. Perpetual swaps also have funding payments, covered in a later chapter.
- Comparing rates without checking the unit. Some venues quote fees on notional, some on received amount, and inverse contracts charge in coin, so the same percentage costs different dollar amounts as the coin price changes.
Exercise
You hold no position. You place a limit buy for 2 BTC at 60,000 with GTC. The best ask is 59,990, and 0.5 BTC is available there. The rest of the ask side is above 60,000. The taker fee is 0.055% and the maker fee is 0.02%. What happens, and what total fee do you pay in USDT on this order if the remaining 1.5 BTC later fills in full at 60,000?
Show answer
The order crosses the spread, so the first 0.5 BTC fills immediately at 59,990 as a taker, and the other 1.5 BTC rests at 60,000 as a maker. Taker fee: 0.5 x 59,990 x 0.00055 = 16.50 USDT (about 16.4973). Maker fee: 1.5 x 60,000 x 0.0002 = 18.00 USDT. Total is about 34.50 USDT. With post-only the whole order would have been rejected instead, because it would take liquidity.