FlashAlpha Java SDK
Official Java 11+ SDK for the FlashAlpha options analytics API. JDK-native java.net.http, Gson parsing, usable from Java, Kotlin, and Scala.
com.flashalpha:flashalpha:0.3.0
What the SDK gives you
Full endpoint coverage
All REST endpoints mapped to methods on FlashAlphaClient — returns JsonObject or JsonArray for flexible access.
JDK-native HTTP
Uses java.net.http.HttpClient built into JDK 11+. No OkHttp, no Apache, no conflicting versions.
Kotlin & Scala friendly
Plain Java API — no hidden codegen or annotation processors. Use seamlessly from Kotlin coroutines or Scala futures.
Typed exceptions
AuthenticationException, TierRestrictedException, RateLimitException, NotFoundException, ServerException, FlashAlphaException.
Flexible screener requests
Build screener queries as Map/List structures — or pass any POJO and let Gson serialize it.
Testable
Configure a custom baseUrl to point at MockWebServer or WireMock in tests.
Install
Maven:
<dependency>
<groupId>com.flashalpha</groupId>
<artifactId>flashalpha</artifactId>
<version>0.3.0</version>
</dependency>
Gradle (Kotlin DSL):
implementation("com.flashalpha:flashalpha:0.3.0")
Quick start
import com.flashalpha.FlashAlphaClient;
import com.google.gson.JsonObject;
FlashAlphaClient client = new FlashAlphaClient("YOUR_API_KEY");
// Gamma exposure for SPY
JsonObject gex = client.gex("SPY");
System.out.println(gex.get("net_gex") + " / flip " + gex.get("gamma_flip"));
// Key support / resistance levels
JsonObject key = client.exposureLevels("SPY")
.getAsJsonObject("levels");
System.out.println("Call wall: " + key.get("call_wall"));
// BSM greeks for a single contract
JsonObject g = client.greeks(655, 660, 7, 0.18, "call", null, null);
System.out.println("delta=" + g.get("delta"));
Live options screener
import java.util.*;
Map<String, Object> body = new LinkedHashMap<>();
body.put("filters", Map.of(
"op", "and",
"conditions", List.of(
Map.of("field", "regime", "operator", "eq", "value", "positive_gamma"),
Map.of("field", "harvest_score", "operator", "gte", "value", 65)
)));
body.put("sort", List.of(Map.of("field", "harvest_score", "direction", "desc")));
body.put("select", List.of("symbol", "price", "harvest_score"));
JsonObject screen = client.screener(body);
screen.getAsJsonArray("data").forEach(row ->
System.out.println(row.getAsJsonObject().get("symbol")));
Common recipes
Convert response to a POJO via Gson
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
record GexSummary(
@SerializedName("net_gex") double netGex,
@SerializedName("gamma_flip") double gammaFlip) {}
Gson gson = new Gson();
GexSummary s = gson.fromJson(client.gex("SPY"), GexSummary.class);
System.out.println(s.netGex() + " / " + s.gammaFlip());
Expiration-filtered exposure
// Methods have overloads for optional params
JsonObject all = client.gex("SPY");
JsonObject friday = client.gex("SPY", "2026-04-10", 500); // expiry, min OI
Kotlin
import com.flashalpha.FlashAlphaClient
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
val fa = FlashAlphaClient("YOUR_API_KEY")
suspend fun getGex(symbol: String) = withContext(Dispatchers.IO) {
fa.gex(symbol)
}
Method catalog
| Category | Methods | Tier |
|---|---|---|
| Market data | stockQuote, optionQuote, stockSummary, surface | Free / Growth |
| Historical replay (point-in-time) | historicalStockQuote, historicalOptionQuote, plus the full live API mirrored on historical.flashalpha.com via FlashAlpha.builder().apiKey(...).baseUrl("https://historical.flashalpha.com").build() with at param | Alpha |
| Exposure (basic) | gex, exposureLevels | Free+ (equities); Basic+ for ETFs & indexes |
| Exposure (Greeks) | dex, vex, chex, maxpain | Basic+ |
| Exposure (Growth) | exposureSummary, narrative, zeroDte, exposureHistory | Growth+ |
| Pricing | greeks, iv, kelly | Free / Growth |
| Volatility | volatility, advVolatility | Growth / Alpha |
| Screener | screener | Growth+ |
| Reference | tickers, options, symbols | Free+ |
| Account | account, health | Free+ |
Error handling
try {
client.narrative("SPY");
} catch (TierRestrictedException e) {
System.out.println("Upgrade from " + e.getCurrentPlan()
+ " to " + e.getRequiredPlan());
} catch (RateLimitException e) {
System.out.println("Retry after " + e.getRetryAfter() + "s");
} catch (NotFoundException e) {
System.out.println("Symbol not found");
} catch (FlashAlphaException e) {
System.out.println("API error " + e.getStatusCode()
+ ": " + e.getMessage());
}
| HTTP | Exception | Accessors |
|---|---|---|
| 401 | AuthenticationException | — |
| 403 | TierRestrictedException | getCurrentPlan(), getRequiredPlan() |
| 404 | NotFoundException | — |
| 429 | RateLimitException | getRetryAfter() |
| 5xx | ServerException | getStatusCode() |
| other | FlashAlphaException | getStatusCode() |
Client configuration
// Default base URL
FlashAlphaClient client = new FlashAlphaClient("YOUR_API_KEY");
// Override base URL (useful for MockWebServer in tests)
FlashAlphaClient client = new FlashAlphaClient(
"YOUR_API_KEY",
"https://lab.flashalpha.com"
);
// Timeout is fixed at 30 seconds.
Links
Ready to build?
Get your free API key and start pulling live options data in 30 seconds.