Skip to content

Commit efeee3a

Browse files
committed
Update BitMEX integration guide
1 parent 3c9f8ca commit efeee3a

File tree

1 file changed

+65
-58
lines changed

1 file changed

+65
-58
lines changed

docs/integrations/bitmex.md

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,18 @@ the same asset - Bitcoin.
111111

112112
Futures contracts use standard futures month codes:
113113

114-
- `F` = January, `G` = February, `H` = March
115-
- `J` = April, `K` = May, `M` = June
116-
- `N` = July, `Q` = August, `U` = September
117-
- `V` = October, `X` = November, `Z` = December
114+
- `F` = January
115+
- `G` = February
116+
- `H` = March
117+
- `J` = April
118+
- `K` = May
119+
- `M` = June
120+
- `N` = July
121+
- `Q` = August
122+
- `U` = September
123+
- `V` = October
124+
- `X` = November
125+
- `Z` = December
118126

119127
Followed by the year (e.g., `24` for 2024, `25` for 2025).
120128

@@ -154,66 +162,75 @@ with additional functionality being actively developed.
154162
|------------------------|-----------|-----------------------------------------------|
155163
| `MARKET` || Executed immediately at current market price. |
156164
| `LIMIT` || Executed only at specified price or better. |
157-
| `STOP_MARKET` | - | *Currently under development*. |
158-
| `STOP_LIMIT` | - | *Currently under development*. |
159-
| `MARKET_IF_TOUCHED` | - | *Currently under development*. |
160-
| `LIMIT_IF_TOUCHED` | - | *Currently under development*. |
165+
| `STOP_MARKET` | | Supported (set `trigger_price`). |
166+
| `STOP_LIMIT` | | Supported (set `price` and `trigger_price`). |
167+
| `MARKET_IF_TOUCHED` | | Supported (set `trigger_price`). |
168+
| `LIMIT_IF_TOUCHED` | | Supported. |
161169
| `TRAILING_STOP_MARKET` | - | *Not yet implemented*. |
162170

163171
### Execution instructions
164172

165-
| Instruction | Supported | Notes |
166-
|---------------|-----------|-------------------------------------------------------------|
167-
| `post_only` || Supported via `ParticipateDoNotInitiate` on `LIMIT` orders. |
168-
| `reduce_only` | - | *Currently under development*. |
173+
| Instruction | Supported | Notes |
174+
|---------------|-----------|-----------------------------------------------------------------------------------|
175+
| `post_only` || Supported via `ParticipateDoNotInitiate` execution instruction on `LIMIT` orders. |
176+
| `reduce_only` | | Supported via `ReduceOnly` execution instruction. |
169177

170178
:::note
171-
Post-only orders are implemented using BitMEX's `ParticipateDoNotInitiate` execution
172-
instruction, which ensures orders are added to the order book as maker orders only.
179+
Post-only orders that would cross the spread are canceled by BitMEX rather than rejected. The
180+
integration surfaces these as rejections with `due_post_only=True` so strategies can handle them
181+
consistently.
173182
:::
174183

175184
### Time in force
176185

177-
| Time in force | Supported | Notes |
178-
|---------------|-----------|------------------------------------------------|
179-
| `GTC` || Good Till Canceled (default). |
180-
| `GTD` | - | *Not supported by BitMEX*. |
181-
| `FOK` | - | *Currently under development*. |
182-
| `IOC` | - | *Currently under development*. |
186+
| Time in force | Supported | Notes |
187+
|---------------|-----------|-----------------------------------------------|
188+
| `GTC` || Good Till Canceled (default). |
189+
| `GTD` | - | *Not yet implemented*. |
190+
| `FOK` | | Fill or Kill - fills entire order or cancels. |
191+
| `IOC` | | Immediate or Cancel - partial fill allowed. |
183192

184193
### Advanced order features
185194

186-
| Feature | Supported | Notes |
187-
|--------------------|-----------|---------------------------------------------|
188-
| Order Modification | - | *Currently under development*. |
189-
| Bracket Orders | - | *Not yet implemented*. |
190-
| Iceberg Orders | - | *Supported by BitMEX, not yet implemented*. |
195+
| Feature | Supported | Notes |
196+
|--------------------|-----------|--------------------------------------------|
197+
| Order Modification | | Modify price, quantity, and trigger price. |
198+
| Bracket Orders | - | *Not yet implemented*. |
199+
| Iceberg Orders | | Use `display_qty`. |
191200

