# Concentrated-Liquidity Position

`D25-F01-A05` · Digital Assets and On-Chain Finance → AMM Pricing · archetype `record-transform` · difficulty 3/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/digital-assets-and-on-chain-finance/amm-pricing/concentrated-liquidity-position/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { concentratedLiquidityPosition } from "fintech-algorithms/digital-assets-and-on-chain-finance/amm-pricing/concentrated-liquidity-position";
```

## Signature

```ts
concentratedLiquidityPosition(liquidity, priceLower, priceUpper, currentPrice)
```

Uniswap v3 positions: liquidity supplied only within a price range. Far more capital-efficient inside the range, and entirely one-sided outside it — a position whose price has left its range is holding only the losing asset.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `liquidity` | `number` | yes | Position liquidity L. · min: 0 |
| `priceLower` | `number` | yes | Lower bound of the range. · min: 0 |
| `priceUpper` | `number` | yes | Upper bound of the range. · min: 0 |
| `currentPrice` | `number` | yes | Current pool price. · min: 0 |

## Returns

`{ amount0, amount1, inRange, … }`

Token amounts held with an explicit in-range flag — out of range is the state that surprises position holders.

## Errors

- When priceLower is not below priceUpper — throws

## Complexity

Time `O(1)`, space `O(1)`.

## Worked example

Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

### Input

`liquidity`:

```json
1000
```

`priceLower`:

```json
0.81
```

`priceUpper`:

```json
1.21
```

`currentPrice`:

```json
0.7
```

### Call

```ts
concentratedLiquidityPosition(liquidity, priceLower, priceUpper, currentPrice)
```

### Returns

object with 14 fields: model, liquidity, priceLowerToken1PerToken0, priceUpperToken1PerToken0, currentPriceToken1PerToken0, sqrtPriceLower, sqrtPriceUpper, sqrtPriceCurrent, …

```json
{
  "model": "concentrated-liquidity-position",
  "liquidity": 1000,
  "priceLowerToken1PerToken0": 0.81,
  "priceUpperToken1PerToken0": 1.21,
  "currentPriceToken1PerToken0": 0.7,
  "sqrtPriceLower": 0.9,
  "sqrtPriceUpper": 1.1,
  "sqrtPriceCurrent": 0.836660026534,
  "amount0": 202.020202020202,
  "amount1": 0,
  "valueInToken1AtCurrentPrice": 141.414141414141,
  "state": "below-range",
  "active": false,
  "boundaryConvention": "price<=lower is below; lower<price<upper is active; price>=upper is above"
}
```

## Other exports

`constantProductQuote`, `constantSumQuote`, `stableSwapInvariant`, `stableSwapQuote`, `weightedProductQuote`. Every module additionally exports `run` as an alias of its primary
function, and a `meta` object carrying its catalog id, domain, family, shape and article URL.

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/digital-assets-and-on-chain-finance/amm-pricing/concentrated-liquidity-position/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/digital-assets-and-on-chain-finance/amm-pricing/concentrated-liquidity-position/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/digital-assets-and-on-chain-finance/llms.txt
