{"id":50510562,"url":"https://github.com/flashalpha-lab/flashalpha-quantconnect","last_synced_at":"2026-06-02T20:00:40.322Z","repository":{"id":361357206,"uuid":"1254126408","full_name":"FlashAlpha-lab/flashalpha-quantconnect","owner":"FlashAlpha-lab","description":"FlashAlpha options-flow \u0026 dealer-positioning data as QuantConnect LEAN custom-data bars (C# + Python)","archived":false,"fork":false,"pushed_at":"2026-05-30T08:31:14.000Z","size":586,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-30T10:11:38.841Z","etag":null,"topics":["0dte","algorithmic-trading","backtesting","csharp","custom-data","dealer-positioning","dex","flashalpha","gex","lean","options","python","quantconnect","vex","vol-surface","vrp"],"latest_commit_sha":null,"homepage":"https://historical.flashalpha.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FlashAlpha-lab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-30T07:09:20.000Z","updated_at":"2026-05-30T08:31:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/FlashAlpha-lab/flashalpha-quantconnect","commit_stats":null,"previous_names":["flashalpha-lab/flashalpha-quantconnect"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/FlashAlpha-lab/flashalpha-quantconnect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlashAlpha-lab%2Fflashalpha-quantconnect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlashAlpha-lab%2Fflashalpha-quantconnect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlashAlpha-lab%2Fflashalpha-quantconnect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlashAlpha-lab%2Fflashalpha-quantconnect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlashAlpha-lab","download_url":"https://codeload.github.com/FlashAlpha-lab/flashalpha-quantconnect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlashAlpha-lab%2Fflashalpha-quantconnect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33733754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["0dte","algorithmic-trading","backtesting","csharp","custom-data","dealer-positioning","dex","flashalpha","gex","lean","options","python","quantconnect","vex","vol-surface","vrp"],"created_at":"2026-06-02T20:00:33.112Z","updated_at":"2026-06-02T20:00:40.307Z","avatar_url":"https://github.com/FlashAlpha-lab.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flashalpha-quantconnect\n\n**FlashAlpha options-flow and dealer-positioning data as native QuantConnect LEAN custom-data bars — C# (NuGet) and Python (PyPI).**\n\nSubscribe to GEX (gamma exposure), DEX, VEX, CHEX, the full exposure summary, a smoothed implied-vol surface, 0DTE pin-risk + dealer hedging flows, max-pain, VRP (variance risk premium), advanced volatility (SVI, variance swaps), narrative summaries, stock + option quote books, a coverage universe — seventeen endpoint families — and read them from `OnData` exactly like any other LEAN bar. Backtest dealer-flow strategies on QuantConnect Cloud or self-hosted LEAN with one `AddData\u003c…\u003e` line per data type.\n\n[![NuGet](https://img.shields.io/nuget/v/FlashAlpha.QuantConnect.svg)](https://www.nuget.org/packages/FlashAlpha.QuantConnect)\n[![PyPI](https://img.shields.io/pypi/v/flashalpha-quantconnect.svg)](https://pypi.org/project/flashalpha-quantconnect/)\n[![CI](https://github.com/FlashAlpha-lab/flashalpha-quantconnect/actions/workflows/ci.yml/badge.svg)](https://github.com/FlashAlpha-lab/flashalpha-quantconnect/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n---\n\n## What it does\n\n`flashalpha-quantconnect` is the official QuantConnect LEAN bridge for the [FlashAlpha historical API](https://historical.flashalpha.com). It plumbs FlashAlpha's options-flow and dealer-positioning analytics into LEAN as first-class custom-data bars so a backtest just calls `AddData\u003cFlashAlphaGexBar\u003e(\"SPY\")` (or `algorithm.AddData(GexBar, \"SPY\")` in Python) and the bars stream into `OnData` with full per-strike detail — gamma flips, pin probabilities, IV grids, 0DTE Greeks, VRP scores — all timestamped, all replayable, all version-pinned to the underlying SDK so schema drift dies at compile time.\n\n| Family             | Endpoint slug         | C# bar class                          | Python bar class           |\n| ------------------ | --------------------- | ------------------------------------- | -------------------------- |\n| GEX                | `exposure/gex`        | `FlashAlphaGexBar`                    | `GexBar`                   |\n| DEX                | `exposure/dex`        | `FlashAlphaDexBar`                    | `DexBar`                   |\n| VEX                | `exposure/vex`        | `FlashAlphaVexBar`                    | `VexBar`                   |\n| CHEX               | `exposure/chex`       | `FlashAlphaChexBar`                   | `ChexBar`                  |\n| Exposure summary   | `exposure/summary`    | `FlashAlphaExposureSummaryBar`        | `ExposureSummaryBar`       |\n| Exposure levels    | `exposure/levels`     | `FlashAlphaExposureLevelsBar`         | `ExposureLevelsBar`        |\n| Vol surface        | `surface`             | `FlashAlphaSurfaceBar`                | `SurfaceBar`               |\n| Zero-DTE           | `exposure/zero-dte`   | `FlashAlphaZeroDteBar`                | `ZeroDteBar`               |\n| Max pain           | `max-pain`            | `FlashAlphaMaxPainBar`                | `MaxPainBar`               |\n| Volatility         | `volatility`          | `FlashAlphaVolatilityBar`             | `VolatilityBar`            |\n| Advanced vol       | `adv-volatility`      | `FlashAlphaAdvVolatilityBar`          | `AdvVolatilityBar`         |\n| VRP                | `vrp`                 | `FlashAlphaVrpBar`                    | `VrpBar`                   |\n| Narrative          | `narrative`           | `FlashAlphaNarrativeBar`              | `NarrativeBar`             |\n| Stock summary      | `stock/summary`       | `FlashAlphaStockSummaryBar`           | `StockSummaryBar`          |\n| Stock quote        | `stock/quote`         | `FlashAlphaStockQuoteBar`             | `StockQuoteBar`            |\n| Option quote       | `option/quote`        | `FlashAlphaOptionQuoteBar`            | `OptionQuoteBar`           |\n| Tickers (coverage) | `tickers`             | `FlashAlphaTickersBar` + universe     | `TickersBar` + universe    |\n\nFull reference: [docs/data-types.md](docs/data-types.md).\n\n---\n\n## Install\n\n### QuantConnect Cloud (C# or Python)\n\nBoth packages are pre-installed in QC Cloud — no `pip install` or NuGet ceremony. Add your API key to **Project → Parameters** with the key `flashalpha-api-key` and paste the value (get one at [flashalpha.com](https://flashalpha.com)). The bridge resolves it via `GetParameter` on the first request.\n\n### Self-hosted LEAN — C# (NuGet)\n\n```bash\ndotnet add package FlashAlpha.QuantConnect\n```\n\nOr in `.csproj`:\n\n```xml\n\u003cPackageReference Include=\"FlashAlpha.QuantConnect\" Version=\"0.1.0\" /\u003e\n```\n\nSet the key as an env var so LEAN picks it up:\n\n```bash\nexport FLASHALPHA_API_KEY=\"fa_live_...\"\n```\n\n### Self-hosted LEAN — Python (PyPI)\n\n```bash\npip install flashalpha-quantconnect\n```\n\nSame env var:\n\n```bash\nexport FLASHALPHA_API_KEY=\"fa_live_...\"\n```\n\nFull auth setup — including CI secrets and key resolution order — lives in [docs/auth.md](docs/auth.md).\n\n---\n\n## QuantConnect GEX — first algorithm\n\nLong when the dealer gamma regime is positive, flat otherwise. Sixty seconds, both languages.\n\n**C#**\n\n```csharp\nusing FlashAlpha.QuantConnect;\nusing FlashAlpha.QuantConnect.Data;\nusing QuantConnect;\nusing QuantConnect.Algorithm;\nusing QuantConnect.Data;\n\npublic class GexRegimeAlgorithm : QCAlgorithm\n{\n    private Symbol _spy;\n    private Symbol _gex;\n\n    public override void Initialize()\n    {\n        SetStartDate(2024, 1, 1);\n        SetEndDate(2024, 12, 31);\n        SetCash(100_000);\n\n        _spy = AddEquity(\"SPY\", Resolution.Daily).Symbol;\n        _gex = this.AddFlashAlphaGex(\"SPY\").Symbol;\n    }\n\n    public override void OnData(Slice slice)\n    {\n        if (!slice.ContainsKey(_gex)) return;\n        var bar = slice.Get\u003cFlashAlphaGexBar\u003e(_gex);\n        if (bar == null) return;\n\n        var longRegime = bar.NetGexLabel == \"positive\";\n        SetHoldings(_spy, longRegime ? 1.0m : 0m);\n    }\n}\n```\n\n**Python**\n\n```python\nfrom AlgorithmImports import *\nfrom flashalpha_quantconnect import GexBar, add_flashalpha_gex\n\n\nclass GexRegimeAlgorithm(QCAlgorithm):\n    def Initialize(self):\n        self.SetStartDate(2024, 1, 1)\n        self.SetEndDate(2024, 12, 31)\n        self.SetCash(100_000)\n\n        self.spy = self.AddEquity(\"SPY\", Resolution.Daily).Symbol\n        self.gex = add_flashalpha_gex(self, \"SPY\").Symbol\n\n    def OnData(self, slice):\n        if self.gex not in slice:\n            return\n        bar = slice[self.gex]\n        long_regime = bar.NetGexLabel == \"positive\"\n        self.SetHoldings(self.spy, 1.0 if long_regime else 0.0)\n```\n\nFive more end-to-end recipes — pair-by-ticker with equity bars, 0DTE pin-risk gating, vol-surface snapshots, universe selection by GEX regime — are in [docs/recipes/](docs/recipes/).\n\n---\n\n## Data catalog\n\nEvery bar lives at `https://historical.flashalpha.com/docs/\u003cendpoint\u003e`. Full field tables and side-by-side `OnData` samples are in [docs/data-types.md](docs/data-types.md).\n\n| Family             | Endpoint                                                                        | C# class                          | Python class           |\n| ------------------ | ------------------------------------------------------------------------------- | --------------------------------- | ---------------------- |\n| GEX                | [`exposure/gex`](https://historical.flashalpha.com/docs/exposure/gex)           | `FlashAlphaGexBar`                | `GexBar`               |\n| DEX                | [`exposure/dex`](https://historical.flashalpha.com/docs/exposure/dex)           | `FlashAlphaDexBar`                | `DexBar`               |\n| VEX                | [`exposure/vex`](https://historical.flashalpha.com/docs/exposure/vex)           | `FlashAlphaVexBar`                | `VexBar`               |\n| CHEX               | [`exposure/chex`](https://historical.flashalpha.com/docs/exposure/chex)         | `FlashAlphaChexBar`               | `ChexBar`              |\n| Exposure summary   | [`exposure/summary`](https://historical.flashalpha.com/docs/exposure/summary)   | `FlashAlphaExposureSummaryBar`    | `ExposureSummaryBar`   |\n| Exposure levels    | [`exposure/levels`](https://historical.flashalpha.com/docs/exposure/levels)     | `FlashAlphaExposureLevelsBar`     | `ExposureLevelsBar`    |\n| Vol surface        | [`surface`](https://historical.flashalpha.com/docs/surface)                     | `FlashAlphaSurfaceBar`            | `SurfaceBar`           |\n| Zero-DTE           | [`exposure/zero-dte`](https://historical.flashalpha.com/docs/exposure/zero-dte) | `FlashAlphaZeroDteBar`            | `ZeroDteBar`           |\n| Max pain           | [`max-pain`](https://historical.flashalpha.com/docs/max-pain)                   | `FlashAlphaMaxPainBar`            | `MaxPainBar`           |\n| Volatility         | [`volatility`](https://historical.flashalpha.com/docs/volatility)               | `FlashAlphaVolatilityBar`         | `VolatilityBar`        |\n| Advanced vol       | [`adv-volatility`](https://historical.flashalpha.com/docs/adv-volatility)       | `FlashAlphaAdvVolatilityBar`      | `AdvVolatilityBar`     |\n| VRP                | [`vrp`](https://historical.flashalpha.com/docs/vrp)                             | `FlashAlphaVrpBar`                | `VrpBar`               |\n| Narrative          | [`narrative`](https://historical.flashalpha.com/docs/narrative)                 | `FlashAlphaNarrativeBar`          | `NarrativeBar`         |\n| Stock summary      | [`stock/summary`](https://historical.flashalpha.com/docs/stock/summary)         | `FlashAlphaStockSummaryBar`       | `StockSummaryBar`      |\n| Stock quote        | [`stock/quote`](https://historical.flashalpha.com/docs/stock/quote)             | `FlashAlphaStockQuoteBar`         | `StockQuoteBar`        |\n| Option quote       | [`option/quote`](https://historical.flashalpha.com/docs/option/quote)           | `FlashAlphaOptionQuoteBar`        | `OptionQuoteBar`       |\n| Tickers (coverage) | [`tickers`](https://historical.flashalpha.com/docs/tickers)                     | `FlashAlphaTickersBar`            | `TickersBar`           |\n\nSugar extensions: every bar has a one-liner — `algo.AddFlashAlphaGex(\"SPY\")` in C#, `add_flashalpha_gex(self, \"SPY\")` in Python — that's equivalent to `AddData\u003cFlashAlphaGexBar\u003e(\"SPY\", Resolution.Daily)` / `self.AddData(GexBar, \"SPY\", Resolution.Daily)` with the daily default already baked in.\n\n---\n\n## Auth\n\nGet an API key at [flashalpha.com](https://flashalpha.com). The bridge resolves the key in this order:\n\n1. **Explicit override** — `FlashAlphaConfig.ApiKey = \"fa_live_…\"` in C#, `config.api_key = \"fa_live_…\"` in Python.\n2. **QC Cloud parameter** — set `flashalpha-api-key` under **Project → Parameters**.\n3. **Environment variable** — `FLASHALPHA_API_KEY` for self-hosted LEAN.\n\nIf all three miss the bridge throws `FlashAlphaAuthMissingException` (error code `FA-AUTH-001`). Full setup — including CI, dotenv, and secrets hygiene — in [docs/auth.md](docs/auth.md).\n\n---\n\n## Resolution → API cost\n\nLEAN resolution drives how often the bridge calls the FlashAlpha API. Pick the lowest resolution that satisfies your strategy.\n\n| LEAN resolution   | FlashAlpha calls per ticker per trading day | Notes                                                 |\n| ----------------- | ------------------------------------------- | ----------------------------------------------------- |\n| `Resolution.Daily`  | 1                                         | Default. One end-of-day snapshot. Cheapest.           |\n| `Resolution.Hour`   | ~7                                        | RTH hourly bars (09:30, 10:30, … 15:30).              |\n| `Resolution.Minute` | ~390                                      | Heavy. Use for research minute-of-the-day studies.    |\n| `Resolution.Tick`   | not supported                             | The historical API isn't tick-granular.               |\n\nA 252-day daily backtest of GEX on `SPY` is 252 API calls. The same backtest at minute resolution is ~98k calls — same data, just more snapshots per session.\n\n---\n\n## QuantConnect 0DTE — recipes\n\nFive end-to-end recipes, each a copy-paste template:\n\n- [Subscribe to GEX in QuantConnect](docs/recipes/subscribe-to-gex-in-quantconnect.md) — basics.\n- [Filter universe by GEX regime](docs/recipes/filter-universe-by-gex-regime.md) — `FlashAlphaTickersUniverse` + per-name GEX gating.\n- [Combine FlashAlpha with equity data](docs/recipes/combine-flashalpha-with-equity-data.md) — pair `AddEquity` and `AddData\u003c…\u003e` by ticker string in `OnData`.\n- [0DTE pin-risk check in QuantConnect](docs/recipes/0dte-pin-risk-check-in-quantconnect.md) — gate 0DTE entries on dealer-pin score.\n- [Vol-surface snapshot in QuantConnect](docs/recipes/vol-surface-snapshot-in-quantconnect.md) — read the IV grid, interpolate at a custom strike/tenor.\n\n---\n\n## FAQ\n\n### Why does FlashAlpha use a separate custom-data Symbol from AddEquity?\n\nQC's custom-data subscription system mints a fresh `Symbol` for each `AddData\u003cT\u003e(ticker, …)` call — distinct from the equity `Symbol` returned by `AddEquity(ticker, …)`. The two are *not interchangeable* in `Slice` lookups. Typical algos hold both symbols as fields and pair them by ticker string in `OnData`. There's a worked example in [docs/recipes/combine-flashalpha-with-equity-data.md](docs/recipes/combine-flashalpha-with-equity-data.md) and a deeper dive at [docs/troubleshooting.md#why-two-symbols](docs/troubleshooting.md#why-two-symbols).\n\n### What's the API cost per backtest day?\n\nOne FlashAlpha API call per ticker per bar. At `Resolution.Daily` (the default) that's one call per ticker per trading day — a 252-day SPY-only GEX backtest is 252 calls. At `Resolution.Minute` it's ~390 calls per ticker per day. The bridge has an in-process cache so duplicate subscriptions on the same `(endpoint, ticker, date)` reuse the response.\n\n### Does this work in QC Cloud?\n\nYes. Both the NuGet and PyPI packages are available in the QC Cloud project environment. Add your API key under **Project → Parameters** with the key `flashalpha-api-key` and the bridge picks it up via `GetParameter`. No env-var setup needed.\n\n### How is this different from polygon/CBOE feeds?\n\nPolygon and CBOE ship the raw chain — quotes, OI, Greeks. FlashAlpha ships the *positioning analytics* derived from that chain: net dealer GEX/DEX/VEX/CHEX, the gamma flip strike, call/put walls, 0DTE pin probability, dealer hedging-flow estimates, the smoothed IV surface and SVI parameters, VRP and harvest scores, plain-English narrative summaries. You can feed FlashAlpha and raw option data into the same algorithm — see [docs/recipes/combine-flashalpha-with-equity-data.md](docs/recipes/combine-flashalpha-with-equity-data.md).\n\n### Can I use this for live trading?\n\nThe current bar set targets the *historical* endpoint family — meant for backtests and research, not live signals. The same bars will work live in LEAN when the FlashAlpha realtime endpoints land; the subscription surface won't change. Track [github.com/FlashAlpha-lab/flashalpha-quantconnect/issues](https://github.com/FlashAlpha-lab/flashalpha-quantconnect/issues) for live-mode milestones.\n\n### What's the relationship to the flashalpha-historical SDK?\n\n`flashalpha-historical` is the raw cross-language SDK for the FlashAlpha historical API — available for [Python](https://pypi.org/project/flashalpha-historical/), [.NET](https://www.nuget.org/packages/FlashAlpha.Historical/), [Node](https://www.npmjs.com/package/@flashalpha/historical), [Go](https://pkg.go.dev/github.com/FlashAlpha-lab/flashalpha-historical-go), and [Java](https://central.sonatype.com/artifact/com.flashalpha/flashalpha-historical). `flashalpha-quantconnect` is the *LEAN adapter* on top of it. The bridge's C# bars depend on `FlashAlpha.Historical`'s typed response models so any schema drift in the SDK breaks the build, never silently corrupts a bar. You generally don't import the SDK directly — `AddData\u003c…\u003e` is the user-facing surface.\n\n---\n\n## Related\n\n- [historical.flashalpha.com](https://historical.flashalpha.com) — the underlying API.\n- [flashalpha-historical-python](https://pypi.org/project/flashalpha-historical/) / [-dotnet](https://www.nuget.org/packages/FlashAlpha.Historical/) / [-js](https://www.npmjs.com/package/@flashalpha/historical) / [-go](https://pkg.go.dev/github.com/FlashAlpha-lab/flashalpha-historical-go) / [-java](https://central.sonatype.com/artifact/com.flashalpha/flashalpha-historical) — raw SDKs.\n- `flashalpha-historical-examples` (upcoming) — twenty-plus end-to-end backtest essays using this bridge.\n- [LEAN custom data](https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/custom-data) — QC's reference for how custom-data subscriptions work.\n\n---\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashalpha-lab%2Fflashalpha-quantconnect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflashalpha-lab%2Fflashalpha-quantconnect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashalpha-lab%2Fflashalpha-quantconnect/lists"}