{"id":51220923,"url":"https://github.com/tetherto/wdk-pricing-coingecko-http","last_synced_at":"2026-06-28T07:03:03.826Z","repository":{"id":365994597,"uuid":"1196070447","full_name":"tetherto/wdk-pricing-coingecko-http","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-19T18:49:58.000Z","size":661,"stargazers_count":1,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T20:22:30.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetherto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-30T10:44:13.000Z","updated_at":"2026-06-19T18:49:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/wdk-pricing-coingecko-http","commit_stats":null,"previous_names":["tetherto/wdk-pricing-coingecko-http"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/wdk-pricing-coingecko-http","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-coingecko-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-coingecko-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-coingecko-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-coingecko-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/wdk-pricing-coingecko-http/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fwdk-pricing-coingecko-http/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34880191,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-28T07:03:03.367Z","updated_at":"2026-06-28T07:03:03.821Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @tetherto/wdk-pricing-coingecko-http\n\nNote: This package is in beta. Please test in a dev setup first.\n\nHTTP client for prices from CoinGecko. It uses the [CoinGecko HTTP API](https://docs.coingecko.com/reference/introduction) to obtain current prices and historical data for a given ticker, and serves as a fallback for the Bitfinex provider when that becomes unavailable.\n\nIt works as a `PricingClient` for [`@tetherto/wdk-pricing-provider`](https://github.com/tetherto/wdk-pricing-provider).\n\n## 🔍 About WDK\n\nThis module is part of the WDK (Wallet Development Kit) project. Learn more at https://docs.wallet.tether.io.\n\n## ✨ Features\n\n- Compatible with [@tetherto/wdk-pricing-provider](https://github.com/tetherto/wdk-pricing-provider)\n- Current price for a single pair, or batched for many pairs in one request\n- Full price data (last price + daily change) batched in one request\n- Historical prices over a time range, with optional even downsampling\n- Configurable symbol → CoinGecko ID map, extensible per instance\n- Demo and Pro API key support (auth header auto-selected from the base URL)\n\n## ⬇️ Installation\n\n```bash\nnpm install @tetherto/wdk-pricing-coingecko-http\n```\n\n## 🚀 Quick Start\n\n```javascript\nimport { CoingeckoPricingClient } from '@tetherto/wdk-pricing-coingecko-http'\n\n// Public host, no key (subject to CoinGecko's free-tier rate limits)\nconst client = new CoingeckoPricingClient()\n\n// Demo API key for higher rate limits\nconst demo = new CoingeckoPricingClient({ apiKey: 'CG-xxx' })\n\n// Pro API key (use the Pro host so the correct auth header is sent)\nconst pro = new CoingeckoPricingClient({\n  baseURL: 'https://pro-api.coingecko.com/api/v3',\n  apiKey: 'CG-xxx'\n})\n\n// Extend / override the symbol → CoinGecko ID map\nconst custom = new CoingeckoPricingClient({\n  coinIds: { PEPE: 'pepe', SHIB: 'shiba-inu' }\n})\n\nconst price = await client.getCurrentPrice('BTC', 'USD')\n```\n\n## 📚 API Reference\n\n### Constructor\n\n```javascript\nnew CoingeckoPricingClient(options?)\n```\n\n| Option    | Type                     | Description                                                                                            |\n| --------- | ------------------------ | ----------------------------------------------------------------------------------------------------- |\n| `baseURL` | `string`                 | CoinGecko API base URL. Use the Pro host with a Pro key. Default: `https://api.coingecko.com/api/v3`.  |\n| `coinIds` | `Object\u003cstring, string\u003e` | Symbol → CoinGecko ID overrides, merged on top of the built-in defaults (`BTC, ETH, USDT, XAUT, USAT`). |\n| `apiKey`  | `string`                 | CoinGecko API key. The Demo or Pro auth header is chosen automatically from `baseURL`.                 |\n\nThe `from` argument of every method is an asset ticker symbol (e.g. `BTC`) resolved to a CoinGecko ID via `coinIds`; `to` is a currency code CoinGecko accepts as `vs_currency` (e.g. `USD`). Both are case-insensitive. An unknown `from` throws; add it via `coinIds`.\n\n### Methods\n\n| Method                               | Description                             | Returns                            |\n| ------------------------------------ | --------------------------------------- | ---------------------------------- |\n| `getCurrentPrice(from, to)`          | Current price for one pair              | `Promise\u003cnumber \\| null\u003e`          |\n| `getMultiCurrentPrices(list)`        | Current prices for many pairs (batched) | `Promise\u003cArray\u003cnumber \\| null\u003e\u003e`   |\n| `getMultiPriceData(list)`            | Last price + daily change (batched)     | `Promise\u003cArray\u003cPriceData \\| null\u003e\u003e`|\n| `getHistoricalPrice(from, to, opts)` | Historical prices over a range          | `Promise\u003cHistoricalPriceResult[]\u003e` |\n\n`list` is an array of `{ from, to }` pairs. For the batched methods, results are returned in the same order as the input; an entry resolves to `null` when CoinGecko has no data for that pair (matching the sibling fallback providers).\n\n#### `getHistoricalPrice(from, to, opts)`\n\n```javascript\nconst series = await client.getHistoricalPrice('BTC', 'USD', {\n  start: Date.now() - 7 * 24 * 60 * 60 * 1000, // required, Unix ms\n  end: Date.now(),                              // required, Unix ms\n  maxEntries: 100                               // optional even downsample\n})\n```\n\n- `start` and `end` (Unix milliseconds) are **required**.\n- Without `maxEntries`, every point CoinGecko returns is included. When set, the result is evenly downsampled to at most `maxEntries` points, always keeping the first and last point.\n- On the free/Demo tier, `start` must be within the trailing 365 days; older ranges require a Pro key. See the [CoinGecko docs](https://www.coingecko.com/learn/download-bitcoin-historical-data).\n\n\u003e Note: CoinGecko exposes the 24h change only as a percentage, so the absolute `dailyChange` in `getMultiPriceData` is derived from the last price and that percentage and is therefore an approximation.\n\n## ⚠️ Rate limits\n\nCoinGecko's free tier rate-limits at ~10–30 req/min, so integration tests may `429` under repeated runs. Provide an `apiKey` to raise the limit.\n\n## 🛠️ Development\n\n```bash\nnpm install\nnpm run lint\nnpm test\nnpm run test:coverage\nnpm run test:integration   # hits the live CoinGecko API\nnpm run build:types        # regenerate types/ after JSDoc changes\n```\n\n## 📜 License\n\nThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 🆘 Support\n\nFor support, please open an issue on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-pricing-coingecko-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fwdk-pricing-coingecko-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fwdk-pricing-coingecko-http/lists"}