Orderly network perp.positions
Orderly SDKs / Modules / @orderly.network/perp / positions
Namespace: positions
@orderly.network/perp.positions
Table of contents
Type Aliases
- LiqPriceInputs
- MMInputs
- MMRInputs
- TotalUnsettlementPnLInputs
- UnrealPnLInputs
- UnrealPnLROIInputs
- UnsettlementPnLInputs
Functions
- MMR
- estOffsetForTP
- estPnLForSL
- estPnLForTP
- estPriceForTP
- estPriceFromOffsetForTP
- liqPrice
- maintenanceMargin
- notional
- totalNotional
- totalUnrealizedPnL
- totalUnsettlementPnL
- unrealizedPnL
- unrealizedPnLROI
- unsettlementPnL
Type Aliases
LiqPriceInputs
Ƭ LiqPriceInputs: Object
Type declaration
Name | Type |
---|---|
MMR | number |
markPrice | number |
positionQty | number |
positions | Pick <PositionExt , "position_qty" | "mark_price" | "mmr" >[] |
totalCollateral | number |
Defined in
MMInputs
Ƭ MMInputs: Object
Type declaration
Name | Type |
---|---|
MMR | number |
markPrice | number |
positionQty | number |
Defined in
MMRInputs
Ƭ MMRInputs: Object
Type declaration
Name | Type |
---|---|
IMRFactor | number |
IMR_factor_power | number |
baseIMR | number |
baseMMR | number |
positionNotional | number |
Defined in
TotalUnsettlementPnLInputs
Ƭ TotalUnsettlementPnLInputs: Object
Type declaration
Name | Type |
---|---|
positions | Position & { sum_unitary_funding : number }[] |
sumUnitaryFunding | number |
Defined in
UnrealPnLInputs
Ƭ UnrealPnLInputs: Object
Type declaration
Name | Type |
---|---|
markPrice | number |
openPrice | number |
qty | number |
Defined in
UnrealPnLROIInputs
Ƭ UnrealPnLROIInputs: Object
Type declaration
Name | Type |
---|---|
IMR | number |
openPrice | number |
positionQty | number |
unrealizedPnL | number |
Defined in
UnsettlementPnLInputs
Ƭ UnsettlementPnLInputs: Object
Type declaration
Name | Type |
---|---|
costPosition | number |
lastSumUnitaryFunding | number |
markPrice | number |
positionQty | number |
sumUnitaryFunding | number |
Defined in
Functions
MMR
▸ MMR(inputs
): number
Calculates the maintenance margin requirement (MMR) of a position.
Parameters
Name | Type | Description |
---|---|---|
inputs | MMRInputs | The inputs for calculating the MMR. |
Returns
number
The MMR of the position.
Defined in
estOffsetForTP
▸ estOffsetForTP(inputs
): number
Calculates the estimated offset for take profit.
Parameters
Name | Type |
---|---|
inputs | Object |
inputs.entryPrice | number |
inputs.price | number |
Returns
number
Defined in
estPnLForSL
▸ estPnLForSL(inputs
): number
Calculates the PnL for stop loss.
Parameters
Name | Type |
---|---|
inputs | Object |
inputs.entryPrice | number |
inputs.positionQty | number |
Returns
number
Defined in
estPnLForTP
▸ estPnLForTP(inputs
): number
Calculates the profit or loss for take profit.
Parameters
Name | Type |
---|---|
inputs | Object |
inputs.entryPrice | number |
inputs.positionQty | number |
inputs.price | number |
Returns
number
The profit or loss for take profit.
Defined in
estPriceForTP
▸ estPriceForTP(inputs
): number
Calculates the estimated price for take profit.
Parameters
Name | Type |
---|---|
inputs | Object |
inputs.entryPrice | number |
inputs.pnl | number |
inputs.positionQty | number |
Returns
number
Defined in
estPriceFromOffsetForTP
▸ estPriceFromOffsetForTP(inputs
): number
Calculates the estimated price from offset for take profit.
Parameters
Name | Type |
---|---|
inputs | Object |
inputs.entryPrice | number |
inputs.offset | number |
Returns
number
Defined in
liqPrice
▸ liqPrice(inputs
): number
| null
Calculates the liquidation price of a single position.
Parameters
Name | Type | Description |
---|---|---|
inputs | LiqPriceInputs | The inputs for calculating the liquidation price. |
Returns
number
| null
The liquidation price of the position.
Defined in
maintenanceMargin
▸ maintenanceMargin(inputs
): number
Calculates the maintenance margin of a position.
Parameters
Name | Type | Description |
---|---|---|
inputs | MMInputs | The inputs for calculating the maintenance margin. |
Returns
number
The maintenance margin of the position.
Defined in
notional
▸ notional(qty
, mark_price
): number
Calculates the notional value of a single position.
Parameters
Name | Type | Description |
---|---|---|
qty | number | The quantity of the position. |
mark_price | number | The price of the position. |
Returns
number
The notional value of the position.
Defined in
totalNotional
▸ totalNotional(positions
): number
Calculates the total notional value of all positions.
Parameters
Name | Type | Description |
---|---|---|
positions | Position [] | The array of positions. |
Returns
number
The total notional value of all positions.
Defined in
totalUnrealizedPnL
▸ totalUnrealizedPnL(positions
): number
Calculates the total unrealized profit or loss of all positions.
Parameters
Name | Type | Description |
---|---|---|
positions | Position [] | The array of positions. |
Returns
number
The total unrealized profit or loss of all positions.
Defined in
totalUnsettlementPnL
▸ totalUnsettlementPnL(positions
): number
Calculates the total unrealized profit or loss of all positions.
Parameters
Name | Type | Description |
---|---|---|
positions | Position & { sum_unitary_funding : number }[] | The array of positions. |
Returns
number
The total unrealized profit or loss of all positions.
Defined in
unrealizedPnL
▸ unrealizedPnL(inputs
): number
Calculates the unrealized profit or loss of a single position.
Parameters
Name | Type | Description |
---|---|---|
inputs | UnrealPnLInputs | The inputs for calculating the unrealized profit or loss. |
Returns
number
The unrealized profit or loss of the position.
Defined in
unrealizedPnLROI
▸ unrealizedPnLROI(inputs
): number
Calculates the return on investment (ROI) of a single position’s unrealized profit or loss.
Parameters
Name | Type | Description |
---|---|---|
inputs | UnrealPnLROIInputs | The inputs for calculating the ROI. |
Returns
number
The ROI of the position’s unrealized profit or loss.
Defined in
unsettlementPnL
▸ unsettlementPnL(inputs
): number
Calculates the unrealized profit or loss of each position.
Parameters
Name | Type | Description |
---|---|---|
inputs | UnsettlementPnLInputs | The inputs for calculating the unrealized profit or loss. |
Returns
number
The unrealized profit or loss of each position.