ccxt-typescript

star 0

CCXT usage patterns for Arena. Arena uses CCXT only for market data (tickers, OHLCV, trading pairs) — NOT for copy trading APIs (custom connectors handle those).

Adeline117 By Adeline117 schedule Updated 3/6/2026

name: ccxt-typescript description: CCXT usage patterns for Arena. Arena uses CCXT only for market data (tickers, OHLCV, trading pairs) — NOT for copy trading APIs (custom connectors handle those).

CCXT in Arena

How Arena Uses CCXT

Arena uses CCXT only for standardized market data:

  • Ticker data (price, volume, 24h change)
  • OHLCV candlestick data
  • Trading pair lists
  • Price lookups for PnL calculation

NOT for: Copy trading/leaderboard APIs — those use custom connectors in lib/connectors/.

Key file: lib/exchange/ccxt-client.ts — lazy-loads ccxt to avoid 56MB cold start impact.

Supported Exchanges

const SUPPORTED_EXCHANGES = [
  'binance', 'bybit', 'okx', 'bitget', 'mexc',
  'kucoin', 'gateio', 'htx', 'coinex', 'bingx',
  'phemex', 'xt', 'lbank',
]

Common Patterns

Fetch Ticker

import ccxt from 'ccxt'
const exchange = new ccxt.binance()
await exchange.loadMarkets()
const ticker = await exchange.fetchTicker('BTC/USDT')

Fetch OHLCV

const candles = await exchange.fetchOHLCV('BTC/USDT', '1h', undefined, 100)
// Returns: [timestamp, open, high, low, close, volume][]

Error Handling

try {
  const ticker = await exchange.fetchTicker(symbol)
} catch (e) {
  if (e instanceof ccxt.NetworkError) {
    // Retry with backoff
  } else if (e instanceof ccxt.ExchangeError) {
    // Exchange-specific error (invalid symbol, etc.)
  } else if (e instanceof ccxt.RateLimitExceeded) {
    // Back off, reduce concurrency
  }
}

Arena-Specific Notes

  • Lazy-load via await import('ccxt') — never top-level import (56MB)
  • Use exchange.setSandboxMode(false) — always production
  • Some exchanges need defaultType: 'swap' for futures data
  • Proxy: set exchange.proxy = process.env.VPS_PROXY_URL for geo-blocked exchanges
  • Rate limits: CCXT has built-in rate limiting, but Arena adds p-limit for extra control
Install via CLI
npx skills add https://github.com/Adeline117/ranking-arena --skill ccxt-typescript
Repository Details
star Stars 0
call_split Forks 1
navigation Branch main
article Path SKILL.md
More from Creator