Skip to main content

Module margin

Module margin 

Source
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.

Structs§

InterestCharge
One charge a MarginInterestModel makes on one loan.
PeriodicMarginInterest
Margin interest charged a period at a time, at an annualised rate per asset: a crypto margin account’s hourly interest.
SpotMarginConfig
Spot margin on the simulated venue: what it lends a spot order, how much, and what it repays.

Enums§

InterestDue
When a MarginInterestModel is asked to charge a loan.
InterestSchedule
When a PeriodicMarginInterest charges a loan.
MarginEffect
What an order does to a margin account’s loans: borrow what it lacks, repay from what it receives, or touch neither.
SpotMarginConfigError
Why a SpotMarginConfig was refused.

Traits§

MarginInterestModel
Charges interest on a simulated margin loan: once when the loan is taken, and at boundaries in time while it stays open.