$ show ccxt/ccxt
CCXT is a cryptocurrency exchange trading library that provides a unified API for over 100 exchanges across 7 programming languages (TypeScript/JavaScript, Python, PHP, C#, Go, Java). The core is written in TypeScript from which all other language bindings are transpiled. It implements both REST and WebSocket APIs for market data, trading, and account management. The library normalizes exchange-specific data formats into a common schema, enabling cross-exchange arbitrage and analytics. Key architectural patterns include a base Exchange class with exchange-specific subclasses, a pro/ subdirectory for WebSocket-enabled exchanges, static_dependencies/ for vendored third-party code (ethers, starknet, bip39, etc.), and an extensive test suite with both static and live tests. The repository includes a playground (Next.js web IDE), CLI tool, documentation site (Fumadocs), CI/CD for all languages, and Docker development environment.
The LLM identified 8 files worth highlighting for reuse:
The core Exchange class that all exchange implementations extend. Provides the unified API layer (fetchTicker, fetchOrderBook, createOrder, etc.) that normalizes differences between exchanges. Handles rate limiting, authentication, market loading, and error handling. This is the central abstraction that makes the library work — every exchange subclass overrides exchange-specific methods while inheriting the unified interface. The pattern demonstrates a well-designed Template Method with hooks for exchange-specific behavior.
Python implementation of the Exchange base class, transpiled from TypeScript. Provides both sync and async support through aiohttp. Includes decimal precision handling, extensive error type hierarchy, and the safe/ticker pattern for data normalization. The Python version is particularly well-crafted with careful attention to Pythonic idioms while maintaining parity with the TypeScript source.
Go implementation using interface-based design with exchange-specific wrapper structs. Demonstrates idiomatic Go patterns: error handling with typed errors, goroutine-safe rate limiting, and the WithX option pattern for optional parameters (since Go lacks default arguments). The Go binding shows how the unified API adapts to a statically-typed, non-OOP language while preserving the core abstraction.
Vendored Starknet serialization library for interacting with Starknet-based dYdX. Implements Cairo ABI encoding/decoding, calldata compilation, Poseidon hashing, and typed data serialization. This is a self-contained, modified copy of starknet.py that handles the complex encoding requirements of a ZK-rollup exchange. Reusable for any Starknet project, though tightly coupled to the specific API surface dYdX requires.
Vendored Ethereum utility library (HexBytes, ABI encoding/decoding, address utilities) used for EVM-chain exchanges like Hyperliquid. Provides a clean HexBytes class that wraps Python bytes with hex representation and slicing. The ABI module handles Ethereum ABI encoding/decoding. Self-contained and could be extracted for other Ethereum-related projects, though it's a specific version vendored for compatibility.
Sandbox execution engine for the CCXT Playground web IDE. Handles running user-submitted code in 6 languages (JS, TS, Python, PHP, Go, C#) with timeout enforcement, output capture, environment scrubbing, and process isolation. Demonstrates a practical multi-language execution framework with security considerations (env var scrubbing, timeout via SIGKILL, output size limits). The pattern of a language-agnostic runner dispatcher with per-language implementations is reusable for any multi-language code execution platform.
Generates a Squid proxy allowlist from CCXT's exchange URL definitions. Instantiates every exchange, extracts hostnames from exchange.urls.api and exchange.urls.test, and produces a deny-by-default proxy config permitting only exchange API hosts. This is a clever security pattern: the allowlist is derived from the same source of truth as the exchange definitions, ensuring it stays current. Reusable for any project that needs to restrict network access to a known set of API endpoints.
The core transpiler that converts TypeScript source to Python, PHP, C#, Go, and Java. This is the architectural keystone — a single source of truth in TypeScript generates all language bindings. The transpiler handles language-specific idioms (Python's snake_case, Go's error handling, C#'s PascalCase), demonstrating a sophisticated understanding of each target language's conventions. The build system orchestrates transpilation, compilation, testing, and packaging across all languages.