Key Definitions
| Term | Description |
|---|---|
| positionQty | Signed position size — positive for long, negative for short |
| positionValue | Signed cost basis of the position |
| indexPrice | Current market index price |
| leverage | Leverage applied to the position |
| MMR | Maintenance margin rate — fixed at 0.1 (10%) |
| side | +1 for long positions, -1 for short positions |
Average Entry Price & Notional Value
| Field | Formula | Description |
|---|---|---|
| avgEntryPrice | positionValue / positionQty | Weighted average fill price for the position |
| positionNotionalValue | indexPrice × positionQty | Signed current market value of the position |
Unrealized PnL
Unrealized PnL reflects the current profit or loss on an open position, based on the index price relative to the average entry price.positionQty is signed, this formula naturally handles both directions:
- Long (
positionQty > 0): profit whenindexPrice > avgEntryPrice - Short (
positionQty < 0): profit whenindexPrice < avgEntryPrice
Position Margin & Maintenance Margin
Position margin is the collateral locked to support an open position. Maintenance margin is the minimum collateral required to keep the position open.| Field | Formula | Description |
|---|---|---|
| positionMargin | indexPrice × ABS(positionQty) / leverage | Collateral locked for the position at the current index price |
| maintenanceMargin | indexPrice × ABS(positionQty) × MMR | Minimum collateral required to keep the position open |
Liquidation Price
The liquidation price is the index price at which a position will be forcibly closed due to insufficient margin. Rails uses a cross-margin model, so margin availability is computed across all open positions.marginAvailable is the equity cushion remaining after covering all maintenance margins. It differs from availableBalance (see Account Equity & Balances), which is based on position margin and open order margin.
Usage in API
These calculations are used in the Get Account Positions and Get Account Balances responses. Note that several formula variable names differ from their corresponding response field names:| Formula variable | Response field | Endpoint |
|---|---|---|
positionValue | value | Get Account Positions |
positionQty | quantity | Get Account Positions |
unrealizedPnL | unrealizedPnl | Get Account Positions |
positionNotionalValue | notionalValue | Get Account Positions |
liqPrice | liquidationPrice | Get Account Positions |
positionMargin | margin | Get Account Balances |
avgEntryPrice is not returned directly — derive it from value / quantity in the positions response.