#
Simple Limit Orders
#
Basic Margin Formula
Initial margin is calculated as a percentage of the notional value of the position that the order would generate, if executed. The calculation varies between linear and inverse futures.
#
Linear Futures
For linear futures (e.g., BTC-USD-PERP where USD is the margin currency):
Initial Margin = Position Size × Limit Price × Initial Margin Rate
#
Example
Given:
- Order: Buy 1 BTC at $50,000
- Initial Margin Rate: 1%
- Limit Price: $50,000
Initial Margin = 1 BTC × $50,000 × 0.01 = $500 USD
#
Inverse Futures
For inverse futures (e.g., BTC-USDT-INVERSE where BTC is the margin currency):
Initial Margin = (Position Size / Limit Price) × Initial Margin Rate
#
Example
Given:
- Order: Sell 100,000 USDT at $50,000/BTC
- Initial Margin Rate: 1%
- Limit Price: $50,000
Initial Margin = (100,000 / 50,000) × 0.01 = 0.02 BTC
#
Execution Price Calculation
#
Aggressing Orders
The margin system optimizes capital efficiency by calculating margin based on actual execution prices taking into account the price parameters provided on the order.
#
Example
Consider the following order book for BTC-USD-PERP:
Asks:
50,200 - 2.5 BTC
50,100 - 3.0 BTC
50,000 - 2.0 BTC
Bids:
49,900 - 1.5 BTC
49,800 - 2.0 BTC
49,700 - 1.0 BTC
For a market buy order of 4 BTC:
- 2.0 BTC executes at $50,000
- 2.0 BTC executes at $50,100
The margin calculation uses these actual execution prices:
Initial Margin = (2.0 × $50,000 × 0.01) + (2.0 × $50,100 × 0.01)
= $1,000 + $1,002
= $2,002 USD
When calculating the effective price of an aggressing order, the margin system ignores:
- All resting hidden orders
- Hidden portions of iceberg orders
This ensures the margin calculation does not leak information about hidden or iceberg orders when sending order rejections.
#
Net Margin Calculation
The system calculates margin requirements separately for each side (buy/sell) and uses the higher value, considering the specific price of each order.
#
Example
Consider an account with:
- Buy Orders:
- 0.5 BTC @ $49,800
- 0.5 BTC @ $49,500
- Sell Orders:
- 1.5 BTC @ $50,200
- 1.0 BTC @ $50,500
- Initial Margin Rate: 1%
Buy Side Margin:
Order 1: 0.5 × $49,800 × 0.01 = $249
Order 2: 0.5 × $49,500 × 0.01 = $247.50
Total Buy Side = $496.50 USD
Sell Side Margin:
Order 1: 1.5 × $50,200 × 0.01 = $753
Order 2: 1.0 × $50,500 × 0.01 = $505
Total Sell Side = $1,258 USD
Required Initial Margin = max($496.50, $1,258) = $1,258 USD
#
Cross-Margin
The Nekuti Matching Engine implements cross-margin across all instruments sharing the same margin currency.
#
Example
Consider an account trading multiple instruments with USD margin:
- BTC-USD-PERP position requiring $1,500 margin
- ETH-USD-PERP position requiring $800 margin
- SOL-USD-PERP position requiring $400 margin
Total Required Initial Margin = $1,500 + $800 + $400 = $2,700 USD
#
Margin Rejection Response
When an order fails the initial margin check, the system returns a rejection response that includes the additional margin required to place the order. This helps users understand exactly how much additional collateral they need to deposit or free up to execute their desired trade.
#
Calculation Example
Consider an account trading BTC-USD-PERP:
- Available Balance: $800 USD
- Existing Position Margin: $500 USD
- New Order Requirements: $500 USD
- Total Required: $1,000 USD
#
Rejection Response Format
{
"error": "Account has insufficient Available Balance, 500000000 USDt required"
}
Important notes:
- All instruments using the same margin currency draw from the same margin balance
- Each instrument's margin requirement is calculated independently and then summed