# Open Position

### Quick Start

<pre class="language-typescript"><code class="lang-typescript">import { clmmMainnet, initFerraSDK } from '@ferra-labs/clmm'

// Initialize SDK
const sdk = initFerraSDK({
  ...clmmMainnet,
  network: 'beta',
  fullNodeUrl: 'https://...',
  wallet: '0x...'
})

<strong>const tx = sdk.Position.openPositionTransactionPayload({
</strong>  pool_id: '0x...',
  coinTypeA: '0x2::sui::SUI', 
  coinTypeB: '0x...::usdc::USDC',
  tick_lower: -1000,
  tick_upper: 1000
})

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

### Parameters

| Parameter    | Type   | Description          |
| ------------ | ------ | -------------------- |
| `pool_id`    | string | Pool object ID       |
| `coinTypeA`  | string | First token type     |
| `coinTypeB`  | string | Second token type    |
| `tick_lower` | number | Lower price boundary |
| `tick_upper` | number | Upper price boundary |

### Price Range

#### Set Custom Range

```typescript
import { TickMath } from '@ferra-labs/clmm'

// Price range: 0.9 - 1.1 USDC per SUI
const lowerPrice = 0.9
const upperPrice = 1.1

const tickLower = TickMath.priceToTickIndex(lowerPrice, 9, 6)
const tickUpper = TickMath.priceToTickIndex(upperPrice, 9, 6)
```

#### Range Around Current Price

```typescript
const pool = await sdk.Pool.getPool(poolId)
const currentTick = pool.current_tick_index
const tickSpacing = pool.tick_spacing

// ±10 ticks from current price
const tickLower = currentTick - 10 * tickSpacing
const tickUpper = currentTick + 10 * tickSpacing
```

### Complete Example

```typescript
// 1. Get pool info
const pool = await sdk.Pool.getPool(poolId)

// 2. Set price range
const tickLower = -1000
const tickUpper = 1000

// 3. Open position
const tx = sdk.Position.openPositionTransactionPayload({
  pool_id: poolId,
  coinTypeA: pool.coinTypeA,
  coinTypeB: pool.coinTypeB,
  tick_lower: tickLower,
  tick_upper: tickUpper
})

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

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

### Important Notes

* Opening a position creates an empty NFT without liquidity
* Add liquidity separately after position creation
* Position NFT is transferable and tradeable
* Each position has unique tick range that cannot be changed


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ferra.ag/integration/clmm/typescript-sdk/open-position.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
