Orderly SDKs / Modules / @orderly.network/perp / positions

Namespace: positions

@orderly.network/perp.positions

Table of contents

Type Aliases

Functions

Type Aliases

LiqPriceInputs

Ƭ LiqPriceInputs: Object

Type declaration

NameType
MMRnumber
markPricenumber
positionQtynumber
positionsPick<PositionExt, "position_qty" | "mark_price" | "mmr">[]
totalCollateralnumber

Defined in

positions.ts:89


MMInputs

Ƭ MMInputs: Object

Type declaration

NameType
MMRnumber
markPricenumber
positionQtynumber

Defined in

positions.ts:130


MMRInputs

Ƭ MMRInputs: Object

Type declaration

NameType
IMRFactornumber
IMR_factor_powernumber
baseIMRnumber
baseMMRnumber
positionNotionalnumber

Defined in

positions.ts:213


TotalUnsettlementPnLInputs

Ƭ TotalUnsettlementPnLInputs: Object

Type declaration

NameType
positionsPosition & { sum_unitary_funding: number }[]
sumUnitaryFundingnumber

Defined in

positions.ts:178


UnrealPnLInputs

Ƭ UnrealPnLInputs: Object

Type declaration

NameType
markPricenumber
openPricenumber
qtynumber

Defined in

positions.ts:26


UnrealPnLROIInputs

Ƭ UnrealPnLROIInputs: Object

Type declaration

NameType
IMRnumber
openPricenumber
positionQtynumber
unrealizedPnLnumber

Defined in

positions.ts:43


UnsettlementPnLInputs

Ƭ UnsettlementPnLInputs: Object

Type declaration

NameType
costPositionnumber
lastSumUnitaryFundingnumber
markPricenumber
positionQtynumber
sumUnitaryFundingnumber

Defined in

positions.ts:147

Functions

MMR

MMR(inputs): number

Calculates the maintenance margin requirement (MMR) of a position.

Parameters

NameTypeDescription
inputsMMRInputsThe inputs for calculating the MMR.

Returns

number

The MMR of the position.

Defined in

positions.ts:226


estOffsetForTP

estOffsetForTP(inputs): number

Calculates the estimated offset for take profit.

Parameters

NameType
inputsObject
inputs.entryPricenumber
inputs.pricenumber

Returns

number

Defined in

positions.ts:276


estPnLForSL

estPnLForSL(inputs): number

Calculates the PnL for stop loss.

Parameters

NameType
inputsObject
inputs.entryPricenumber
inputs.positionQtynumber

Returns

number

Defined in

positions.ts:296


estPnLForTP

estPnLForTP(inputs): number

Calculates the profit or loss for take profit.

Parameters

NameType
inputsObject
inputs.entryPricenumber
inputs.positionQtynumber
inputs.pricenumber

Returns

number

The profit or loss for take profit.

Defined in

positions.ts:249


estPriceForTP

estPriceForTP(inputs): number

Calculates the estimated price for take profit.

Parameters

NameType
inputsObject
inputs.entryPricenumber
inputs.pnlnumber
inputs.positionQtynumber

Returns

number

Defined in

positions.ts:262


estPriceFromOffsetForTP

estPriceFromOffsetForTP(inputs): number

Calculates the estimated price from offset for take profit.

Parameters

NameType
inputsObject
inputs.entryPricenumber
inputs.offsetnumber

Returns

number

Defined in

positions.ts:286


liqPrice

liqPrice(inputs): number | null

Calculates the liquidation price of a single position.

Parameters

NameTypeDescription
inputsLiqPriceInputsThe inputs for calculating the liquidation price.

Returns

number | null

The liquidation price of the position.

Defined in

positions.ts:102


maintenanceMargin

maintenanceMargin(inputs): number

Calculates the maintenance margin of a position.

Parameters

NameTypeDescription
inputsMMInputsThe inputs for calculating the maintenance margin.

Returns

number

The maintenance margin of the position.

Defined in

positions.ts:141


notional

notional(qty, mark_price): number

Calculates the notional value of a single position.

Parameters

NameTypeDescription
qtynumberThe quantity of the position.
mark_pricenumberThe price of the position.

Returns

number

The notional value of the position.

Defined in

positions.ts:11


totalNotional

totalNotional(positions): number

Calculates the total notional value of all positions.

Parameters

NameTypeDescription
positionsPosition[]The array of positions.

Returns

number

The total notional value of all positions.

Defined in

positions.ts:20


totalUnrealizedPnL

totalUnrealizedPnL(positions): number

Calculates the total unrealized profit or loss of all positions.

Parameters

NameTypeDescription
positionsPosition[]The array of positions.

Returns

number

The total unrealized profit or loss of all positions.

Defined in

positions.ts:76


totalUnsettlementPnL

totalUnsettlementPnL(positions): number

Calculates the total unrealized profit or loss of all positions.

Parameters

NameTypeDescription
positionsPosition & { sum_unitary_funding: number }[]The array of positions.

Returns

number

The total unrealized profit or loss of all positions.

Defined in

positions.ts:190


unrealizedPnL

unrealizedPnL(inputs): number

Calculates the unrealized profit or loss of a single position.

Parameters

NameTypeDescription
inputsUnrealPnLInputsThe inputs for calculating the unrealized profit or loss.

Returns

number

The unrealized profit or loss of the position.

Defined in

positions.ts:37


unrealizedPnLROI

unrealizedPnLROI(inputs): number

Calculates the return on investment (ROI) of a single position’s unrealized profit or loss.

Parameters

NameTypeDescription
inputsUnrealPnLROIInputsThe inputs for calculating the ROI.

Returns

number

The ROI of the position’s unrealized profit or loss.

Defined in

positions.ts:55


unsettlementPnL

unsettlementPnL(inputs): number

Calculates the unrealized profit or loss of each position.

Parameters

NameTypeDescription
inputsUnsettlementPnLInputsThe inputs for calculating the unrealized profit or loss.

Returns

number

The unrealized profit or loss of each position.

Defined in

positions.ts:160