Skill: strykragent/realtime-crypto-price-api (version 1.0.0)

--- name: realtime-crypto-price-api description: Real-time cryptocurrency price data API for Bitcoin, Ethereum, Solana and 10,000+ tokens. Get live prices, historical data, trending coins, and batch queries for trading bots and dashboards. --- # Real-time Crypto Price API Get real-time cryptocurrency prices for 10,000+ tokens. ## Installation ```bash npm install realtime-crypto-price-api ``` ## Usage ```javascript const { CryptoPrice } = require('realtime-crypto-price-api'); const client = new CryptoPrice(); // Get Bitcoin price const btc = await client.getPrice('BTC'); console.log(`Bitcoin: $${btc.price}`); // Get multiple prices const prices = await client.getPrices(['BTC', 'ETH', 'SOL']); // Top coins by market cap const top10 = await client.getTopCoins(10); // Trending gainers/losers const gainers = await client.getTrending('gainers'); // Historical OHLCV data const history = await client.getHistory('ETH', '1d', 30); // Search tokens const results = await client.search('pepe'); ``` ## CLI ```bash # Single price npx realtime-crypto-price-api BTC # Multiple prices npx realtime-crypto-price-api batch BTC,ETH,SOL # Top coins npx realtime-crypto-price-api top 20 # Trending npx realtime-crypto-price-api trending gainers ``` ## API Methods - `getPrice(symbol)` - Single token price with 24h change - `getPrices(symbols)` - Batch price query - `getTopCoins(limit)` - Top by market cap - `getTrending(direction)` - Gainers or losers - `getHistory(symbol, interval)` - OHLCV candles - `search(query)` - Find tokens ## Data Source Powered by [PRISM API](https://prismapi.ai) - aggregated from 50+ exchanges.

path: README.md
content: # realtime-crypto-price-api

Real-time cryptocurrency price data for Bitcoin, Ethereum, Solana, and 10,000+ tokens. Simple REST API for trading bots, dashboards, price alerts, and DeFi applications.

## Features

- **Real-time prices** - Live price data with sub-second updates
- **10,000+ tokens** - Bitcoin, Ethereum, Solana, memecoins, DeFi tokens
- **Batch queries** - Get multiple prices in one API call
- **Historical data** - OHLCV candles for charting
- **Trending coins** - Top gainers and losers
- **Search** - Find tokens by name or symbol
- **Free tier** - No API key required for basic usage

## Installation

```bash
npm install realtime-crypto-price-api
```

## Quick Start

```javascript
const { CryptoPrice } = require('realtime-crypto-price-api');

const client = new CryptoPrice();

// Get Bitcoin price
const btc = await client.getPrice('BTC');
console.log(`Bitcoin: $${btc.price}`);
// Output: Bitcoin: $69420.00

// Get multiple prices at once
const prices = await client.getPrices(['BTC', 'ETH', 'SOL']);
console.log(prices);

// Get top 10 coins by market cap
const top10 = await client.getTopCoins(10);

// Get trending gainers
const gainers = await client.getTrending('gainers');

// Get historical data for charting
const history = await client.getHistory('ETH', '1d', 30);
```

## CLI Usage

```bash
# Get single price
npx realtime-crypto-price-api BTC
# Output: BTC: $69,420.00
#         24h: +2.34%

# Get multiple prices
npx realtime-crypto-price-api batch BTC,ETH,SOL

# Top coins
npx realtime-crypto-price-api top 20

# Trending
npx realtime-crypto-price-api trending gainers

# Search
npx realtime-crypto-price-api search pepe
```

## API Reference

### `getPrice(symbol, currency?)`
Get real-time price for a single cryptocurrency.

**Returns:**
```javascript
{
  symbol: 'BTC',
  price: 69420.00,
  change24h: 1234.56,
  changePercent24h: 2.34,
  volume24h: 28000000000,
  marketCap: 1360000000000,
  timestamp: 1707912345678
}
```

### `getPrices(symbols, currency?)`
Get prices for multiple cryptocurrencies in one call.

### `getTopCoins(limit?, currency?)`
Get top cryptocurrencies ranked by market cap.

### `getTrending(direction?, limit?)`
Get trending cryptocurrencies. Direction: 'gainers' or 'losers'.

### `getHistory(symbol, interval?, limit?)`
Get historical OHLCV data. Intervals: '1h', '4h', '1d', '1w'.

### `search(query)`
Search for cryptocurrencies by name or symbol.

## Environment Variables

