Unofficial Rust CLI for the Bittime exchange. Use it to inspect markets, manage account data, place spot orders, stream live WebSocket events, and expose the same command surface to agents through MCP.
- Public market data: ping, server time, exchange info, tickers, order book, trades, aggregate trades.
- Private account data: balances, account info, assets, order history, trade history.
- Spot trading: market and limit buy/sell, query order, cancel order, open orders.
- Funding and OTC: crypto deposit/withdraw history, OTC VA code, OTC IDR deposit and withdrawal history.
- Real-time streams: market depth, private order events, private balance events, raw user channels.
- Paper trading: local simulated balances and orders stored in
~/.config/bittime/paper_state.json. - Automation-friendly output: human tables by default, JSON envelopes with
-o json. - Credential resolution: CLI flags, environment variables, or
~/.config/bittime/config.toml. - Agent support: MCP server mode for tool discovery and JSON-RPC execution.
Install from source:
git clone https://github.com/ibidathoillah/bittime-cli.git
cd bittime-cli
cargo install --path .Install from crates.io:
cargo install bittime-cliInstall from npm:
npm install -g bittime-cliRun with Docker:
docker run --rm ibidathoillah/bittime-cli --help
docker run --rm -e BITTIME_API_KEY -e BITTIME_API_SECRET ibidathoillah/bittime-cli balanceRun from the checkout:
cargo build
./target/debug/bittime --helpMarket data does not require credentials:
bittime ping
bittime ticker usdt/idr
bittime orderbook usdt/idr --count 10
bittime -o json book-ticker usdt/idrConfigure private API credentials:
bittime auth set --api-key YOUR_API_KEY --api-secret YOUR_API_SECRET
bittime auth testOr use environment variables:
export BITTIME_API_KEY=your_api_key
export BITTIME_API_SECRET=your_api_secretCredential priority:
--api-keyand--api-secretBITTIME_API_KEYandBITTIME_API_SECRET~/.config/bittime/config.toml
Global options:
bittime [OPTIONS] <COMMAND>
Options:
-o, --output <table|json> Output format [default: table]
--api-key <API_KEY> API key override
--api-secret <API_SECRET> API secret override
-v, --verbose Enable verbose logs
--host <HOST> Override API host
bittime ping
bittime server-time
bittime exchange-info
bittime ticker usdt/idr
bittime ticker-all
bittime price usdt/idr
bittime book-ticker usdt/idr
bittime orderbook usdt/idr --count 10
bittime trades usdt/idr --count 5
bittime agg-trades usdt/idr --count 5
bittime historical-trades usdt/idr --count 5bittime account-info
bittime balance
bittime account-info-v2
bittime assets usdt
bittime trades-history usdt/idr
bittime trades-history-v2 usdt/idr --since 123
bittime trades-legacy usdt/idrbittime order buy usdt/idr -t LIMIT -p 16000 --volume 1
bittime order sell usdt/idr -t MARKET --volume 1
bittime order cancel usdt/idr --order-id 123456
bittime order query usdt/idr --order-id 123456
bittime order open-orders usdt/idr
bittime order all-orders usdt/idr
bittime order pending-orders usdt/idr
bittime order book-orders usdt/idr --count 5Notes:
pending-ordersis a compatibility alias for Bittime's documentedopenOrdersendpoint.book-ordersreturns public order book depth from Bittime's documenteddepthendpoint.
bittime withdraw --asset USDT --volume 100 --address 0x... --network ERC20
bittime withdrawal status --asset usdt
bittime deposit status --asset usdt
bittime deposit va --bank-id 7
bittime deposit otc-status --count 10
bittime withdrawal otc-status --count 10bittime paper init --pair usdt/idr --quote-balance 100000000 --base-balance 1
bittime paper balance
bittime paper buy usdt/idr --price 16000 --volume 1
bittime paper sell usdt/idr --price 17000 --volume 1
bittime paper fill 1
bittime paper orders
bittime paper orders --all
bittime paper cancel 2
bittime paper cancel-all --pair usdt/idr
bittime paper topup IDR 5000000
bittime paper history
bittime paper status
bittime paper resetUse --fill on paper buy or paper sell to immediately settle an order at the supplied price.
Market depth:
bittime ws depth usdt/idr
bittime ws depth usdt/idr --limit 1 --seconds 15Private streams:
bittime ws orders
bittime ws balances
bittime ws user user_order_update
bittime ws user user_balance_updateThe WebSocket client handles Bittime's market gzip frames, market ping/pong, user-stream ping/pong, listen-key creation, and listen-key keepalive.
bittime shellbittime mcpThe MCP server exposes CLI commands as machine-readable tools over JSON-RPC stdio.
The repository includes live API smoke tests:
./scripts/e2e_test.sh --public
./scripts/e2e_test.sh --private
./scripts/e2e_test.sh --wsEnvironment knobs:
BITTIME_TEST_PAIR=usdt/idr
BITTIME_TEST_COIN=usdt
BITTIME_BIN=./target/debug/bittimeLatest local verification:
cargo test: 16 passed
./scripts/e2e_test.sh --public: 22 passed
./scripts/e2e_test.sh --private: 19 passed
./scripts/e2e_test.sh --ws: 4 passed
- REST base:
https://openapi.bittime.com - Market WebSocket:
wss://ws.bittime.com/market/ws - User WebSocket:
wss://wsapi.bittime.com - API docs: https://bittime-docs.github.io/
graph TD
A[bittime binary] --> B[Clap command dispatcher]
B --> C[AppContext]
C --> D[BittimeClient]
C --> E[Output dispatcher JSON/Table]
D --> F[Bittime REST API]
D --> G[Bittime WebSocket streams]
B --> H[Interactive shell REPL]
B --> I[Model Context Protocol server]
- Credentials are stored with
0600permissions when usingbittime auth set. - Prefer read-only API keys for account inspection and WebSocket monitoring.
- Use IP restrictions on exchange API keys when possible.
- Never commit real API keys, secrets, or listen keys.
cargo fmt
cargo test
cargo buildIf you use multiple exchanges, check out these related CLI tools built with the same architecture:
- indodax-cli - CLI for Indodax
- bittime-cli - CLI for Bittime
- binance-cli - CLI for Binance Spot
- tokocrypto-cli - CLI for Tokocrypto
- kraken-cli - CLI for Kraken (Spot, Margin, Futures)
MIT
This project is unofficial and is not affiliated with or endorsed by Bittime. Cryptocurrency trading is risky; review commands carefully before using write-capable API keys.