Documentation Index
Fetch the complete documentation index at: https://staging-docs.orderly.network/llms.txt
Use this file to discover all available pages before exploring further.
Orderly SDKs / Modules / @orderly.network/perp / account
Namespace: account
@orderly.network/perp.account
Table of contents
Type Aliases
Functions
Type Aliases
Ƭ AccountMMRInputs: Object
Type declaration
| Name | Type | Description |
|---|
positionsMMR | number | - |
positionsNotional | number | Notional sum of all positions, positions.totalNotional() |
Defined in
account.ts:718
Ƭ AvailableBalanceInputs: Object
Type declaration
| Name | Type |
|---|
USDCHolding | number |
unsettlementPnL | number |
Defined in
account.ts:708
Ƭ FreeCollateralInputs: Object
Total value of available collateral in the user’s account (denominated in USDC).
Type declaration
| Name | Type |
|---|
totalCollateral | Decimal |
totalInitialMarginWithOrders | number |
Defined in
account.ts:41
Ƭ IMRInputs: Object
Type declaration
| Name | Type |
|---|
IMR_Factor | number |
IMR_factor_power? | number |
baseIMR | number |
maxLeverage | number |
ordersNotional | number |
positionNotional | number |
Defined in
account.ts:123
Ƭ MaxQtyInputs: Object
Type declaration
| 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 |
Defined in
account.ts:483
Ƭ OtherIMsInputs: Object
Type declaration
| Name | Type |
|---|
IMR_Factors | { [key: string]: number; } |
markPrices | { [key: string]: number; } |
maxLeverage | number |
orders | Order[] |
positions | Position[] |
symbolInfo | any |
Defined in
account.ts:396
Ƭ PositionNotionalWithOrderInputs: Object
Type declaration
| Name | Type |
|---|
markPrice | number |
positionQtyWithOrders | number |
Defined in
account.ts:87
Ƭ PositionQtyWithOrderInputs: Object
Type declaration
| Name | Type |
|---|
buyOrdersQty | number |
positionQty | number |
sellOrdersQty | number |
Defined in
account.ts:100
ResultOptions
Ƭ ResultOptions: Object
Type declaration
Defined in
account.ts:10
Ƭ TotalCollateralValueInputs: Object
Type declaration
| Name | Type |
|---|
USDCHolding | number |
nonUSDCHolding | { discount: number ; holding: number ; markPrice: number }[] |
unsettlementPnL | number |
Defined in
account.ts:56
Ƭ TotalInitialMarginWithOrdersInputs: { IMR_Factors: { [key: string]: number; } ; markPrices: { [key: string]: number; } ; orders: Order[] ; positions: Position[] ; symbolInfo: any } & Pick<IMRInputs, "maxLeverage">
Defined in
account.ts:228
Ƭ TotalMarginRatioInputs: Object
Type declaration
| Name | Type |
|---|
markPrices | { [key: string]: number; } |
positions | Position[] |
totalCollateral | number |
Defined in
account.ts:650
Ƭ TotalUnrealizedROIInputs: Object
Type declaration
| Name | Type |
|---|
totalUnrealizedPnL | number |
totalValue | number |
Defined in
account.ts:682
Ƭ TotalValueInputs: Object
Type declaration
| Name | Type |
|---|
USDCHolding | number |
nonUSDCHolding | { discount: number ; holding: number ; markPrice: number }[] |
totalUnsettlementPnL | number |
Defined in
account.ts:14
Functions
IMR
▸ IMR(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))
Parameters
Returns
number
Defined in
account.ts:136
MMR
▸ MMR(inputs): number | null
total maintenance margin ratio
Parameters
| Name | Type | Description |
|---|
inputs | AccountMMRInputs | AccountMMRInputs |
Returns
number | null
number|null
Defined in
account.ts:733
availableBalance
▸ availableBalance(inputs): number
Parameters
Returns
number
Defined in
account.ts:712
buyOrdersFilter_by_symbol
▸ buyOrdersFilter_by_symbol(orders, symbol): Order[]
Parameters
| Name | Type |
|---|
orders | Order[] |
symbol | string |
Returns
Order[]
Defined in
account.ts:159
currentLeverage
▸ currentLeverage(totalMarginRatio): number
current account leverage
Parameters
| Name | Type |
|---|
totalMarginRatio | number |
Returns
number
Defined in
account.ts:701
▸ extractSymbols(positions, orders): string[]
Extracts all unique symbols from positions and orders.
Parameters
| Name | Type | Description |
|---|
positions | Pick<Position, "symbol">[] | An array of position objects. |
orders | Pick<Order, "symbol">[] | An array of order objects. |
Returns
string[]
An array of unique symbols.
Defined in
account.ts:375
freeCollateral
▸ freeCollateral(inputs): Decimal
Calculate free collateral.
Parameters
Returns
Decimal
Defined in
account.ts:50
getPositonsAndOrdersNotionalBySymbol
▸ getPositonsAndOrdersNotionalBySymbol(inputs): number
Parameters
| Name | Type |
|---|
inputs | Object |
inputs.markPrice | number |
inputs.orders | Order[] |
inputs.positions | Position[] |
inputs.symbol | string |
Returns
number
Defined in
account.ts:208
getQtyFromOrdersBySide
▸ getQtyFromOrdersBySide(orders, symbol, side): number
Get the quantity of long and short orders for a specified symbol from the list of orders.
Parameters
| Name | Type |
|---|
orders | Order[] |
symbol | string |
side | OrderSide |
Returns
number
Defined in
account.ts:194
getQtyFromPositions
▸ getQtyFromPositions(positions, symbol): number
Get the quantity of a specified symbol from the list of positions.
Parameters
| Name | Type |
|---|
positions | Position[] |
symbol | string |
Returns
number
Defined in
account.ts:180
groupOrdersBySymbol
▸ groupOrdersBySymbol(orders): Object
Group orders by symbol, as a symbol can have multiple orders.
Parameters
Returns
Object
Defined in
account.ts:355
initialMarginWithOrder
▸ initialMarginWithOrder(): void
Returns
void
Defined in
account.ts:85
maxQty
▸ maxQty(side, inputs, options?): number
Maximum order quantity.
Parameters
Returns
number
Defined in
account.ts:515
maxQtyByLong
▸ maxQtyByLong(inputs, options?): number
Parameters
| Name | Type |
|---|
inputs | Omit<MaxQtyInputs, "side"> |
options? | ResultOptions |
Returns
number
Defined in
account.ts:526
maxQtyByShort
▸ maxQtyByShort(inputs, options?): number
Parameters
| Name | Type |
|---|
inputs | Omit<MaxQtyInputs, "side"> |
options? | ResultOptions |
Returns
number
Defined in
account.ts:587
otherIMs
▸ otherIMs(inputs): number
Total margin used by other symbols (except the current symbol).
Parameters
| Name | Type |
|---|
inputs | OtherIMsInputs |
Returns
number
Defined in
account.ts:410
positionNotionalWithOrder_by_symbol
▸ positionNotionalWithOrder_by_symbol(inputs): Decimal
Sum of notional value for a symbol’s position and orders.
Parameters
Returns
Decimal
Defined in
account.ts:94
positionQtyWithOrders_by_symbol
▸ positionQtyWithOrders_by_symbol(inputs): number
Sum of position quantity and orders quantity for a symbol.
Parameters
Returns
number
Defined in
account.ts:110
sellOrdersFilter_by_symbol
▸ sellOrdersFilter_by_symbol(orders, symbol): Order[]
Parameters
| Name | Type |
|---|
orders | Order[] |
symbol | string |
Returns
Order[]
Defined in
account.ts:168
totalCollateral
▸ totalCollateral(inputs): Decimal
Calculate total collateral.
Parameters
Returns
Decimal
Defined in
account.ts:71
totalInitialMarginWithOrders
▸ totalInitialMarginWithOrders(inputs): number
Calculate the total initial margin used by the user (including positions and orders).
Parameters
Returns
number
Defined in
account.ts:240
totalInitialMarginWithQty
▸ totalInitialMarginWithQty(inputs): number
Parameters
| Name | Type |
|---|
inputs | Object |
inputs.IMR_Factors | Object |
inputs.markPrices | Object |
inputs.maxLeverage | number |
inputs.positions | Position[] |
inputs.symbolInfo | any |
Returns
number
Defined in
account.ts:298
totalMarginRatio
▸ totalMarginRatio(inputs, dp?): number
total margin ratio
Parameters
| Name | Type |
|---|
inputs | TotalMarginRatioInputs |
dp? | number |
Returns
number
Defined in
account.ts:658
totalUnrealizedROI
▸ totalUnrealizedROI(inputs): number
totalUnrealizedROI
Parameters
Returns
number
Defined in
account.ts:690
totalValue
▸ totalValue(inputs): Decimal
User’s total asset value (denominated in USDC), including assets that cannot be used as collateral.
Parameters
Returns
Decimal
Defined in
account.ts:28