Skip to content

Commit bb7d413

Browse files
tdobrowolski1claude
andcommitted
Add live options screener example notebook
New notebook 10_live_options_screener.py with 8 worked examples: default universe scan, positive-gamma ranking, harvestable VRP setups, vol scanner (IV rich vs RV), cascading strike/contract filters, custom formulas (IV premium, risk-adjusted harvest), macro context filtering (VIX gate). Update README keywords and method table to surface the screener as a first-class feature. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4486c2b commit bb7d413

2 files changed

Lines changed: 178 additions & 6 deletions

File tree

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
[![CI](https://github.com/FlashAlpha-lab/flashalpha-examples/actions/workflows/ci.yml/badge.svg)](https://github.com/FlashAlpha-lab/flashalpha-examples/actions/workflows/ci.yml)
44

5-
Practical Python examples for options analytics, gamma exposure, volatility surface
5+
Practical Python examples for options analytics, a **live options screener**
6+
(filter/rank by GEX, VRP, IV, harvest scores), gamma exposure, volatility surface
67
modeling, dealer positioning, 0DTE analytics, and more — all powered by the
78
[FlashAlpha API](https://flashalpha.com).
89

910
Each file in `notebooks/` is a self-contained Python script. Run it directly,
1011
paste it into a Jupyter notebook, or share it as-is.
1112

12-
Keywords: gamma exposure python, options analytics API, 0DTE options analytics,
13-
volatility surface python, implied volatility rank, dealer positioning, GEX dashboard,
14-
SVI volatility model, variance swap, options flow python, options greeks API,
15-
IV rank scanner, volatility skew python, options regime analysis.
13+
Keywords: live options screener, options screener API, gamma exposure python, options analytics API,
14+
0DTE options analytics, volatility surface python, implied volatility rank, dealer positioning,
15+
GEX dashboard, VRP harvest screener, variance risk premium, SVI volatility model, variance swap,
16+
options flow python, options greeks API, IV rank scanner, volatility skew python, options regime analysis,
17+
short volatility screener, vol selling scanner.
1618

1719
---
1820

@@ -29,6 +31,7 @@ IV rank scanner, volatility skew python, options regime analysis.
2931
| `notebooks/07_zero_dte_analytics.py` | 0DTE Intraday Analytics | Regime, expected move, pin risk, dealer hedging flows, theta decay for same-day expiries |
3032
| `notebooks/08_advanced_volatility.py` | Advanced Volatility: SVI and Variance Surface | SVI parameters, variance surface, calendar/butterfly arbitrage detection, greeks surfaces, variance swap rates |
3133
| `notebooks/09_volatility_analysis.py` | Comprehensive Volatility Analysis | IV rank, term structure, skew, vol risk premium, forward vol, vol regime for TSLA |
34+
| `notebooks/10_live_options_screener.py` | **Live Options Screener** | **Filter and rank symbols by GEX, VRP, IV, greeks, harvest scores, and custom formulas. Includes harvestable VRP screen, vol scanner, cascading strike/contract filters, and risk-adjusted rankings** |
3235

3336
---
3437

@@ -72,6 +75,7 @@ pytest tests/test_examples.py -m integration -v
7275

7376
| Method | Description | Tier |
7477
|--------|-------------|------|
78+
| `fa.screener(...)` | Live options screener — filter/rank by GEX, VRP, IV, harvest score, formulas | Growth+ |
7579
| `fa.gex(symbol)` | Gamma exposure by strike | Public |
7680
| `fa.dex(symbol)` | Delta exposure | Public |
7781
| `fa.vex(symbol)` | Vanna exposure | Public |
@@ -100,9 +104,19 @@ MIT. See [LICENSE](LICENSE).
100104

101105
---
102106

107+
## SDKs
108+
109+
| Language | Package | Repository |
110+
|----------|---------|------------|
111+
| Python | `pip install flashalpha` | [flashalpha-python](https://github.com/FlashAlpha-lab/flashalpha-python) |
112+
| JavaScript | `npm i flashalpha` | [flashalpha-js](https://github.com/FlashAlpha-lab/flashalpha-js) |
113+
| .NET | `dotnet add package FlashAlpha` | [flashalpha-dotnet](https://github.com/FlashAlpha-lab/flashalpha-dotnet) |
114+
| Java | Maven Central | [flashalpha-java](https://github.com/FlashAlpha-lab/flashalpha-java) |
115+
| Go | `go get github.com/FlashAlpha-lab/flashalpha-go` | [flashalpha-go](https://github.com/FlashAlpha-lab/flashalpha-go) |
116+
| MCP | Claude / LLM tool server | [flashalpha-mcp](https://github.com/FlashAlpha-lab/flashalpha-mcp) |
117+
103118
## Related Repositories
104119

105-
- [FlashAlpha Python SDK](https://github.com/FlashAlpha-lab/flashalpha-python)`pip install flashalpha`
106120
- [GEX Explained](https://github.com/FlashAlpha-lab/gex-explained) — gamma exposure theory and code
107121
- [0DTE Options Analytics](https://github.com/FlashAlpha-lab/0dte-options-analytics) — 0DTE pin risk, expected move, dealer hedging
108122
- [Volatility Surface Python](https://github.com/FlashAlpha-lab/volatility-surface-python) — SVI, variance swap, skew analysis
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# # Live Options Screener — filter & rank symbols in real time
2+
#
3+
# The Screener endpoint lets you filter and rank symbols across your tier's
4+
# universe by any combination of stock, expiry, strike, or contract-level
5+
# metrics: gamma exposure (GEX), VRP, implied volatility, greeks, harvest
6+
# scores, dealer flow risk, and more. Data is live from an in-memory store,
7+
# refreshed every 5-10 seconds.
8+
#
9+
# Docs: https://flashalpha.com/docs/lab-api-screener
10+
# Cookbook: https://flashalpha.com/docs/lab-api-screener-cookbook
11+
# Install: pip install "flashalpha>=0.3.0"
12+
#
13+
# Tier notes:
14+
# Growth — 10 symbols (SPY, QQQ, AAPL, TSLA, NVDA, AMZN, META, MSFT, SPX, AMD), 10 rows max
15+
# Alpha — ~250 symbols, 50 rows max, formulas, harvest/dealer-flow-risk scores
16+
17+
import os
18+
from flashalpha import FlashAlpha
19+
20+
fa = FlashAlpha(os.environ["FLASHALPHA_API_KEY"])
21+
22+
# ---------------------------------------------------------------------------
23+
# 1) Simplest call — no filters, returns the default universe
24+
# ---------------------------------------------------------------------------
25+
result = fa.screener()
26+
print(f"tier={result['meta']['tier']} universe={result['meta']['universe_size']}")
27+
for row in result["data"][:5]:
28+
print(f" {row['symbol']:6} price={row.get('price')} regime={row.get('regime')}")
29+
30+
# ---------------------------------------------------------------------------
31+
# 2) Positive-gamma names ranked by net GEX
32+
# ---------------------------------------------------------------------------
33+
result = fa.screener(
34+
filters={"field": "regime", "operator": "eq", "value": "positive_gamma"},
35+
sort=[{"field": "net_gex", "direction": "desc"}],
36+
select=["symbol", "price", "regime", "net_gex", "gamma_flip"],
37+
)
38+
print("\nPositive-gamma names:")
39+
for row in result["data"]:
40+
print(f" {row['symbol']:6} net_gex={row['net_gex']:>15,.0f} flip={row.get('gamma_flip')}")
41+
42+
# ---------------------------------------------------------------------------
43+
# 3) Harvestable VRP setups (Alpha tier)
44+
# ---------------------------------------------------------------------------
45+
result = fa.screener(
46+
filters={
47+
"op": "and",
48+
"conditions": [
49+
{"field": "regime", "operator": "eq", "value": "positive_gamma"},
50+
{"field": "vrp_regime", "operator": "eq", "value": "harvestable"},
51+
{"field": "dealer_flow_risk", "operator": "lte", "value": 40},
52+
{"field": "harvest_score", "operator": "gte", "value": 65},
53+
],
54+
},
55+
sort=[{"field": "harvest_score", "direction": "desc"}],
56+
select=["symbol", "price", "harvest_score", "dealer_flow_risk", "vrp_regime"],
57+
)
58+
print("\nHarvestable VRP setups:")
59+
for row in result["data"]:
60+
print(
61+
f" {row['symbol']:6} harvest={row['harvest_score']:>3} "
62+
f"risk={row['dealer_flow_risk']:>3} vrp={row.get('vrp_regime')}"
63+
)
64+
65+
# ---------------------------------------------------------------------------
66+
# 4) Vol scanner — where is IV rich vs realized?
67+
# ---------------------------------------------------------------------------
68+
result = fa.screener(
69+
filters={
70+
"op": "and",
71+
"conditions": [
72+
{"field": "vrp_20d", "operator": "gte", "value": 5},
73+
{"field": "atm_iv", "operator": "gte", "value": 25},
74+
],
75+
},
76+
sort=[{"field": "vrp_20d", "direction": "desc"}],
77+
select=["symbol", "atm_iv", "rv_20d", "vrp_20d", "skew_25d"],
78+
)
79+
print("\nHigh VRP names (IV rich vs RV):")
80+
for row in result["data"]:
81+
print(
82+
f" {row['symbol']:6} iv={row['atm_iv']:>5} "
83+
f"rv={row['rv_20d']:>5} vrp={row['vrp_20d']:>5}"
84+
)
85+
86+
# ---------------------------------------------------------------------------
87+
# 5) Cascading filter — stock + expiry + strike + contract level
88+
# ---------------------------------------------------------------------------
89+
# Returns symbols with positive gamma, trimmed to expiries <= 14 days,
90+
# high-OI strikes, and only the high-delta calls.
91+
result = fa.screener(
92+
filters={
93+
"op": "and",
94+
"conditions": [
95+
{"field": "regime", "operator": "eq", "value": "positive_gamma"},
96+
{"field": "expiries.days_to_expiry", "operator": "lte", "value": 14},
97+
{"field": "strikes.call_oi", "operator": "gte", "value": 2000},
98+
{"field": "contracts.type", "operator": "eq", "value": "C"},
99+
{"field": "contracts.delta", "operator": "gte", "value": 0.3},
100+
],
101+
},
102+
select=["symbol", "expiry_aggregates"],
103+
limit=10,
104+
)
105+
print("\nCascading filter (positive gamma, <=14 DTE, high-OI calls, delta>=0.3):")
106+
for row in result["data"]:
107+
print(f" {row['symbol']}: {len(row.get('expiry_aggregates', []))} expiries kept")
108+
109+
# ---------------------------------------------------------------------------
110+
# 6) Custom formula — IV premium sorted descending (Alpha tier)
111+
# ---------------------------------------------------------------------------
112+
result = fa.screener(
113+
formulas=[{"alias": "iv_premium", "expression": "atm_iv - rv_20d"}],
114+
filters={"formula": "iv_premium", "operator": "gte", "value": 5},
115+
sort=[{"formula": "iv_premium", "direction": "desc"}],
116+
select=["symbol", "atm_iv", "rv_20d", "iv_premium"],
117+
limit=20,
118+
)
119+
print("\nCustom formula (iv_premium = atm_iv - rv_20d):")
120+
for row in result["data"]:
121+
print(
122+
f" {row['symbol']:6} iv={row['atm_iv']:>5} "
123+
f"rv={row['rv_20d']:>5} premium={row['iv_premium']:>5}"
124+
)
125+
126+
# ---------------------------------------------------------------------------
127+
# 7) Risk-adjusted harvest score (formula ranking)
128+
# ---------------------------------------------------------------------------
129+
result = fa.screener(
130+
formulas=[
131+
{"alias": "risk_adj", "expression": "harvest_score / (dealer_flow_risk + 1)"},
132+
],
133+
filters={"field": "harvest_score", "operator": "gte", "value": 50},
134+
sort=[{"formula": "risk_adj", "direction": "desc"}],
135+
select=["symbol", "harvest_score", "dealer_flow_risk", "risk_adj"],
136+
limit=20,
137+
)
138+
print("\nRisk-adjusted harvest score (score / (risk + 1)):")
139+
for row in result["data"]:
140+
print(
141+
f" {row['symbol']:6} score={row['harvest_score']:>3} "
142+
f"risk={row['dealer_flow_risk']:>3} risk_adj={row['risk_adj']:.3f}"
143+
)
144+
145+
# ---------------------------------------------------------------------------
146+
# 8) Macro context filter — only show when VIX is elevated
147+
# ---------------------------------------------------------------------------
148+
result = fa.screener(
149+
filters={
150+
"op": "and",
151+
"conditions": [
152+
{"field": "regime", "operator": "eq", "value": "negative_gamma"},
153+
{"field": "vix", "operator": "gte", "value": 20},
154+
],
155+
},
156+
select=["symbol", "regime", "atm_iv", "vix"],
157+
)
158+
print(f"\nNegative gamma names (VIX >= 20): {result['meta']['total_count']} found")

0 commit comments

Comments
 (0)