# BID-ASK Distribution

Create weighted liquidity that increases farther from the current price. Ideal for market making and volatility harvesting strategies. Visit the [Shapes and Strategy](/core-protocols/quickstart/shapes-and-strategies.md) section for more details.

### Quick Implementation

```typescript
import { DistributionUtils } from '@ferra-labs/dlmm';

// Create BID-ASK distribution
const bidAskParams = DistributionUtils.createParams(
  DistributionUtils.BID_ASK,
  {
    activeId: pair.parameters.active_id,
    binRange: [activeId - 15, activeId + 15],
    parsedAmounts: [
      new Decimal(1000),  // token X
      new Decimal(1000)   // token Y
    ]
  }
);

// Add liquidity
const tx = await sdk.Pair.openPositionAndAddLiquidity(pair, {
  amountX: 1000000000n,
  amountY: 1000000000n,
  ...bidAskParams
});
```

### How It Works

Liquidity weight increases with distance from active bin:

* Bin ±1: Weight = 2
* Bin ±2: Weight = 3
* Bin ±3: Weight = 4
* And so on...

```typescript
// Manual implementation
const range = 10;
const deltaIds = Array.from({length: range * 2 + 1}, (_, i) => i - range);

const distribution = deltaIds.map(id => {
  const weight = Math.abs(id) + 1;
  return id === 0 ? weight / 2 : weight;  // Half weight at active
});

// Normalize to 100
const normalized = distribution.map(v => (v / sum) * 100);
```

### Best Use Cases

✅ **Ideal for:**

* Market making strategies
* Mean reversion trading
* Volatility harvesting
* Large price swings

❌ **Not suitable for:**

* Stable pairs
* Trending markets
* Passive strategies

### Strategy Benefits

#### Volatility Capture

* Profits from price swings
* Better fills at extremes
* Natural buy low/sell high

#### Risk Management

* Less IL at current price
* Protected from small moves
* Captures large deviations

### Configuration Tips

* **Volatile pairs**: 20-30 bin range
* **Standard pairs**: 15-20 bin range
* **Adjust range**: Based on historical volatility

### Example Scenarios

```typescript
// High volatility pair
const volatileParams = {
  binRange: [activeId - 25, activeId + 25],  // Wide range
  // More capital for larger swings
};

// Moderate volatility
const standardParams = {
  binRange: [activeId - 15, activeId + 15],  // Standard range
  // Balanced approach
};
```

### Key Advantages

* Captures volatility premium
* Reduces impermanent loss risk
* Better pricing at extremes
* Automated mean reversion

### Related Topics

* [SPOT Distribution](/integration/dlmm/typescript-sdk/add-liquidity/spot-distribution.md) - Uniform approach
* [CURVE Distribution](/integration/dlmm/typescript-sdk/add-liquidity/curve-distribution.md) - Concentrated liquidity
* [Liquidity Strategies](broken://pages/QDLzlzw07vfHJEB6TvIY) - Advanced tactics


---

# 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/add-liquidity/bid-ask-distribution.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.
