Expand description
Margin borrowing: the borrow and repay policy a margin account applies to its orders, the simulated venue’s spot margin configuration, and the interest it charges on its loans.
MarginEffect is what an order does to a margin account’s loans: borrow what it lacks, repay
from what it receives, or neither. A live margin client sends it with each order, and the
simulated venue applies it when SpotMarginConfig turns its spot margin on. A
MarginInterestModel prices those loans over time; PeriodicMarginInterest is the
built-in one. A margin client that learns what an order borrowed reports it as a
MarginBorrow, in a MarginPlacement.
Structs§
- Interest
Charge - One charge a
MarginInterestModelmakes on one loan. - Margin
Borrow - A loan a margin order took out when it was placed:
amountofasset. - Margin
Placement - The answer to placing a margin order: the order, and what it borrowed.
- Periodic
Margin Interest - Margin interest charged a period at a time, at an annualised rate per asset: a crypto margin account’s hourly interest.
- Spot
Margin Config - Spot margin on the simulated venue: what it lends a spot order, how much, and what it repays.
- Spot
Margin Liquidation - When the simulated venue liquidates a spot margin account, what it charges for it, and whether
it warns first. Set by
SpotMarginConfig::with_liquidation.
Enums§
- Interest
Due - When a
MarginInterestModelis asked to charge a loan. - Interest
Schedule - When a
PeriodicMarginInterestcharges a loan. - Margin
Effect - What an order does to a margin account’s loans: borrow what it lacks, repay from what it receives, or touch neither.
- Spot
Margin Config Error - Why a
SpotMarginConfigwas refused.
Traits§
- Margin
Interest Model - Charges interest on a simulated margin loan: once when the loan is taken, and at boundaries in time while it stays open.