> ## 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 network perp.positions

[Orderly SDKs](/sdks/tech-doc/README) / [Modules](/sdks/tech-doc/modules) / [@orderly.network/perp](/sdks/tech-doc/modules/orderly_network_perp) / positions

# Namespace: positions

[@orderly.network/perp](/sdks/tech-doc/modules/orderly_network_perp).positions

## Table of contents

### Type Aliases

* [LiqPriceInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#liqpriceinputs)
* [MMInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#mminputs)
* [MMRInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#mmrinputs)
* [TotalUnsettlementPnLInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#totalunsettlementpnlinputs)
* [UnrealPnLInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#unrealpnlinputs)
* [UnrealPnLROIInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#unrealpnlroiinputs)
* [UnsettlementPnLInputs](/sdks/tech-doc/modules/orderly_network_perp.positions#unsettlementpnlinputs)

### Functions

* [MMR](/sdks/tech-doc/modules/orderly_network_perp.positions#mmr)
* [estOffsetForTP](/sdks/tech-doc/modules/orderly_network_perp.positions#estoffsetfortp)
* [estPnLForSL](/sdks/tech-doc/modules/orderly_network_perp.positions#estpnlforsl)
* [estPnLForTP](/sdks/tech-doc/modules/orderly_network_perp.positions#estpnlfortp)
* [estPriceForTP](/sdks/tech-doc/modules/orderly_network_perp.positions#estpricefortp)
* [estPriceFromOffsetForTP](/sdks/tech-doc/modules/orderly_network_perp.positions#estpricefromoffsetfortp)
* [liqPrice](/sdks/tech-doc/modules/orderly_network_perp.positions#liqprice)
* [maintenanceMargin](/sdks/tech-doc/modules/orderly_network_perp.positions#maintenancemargin)
* [notional](/sdks/tech-doc/modules/orderly_network_perp.positions#notional)
* [totalNotional](/sdks/tech-doc/modules/orderly_network_perp.positions#totalnotional)
* [totalUnrealizedPnL](/sdks/tech-doc/modules/orderly_network_perp.positions#totalunrealizedpnl)
* [totalUnsettlementPnL](/sdks/tech-doc/modules/orderly_network_perp.positions#totalunsettlementpnl)
* [unrealizedPnL](/sdks/tech-doc/modules/orderly_network_perp.positions#unrealizedpnl)
* [unrealizedPnLROI](/sdks/tech-doc/modules/orderly_network_perp.positions#unrealizedpnlroi)
* [unsettlementPnL](/sdks/tech-doc/modules/orderly_network_perp.positions#unsettlementpnl)

## Type Aliases

### LiqPriceInputs

Ƭ **LiqPriceInputs**: `Object`

#### Type declaration

| Name              | Type                                                                                                                                        |
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
| `MMR`             | `number`                                                                                                                                    |
| `markPrice`       | `number`                                                                                                                                    |
| `positionQty`     | `number`                                                                                                                                    |
| `positions`       | `Pick`\<[`PositionExt`](/sdks/tech-doc/interfaces/orderly_network_types.API.PositionExt), `"position_qty"` \| `"mark_price"` \| `"mmr"`>\[] |
| `totalCollateral` | `number`                                                                                                                                    |

#### Defined in

[positions.ts:89](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L89)

***

### MMInputs

Ƭ **MMInputs**: `Object`

#### Type declaration

| Name          | Type     |
| :------------ | :------- |
| `MMR`         | `number` |
| `markPrice`   | `number` |
| `positionQty` | `number` |

#### Defined in

[positions.ts:130](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L130)

***

### MMRInputs

Ƭ **MMRInputs**: `Object`

#### Type declaration

| Name               | Type     |
| :----------------- | :------- |
| `IMRFactor`        | `number` |
| `IMR_factor_power` | `number` |
| `baseIMR`          | `number` |
| `baseMMR`          | `number` |
| `positionNotional` | `number` |

#### Defined in

[positions.ts:213](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L213)

***

### TotalUnsettlementPnLInputs

Ƭ **TotalUnsettlementPnLInputs**: `Object`

#### Type declaration

| Name                | Type                                                                                                                 |
| :------------------ | :------------------------------------------------------------------------------------------------------------------- |
| `positions`         | [`Position`](/sdks/tech-doc/interfaces/orderly_network_types.API.Position) & \{ `sum_unitary_funding`: `number` }\[] |
| `sumUnitaryFunding` | `number`                                                                                                             |

#### Defined in

[positions.ts:178](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L178)

***

### UnrealPnLInputs

Ƭ **UnrealPnLInputs**: `Object`

#### Type declaration

| Name        | Type     |
| :---------- | :------- |
| `markPrice` | `number` |
| `openPrice` | `number` |
| `qty`       | `number` |

#### Defined in

[positions.ts:26](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L26)

***

### UnrealPnLROIInputs

Ƭ **UnrealPnLROIInputs**: `Object`

#### Type declaration

| Name            | Type     |
| :-------------- | :------- |
| `IMR`           | `number` |
| `openPrice`     | `number` |
| `positionQty`   | `number` |
| `unrealizedPnL` | `number` |

#### Defined in

[positions.ts:43](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L43)

***

### UnsettlementPnLInputs

Ƭ **UnsettlementPnLInputs**: `Object`

#### Type declaration

| Name                    | Type     |
| :---------------------- | :------- |
| `costPosition`          | `number` |
| `lastSumUnitaryFunding` | `number` |
| `markPrice`             | `number` |
| `positionQty`           | `number` |
| `sumUnitaryFunding`     | `number` |

#### Defined in

[positions.ts:147](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L147)

## Functions

### MMR

▸ **MMR**(`inputs`): `number`

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

#### Parameters

| Name     | Type                                                                           | Description                         |
| :------- | :----------------------------------------------------------------------------- | :---------------------------------- |
| `inputs` | [`MMRInputs`](/sdks/tech-doc/modules/orderly_network_perp.positions#mmrinputs) | The inputs for calculating the MMR. |

#### Returns

`number`

The MMR of the position.

#### Defined in

[positions.ts:226](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L226)

***

### 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

[positions.ts:276](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L276)

***

### 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

[positions.ts:296](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L296)

***

### 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

[positions.ts:249](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L249)

***

### 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

[positions.ts:262](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L262)

***

### 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

[positions.ts:286](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L286)

***

### liqPrice

▸ **liqPrice**(`inputs`): `number` | `null`

Calculates the liquidation price of a single position.

#### Parameters

| Name     | Type                                                                                     | Description                                       |
| :------- | :--------------------------------------------------------------------------------------- | :------------------------------------------------ |
| `inputs` | [`LiqPriceInputs`](/sdks/tech-doc/modules/orderly_network_perp.positions#liqpriceinputs) | The inputs for calculating the liquidation price. |

#### Returns

`number` | `null`

The liquidation price of the position.

#### Defined in

[positions.ts:102](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L102)

***

### maintenanceMargin

▸ **maintenanceMargin**(`inputs`): `number`

Calculates the maintenance margin of a position.

#### Parameters

| Name     | Type                                                                         | Description                                        |
| :------- | :--------------------------------------------------------------------------- | :------------------------------------------------- |
| `inputs` | [`MMInputs`](/sdks/tech-doc/modules/orderly_network_perp.positions#mminputs) | The inputs for calculating the maintenance margin. |

#### Returns

`number`

The maintenance margin of the position.

#### Defined in

[positions.ts:141](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L141)

***

### 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

[positions.ts:11](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L11)

***

### totalNotional

▸ **totalNotional**(`positions`): `number`

Calculates the total notional value of all positions.

#### Parameters

| Name        | Type                                                                          | Description             |
| :---------- | :---------------------------------------------------------------------------- | :---------------------- |
| `positions` | [`Position`](/sdks/tech-doc/interfaces/orderly_network_types.API.Position)\[] | The array of positions. |

#### Returns

`number`

The total notional value of all positions.

#### Defined in

[positions.ts:20](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L20)

***

### totalUnrealizedPnL

▸ **totalUnrealizedPnL**(`positions`): `number`

Calculates the total unrealized profit or loss of all positions.

#### Parameters

| Name        | Type                                                                          | Description             |
| :---------- | :---------------------------------------------------------------------------- | :---------------------- |
| `positions` | [`Position`](/sdks/tech-doc/interfaces/orderly_network_types.API.Position)\[] | The array of positions. |

#### Returns

`number`

The total unrealized profit or loss of all positions.

#### Defined in

[positions.ts:76](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L76)

***

### totalUnsettlementPnL

▸ **totalUnsettlementPnL**(`positions`): `number`

Calculates the total unrealized profit or loss of all positions.

#### Parameters

| Name        | Type                                                                                                                 | Description             |
| :---------- | :------------------------------------------------------------------------------------------------------------------- | :---------------------- |
| `positions` | [`Position`](/sdks/tech-doc/interfaces/orderly_network_types.API.Position) & \{ `sum_unitary_funding`: `number` }\[] | The array of positions. |

#### Returns

`number`

The total unrealized profit or loss of all positions.

#### Defined in

[positions.ts:190](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L190)

***

### unrealizedPnL

▸ **unrealizedPnL**(`inputs`): `number`

Calculates the unrealized profit or loss of a single position.

#### Parameters

| Name     | Type                                                                                       | Description                                               |
| :------- | :----------------------------------------------------------------------------------------- | :-------------------------------------------------------- |
| `inputs` | [`UnrealPnLInputs`](/sdks/tech-doc/modules/orderly_network_perp.positions#unrealpnlinputs) | The inputs for calculating the unrealized profit or loss. |

#### Returns

`number`

The unrealized profit or loss of the position.

#### Defined in

[positions.ts:37](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L37)

***

### 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`](/sdks/tech-doc/modules/orderly_network_perp.positions#unrealpnlroiinputs) | The inputs for calculating the ROI. |

#### Returns

`number`

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

#### Defined in

[positions.ts:55](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L55)

***

### unsettlementPnL

▸ **unsettlementPnL**(`inputs`): `number`

Calculates the unrealized profit or loss of each position.

#### Parameters

| Name     | Type                                                                                                   | Description                                               |
| :------- | :----------------------------------------------------------------------------------------------------- | :-------------------------------------------------------- |
| `inputs` | [`UnsettlementPnLInputs`](/sdks/tech-doc/modules/orderly_network_perp.positions#unsettlementpnlinputs) | The inputs for calculating the unrealized profit or loss. |

#### Returns

`number`

The unrealized profit or loss of each position.

#### Defined in

[positions.ts:160](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/perp/src/positions.ts#L160)
