# Analytics

The endpoints below provide all the data visually available at [analytics.plenty.network](https://analytics.plenty.network).

### Tokens

## Get latest analytics for all tokens listed on Plentyswap

<mark style="color:blue;">`GET`</mark> `https://api.plenty.network/analytics/tokens`

This endpoint returns an array of objects, where each object contains information about a token, including its symbol, name, contract address, FA standard, decimals, current price data, volume data, fees data, and total value locked (TVL) data.

{% tabs %}
{% tab title="200: OK Successfully returned token analytics data" %}

```typescript
[
  {
    token: string; // Token symbol
    name: string;
    contract: string | null; // Tezos contract address
    standard: string; // FA standard
    tokenId?: number;
    decimals: number;
    price: {
      value: string; // Dollar value
      change24H: string; // Percentage change
      change7D: string; 
      change30D: string;
    };
    volume: {
      value24H: string; // Aggregated Dollar value in the last 24 hours
      change24H: string;
      value7D: string; // Aggregated Dollar value in the last 7 days
    };
    fees: {
      value24H: string;
      change24H: string;
      value7D: string;
    };
    tvl: {
      value: string;
      change24H: string;
    };
  }
]

```

{% endtab %}
{% endtabs %}

## Get historical analytics data for a specific token listed on Plentyswap

<mark style="color:blue;">`GET`</mark> `https://api.plenty.network/analytics/tokens/{tokenSymbol}`

This endpoint returns an object that contains information about a token, including its symbol, name, contract address, FA standard, decimals, current price data, volume data, fees data, and total value locked (TVL) data.

#### Path Parameters

| Name                                          | Type   | Description                                     |
| --------------------------------------------- | ------ | ----------------------------------------------- |
| tokenSymbol<mark style="color:red;">\*</mark> | String | The symbol of the token present in its metadata |

#### Query Parameters

| Name         | Type   | Description                                                                                                                          |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| priceHistory | String | Value could be either `day` to receive day wise price history for a year, or `hour` to receive hourly price history for last 7 days. |

{% tabs %}
{% tab title="200: OK Successfully returned token analytics data" %}

```typescript
{
  token: string; // Token symbol
  name: string; 
  contract: string | null; // Tezos contract
  standard: string; // FA standard
  tokenId?: number;
  decimals: number;
  price: {
    value: string; // Dollar value
    change24H: string; // Percentage change
    change7D: string;
    change30D: string;
    // key represents the hourly/daily UTC timestamp
    history?: { [key: string]: PriceOHLC }[]; 
  volume: {
    value24H: string; // Aggregated value in the last 24 hours
    change24H: string;
    value7D: string;
    history?: { [key: string]: string }[];
  };
  fees: {
    value24H: string;
    change24H: string;
    value7D: string;
    history?: { [key: string]: string }[];
  };
  tvl: {
    value: string;
    change24H: string;
    history?: { [key: string]: string }[];
  };
}
```

{% endtab %}
{% endtabs %}

### Pools

## Get latest analytics for all pools on Plentyswap

<mark style="color:blue;">`GET`</mark> `https://api.plenty.network/analytics/pools`

This endpoint returns an array of objects, where each object contains information about a liquidity pool, including its contract address, symbol, curve type, volume data, fees data, and total value locked (TVL) data.

{% tabs %}
{% tab title="200: OK Successfully returned pool analytics data" %}

```typescript
[
  pool: string; // Tezos contract address
  symbol: string; // Ticker symbol. Eg: USDT/USDC
  type: string; // Volatile, Stable or V3 pool
  volume: {
    value24H: string; // Aggregated value over the past 24 hours
    change24H: string;
    value7D: string;
  };
  fees: {
    value24H: string;
    change24H: string;
    value7D: string;
  };
  tvl: {
    token1Amount: string; // Decimal scaled token amount
    token2Amount: string;
    value: string;
    change24H: string;
  };
]
```

{% endtab %}
{% endtabs %}

## Get historical analytics for a specific pool on Plentyswap

<mark style="color:blue;">`GET`</mark> `https://api.plenty.network/analytics/pools/{poolAddress}`

This endpoint returns an object that contains information about a liquidity pool, including its contract address, symbol, curve type, volume data, fees data, and total value locked (TVL) data.

#### Path Parameters

| Name                                          | Type   | Description                        |
| --------------------------------------------- | ------ | ---------------------------------- |
| poolAddress<mark style="color:red;">\*</mark> | String | Tezos contract address of the pool |

{% tabs %}
{% tab title="200: OK Successfully returned pool analytics data" %}

```typescript
{
  pool: string; // Tezos contract address
  symbol: string; // Ticker symbol. Eg: USDT/USDC
  type: string; // Volatile, Stable or V3 pool
  volume: {
    value24H: string; // Aggregated value of the last 24 hours
    change24H: string;
    value7D: string;
    // key represents the daily UTC timestamp
    history?: { [key: string]: string }[]; 
  };
  fees: {
    value24H: string;
    change24H: string;
    value7D: string;
    history?: { [key: string]: string }[];
  };
  tvl: {
    token1Amount: string;
    token2Amount: string;
    value: string;
    change24H: string;
    history?: { [key: string]: string }[];
  };
}
```

{% endtab %}
{% endtabs %}

### Plenty

## Get historical system wide analytics for Plentyswap

<mark style="color:blue;">`GET`</mark> `https://api.plenty.network/analytics/plenty`

{% tabs %}
{% tab title="200: OK Successfully returned analytics data" %}

```typescript
{
  volume: {
    value24H: string; // Aggregated value over the last 24 hours
    change24H: string;
    // key represents the daily UTC timestamp
    history?: { [key: string]: string }[];
  };
  fees: {
    value24H: string;
    change24H: string;
    history?: { [key: string]: string }[];
  };
  tvl: {
    value: string;
    change24H: string;
    history?: { [key: string]: string }[];
  };
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.plenty.network/endpoints/analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
