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

# How to get token ATH/ATL values on Solana, Base & +50 other chains

> Learn how to retrieve All-Time High and All-Time Low values for any token across 50+ supported blockchains using the Mobula API.

This cookbook demonstrates how to retrieve All-Time High (ATH) and All-Time Low (ATL) values for tokens across multiple blockchains including Solana, Base, Ethereum, and 50+ other chains supported by Mobula.

<Tip>
  **Quick Start**: Get your free API key at [admin.mobula.io](https://admin.mobula.io) to start querying ATH/ATL data immediately.
</Tip>

## Overview

ATH and ATL values are essential metrics for understanding a token's price history:

* **ATH (All-Time High)**: The highest price the token has ever reached
* **ATL (All-Time Low)**: The lowest price the token has ever reached

These values help traders and investors:

* Gauge how far a token is from its historical peak
* Identify potential recovery opportunities from ATL levels
* Set realistic price targets based on historical data

## Basic Usage

### Single Token Query

Fetch ATH/ATL for a single token using a simple GET request:

```bash theme={null}
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=solana&address=So11111111111111111111111111111111111111112" \
  -H "Authorization: YOUR_API_KEY"
```

**Response:**

```json theme={null}
{
  "data": {
    "address": "So11111111111111111111111111111111111111112",
    "chainId": "solana",
    "symbol": "SOL",
    "name": "Solana",
    "priceUSD": 125.45,
    "athUSD": 260.06,
    "atlUSD": 0.50,
    "athDate": "2021-11-06T21:54:00.000Z",
    "atlDate": "2020-05-11T19:35:00.000Z"
  }
}
```

### JavaScript/TypeScript Implementation

```typescript theme={null}
import { Mobula } from "@mobula/sdk";

const mobula = new Mobula({ apiKey: "YOUR_API_KEY" });

async function getTokenAth(blockchain: string, address: string) {
  const response = await fetch(
    `https://api.mobula.io/api/2/token/ath?blockchain=${blockchain}&address=${address}`,
    {
      headers: {
        "Authorization": "YOUR_API_KEY",
      },
    }
  );
  
  const data = await response.json();
  return data.data;
}

// Get SOL ATH/ATL
const solAth = await getTokenAth("solana", "So11111111111111111111111111111111111111112");
console.log(`SOL ATH: $${solAth.athUSD} on ${new Date(solAth.athDate).toLocaleDateString()}`);
console.log(`SOL ATL: $${solAth.atlUSD} on ${new Date(solAth.atlDate).toLocaleDateString()}`);
console.log(`Distance from ATH: ${((1 - solAth.priceUSD / solAth.athUSD) * 100).toFixed(2)}%`);
```

### Python Implementation

```python theme={null}
import requests

def get_token_ath(blockchain: str, address: str, api_key: str) -> dict:
    """Fetch ATH/ATL data for a token."""
    response = requests.get(
        f"https://api.mobula.io/api/2/token/ath",
        params={
            "blockchain": blockchain,
            "address": address,
        },
        headers={
            "Authorization": api_key,
        }
    )
    response.raise_for_status()
    return response.json()["data"]

# Example: Get SOL ATH/ATL
sol_data = get_token_ath(
    blockchain="solana",
    address="So11111111111111111111111111111111111111112",
    api_key="YOUR_API_KEY"
)

print(f"SOL ATH: ${sol_data['athUSD']:.2f}")
print(f"SOL ATL: ${sol_data['atlUSD']:.2f}")
print(f"Current Price: ${sol_data['priceUSD']:.2f}")
```

## Multi-Chain Examples

### Ethereum (ERC-20 Tokens)

```bash theme={null}
# USDT on Ethereum
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=ethereum&address=0xdac17f958d2ee523a2206206994597c13d831ec7"

# USDC on Ethereum
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=ethereum&address=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
```

### Base Chain

```bash theme={null}
# WETH on Base
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=base&address=0x4200000000000000000000000000000000000006"
```

### Solana

```bash theme={null}
# SOL
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=solana&address=So11111111111111111111111111111111111111112"

# BONK
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=solana&address=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"
```

### Arbitrum

```bash theme={null}
# ARB Token
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=arbitrum&address=0x912CE59144191C1204E64559FE8253a0e49E6548"
```

## Batch Queries

Fetch ATH/ATL for multiple tokens in a single request:

```bash theme={null}
curl -X POST "https://api.mobula.io/api/2/token/ath" \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY" \
  -d '[
    {"blockchain": "solana", "address": "So11111111111111111111111111111111111111112"},
    {"blockchain": "ethereum", "address": "0xdac17f958d2ee523a2206206994597c13d831ec7"},
    {"blockchain": "base", "address": "0x4200000000000000000000000000000000000006"},
    {"blockchain": "arbitrum", "address": "0x912CE59144191C1204E64559FE8253a0e49E6548"}
  ]'
```

### TypeScript Batch Example

```typescript theme={null}
async function getMultipleTokensAth(tokens: Array<{blockchain: string, address: string}>) {
  const response = await fetch("https://api.mobula.io/api/2/token/ath", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": "YOUR_API_KEY",
    },
    body: JSON.stringify(tokens),
  });
  
  const data = await response.json();
  return data.payload;
}

// Fetch ATH/ATL for multiple tokens across different chains
const tokens = [
  { blockchain: "solana", address: "So11111111111111111111111111111111111111112" },
  { blockchain: "ethereum", address: "0xdac17f958d2ee523a2206206994597c13d831ec7" },
  { blockchain: "base", address: "0x4200000000000000000000000000000000000006" },
];

