# Create LB Pair

Deploy new liquidity book trading pairs with custom configurations for any token combination.

### Prerequisites

Before creating a pair:

* Initialize the SDK with valid configuration
* Have wallet connected with sufficient gas
* Ensure both token types are valid on Sui
* Choose appropriate bin step for your pair type
* Calculate initial active bin ID for starting price

### Basic Usage

```typescript
const tx = await sdk.Factory.createLBPair({
  tokenXType: "0x2::sui::SUI",
  tokenYType: "0x...::usdc::USDC", 
  binStep: 20,        // 20 basis points
  activeId: 8388608   // Starting price = 1.0
});

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

### Parameters

#### tokenXType & tokenYType

* Full type strings of both tokens
* Order doesn't matter (SDK auto-sorts)
* Must be different tokens

#### binStep

* Price increment in basis points (1-10000)
* Cannot be changed after creation

#### activeId

* Starting bin ID (sets initial price)
* Use 8388608 for 1:1 price ratio

### Advanced Example

```typescript
// Create ETH/USDC pair starting at $3,500
const targetPrice = 3500;
const binStep = 20;

// Calculate starting bin ID
const activeId = getBinIdFromPrice(targetPrice, binStep);

const tx = await sdk.Factory.createLBPair({
  tokenXType: SUI_TYPE,
  tokenYType: USDC_TYPE,
  binStep: binStep,
  activeId: activeId  // ~8394879 for $3,500
});
```

### Token Ordering

DLMM requires tokenX < tokenY (by address). The SDK handles this automatically:

```typescript
// Both orders work - SDK will sort
await createLBPair({ 
  tokenXType: USDC, 
  tokenYType: SUI, 
  ...
});

await createLBPair({ 
  tokenXType: SUI,  // Will be swapped to Y
  tokenYType: USDC, // Will be swapped to X
  ...
});
```

### After Creation

1. Pair is deployed but has no liquidity
2. Use [Add to New Position](/integration/dlmm/typescript-sdk/add-liquidity/add-to-new-position.md) to provide initial liquidity
3. Find your pair with [Get Single Pair](/integration/dlmm/typescript-sdk/trading-pairs/get-single-pair.md)

### Related Topics

* [Add to New Position](/integration/dlmm/typescript-sdk/add-liquidity/add-to-new-position.md) - Add initial liquidity
* [Get All Pairs](/integration/dlmm/typescript-sdk/trading-pairs/get-all-pairs.md) - Find existing pairs first


---

# 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/dlmm/typescript-sdk/trading-pairs/create-lb-pair.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.
