DEV Community

tomasz dobrowolski
tomasz dobrowolski

Posted on • Originally published at flashalpha.com

FlashAlpha Python SDK: Open-Source Tools for Options Analytics

Building real-time options analytics from scratch is a serious engineering problem. You need an options data feed ($500-5,000/mo), Greeks computation with American exercise and dividend adjustments, exposure aggregation across thousands of strikes, infrastructure to run during market hours, and ongoing maintenance as 0DTE volumes evolve.

FlashAlpha eliminates all of that. One API key, one SDK, one line of code. Five open-source GitHub repos give you working code to learn from, modify, and deploy.


Getting Started in 60 Seconds

pip install flashalpha
Enter fullscreen mode Exit fullscreen mode
from flashalpha import FlashAlpha

fa = FlashAlpha("YOUR_API_KEY")

# Gamma exposure for SPY
gex = fa.gex("SPY")
print(f"Net GEX: ${gex['net_gex']:,.0f}")
print(f"Gamma flip: {gex['gamma_flip']}")
print(f"Regime: {'Positive - mean reverting' if gex['net_gex'] > 0 else 'Negative - trending'}")
Enter fullscreen mode Exit fullscreen mode

No HTTP setup, no headers, no JSON parsing. The SDK handles auth, retries on transient failures, and raises typed exceptions for every error condition.

The key levels endpoint returns the five structural levels that define dealer positioning:

levels = fa.exposure_levels("SPY")
lvl = levels["levels"]

print(f"Gamma flip:          {lvl['gamma_flip']}")
print(f"Call wall:           {lvl['call_wall']}")
print(f"Put wall:            {lvl['put_wall']}")
print(f"Max positive gamma:  {lvl['max_positive_gamma']}")
print(f"Max negative gamma:  {lvl['max_negative_gamma']}")
print(f"0DTE magnet:         {lvl['zero_dte_magnet']}")
Enter fullscreen mode Exit fullscreen mode

These are structural levels created by billions of dollars of mechanical dealer hedging flow, not chart patterns.

Get your API key: flashalpha.com/pricing — free tier, 10 req/day, no credit card.


SDK Architecture

Principle Detail
Zero dependencies Only requests. No framework lock-in.
Typed exceptions AuthenticationError, TierRestrictedError, RateLimitError, NotFoundError
Automatic retries Exponential backoff on 5xx and timeouts
Pass-through responses Field names match the API docs exactly

Complete Method Reference

Category Methods Min. Plan
Exposure analytics gex(), dex(), vex(), chex(), exposure_levels(), exposure_summary(), narrative() Free / Growth
0DTE analytics zero_dte() Growth
Market data stock_quote(), option_quote(), stock_summary(), surface() Free / Growth
Historical data historical_stock_quote(), historical_option_quote() Free
Pricing & greeks greeks(), iv(), kelly() Free / Growth
Volatility volatility(), adv_volatility() Growth / Alpha
Reference tickers(), options(), symbols(), account(), health() Free

Error Handling

from flashalpha import (
    FlashAlpha,
    AuthenticationError,    # 401 - bad or missing API key
    TierRestrictedError,    # 403 - endpoint requires higher plan
    NotFoundError,          # 404 - ticker not found
    RateLimitError,         # 429 - daily quota exceeded
)

fa = FlashAlpha("YOUR_API_KEY")

def get_full_analysis(symbol):
    result = {"symbol": symbol}

    try:
        result["gex"] = fa.exposure_levels(symbol)
    except NotFoundError:
        print(f"{symbol}: not found - skipping")
        return None
    except RateLimitError as e:
        print(f"Rate limited - retry after {e.retry_after}s")
        return None

    # 0DTE requires Growth - handle gracefully
    try:
        result["zero_dte"] = fa.zero_dte(symbol)
    except TierRestrictedError as e:
        print(f"0DTE requires {e.required_plan} (you have {e.current_plan})")
        result["zero_dte"] = None

    return result
Enter fullscreen mode Exit fullscreen mode

This pattern — try the call, catch the specific exception, continue with what you have — is the recommended way to build multi-endpoint workflows.


Build a GEX Dashboard — Multi-Symbol Scanner

Repo: github.com/FlashAlpha-lab/gex-explained

When net GEX is positive, dealers buy dips and sell rallies — stabilizing price. When negative, they amplify moves. This scanner checks your entire watchlist:

from flashalpha import FlashAlpha

fa = FlashAlpha("YOUR_API_KEY")
watchlist = ["SPY", "QQQ", "TSLA", "NVDA", "AAPL", "AMZN", "META", "AMD"]

