Skip to content

usherlabs/ccxt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (Recommended)

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •