alpha rptr

Trading system for automated algorithmic trading on Binance Futures and BitMEX.

Author is not responsible for any damage caused by this software. Be careful and test your strategy using very small sizes for some time to make sure it does what you expect it to do.


  • API and Websocket implementation for both Binance Futures and BitMEX
  • Supports all pairs
  • Event-driven
  • all types of orders supported including majority of parameters/combinations - if you miss any, you can request
  • Supports custom strategies
  • Backtesting
  • Testnet only for BitMEX (todo Binance Futures testnet)
  • Stub trading
  • TA-lib indicators, you can request an indicator as well if its missing
  • Very easy strategy implementation, should be easy enough to migrate most pine script(tradingview) strategies - see Sample strategy

Implemented reference strategies

  1. Channel Breakout
  2. Cross SMA
  3. RCI
  4. Open Close Cross Strategy
  5. Trading View Strategy (implemented but not supported in the current implementation via gmail) - maybe in the future todo tradingview webhooks implementation, until then this project is recommended for tradingview webhooks trading:


  • Python: 3.6.5

How to install

1. Install packages


$ brew install ta-lib
$ git clone
$ cd alpha-rptr/
$ pip install -r requirements.txt


$ wget
$ tar xvzf ta-lib-0.4.0-src.tar.gz
$ cd ta-lib/
$ ./configure --prefix=/usr
$ make
$ sudo make install
$ git clone
$ cd alpha-rptr/
$ pip install -r requirements.txt

2. Setting keys

Set your API keys in src / file.

config = {
    "binance_keys": {
                    "binanceaccount1":{"API_KEY": "", "SECRET_KEY": ""},
                    "binanceaccount2": {"API_KEY": "", "SECRET_KEY": ""}
    "bitmex_keys": {
                    "bitmexaccount1":{"API_KEY": "", "SECRET_KEY": ""},
                    "bitmexaccount2": {"API_KEY": "", "SECRET_KEY": ""}
    "bitmex_test_keys": {
                    "bitmextest1":{"API_KEY": "", "SECRET_KEY": ""},
                    "bitmextest2": {"API_KEY": "", "SECRET_KEY": ""}
    "line_apikey": {"API_KEY": ""}                       

If you want to send notifications to LINE, set LINE's API key as well. #todo discord and telegram notifications implementation as well.

How to execute

$ python --account binanceaccount1 --exchange binance --pair BTCUSDT --strategy Sample

By changing the values of ACCOUNT EXCHANGE PAIR STRATEGY you can switch accounts, exchanges, piars, strategies.

Case of using Channel Breakout on bitmex with bitmexaccount1 and XBTUSD pair

$ python --account bitmexaccount1 --exchange bitmex --pair XBTUSD --strategy Doten


1. Production Trade Mode

$ python --account binanceaccount1 --exchange binance --pair BTCUSDT --strategy Sample

2. Demo Trade Mode

It is possible to trade on BitMEX testnet. (todo Binance Futures testnet)

$ python --demo --account bitmexaccount1 --exchange bitmex --pair XBTUSD --strategy Sample

3. Back test Mode

$ python --test --account binanceaccount1 --exchange binance --pair BTCUSDT --strategy Sample

4. Hyperopt Mode

$ python --hyperopt --account binanceaccount1 --exchange binance --pair BTCUSDT --strategy Sample

5. Stub trade Mode

$ python --stub --account binanceaccount1 --exchange binance --pair BTCUSDT --strategy Sample

How to add a custom strategy

You can add a strategy by creating a new class in src / Follow this example, which hopefully explains a lot of questions.

# sample strategy

class Sample(Bot):
    # set variables
    long_entry_signal_history = []
    short_entry_signal_history = []

    def __init__(self): 
        # set time frame here       
        Bot.__init__(self, '1m')

    # this for parameter optimization in hyperopt mode - see other reference strategies  
    def options(self):
        return {}

    def strategy(self, open, close, high, low, volume):

        # get lot or set your own value which will be used to size orders 
        # careful default lot is about 20x your account size !!!
        lot =

        # indicator lengths
        fast_len = self.input('fast_len', int, 6)
        slow_len = self.input('slow_len', int, 18)

        # setting indicators, they usually take source and length as arguments
        sma1 = sma(close, fast_len)
        sma2 = sma(close, slow_len)

        # entry conditions
        long_entry_condition = crossover(sma1, sma2)
        short_entry_condition = crossunder(sma1, sma2)

        # setting a simple stop loss and profit target in % using built-in simple profit take and stop loss implementation 
        # which is placing the sl and tp automatically after entering a position, profit_short=1.25, stop_long=1, stop_short=1.1, round_decimals=0)

        # example of calculation of stop loss price 0.8% round on 2 decimals hardcoded inside this class
        # sl_long = round(close[-1] - close[-1]*0.8/100, 2)
        # sl_short = round(close[-1] - close[-1]*0.8/100, 2)

        # order execution logic
        if long_entry_condition:
            # entry - True means long for every other order other than entry use function
  "Long", True, lot/20)
            # stop loss hardcoded inside this class
  "SLLong", False, lot/20, stop=sl_long, reduce_only=True, when=False)

        if short_entry_condition:
            # entry - False means short for every other order other than entry use function
  "Short", False, lot/20)
            # stop loss hardcoded inside this class
            #"SLShort", True, lot/20, stop=sl_short, reduce_only=True, when=False)

        # storing history for entry signals, you can store any variable this way to keep historical values

        # OHLCV and indicator data, you can access history using list index        
        # log indicator values"sma1: {sma1[-1]}")"second last sma2: {sma2[-2]}")
        # log last candle OHLCV values"open: {open[-1]}")"high: {high[-1]}")"low: {low[-1]}")"close: {close[-1]}")"volume: {volume[-1]}")
        #second last candle OHLCV values"second last open: {open[-2]}")"second last high: {high[-2]}")"second last low: {low[-2]}")"second last close: {close[-2]}")"second last volume: {volume[-2]}")
        # log history entry signals"long_entry_hist: {self.long_entry_signal_history}")"short_entry_hist: {self.short_entry_signal_history}")

Dedicated discord server

This server is dedicated for bug reporting, feature requests and support.


if you find this software useful and want to support the development, please feel free to donate.

BTC address: ETH address:

Alpha Rptr

Lightweight trading system for automated algorithmic trading on Binance Futures and BitMEX written in python.

Alpha Rptr Info

⭐ Stars 11
🔗 Source Code
🕒 Last Update 8 months ago
🕒 Created 10 months ago
🐞 Open Issues 2
➗ Star-Issue Ratio 6
😎 Author TheFourGreatErrors