JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 86
  • Score
    100M100P100Q85020F
  • License MIT

A JavaScript cryptocurrency trading library with support for 100+ exchanges + optional Verity zkTLS proof of data source.

Package Exports

  • @usherlabs/ccxt

Readme

CCXT – CryptoCurrency eXchange Trading Library

NPM Downloads npm Discord Supported Exchanges Follow CCXT at x.com

A JavaScript / TypeScript library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs.

Install · Usage · Manual · FAQ · Examples · Contributing · Disclaimer · Social

The CCXT library is used to connect and trade with cryptocurrency exchanges and payment processing services worldwide. It provides quick access to market data for storage, analysis, visualization, indicator development, algorithmic trading, strategy backtesting, bot programming, and related software engineering.

It is intended to be used by coders, developers, technically-skilled traders, data-scientists and financial analysts for building trading algorithms.

Key Features

  • 100+ Supported Exchanges - Comprehensive coverage of major cryptocurrency exchanges
  • Unified API - Consistent interface across all supported exchanges
  • Full TypeScript Support - Complete type definitions and IntelliSense support
  • Public & Private APIs - Market data, trading, account management, and more
  • WebSocket Support - Real-time data streaming capabilities
  • Rate Limiting - Built-in request throttling and rate limit handling
  • Error Handling - Robust error management and recovery mechanisms
  • Cross-Platform - Works in Node.js and modern web browsers
  • MIT License - Free for commercial and open-source use

Supported Exchanges

CCXT currently supports 105+ cryptocurrency exchanges including:

Exchange Type Status Pro
Binance CEX ✅ Certified
Coinbase CEX
Kraken CEX
OKX CEX ✅ Certified
Bybit CEX ✅ Certified
KuCoin CEX ✅ Certified
Gate.io CEX ✅ Certified
HTX CEX ✅ Certified
MEXC CEX ✅ Certified
Bitget CEX ✅ Certified

For a complete list of all supported exchanges, see the Exchange Markets page.

Install

npm install @usherlabs/ccxt

Yarn

yarn add @usherlabs/ccxt

Quick Start

Basic Usage

const ccxt = require('@usherlabs/ccxt');

// Create exchange instance
const exchange = new ccxt.binance({
    apiKey: 'YOUR_API_KEY',
    secret: 'YOUR_SECRET',
    sandbox: true, // Use testnet
    enableRateLimit: true
});

// Fetch market data
async function getMarketData() {
    try {
        // Load markets
        await exchange.loadMarkets();
        
        // Get ticker
        const ticker = await exchange.fetchTicker('BTC/USDT');
        console.log('BTC/USDT Price:', ticker.last);
        
        // Get order book
        const orderbook = await exchange.fetchOrderBook('BTC/USDT');
        console.log('Best bid:', orderbook.bids[0]);
        console.log('Best ask:', orderbook.asks[0]);
        
    } catch (error) {
        console.error('Error:', error.message);
    }
}

getMarketData();

TypeScript Example

import { binance } from '@usherlabs/ccxt';

const exchange = new binance({
    apiKey: process.env.BINANCE_API_KEY,
    secret: process.env.BINANCE_SECRET,
    enableRateLimit: true
});

async function fetchBalance() {
    try {
        const balance = await exchange.fetchBalance();
        console.log('USDT Balance:', balance.USDT?.free || 0);
    } catch (error) {
        console.error('Error fetching balance:', error);
    }
}

Trading Example

const ccxt = require('@usherlabs/ccxt');

const exchange = new ccxt.binance({
    apiKey: 'YOUR_API_KEY',
    secret: 'YOUR_SECRET',
    enableRateLimit: true
});

async function placeOrder() {
    try {
        // Place a limit buy order
        const order = await exchange.createLimitBuyOrder(
            'BTC/USDT',  // symbol
            0.001,       // amount
            50000        // price
        );
        
        console.log('Order placed:', order.id);
        
        // Check order status
        const orderStatus = await exchange.fetchOrder(order.id, 'BTC/USDT');
        console.log('Order status:', orderStatus.status);
        
    } catch (error) {
        console.error('Trading error:', error.message);
    }
}

Using Verity Features

This fork includes enhanced capabilities powered by Verity. To enable Verity features, you can configure the exchange instance with additional parameters:

const exchange = new ccxt.binance({
    apiKey: 'YOUR_API_KEY',
    secret: 'YOUR_SECRET',
    enableRateLimit: true,
    defaultType: 'spot',
    useVerity: true,                    // Enable Verity features
    verityProxyUrl: 'YOUR_PROXY_URL',   // Verity proxy URL
    timeout: 150 * 1000,
    options: {
        adjustForTimeDifference: true,
        recvWindow: 60000
    }
});

Verity Configuration Options:

  • useVerity: Boolean flag to enable/disable Verity features
  • verityProxyUrl: URL endpoint for the Verity proxy service
  • Enhanced error handling and performance optimizations when Verity is enabled

API Overview

Public APIs (No Authentication Required)

  • Market Data: Tickers, order books, trades
  • Trading Pairs: Available symbols and markets
  • OHLCV Data: Historical price data for charts
  • Exchange Info: Trading rules, fees, limits

Private APIs (Authentication Required)

  • Account Management: Balances, positions
  • Trading: Place, cancel, and query orders
  • History: Order history, trade history, ledger
  • Deposits/Withdrawals: Fund management

CLI Tool

CCXT provides a command-line interface for quick operations:

Examples

Check out the examples directory for comprehensive code samples:

Documentation

Contributing

We welcome contributions! Please read our Contributing Guide before submitting pull requests.

Development Setup

# Clone the repository
git clone https://github.com/usherlabs/ccxt.git
cd @usherlabs/ccxt

# Install dependencies
npm install

# Run tests
npm test

# Build the library
npm run build

Support

Community Support

Professional Support

Sponsors

Support CCXT development by becoming a sponsor:

Sponsors

Social

  • Twitter Follow us on Twitter
  • Discord Join our Discord
  • Telegram Telegram Channel

License

This library is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

CCXT is a free open source non-custodian API broker software under MIT license.

  • Non-custodian: CCXT does not hold your funds or act as an intermediary
  • MIT License: Free to use for any purpose, but use at your own risk
  • No Warranties: Provided "as is" without any warranties
  • API Broker: Funded through exchange API broker programs

Star History

Star History Chart