Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Risk ¶
type Risk struct {
MMR *big.Int // Maintenance Margin Requirement
IMR *big.Int // Initial Margin Requirement
NC *big.Int // Net Collateral
}
Risk is a struct to hold net collateral and margin requirements. This can be applied to a single position or an entire account.
func (*Risk) AddInPlace ¶
AddInPlace adds the values of b to a (in-place).
func (*Risk) Cmp ¶
Note that here we are effectively checking that `a.NetCollateral / a.MaintenanceMargin >= b.NetCollateral / b.MaintenanceMargin`. However, to avoid rounding errors, we factor this as `a.NetCollateral * b.MaintenanceMargin >= b.NetCollateral * a.MaintenanceMargin`.
func (*Risk) IsInitialCollateralized ¶
IsInitialCollateralized returns true if the account has enough net collateral to meet the initial margin requirement.
func (*Risk) IsLiquidatable ¶
IsLiquidatable returns true if the account is liquidatable given its maintenance margin requirement and net collateral.
The account is liquidatable if both of the following are true: - The maintenance margin requirements are greater than zero (note that they can never be negative). - The maintenance margin requirements are greater than the account's net collateral.
func (*Risk) IsMaintenanceCollateralized ¶
IsMaintenanceCollateralized returns true if the account has enough net collateral to meet the maintenance margin requirement.