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.
- 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
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.
npm install @usherlabs/ccxt
yarn add @usherlabs/ccxt
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();
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);
}
}
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);
}
}
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 featuresverityProxyUrl
: URL endpoint for the Verity proxy service- Enhanced error handling and performance optimizations when Verity is enabled
- 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
- Account Management: Balances, positions
- Trading: Place, cancel, and query orders
- History: Order history, trade history, ledger
- Deposits/Withdrawals: Fund management
CCXT provides a command-line interface for quick operations:
Check out the examples directory for comprehensive code samples:
- Manual: Comprehensive documentation
- API Reference: Complete API documentation
- FAQ: Frequently asked questions
- Exchange-Specific Notes: Exchange-specific implementation details
We welcome contributions! Please read our Contributing Guide before submitting pull requests.
# 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
- Discord: Join our community chat
- GitHub Issues: Report bugs and request features
- Stack Overflow: Search for answers
- CCXT Pro: Professional version with additional features
- Enterprise Support: Custom solutions and consulting
Support CCXT development by becoming a sponsor:
This library is licensed under the MIT License. See the LICENSE file for details.
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