Update #2: BitMEX Automatic Stop Loss / Take Profit Bot (Pre-Alpha)

in #cryptocurrencylast year


In the last couple of days, I have been working on a command-line interface for this bot and adding features that allow users to modify settings.

So what have I done so far?

The bot now has a basic CLI, that can be used to do the following:

  • Start the bot (not yet possible, until trading logic is implemented)
  • Stop the bot
  • Change the settings file (or config)

Changing the settings

This is where a lot of my work has been. I wanted to create a framework for modifying settings of the BitMEX accounts stored in the config file. This includes the API Keys and the distances for stop-loss and take-profit orders.

I designed the config file with multiple accounts in mind. So it has account specific settings.

Mode 1: Boot

This is the first mode the bot enters when you start the script. It asks for your input:

  • start to start the bot and have it watch your account and place orders
  • quit to stop the bot
  • settings to enter settings mode

Mode 2: Settings

This is where you can configure the bot's behavior and modify accounts. Here's the workflow:

  • Enter settings mode
  • Choose account by number
  • Choose which setting to change (SL Distance, SL Trail, TP Distance)
  • Save changes


  • Use constants to hold string values for tips and other messages
  • Handle the command info to display current config status
  • Implement add new account feature, to add a new account entry in config file

That's all for this update. After working on the remaining issues, I will start implementing basic API connectivity and parts of the bot's core trading logic.

You can find the code and installation instructions for this bot on GitHub.