{"id":"981dc970-a520-40b2-b4fc-f1348e6d5877","shortId":"5pXh66","kind":"skill","title":"get-crypto-price","tagline":"Fetch current and historical crypto prices and compute ATH or ATL over common time windows.","description":"# Get Crypto Price (minimal guide)\n\nThis short guide shows how to fetch current prices and at least 3 months of past price action using CoinGecko, Binance, and Coinbase public APIs. It also shows how to compute ATH (highest) and ATL (lowest) within time windows: 1 DAY, 1 WEEK, 1 MONTH.\n\n---\n\n## Quick notes\n- Timestamps: many APIs return milliseconds since epoch (ms) or seconds (s). Convert consistently.\n- Rate limits: respect exchange rate limits; cache responses when possible.\n- Symbols: use canonical pair symbols (e.g., `BTCUSDT` on Binance, `bitcoin` on CoinGecko).\n\n---\n\n## 1) CoinGecko (recommended for simple historical ranges)\n\n- Current price (curl):\n\n```bash\ncurl \"https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd\"\n```\n\n- Last 90 days (price history):\n\n```bash\ncurl \"https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=90\"\n```\n\nResponse contains `prices` array: [[timestamp_ms, price], ...].\n\n**Node.js:** Fetch 90 days and compute ATH/ATL for 1d/7d/30d windows.\n\n```javascript\nasync function fetchCoinGeckoPrices(coinId = 'bitcoin', vs = 'usd', days = 90) {\n  const url = `https://api.coingecko.com/api/v3/coins/${coinId}/market_chart`;\n  const res = await fetch(`${url}?vs_currency=${vs}&days=${days}`);\n  if (!res.ok) throw new Error(`HTTP ${res.status}`);\n  const data = await res.json();\n  return data.prices; // array of [ts_ms, price]\n}\n\nfunction maxMinInWindow(prices, sinceMs) {\n  const window = prices.filter(([ts]) => ts >= sinceMs).map(([, p]) => p);\n  if (window.length === 0) return [null, null];\n  return [Math.max(...window), Math.min(...window)];\n}\n\nconst prices = await fetchCoinGeckoPrices('bitcoin', 'usd', 90);\nconst nowMs = Date.now();\n\nconst windows = {\n  '1d': nowMs - 24 * 3600 * 1000,\n  '1w': nowMs - 7 * 24 * 3600 * 1000,\n  '1m': nowMs - 30 * 24 * 3600 * 1000,\n};\n\nfor (const [name, since] of Object.entries(windows)) {\n  const [ath, atl] = maxMinInWindow(prices, since);\n  console.log(name, 'ATH:', ath, 'ATL:', atl);\n}\n```\n\nNotes: CoinGecko returns sampled points (usually hourly) — good for these windows.\n\n---\n\n## 2) Binance (exchange-level data)\n\n- Current price (curl):\n\n```bash\ncurl \"https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT\"\n```\n\n- Historical klines (candles): use `klines` endpoint. Example: fetch daily candles for the last 1000 days or hourly for finer resolution.\n\n```bash\n# daily candles for BTCUSDT (limit up to 1000 rows)\ncurl \"https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=1d&limit=1000\"\n```\n\nEach kline row: [openTime, open, high, low, close, ...] where openTime is ms.\n\n**Node.js:** Fetch hourly klines for last 90 days and compute ATH/ATL windows.\n\n```javascript\nasync function fetchBinanceKlines(symbol = 'BTCUSDT', interval = '1h', limit = 1000) {\n  const url = 'https://api.binance.com/api/v3/klines';\n  const params = new URLSearchParams({ symbol, interval, limit: String(limit) });\n  const res = await fetch(`${url}?${params}`);\n  if (!res.ok) throw new Error(`HTTP ${res.status}`);\n  return await res.json(); // array of arrays\n}\n\n// To cover ~90 days hourly: 24*90 = 2160 rows -> call twice with different startTimes or use 4h interval\nconst klines = await fetchBinanceKlines('BTCUSDT', '1h', 1000);\n// For more than 1000 rows you'd loop with startTime using ms timestamps.\n\n// Convert to list of [ts_ms, high, low]\nconst data = klines.map(row => [row[0], parseFloat(row[2]), parseFloat(row[3])]);\nconst nowMs = Date.now();\n\nfunction athAtlFromKlines(data, sinceMs) {\n  const filtered = data.filter(([ts]) => ts >= sinceMs);\n  if (filtered.length === 0) return [null, null];\n  const highs = filtered.map(([, h]) => h);\n  const lows = filtered.map(([, , l]) => l);\n  return [Math.max(...highs), Math.min(...lows)];\n}\n\nconst windows = {\n  '1d': nowMs - 24 * 3600 * 1000,\n  '1w': nowMs - 7 * 24 * 3600 * 1000,\n  '1m': nowMs - 30 * 24 * 3600 * 1000,\n};\n\nfor (const [name, since] of Object.entries(windows)) {\n  const [ath, atl] = athAtlFromKlines(data, since);\n  console.log(name, 'ATH:', ath, 'ATL:', atl);\n}\n```\n\nNotes: Binance `limit` is 1000 max per request; for full 90 days hourly, page by startTime.\n\n---\n\n## 3) Coinbase (public example)\n\n- Current spot price (curl):\n\n```bash\ncurl \"https://api.coinbase.com/v2/prices/BTC-USD/spot\"\n```\n\n- Historical candles (Coinbase Exchange API):\n\n```bash\ncurl \"https://api.exchange.coinbase.com/products/BTC-USD/candles?granularity=3600&start=2025-11-01T00:00:00Z&end=2026-02-01T00:00:00Z\"\n```\n\nResponse: array of [time, low, high, open, close, volume]. Use similar filtering by timestamp to compute ATH/ATL.\n\n---\n\n## 4) Compute ATH / ATL for a timeframe (1 DAY, 1 WEEK, 1 MONTH)\n\nGeneral steps (applies to any data source that gives timestamped prices or OHLC candles):\n\n1. Fetch historical points that cover at least the desired window (e.g., last 90 days).\n2. Choose the window start timestamp (now - window_seconds).\n3. Filter the points where timestamp >= window_start.\n4. If you have OHLC candles, use `high` as candidate for ATH and `low` as candidate for ATL. If you only have sampled prices, use max/min of sampled values.\n\n**Example with simple price points (Node.js):**\n\n```javascript\n// points = [[ts_ms, price], ...]\nconst sinceMs = Date.now() - 24 * 3600 * 1000; // 1 day\nconst windowPrices = points.filter(([ts]) => ts >= sinceMs).map(([, p]) => p);\nif (windowPrices.length > 0) {\n  const ath = Math.max(...windowPrices);\n  const atl = Math.min(...windowPrices);\n} else {\n  const ath = null;\n  const atl = null;\n}\n```\n\n**If using OHLC candles:**\n\n```javascript\n// candles = [[ts_ms, open, high, low, close], ...]\nconst window = candles.filter(c => c[0] >= sinceMs);\nconst ath = Math.max(...window.map(c => c[2]));\nconst atl = Math.min(...window.map(c => c[3]));\n```\n\n---\n\n## 5) Practical tips\n- For 3 months of past price action, fetch 90 days of data or page the exchange candle endpoints until you cover ~90 days.\n- Use hourly or daily granularity depending on required resolution. For 1-day ATH/ATL, hourly or minute granularity is better.\n- Convert times into UTC and use ms for consistency.\n- Respect API rate limits and use caching for repeated queries.\n\n---\n\n## 6) Example workflow (summary)\n1. Try CoinGecko `market_chart?days=90` for quick 90-day history.\n2. Compute windows for 1d/7d/30d from that array and derive ATH/ATL.\n3. For exchange-precise data or higher resolution, query Binance `klines` or Coinbase `candles` and repeat the same aggregation.\n\n---\n\nIf you want, I can add ready-to-run scripts for specific coins (BTC, ETH) and automate paginated Binance fetches to guarantee 90 days of hourly data.\n\n\nAgent note: When producing human-friendly reports, agents should use the `skills/generate-report` skill to produce formatted outputs (markdown or PDF). See `skills/generate-report/SKILL.md` for examples and templates.\n\nExample agent prompt:\n> Use the generate-report skill to create a short Bitcoin price report (current price, 24h change, 7d change) in markdown and PDF. Include source URLs.","tags":["get","crypto","price","open","skills","besoeasy","agent-skills","ai-agents","claude-code","clawdbot","clawdbot-skill","llm-tools"],"capabilities":["skill","source-besoeasy","skill-get-crypto-price","topic-agent-skills","topic-ai-agents","topic-claude-code","topic-clawdbot","topic-clawdbot-skill","topic-llm-tools","topic-mcp-server","topic-openai","topic-openclaw","topic-vibe-coding","topic-vibecoding"],"categories":["open-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/besoeasy/open-skills/get-crypto-price","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add besoeasy/open-skills","source_repo":"https://github.com/besoeasy/open-skills","install_from":"skills.sh"}},"qualityScore":"0.505","qualityRationale":"deterministic score 0.51 from registry signals: · indexed on github topic:agent-skills · 111 github stars · SKILL.md body (7,026 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-02T12:55:03.843Z","embedding":null,"createdAt":"2026-04-18T22:10:45.698Z","updatedAt":"2026-05-02T12:55:03.843Z","lastSeenAt":"2026-05-02T12:55:03.843Z","tsv":"'/api/v3/coins/$':163 '/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=90':131 '/api/v3/klines'';':363 '/api/v3/klines?symbol=btcusdt&interval=1d&limit=1000':324 '/api/v3/simple/price?ids=bitcoin&vs_currencies=usd':121 '/api/v3/ticker/price?symbol=btcusdt':290 '/market_chart':165 '/products/btc-usd/candles?granularity=3600&start=2025-11-01t00:00:00z&end=2026-02-01t00:00:00z':560 '/v2/prices/btc-usd/spot':550 '0':209,443,465,696,729 '1':64,66,68,107,585,587,589,605,683,781,813 '1000':234,240,246,304,319,358,416,420,490,496,502,526,682 '1d':230,486 '1d/7d/30d':147,829 '1h':356,415 '1m':241,497 '1w':235,491 '2':277,446,620,737,825 '2160':399 '24':232,238,244,397,488,494,500,680 '24h':929 '3':37,449,538,629,744,749,836 '30':243,499 '3600':233,239,245,489,495,501,681 '4':578,637 '4h':408 '5':745 '6':809 '7':237,493 '7d':931 '90':123,141,158,224,343,394,398,532,618,756,769,819,822,879 'action':42,754 'add':861 'agent':884,892,912 'aggreg':855 'also':51 'api':49,74,555,800 'api.binance.com':289,323,362 'api.binance.com/api/v3/klines'';':361 'api.binance.com/api/v3/klines?symbol=btcusdt&interval=1d&limit=1000':322 'api.binance.com/api/v3/ticker/price?symbol=btcusdt':288 'api.coinbase.com':549 'api.coinbase.com/v2/prices/btc-usd/spot':548 'api.coingecko.com':120,130,162 'api.coingecko.com/api/v3/coins/$':161 'api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=90':129 'api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd':119 'api.exchange.coinbase.com':559 'api.exchange.coinbase.com/products/btc-usd/candles?granularity=3600&start=2025-11-01t00:00:00z&end=2026-02-01t00:00:00z':558 'appli':593 'array':135,189,389,391,562,832 'async':150,350 'ath':13,56,255,262,263,511,518,519,580,648,698,707,732 'ath/atl':145,347,577,783,835 'athatlfromklin':454,513 'atl':15,59,256,264,265,512,520,521,581,654,702,710,739 'autom':873 'await':168,185,220,375,387,412 'bash':117,127,286,311,546,556 'better':789 'binanc':45,103,278,523,846,875 'bitcoin':104,154,222,924 'btc':870 'btcusdt':101,315,354,414 'c':727,728,735,736,742,743 'cach':91,805 'call':401 'candid':646,652 'candl':293,300,313,552,604,642,715,717,764,850 'candles.filter':726 'canon':97 'chang':930,932 'chart':817 'choos':621 'close':332,568,723 'coin':869 'coinbas':47,539,553,849 'coingecko':44,106,108,267,815 'coinid':153,164 'common':17 'comput':12,55,144,346,576,579,826 'consist':84,798 'console.log':260,516 'const':159,166,183,198,218,225,228,248,254,359,364,373,410,438,450,457,469,474,484,504,510,677,685,697,701,706,709,724,731,738 'contain':133 'convert':83,430,790 'cover':393,610,768 'creat':921 'crypto':3,9,21 'curl':116,118,128,285,287,321,545,547,557 'currenc':172 'current':6,32,114,283,542,927 'd':423 'daili':299,312,774 'data':184,282,439,455,514,596,759,841,883 'data.filter':459 'data.prices':188 'date.now':227,452,679 'day':65,124,142,157,174,175,305,344,395,533,586,619,684,757,770,782,818,823,880 'depend':776 'deriv':834 'desir':614 'differ':404 'e.g':100,616 'els':705 'endpoint':296,765 'epoch':78 'error':180,383 'eth':871 'exampl':297,541,666,810,908,911 'exchang':88,280,554,763,839 'exchange-level':279 'exchange-precis':838 'fetch':5,31,140,169,298,338,376,606,755,876 'fetchbinanceklin':352,413 'fetchcoingeckopric':152,221 'filter':458,572,630 'filtered.length':464 'filtered.map':471,476 'finer':309 'format':900 'friend':890 'full':531 'function':151,194,351,453 'general':591 'generat':917 'generate-report':916 'get':2,20 'get-crypto-pric':1 'give':599 'good':273 'granular':775,787 'guarante':878 'guid':24,27 'h':472,473 'high':330,436,470,481,566,644,721 'higher':843 'highest':57 'histor':8,112,291,551,607 'histori':126,824 'hour':272,307,339,396,534,772,784,882 'http':181,384 'human':889 'human-friend':888 'includ':937 'interv':355,369,409 'javascript':149,349,672,716 'kline':292,295,326,340,411,847 'klines.map':440 'l':477,478 'last':122,303,342,617 'least':36,612 'level':281 'limit':86,90,316,357,370,372,524,802 'list':432 'loop':424 'low':331,437,475,483,565,650,722 'lowest':60 'mani':73 'map':204,691 'markdown':902,934 'market':816 'math.max':214,480,699,733 'math.min':216,482,703,740 'max':527 'max/min':662 'maxmininwindow':195,257 'millisecond':76 'minim':23 'minut':786 'month':38,69,590,750 'ms':79,137,192,336,428,435,675,719,796 'name':249,261,505,517 'new':179,366,382 'node.js':139,337,671 'note':71,266,522,885 'nowm':226,231,236,242,451,487,492,498 'null':211,212,467,468,708,711 'object.entries':252,508 'ohlc':603,641,714 'open':329,567,720 'opentim':328,334 'output':901 'p':205,206,692,693 'page':535,761 'pagin':874 'pair':98 'param':365,378 'parsefloat':444,447 'past':40,752 'pdf':904,936 'per':528 'point':270,608,632,670,673 'points.filter':687 'possibl':94 'practic':746 'precis':840 'price':4,10,22,33,41,115,125,134,138,193,196,219,258,284,544,601,660,669,676,753,925,928 'prices.filter':200 'produc':887,899 'prompt':913 'public':48,540 'queri':808,845 'quick':70,821 'rang':113 'rate':85,89,801 'readi':863 'ready-to-run':862 'recommend':109 'repeat':807,852 'report':891,918,926 'request':529 'requir':778 'res':167,374 'res.json':186,388 'res.ok':177,380 'res.status':182,385 'resolut':310,779,844 'respect':87,799 'respons':92,132,561 'return':75,187,210,213,268,386,466,479 'row':320,327,400,421,441,442,445,448 'run':865 'sampl':269,659,664 'script':866 'second':81,628 'see':905 'short':26,923 'show':28,52 'similar':571 'simpl':111,668 'sinc':77,250,259,506,515 'sincem':197,203,456,462,678,690,730 'skill':897,919 'skill-get-crypto-price' 'skills/generate-report':896 'skills/generate-report/skill.md':906 'sourc':597,938 'source-besoeasy' 'specif':868 'spot':543 'start':624,636 'starttim':405,426,537 'step':592 'string':371 'summari':812 'symbol':95,99,353,368 'templat':910 'throw':178,381 'time':18,62,564,791 'timefram':584 'timestamp':72,136,429,574,600,625,634 'tip':747 'topic-agent-skills' 'topic-ai-agents' 'topic-claude-code' 'topic-clawdbot' 'topic-clawdbot-skill' 'topic-llm-tools' 'topic-mcp-server' 'topic-openai' 'topic-openclaw' 'topic-vibe-coding' 'topic-vibecoding' 'tri':814 'ts':191,201,202,434,460,461,674,688,689,718 'twice':402 'url':160,170,360,377,939 'urlsearchparam':367 'usd':156,223 'use':43,96,294,407,427,570,643,661,713,771,795,804,894,914 'usual':271 'utc':793 'valu':665 'volum':569 'vs':155,171,173 'want':858 'week':67,588 'window':19,63,148,199,215,217,229,253,276,348,485,509,615,623,627,635,725,827 'window.length':208 'window.map':734,741 'windowpric':686,700,704 'windowprices.length':695 'within':61 'workflow':811","prices":[{"id":"d1b42f32-4941-43e7-ac5c-39fa2a5952de","listingId":"981dc970-a520-40b2-b4fc-f1348e6d5877","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"besoeasy","category":"open-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T22:10:45.698Z"}],"sources":[{"listingId":"981dc970-a520-40b2-b4fc-f1348e6d5877","source":"github","sourceId":"besoeasy/open-skills/get-crypto-price","sourceUrl":"https://github.com/besoeasy/open-skills/tree/main/skills/get-crypto-price","isPrimary":false,"firstSeenAt":"2026-04-18T22:10:45.698Z","lastSeenAt":"2026-05-02T12:55:03.843Z"}],"details":{"listingId":"981dc970-a520-40b2-b4fc-f1348e6d5877","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"besoeasy","slug":"get-crypto-price","github":{"repo":"besoeasy/open-skills","stars":111,"topics":["agent-skills","ai","ai-agents","claude-code","clawdbot","clawdbot-skill","llm-tools","mcp-server","openai","openclaw","vibe-coding","vibecoding"],"license":null,"html_url":"https://github.com/besoeasy/open-skills","pushed_at":"2026-03-31T13:05:30Z","description":"Battle-tested skill library for AI agents. Save 98% of API costs with ready-to-use code for crypto, PDFs, search, web scraping & more. No trial-and-error, no expensive APIs.","skill_md_sha":"637ef73cca63f20439850ec3ee4fe6d045f02bcb","skill_md_path":"skills/get-crypto-price/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/besoeasy/open-skills/tree/main/skills/get-crypto-price"},"layout":"multi","source":"github","category":"open-skills","frontmatter":{"name":"get-crypto-price","description":"Fetch current and historical crypto prices and compute ATH or ATL over common time windows."},"skills_sh_url":"https://skills.sh/besoeasy/open-skills/get-crypto-price"},"updatedAt":"2026-05-02T12:55:03.843Z"}}