项目作者: adshao

项目描述 :
binance cli
高级语言: Go
项目地址: git://github.com/adshao/binance-cli.git
创建时间: 2019-07-29T12:37:23Z
项目社区:https://github.com/adshao/binance-cli

开源协议:

下载


binance-cli

Binance CLI
币安交易所命令行工具

Manipulate multiple accounts with one command!
支持批量操作多账号!

Installation

  1. go install github.com/adshao/binance-cli

Prepare key file

save api/secret keys into keys.json

  1. [
  2. {
  3. "name": "demo",
  4. "api_key": "xxxx",
  5. "secret_key": "xxx"
  6. },
  7. {
  8. }
  9. ]

Run CLI

use -h to get help.

  1. ./binance-cli -h
  2. NAME:
  3. binance-cli - Binance CLI
  4. USAGE:
  5. binance-cli [global options] command [command options] [arguments...]
  6. VERSION:
  7. 0.0.0
  8. COMMANDS:
  9. list-balance list account balances
  10. list-price list latest price for a symbol or symbols
  11. list-order list open orders
  12. create-order create order
  13. cancel-order cancel open orders
  14. list-symbol list symbols info
  15. help, h Shows a list of commands or help for one command
  16. GLOBAL OPTIONS:
  17. --name value account name
  18. --keyfile value file path of api keys
  19. --debug, -d show debug info
  20. --help, -h show help
  21. --version, -v print the version

Check Latest Price

  1. ./binance-cli list-price --symbol BNBBTC

output

shell { "test1": [ { "symbol": "BNBBTC", "price": "0.00283210" } ] }

List Balances

  1. ./binance-cli list-balance

output

shell [ { "test1": [ { "asset": "BNB", "free": "2027.68758027", "locked": "1000.00000000" }, { "asset": "BTC", "free": "0.00001550", "locked": "0.00000000" } ], "test2": [ { "asset": "BNB", "free": "300.00000000", "locked": "0.00000000" }, { "asset": "BTC", "free": "0.00000000", "locked": "0.00000000" } ], "test3": [ { "asset": "BNB", "free": "603.98788625", "locked": "0.00000000" }, { "asset": "BTC", "free": "0.00881320", "locked": "0.00000000" } ] }, { "BNB": 3931.6754665199996, "BTC": 0.0088287 } ]

Create Order

Currently only support LIMIT order.

Create Sell Order
  1. ./binance-cli create-order --symbol BNBUSDT --side SELL --quantity 10 --price 50
Create Sell Order With Percent Quantity

This will sell 50% of your BNB to buy USDT at price 50 USDT.

  1. ./binance-cli create-order --symbol BNBUSDT --side SELL --quantity 50% --price 50
Create Buy Order
  1. ./binance-cli create-order --symbol BNBUSDT --side BUY --quantity 10 --price 20
Create Buy Order With Percent Quantity

This will sell 100% of your USDT to buy BNB at price 20 USDT.

  1. ./binance-cli create-order --symbol BNBUSDT --side BUY --quantity 100% --price 20

Cancel Order

Cancel all orders with BNBUSDT in all accounts.

  1. ./binance-cli cancel-order --symbol BNBUSDT