Skip to content

Commit b7157e0

Browse files
committed
Fix free tier description to match pricing
1 parent 92c8849 commit b7157e0

File tree

4 files changed

+331
-1
lines changed

4 files changed

+331
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for strike in gex["strikes"][:5]:
2727
print(f" {strike['strike']}: net ${strike['net_gex']:,.0f}")
2828
```
2929

30-
Get your free API key at [flashalpha.com](https://flashalpha.com)10 requests/day, no credit card.
30+
Get your free API key at [flashalpha.com](https://flashalpha.com) — no credit card required.
3131

3232
## Features
3333

article-flashalpha-python-sdk.md

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
# FlashAlpha Python SDK: Open-Source Tools for Options Analytics
2+
3+
FlashAlpha provides a REST API for real-time options exposure analytics — gamma exposure (GEX), delta exposure (DEX), vanna exposure (VEX), charm exposure (CHEX), Black-Scholes greeks, implied volatility, 0DTE analytics, volatility surfaces, and dealer positioning data.
4+
5+
To make the API accessible to Python developers, we've published an open-source SDK and a collection of educational repositories on GitHub. This article covers what's available, how to use it, and what each repo is for.
6+
7+
---
8+
9+
## The SDK: `pip install flashalpha`
10+
11+
The Python SDK is a thin wrapper around the FlashAlpha REST API. It handles authentication, error handling, and returns typed Python dicts instead of raw JSON.
12+
13+
**Install:**
14+
15+
```bash
16+
pip install flashalpha
17+
```
18+
19+
**Quick start:**
20+
21+
```python
22+
from flashalpha import FlashAlpha
23+
24+
fa = FlashAlpha("YOUR_API_KEY")
25+
26+
# Gamma exposure by strike
27+
gex = fa.gex("SPY")
28+
print(f"Net GEX: ${gex['net_gex']:,.0f}")
29+
print(f"Gamma flip: {gex['gamma_flip']}")
30+
```
31+
32+
**PyPI:** [pypi.org/project/flashalpha](https://pypi.org/project/flashalpha/)
33+
**Source:** [github.com/FlashAlpha-lab/flashalpha-python](https://github.com/FlashAlpha-lab/flashalpha-python)
34+
35+
### What's Covered
36+
37+
The SDK wraps every live endpoint in the FlashAlpha API:
38+
39+
| Category | Methods | Plan |
40+
|----------|---------|------|
41+
| **Exposure analytics** | `gex()`, `dex()`, `vex()`, `chex()`, `exposure_levels()`, `exposure_summary()`, `narrative()` | Free+ / Growth+ |
42+
| **0DTE analytics** | `zero_dte()` | Growth+ |
43+
| **Market data** | `stock_quote()`, `option_quote()`, `stock_summary()`, `surface()` | Free+ / Growth+ |
44+
| **Historical data** | `historical_stock_quote()`, `historical_option_quote()` | Free+ |
45+
| **Pricing** | `greeks()`, `iv()`, `kelly()` | Free+ / Growth+ |
46+
| **Volatility** | `volatility()`, `adv_volatility()` | Growth+ / Alpha+ |
47+
| **Reference** | `tickers()`, `options()`, `symbols()`, `account()`, `health()` | Free+ |
48+
49+
### Error Handling
50+
51+
The SDK raises specific exceptions for each error type:
52+
53+
```python
54+
from flashalpha import (
55+
FlashAlpha,
56+
AuthenticationError, # 401 — invalid API key
57+
TierRestrictedError, # 403 — endpoint requires higher plan
58+
NotFoundError, # 404 — symbol not found
59+
RateLimitError, # 429 — daily quota exceeded
60+
)
61+
62+
try:
63+
data = fa.exposure_summary("SPY")
64+
except TierRestrictedError as e:
65+
print(f"Need {e.required_plan} plan (you have {e.current_plan})")
66+
except RateLimitError as e:
67+
print(f"Rate limited — retry after {e.retry_after}s")
68+
```
69+
70+
---
71+
72+
## Gamma Exposure Explained
73+
74+
**Repo:** [github.com/FlashAlpha-lab/gex-explained](https://github.com/FlashAlpha-lab/gex-explained)
75+
76+
This repo explains what gamma exposure is, how to calculate it from raw options data, and how to use it for trading. It includes both theory (markdown articles) and runnable Python code.
77+
78+
### Theory
79+
80+
- **What is gamma exposure** — the formula, the intuition, why it matters for price action
81+
- **Dealer hedging mechanics** — how market makers hedge, why positive gamma dampens moves and negative gamma amplifies them
82+
- **GEX regimes** — what happens above vs below the gamma flip level
83+
84+
### Code Examples
85+
86+
| File | What it does |
87+
|------|-------------|
88+
| `compute_gex.py` | Calculates GEX from a raw options chain — the full formula from scratch |
89+
| `gamma_exposure_by_strike.py` | Pulls GEX by strike from the API and displays a per-strike breakdown |
90+
| `gamma_flip_level_tracker.py` | Tracks gamma flip, call wall, put wall, max pain, and 0DTE magnet |
91+
| `call_wall_put_wall_finder.py` | Scans multiple symbols (SPY, QQQ, AAPL, TSLA, NVDA) for support/resistance levels |
92+
| `dealer_hedging_flow_analysis.py` | Shows estimated dealer hedging flows at +/-1% spot moves |
93+
| `gex_trading_spy_tsla_qqq.py` | Full GEX analysis across SPY, TSLA, QQQ — regime, levels, narrative |
94+
| `exposure_narrative_analysis.py` | AI-generated exposure narrative — regime, flow, vanna, charm, outlook |
95+
| `delta_vanna_charm_exposure.py` | DEX, VEX, CHEX analysis — second-order exposure beyond gamma |
96+
97+
### Example: Key Levels
98+
99+
```python
100+
from flashalpha import FlashAlpha
101+
102+
fa = FlashAlpha("YOUR_API_KEY")
103+
104+
levels = fa.exposure_levels("SPY")
105+
lvl = levels["levels"]
106+
print(f"Gamma flip: {lvl['gamma_flip']}")
107+
print(f"Call wall: {lvl['call_wall']} (resistance)")
108+
print(f"Put wall: {lvl['put_wall']} (support)")
109+
print(f"Max pain: {lvl['max_pain']}")
110+
```
111+
112+
**Further reading:** [GEX Trading Guide — How to Read and Trade Gamma Exposure](https://flashalpha.com/articles/gex-trading-guide-gamma-exposure-api-spy-tsla)
113+
114+
---
115+
116+
## 0DTE Options Analytics
117+
118+
**Repo:** [github.com/FlashAlpha-lab/0dte-options-analytics](https://github.com/FlashAlpha-lab/0dte-options-analytics)
119+
120+
Zero-days-to-expiration (0DTE) options now account for over 40% of SPX options volume on some days. This repo provides Python examples for analyzing 0DTE dynamics in real time: pin risk, expected move, gamma regime, dealer hedging, and theta decay.
121+
122+
### Why 0DTE Matters
123+
124+
0DTE options behave differently from longer-dated contracts:
125+
126+
- **Gamma is 2-10x higher** than equivalent 7DTE options — small spot moves create large hedging flows
127+
- **Theta accelerates exponentially** — a $5 option at 9:30 AM can be worth $0.10 by 3:30 PM
128+
- **Pin risk is real** — high OI concentration at round strikes creates "magnetic" price action
129+
- **Expected move shrinks in real time** — remaining 1SD at 3:00 PM is much smaller than at open
130+
131+
### Code Examples
132+
133+
| File | What it does |
134+
|------|-------------|
135+
| `0dte_pin_risk_analysis.py` | Pin score (0-100), magnet strike, OI concentration, max pain |
136+
| `0dte_expected_move_calculator.py` | Full-day and remaining 1SD, straddle price, upper/lower bounds |
137+
| `0dte_gamma_regime_tracker.py` | Positive vs negative gamma, gamma flip, % of total GEX from 0DTE |
138+
| `0dte_dealer_hedging_flows.py` | Dealer hedging at +/-0.5% and +/-1% moves (shares, notional, direction) |
139+
| `0dte_theta_decay_monitor.py` | Net theta, theta per hour remaining, charm regime, gamma acceleration |
140+
| `0dte_spy_intraday_playbook.py` | Complete intraday report combining all sections |
141+
| `0dte_trading_strategies.py` | 5 strategies: pin play, gamma scalp, vol crush, momentum fade, straddle |
142+
| `0dte_vol_context_analysis.py` | 0DTE vs 7DTE IV ratio, VIX, vanna exposure, vol regime |
143+
144+
### Example: Pin Risk
145+
146+
```python
147+
from flashalpha import FlashAlpha
148+
149+
fa = FlashAlpha("YOUR_API_KEY")
150+
151+
dte = fa.zero_dte("SPY")
152+
pin = dte["pin_risk"]
153+
print(f"Pin score: {pin['pin_score']}/100")
154+
print(f"Magnet strike: {pin['magnet_strike']}")
155+
print(f"Distance: {pin['distance_to_magnet_pct']:.2f}%")
156+
print(f"Max pain: {pin['max_pain']}")
157+
print(f"Top 3 OI: {pin['oi_concentration_top3_pct']:.1f}%")
158+
```
159+
160+
A pin score above 70 with spot within 0.15% of the magnet strike suggests a high probability of pinning near that strike into close.
161+
162+
### Example: Expected Move (Time-Adjusted)
163+
164+
```python
165+
em = dte["expected_move"]
166+
print(f"Full-day 1SD: +/-${em['implied_1sd_dollars']:.2f}")
167+
print(f"Remaining 1SD: +/-${em['remaining_1sd_dollars']:.2f}")
168+
print(f"Range: ${em['lower_bound']:.2f} - ${em['upper_bound']:.2f}")
169+
print(f"ATM straddle: ${em['straddle_price']:.2f}")
170+
```
171+
172+
The remaining expected move shrinks as the day progresses. At 3:00 PM, it's roughly 27% of the full-day move. This is how 0DTE straddle sellers profit — they sell the full implied move and collect as theta decays it.
173+
174+
**Further reading:**
175+
- [0DTE SPY: The Complete Intraday Playbook](https://flashalpha.com/articles/0dte-spy-complete-intraday-playbook-same-day-options)
176+
- [0DTE Gamma Exposure and Pin Risk](https://flashalpha.com/articles/0dte-gamma-exposure-pin-risk-intraday-options-analytics)
177+
- [Guide to 0DTE Trading Strategies](https://flashalpha.com/articles/guide-to-0dte-trading-strategies-real-time-data)
178+
179+
---
180+
181+
## Volatility Surface Analysis
182+
183+
**Repo:** [github.com/FlashAlpha-lab/volatility-surface-python](https://github.com/FlashAlpha-lab/volatility-surface-python)
184+
185+
This repo covers implied volatility surface construction, SVI calibration, variance swap pricing, arbitrage detection, and volatility analytics. It targets the Alpha tier of the API, which provides raw SVI parameters, total variance grids, and higher-order greeks surfaces.
186+
187+
### What's an Implied Volatility Surface?
188+
189+
An implied volatility surface maps IV across two dimensions: strike (or moneyness) and expiration. It reveals the market's view of risk across different outcomes and time horizons. Key features:
190+
191+
- **Skew** — puts trade at higher IV than calls (crash protection premium)
192+
- **Term structure** — near-term vs long-term IV (contango = calm, backwardation = fear)
193+
- **Smile** — deep OTM options on both sides trade at higher IV than ATM
194+
195+
### SVI Parameterization
196+
197+
The API fits Gatheral's SVI (Stochastic Volatility Inspired) model to each expiry slice:
198+
199+
```
200+
w(k) = a + b(rho(k - m) + sqrt((k - m)^2 + sigma^2))
201+
```
202+
203+
Where `k` is log-moneyness, and `a`, `b`, `rho`, `m`, `sigma` are the five SVI parameters. This gives a smooth, arbitrage-constrained representation of the smile.
204+
205+
### Code Examples
206+
207+
| File | What it does |
208+
|------|-------------|
209+
| `implied_volatility_surface.py` | Total variance surface grid — moneyness x expiry |
210+
| `svi_calibration_example.py` | Raw SVI parameters per expiry with analytical smile reconstruction |
211+
| `variance_swap_pricing.py` | Fair variance, fair vol, convexity adjustment per expiry |
212+
| `volatility_skew_analysis.py` | 10-delta/25-delta put/call skew, risk reversal, smile ratio |
213+
| `realized_vs_implied_volatility.py` | RV across 5 windows, VRP, and strategy guidance |
214+
| `volatility_term_structure.py` | Contango/backwardation shape, near/far slope |
215+
| `arbitrage_detection_butterfly_calendar.py` | Butterfly and calendar arbitrage violations |
216+
| `greeks_surface_vanna_charm.py` | Vanna, charm, volga, speed surfaces across strikes and expiries |
217+
| `iv_rank_scanner.py` | Multi-symbol IV rank scanner |
218+
| `vol_risk_premium_analysis.py` | Deep-dive VRP analysis with trade signals |
219+
| `forward_implied_volatility.py` | Implied forward prices and cost-of-carry basis |
220+
221+
### Example: SVI Parameters
222+
223+
```python
224+
from flashalpha import FlashAlpha
225+
226+
fa = FlashAlpha("YOUR_API_KEY")
227+
228+
adv = fa.adv_volatility("SPY")
229+
for s in adv["svi_parameters"]:
230+
print(f"{s['expiry']} ({s['days_to_expiry']}d)")
231+
print(f" a={s['a']:.6f} b={s['b']:.6f} rho={s['rho']:.4f}")
232+
print(f" m={s['m']:.6f} sigma={s['sigma']:.6f}")
233+
print(f" ATM IV: {s['atm_iv']:.2f}% Forward: {s['forward']:.2f}")
234+
```
235+
236+
### Example: Realized vs Implied Volatility
237+
238+
```python
239+
vol = fa.volatility("TSLA")
240+
print(f"ATM IV: {vol['atm_iv']:.1f}%")
241+
print(f"RV 20d: {vol['realized_vol']['rv_20d']:.1f}%")
242+
print(f"VRP: {vol['iv_rv_spreads']['vrp_20d']:.1f}%")
243+
print(f"Assessment: {vol['iv_rv_spreads']['assessment']}")
244+
```
245+
246+
When IV is significantly above realized vol (positive VRP), options are "expensive" — favoring premium sellers. When VRP is negative, options are cheap relative to actual moves.
247+
248+
**Further reading:**
249+
- [Advanced Volatility API: SVI, Variance Surface, Arbitrage Detection](https://flashalpha.com/articles/advanced-volatility-api-svi-variance-surface-arbitrage-detection)
250+
- [Realized vs Implied Volatility Risk Premium](https://flashalpha.com/articles/realized-vs-implied-volatility-risk-premium)
251+
- [Volatility Term Structure: Contango, Backwardation, and Events](https://flashalpha.com/articles/volatility-term-structure-contango-backwardation-events)
252+
253+
---
254+
255+
## More Examples
256+
257+
**Repo:** [github.com/FlashAlpha-lab/flashalpha-examples](https://github.com/FlashAlpha-lab/flashalpha-examples)
258+
259+
Runnable Python examples covering the full API:
260+
261+
| Example | What it shows |
262+
|---------|-------------|
263+
| `01_quick_start.py` | First API call — GEX for SPY in 3 lines |
264+
| `02_gex_dashboard.py` | GEX dashboard with levels and regime |
265+
| `03_iv_rank_scanner.py` | IV rank scanner across multiple symbols |
266+
| `04_vol_surface_3d.py` | 3D volatility surface visualization |
267+
| `05_dealer_positioning.py` | Dealer positioning analysis with hedging estimates |
268+
| `06_kelly_sizing.py` | Kelly criterion position sizing for options |
269+
| `07_zero_dte_analytics.py` | 0DTE intraday analysis |
270+
| `08_advanced_volatility.py` | SVI parameters, variance surface, arbitrage detection |
271+
| `09_volatility_analysis.py` | Comprehensive volatility analysis |
272+
273+
---
274+
275+
## API Plans
276+
277+
| Plan | Daily Requests | Access |
278+
|------|---------------|--------|
279+
| **Free** | 10 | Stock quotes, GEX/DEX/VEX/CHEX by strike, levels, BSM greeks, IV, historical quotes, vol surface, stock summary |
280+
| **Basic** | 250 | Everything in Free + index symbols (SPX, VIX, RUT) |
281+
| **Growth** | 2,500 | + Exposure summary, narrative, 0DTE analytics, volatility analytics, option quotes, full-chain GEX, Kelly sizing |
282+
| **Alpha** | Unlimited | + Advanced volatility (SVI parameters, variance surfaces, arbitrage detection, greeks surfaces, variance swap pricing) |
283+
284+
Get your free API key at [flashalpha.com](https://flashalpha.com).
285+
286+
---
287+
288+
## Test Coverage
289+
290+
Every repo includes comprehensive unit tests (mocked, no API key needed) and integration tests (live API). Total across all repos:
291+
292+
| Repo | Unit tests | Integration tests |
293+
|------|-----------|------------------|
294+
| flashalpha-python | 36 | 23 |
295+
| 0dte-options-analytics | 27 | 15 |
296+
| gex-explained | 44 | 18 |
297+
| volatility-surface-python | 20 | 15 |
298+
| **Total** | **127** | **71** |
299+
300+
---
301+
302+
## Links
303+
304+
- [FlashAlpha](https://flashalpha.com) — API keys, docs, pricing
305+
- [API Documentation](https://flashalpha.com/docs)
306+
- [Python SDK (PyPI)](https://pypi.org/project/flashalpha/)
307+
- [GitHub Organization](https://github.com/FlashAlpha-lab)
308+
309+
### All Repositories
310+
311+
| Repo | Description |
312+
|------|-------------|
313+
| [flashalpha-python](https://github.com/FlashAlpha-lab/flashalpha-python) | Python SDK — `pip install flashalpha` |
314+
| [gex-explained](https://github.com/FlashAlpha-lab/gex-explained) | Gamma exposure theory, math, and Python code |
315+
| [0dte-options-analytics](https://github.com/FlashAlpha-lab/0dte-options-analytics) | 0DTE pin risk, expected move, dealer hedging, theta decay |
316+
| [volatility-surface-python](https://github.com/FlashAlpha-lab/volatility-surface-python) | SVI calibration, variance swap, skew, term structure |
317+
| [flashalpha-examples](https://github.com/FlashAlpha-lab/flashalpha-examples) | Runnable examples and tutorials |
318+
| [awesome-options-analytics](https://github.com/FlashAlpha-lab/awesome-options-analytics) | Curated list of options analytics resources |
319+
320+
### Articles
321+
322+
- [GEX Trading Guide — How to Read and Trade Gamma Exposure](https://flashalpha.com/articles/gex-trading-guide-gamma-exposure-api-spy-tsla)
323+
- [0DTE SPY: The Complete Intraday Playbook](https://flashalpha.com/articles/0dte-spy-complete-intraday-playbook-same-day-options)
324+
- [0DTE Gamma Exposure and Pin Risk](https://flashalpha.com/articles/0dte-gamma-exposure-pin-risk-intraday-options-analytics)
325+
- [Guide to 0DTE Trading Strategies](https://flashalpha.com/articles/guide-to-0dte-trading-strategies-real-time-data)
326+
- [Advanced Volatility API: SVI, Variance Surface, Arbitrage Detection](https://flashalpha.com/articles/advanced-volatility-api-svi-variance-surface-arbitrage-detection)
327+
- [Realized vs Implied Volatility Risk Premium](https://flashalpha.com/articles/realized-vs-implied-volatility-risk-premium)
328+
- [Volatility Term Structure: Contango, Backwardation, and Events](https://flashalpha.com/articles/volatility-term-structure-contango-backwardation-events)

awesome-investing

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 138b7793d0bd111ec77826c85e324e191b1a58ce

awesome_investing

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 05fa7d11257fffc4ae5076773a69d46f3c0bd6df

0 commit comments

Comments
 (0)