A command-line interface for the CCXT cryptocurrency trading library.
- Support for most CEXs
- Check your balance
- Place market and limit orders
- Human-readable output for commands
- Confirmation prompts for potentially destructive actions
- Clear warnings about exchange requirements (e.g., address whitelisting)
- Secure storage of API keys for exchanges
- Testnet/sandbox support
git clone https://github.com/coccoinomane/ccxt-cli.gitcd ccxt-clinpm installnpm link- Run the CLI with
ccxt-cli <args>
# Add an exchange
npm run ccxt-cli -- config add binance
npm run ccxt-cli -- config add cryptocom
# To add an exchange testnet/sandbox, use the `-testnet` suffix
npm run ccxt-cli -- config add binance-testnet
npm run ccxt-cli -- config add cryptocom-testnet
# Show all configured exchanges
npm run ccxt-cli -- config listTo see the changes you make to the code take effect, you can either:
- build and run the CLI with
npm run build && ccxt-cli <args>, or - run the shorthand command
npm run ccxt-cli -- <args>.
--debug-calls: Print to the console most of the calls made to the API and their response.--debug-calls-verbose: Print to the console all of the calls made to the API and their response.--debug-http: Print to the console all HTTP requests and responses to the exchange APIs.
# List all exchanges supported by CCXT
npm run ccxt-cli -- exchanges list
# List features supported by an exchange
npm run ccxt-cli -- exchanges features binance
# List functions supported by an exchange
npm run ccxt-cli -- exchanges supported binance
# List functions NOT supported by an exchange
npm run ccxt-cli -- exchanges unsupported binance# Fetch all active markets supported by an exchange
npm run ccxt-cli -- market list binance
# Fetch details and limits about a specific market
npm run ccxt-cli -- market get binance BTC/USDT
# Fetch price and volume info for a specific market
npm run ccxt-cli -- market ticker binance BTC/USDT
# Fetch all active currencies supported by an exchange
npm run ccxt-cli -- market currencies binance# Check your spot balance
npm run ccxt-cli -- account balance binance
# Transfer funds between different accounts, e.g. from spot to future
npm run ccxt-cli -- account transfer binance --currency USDC --amount 100 --from spot --to future
# Withdraw funds (will prompt for confirmation)
npm run ccxt-cli -- account withdraw binance BTC 0.01 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
# Use --force to skip confirmation
npm run ccxt-cli -- account withdraw binance BTC 0.01 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa --forceCreate a limit buy order:
npm run ccxt-cli -- order create binance BTC/USDT --type limit --side buy --amount 0.001 --price 50000Create a market sell order:
npm run ccxt-cli -- order create binance BTC/USDT --type market --side sell --amount 0.001Create a stop order:
npm run ccxt-cli -- order create binance BTC/USDT --type market --side sell --amount 0.001 --params-triggerPrice 52000Create an OCO order to:
- buy BTC at 50000, then
- set a stop loss at 48000 (triggering at 48100) and
- a take profit at 52000 (triggering at 51900):
npm run ccxt-cli -- order create binance BTC/USDT\
--type limit --side buy --amount 0.001 --price 50000\
--params-stopLoss-triggerPrice 48000 --params-stopLoss-price 47900\
--params-takeProfit-triggerPrice 52000 --params-takeProfit-price 51900Same as above, but for testnet/sandbox use the -testnet suffix. For example, for spot Binance testnet, you can do:
npm run ccxt-cli -- config add binance-testnet
npm run ccxt-cli -- order create binance-testnet BTC/USDT --type limit --side buy --amount 0.001 --price 100000For futures testnet, you can do:
npm run ccxt-cli -- config add binanceusdm-testnet
npm run ccxt-cli -- order create binanceusdm-testnet BTC/USDT:USDT --type limit --side buy --amount 0.01 --price 100000Usually the API keys for testnet/sandbox are not the same as the ones for the mainnet/live environment. For example, on Binance, you need to create them here:
- For spot orders > https://testnet.binance.vision/
- For futures orders > https://testnet.binancefuture.com/
Get details about a specific order:
npm run ccxt-cli -- order get binance 1234567890 --symbol BTC/USDTCancel a specific order:
npm run ccxt-cli -- order cancel binance 1234567890 --symbol BTC/USDT
# The market symbol may be omitted on some exchanges
npm run ccxt-cli -- order cancel cryptocom 1234567890Cancel all open orders on a market:
npm run ccxt-cli -- order cancelAll binance --symbol BTC/USDTThe order create command supports passing custom parameters to the underlying exchange API using the --params-* syntax. These parameters are passed directly to the CCXT createOrder function as the params object.
Example of custom parameters object that will be created:
const params = {
stopLoss: {
triggerPrice: 6.0,
price: 5.0,
},
takeProfit: {
triggerPrice: 15.0,
price: 14.0,
},
};You can specify these parameters on the command line using dot notation:
--params-stopLoss-triggerPrice 6.0 --params-stopLoss-price 5.0 --params-takeProfit-triggerPrice 15.0 --params-takeProfit-price 14.0Note that the available parameters depend on the specific exchange API and may vary; for more details, refer to the CCXT documentation on placing orders.
You can also set your API keys as environment variables:
export BINANCE_APIKEY=your_api_key
export BINANCE_SECRET=your_secret_key- API keys are stored encrypted, but for maximum security, consider using environment variables for sensitive operations.
- Always verify deposit addresses before executing withdrawals.
- Some exchanges require address whitelisting on their website before withdrawal.