Real-time lock screen position tracking, P&L status, and 0DTE trailing stop alerts for active options contracts (v0.50.0, #160).
Live Activities bring glanceable, real-time market data to the iOS Lock Screen, StandBy mode, and Dynamic Island (iPhone 14 Pro, 15, 16 series). Designed specifically for retail options traders, this feature delivers continuous mark price updates and automated intraday trailing stop alerts—especially critical for 0DTE contracts subject to aggressive gamma acceleration and sudden intraday reversals.
+-----------------------------------------------------------------------------------+
| Flutter App Layer |
| |
| [OptionPositionsWidget] / [OptionInstrumentWidget] |
| | |
| v (Long-press / Live Activity Sensors Button) |
| [OptionLiveActivitySheet] <--> User configures Trailing Stop % (5%, 10%, 20%) |
| | |
| v |
| [LiveActivityService] |
| - Tracks active sessions, calculates high-water mark / trailing stop price |
| - Detects 0DTE contracts (DTE == 0) and computes stop trigger breaches |
| - MethodChannel `com.realizealpha.live_activity` |
+----------------------------------------+------------------------------------------+
| MethodChannel (start/update/end)
v
+-----------------------------------------------------------------------------------+
| iOS Host Application (Runner) |
| |
| [AppDelegate.swift] / [LiveActivityManager.swift] |
| - Bridges MethodChannel calls to native Swift ActivityKit |
| - Requests, updates, and dismisses Activity<OptionPositionAttributes> |
+----------------------------------------+------------------------------------------+
| ActivityAttributes & ContentState
v
+-----------------------------------------------------------------------------------+
| PortfolioWidgetExtension (ActivityKit / SwiftUI) |
| |
| [PortfolioWidgetLiveActivity.swift] |
| - Lock Screen / StandBy Banner: |
| * Header: Symbol, Strike, Call/Put, Expiration, and [0DTE] Flame Badge |
| * Pricing: Mark Price, Total Market Value, and P&L ($ & %) |
| * Trailing Stop Status Bar: Stop Price, Distance %, [STOP TRIGGERED] Alert |
| * Deep Link: widgetURL(URL(string: "realizealpha://position/{symbol}")) |
| - Dynamic Island: |
| * Compact Leading: Symbol + 0DTE indicator |
| * Compact Trailing: Color-coded P&L % or STOP badge |
| * Minimal: Compact symbol / alert icon |
| * Expanded: Comprehensive 3-region metrics, stop meter, & distance buffer |
+-----------------------------------------------------------------------------------+
SPY, TSLA, NVDA), strike price, contract type (CALL/PUT), and expiration date.DTE == 0) and highlights them with an orange 0DTE flame badge.Options that expire the same day can experience rapid, non-linear price decay when the underlying asset moves against the position. The Trailing Stop Loss engine provides on-device automated protection:
peakPrice = max(peakPrice, markPrice)).STOP / ⚠️ state.STOP TRIGGERED: Exceeded -X% trailing stop at $Y.YY).STOP warning in red when breached).⚠️ alert icon.OptionPositionsWidget):
sensors icon).sensors icon next to their expiration date.OptionInstrumentWidget):
sensors icon in the AppBar opens the Live Activity configuration sheet for any active holding.OptionLiveActivitySheet):
5%, 10%, 15%, 20%, 25%).Start Live Activity, Update Trailing Stop, and End Live Activity.Info.plistTo enable Live Activities and allow high-frequency pricing updates during fast market movements, the following keys are configured in ios/Runner/Info.plist:
<key>NSSupportsLiveActivities</key>
<true/>
<key>NSSupportsLiveActivitiesFrequentUpdates</key>
<true/>
Tapping any region of the Live Activity triggers deep navigation to the position in RealizeAlpha via custom URL scheme:
realizealpha://position/{symbol}
If the app is running in the background or killed, iOS automatically opens RealizeAlpha and navigates directly to the instrument.