print(f"{'Symbol':<8} {'Net GEX':>12} {'Regime':<12} {'Flip':>10} {'Call Wall':>11} {'Put Wall':>10}")
print("-" * 73)

for symbol in watchlist:
    try:
        levels = fa.exposure_levels(symbol)
        summary = fa.exposure_summary(symbol)
        lvl = levels["levels"]

        regime = "POSITIVE" if summary["net_gex"] > 0 else "NEGATIVE"

        print(f"{symbol:<8} ${summary['net_gex']:>11,.0f} {regime:<12} "
              f"{lvl['gamma_flip']:>10} {lvl['call_wall']:>11} {lvl['put_wall']:>10}")

        if regime == "NEGATIVE":
            print(f"  >> WARNING: {symbol} in negative gamma - expect amplified moves")
        if lvl.get("zero_dte_magnet"):
            print(f"  >> 0DTE magnet at {lvl['zero_dte_magnet']} - watch for pin into close")

    except Exception as e:
        print(f"{symbol:<8} Error: {e}")
Enter fullscreen mode Exit fullscreen mode

This 25-line script replaces a Bloomberg terminal's GEX screen. Run it before the open to know which symbols are safe to sell premium and which are dangerous.

What each level means:

  • Gamma flip — the most important level. Above it, dealers stabilize. Below it, dealers amplify.
  • Call wall — highest call gamma. Resistance. Dealers sell into rallies here.
  • Put wall — highest put gamma. Support, but dangerous. Break below triggers cascading selling.
  • 0DTE magnet — strongest gravitational pull from zero-day options. Dominant in the last 2 hours.

0DTE Morning Pre-Flight

Repo: github.com/FlashAlpha-lab/0dte-options-analytics

Zero-day options are now 40%+ of SPY volume. Gamma is 2-10x higher than weeklies. The zero_dte() endpoint packs everything into one call:

from flashalpha import FlashAlpha

fa = FlashAlpha("YOUR_API_KEY")
zdte = fa.zero_dte("SPY")

# Regime
regime = zdte["regime"]
print(f"Regime:        {regime['label']}")
print(f"Gamma flip:    {regime['gamma_flip']}")

# Pin risk
pin = zdte["pin_risk"]
print(f"Pin score:     {pin['pin_score']}/100")
print(f"Magnet strike: ${pin['magnet_strike']}")

# Expected move
em = zdte["expected_move"]
print(f"Implied 1SD:   +-${em['implied_1sd_dollars']:.2f}")
print(f"Straddle:      ${em['straddle_price']:.2f}")

# Theta decay
decay = zdte["decay"]
print(f"Theta/hr:      ${decay['theta_per_hour_remaining']:.2f}")
print(f"Gamma accel:   {decay['gamma_acceleration']:.4f}")

# Vol context
vol = zdte["vol_context"]
print(f"0DTE IV:       {vol['zero_dte_atm_iv']:.1f}%")
print(f"7DTE IV:       {vol['seven_dte_atm_iv']:.1f}%")
print(f"IV ratio:      {vol['iv_ratio_0dte_7dte']:.2f}")

# Decision framework
if pin["pin_score"] >= 70:
    print("HIGH PIN RISK - sell butterflies around magnet strike")
if vol["iv_ratio_0dte_7dte"] > 1.15:
    print("0DTE IV ELEVATED - premium selling has edge")
if regime["label"] == "Negative Gamma":
    print("NEGATIVE GAMMA - trending day, use momentum strategies")
Enter fullscreen mode Exit fullscreen mode

Complete decision framework in under 2 seconds. Every signal has a direct trading implication.


Volatility Scanner — VRP Opportunities

Repo: github.com/FlashAlpha-lab/volatility-surface-python

The volatility risk premium — the spread between implied and realized vol — is one of the most persistent edges in options. This scanner finds the best opportunities:

from flashalpha import FlashAlpha

fa = FlashAlpha("YOUR_API_KEY")
watchlist = ["SPY", "QQQ", "AAPL", "TSLA", "NVDA", "AMZN", "META", "AMD", "MSFT", "GOOGL"]

results = []
for symbol in watchlist:
    try:
        vol = fa.volatility(symbol)
        results.append({
            "symbol": symbol,
            "atm_iv": vol["atm_iv"],
            "rv_20d": vol["realized_vol"]["rv_20d"],
            "vrp_20d": vol["iv_rv_spreads"]["vrp_20d"],
            "assessment": vol["iv_rv_spreads"]["assessment"],
        })
    except Exception as e:
        print(f"{symbol}: {e}")

results.sort(key=lambda x: x["vrp_20d"], reverse=True)

