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

# Get Contract Market Chart

Retrieves historical price, market cap, and volume for a token by contract address over a specified number of days. Returns [timestamp, value] arrays with auto-adjusted granularity (5m/hourly/daily based on range). Ideal for: building price charts by contract, backtesting strategies, historical performance analysis.

![Get Contract Market Chart logo](https://ai-icon.b3.fun/logo/coingecko)
Catalog action Blockchain Data

Retrieves historical price, market cap, and volume for a token by contract address over a specified number of days. Returns [timestamp, value] arrays with auto-adjusted granularity (5m/hourly/daily based on range). Ideal for: building price charts by contract, backtesting strategies, historical performance analysis.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `coingecko-get-contract-market-chart` |
| Category | Blockchain Data |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `coingecko`, `contract`, `chart`, `historical`, `price`, `market-cap`, `volume`, `read` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `platform` | `string` | Yes | Asset platform ID \(e.g., 'ethereum', 'polygon-pos', 'arbitrum-one', 'base'\). See /asset_platforms endpoint for full list. |
| `contractAddress` | `string` | Yes | Token contract address on the specified platform. |
| `vsCurrency` | `string` | Yes | Target currency for price data \(e.g., 'usd', 'eur', 'btc'\). |
| `days` | `number \| string` | Yes | Number of days of data. Options: 1, 7, 14, 30, 90, 180, 365, or 'max' for all history. Data granularity: 5-min for 1 day, hourly for 2-90 days, daily for 90+ days. |
| `interval` | `string` | No | Data interval: 'hourly' or 'daily'. If not specified, CoinGecko auto-selects granularity from days: 1 day returns 5-minutely, 2-90 days hourly, 90+ days daily. |
| `precision` | `number` | No | Decimal precision for price values \(0-18\). |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `coinId` | `string` | Yes | Token identifier \(contract address\). |
| `vsCurrency` | `string` | Yes | Target currency. |
| `prices` | `array` | Yes | Array of price data points |
| `marketCaps` | `array` | Yes | Array of market cap data points |
| `totalVolumes` | `array` | Yes | Array of volume data points |

## Examples

**Workflow node**

```json
{
  "type": "coingecko-get-contract-market-chart",
  "payload": {
    "platform": "example-platform",
    "contractAddress": "0x0000000000000000000000000000000000000000",
    "vsCurrency": "example-vsCurrency",
    "days": 1
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/coingecko-get-contract-market-chart/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "platform": "example-platform",
    "contractAddress": "0x0000000000000000000000000000000000000000",
    "vsCurrency": "example-vsCurrency",
    "days": 1
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.