GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - binance/binance-cli: Simple CLI to Binance API

BranchesTags
Open more actions menu

Latest commit

 

History

53 Commits
53 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
examples
examples
 
 
src
src
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
README.md
README.md
 
 
build.rs
build.rs
 
 

Repository files navigation

Binance CLI

Latest Release

A simple CLI that interacts with the Binance API

binance-cli demo

Installation

  1. If global npm package @binance/binance-cli exists and binance-cli --version is < 2.0.0, uninstall it:
npm uninstall -g @binance/binance-cli
  1. Install the latest release:
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/binance/binance-cli/releases/latest/download/binance-cli-installer.sh \
  | sh
  1. Verify:
binance-cli --version

Usage

Help

Use --help to consult all the available commands

binance-cli --help

--help is supported for each product and each command.

binance-cli demo

Authentication

Using Environment variable

# Display help command
binance-cli -h

# Set the API key and secret as global variables
export BINANCE_API_KEY=<the_api_key>
export BINANCE_SECRET_KEY=<the_api_secret> # Can be secret key, path to private key or content of private key

# Set the environment (prod by default, valid options: prod, demo and testnet)
export BINANCE_API_ENV=testnet

# It is possible to have a custom base URL
export BINANCE_SPOT_BASE_PATH=https://testnet.binance.vision
export BINANCE_FUTURES_USDS_BASE_PATH=https://testnet.binancefuture.com

Using profile (non-interactive)

Create a new profile
binance-cli profile create --name new-name --api-key <the_api_key> --api-secret <the_api_secret> --env <prod|demo|testnet>
Select a profile
binance-cli profile select --name new-name

View the current active profile

binance-cli profile view

List all the existing profiles

binance-cli profile list

The active profile will be shown with an asterisk.

Delete an existing profile

binance-cli profile delete --name profile-name

Specify profile

It is also possible to specify the profile for a single command.

binance-cli spot get-account --profile my_profile

Using profile (interactive)

Create a new profile
binance-cli profile create -i # binance-cli will prompt the questions to create a new profile

It can also be used to update an existing profile.

Select a profile
binance-cli profile select -i # select the profile to activate
View the current active profile
binance-cli profile view

Commands

Available commands

  • Algo Trading: Rest API
  • Alpha: Rest API - WebSocket Streams
  • C2C: Rest API
  • CMS: WebSocket Streams
  • Convert: Rest API
  • Copy Trading: Rest API
  • Crypto Loan: Rest API
  • Derivatives Trading (COIN-M Futures): Rest API - WebSocket Streams
  • Derivatives Trading (Options): Rest API - WebSocket Streams
  • Derivatives Trading (Portfolio Margin): Rest API - WebSocket Streams
  • Derivatives Trading (Portfolio Margin Pro): Rest API - WebSocket Streams
  • Derivatives Trading (USDS-M Futures): Rest API - WebSocket Streams
  • Dual Investment: Rest API
  • Fiat: Rest API
  • Gift Card: Rest API
  • Margin Trading: Rest API
  • Mining: Rest API
  • Pay: Rest API
  • Rebate: Rest API
  • Simple Earn: Rest API
  • Spot Trading: Rest API - WebSocket Streams
  • Stocks: Rest API - WebSocket Streams
  • Staking: Rest API
  • Sub Account: Rest API
  • VIP Loan: Rest API
  • Web3 Prediction: Rest API - WebSocket Streams
  • Wallet: Rest API

Parameters

CLI Argument
binance-cli spot klines --symbol "BNBUSDT" --interval "1s"
Using pipe
echo '{"symbol": "BNBUSDT", "interval": "1s"}' | binance-cli spot klines

Using interactive mode

binance-cli spot klines -i

Completion

In order to add completion, the following steps can be followed:

For Bash:

Append the output to the .bashrc file:

binance-cli completion bash >> ~/.bashrc
For Zsh:

Append the output to the .zshrc file:

binance-cli completion zsh >> ~/.zshrc

After updating the file, the terminal needs to be restarted or activate the completion with source ~/.bashrc (or .zshrc).

Custom request

Custom request can also be sent using binance-cli, any parameter can be added to the command and will be sent in the request.

binance-cli request GET https://api.binance.com/api/v3/trades --symbol BNBUSDT --limit 5

Signed endpoints are also supported.

binance-cli request GET https://testnet.binance.vision/api/v3/account --signed

LICENSE

MIT

About

Simple CLI to Binance API

Topics

binance-apiclicommand-linefuturesmarket-dataspot

Resources

Readme
Activity
Custom properties

Stars

75 stars

Watchers

5 watching

Forks

24 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.