Object
Name | Type | Description |
---|---|---|
positionsMMR | number | - |
positionsNotional | number | Notional sum of all positions, positions.totalNotional() |
Object
Name | Type |
---|---|
USDCHolding | number |
unsettlementPnL | number |
Object
Total value of available collateral in the user’s account (denominated in USDC).
Name | Type |
---|---|
totalCollateral | Decimal |
totalInitialMarginWithOrders | number |
Object
Name | Type |
---|---|
IMR_Factor | number |
IMR_factor_power? | number |
baseIMR | number |
maxLeverage | number |
ordersNotional | number |
positionNotional | number |
Object
Name | Type | Description |
---|---|---|
IMR_Factor | number | - |
baseIMR | number | - |
baseMaxQty | number | - |
buyOrdersQty | number | - |
markPrice | number | - |
maxLeverage | number | - |
otherIMs | number | See otherIMs |
positionQty | number | - |
sellOrdersQty | number | - |
symbol | string | - |
takerFeeRate | number | - |
totalCollateral | number | Total collateral of the user (denominated in USDC), can be calculated from totalCollateral. See totalCollateral |
Object
Name | Type |
---|---|
IMR_Factors | { [key: string] : number ; } |
markPrices | { [key: string] : number ; } |
maxLeverage | number |
orders | Order [] |
positions | Position [] |
symbolInfo | any |
Object
Name | Type |
---|---|
markPrice | number |
positionQtyWithOrders | number |
Object
Name | Type |
---|---|
buyOrdersQty | number |
positionQty | number |
sellOrdersQty | number |
Object
Name | Type |
---|---|
dp | number |
Object
Name | Type |
---|---|
USDCHolding | number |
nonUSDCHolding | { discount : number ; holding : number ; markPrice : number }[] |
unsettlementPnL | number |
IMR_Factors
: { [key: string]
: number
; } ; markPrices
: { [key: string]
: number
; } ; orders
: Order
[] ; positions
: Position
[] ; symbolInfo
: any
} & Pick
<IMRInputs
, "maxLeverage"
>
Object
Name | Type |
---|---|
markPrices | { [key: string] : number ; } |
positions | Position [] |
totalCollateral | number |
Object
Name | Type |
---|---|
totalUnrealizedPnL | number |
totalValue | number |
Object
Name | Type |
---|---|
USDCHolding | number |
nonUSDCHolding | { discount : number ; holding : number ; markPrice : number }[] |
totalUnsettlementPnL | number |
inputs
): number
Initial margin rate for a symbol.
Max(1 / Max Account Leverage, Base IMR i, IMR Factor i * Abs(Position Notional i + Order Notional i)^(4/5))
Name | Type |
---|---|
inputs | IMRInputs |
number
inputs
): number
| null
total maintenance margin ratio
Name | Type | Description |
---|---|---|
inputs | AccountMMRInputs | AccountMMRInputs |
number
| null
number|null
inputs
): number
Name | Type |
---|---|
inputs | AvailableBalanceInputs |
number
orders
, symbol
): Order
[]
Name | Type |
---|---|
orders | Order [] |
symbol | string |
Order
[]
totalMarginRatio
): number
current account leverage
Name | Type |
---|---|
totalMarginRatio | number |
number
positions
, orders
): string
[]
Extracts all unique symbols from positions and orders.
Name | Type | Description |
---|---|---|
positions | Pick <Position , "symbol" >[] | An array of position objects. |
orders | Pick <Order , "symbol" >[] | An array of order objects. |
string
[]
An array of unique symbols.
inputs
): Decimal
Calculate free collateral.
Name | Type |
---|---|
inputs | FreeCollateralInputs |
Decimal
inputs
): number
Name | Type |
---|---|
inputs | Object |
inputs.markPrice | number |
inputs.orders | Order [] |
inputs.positions | Position [] |
inputs.symbol | string |
number
orders
, symbol
, side
): number
Get the quantity of long and short orders for a specified symbol from the list of orders.
Name | Type |
---|---|
orders | Order [] |
symbol | string |
side | OrderSide |
number
positions
, symbol
): number
Get the quantity of a specified symbol from the list of positions.
Name | Type |
---|---|
positions | Position [] |
symbol | string |
number
orders
): Object
Group orders by symbol, as a symbol can have multiple orders.
Name | Type |
---|---|
orders | Order [] |
Object
void
void
side
, inputs
, options?
): number
Maximum order quantity.
Name | Type |
---|---|
side | OrderSide |
inputs | MaxQtyInputs |
options? | ResultOptions |
number
inputs
, options?
): number
Name | Type |
---|---|
inputs | Omit <MaxQtyInputs , "side" > |
options? | ResultOptions |
number
inputs
, options?
): number
Name | Type |
---|---|
inputs | Omit <MaxQtyInputs , "side" > |
options? | ResultOptions |
number
inputs
): number
Total margin used by other symbols (except the current symbol).
Name | Type |
---|---|
inputs | OtherIMsInputs |
number
inputs
): Decimal
Sum of notional value for a symbol’s position and orders.
Name | Type |
---|---|
inputs | PositionNotionalWithOrderInputs |
Decimal
inputs
): number
Sum of position quantity and orders quantity for a symbol.
Name | Type |
---|---|
inputs | PositionQtyWithOrderInputs |
number
orders
, symbol
): Order
[]
Name | Type |
---|---|
orders | Order [] |
symbol | string |
Order
[]
inputs
): Decimal
Calculate total collateral.
Name | Type |
---|---|
inputs | TotalCollateralValueInputs |
Decimal
inputs
): number
Calculate the total initial margin used by the user (including positions and orders).
Name | Type |
---|---|
inputs | TotalInitialMarginWithOrdersInputs |
number
inputs
): number
Name | Type |
---|---|
inputs | Object |
inputs.IMR_Factors | Object |
inputs.markPrices | Object |
inputs.maxLeverage | number |
inputs.positions | Position [] |
inputs.symbolInfo | any |
number
inputs
, dp?
): number
total margin ratio
Name | Type |
---|---|
inputs | TotalMarginRatioInputs |
dp? | number |
number
inputs
): number
totalUnrealizedROI
Name | Type |
---|---|
inputs | TotalUnrealizedROIInputs |
number
inputs
): Decimal
User’s total asset value (denominated in USDC), including assets that cannot be used as collateral.
Name | Type |
---|---|
inputs | TotalValueInputs |
Decimal