Get professional and fast support

GitHub Release GitHub Downloads Conda Release Conda Downloads PyPi Release PyPi Downloads License Supported Python Version PyPI - Status Unit Tests Azure Pipelines codecov Read the Docs Github 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 and is used to interact with the unicorn-binance-trailing-stop-loss Python library.

If you are looking for a standalone version that runs without an installed Python environment, you can use UNICORN Binance Tailing Stop Loss Bot.

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'.


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 yes no
Binance Testnet yes no
Binance Futures yes yes
Binance Isolated Margin yes yes (experimental)
Binance Margin yes yes


No matter if you installed the CLI version via PIP/conda or the standalone Bot version via setup file. Both the configuration and the usage are always absolutely identical for both versions. It is the same source code!

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 --market BTCUSDT

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

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


$ ubtsl --help

Alternatively, it is possible to run ubtsl in the Python environment as follows (not available in the bot/stand alone variant):


$ python3 -m ubtsl --help


$ 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]

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

  -h, --help            show this help message and exit
  -ak APIKEY, --apikey APIKEY
                        the API key
  -as APISECRET, --apisecret APISECRET
                        The Binance API secret.
                        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
  -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
  -n ENGINE, --engine ENGINE
                        Choose the engine. Default: trail Options: jump-in-and-trail to place a buy order and
                        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
  -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.
                        Reset the existing stop_loss_price! usage: True anything else is False.
                        Stop/loss limit in float or percent.
                        Set the start stop/loss limit in float or percent.
                        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, the bot 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 "" --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 "" --market "BTCUSDT" --cancelopenorders

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

$ ubtsl --profile "BTCUSDT_SELL" --listopenorders

Example files

Change Log


Project Homepage



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!


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.



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!


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