> ## Documentation Index
> Fetch the complete documentation index at: https://docs.avnu.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Token prices and market data on Starknet

Access price feeds, liquidity metrics, and trading volume directly from Starknet—no external oracles needed.

<CardGroup cols={3}>
  <Card title="Tokens price feed" icon="dollar-sign">
    Updated every minute
  </Card>

  <Card title="On-Chain Data" icon="link">
    Sourced from avnu Liquidity Graph
  </Card>

  <Card title="Exchange Breakdown" icon="layer-group">
    Per-DEX volume and TVL
  </Card>
</CardGroup>

<Warning>
  **Display & Analytics Only:** Market data is intended for display purposes and analytics only. Do not use this data for automated decision-making or trading strategies, as it does not benefit from active monitoring or guaranteed uptime.
</Warning>

## How It Works

Markets API uses the **avnu Liquidity Graph** - a real-time index of all liquidity pools on Starknet, updated every block.

<AccordionGroup>
  <Accordion title="Pool State Tracking" icon="database">
    Monitors all supported AMM pools at every block:

    * Pool reserves and liquidity depth
    * Token pair information
    * Real-time state updates
  </Accordion>

  <Accordion title="Starknet & Global prices" icon="route">
    * Provide both global market price (if available) & starknet market price
  </Accordion>

  <Accordion title="Indirect Starknet Pricing" icon="route">
    For tokens without direct ETH or USDC pairs:

    * Chain through multiple tokens
    * Example: TOKEN → STRK → ETH → USDC
    * Calculate final price via intermediate hops
  </Accordion>

  <Accordion title="Real-Time Updates" icon="arrows-rotate">
    Prices and metrics refresh every minute. Historical data available with configurable resolution.
  </Accordion>
</AccordionGroup>

## Feed pricing methodology

Token prices are computed through a two-step process:

1. **Starknet Price Feed** - Calculates token prices in ETH using the avnu Liquidity Graph (on-chain pool states)
2. **External ETH/USD Price** - Combined with the above to derive final USD valuations

### Pool Price Estimation

Rather than using marginal pool prices (which suffer from price impact and arbitrage), avnu samples swap functions using a combination of fix-point approximations and sampling to minimize distortion.

### Final Price Calculation

For a given asset pair, each pool trading these assets is priced and the median of these prices is defined as the current Starknet price for the given pair.

### Indirect Pricing

For tokens without direct ETH pairs:

1. Find the largest connected pool (e.g., TOKEN → STRK)
2. Compute: `Price(TOKEN→ETH) = Price(TOKEN→STRK) × Price(STRK→ETH)`
3. Repeat recursively until reaching ETH

## Quick Start

<CodeGroup>
  ```typescript Get market verified Tokens theme={null}
  import { getMarketData } from '@avnu/avnu-sdk';

  const tokens = await getMarketData();

  tokens.forEach(token => {
    console.log({
      symbol: token.symbol,
      price: token.starknet.usd,
      marketCap: token.global?.usdMarketCap,
      volume24h: token.starknet.usdVolume24h,
      priceChange24h: token.starknet.usdPriceChangePercentage24h,
    });
  });
  ```
</CodeGroup>

## Use Cases

<CardGroup cols={2}>
  <Card title="Wallets" icon="wallet">
    Display real-time token prices and portfolio values without external API dependencies
  </Card>

  <Card title="Trading Dashboards" icon="chart-candlestick">
    Build price charts, volume analysis, and market screeners with historical data
  </Card>

  <Card title="DeFi Protocols" icon="layer-group">
    Calculate TVL, track liquidity, and monitor token prices for lending and yield farming
  </Card>

  <Card title="Analytics Platforms" icon="magnifying-glass-chart">
    Analyze exchange dominance, liquidity trends, and trading patterns across Starknet
  </Card>
</CardGroup>

## Related

<CardGroup cols={2}>
  <Card title="Swap" icon="arrow-right-arrow-left" href="/docs/swap/index">
    Trade tokens at best prices
  </Card>

  <Card title="Token List" icon="coins" href="/docs/tokens/index">
    Get verified token metadata
  </Card>

  <Card title="DCA Orders" icon="calendar-days" href="/docs/dca/index">
    Automate recurring buys
  </Card>

  <Card title="Dashboard" icon="chart-line" href="https://app.avnu.fi/en/market">
    View Markets on avnu app
  </Card>
</CardGroup>
