Skip to content

CLI

The CLI is a standalone terminal tool that works without any AI client. After installation, use the toobit command directly.

Installation

bash
npm install -g toobit-trade-cli

Command Format

bash
toobit <module> <command> [options]

Supported modules: market, spot, futures, account.

Symbol Format

Endpoint TypeSymbol FormatExample
Spot (ticker, depth, candles, orders, etc.)No separator, uppercaseBTCUSDT, ETHUSDT
Futures (funding rate, mark price, open interest, long-short ratio, contract ticker, insurance fund, risk limits, place order, positions, leverage, etc.)Contract format with hyphensBTC-SWAP-USDT, ETH-SWAP-USDT

Command Examples

Market Data

bash
# Query BTC latest price (spot)
toobit market ticker --symbol BTCUSDT

# 24-hour ticker statistics (spot)
toobit market ticker-24hr --symbol ETHUSDT

# Candlestick data (spot)
toobit market candles --symbol BTCUSDT --interval 1h --limit 10

# Order book depth (spot)
toobit market depth --symbol BTCUSDT --limit 5

# Futures funding rate (requires contract symbol)
toobit market funding-rate --symbol BTC-SWAP-USDT

# Mark price, open interest, long-short ratio (futures)
toobit market mark-price --symbol BTC-SWAP-USDT
toobit market open-interest --symbol BTC-SWAP-USDT
toobit market long-short-ratio --symbol BTC-SWAP-USDT

# Contract ticker (futures)
toobit market contract-ticker --symbol BTC-SWAP-USDT

# Insurance fund, risk limits (futures)
toobit market insurance-fund --symbol BTC-SWAP-USDT
toobit market risk-limits --symbol BTC-SWAP-USDT

Spot Trading

bash
# Market buy BTC
toobit spot place --symbol BTCUSDT --side BUY --type MARKET --quantity 0.001

# Limit buy DOGE
toobit spot place --symbol DOGEUSDT --side BUY --type LIMIT --quantity 100 --price 0.08

# View open orders
toobit spot open-orders

# Cancel an order
toobit spot cancel --orderId 123456789

Futures Trading

bash
# Market open long (requires contract symbol)
toobit futures place --symbol BTC-SWAP-USDT --side BUY_OPEN --orderType MARKET --quantity 1

# View positions
toobit futures positions

# Check leverage settings (requires contract symbol)
toobit futures leverage --symbol BTC-SWAP-USDT

Account Management

bash
# View account info
toobit account info

# View balance flow
toobit account balance-flow

Piping & Scripting

The CLI supports --json output for integration with other tools:

bash
# Extract price data
toobit market ticker --symbol BTCUSDT --json | jq '.data'

# Pipe into a Python analysis script
toobit market candles --symbol BTCUSDT --interval 1h --limit 200 --json | python3 analyze.py

You can also use cron jobs for automation:

bash
# Log BTC price every 5 minutes
*/5 * * * * toobit market ticker --symbol BTCUSDT --json >> /var/log/btc-price.jsonl

Released under the MIT License.