> ## 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.

# Get Token Data

> Fetch market data for a specific token using the SDK

## Overview

Get detailed market data for a specific token including current price, volume, market cap, price changes, and TVL. Use this for token detail pages, price widgets, and portfolio tracking.

## SDK Method

```typescript theme={null}
getTokenMarketData(
  tokenAddress: string,
  options?: AvnuOptions
): Promise<TokenMarketData>
```

## Parameters

<ParamField path="tokenAddress" type="string" required>
  Token contract address (hex format with 0x prefix)
</ParamField>

<ParamField path="options" type="AvnuOptions">
  Optional SDK configuration

  <Expandable title="AvnuOptions properties">
    <ParamField path="baseUrl" type="string">
      Custom Impulse API base URL (default: `https://starknet.impulse.avnu.fi`)
    </ParamField>

    <ParamField path="avnuPublicKey" type="string">
      Public key for response verification
    </ParamField>
  </Expandable>
</ParamField>

## Returns

Returns `Promise<TokenMarketData>` - Market data for the specified token.

```typescript theme={null}
interface TokenMarketData {
  address: string;
  name: string;
  symbol: string;
  decimals: number;
  logoUri?: string | null;
  coingeckoId?: string | null;
  verified: boolean;
  tags: TokenTag[];  // defaults to []
  linePriceFeedInUsd: DataPoint[];
  starknet: StarknetMarket;
  global: GlobalMarket | null;
}

interface StarknetMarket {
  usd: number;
  usdTvl: number;
  usdPriceChange1h: number;
  usdPriceChangePercentage1h: number | null;
  usdPriceChange24h: number;
  usdPriceChangePercentage24h: number | null;
  usdPriceChange7d: number;
  usdPriceChangePercentage7d: number | null;
  usdVolume24h: number;
  usdTradingVolume24h: number;
}

interface GlobalMarket {
  usd: number;
  usdMarketCap: number;
  usdFdv: number;
  usdMarketCapChange24h: number;
  usdMarketCapChangePercentage24h: number;
}

interface DataPoint {
  date: string;
  value: number;
}
```

## Examples

<CodeGroup>
  ```typescript Basic Usage theme={null}
  import { getTokenMarketData } from '@avnu/avnu-sdk';

  const ETH = '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7';

  const ethData = await getTokenMarketData(ETH);

  console.log(`${ethData.symbol} (${ethData.name})`);
  console.log(`Price: $${ethData.starknet.usd.toFixed(2)}`);
  console.log(`Market Cap: $${((ethData.global?.usdMarketCap || 0) / 1e9).toFixed(2)}B`);
  console.log(`24h Volume: $${(ethData.starknet.usdVolume24h / 1e6).toFixed(2)}M`);
  console.log(`24h Change: ${ethData.starknet.usdPriceChangePercentage24h?.toFixed(2) || 'N/A'}%`);
  console.log(`TVL: $${(ethData.starknet.usdTvl / 1e6).toFixed(2)}M`);
  ```
</CodeGroup>

## Related

<CardGroup cols={2}>
  <Card title="Get Market Data" icon="chart-simple" href="/docs/markets/get-market-data">
    Get data for all tokens
  </Card>

  <Card title="Get Price Feed" icon="chart-line" href="/docs/markets/get-price-feed">
    Fetch historical price data
  </Card>

  <Card title="API Reference" icon="code" href="/api/markets">
    REST API endpoints
  </Card>

  <Card title="Markets Overview" icon="book" href="/docs/markets/index">
    Learn about Markets API
  </Card>
</CardGroup>
