robinhood-options-mobile

Futures Positions

RealizeAlpha now enriches futures positions with contract & product metadata, real-time quotes, and settlement prices, exposing Open P&L, Day P&L, and Realized P&L calculations per contract.

Overview

Futures data is aggregated client-side from brokerage APIs, then augmented with metadata (contract + product), live quotes, and previous close prices before being displayed. The implementation provides transparent Open P&L, Day P&L, and Realized P&L; margin analytics and roll logic are planned.

Data Sources

Enrichment Fields (per position)

| Field | Description | |——-|————-| | symbol | Full futures symbol (e.g., ESZ25). | | rootSymbol | Root (e.g., ES). | | expiration | Contract expiration date. | | currency | Pricing currency. | | multiplier | Contract price multiplier (e.g., 50 for ES). | | avgTradePrice | Average execution price of current open position. | | lastTradePrice | Latest trade price from quote feed. | | previousClosePrice | Previous close (settlement) price from closes endpoint. | | quantity | Number of contracts held (signed). | | startOfDayPnl | P&L since the start of the trading day. | | realizedPnl | Realized P&L for the day. | | openPnlCalc | Computed Open P&L value (see formula). | | dayPnlCalc | Computed Day P&L value (see formula). | | notionalValue | Computed Notional Value (Last Price * |Quantity| * Multiplier). |

P&L Formulas

Open P&L

The Open P&L is derived directly from the last trade price vs the average trade price, scaled by contract quantity and multiplier.

$Open\ P\&L = (Last\ Price - Avg\ Price) \times Quantity \times Multiplier$

Example:

AvgTradePrice = 4520.00
LastTradePrice = 4527.25
Quantity = 3
Multiplier = 50
OpenPnlCalc = (4527.25 - 4520.00) * 3 * 50 = 1087.50

Day P&L

The Day P&L compares the last trade price against the previous close price, scaled by contract quantity and multiplier.

$Day\ P\&L = (Last\ Price - Previous\ Close\ Price) \times Quantity \times Multiplier$

Example:

PreviousClosePrice = 4518.50
LastTradePrice = 4527.25
Quantity = 3
Multiplier = 50
DayPnlCalc = (4527.25 - 4518.50) * 3 * 50 = 1312.50

Realized P&L

Realized P&L is calculated based on closed positions during the current session, factoring in execution prices and quantities.

Risk Metrics

Basic risk metrics are provided to monitor exposure.

Notional Value Represents the total value of the assets controlled by the futures position.

$Notional\ Value = Last\ Price \times Quantity \times Multiplier$

Example:

LastTradePrice = 4527.25
Quantity = -3 (Short)
Multiplier = 50
NotionalValue = 4527.25 * 3 * 50 = 679,087.50

Risk Distribution

A pie chart visualizes the distribution of Notional Value across different futures products (e.g., /ES, /NQ), highlighting concentration risk.

UI Integration

Futures Auto-Trading

Futures Auto-Trading adds automated strategy execution on futures contracts with configurable rules, activity logging, and safety controls.

Key Elements

Technical Implementation

Planned Enhancements

Developer Notes

Safety Checklist

Before extending futures logic:

  1. No API keys or secrets in Dart; use Firebase Functions for secure calls.
  2. Add unit tests for new calculations (especially margin, realized P&L).
  3. Maintain consistent naming (snake_case files, UpperCamelCase classes).

    Summary

    Futures support now delivers enriched contract context with transparent Open P&L and Day P&L calculations, and futures auto-trading extends the platform with configurable automated execution.