const results = await getMultipleTokensAth(tokens);
results.forEach((token) => {
  console.log(`${token.symbol}: ATH $${token.athUSD}, ATL $${token.atlUSD}`);
});
```

## Multi-Currency Support

Get ATH/ATL values in multiple currencies:

```bash theme={null}
curl -X GET "https://api.mobula.io/api/2/token/ath?blockchain=solana&address=So11111111111111111111111111111111111111112&currencies=EUR,GBP,JPY"
```

**Response:**

```json theme={null}
{
  "data": {
    "address": "So11111111111111111111111111111111111111112",
    "chainId": "solana",
    "symbol": "SOL",
    "name": "Solana",
    "priceUSD": 125.45,
    "priceEUR": 115.21,
    "priceGBP": 98.67,
    "priceJPY": 18867.50,
    "athUSD": 260.06,
    "athEUR": 238.86,
    "athGBP": 204.65,
    "athJPY": 39129.00,
    "atlUSD": 0.50,
    "atlEUR": 0.46,
    "atlGBP": 0.39,
    "atlJPY": 75.25,
    "athDate": "2021-11-06T21:54:00.000Z",
    "atlDate": "2020-05-11T19:35:00.000Z"
  }
}
```

## Practical Use Cases

### ATH Distance Calculator

```typescript theme={null}
interface TokenAthData {
  symbol: string;
  priceUSD: number;
  athUSD: number;
  atlUSD: number;
  athDate: string;
  atlDate: string;
}

function calculateAthMetrics(data: TokenAthData) {
  const distanceFromAth = ((data.athUSD - data.priceUSD) / data.athUSD) * 100;
  const distanceFromAtl = ((data.priceUSD - data.atlUSD) / data.atlUSD) * 100;
  const athRecoveryNeeded = ((data.athUSD - data.priceUSD) / data.priceUSD) * 100;
  
  return {
    symbol: data.symbol,
    currentPrice: data.priceUSD,
    ath: data.athUSD,
    atl: data.atlUSD,
    distanceFromAth: `${distanceFromAth.toFixed(2)}%`,
    distanceFromAtl: `${distanceFromAtl.toFixed(2)}%`,
    athRecoveryNeeded: `${athRecoveryNeeded.toFixed(2)}%`,
    daysSinceAth: Math.floor(
      (Date.now() - new Date(data.athDate).getTime()) / (1000 * 60 * 60 * 24)
    ),
    daysSinceAtl: Math.floor(
      (Date.now() - new Date(data.atlDate).getTime()) / (1000 * 60 * 60 * 24)
    ),
  };
}
```

### Portfolio ATH Tracker

```typescript theme={null}
async function trackPortfolioAth(portfolio: Array<{blockchain: string, address: string, amount: number}>) {
  const athData = await getMultipleTokensAth(
    portfolio.map(({ blockchain, address }) => ({ blockchain, address }))
  );
  
  return portfolio.map((holding, index) => {
    const token = athData[index];
    const currentValue = holding.amount * token.priceUSD;
    const athValue = holding.amount * token.athUSD;
    
    return {
      symbol: token.symbol,
      holding: holding.amount,
      currentValue,
      athValue,
      potentialUpside: athValue - currentValue,
      percentFromAth: ((1 - token.priceUSD / token.athUSD) * 100).toFixed(2),
    };
  });
}
```

## Supported Chains

The `/token/ath` endpoint supports 50+ blockchains including:

| Chain     | Identifier      |
| --------- | --------------- |
| Solana    | `solana:solana` |
| Ethereum  | `evm:1`         |
| Base      | `evm:8453`      |
| Arbitrum  | `evm:42161`     |
| Polygon   | `evm:137`       |
| BSC       | `evm:56`        |
| Avalanche | `evm:43114`     |
| Optimism  | `evm:10`        |

<Note>
  For a complete list of supported chains, see our [Blockchains documentation](/blockchains/intro-blockchains).
</Note>

## Error Handling

```typescript theme={null}
async function safeGetTokenAth(blockchain: string, address: string) {
  try {
    const response = await fetch(
      `https://api.mobula.io/api/2/token/ath?blockchain=${blockchain}&address=${address}`,
      {
        headers: { "Authorization": "YOUR_API_KEY" },
      }
    );
    
    if (!response.ok) {
      if (response.status === 404) {
        throw new Error("Token not found");
      }
      throw new Error(`API error: ${response.status}`);
    }
    
    return await response.json();
  } catch (error) {
    console.error(`Failed to fetch ATH for ${address}:`, error);
    return null;
  }
}
```

## Rate Limits

* The endpoint uses 1 credit per request for GET calls
* Batch POST requests use 1 credit per token in the array
* For high-volume applications, consider using batch requests to optimize credit usage

## Related Endpoints

* [`/token/details`](/rest-api-reference/endpoint/token-details) - Full token data including ATH/ATL
* [`/token/price`](/rest-api-reference/endpoint/token-price) - Current token price only
* [`/token/ohlcv-history`](/rest-api-reference/endpoint/token-ohlcv-history) - Historical OHLCV data

***

## Need Help?

<CardGroup cols={4}>
  <Card title="Telegram" icon="telegram" href="https://t.me/mobuladevelopers">
    Fast support
  </Card>

  <Card title="Discord" icon="discord" href="https://discord.gg/JVT7xKm3AD">
    Community
  </Card>

  <Card title="Slack" icon="slack" href="https://join.slack.com/t/mobulaapi/shared_invite/zt-29zrrpjnl-I0tyD73sy7zKy8q~KLL3Ug">
    Enterprise
  </Card>

  <Card title="Email" icon="envelope" href="mailto:contact@mobulalabs.org">
    Contact us
  </Card>
</CardGroup>
