npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

binance-trader-cli

v1.0.3

Published

Binance API CLI — trade spot, futures, margin, algo from command line. Binance REST API for crypto trading, wallets, convert. 150+ commands.

Readme

binance-trader-cli — Binance API Command Line Tool

Binance CLI for the full Financial Trading REST API. Trade spot, futures, margin, wallet, algo from the command line. 150+ commands. No boilerplate.

One command to check prices, place orders, manage funds, trade futures. The Binance API command line tool you can use directly or via npx.

Install

npm install -g binance-trader-cli

Or use with npx (no install):

npx binance-trader-cli spot ticker --symbol BTCUSDT

Configuration

| Variable | Description | |----------|-------------| | BINANCE_API_KEY | Your Binance API key | | BINANCE_SECRET_KEY | Your Binance secret key | | BINANCE_TESTNET | Set to 1 for testnet |

Or use global options: --apiKey, --secretKey, --testnet, --baseUrl, --futuresUrl.


Command Rules

Format

binance <module> <command> [options]
  • Module — One of: spot, futures, margin, algo, wallet, copy-trading, convert, alpha, institutional-loan
  • Command — The API action (e.g. ticker, order, balance, klines)
  • Options — All option names match the Binance API parameter names exactly: --symbol, --side, --type, --quantity, etc.

Global Options

