robinhood-options-mobile

Landscape Charting & Multi-Column Matrix View

The Landscape Charting & Multi-Column Matrix View (MultiLegMatrixOrderEntryWidget, #117) provides a professional-grade widescreen charting and execution environment for tablet, desktop, and mobile landscape orientations.

It combines full-width interactive technical charts with a collapsible, responsive split-screen multi-leg options matrix—allowing options traders to visually identify technical levels (support, resistance, moving averages, and VWAP) while simultaneously configuring and pricing complex multi-leg options orders in real time.


Overview & Motivation

When analyzing charts on standard mobile portrait layouts, options traders frequently experience disjointed context switching:

  1. Navigating away from the candlestick chart to view the option chain.
  2. Manually calculating spread widths, net debits/credits, and breakeven levels without visual reference to underlying price history.
  3. Returning to the chart to re-evaluate key support/resistance levels.

The Landscape Chart Matrix eliminates this friction by leveraging the horizontal viewport:

+----------------------------------------------------------------------------------------------------+
| FullScreenInstrumentChartWidget (Landscape Mode)                                                   |
+----------------------------------------------------+-----------------------------------------------+
| Left Panel: Technical Chart                        | Right Panel: Multi-Leg Order Matrix           |
|                                                    |                                               |
|  [Symbol: NVDA $128.50 (+3.2%)]                    |  [Strategy: Bull Call Spread] [Presets v]     |
|  ------------------------------------------------  |  -------------------------------------------  |
|  Candlestick / Area Chart with Overlays            |  Leg 1: BUY  CALL $125.00 Exp: Oct 18  $6.20  |
|  - SMA 20 / SMA 50 / VWAP                          |  Leg 2: SELL CALL $135.00 Exp: Oct 18  $2.10  |
|  - Volume Histogram / Time Series Markers          |  -------------------------------------------  |
|                                                    |  Net Debit: $4.10 ($410.00 / contract)        |
|                                                    |  Max Profit: $5.90 ($590.00) | Max Loss: $410 |
|                                                    |  Risk/Reward: 1.44:1 | Breakeven: $129.10     |
|                                                    |  [Qty: 1] [Limit: $4.10] [TIF: GTC]           |
|                                                    |  [====== REVIEW & SUBMIT SPREAD ======]       |
+----------------------------------------------------+-----------------------------------------------+

Architecture & Core Components

1. Data Models (lib/model/multi_leg_order_entry.dart)

The multi-leg execution framework is driven by two primary models:

2. UI Components


Technical Features & Error Resilience

During the development of the Landscape Chart Matrix, several core serialization and type safety hardening measures were implemented:

  1. Defensive Snapshot Serialization:
    • OptionChain.expirationDates serialization converts mapped iterables to a concrete List<String> of ISO 8601 strings, preventing lazy MappedListIterable serialization failures.
    • Constants.toEncodable defensively converts arbitrary Dart Iterable instances into JSON-safe lists and formats DateTime objects.
  2. Null-Safe Financial Deserialization:
    • ForexHolding.fromJson and InstrumentPosition.fromJson robustly handle numeric values passed as either numbers or strings.
    • Guarded getters against null quotes and quantities to prevent null assertion exceptions during position sorting.
  3. Responsive UI Constraints:
    • Replaced fixed-width Row layouts with responsive Wrap and flex constraints to eliminate RenderFlex overflow errors across various mobile device aspect ratios.

Test Coverage

Comprehensive unit and widget tests are located in test/landscape_chart_matrix_test.dart: