GitHunt
LA

laisee/rektbitmex

bot tracking liquidations on Bitmex exchange (www.bitmex.com). Stores records of each liquidation and publishes to twitter

Python App
Lint
Bandit Security Check
codecov
Python Version
Python Version
Python Version
License: CC0-1.0

๐Ÿ’ฅ Rekt @ BitMEX Bot

rektbitmex tracks liquidation events on BitMEX and stores
information about each event in a local SQLite database. When configured with
Twitter credentials it tweets a short summary of the liquidation.


Features

  • Polls the BitMEX order/liquidations API endpoint
  • Persists liquidation information to rekt.sqlite
  • Optional Twitter posting using Tweepy
  • PID file handling to avoid multiple running instances
  • Simple commands to initialise the database tables

Requirements

  • Python 3.8 or newer
  • Dependencies listed in requirements.txt

Installation

pip install -r requirements.txt

Usage

Initialise the database tables:

python add_sql_rekt.py

Run the bot:

python rektrunner.py

Set the following environment variables if you want the bot to tweet:
TWITTER_APP_KEY, TWITTER_APP_SECRET, TWITTER_ACCESS_TOKEN and
TWITTER_ACCESS_TOKEN_SECRET.

Supported Versions

The project is actively tested with Python 3.8 and later.

Database Schema

Two tables are created in rekt.sqlite:

  • rekkage: stores liquidation events
    • rekt_key TEXT primary key
    • rekt_symbol TEXT
    • rekt_qty INTEGER
    • rekt_price REAL
    • rekt_position TEXT
    • rekt_side TEXT
    • rekt_ts TEXT (timestamp of insertion)
  • rekt_PID: tracks the running process ID
    • rekt_PID TEXT primary key

Configuration

config.py defines the BitMEX API base URL. The database path can be passed to
functions in rektrunner.py if you wish to store it elsewhere. Twitter
credentials are read from environment variables as noted above.

Test Coverage

Unit tests are located in the tests directory and can be executed with
pytest and the pytest-cov plugin:

pytest --cov=./

There are four tests covering database initialisation, record insertion and the
basic helper functions. Coverage results are uploaded to Codecov and displayed in the badge above.

Languages

Python100.0%

Contributors

Creative Commons Zero v1.0 Universal
Created January 4, 2017
Updated June 13, 2025