{"_id":"@amrulizwan/coingecko-client","name":"@amrulizwan/coingecko-client","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@amrulizwan/coingecko-client","version":"1.0.0","description":"Professional JavaScript SDK for CoinGecko API with comprehensive cryptocurrency data access","main":"src/index.js","scripts":{"test":"jest","test:watch":"jest --watch","test:coverage":"jest --coverage","example:basic":"node examples/basic-usage.js","example:advanced":"node examples/advanced-usage.js"},"keywords":["coingecko","cryptocurrency","api","sdk","bitcoin","ethereum","crypto","client"],"author":{"name":"Amrul Izwan"},"license":"MIT","dependencies":{"axios":"^1.6.0"},"devDependencies":{"jest":"^29.7.0"},"engines":{"node":">=14.0.0"},"repository":{"type":"git","url":"git+https://github.com/amrulizwan/coingecko-client.git"},"bugs":{"url":"https://github.com/amrulizwan/coingecko-client/issues"},"homepage":"https://github.com/amrulizwan/coingecko-client#readme","_id":"@amrulizwan/coingecko-client@1.0.0","gitHead":"08e31eb3ff0e7c8ac778b71e360b59bcfee754ce","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-Sn766lvj7HkYC+Gg2Fk6CWfoy7tNBYP6JOT9mX40Htb7iYpF8s5F9afiikvpaSSKZv0N3SpJhmm70Rf/5S0ZFQ==","shasum":"8b19da61daf6e5207ce455e7632166f5181e79f6","tarball":"https://registry.npmjs.org/@amrulizwan/coingecko-client/-/coingecko-client-1.0.0.tgz","fileCount":8,"unpackedSize":19255,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHeb8BDUyR7zXssrElFJvbnvbMVhJHLztT10RIhRprZkAiBFUrysyfEblHs597PlatAvrmcO2HQ3zwftdyknXKis0A=="}]},"_npmUser":{"name":"amrulizwan","email":"amrulizwan7@gmail.com"},"directories":{},"maintainers":[{"name":"amrulizwan","email":"amrulizwan7@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/coingecko-client_1.0.0_1753027262146_0.4181012868555629"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-20T16:01:01.999Z","1.0.0":"2025-07-20T16:01:02.347Z","modified":"2025-07-20T16:01:02.668Z"},"maintainers":[{"name":"amrulizwan","email":"amrulizwan7@gmail.com"}],"description":"Professional JavaScript SDK for CoinGecko API with comprehensive cryptocurrency data access","homepage":"https://github.com/amrulizwan/coingecko-client#readme","keywords":["coingecko","cryptocurrency","api","sdk","bitcoin","ethereum","crypto","client"],"repository":{"type":"git","url":"git+https://github.com/amrulizwan/coingecko-client.git"},"author":{"name":"Amrul Izwan"},"bugs":{"url":"https://github.com/amrulizwan/coingecko-client/issues"},"license":"MIT","readme":"# CoinGecko Client\r\n\r\nProfessional JavaScript SDK for seamless integration with CoinGecko API. Access comprehensive cryptocurrency market data, prices, charts, and exchange information with built-in error handling and TypeScript-friendly design.\r\n\r\n## Features\r\n\r\n- 🚀 **Easy Integration** - Simple and intuitive API design\r\n- 📊 **Complete Coverage** - Access to all major CoinGecko endpoints\r\n- 🔒 **Error Handling** - Robust error handling with descriptive messages\r\n- ⚡ **Performance** - Optimized HTTP client with configurable timeouts\r\n- 🎯 **Flexible** - Support for both free and pro API keys\r\n- 📦 **Lightweight** - Minimal dependencies\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install coingecko-client\r\n```\r\n\r\n## Quick Start\r\n\r\n```javascript\r\nconst CoinGeckoClient = require('coingecko-client');\r\n\r\nconst client = new CoinGeckoClient();\r\n\r\nasync function getCryptoPrices() {\r\n  try {\r\n    const prices = await client.getSimplePrice('bitcoin,ethereum', 'usd');\r\n    console.log(prices);\r\n  } catch (error) {\r\n    console.error('Error:', error.message);\r\n  }\r\n}\r\n\r\ngetCryptoPrices();\r\n```\r\n\r\n## Configuration\r\n\r\n```javascript\r\nconst client = new CoinGeckoClient({\r\n  timeout: 10000,\r\n  apiKey: 'your-pro-api-key',\r\n});\r\n```\r\n\r\n### Options\r\n\r\n| Option      | Type   | Default | Description                                  |\r\n| ----------- | ------ | ------- | -------------------------------------------- |\r\n| `timeout` | number | 10000   | Request timeout in milliseconds              |\r\n| `apiKey`  | string | null    | CoinGecko Pro API key for higher rate limits |\r\n\r\n## API Methods\r\n\r\n### Basic Price Data\r\n\r\n#### getSimplePrice(ids, vsCurrencies, options)\r\n\r\nGet current prices for cryptocurrencies in specified currencies.\r\n\r\n```javascript\r\nconst prices = await client.getSimplePrice('bitcoin', 'usd');\r\n\r\nconst multiplePrices = await client.getSimplePrice(['bitcoin', 'ethereum'], ['usd', 'eur'], {\r\n  include_market_cap: true,\r\n  include_24hr_change: true,\r\n  include_last_updated_at: true,\r\n});\r\n```\r\n\r\n#### getSupportedVsCurrencies()\r\n\r\nGet list of all supported fiat currencies and cryptocurrencies.\r\n\r\n```javascript\r\nconst currencies = await client.getSupportedVsCurrencies();\r\n```\r\n\r\n### Coin Information\r\n\r\n#### getCoinsList(includePlatform)\r\n\r\nGet list of all supported coins with id, name, and symbol.\r\n\r\n```javascript\r\nconst coins = await client.getCoinsList();\r\nconst coinsWithPlatform = await client.getCoinsList(true);\r\n```\r\n\r\n#### getCoinById(id, options)\r\n\r\nGet detailed information about a specific coin.\r\n\r\n```javascript\r\nconst bitcoin = await client.getCoinById('bitcoin');\r\n\r\nconst bitcoinDetailed = await client.getCoinById('bitcoin', {\r\n  localization: false,\r\n  tickers: true,\r\n  marketData: true,\r\n  communityData: true,\r\n  developerData: true,\r\n  sparkline: true,\r\n});\r\n```\r\n\r\n#### getCoinsMarkets(vsCurrency, options)\r\n\r\nGet market data for multiple coins.\r\n\r\n```javascript\r\nconst marketData = await client.getCoinsMarkets('usd');\r\n\r\nconst customMarketData = await client.getCoinsMarkets('usd', {\r\n  order: 'market_cap_desc',\r\n  perPage: 50,\r\n  page: 1,\r\n  sparkline: false,\r\n  priceChangePercentage: '1h,24h,7d',\r\n});\r\n```\r\n\r\n### Historical Data\r\n\r\n#### getCoinHistory(id, date, localization)\r\n\r\nGet historical data for a coin on a specific date.\r\n\r\n```javascript\r\nconst history = await client.getCoinHistory('bitcoin', '30-12-2023');\r\n```\r\n\r\n#### getCoinMarketChart(id, vsCurrency, days, options)\r\n\r\nGet market chart data (price, market cap, volume).\r\n\r\n```javascript\r\nconst chartData = await client.getCoinMarketChart('bitcoin', 'usd', 7);\r\n\r\nconst hourlyData = await client.getCoinMarketChart('ethereum', 'usd', 1, {\r\n  interval: 'hourly',\r\n});\r\n```\r\n\r\n#### getCoinMarketChartRange(id, vsCurrency, from, to)\r\n\r\nGet market chart data within a specific date range.\r\n\r\n```javascript\r\nconst fromTimestamp = Math.floor(Date.now() / 1000) - 30 * 24 * 60 * 60;\r\nconst toTimestamp = Math.floor(Date.now() / 1000);\r\n\r\nconst rangeData = await client.getCoinMarketChartRange('bitcoin', 'usd', fromTimestamp, toTimestamp);\r\n```\r\n\r\n#### getCoinOHLC(id, vsCurrency, days)\r\n\r\nGet OHLC (Open, High, Low, Close) data.\r\n\r\n```javascript\r\nconst ohlcData = await client.getCoinOHLC('bitcoin', 'usd', 7);\r\n```\r\n\r\n### Exchange Data\r\n\r\n#### getExchangesList()\r\n\r\nGet list of all exchanges.\r\n\r\n```javascript\r\nconst exchanges = await client.getExchangesList();\r\n```\r\n\r\n#### getExchangeById(id)\r\n\r\nGet detailed information about a specific exchange.\r\n\r\n```javascript\r\nconst binance = await client.getExchangeById('binance');\r\n```\r\n\r\n#### getExchangeTickers(id, options)\r\n\r\nGet tickers from a specific exchange.\r\n\r\n```javascript\r\nconst tickers = await client.getExchangeTickers('binance');\r\n\r\nconst filteredTickers = await client.getExchangeTickers('binance', {\r\n  coinIds: 'bitcoin,ethereum',\r\n  includeExchangeLogo: true,\r\n  page: 1,\r\n  depth: true,\r\n  order: 'trust_score_desc',\r\n});\r\n```\r\n\r\n### Global Market Data\r\n\r\n#### getGlobalData()\r\n\r\nGet global cryptocurrency market data.\r\n\r\n```javascript\r\nconst globalData = await client.getGlobalData();\r\nconsole.log('Total Market Cap:', globalData.data.total_market_cap.usd);\r\nconsole.log('Market Cap Change 24h:', globalData.data.market_cap_change_percentage_24h_usd);\r\n```\r\n\r\n#### getGlobalDeFiData()\r\n\r\nGet global DeFi market data.\r\n\r\n```javascript\r\nconst defiData = await client.getGlobalDeFiData();\r\n```\r\n\r\n### Trending & Search\r\n\r\n#### getTrendingCoins()\r\n\r\nGet trending cryptocurrencies.\r\n\r\n```javascript\r\nconst trending = await client.getTrendingCoins();\r\nconsole.log('Trending coins:', trending.coins);\r\nconsole.log('Trending NFTs:', trending.nfts);\r\n```\r\n\r\n#### searchCoins(query)\r\n\r\nSearch for coins, exchanges, and categories.\r\n\r\n```javascript\r\nconst searchResults = await client.searchCoins('bitcoin');\r\n```\r\n\r\n### Utility\r\n\r\n#### ping()\r\n\r\nCheck API server status.\r\n\r\n```javascript\r\nconst status = await client.ping();\r\n```\r\n\r\n## Error Handling\r\n\r\nThe SDK provides comprehensive error handling with descriptive error messages:\r\n\r\n```javascript\r\ntry {\r\n  const data = await client.getCoinById('invalid-coin-id');\r\n} catch (error) {\r\n  if (error.message.includes('CoinGecko API Error: 404')) {\r\n    console.log('Coin not found');\r\n  } else if (error.message.includes('Network Error')) {\r\n    console.log('Connection issue');\r\n  } else {\r\n    console.log('Other error:', error.message);\r\n  }\r\n}\r\n```\r\n\r\n### Error Types\r\n\r\n- **API Errors**: HTTP errors from CoinGecko API (400, 404, 429, 500, etc.)\r\n- **Network Errors**: Connection timeouts or network issues\r\n- **Request Errors**: Invalid parameters or malformed requests\r\n\r\n### Rate Limiting\r\n\r\nCoinGecko API has rate limits:\r\n\r\n- **Free Plan**: 10-30 calls/minute\r\n- **Pro Plan**: Higher limits with API key\r\n\r\n```javascript\r\nconst client = new CoinGeckoClient({\r\n  apiKey: 'your-pro-api-key',\r\n});\r\n```\r\n\r\n## Examples\r\n\r\nRun example scripts:\r\n\r\n```bash\r\nnpm run example:basic\r\nnpm run example:advanced\r\n```\r\n\r\n## Testing\r\n\r\n```bash\r\nnpm test\r\nnpm run test:watch\r\nnpm run test:coverage\r\n```\r\n\r\n## API Reference\r\n\r\nFor complete API documentation, visit: [CoinGecko API Documentation](https://www.coingecko.com/en/api/documentation)\r\n\r\n## Contributing\r\n\r\n1. Fork the repository\r\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\r\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\r\n4. Push to the branch (`git push origin feature/amazing-feature`)\r\n5. Open a Pull Request\r\n\r\n## License\r\n\r\nMIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Support\r\n\r\n- 📖 [Documentation](https://github.com/amrulizwan/coingecko-client)\r\n- 🐛 [Report Issues](https://github.com/amrulizwan/coingecko-client/issues)\r\n- 💬 [Discussions](https://github.com/amrulizwan/coingecko-client/discussions)\r\n\r\n## Disclaimer\r\n\r\nThis library is not officially affiliated with CoinGecko. Use at your own risk and ensure compliance with CoinGecko's Terms of Service.\r\n","readmeFilename":"README.md","_rev":"1-6b5ed4fa18c9c4c84f6e78186c51e754"}