Skip to content
Back to skills

Crypto Market Data

ASecurity

Write TypeScript or JavaScript that fetches crypto prices, trending coins, global market stats, DeFi TVL and the Fear and Greed Index with the @nirholas/crypto-market-data library. Use when a project needs cached, rate-limited CoinGecko and DeFiLlama data, including in Edge Runtime.

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 11, 2026
blockchainjavascripttypescriptgojavanodeapi

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned November 11, 2026

npx -y skills add nirholas/crypto-market-data-ts --skill crypto-market-data --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Crypto Market Data?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Crypto Market Data
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nirholas-crypto-market-data/badge)](https://www.skillsdirectory.com/skills/nirholas-crypto-market-data)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: crypto-market-data
description: Write TypeScript or JavaScript that fetches crypto prices, trending coins, global market stats, DeFi TVL and the Fear and Greed Index with the @nirholas/crypto-market-data library. Use when a project needs cached, rate-limited CoinGecko and DeFiLlama data, including in Edge Runtime.
---

# @nirholas/crypto-market-data

A zero-dependency client over the public CoinGecko, DeFiLlama and Fear and Greed APIs with built-in caching and rate limiting. No API key is required. Node 18 or newer (it uses global `fetch`), ESM and CommonJS builds.

```
npm install @nirholas/crypto-market-data
```

## Usage

A default instance `marketData` is exported, along with one function per method (for example `getTopCoins`). Create your own client to change limits:

```ts
import { MarketDataClient, MarketDataError, formatPrice } from '@nirholas/crypto-market-data';

const client = new MarketDataClient({
  rateLimitWindow: 60000,     // ms, default 60000
  maxRequestsPerWindow: 25,   // default 25
  timeout: 10000,             // ms, default 10000
  userAgent: 'my-app/1.0',
});

try {
  const top = await client.getTopCoins(10);
  for (const c of top) console.log(c.symbol, formatPrice(c.current_price), c.price_change_percentage_24h);
} catch (err) {
  if (err instanceof MarketDataError && err.isRateLimited) {
    console.log('rate limited, status', err.statusCode);
  }
}
```

## Methods

- Prices: `getSimplePrices()` (bitcoin, ethereum, solana in USD with 24h change), `getTopCoins(limit = 50)`, `getTrending()`, `getCoinDetails(coinId)`, `searchCoins(query)`, `compareCoins(coinIds[])`, `getCoinsList()`.
- History: `getHistoricalPrices(coinId, days | 'max', interval?)` where interval is `'minutely' | 'hourly' | 'daily'`, `getOHLC(coinId, days)`, `getHistoricalPrice(coinId, date)`.
- Market: `getGlobalMarketData()`, `getMarketOverview()`, `getFearGreedIndex()` (`value`, `value_classification`), `getGlobalDeFiData()`, `getDerivativesTickers()`.
- DeFi: `getTopProtocols(limit = 20)`, `getTopChains(limit = 20)`.
- Exchanges and categories: `getExchanges(perPage, page)`, `getExchangeDetails(id)`, `getCoinTickers(coinId, page)`, `getCategories()`, `getCategoryCoins(categoryId, perPage, page)`.
- Community: `getCoinDeveloperData(coinId)`, `getCoinCommunityData(coinId)`.
- Client control: `clearCache()`, `getCacheStats()`, `getRateLimitStatus()` returning `remaining`, `windowResetAt`, `isBlocked`.
- Formatting helpers: `formatPrice`, `formatNumber`, `formatPercent`, `getFearGreedColor`, `getFearGreedBgColor`.

Coin IDs are CoinGecko IDs (`bitcoin`, `solana`), not ticker symbols; use `searchCoins` to resolve a symbol.

## Notes

- Some methods return `null` on failure (`getFearGreedIndex`, `getGlobalMarketData`, `getCoinDetails`), so null-check them.
- The free CoinGecko tier is limited; keep the default rate limit unless you have measured headroom. Repeated calls inside the cache window are served from cache.
- To verify before writing code, read `src/index.ts` in the repo; every method above is defined there.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in blockchain →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.