fc57aecd98a39a236f9e3799ae045199a7a7389b
On page load and on every symbol Lookup, target the 3rd Friday of
the next calendar month (the standard US monthly options expiry).
If that exact date isn't listed (e.g., June 19, 2026 is Juneteenth
so SPY's monthly is the Thursday 06-18), fall back to the nearest
available expiration.
Data flow:
1. Init reads {symbol, expirations} from ViewState.
2. Computes target expiry (3rd Fri next month).
3. Hits a new per-symbol cache at
localStorage['optionsPricer:surfaceCache'][symbol:expiry].
- Hit AND cache.date === today → render instantly, no network.
- Hit but stale (cache.date !== today) → refetch.
- Miss → fetch expirations + load surface.
4. fetchExpirations() now auto-selects the target expiry and
triggers _loadForTargetExpiry (cache-aware) — entering a new
symbol now produces a rendered surface with one Enter press.
5. Successful loadSurface writes the response into the cache
under today's date; cache is pruned to 50 entries.
Analytics is no longer stuffed into ViewState (only the lightweight
symbol/expirations/expiry pointer is), so the per-symbol cache is
the single source of truth for surface data.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Options pricing dashboard — IV surface, Greeks, Yahoo Finance data
Languages
HTML
78.5%
TypeScript
17.8%
JavaScript
3.7%