Appearance
Margin Trading
Admin → Trading → Margin Trading controls spot margin trading (see Margin trading for what users see) and the Cross margin mode for futures. Superadmins only.
The exchange lends the money
Every margin loan is funded by the exchange. Interest and liquidation fees are the exchange's income; a liquidation that can't cover the debt (a price gap) is a loss for the exchange. Use the borrow caps below to limit the exposure.
Overview
Four cards: Open loans (USD value of everything lent out, and how many accounts are borrowing), Accounts at risk (margin level at or below the call level), Interest, 30 days and Liquidations, 30 days (with the number of open Cross futures positions).
At the bottom: the riskiest accounts (lowest margin level first, with a link to the user) and the recent liquidations (debt, fee, any shortfall).
Settings
Spot margin
| Field | Default | Meaning |
|---|---|---|
| Margin trading | Off | Shows margin on the trade page, Assets → Margin and in the app. While off, nobody can open an account, transfer, borrow or place margin orders. |
| Require KYC | Off | Only users with approved identity verification can open a margin account. |
| Cross max leverage | 3x (2–10) | A new loan may not take a Cross account below L ÷ (L − 1) (3x → 1.50). Must stay above the call level. |
| Margin call level | 1.3 | At or below this, users get a push notification (once every 6 hours). |
| Cross liquidation level | 1.1 | Must be below the call level. |
| Isolated liquidation level | 1.05 | Must be below the call level, and every pair's isolated leverage must start above it. |
| Transfer-out level | 2.0 | With loans open, assets can leave the account only while the level stays at or above this. |
| Liquidation fee | 2% | Share of the debt kept by the exchange when an account is liquidated. |
The page refuses combinations that don't make sense (for example a leverage whose starting level isn't above the call level) and explains why.
Futures margin mode
| Field | Default | Meaning |
|---|---|---|
| Cross margin for futures | On | Users can pick Cross in the futures order form. Isolated stays the default; copy trading always opens Isolated positions. |
| Maintenance margin | 0.5% | Cross positions are liquidated when the user's equity (free balance + their margin + unrealized PnL) falls to this share of the positions' value. See Futures → Margin mode. |
Margin coins
Coins that can be held in margin accounts and borrowed. For each: Borrowing on/off, Daily interest (0.02 = 0.02% a day, charged hourly), Max borrowed per user and Max lent out in total (0 = no cap), and how much is lent out right now. A coin users still hold or owe can't be removed; turn borrowing off instead.
Defaults from the installer: BTC 0.005%, ETH 0.006%, every other coin of an active USDT pair (and USDT) 0.02% a day.
Margin pairs
Pairs that can be traded on margin, with Cross and Isolated switches and the Isolated max leverage (2–10x, default 5x). Adding a pair also adds its two coins as margin coins. A pair with isolated accounts can't be removed; turn it off instead (users can still move their funds out).
Margin orders are not available on markets that use the external (Rust) matching engine.
What runs automatically
| Task | How often |
|---|---|
margin:interest: one hour of interest on every open loan | Every hour (at :00) |
margin:monitor: margin levels, margin calls, liquidations | Every minute (--loop runs it continuously for a PM2 process) |
| Cross futures: equity vs maintenance check, estimated liquidation prices | Every 2 seconds, inside the futures liquidation watcher (market-watcher:liquidation) |
orders:trigger-stops: stop-limit orders (spot and margin) | Every minute, checking every 3 seconds |
The scheduler must be running (see Scheduler). Restart the market-watcher:liquidation process after an update.
Data
Tables: margin_assets, margin_markets, margin_accounts, margin_wallets (free, in orders, borrowed, interest per account and coin), margin_ledger (every transfer, loan, repayment, interest charge and liquidation line), margin_liquidations; orders.margin_account_id marks margin orders and futures_contract.margin_mode the futures mode. Defaults are seeded by Database\Seeders\Margin\MarginSeeder (safe to run again: existing rows are not changed).
