This document offers traders the specified format to create webhook payloads for a particular cryptocurrency asset class on the BitMEX trading platform.
With BitMEX you can trade cryptocurrency using these four orders:
Let's get started 🚀
Market Order
Write a webhook payload for market order using these three payload fields:
- Symbol
- Action
- Quantity
I. Symbol: The ticker symbol of the cryptocurrency. BitMEX represents this asset class by pairing cryptocurrency ticker symbols. E.g. XBTUSD, ETHUSD, BCHUSD, etc.
II. Action: The signal action, indicates the type of trade to be executed. It can be one of the following three:
- Buy: Triggers an action to purchase the asset.
- Sell: Triggers an action to sell the asset.
- Close: Triggers an action to close an existing open position and exit the trade.
III. Quantity: The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
Examples
I. Buy
{
"symbol": "XBTUSD",
"action": "buy",
"quantity": 123
}
II. Sell
{
"symbol": "XBTUSD",
"action": "sell",
"quantity": 123
}
III. Close
{
"symbol": "XBTUSD",
"action": "close",
}
Limit Order
Write a webhook payload for Limit order using these four payload fields:
- Symbol
- Action
- Quantity
- Limit_price
I. Symbol: The ticker symbol of the cryptocurrency. BitMEX represents this asset class by pairing cryptocurrency ticker symbols. E.g. XBTUSD, ETHUSD, BCHUSD, etc.
II. Action: The signal action, indicates the type of trade to be executed. It can be one of the following three:
- Buy: Triggers an action to purchase the asset.
- Sell: Triggers an action to sell the asset.
- Close: Triggers an action to close an existing open position and exit the trade.
III. Quantity: The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
IV. Limit_price: An optional field specifying the execution price for a “buy” or “sell” trade. If you specify the limit price the trade will be executed at the specified limit price. Or If you choose not to specify a limit price, the trade will be executed at the current market price.
EXAMPLE
I. Buy
{
"symbol": "XBTUSD",
"action": "buy",
"quantity": 123,
"limit_price": 123.98
}
II. Sell
{
"symbol": "XBTUSD",
"action": "sell",
"quantity": 123,
"limit_price": 123.98
}
III. Close
{
"symbol": "XBTUSD",
"action": "Close",
"limit_price": 123.98
}
Stop Order
Write a webhook payload for Stop order using these four payload fields:
- Symbol
- Action
- Quantity
- Stop_price
I. Symbol: The ticker symbol of the cryptocurrency. BitMEX represents this asset class by pairing cryptocurrency ticker symbols. E.g. XBTUSD, ETHUSD, BCHUSD, etc.
II. Action: The signal action, indicates the type of trade to be executed. It can be one of the following three:
- Buy: Triggers an action to purchase the asset.
- Sell: Triggers an action to sell the asset.
- Close: Triggers an action to close an existing open position and exit the trade.
III. Quantity: The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
IV. Stop_price: An optional field specifying the price level at which a stop-loss or stop-limit order should be triggered. It helps limit potential losses by automatically closing the position when the specified price is reached.
EXAMPLE
I. Buy
{
"symbol": "XBTUSD",
"action": "buy",
"quantity": 123,
"stop_price": 123.98
}
II. Sell
{
"symbol": "XBTUSD",
"action": "sell",
"quantity": 123,
"stop_price": 123.98
}
III. Close
{
"symbol": "XBTUSD",
"action": "close",
"stop_price": 123.98
}
Stop-Limit Order
Write a webhook payload for Stop-Limit order using these five payload fields:
- Symbol
- Action
- Quantity
- Limit_price
- Stop-Limit_price
I. Symbol: The ticker symbol of the cryptocurrency. BitMEX represents this asset class by pairing cryptocurrency ticker symbols. E.g. XBTUSD, ETHUSD, BCHUSD, etc.
II. Action: The signal action, indicates the type of trade to be executed. It can be one of the following three:
- Buy: Triggers an action to purchase the asset.
- Sell: Triggers an action to sell the asset.
- Close: Triggers an action to close an existing open position and exit the trade.
III. Quantity: The number of assets to be traded. If omitted, the quantity will be dynamically calculated or defaulted to 1.
IV. Limit_price: An optional field specifying the execution price for a “buy” or “sell” trade. If you specify the limit price the trade will be executed at the specified limit price. Or If you choose not to specify a limit price, the trade will be executed at the current market price.
V. Stop_price: An optional field specifying the price level at which a stop-loss or stop-limit order should be triggered. It helps limit potential losses by automatically closing the position when the specified price is reached.
EXAMPLE
A. Buy
{
"symbol": "XBTUSD",
"action": "buy",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
B. Sell
{
"symbol": "XBTUSD",
"action": "sell",
"quantity": 123,
"limit_price": 123.98,
"stop_price": 123.98
}
C. Close
{
"symbol": "XBTUSD",
"action": "close",
"limit_price": 123.98,
"stop_price": 123.98
}