> For the complete documentation index, see [llms.txt](https://docs.metric.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metric.xyz/how-pools-work/price-providers.md).

# Price Providers

Each pool uses one **Price Provider**: a contract that returns a quote containing bid, ask and reference price.

Pools of the same pair can share one provider contract while keeping separate liquidity.

By design, a Price Provider is small and disposable: quick to write and cheap to deploy. When a strategy changes, deploy a new provider rather than patching the old one.

<figure><img src="https://2762670563-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyvQVWzbfEJJ8Aelwvxmj%2Fuploads%2FhcSK7cfDrAim6zC6K21z%2Fmetric_provider_and_bins_into_pool.png?alt=media&#x26;token=727d8c72-1a25-417b-8994-ea1818b5bb31" alt=""><figcaption></figcaption></figure>

## Three pricing inputs

Bid and ask are from the **pool's perspective**, for the asset being priced.

| Input           | Role                                                           |
| --------------- | -------------------------------------------------------------- |
| Bid             | Price at which the pool buys the asset                         |
| Ask             | Price at which the pool sells the asset                        |
| Reference price | Sets 0% deviation and the basis for LP earnings and admin fees |

The reference must lie between bid and ask. Widening a side increases the LP earnings on that side, and both sides can widen together without limit. What the pool's configuration bounds is the skew: how much further one side may sit from the reference than the other. Metric can also turn this check off for a pool. A quote that breaks these rules reverts, and the pool doesn't trade.

See [Liquidity and bins](/how-pools-work/liquidity-and-bins.md#execution-price) for how the pool uses the provider's quote.

#### If the provider can't quote

If the provider reverts or reports no valid price, the pool rejects every swap until a valid quote returns, so nothing trades at a missing or invalid price. Deposits and withdrawals still work, subject to the pool's extensions. Providers use this on purpose, for example to halt during a feed outage or outside trading hours.

## Different markets, different rules

A provider can:

* Follow an oracle feed or another onchain market.
* Adjust spreads using price uncertainty, a stablecoin's distance from its peg or pool balances.
* Discover prices using trading activity and inventory.
* Use a market maker's proprietary quotes.
* Set its own trading hours. A private pool can price a stock whenever its curator chooses, including while the stock's market is closed.

**An external oracle is optional.** Offchain models can use Metric's [shared oracle infrastructure](/how-pools-work/oracles.md) to publish data; the pool still reads prices from its provider contract.

## Why the reference matters

A quote can pass the pool's checks and still trade at a bad price, losing LP funds. A misleading reference can also inflate reported LP earnings without improving the value of the assets held.

Always report a correct reference price; see [Build a Price Provider](/run-a-pool/build-a-price-provider.md#reference-price).

[Anchored pricing](/how-pools-work/anchored-pricing.md#anchored-pricing) uses an independent feed to constrain custom quotes. Unanchored providers rely on their own logic, inputs and permissions.

For replacement and configuration permissions, see [Risks and safeguards](/use-metric/provide-and-manage-liquidity/risks-and-safeguards.md).

[Oracles](/how-pools-work/oracles.md) · [Build a Price Provider](/run-a-pool/build-a-price-provider.md)
