CCXT NOTES (that helped me develop ccxt)


git clone && cd ccxt
docker-compose run --rm ccxt
npm install # not needed in docker
npm run build # to confirm a build ok

npm run-tests
node run-tests bitget3 # runs 5 tests: js, phthon, python-async, php, php-async
node run-tests biget3 --js --php # runs a js test and a php test

To test a single exchange in one language use the following:

node js/test/test exchange --verbose
python3 python/ccxt/test/ exchange --verbose
php -f php/test/test_async.php exchange --verbose

CLI.js commands

Update the list of exchanges (required when a new one is added)

npm run export-exchanges

Examples of getting data:

node examples/js/cli.js myexchange markets --verbose --markets
node examples/js/cli.js myexchange markets --verbose --markets --table
node examples/js/cli.js myexchange fetchTicker BTC/USDT --verbose
node examples/js/cli.js myexchange fetchOrderBook BTC/USDT 5 --verbose //depth of 5
node examples/js/cli.js myexchange fetchOHLCV 1h undefined 5 --iso8601
node examples/js/cli.js myexchange privateGetAccountInfo --verbose
node examples/js/cli.js myexchange fetchTotalBalance
node examples/js/cli.js myexchange fetchDepositAddress USDC '{"network":"TRC20"}' --verbose
node examples/js/exchange-capabilities.js --csv

Example of getting implicit data (direct as is comes from exchange) or unified data (unified to ccxt standard):

node examples/js/cli myexchange publicGetMarketSymbols --verbose //Call the exchange data
node examples/js/cli myexchange fetchMarkets --verbose //Call the async function

Examples for running tests:

node js/test/test myexchange

CLI commands JS/python/php

node    examples/js/cli.js   binance fetchTicker  BTC/USDT
python3 examples/py/   binance fetch_ticker BTC/USDT
php     examples/php/cli.php binance fetch_ticker BTC/USDT

Unified functions

At the top of the exchange file in the exchange metadata. I declare which unified functions it has. Some of them can be:

  • fetchMarkets (market/symbols)
  • fetchTime (timestamp)
  • fetchStatus (ping)
  • fetchTicker (market/ticker)
  • fetchOrderBook (market/depth)
  • fetchTrades (market/deals)
  • fetchMarket (Open High Low Close OHLCV-Candles)
  • fecthCurrencies


In keys.local.json you can override any exchange property and add private keys like this:

    "mexc": {
        "apiKey": "foo",
        "secret": "bar",
        "options": {
            "defaultType": "swap"
    "binance": {
        "apiKey": "...",
        "secret": "..."


  • Ctrl + Shift + L –> useful to edit json raw files

  • I can debug and output by temporarily entering in the code something like:

    console.log(data[0]); process.exit(); //To stop there

  • You can active a sandbox mode if the exchange supports it to trade with fake money.

Code notes

In the following example the third parameter {} is the value that will be sent if data is not found in the response object.

const data = this.safeValue(response,'data', {});

In most functions I have the params = {}which are the overrides if I need them. For example:

async createorder (symbol, type, side, amount, price = undefined, params = {})

Implicit methods

Implicit methods