The Options Strategy Roll Assistant (OptionRollAssistantWidget, #157) is an institutional-grade, 1-tap rolling wizard designed to simplify and optimize options position management. It supports single-leg short and long calls/puts, covered calls, cash-secured puts, and vertical spreads.
netPrice * quantity * 100).Cost Basis - Closing Cost + Opening Proceeds (or Strike + Net Credit).Strike - Net Credit (or Strike - Opening Proceeds + Closing Cost).Strike ± Net Debit.position_effect: 'close' and position_effect: 'open') compatible with both Robinhood and Schwab brokerage endpoints.PaperTradingStore.executeRollOptionStrategy()) simulating position closing, opening, and cash adjustments with audit logging.SlideToConfirm order safety slider.flowchart TD
A["Open Option Position\n(OptionAggregatePosition)"] --> B["OptionRollAssistantWidget"]
B --> C["Fetch Expiration Dates &\nOption Chain Contracts"]
C --> D["OptionRollCalculation Engine"]
D --> E["Preset Selection\n(Roll Out / Up / Down / Custom)"]
E --> F["Real-Time Financial & Greeks Display\n- Net Credit/Debit\n- Updated Breakeven\n- Greeks Comparison Table\n- DTE Extension"]
F --> G["Review & Execution Gate\n(SlideToConfirm)"]
G -->|Paper Trading| H["PaperTradingStore.executeRollOptionStrategy\n- Close old position\n- Open new position\n- Adjust cash balance"]
G -->|Live Trading| I["IBrokerageService.placeMultiLegOptionsOrder\n- Leg 1: Close (Buy/Sell)\n- Leg 2: Open (Sell/Buy)"]
OptionRollCalculationDefined in lib/model/option_roll_models.dart:
class OptionRollCalculation {
final OptionInstrument closingOption;
final OptionInstrument openingOption;
final int quantity;
final bool isShort;
final double? underlyingPrice;
final double? underlyingCostBasis;
final String strategyType;
final double closingPrice;
final double openingPrice;
// Computed properties:
double get closingCostPerShare;
double get openingProceedsPerShare;
double get netPrice;
String get creditOrDebit; // 'credit' or 'debit'
double get totalCashAmount;
int get dteDelta;
double? get updatedBreakeven;
double? get currentDelta;
double? get targetDelta;
double? get deltaShift;
double? get currentTheta;
double? get targetTheta;
double? get thetaShift;
List<Map<String, dynamic>> buildOrderLegs();
}
The order builder generates standardized legs accepted by brokerages:
// For a Short Call (e.g. Covered Call):
Leg 1: {
"option": closingOption.url,
"position_effect": "close",
"side": "buy",
"ratio_quantity": 1
}
Leg 2: {
"option": openingOption.url,
"position_effect": "open",
"side": "sell",
"ratio_quantity": 1
}
The Roll Assistant is accessible via two intuitive entry points:
OptionInstrumentWidget):
OptionPositionsWidget):
OptionRollAssistantWidget pre-populated with the selected contract.test/option_roll_models_test.dart):
test/option_roll_assistant_widget_test.dart):