Configuring BitMEX Through CCXT and Checking Derivatives Behavior
Summary
This document explains how to connect to BitMEX through Lumibot’s CCXT broker interface using an explicit exchange configuration and API credentials. It notes that BitMEX is not among the globally auto-detected credential paths, and identifies the exchange ID used for CCXT backtesting. The example configuration also exposes sandbox and margin settings that need attention when preparing a connection.
The main trading lesson is to validate the instrument’s semantics before relying on live orders or simulated results. BitMEX products may use leverage, contract multipliers, and derivative-specific calculations that differ from spot crypto, so asset selection, quantity, margin treatment, and profit-and-loss behavior require exchange-specific checks. The document supplies setup guidance rather than a strategy or performance evidence; it does not explain execution behavior, supported products in detail, or the accuracy and limitations of the backtesting data source.
Key ideas
- BitMEX access through CCXT requires an explicit broker configuration in this setup.
- The document identifies BitMEX as a crypto derivatives venue and names its CCXT exchange ID for backtesting.
- Leverage and contract multipliers can make product behavior differ from spot crypto.
- Validate the selected asset, order quantity, margin settings, and profit-and-loss calculations before live trading.
Tags
Full text
# brokers.ccxt.bitmex
BitMEX CCXT Configuration
=========================
.. meta::
:description: BitMEX has documented Lumibot CCXT examples, but it is not currently one of the global auto-detected credential paths.
BitMEX has documented Lumibot CCXT examples, but it is not currently one of the
global auto-detected credential paths. Use an explicit ``Ccxt`` config and
validate exchange-specific behavior carefully.
Status
------
* **Live trading path:** explicit ``Ccxt`` config
* **Credential style:** API key and secret
* **Backtesting:** documented CCXT backtesting exchange id: ``bitmex``
* **Asset class:** crypto derivatives exchange; verify product support before live use
Manual Config
-------------
.. code-block:: python
from lumibot.brokers import Ccxt
BITMEX_CONFIG = {
"exchange_id": "bitmex",
"apiKey": "your_api_key",
"secret": "your_api_secret",
"margin": False,
"sandbox": False,
}
broker = Ccxt(BITMEX_CONFIG)
Backtesting
-----------
.. code-block:: bash
export BACKTESTING_DATA_SOURCE=bitmex
BitMEX products can involve leverage, contract multipliers, and derivative
semantics that differ from spot crypto. Validate the exact asset, quantity,
margin, and PnL behavior before live trading.Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.