Skip to content

anbuhckr/bincli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bincli

GitHub issues GitHub forks GitHub stars GitHub license PyPI - Python Version

Binance Futures Client

Table of Contents

Installation

To install bincli, simply:

$ python3 -m pip install -U git+https://github.com/anbuhckr/bincli.git

or from source:

$ python3 setup.py install

CLI

Set api key & secret:

$ python3 -m bincli api "your_api_key" "your_api_sec"

Usage:

# python3 -m bincli run symbol leverage margin side
$ python3 -m bincli run BTCUSDT 50 2 long

Getting Started

#! /usr/bin/env python3

from bincli import BinanceClient

key = ''
sec = ''
binbot = BinanceClient(key, sec, maxtx=10, debug=True)

# bincli is for hedge mode only
# set hedge true if still in oneway
binbot.hedge_mode('true')

# entry long in current price with leverage 50 margin 2
binbot.run('BTCUSDT', 50, 2, 'long')

# entry short in current price with leverage 50 margin 2%
binbot.run('BTCUSDT', 50, '2%', 'short')

# exit order in current price for long or short
binbot.run('BTCUSDT', 50, 2, 'flat')

# entry long in current price with leverage 50 margin 2 takeprofit 2% & sl 1%
binbot.tpsl_run('BTCUSDT', 50, 2, 'long', 0.02, 0.01)

# entry short in current price with leverage 50 margin 2 takeprofit 2% & sl 1%
binbot.tpsl_run('BTCUSDT', 50, 2, 'short', 0.02, 0.01)

# do like oneway mode, only close order before entry
binbot.run('BTCUSDT', 50, 2, 'flat')
binbot.run('BTCUSDT', 50, 2, 'long')