You need a UNICORN Binance Suite License?

More information about the UNICORN Binance Suite can be found here.

get a license

Github GitHub Release GitHub Downloads Anaconda Release Anaconda Downloads PyPi Release PyPi Downloads License Supported Python Version PyPI - Status codecov CodeQL Unit Tests Build and Publish GH+PyPi Build and Publish Anaconda Read the Docs Read How To`s Telegram Gitter

UNICORN Binance Trailing Stop Loss CLI

Description | Installation | Usage | Example commands | Smart Entry | Example files | Change Log | Wiki | Social | Notifications | Bugs | Contributing | Leave a review | Disclaimer

After starting the engine, a stop/loss order is placed and trailed until it is completely fulfilled. If desired, a notification can be sent via email and Telegram afterwards.

In addition, there is a smart entry option called jump-in-and-trail. This offers the possibility to buy spot, future and margin assets with a limit or market order and then to trail a stop/loss order until sold.

The CLI interface ubtsl/ubtsl.exe is installed during the installation of unicorn-binance-trailing-stop-loss with pip or conda and is used to interact with the unicorn-binance-trailing-stop-loss Python library.

Please read carefully all provided documentation, our disclaimer and look in the issues about known problems before using this tool - you use it at your own risk!

If you put this engine on a market, you should stop trading manually on this market yourself!

Part of 'UNICORN Binance Suite'.

Get a UNICORN Binance Suite License

To run modules of the UNICORN Binance Suite you need a valid license!

Description

After startup ubtsl tries to load a ubtsl_config.ini and a ubtsl_profiles.ini file from the {home}/.lucit/ and the current working directory. Alternatively, you can specify these files explicitly with the --configfile and --profilesfile parameters.

Once the tool is started, it trails the stop/loss order until it is completely fulfilled, sends the notifications, and then it stops.

Supported exchanges:

Exchange Exchange string trail jump-in-and-trail
Binance binance.com yes no
Binance Testnet binance.com-testnet yes no
Binance Futures binance.com-futures yes yes
Binance Isolated Margin binance.com-isolated_margin yes yes (experimental)
Binance Margin binance.com-margin yes yes

Installation

The CLI interface ubtsl/ubtsl.exe is installed during the installation of unicorn-binance-trailing-stop-loss with pip or conda and is used to interact with the unicorn-binance-trailing-stop-loss Python library.

Every parameter that can be configured via the ubtsl_profiles.ini or the ubtsl_config.ini file can also be defined as a command line argument. Therefore, both files are not mandatory, but it increases the usability immensely.

Create ubtsl_config.ini

A fresh ubtsl_config.ini file can be created with the following command

$ ubtsl --createconfigini

Create ubtsl_profiles.ini

The same command is available for the ubtsl_profiles.ini file:

$ ubtsl --createprofilesini

Open ubtsl_config.ini

Open the used ubtsl_config.ini file in a GUI editor:

$ ubtsl --openconfigini

Open ubtsl_profiles.ini

The same command is available for the ubtsl_profiles.ini file:

$ ubtsl --openprofilesini

Test the notification settings

If you entered valid email and/or Telegram settings you can test the notification system:

$ ubtsl --test notification

Test connectivity to Binance API

If you entered valid API key and secret you can test the connectivity to the Binance API:

$ ubtsl --test binance-connectivity

Test data streams

Test the data streams, this test needs a defined exchange and market parameter:

$ ubtsl --test streams --exchange binance.com --market BTCUSDT

It is possible to use exchange and market values of a profile.

$ ubtsl --profile "BTCUSDT_SELL" --test streams

Usage

$ ubtsl --help

Alternatively, it is possible to run ubtsl in the Python environment as follows:

Linux/Mac:

$ python3 -m ubtsl --help

Windows:

$ py -m ubtsl --help

Load a profile

If profiles are available, they can be activated with the --profile parameter at startup.

$ ubtsl --profile BTCUSDT_SELL

Command line arguments

Instead of loading the values from profiles, they can also be defined explicitly via command line parameters.

Any CLI parameters will overwrite predefined values from the profile.

All parameters that expect numbers can be configured with fixed numerical values as well as with percentage values.

$ ubtsl --help
usage: ubtsl [-h] [-ak APIKEY] [-as APISECRET] [-bt BORROWTHRESHOLD] [-coo] [-cci] [-cpi] [-cf CONFIGFILE] [-cu]
             [-ex EXAMPLE] [-e EXCHANGE] [-n ENGINE] [-k KEEPTHRESHOLD] [-lf LOGFILE] [-ll LOGLEVEL] [-loo]
             [-m MARKET] [-oci] [-opi] [-ot ORDERTYPE] [-pf PROFILE] [-pff PROFILESFILE] [-r RESETSTOPLOSSPRICE]
             [-l STOPLOSSLIMIT] [-sl STOPLOSSSTARTLIMIT] [-p STOPLOSSPRICE] [-t TEST] [-v]

UNICORN Binance Trailing Stop Loss 0.7.1 by LUCIT Systems and Development (MIT License)

options:
  -h, --help            show this help message and exit
  -ak APIKEY, --apikey APIKEY
                        the API key
  -as APISECRET, --apisecret APISECRET
                        The Binance API secret.
  -bt BORROWTHRESHOLD, --borrowthreshold BORROWTHRESHOLD
                        How much of the possible credit line to exhaust. (Only available in Margin)
  -coo, --cancelopenorders
                        Cancel all open orders and then stop. Only valid in combination with parameter exchange and
                        market.
  -cci, --createconfigini
                        Create the config file and then stop.
  -cpi, --createprofilesini
                        Create the profiles file and then stop.
  -cf CONFIGFILE, --configfile CONFIGFILE
                        Specify path including filename to the config file (ex: ~/my_config.ini). If not provided
                        ubtsl tries to load a ubtsl_config.ini from the {home}\.lucit\ and the current
                        working directory.
  -cu, --checkupdate    Check if update is available and then stop.
  -ex EXAMPLE, --example EXAMPLE
                        Show an example ini file from GitHub and then stop. Options: config or profiles.
  -e EXCHANGE, --exchange EXCHANGE
                        Exchange: binance.com, binance.com-testnet, binance.com-futures, binance.com-isolated_margin,
                        binance.com-margin
  -n ENGINE, --engine ENGINE
                        Choose the engine. Default: trail Options: jump-in-and-trail to place a buy order and
                        trail
  -k KEEPTHRESHOLD, --keepthreshold KEEPTHRESHOLD
                        Set the threshold to be kept. This is the amount that will not get sold.
  -lf LOGFILE, --logfile LOGFILE
                        Specify path including filename to the logfile.
  -ll LOGLEVEL, --loglevel LOGLEVEL
                        Choose a loglevel. Default: INFO Options: DEBUG, INFO, WARNING, ERROR and CRITICAL
  -loo, --listopenorders
                        List all open orders and then stop. Only valid in combination with parameter exchange and
                        market.
  -m MARKET, --market MARKET
                        The market on which is traded.
  -oci, --openconfigini
                        Open the used config file and then stop.
  -opi, --openprofilesini
                        Open the used profiles file and then stop.
  -ot ORDERTYPE, --ordertype ORDERTYPE
                        Use limit or market.
  -pf PROFILE, --profile PROFILE
                        Name of the profile to load from ubtsl_profiles.ini!
  -pff PROFILESFILE, --profilesfile PROFILESFILE
                        Specify path including filename to the profiles file (ex: ~/my_profiles.ini). If not
                        available ubtsl tries to load a ubtsl_profile.ini from the {home}\.lucit\ and the
                        current working directory.
  -r RESETSTOPLOSSPRICE, --resetstoplossprice RESETSTOPLOSSPRICE
                        Reset the existing stop_loss_price! usage: True anything else is False.
  -l STOPLOSSLIMIT, --stoplosslimit STOPLOSSLIMIT
                        Stop/loss limit in float or percent.
  -sl STOPLOSSSTARTLIMIT, --stoplossstartlimit STOPLOSSSTARTLIMIT
                        Set the start stop/loss limit in float or percent.
  -p STOPLOSSPRICE, --stoplossprice STOPLOSSPRICE
                        Set the start stop/loss price as float value.
  -t TEST, --test TEST  Use this to test specific systems like "notification", "binance-connectivity" and "streams".
                        The streams test needs a valid exchange and market. If test is not None the engine will NOT
                        start! It only tests!
  -v, --version         Show the program version and then stop. the version is 0.7.1 by the way :)

Example commands

Check if a new update is available

$ ubtsl --checkupdate

Show program version

$ ubtsl --version

Overwrite values

Arguments defined in the CLI overrule values from the loaded profile!

Start with profile "BTCUSDT_SELL" and overwrite the stoplosslimit:

$ ubtsl --profile BTCUSDT_SELL --stoplosslimit 0.5%

Smart entry

This function is still in an experimental phase and only available for Isolated Margin.

Do a smart entry by using engine = jump-in-and-trail like it is defined within the profile BTCUSDT_SMART_ENTRY of the example_ubtsl_profiles.ini.

By activating the jump-in-and-trail engine, it first buys the predefined asset amount and then trails them automatically.

$ ubtsl --profile BTCUSDT_SMART_ENTRY

List all open orders

Get a list of all open orders.

$ ubtsl --exchange "binance.com" --market "BTCUSDT" --listopenorders

It is possible to use exchange and market values of a profile.

$ ubtsl --profile "BTCUSDT_SELL" --listopenorders

Cancel all open orders

$ ubtsl --exchange "binance.com" --market "BTCUSDT" --cancelopenorders

It's possible to use exchange and market values of a profile.

$ ubtsl --profile "BTCUSDT_SELL" --listopenorders

Example files

Change Log

https://unicorn-binance-trailing-stop-loss.docs.lucit.tech/CHANGELOG.html

Documentation

Project Homepage

https://github.com/LUCIT-Systems-and-Development/unicorn-binance-trailing-stop-loss

Wiki

https://github.com/LUCIT-Systems-and-Development/unicorn-binance-trailing-stop-loss/wiki

Social

Receive Notifications

To receive notifications on available updates you can watch the repository on GitHub.

Follow us on Twitter or on Facebook for general news about the unicorn-binance-suite!

To receive news (like inspection windows/maintenance) about the Binance API`s subscribe to their telegram groups:

