FlashAlpha .NET SDK
Official .NET 8+ SDK. Strongly typed async/await access to exposure, volatility, pricing, and the live options screener — from C#, F#, or VB. Works standalone or with IHttpClientFactory.
dotnet add package FlashAlpha
What the SDK gives you
Full endpoint coverage
All REST endpoints — market data, exposure, volatility, pricing, screener, account — as async methods on FlashAlphaClient.
DI & IHttpClientFactory
Inject a pre-configured HttpClient from the factory. Register the client in your DI container and let ASP.NET manage its lifetime.
CancellationToken everywhere
Every async method accepts a CancellationToken so requests can participate in structured cancellation.
Typed exceptions
AuthenticationException, TierRestrictedException, RateLimitException, NotFoundException, ServerException — all derive from FlashAlphaException.
Strongly typed screener
Build filter/sort/select queries via ScreenerRequest, ScreenerGroup, and ScreenerLeaf. Or pass a raw anonymous object when you just want flexibility.
No runtime deps
Built on System.Net.Http and System.Text.Json. No Newtonsoft, no pollyfills, no conflicts.
Install
dotnet add package FlashAlpha
# or in .csproj
<PackageReference Include="FlashAlpha" Version="0.3.0" />
Targets .NET 8.0 and newer. Requires C# 12 language features for the most idiomatic usage but works fine from any .NET 8-compatible language.
Quick start
using FlashAlpha;
using var client = new FlashAlphaClient("YOUR_API_KEY");
// All methods return JsonElement — navigate with GetProperty / indexer
var gex = await client.GexAsync("SPY");
Console.WriteLine($"Net GEX: {gex.GetProperty("net_gex").GetDouble():N0}");
Console.WriteLine($"Flip: {gex.GetProperty("gamma_flip").GetDouble()}");
// Key support / resistance levels
var key = (await client.ExposureLevelsAsync("SPY")).GetProperty("levels");
Console.WriteLine($"Call wall: {key.GetProperty("call_wall").GetDouble()}");
Console.WriteLine($"Put wall: {key.GetProperty("put_wall").GetDouble()}");
// BSM greeks for a single contract
var g = await client.GreeksAsync(
spot: 655, strike: 660, dte: 7, sigma: 0.18, type: "call");
Console.WriteLine($"delta={g.GetProperty("delta").GetDouble()}");
System.Text.Json.JsonElement. Navigate with GetProperty() / EnumerateArray(), or project into your own record via Deserialize<T>() — see the recipes below.
Live options screener
var screen = await client.ScreenerAsync(new ScreenerRequest
{
Filters = new ScreenerGroup
{
Op = "and",
Conditions = new List<object>
{
new ScreenerLeaf { Field = "regime", Operator = "eq", Value = "positive_gamma" },
new ScreenerLeaf { Field = "harvest_score", Operator = "gte", Value = 65 },
},
},
Sort = new List<ScreenerSort> { new() { Field = "harvest_score", Direction = "desc" } },
Select = new List<string> { "symbol", "price", "harvest_score" },
});
foreach (var row in screen.GetProperty("data").EnumerateArray())
{
Console.WriteLine($"{row.GetProperty("symbol").GetString()} : " +
$"{row.GetProperty("harvest_score").GetDouble()}");
}
ASP.NET Core & DI
// Program.cs
builder.Services.AddHttpClient<FlashAlphaClient>((sp, http) =>
{
http.BaseAddress = new Uri("https://lab.flashalpha.com");
http.DefaultRequestHeaders.Add("X-Api-Key",
builder.Configuration["FlashAlpha:ApiKey"]);
});
// Consume via constructor injection
public class ExposureService(FlashAlphaClient client)
{
public Task<JsonElement> GetSpyAsync(CancellationToken ct) =>
client.GexAsync("SPY", ct: ct);
}
Common recipes
Deserialize JsonElement into your own DTO
Responses are System.Text.Json.JsonElement for flexibility. Project into your own record when you want strong typing:
using System.Text.Json;
using System.Text.Json.Serialization;
public record GexSummary(
[property: JsonPropertyName("net_gex")] double NetGex,
[property: JsonPropertyName("gamma_flip")] double GammaFlip);
var raw = await client.GexAsync("SPY");
var typed = raw.Deserialize<GexSummary>()!;
Console.WriteLine($"{typed.NetGex:N0} / {typed.GammaFlip}");
Flexible screener via anonymous object
ScreenerAsync has two overloads: typed (ScreenerRequest) and object for ad-hoc JSON:
var screen = await client.ScreenerAsync(new {
filters = new {
op = "and",
conditions = new object[] {
new { field = "regime", @operator = "eq", value = "positive_gamma" },
new { field = "harvest_score", @operator = "gte", value = 65 },
},
},
sort = new[] { new { field = "harvest_score", direction = "desc" } },
select = new[] { "symbol", "price", "harvest_score" },
});
Handle cancellations cleanly
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
try
{
var gex = await client.GexAsync("SPY", ct: cts.Token);
}
catch (OperationCanceledException) when (cts.IsCancellationRequested)
{
Console.WriteLine("Gave up after 5 seconds");
}
Method catalog
| Category | Methods | Tier |
|---|---|---|
| Market data | StockQuoteAsync, OptionQuoteAsync, StockSummaryAsync, SurfaceAsync | Free / Growth |
| Historical replay (point-in-time) | HistoricalStockQuoteAsync, HistoricalOptionQuoteAsync, plus the full live API mirrored on historical.flashalpha.com via new FlashAlphaClient(apiKey, baseUrl: "https://historical.flashalpha.com") with at param | Alpha |
| Exposure (basic) | GexAsync, ExposureLevelsAsync | Free+ (equities); Basic+ for ETFs & indexes |
| Exposure (Greeks) | DexAsync, VexAsync, ChexAsync, MaxPainAsync | Basic+ |
| Exposure (Growth) | ExposureSummaryAsync, NarrativeAsync, ZeroDteAsync, ExposureHistoryAsync | Growth+ |
| Pricing | GreeksAsync, IvAsync, KellyAsync | Free / Growth |
| Volatility | VolatilityAsync, AdvVolatilityAsync | Growth / Alpha |
| Screener | ScreenerAsync | Growth+ |
| Reference | TickersAsync, OptionsAsync, SymbolsAsync | Free+ |
| Account | AccountAsync, HealthAsync | Free+ |
Error handling
try
{
await client.NarrativeAsync("SPY");
}
catch (TierRestrictedException ex)
{
Console.WriteLine($"Upgrade from {ex.CurrentPlan} to {ex.RequiredPlan}");
}
catch (RateLimitException ex)
{
Console.WriteLine($"Retry after {ex.RetryAfter}s");
}
catch (NotFoundException)
{
Console.WriteLine("Symbol not found");
}
catch (FlashAlphaException ex)
{
Console.WriteLine($"API error {ex.StatusCode}: {ex.Message}");
}
| HTTP | Exception | Properties |
|---|---|---|
| 401 | AuthenticationException | — |
| 403 | TierRestrictedException | CurrentPlan, RequiredPlan |
| 404 | NotFoundException | — |
| 429 | RateLimitException | RetryAfter |
| 5xx | ServerException | StatusCode |
| other | FlashAlphaException | StatusCode |
Client configuration
// Simple
using var client = new FlashAlphaClient(
apiKey: "...",
baseUrl: "https://lab.flashalpha.com", // default
timeout: 30 // seconds
);
// Or inject a pre-configured HttpClient
using var client2 = new FlashAlphaClient(httpClient);
Links
Ready to build?
Get your free API key and start pulling live options data in 30 seconds.