| Variable | Description |
|----------|-------------|
| `PRISM_API_KEY` | API key for higher rate limits |
| `PRISM_API_URL` | Custom API endpoint (optional) |

## Rate Limits

- **Free tier**: 100 requests/minute
- **Pro tier**: 1000 requests/minute
- Get your API key at [prismapi.ai](https://prismapi.ai)

## Data Sources

Aggregated from 50+ exchanges including Binance, Coinbase, Kraken, and major DEXs. Prices are volume-weighted for accuracy.

## License

MIT


path: cli.js
content: #!/usr/bin/env node
/**
 * realtime-crypto-price-api CLI
 * Quick price lookups from the command line
 */

const { CryptoPrice } = require('./src/index.js');

const args = process.argv.slice(2);
const command = args[0];

async function main() {
  const client = new CryptoPrice();

  if (!command || command === 'help' || command === '--help') {
    console.log(`
realtime-crypto-price-api - Real-time cryptocurrency prices

Usage:
  crypto-price <symbol>              Get price for a single token
  crypto-price batch <sym1,sym2,...> Get multiple prices
  crypto-price top [limit]           Get top coins by market cap
  crypto-price trending [gainers|losers]  Get trending coins
  crypto-price search <query>        Search for tokens

Examples:
  crypto-price BTC
  crypto-price batch BTC,ETH,SOL
  crypto-price top 20
  crypto-price trending gainers
  crypto-price search pepe

Environment:
  PRISM_API_KEY - Your API key (optional for basic usage)
`);
    return;
  }

  try {
    if (command === 'batch') {
      const symbols = args[1]?.split(',') || ['BTC', 'ETH'];
      const prices = await client.getPrices(symbols);
      console.log(JSON.stringify(prices, null, 2));
    } 
    else if (command === 'top') {
      const limit = parseInt(args[1]) || 10;
      const top = await client.getTopCoins(limit);
      console.log(JSON.stringify(top, null, 2));
    }
    else if (command === 'trending') {
      const direction = args[1] || 'gainers';
      const trending = await client.getTrending(direction);
      console.log(JSON.stringify(trending, null, 2));
    }
    else if (command === 'search') {
      const query = args[1];
      if (!query) {
        console.error('Usage: crypto-price search <query>');
        process.exit(1);
      }
      const results = await client.search(query);
      console.log(JSON.stringify(results, null, 2));
    }
    else {
      // Single symbol lookup
      const price = await client.getPrice(command);
      console.log(`${price.symbol}: $${price.price.toLocaleString()}`);
      if (price.changePercent24h !== undefined) {
        const sign = price.changePercent24h >= 0 ? '+' : '';
        console.log(`24h: ${sign}${price.changePercent24h.toFixed(2)}%`);
      }
    }
  } catch (err) {
    console.error('Error:', err.message);
    process.exit(1);
  }
}

main();


path: examples/basic.js
content: /**
 * Basic usage examples for realtime-crypto-price-api
 */

const { CryptoPrice } = require('../src/index.js');

async function main() {
  const client = new CryptoPrice();

  console.log('=== Single Price ===');
  const btc = await client.getPrice('BTC');
  console.log(`Bitcoin: $${btc.price.toLocaleString()}`);
  
  console.log('\n=== Multiple Prices ===');
  const prices = await client.getPrices(['BTC', 'ETH', 'SOL', 'DOGE']);
  Object.entries(prices).forEach(([symbol, data]) => {
    console.log(`${symbol}: $${data.price.toLocaleString()}`);
  });

  console.log('\n=== Top 5 Coins ===');
  const top5 = await client.getTopCoins(5);
  top5.forEach((coin, i) => {
    console.log(`${i + 1}. ${coin.symbol}: $${coin.price.toLocaleString()}`);
  });

  console.log('\n=== Top Gainers ===');
  const gainers = await client.getTrending('gainers', 5);
  gainers.forEach(coin => {
    console.log(`${coin.symbol}: +${coin.change24h.toFixed(2)}%`);
  });
}

main().catch(console.error);


path: package.json
content: {
  "name": "realtime-crypto-price-api",
  "version": "1.0.0",
  "description": "Real-time cryptocurrency price data API - Bitcoin, Ethereum, Solana, and 10,000+ altcoins. JSON REST API for trading bots, dashboards, price alerts, and DeFi applications.",
  "main": "src/index.js",
  "bin": {
    "crypto-price": "./cli.js"
  },
  "scripts": {
    "test": "node examples/basic.js"
  },
  "keywords": [
    "cryptocurrency price",
    "bitcoin price api",
    "ethereum price",
    "real-time crypto",
    "market data api",
    "trading bot",
    "price feed",
    "crypto api",
    "altcoin prices",
    "solana price",
    "defi prices",
    "token prices",
    "exchange rates",
    "live prices",
    "price alerts",
    "websocket prices"
  ],
  "author": "OpenFinance <[REDACTED_SECRET]>",
  "license": "MIT",
  "homepage": "https://prismapi.ai",
  "repository": {
    "type": "git",
    "url": "https://github.com/Strykr-Prism/realtime-crypto-price-api.git"
  },
  "engines": {
    "node": ">=18.0.0"
  }
}


path: src/index.js
content: /**
 * realtime-crypto-price-api
 * Real-time cryptocurrency price data for 10,000+ tokens
 * Powered by PRISM API - https://prismapi.ai
 */

const PRISM_BASE = process.env.PRISM_API_URL || 'https://api.prismapi.ai';

class CryptoPrice {
  constructor(apiKey) {
    this.[REDACTED_SECRET] || process.env.PRISM_API_KEY;
    this.baseUrl = PRISM_BASE;
  }

  async _fetch(endpoint, params = {}) {
    const url = new URL(this.baseUrl + endpoint);
    Object.entries(params).forEach(([k, v]) => {
      if (v !== undefined) url.searchParams.set(k, v);
    });

    const headers = {};
    if (this.apiKey) {
      headers['Authorization'] = `Bearer ${this.apiKey}`;
    }

    const res = await fetch(url, { headers });
    
    if (!res.ok) {
      throw new Error(`API error: ${res.status} ${res.statusText}`);
    }
    
    return res.json();
  }

  /**
   * Get current price for a single cryptocurrency
   * @param {string} symbol - Token symbol (BTC, ETH, SOL, etc.)
   * @param {string} currency - Quote currency (default: USD)
   * @returns {Promise<{symbol, price, change24h, volume24h, marketCap, timestamp}>}
   */
  async getPrice(symbol, currency = 'USD') {
    const data = await this._fetch(`/crypto/price/${symbol.toUpperCase()}`, { currency });
    return {
      symbol: symbol.toUpperCase(),
      price: data.price,
      change24h: data.change_24h,
      changePercent24h: data.change_percent_24h,
      volume24h: data.volume_24h,
      marketCap: data.market_cap,
      timestamp: data.timestamp || Date.now()
    };
  }

  /**
   * Get prices for multiple cryptocurrencies in one call
   * @param {string[]} symbols - Array of token symbols
   * @param {string} currency - Quote currency (default: USD)
   * @returns {Promise<Object.<string, {price, change24h, volume24h}>>}
   */
  async getPrices(symbols, currency = 'USD') {
    const symbolList = symbols.map(s => s.toUpperCase()).join(',');
    const data = await this._fetch('/crypto/prices/batch', { symbols: symbolList, currency });
    return data;
  }

  /**
   * Get top cryptocurrencies by market cap
   * @param {number} limit - Number of results (default: 100)
   * @param {string} currency - Quote currency (default: USD)
   * @returns {Promise<Array<{rank, symbol, name, price, marketCap, volume24h, change24h}>>}
   */
  async getTopCoins(limit = 100, currency = 'USD') {
    return this._fetch('/crypto/top', { limit, currency });
  }

  /**
   * Get trending cryptocurrencies (biggest movers)
   * @param {string} direction - 'gainers' or 'losers'
   * @param {number} limit - Number of results (default: 20)
   * @returns {Promise<Array<{symbol, name, price, change24h}>>}
   */
  async getTrending(direction = 'gainers', limit = 20) {
    return this._fetch('/crypto/trending', { direction, limit });
  }

  /**
   * Get historical price data
   * @param {string} symbol - Token symbol
   * @param {string} interval - '1h', '4h', '1d', '1w'
   * @param {number} limit - Number of candles
   * @returns {Promise<Array<{timestamp, open, high, low, close, volume}>>}
   */
  async getHistory(symbol, interval = '1d', limit = 30) {
    return this._fetch(`/crypto/history/${symbol.toUpperCase()}`, { interval, limit });
  }

  /**
   * Search for cryptocurrencies by name or symbol
   * @param {string} query - Search query
   * @returns {Promise<Array<{symbol, name, logo}>>}
   */
  async search(query) {
    return this._fetch('/crypto/search', { q: query });
  }
}

module.exports = { CryptoPrice };


Security scan verdicts — ClawScan: clean | static analysis: suspicious | VirusTotal: clean | SkillSpector: clean (LOW)