The margin account
One account, one basket, one requirement at every hour: how collateral value, the debit and the margin figures are computed, and what each figure gates.
Custody
Every asset you deposit or buy is held by the MarginAccounts contract and booked to your address; there is no pooled wallet and no rehypothecation of your basket. The router takes custody only transiently inside a fill transaction, and assets leave the contract through exactly two doors: a withdrawal you sign or a sale. Your debit is a ledger entry against the same contract, marked continuously against the global interest index (see interest).
The five figures
The desk describes an account with five numbers, all computed by the risk engine from per-class margin weights at Chainlink marks. There is a single initial and a single maintenance requirement for the whole basket: rates are set per asset, but the requirement is aggregated and tested once. No position is isolated and no asset is closed out on its own, and none of the five figures depends on the time of day.
| Figure | Definition |
|---|---|
| Collateral value, CV | Sum of quantity times mark over every asset held, including USDG. Each position is floored; USDG is never marked above 1.00. |
| Debit, D | USDG drawn from the vault plus accrued interest, marked at the current index and rounded up. |
| Equity, E | CV minus D. Can be negative. |
| Initial margin, IM | Sum of position value times that asset's initial margin rate, rounded up per position. Gates buys and withdrawals. |
| Maintenance, MM | Sum of position value times the maintenance rate, rounded up. Falling below it opens a maintenance call. |
Rounding always favours the requirement: value floors, requirements round up, buying power floors. An account can never round its way past a margin test. The per-class rates, one initial and one maintenance each, standing at every hour:
| Class | Initial margin | Maintenance |
|---|---|---|
| USDG | 0% | 0% |
| WEEK | 10% | 5% |
| ETF tokens | 40% | 25% |
| Stock tokens, tier A | 50% | 30% |
| Stock tokens, tier B | 60% | 40% |
| ETH | 35% | 25% |
| Majors (WBTC) | 40% | 27.5% |
The full parameter set, including setter bounds, lives on the parameters page.
Buying power
A buy draws USDG buying power: your account cash is spent first and only the remainder draws the vault, raising your debit. Because the purchased asset lands in the basket and raises IM by its own rate, buying power is quoted per target asset:
BP(b) = max(0, XE) / im(b)
A buy or swap settles atomically and then must leave E at or above IM on the post-fill basket, or the whole transaction reverts. The quote is additionally capped by your account cash plus what the vault can currently extend, bounded by the vault's available cash and utilisation ceiling.
One requirement, every hour
The desk trades on chain around the clock, so nothing in the margin math consults a session clock or a calendar. Each asset carries exactly one initial rate and one maintenance rate, and both apply identically at 3am on a Sunday and at noon on a Tuesday. There is no stricter off-hours basis on buys, no uplift before a weekend, and no hour at which a held position is re-weighted. The requirement you were quoted when you opened a position is the requirement it carries for as long as you hold it, and it moves only when prices move or governance changes the rate.
The risk engine takes one argument, the account, and returns one initial and one maintenance figure for the whole basket. A buy is tested against that same pair, whatever the asset and whatever the hour.
Account states
| State | Condition | What changes |
|---|---|---|
| Healthy | E ≥ IM | Everything allowed. |
| Restricted | E below IM but at or above MM | Buying power is zero and withdrawals that would keep E below IM revert; nothing is sold. |
| Maintenance call | E < MM | A call opens with a grace window; buys and withdrawals are blocked until it cures. |
| Bad debt | CV is zero with a debit still open | The remainder is written off through insurance, then vault NAV. |
Calls, grace tiers, the hard floor and forced sale mechanics have their own page.
What blocks what
- Deposits are always allowed. They only ever help, and a deposit that restores E ≥ IM cures a call on the spot.
- Sells are always allowed, in a call, with a delisted asset, whenever. The one exception is the instant a forced sale is executing on your account. Sell proceeds pay the debit down first; only the surplus lands as account cash.
- Buys are blocked in a maintenance call, during a USDG depeg pause, and under the guardian's buying power pause.
- Withdrawals must leave E ≥ IM on the reduced basket and are blocked during a call. Withdrawing USDG additionally requires a clear debit: cash never leaves the account while anything is owed.
Worked example: the demo book
The seeded demo account holds 5 ETH at $3,000 and 60 AAPL at $200, the AAPL bought entirely on margin. At ETH rates of 35% / 25% and tier A stock rates of 50% / 30%:
D = $12,000
E = 27,000 − 12,000 = $15,000
IM = 0.35 × 15,000 + 0.50 × 12,000 = 5,250 + 6,000 = $11,250
MM = 0.25 × 15,000 + 0.30 × 12,000 = 3,750 + 3,600 = $7,350
Equity clears IM by $3,750 of excess, so the account is healthy with $7,500 of tier A stock buying power, and it sits $7,650 above the maintenance requirement. These are the protocol spec's worked-example figures, and the test suites pin them to the cent.
Everything above reduces to E against MM. Prices move CV, interest ticks D up every second, and the moment E drops below MM a call opens. The desk header tracks this margin of safety live.