> For the complete documentation index, see [llms.txt](https://docs.ferra.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ferra.ag/integration/dlmm/typescript-sdk/position-management/open-position.md).

# Open Position

Create a new position NFT that represents your liquidity ownership in a DLMM pool. Position NFTs track your share across multiple bins and enable granular liquidity management.

### Prerequisites

Before opening a position:

* Have a valid LBPair object from `getPair()`
* Connected wallet with sufficient gas
* Understanding of position NFTs in DLMM
* Plan for liquidity distribution (can add later)

### Basic Usage

```typescript
// Get the pair first
const pair = await sdk.Pair.getPair(pairAddress);

// Create a new empty position
const tx = await sdk.Pair.openPosition(pair);

// Execute transaction
const result = await sdk.fullClient.signAndExecuteTransaction({
  transaction: tx,
  signer: keypair
});

console.log("Position NFT created:", result.digest);
```

### Method Signature

```typescript
async openPosition(
  pair: LBPair, 
  tx?: Transaction
): Promise<Transaction>
```

#### Parameters

* `pair`: The LBPair to create position for
* `tx`: Optional existing transaction to append to

#### Returns

* Transaction object ready for execution
* Position NFT will be transferred to sender

### Understanding Position NFTs

Position NFTs in DLMM:

* **Unique ownership**: Each NFT represents your specific liquidity
* **Multi-bin support**: Can hold liquidity across many price levels
* **Fee tracking**: Accumulates your share of trading fees
* **Transferable**: Can be sent to other addresses
* **Composable**: Can be used in other protocols

### Creating and Adding Liquidity

#### Two-Step Process

```typescript
// Step 1: Create position
const tx1 = await sdk.Pair.openPosition(pair);
await executeTransaction(tx1);

// Step 2: Add liquidity later
const tx2 = await sdk.Pair.addLiquidity(pair, {
  positionId: "0x...", // From step 1
  amountX: 1000000n,
  amountY: 2000000n,
  // ... distribution params
});
```

#### One-Step Process (Recommended)

```typescript
// Create position and add liquidity together
const tx = await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 1000000n,
  amountY: 2000000n,
  deltaIds: [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5],
  distributionX: [0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0],
  distributionY: [0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0]
});
```

### Batch Operations

```typescript
// Create multiple positions in one transaction
const tx = new Transaction();

// Create positions for different strategies
const position1 = await sdk.Pair.openPosition(pairETHUSDC, tx);
const position2 = await sdk.Pair.openPosition(pairSUIUSDC, tx);

// Execute all at once
await sdk.fullClient.signAndExecuteTransaction({
  transaction: tx,
  signer: keypair
});
```

### Finding Your Position ID

After creation, retrieve the position ID from transaction events:

```typescript
const result = await sdk.fullClient.signAndExecuteTransaction({
  transaction: tx,
  signer: keypair
});

// Get created object IDs
const createdObjects = result.effects?.created || [];
const positionId = createdObjects.find(obj => 
  obj.owner === 'AddressOwner' // Your address
)?.reference.objectId;

console.log("New position ID:", positionId);
```

### Gas Optimization

Opening an empty position uses minimal gas. Consider:

* Batch position creation with liquidity addition
* Use `openPositionAndAddLiquidity()` for efficiency
* Reuse existing positions when possible

### Common Patterns

#### Position for Range Order

```typescript
// Create position for future liquidity
const tx = await sdk.Pair.openPosition(pair);

// Can add liquidity when price reaches target
// Position remains empty until then
```

#### Multi-Strategy Positions

```typescript
// Create separate positions for different strategies
const conservativeTx = await sdk.Pair.openPosition(pair);
const aggressiveTx = await sdk.Pair.openPosition(pair);

// Add different distributions to each
```

### Related Topics

* [Add to New Position](/integration/dlmm/typescript-sdk/add-liquidity/add-to-new-position.md) - Create and fund together
* [Get User Positions](/integration/dlmm/typescript-sdk/position-management/get-user-positions.md) - List your positions
* [Add to Existing Position](/integration/dlmm/typescript-sdk/add-liquidity/add-to-existing-position.md) - Fund created positions
* [Close Position](/integration/dlmm/typescript-sdk/position-management/close-position.md) - Remove and burn position NFT
