Backtest FlashAlpha Options Analytics on QuantConnect LEAN

Backtest FlashAlpha Options Analytics on QuantConnect LEAN

The official flashalpha-quantconnect bridge streams GEX, DEX, VEX, CHEX, vol surfaces, 0DTE pin risk, VRP and 17 endpoint families into QuantConnect LEAN as native custom-data bars - one AddData line per data type, C# on NuGet and Python on PyPI, with golden-file tests pinning the schema. Here is the full setup and a runnable dealer-regime algorithm.

T
Tomasz Dobrowolski Quant Engineer
Jul 24, 2026
6 min read
QuantConnect LEAN Backtesting OptionsData Python CSharp Quant

Searches for QuantConnect options data or LEAN custom data usually end at raw chains - every strike, every quote, and all of the assembly work still ahead of you. What LEAN backtests of dealer-positioning strategies actually need is the computed layer: net gamma exposure, the flip level, pin risk, VRP state, as they stood at each bar's timestamp. That layer is exactly what the bridge streams.

17
Endpoint families as native LEAN bar types
1 line
AddData call per data type, C# or Python
2017
Point-in-time replay start (SPY)

Install

# Python (self-hosted LEAN or QC Cloud project)
pip install flashalpha-quantconnect

# C#
dotnet add package FlashAlpha.QuantConnect

Both packages are official, MIT-licensed, CI-tested, and version-pinned to the underlying FlashAlpha SDK - if the API schema moves, the build breaks instead of your backtest silently drifting. Source: github.com/FlashAlpha-lab/flashalpha-quantconnect.

The bar families

FamilyC# bar classPythonWhat lands in OnData
GEXFlashAlphaGexBarGexBarNet GEX, per-strike gamma, flip level
DEX / VEX / CHEXFlashAlphaDexBar ...DexBar ...Delta / vanna / charm exposure by strike
Exposure summaryFlashAlphaExposureSummaryBarExposureSummaryBarFull dashboard: regime, flip, hedging estimates
LevelsFlashAlphaExposureLevelsBarExposureLevelsBarCall wall, put wall, max-gamma strikes
Vol surfaceFlashAlphaSurfaceBarSurfaceBarSmoothed IV grid
0DTEFlashAlphaZeroDteBarZeroDteBarPin risk, dealer hedging flow, expected move decay
Max pain / Volatility / VRP / Advanced vol / Narrative / quotes / universe...The rest of the seventeen families

A runnable dealer-regime algorithm

This is the bridge's own end-to-end test algorithm (lightly trimmed), which ships in the repo with a committed golden result file - long SPY in positive-gamma regimes, flat in negative:

from AlgorithmImports import *

from flashalpha_quantconnect import add_flashalpha_gex

class GexRegimeFollowing(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2024, 6, 3)
        self.SetCash(100_000)
        self._equity = self.AddEquity("SPY", Resolution.Daily).Symbol
        self._gex = add_flashalpha_gex(self, "SPY").Symbol

    def OnData(self, slice):
        if not slice.ContainsKey(self._gex):
            return
        bar = slice[self._gex]
        if bar is None or bar.NetGex is None:
            return
        # Long-gamma regime: dealers absorb vol. Short-gamma: they amplify it.
        self.SetHoldings(self._equity, 1.0 if bar.NetGex > 0 else 0.0)

Whether that regime filter carries incremental information is a question we have tested honestly elsewhere - see the 8-year GEX backtest and its walk-forward validation before sizing anything on it. The point here is the plumbing: the signal arrives in OnData like any other bar, timestamped point-in-time by the Historical API, so research and live trading share one code path.

Research notebooks

You can see live response shapes before committing to any tier - a free key covers single-name GEX and levels.

QC research nodes allow outbound HTTP, so exploratory work can also hit the REST API directly - useful for endpoint families you want to eyeball before wiring bars:

import requests
r = requests.get("https://historical.flashalpha.com/v1/exposure/summary/SPY",
                 params={"at": "2024-08-05T15:30:00"},
                 headers={"X-Api-Key": API_KEY}).json()
r["regime"], r["gamma_flip"]

The essay collection

A companion repository, flashalpha-historical-examples, is being built in the open: a planned set of 21 LEAN backtest essays (gamma scalping first), each shipped side-by-side in C# and Python with lean.json configs and golden-file validation so every published number is regenerable. Star it if you want the essays as they land.

Access

The bridge reads the Historical API, which is an Alpha tier capability - point-in-time replay since 2017 (SPY from 2017-01-03), response shapes matching live with a few documented deltas. The packages themselves are free and open source. For the wider systematic stack, start with the complete quant backtesting guide and the flow replay article.

LEAN users have been assembling dealer-positioning data by hand for years; the bridge makes it a dependency instead of a project. One package install, one AddData line per family, golden-file schema pinning, and the same endpoints serve your live deployment when the backtest graduates. If you build something on it, the repos take issues and PRs - the integration is developed in the open.

Live Market Pulse

Get fast visibility into market shifts with full-chain analytics over low-latency REST and MCP polling.

Intelligent Screening

Screen millions of option pairs per second using your custom EV rules, filters, and setups.

Export-Ready

Export structured signals to your own execution stack or broker integration - FlashAlpha delivers the analytics, you keep control of order routing.

Join the Community

Discord

Engage in real time conversations with us!

Twitter / X

Follow us for real-time updates and insights!

GitHub

Explore our open-source SDK, examples, and analytics resources!