CCXT (Cryptocurrency eXchange Trading Library) is a JavaScript / TypeScript / Python / C# / PHP / Go library providing a unified API for connecting to and trading with over 100 cryptocurrency exchanges worldwide. It offers quick access to market data (tickers, order books, OHLCV, trade history) and enables algorithmic trading functionalities like placing market/limit orders, managing balances, and handling deposits/withdrawals. The library is actively maintained with frequent updates and new exchange integrations.
pip install ccxtVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate an exchange client and fetch public market data (a ticker) for a specified symbol. It includes basic error handling and illustrates how to configure rate limiting. For private API access (e.g., fetching balance, placing orders), API keys are required and should be loaded securely, ideally from environment variables.
Initialize exchange with `{'rateLimit': <milliseconds>, 'enableRateLimit': True}`. Increase `rateLimit` if encountering `DDoSProtection` or `RateLimitExceeded` errors.Load API keys and secrets from environment variables (e.g., `os.environ.get('API_KEY')`) or a separate, untracked configuration file.For async operations, use `import ccxt.async_support as ccxt` and ensure all API calls are `await`-ed within an `async` function. For sync, use `import ccxt` and regular blocking calls.
Wrap API calls in `try...except` blocks, specifically catching `ccxt.NetworkError`, `ccxt.ExchangeError`, and a general `Exception` for unexpected issues.
Regularly update the library and review the CCXT GitHub releases and changelogs. Test your application thoroughly after updating. Check `exchange.has` properties for exchange-specific capabilities.
Understand whether you need REST (standard CCXT) or WebSocket (CCXT.Pro) functionality. Use `ccxt.pro` for real-time streams and be aware of its specific `watch*` methods and caching mechanisms. The examples folder in the CCXT GitHub repository provides separate examples for `ccxt.pro`.
Double-check your API credentials (key, secret, passphrase) for typos. Ensure the API key has the correct permissions enabled on the exchange (e.g., 'Spot Trading', 'Read Data', 'Withdrawals' if applicable) and is not restricted by IP address if you are running from a different location. Regenerate the API key/secret on the exchange if necessary.
Install the library using pip: `pip install ccxt`. If you are using multiple Python versions or virtual environments, ensure you are installing it into and running your script from the correct environment (e.g., `pip3 install ccxt` or activate your virtual environment before installing).
Check the exchange's official status page or social media for announcements about downtime or maintenance. Ensure your internet connection is stable. If running from a cloud server, verify that your server's IP address is not blocked by the exchange due to geographic restrictions or policy violations. Implement retry logic with exponential backoff for transient network issues.
Enable CCXT's built-in rate limiting feature by setting `exchange.enableRateLimit = True` after initializing the exchange object. If the issue persists, introduce manual delays between API calls using `time.sleep()` or restructure your code to fetch data less often or in larger batches.
No dependency data recorded yet.