> 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/trading-pairs/create-lb-pair.md).

# 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
