Skip to main content
Thirdwatchthirdwatch
Engineering

Analyze CoinGecko Crypto Market Data with Python

Load a CoinGecko Actor dataset into Python and calculate ranked market and volume indicators safely.

Jul 21, 2026 · 1 min read · 232 words
See the scraper →

Once the CoinGecko Markets Scraper finishes, its default dataset is available through the Apify dataset API. Python can load those rows without scraping a rendered market table.

Load and validate rows

Replace the placeholder with a successful dataset ID and preserve nulls during analysis.

import pandas as pd
import requests

url = "https://api.apify.com/v2/datasets/DATASET_ID/items"
rows = requests.get(url, params={"clean": "true"}, timeout=60).json()
df = pd.DataFrame(rows)

assert df["id"].is_unique
assert df["currency"].nunique() == 1
print(df[["market_cap_rank", "name", "current_price"]].head(10))

Check the requested population before computing statistics. A top-20 dataset and top-250 dataset answer different questions. Keep last_updated and the Actor run time so you can detect stale upstream values and identify the snapshot.

Calculate interpretable indicators

Use explicit null handling. For example, calculate volume-to-market-cap only where both values are positive. Do not fill missing supply, valuation, or volume with zero merely to make arithmetic run.

valid = df[(df.market_cap > 0) & df.total_volume.notna()].copy()
valid["volume_to_market_cap"] = valid.total_volume / valid.market_cap
print(valid.nlargest(10, "volume_to_market_cap")[["id", "volume_to_market_cap"]])

For history, append snapshots and deduplicate on ID, currency, and collection time. Symbols can collide and ranks move. When comparing intervals, join on ID and verify both observations came from successful, complete runs.

Analytical rankings are screening tools, not investment recommendations. Document the source, query parameters, coverage cap, currency, and timestamp alongside every chart so another analyst can reproduce the result.

Recheck calculations whenever the source adds fields or changes market coverage.

Frequently asked questions

Can I use pandas?

Yes. JSON rows load directly into a DataFrame while preserving numeric values and nulls.

What is the safest join key?

Use CoinGecko ID plus currency and snapshot time, not symbol or rank.

Related

Try it yourself

100 free credits, no credit card.

About 30 real searches. Add the MCP to Claude or Cursor in two minutes.