# CoinGecko markets - coin prices, caps, volumes, history (API) (`retrainmap/coingecko-markets`) Actor

Read CoinGecko's public API v3 and get one flat row per coin (price, market cap, rank, volume, 24h/7d change, ATH, supply), per day of price history, per trending coin or per category. Optional demo/pro API key. Default: top 250 coins by market cap in USD, one request.

- **URL**: https://apify.com/retrainmap/coingecko-markets.md
- **Developed by:** [RetrainMap Team](https://apify.com/retrainmap) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## CoinGecko markets — coin prices, caps, volumes, history (API)

One flat row per coin from CoinGecko's public REST API v3: price, market cap and rank,
24h volume, 24h/7d/30d change, all-time high, circulating/total/max supply and the
CoinGecko URL. Three more modes: daily price/cap/volume history for chosen coins, the 15
trending coins, and every CoinGecko category with its market cap. Normalised, ready for
CSV or JSON. Optional Demo or Pro API key.

**The default input (markets, USD, top 250 by market cap) is one request, succeeds within
5 minutes and returns rows** — Apify auto-tests it daily.

### Data source and status

| | |
|---|---|
| Publisher | CoinGecko (Gecko Labs Pte. Ltd.) |
| API | https://api.coingecko.com/api/v3 — public tier without a key; Demo key (free) or Pro key (paid, pro-api.coingecko.com) optional. Documentation: https://docs.coingecko.com/reference/introduction |
| What this Actor reads | `GET /coins/markets` (250 coins per request, `price_change_percentage=24h,7d,30d`), `GET /coins/{id}/market_chart?days=N&interval=daily`, `GET /search/trending`, `GET /coins/categories` — plain GETs, at most one per 6.5 s by default |
| Refresh cadence | CoinGecko updates market rows roughly every 1–5 minutes (`last_updated` on each row); history is one point per UTC day (5-minute points when `days` = 1); trending is recomputed continuously. The Actor reads live on every run; `fetched_at` is the fetch time |
| Terms / attribution | CoinGecko's API terms (https://www.coingecko.com/en/api\_terms) require attribution: **"Data provided by CoinGecko"** with a link to https://www.coingecko.com. The keyless public and Demo tiers are for non-commercial use; commercial use needs a paid CoinGecko plan (set `api_key` + `api_tier: pro`). You are responsible for using the data within those terms |
| Known caveats | Rate limit: the keyless tier allows roughly 5–15 requests per minute and answers HTTP 429 when exceeded — the Actor waits 6.5 s between requests by default and backs off 15/30/60 s on 429; a Demo key allows 30/min (set `request_interval_ms` to 2000). History is capped at 365 days on the public tier. Trending `market_cap_text` / `total_volume_text` are the API's display strings (e.g. `$1,234,567`), not numbers. `price_change_percentage_7d` is null when the API has no 7-day series for a coin. An unknown coin id makes the API answer HTTP 404 and the run fails with that message |

Honesty note: market data only, as published by CoinGecko — nothing is inferred; this is
not financial advice; not affiliated with CoinGecko.

Identification: the requests carry a product-token User-Agent and the operator's
contact address in the standard `From:` header (RFC 9110 §10.1.2).

### Input

| Field | Type | Meaning |
|---|---|---|
| `mode` | select | `markets` (default), `coin_history`, `trending`, `categories` |
| `vs_currency` | string | Quote currency code, default `usd` (list: `/simple/supported_vs_currencies`) |
| `coin_ids` | array | CoinGecko ids (`bitcoin`, `ethereum` …). Required for `coin_history`; optional filter for `markets` |
| `days` | integer | `coin_history` only: 1–365, default 30 |
| `order` | select | `markets` only: `market_cap_desc` (default), `market_cap_asc`, `volume_desc`, `volume_asc`, `id_asc`, `id_desc` |
| `max_records` | integer | Default 250; `markets` at most 2,500 (10 requests) |
| `api_key` | secret string | Optional Demo or Pro key (never written anywhere) |
| `api_tier` | select | `demo` (default) or `pro` |
| `request_interval_ms` | integer | Default 6500 (floor 1000) |
| `contact_email` | string | Sent in the `From:` header |

Example — 14 days of daily history for Bitcoin and Ethereum (2 requests, 30 rows):

```json
{ "mode": "coin_history", "vs_currency": "usd", "coin_ids": ["bitcoin", "ethereum"], "days": 14 }
```

### Output (dataset row)

Every row carries `mode`, `vs_currency`, `coingecko_url` and `fetched_at`.

- `markets`: `id`, `symbol`, `name`, `current_price`, `market_cap`, `market_cap_rank`,
  `fully_diluted_valuation`, `total_volume`, `high_24h`, `low_24h`, `price_change_24h`,
  `price_change_percentage_24h`, `price_change_percentage_7d`, `price_change_percentage_30d`,
  `market_cap_change_percentage_24h`, `circulating_supply`, `total_supply`, `max_supply`,
  `ath`, `ath_change_percentage`, `ath_date`, `atl`, `atl_date`, `last_updated`, `image`.
- `coin_history`: `id`, `timestamp` (UTC), `date`, `price`, `market_cap`, `total_volume`.
- `trending`: `rank`, `id`, `name`, `symbol`, `score`, `market_cap_rank`, `price`, `price_btc`,
  `price_change_percentage_24h`, `market_cap_text`, `total_volume_text`, `image`.
- `categories`: `id`, `name`, `market_cap`, `market_cap_change_24h` (%), `volume_24h`,
  `top_3_coins` (ids), `top_3_coin_images`, `updated_at`.

A run summary (mode, filters, requests, retries, whether the pay-per-event budget stopped the
run) is stored as `RUN_SUMMARY` in the run's key-value store.

### Pricing (pay per event)

| Event | Price |
|---|---|
| `run-start` — once per run | $0.10 |
| `record` — per row written | $0.005 |

The default top-250 pull costs $1.35; trending (15 rows) $0.175; 30 days of history for one
coin $0.255. Rows stop when your run's maximum charge is reached; the run summary says so.

### Operator

Steelyard Ventures LLC (RetrainMap) — info@steelyardclinical.com. Not affiliated with
CoinGecko. The Actor writes only to its own dataset and key-value store; your API key is
sent only to CoinGecko and is never logged or stored.

# Actor input Schema

## `mode` (type: `string`):

markets = one row per coin from /coins/markets (price, cap, rank, volume, changes, ATH, supply). coin\_history = one row per day per coin from /coins/{id}/market\_chart (price, cap, volume) - needs coin\_ids. trending = the 15 trending coins from /search/trending. categories = one row per CoinGecko category from /coins/categories.

## `vs_currency` (type: `string`):

CoinGecko currency code prices are quoted in: usd, eur, gbp, jpy, btc, eth ... (full list: https://api.coingecko.com/api/v3/simple/supported\_vs\_currencies).

## `coin_ids` (type: `array`):

CoinGecko coin ids such as bitcoin, ethereum, solana (the id in the coin's coingecko.com URL; full list: /coins/list). Required for coin\_history (one request per coin). Optional filter for markets. Ignored by trending and categories. An unknown id makes the API answer HTTP 404 and the run fails with that message.

## `days` (type: `integer`):

coin\_history only: how many days back (1-365; the public tier serves at most 365). One row per day (daily granularity; days=1 gives 5-minute points).

## `order` (type: `string`):

markets only: the API's order parameter.

## `max_records` (type: `integer`):

Stop after this many rows. markets pages 250 coins per request (at most 2,500 = 10 requests); trending has 15 rows; categories about 760; coin\_history yields days+1 rows per coin.

## `api_key` (type: `string`):

Optional. A Demo key (free, from coingecko.com/en/developers/dashboard) raises the limit to 30 requests/minute and is sent as x-cg-demo-api-key; a paid Pro key is sent as x-cg-pro-api-key to pro-api.coingecko.com when api\_tier = pro. Stored encrypted by Apify; never written to the dataset or logs.

## `api_tier` (type: `string`):

demo (default) uses api.coingecko.com; pro uses pro-api.coingecko.com and needs a paid key.

## `request_interval_ms` (type: `integer`):

Rate limit towards CoinGecko. Default 6500 ms (about 9 requests per minute, safe for the keyless public tier); with a Demo key 2000 ms is safe. Floor 1000 ms. The Actor also backs off 15/30/60 s on HTTP 429.

## `contact_email` (type: `string`):

Sent in the standard From: request header so the data owner can reach the operator (RFC 9110 s10.1.2).

## Actor input object example

```json
{
  "mode": "markets",
  "vs_currency": "usd",
  "days": 30,
  "order": "market_cap_desc",
  "max_records": 250,
  "api_tier": "demo",
  "request_interval_ms": 6500,
  "contact_email": "info@steelyardclinical.com"
}
```

# Actor output Schema

## `results` (type: `string`):

One row per coin (markets), per day per coin (coin\_history), per trending coin or per category, flat and normalised.

## `results_csv` (type: `string`):

The same rows as a CSV file.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "markets",
    "vs_currency": "usd",
    "order": "market_cap_desc",
    "max_records": 250
};

// Run the Actor and wait for it to finish
const run = await client.actor("retrainmap/coingecko-markets").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "markets",
    "vs_currency": "usd",
    "order": "market_cap_desc",
    "max_records": 250,
}

# Run the Actor and wait for it to finish
run = client.actor("retrainmap/coingecko-markets").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "markets",
  "vs_currency": "usd",
  "order": "market_cap_desc",
  "max_records": 250
}' |
apify call retrainmap/coingecko-markets --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,retrainmap/coingecko-markets"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/fM867a5GrL65OQy4x/builds/pnw3MGj3YeSMqfEiK/openapi.json