How to report Bugs or suggest Improvements?

List of planned features - click thumbs-up if you need one of them or suggest a new feature!

Before you report a bug, try the latest release. If the issue still exists, provide the error trace, OS and Python version and explain how to reproduce the error. A demo script is appreciated.

If you dont find an issue related to your topic, please open a new issue!

Report a security bug!

Contributing

UNICORN Binance Trailing Stop Loss is an open source project which welcomes contributions which can be anything from simple documentation fixes and reporting dead links to new features. To contribute follow this guide.

Contributors

Contributors

We love open source!

You want to say Thank You?

We hope you are enjoying using our libraries and that they are proving to be useful to you. If you have a moment, we would greatly appreciate it if you could leave us a review on Google. Thank you for your support!

Disclaimer

This project is for informational purposes only. You should not construe this information or any other material as legal, tax, investment, financial or other advice. Nothing contained herein constitutes a solicitation, recommendation, endorsement or offer by us or any third party provider to buy or sell any securities or other financial instruments in this or any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

If you intend to use real money, use it at your own risk.

Under no circumstances will we be responsible or liable for any claims, damages, losses, expenses, costs or liabilities of any kind, including but not limited to direct or indirect damages for loss of profits.

Do you have any questions? We will be happy to answer them in our chat - usually you will receive an answer within a few minutes during our opening hours.

Arrange a free & no obligation consultation

Together we will clarify your needs and you will receive a detailed offer

Make an appointment now

Our Stack

Automation and Integration of Trading Platforms

REST API`s and Websockets

We specialize in connecting to crypto API endpoints and are maintainers of the UnicornFy, UNICORN Binance REST API and UNICORN Binance Websocket API for Python.

Binance, KuCoin, Pancakeswap, CoinMarketCap, CoinDesk, ...

CCXT

Interactive Brokers

MetaTrader

Yahoo Finance API

KAIKO

Boto3, Azure SDK, ...

AI / Neural Networks

Azure AI (certified)

TensorFlow

Scikit

SageMaker

Data Science

R

Python
Pandas
NumPy
SciPy
Matplotlib

Full-Stack Infrastructure On-Prem or Cloud (AWS, Azure, OVH, Hetzner, Digital Ocean, ...)

Linux (hardened), EC2

DynamoDB

Kafka

Kubernetes

PostgreSQL/MySQL/MariaDB

Redis

Data Lakes

Microservices

Monitoring

Security

AI

And much more ...