print(f"\n{'Symbol':<8} {'ATM IV':>8} {'RV 20d':>8} {'VRP':>9} {'Assessment'}")
print("-" * 50)
for r in results:
    print(f"{r['symbol']:<8} {r['atm_iv']:>7.1f}% {r['rv_20d']:>7.1f}% "
          f"{r['vrp_20d']:>+8.1f}% {r['assessment']}")
Enter fullscreen mode Exit fullscreen mode

Positive VRP = IV overpricing actual movement = sell premium. Negative VRP = market underpricing risk = buy protection.

The endpoint also returns full skew profiles across expirations:

vol = fa.volatility("SPY")

for profile in vol["skew_profiles"]:
    print(f"{profile['expiry']}: "
          f"25d Put={profile['put_25d_iv']:.1f}% "
          f"ATM={profile['atm_iv']:.1f}% "
          f"25d Call={profile['call_25d_iv']:.1f}% "
          f"Skew={profile['skew_25d']:+.1f}%")
Enter fullscreen mode Exit fullscreen mode

A skew of -5% means 25-delta puts are 5 points more expensive than calls. Track this over time to spot when the market shifts from complacency to fear.


Production Client Wrapper

For production code, wrap the SDK with caching and graceful degradation:

import logging
from datetime import datetime, timedelta
from flashalpha import FlashAlpha, RateLimitError, NotFoundError

logger = logging.getLogger("flashalpha")

class FAClient:
    def __init__(self, api_key, cache_ttl_seconds=300):
        self.fa = FlashAlpha(api_key)
        self.cache = {}
        self.ttl = timedelta(seconds=cache_ttl_seconds)

    def _cached(self, key, fn):
        now = datetime.now()
        if key in self.cache:
            data, ts = self.cache[key]
            if now - ts < self.ttl:
                return data
        try:
            data = fn()
            self.cache[key] = (data, now)
            return data
        except RateLimitError as e:
            logger.warning(f"Rate limited - retry after {e.retry_after}s")
            if key in self.cache:
                return self.cache[key][0]  # Return stale data
            raise
        except NotFoundError:
            logger.warning(f"Not found: {key}")
            return None

    def levels(self, symbol):
        return self._cached(f"levels:{symbol}", lambda: self.fa.exposure_levels(symbol))

    def zero_dte(self, symbol):
        return self._cached(f"0dte:{symbol}", lambda: self.fa.zero_dte(symbol))

    def vol(self, symbol):
        return self._cached(f"vol:{symbol}", lambda: self.fa.volatility(symbol))
Enter fullscreen mode Exit fullscreen mode

5-minute cache, fallback to stale data on rate limits, structured logging. Every production example builds on this pattern.


SVI Parameters and Advanced Volatility

For quant teams, the Alpha plan returns raw SVI parameters per expiry (Gatheral's a, b, rho, m, sigma), total variance surface grids, butterfly/calendar arbitrage detection, variance swap fair values, and second/third-order greeks surfaces (vanna, charm, volga, speed).

data = fa.adv_volatility("SPY")

for s in data["svi_parameters"]:
    print(f"{s['expiry']} ({s['days_to_expiry']}d): "
          f"a={s['a']:.6f}  b={s['b']:.6f}  rho={s['rho']:.4f}  "
          f"ATM IV={s['atm_iv']:.1f}%")

# Arb detection
flags = data["arbitrage_flags"]
if flags:
    for f in flags:
        print(f"[{f['type']}] {f['expiry']}: {f['description']}")
else:
    print("Surface is arbitrage-free")
Enter fullscreen mode Exit fullscreen mode

Alpha plan: $14,388/year ($1,199/mo annual). A single engineer maintaining SVI fitting infrastructure costs 10x that. A Bloomberg terminal is $24,000/year and doesn't give you raw SVI parameters via API.


Open Source Repos

Repo What It Does
flashalpha-python The SDK itself. Source code, typed exceptions, retry logic.
gex-explained GEX theory + practical scanner code
0dte-options-analytics 0DTE pre-flight, pin risk, theta decay
volatility-surface-python IV surface building, SVI calibration, arb detection
flashalpha-examples Standalone scripts for every endpoint

Pricing

Plan Price Requests/day Highlights
Free $0 10 GEX, DEX, levels, quotes, Greeks
Growth $299/mo 2,500 + 0DTE, volatility, all exposure endpoints
Alpha $1,199/mo annual Unlimited + SVI surfaces, advanced vol, zero cache

Free tier: no credit card required. Enough to run every example in this guide.

Related guides:

Top comments (0)