Giter Club home page Giter Club logo

binance-cli's Introduction

binance-cli

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

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

Installation

go install github.com/adshao/binance-cli

Prepare key file

save api/secret keys into keys.json

[
    {
        "name": "demo",
        "api_key": "xxxx",
        "secret_key": "xxx"
    },
    {
    }
]

Run CLI

use -h to get help.

./binance-cli -h

NAME:
   binance-cli - Binance CLI

USAGE:
   binance-cli [global options] command [command options] [arguments...]

VERSION:
   0.0.0

COMMANDS:
     list-balance  list account balances
     list-price    list latest price for a symbol or symbols
     list-order    list open orders
     create-order  create order
     cancel-order  cancel open orders
     list-symbol   list symbols info
     help, h       Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --name value     account name
   --keyfile value  file path of api keys
   --debug, -d      show debug info
   --help, -h       show help
   --version, -v    print the version

Check Latest Price

./binance-cli list-price --symbol BNBBTC
output
{
    "test1": [
        {
            "symbol": "BNBBTC",
            "price": "0.00283210"
        }
    ]
}

List Balances

./binance-cli list-balance
output
[
    {
        "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
./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.

./binance-cli create-order --symbol BNBUSDT --side SELL --quantity 50% --price 50
Create Buy Order
./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.

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

Cancel Order

Cancel all orders with BNBUSDT in all accounts.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.