192201
### Batch operations
193202

194-
| Operation | Supported | Notes |
195-
|--------------------|-----------|-----------------------------------------------|
196-
| Batch Submit | - | *Not yet implemented*. |
197-
| Batch Modify | - | *Not yet implemented*. |
198-
| Batch Cancel | - | *Not yet implemented*. |
203+
| Operation | Supported | Notes |
204+
|--------------------|-----------|--------------------------------------------|
205+
| Batch Submit | - | *Not yet implemented*. |
206+
| Batch Modify | - | *Not yet implemented*. |
207+
| Batch Cancel | - | *Not yet implemented*. |
208+
209+
Low-level HTTP bulk endpoints exist (place/amend), but are not yet exposed via the execution client.
199210

200211
### Position management
201212

202-
| Feature | Supported | Notes |
203-
|---------------------|-----------|----------------------------------------------|
204-
| Query positions || Real-time position updates via WebSocket. |
205-
| Leverage control | - | *Currently under development*. |
206-
| Cross margin || Default margin mode. |
207-
| Isolated margin | - | *Currently under development*. |
213+
| Feature | Supported | Notes |
214+
|---------------------|-----------|----------------------------------------------------|
215+
| Query positions || REST and real-time position updates via WebSocket. |
216+
| Cross margin || Default margin mode. |
217+
| Isolated margin || |
208218

209219
### Order querying
210220

211-
| Feature | Supported | Notes |
212-
|---------------------|-----------|----------------------------------------------|
213-
| Query open orders || List all active orders. |
214-
| Query order history || Historical order data. |
215-
| Order status updates|| Real-time order state changes via WebSocket. |
216-
| Trade history || Execution and fill reports. |
221+
| Feature | Supported | Notes |
222+
|----------------------|-----------|----------------------------------------------|
223+
| Query open orders || List all active orders. |
224+
| Query order history || Historical order data. |
225+
| Order status updates || Real-time order state changes via WebSocket. |
226+
| Trade history || Execution and fill reports. |
227+
228+
## Market data
229+
230+
- Order book deltas: `L2_MBP` only; `depth` 0 (full book) or 25.
231+
- Order book snapshots: `L2_MBP` only; `depth` 0 (default 10) or 10.
232+
- Quotes, trades, and instrument updates are supported via WebSocket.
233+
- Funding rates, mark prices, and index prices are supported where applicable.
217234

218235
## Rate limits
219236

@@ -237,17 +254,17 @@ The adapter automatically respects these limits through built-in rate limiting w
237254

238255
### WebSocket limits
239256

240-
- 20 connections per hour per IP address
241-
- Authentication required for private data streams
257+
- Refer to the BitMEX documentation for current connection limits.
258+
- Authentication is required for private data streams.
242259

243260
### Rate limit headers
244261

245262
BitMEX provides rate limit information in response headers:
246263

247-
- `x-ratelimit-limit`: Total allowed requests
248-
- `x-ratelimit-remaining`: Remaining requests in current window
249-
- `x-ratelimit-reset`: Unix timestamp when limits reset
250-
- `retry-after`: Seconds to wait if rate limited (429 response)
264+
- `x-ratelimit-limit`: Total allowed requests.
265+
- `x-ratelimit-remaining`: Remaining requests in current window.
266+
- `x-ratelimit-reset`: Unix timestamp when limits reset.
267+
- `retry-after`: Seconds to wait if rate limited (429 response).
251268

252269
:::warning
253270
Exceeding rate limits will result in HTTP 429 responses and potential temporary IP bans.
@@ -340,16 +357,6 @@ mainnet_exec_config = BitmexExecClientConfig(
340357
- **Taker fees**: Positive fee for taking liquidity.
341358
- **Funding rates**: Apply to perpetual contracts every 8 hours.
342359

343-
## Known limitations
344-
345-
The BitMEX integration is actively being developed. Current limitations include:
346-
347-
- Limited order type support (only MARKET and LIMIT orders for now).
348-
- Post-only functionality pending full implementation.
349-
- Stop orders and advanced order types not yet available.
350-
- Batch operations not implemented.
351-
- Margin mode switching not available.
352-
353360
:::note
354361
We welcome contributions to extend the BitMEX adapter functionality. Please see our
355362
[contributing guide](https://github.com/nautechsystems/nautilus_trader/blob/develop/CONTRIBUTING.md)

0 commit comments

Comments
 (0)