| Option | Description | |--------|-------------| | --apiKey | Override API key | | --secretKey | Override secret key | | --baseUrl | Spot/Margin/Wallet base URL (default: https://api.binance.com) | | --futuresUrl | Futures base URL (default: https://fapi.binance.com) | | --testnet | Use testnet |

Parameter Naming

CLI options use the exact Binance API parameter names in camelCase:

  • API: symbol → CLI: --symbol
  • API: timeInForce → CLI: --timeInForce
  • API: quoteOrderQty → CLI: --quoteOrderQty

Refer to the Binance API docs for full parameter definitions.


Quick Start

# Market data (no API key)
binance spot ping
binance spot ticker --symbol BTCUSDT
binance spot klines --symbol BTCUSDT --interval 1h --limit 24
binance futures funding-rate --symbol BTCUSDT

# Trading (requires credentials)
export BINANCE_API_KEY="your-key"
export BINANCE_SECRET_KEY="your-secret"
binance spot account
binance spot order --symbol BTCUSDT --side BUY --type MARKET --quoteOrderQty 100
binance futures order --symbol BTCUSDT --side BUY --type MARKET --quantity 0.01

Module Reference

spot — Spot Trading & Market Data

| Auth | Commands | API Docs | |------|----------|----------| | No | ticker, ticker-24hr, ticker-trading-day, klines, depth, trades, historical-trades, agg-trades, avg-price, book-ticker, exchange-info, ping, time | Spot Market Data | | Yes | order, test-order, cancel-order, cancel-all-orders, cancel-replace | Spot Trading | | Yes | get-order, open-orders, all-orders, my-trades, my-allocations, my-prevented-matches, rate-limit-order | Spot Order Management | | Yes | account, commission | Spot Account |

Examples:

binance spot ticker --symbol BTCUSDT
binance spot klines --symbol BTCUSDT --interval 1h --limit 24
binance spot order --symbol BTCUSDT --side BUY --type LIMIT --timeInForce GTC --quantity 0.001 --price 60000
binance spot account --omitZeroBalances

Key parameters: symbol, side (BUY/SELL), type (LIMIT/MARKET/STOP_LOSS/STOP_LOSS_LIMIT/TAKE_PROFIT/TAKE_PROFIT_LIMIT/LIMIT_MAKER), timeInForce (GTC/IOC/FOK), quantity, quoteOrderQty, price, stopPrice, interval (1s,1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M)


futures — USDS-M Futures

| Auth | Commands | API Docs | |------|----------|----------| | No | ticker, ticker-24hr, klines, depth, historical-trades, agg-trades, premium-index, funding-rate, funding-info, open-interest, index-info, book-ticker, exchange-info | Futures Market Data | | Yes | order, batch-orders, cancel-order, cancel-all-orders, cancel-batch-orders, countdown-cancel-all | Futures Trading | | Yes | get-order, open-orders, all-orders, user-trades, force-orders | Futures Order Management | | Yes | balance, account, position-risk, income, adl-quantile | Futures Account | | Yes | leverage, margin-type, position-margin, position-margin-history, leverage-bracket, commission-rate | Futures Leverage & Margin | | Yes | position-side-dual, set-position-side, multi-assets-margin, set-multi-assets-margin | Futures Position Mode |

Examples:

binance futures leverage --symbol BTCUSDT --leverage 10
binance futures order --symbol BTCUSDT --side BUY --type MARKET --quantity 0.01
binance futures order --symbol BTCUSDT --side SELL --type STOP_MARKET --stopPrice 58000 --closePosition true
binance futures position-risk --symbol BTCUSDT

Key parameters: symbol, side, type (LIMIT/MARKET/STOP_MARKET/TAKE_PROFIT_MARKET/TRAILING_STOP_MARKET), positionSide (BOTH/LONG/SHORT), leverage, marginType (ISOLATED/CROSSED), closePosition, callbackRate


margin — Margin Trading

| Auth | Commands | API Docs | |------|----------|----------| | Yes | order, cancel-order, cancel-all-orders, get-order, open-orders, all-orders, my-trades | Margin Trading | | Yes | borrow-repay, borrow-repay-records | Margin Borrow | | Yes | account, isolated-account, max-borrowable, max-transferable, interest-history | Margin Account | | Yes | interest-rate-history, force-liquidation | Margin Reference | | No | all-assets, all-pairs, isolated-all-pairs, cross-margin-data, isolated-margin-data, isolated-margin-tier | Margin Reference | | Yes | small-liability, small-liability-exchange, small-liability-history | Margin Small Liability |

Examples:

binance margin borrow-repay --asset USDT --isIsolated FALSE --symbol BTCUSDT --amount 1000 --type BORROW
binance margin order --symbol BTCUSDT --side BUY --type MARKET --quantity 0.001 --isIsolated TRUE --sideEffectType AUTO_BORROW_REPAY
binance margin account

Key parameters: symbol, isIsolated (TRUE/FALSE), sideEffectType (NO_SIDE_EFFECT/MARGIN_BUY/AUTO_REPAY/AUTO_BORROW_REPAY), asset, type (BORROW/REPAY)


algo — Algorithmic Trading (TWAP / VP)

| Auth | Commands | API Docs | |------|----------|----------| | Yes | futures-twap, futures-vp, futures-cancel, futures-open-orders, futures-historical-orders, futures-sub-orders | Algo Futures | | Yes | spot-twap, spot-cancel, spot-open-orders, spot-historical-orders, spot-sub-orders | Algo Spot |

Examples:

binance algo futures-twap --symbol BTCUSDT --side BUY --quantity 1 --duration 300
binance algo futures-vp --symbol BTCUSDT --side BUY --quantity 1 --urgency LOW
binance algo spot-twap --symbol BTCUSDT --side BUY --quantity 0.1 --duration 300

Key parameters: symbol, side, quantity, duration (seconds), urgency (LOW/MEDIUM/HIGH), limitPrice, positionSide, algoId


wallet — Wallet & Asset Management

| Auth | Commands | API Docs | |------|----------|----------| | Yes | balance, user-asset, funding-asset, asset-detail | Wallet Balances | | Yes | deposit-address, deposit-address-list, deposit-history | Wallet Deposits | | Yes | withdraw, withdraw-history, withdraw-quota | Wallet Withdrawals | | Yes | transfer, transfer-history | Wallet Transfers | | Yes | dust-btc, dust, dust-log | Dust Conversion | | Yes | all-coins, trade-fee, account-snapshot, account-info, api-restrictions, system-status, delist-schedule | Wallet Info |

Examples:

binance wallet balance
binance wallet transfer --type MAIN_UMFUTURE --asset USDT --amount 1000
binance wallet withdraw --coin USDT --address ADDR --amount 100 --network TRX

Transfer types: MAIN_UMFUTURE, UMFUTURE_MAIN, MAIN_FUNDING, FUNDING_MAIN, MAIN_MARGIN, MARGIN_MAIN


copy-trading — Copy Trading

| Auth | Commands | API Docs | |------|----------|----------| | Yes | lead-symbol, user-status | Copy Trading |

Examples:

binance copy-trading lead-symbol
binance copy-trading user-status

convert — Flash Swap / Token Conversion

| Auth | Commands | API Docs | |------|----------|----------| | Yes | exchange-info, asset-info | Convert Info | | Yes | get-quote, accept-quote, order-status | Convert Instant | | Yes | limit-order, cancel-limit, open-limit-orders, trade-flow | Convert Limit |

Examples:

binance convert get-quote --fromAsset USDT --toAsset BTC --fromAmount 100
binance convert accept-quote --quoteId QUOTE_ID
binance convert limit-order --baseAsset BTC --quoteAsset USDT --limitPrice 60000 --side BUY --baseAmount 0.001 --expiredType 7_D

Key parameters: fromAsset, toAsset, fromAmount, toAmount, quoteId, expiredType (1_D, 3_D, 7_D, 30_D)


alpha — Alpha Token Trading

| Auth | Commands | API Docs | |------|----------|----------| | No | exchange-info, ticker, klines | Alpha Market | | Yes | order, get-order, all-orders, account | Alpha Trading |

Examples:

binance alpha ticker --symbol TOKENUSDT
binance alpha order --symbol TOKENUSDT --side BUY --type MARKET --quoteOrderQty 100

institutional-loan — Institutional Loans

| Auth | Commands | API Docs | |------|----------|----------| | Yes | margin-data, ongoing-orders, repay, adjust-ltv | Institutional Loan | | Yes | repay-history, ltv-history, borrow-history | Institutional Loan History |

Examples:

binance institutional-loan ongoing-orders
binance institutional-loan repay --orderId 123456 --amount 1000
binance institutional-loan adjust-ltv --orderId 123456 --amount 0.1 --direction ADDITIONAL

Key parameters: orderId, loanCoin, collateralCoin, amount, direction (ADDITIONAL/REDUCED)


Response Format

All responses are JSON. Error responses include code and msg fields. See Binance Error Codes.


FAQ

How do I trade on Binance from the command line?
Install: npm install -g binance-trader-cli. Set BINANCE_API_KEY and BINANCE_SECRET_KEY in .env or environment. Run binance spot order, binance futures order, etc.

Is there a Binance API CLI?
Yes. This package (binance-trader-cli) is a full Binance REST API CLI for spot, futures, margin, wallet, algo, convert, copy trading, and institutional loan.

Does it work without API keys?
Market data endpoints (ticker, klines, depth, funding-rate) work without authentication. Trading and account endpoints require API credentials.

Can I use npx without installing?
Yes: npx binance-trader-cli spot ticker --symbol BTCUSDT

Where is the Binance API documentation?
developers.binance.com. All CLI option names match the official API parameters.


Links

| Resource | URL | |----------|-----| | Binance API (Spot) | https://developers.binance.com/docs/binance-spot-api-docs | | Binance API (Futures) | https://developers.binance.com/docs/derivatives/usds-margined-futures | | Binance API (Margin) | https://developers.binance.com/docs/margin_trading | | Binance API (Wallet) | https://developers.binance.com/docs/wallet | | Binance API (Convert) | https://developers.binance.com/docs/convert | | Binance API (Algo) | https://developers.binance.com/docs/algo | | Binance API (Copy Trading) | https://developers.binance.com/docs/copy_trading | | Binance API (Alpha) | https://developers.binance.com/docs/alpha | | Binance API (Institutional Loan) | https://developers.binance.com/docs/institutional_loan | | Apply for API Key | https://www.binance.com/en/my/settings/api-management | | Testnet | https://testnet.binance.vision/ | | GitHub | https://github.com/open-crab-ai/binance-plugin |

License

Apache-2.0