Sub topic 3
Funding Rates, Liquidation, and Venue Risk
This chapter assumes you know how spot prices, leverage, and margin work, and that you can read simple Python.
Funding rates
A perpetual swap has no expiry, so the venue uses a funding rate to pull its price toward the spot index. At each funding time, longs pay shorts when the rate is positive, and shorts pay longs when it is negative. The payment equals position notional times the rate.
def funding_payment(qty, mark_price, funding_rate, side):
"""Positive result means the trader pays; negative means the trader receives."""
payment = qty * mark_price * funding_rate
return payment if side == "long" else -payment
print(funding_payment(1.0, 60000, 0.0001, "long")) # 6.0
print(funding_payment(1.0, 60000, 0.0001, "short")) # -6.0Liquidation
When margin falls below the maintenance requirement, the venue closes the position. For a long at 10x leverage, an entry of 60,000, and a 0.5% maintenance rate, the liquidation price is about 54,271. Higher leverage moves this price closer to entry.
Insurance funds and auto-deleveraging
An insurance fund covers losses when a liquidated position closes beyond its margin. If the fund runs out, auto-deleveraging (ADL) forcibly closes profitable opposing positions at the current price.
Basis and funding trades
A cash-and-carry trade buys spot and shorts a dated future priced above spot. If the two prices converge at expiry, the gap becomes profit. A funding-rate trade holds spot against a short perpetual to collect positive funding.
Managing risk with leverage
Keep leverage low, size positions so liquidation sits well away from the mark price, and track funding costs, which can erode returns on long holds.
Centralized and on-chain venues
Centralized exchanges hold custody and run the matching engine, so counterparty risk rests with the operator. On-chain venues let users keep custody, but liquidation speed and price-feed quality depend on the underlying chain.
Exercise
Exercise
You hold 2 BTC long in a perpetual swap at a mark price of 60,000. The funding rate is 0.0003 per interval. What do you pay at one funding time?
Show answer
Notional is 2 × 60,000 = 120,000. Payment is 120,000 × 0.0003 = 36. You pay 36 at that funding time.