> ## 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 Volume Data

> Fetch trading volume data by exchange using the SDK

## Overview

Get trading volume data for a token across different exchanges. Three functions are available: aggregated volume by exchange, historical volume feed per exchange, and transfer volume.

## SDK Methods

### getVolumeByExchange

Get aggregated volume distribution across exchanges for a date range.

```typescript theme={null}
getVolumeByExchange(
  tokenAddress: string,
  simpleProps: SimpleFeedProps,
  options?: AvnuOptions
): Promise<ExchangeRangeDataPoint[]>
```

### getExchangeVolumeFeed

Get historical volume data over time with configurable resolution, broken down by exchange.

```typescript theme={null}
getExchangeVolumeFeed(
  tokenAddress: string,
  feedProps: FeedProps,
  options?: AvnuOptions
): Promise<ExchangeDataPoint[]>
```

### getTransferVolumeFeed

Get historical transfer volume (all on-chain transfers, not just DEX trades).

```typescript theme={null}
getTransferVolumeFeed(
  tokenAddress: string,
  feedProps: FeedProps,
  options?: AvnuOptions
): Promise<DataPointWithUsd[]>
```

## Parameters

<ParamField path="tokenAddress" type="string" required>
  Token contract address
</ParamField>

<ParamField path="simpleProps" type="SimpleFeedProps" required>
  Date range configuration

  <Expandable title="properties">
    <ParamField path="dateRange" type="FeedDateRange" required>
      `ONE_HOUR`, `ONE_DAY`, `ONE_WEEK`, `ONE_MONTH`, `ONE_YEAR`
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="feedProps" type="FeedProps" required>
  Feed configuration with resolution

  <Expandable title="properties">
    <ParamField path="dateRange" type="FeedDateRange" required>
      `ONE_HOUR`, `ONE_DAY`, `ONE_WEEK`, `ONE_MONTH`, `ONE_YEAR`
    </ParamField>

    <ParamField path="resolution" type="FeedResolution" required>
      `ONE_MIN`, `FIVE_MIN`, `FIFTEEN_MIN`, `HOURLY`, `FOUR_HOUR`, `DAILY`, `WEEKLY`
    </ParamField>
  </Expandable>
</ParamField>

## Returns

```typescript theme={null}
// getVolumeByExchange response
interface ExchangeRangeDataPoint {
  value: number;
  valueUsd: number;
  exchange: string;
  startDate: string;
  endDate: string;
}

// getExchangeVolumeFeed response
interface ExchangeDataPoint {
  date: string;
  value: number;
  valueUsd: number;
  exchange: string;
}

// getTransferVolumeFeed response
interface DataPointWithUsd {
  date: string;
  value: number;
  valueUsd: number;
}
```

## Examples

<CodeGroup>
  ```typescript Volume by Exchange theme={null}
  import { getVolumeByExchange, FeedDateRange } from '@avnu/avnu-sdk';

  const ETH = '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7';

  const volumeData = await getVolumeByExchange(
    ETH,
    { dateRange: FeedDateRange.ONE_WEEK }
  );

  // Each entry represents an exchange's volume for the period
  volumeData.forEach(item => {
    console.log(`${item.exchange}: $${item.valueUsd.toLocaleString()}`);
    console.log(`  Period: ${item.startDate} to ${item.endDate}`);
  });

  // Calculate total volume
  const totalVolume = volumeData.reduce((sum, item) => sum + item.valueUsd, 0);
  console.log(`Total Volume: $${totalVolume.toLocaleString()}`);
  ```

  ```typescript Historical Volume Feed theme={null}
  import { getExchangeVolumeFeed, FeedDateRange, FeedResolution } from '@avnu/avnu-sdk';

  const ETH = '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7';

  const volumeFeed = await getExchangeVolumeFeed(
    ETH,
    { dateRange: FeedDateRange.ONE_DAY, resolution: FeedResolution.HOURLY }
  );

  console.log(`${volumeFeed.length} data points`);

  // Group by exchange for charting
  const byExchange = volumeFeed.reduce((acc, item) => {
    if (!acc[item.exchange]) acc[item.exchange] = [];
    acc[item.exchange].push({ date: item.date, value: item.valueUsd });
    return acc;
  }, {} as Record<string, { date: string; value: number }[]>);

  Object.entries(byExchange).forEach(([exchange, data]) => {
    console.log(`${exchange}: ${data.length} points`);
  });
  ```

  ```typescript Transfer Volume theme={null}
  import { getTransferVolumeFeed, FeedDateRange, FeedResolution } from '@avnu/avnu-sdk';

  const ETH = '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7';

  const transferVolume = await getTransferVolumeFeed(
    ETH,
    { dateRange: FeedDateRange.ONE_WEEK, resolution: FeedResolution.DAILY }
  );

  transferVolume.forEach(item => {
    console.log(`${item.date}: $${item.valueUsd.toLocaleString()}`);
  });
  ```
</CodeGroup>

## Related

<CardGroup cols={2}>
  <Card title="Get TVL Data" icon="layer-group" href="/docs/markets/get-tvl-data">
    Get liquidity data by exchange
  </Card>

  <Card title="API Reference" icon="code" href="/api/markets/volume-by-exchange">
    REST API endpoint
  </Card>
</CardGroup>
