- Live API Reference
- Pricing Calculators
- Kelly Position Sizing
Kelly Position Sizing API
Kelly-optimal position size for an option trade, from your own view of the underlying.
Endpoint
Computes Kelly criterion optimal position sizing for an option trade. Uses numerical integration over the full lognormal distribution of the underlying to maximize expected log-wealth growth - not the simplified gambling formula. Requires Growth plan or higher.
X-Api-Key)
Rate Limited: Yes
Plan: Growth+
Parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
spot |
query | number | required | - | Underlying spot price. Invalid values return 400 invalid_input. Non-numeric values return a 400 problem-details body. |
strike |
query | number | required | - | Strike price. Invalid values return 400 invalid_input. Non-numeric values return a 400 problem-details body. |
dte |
query | number | required | - | Days to expiration. Invalid values return 400 invalid_input. Non-numeric values return a 400 problem-details body. |
sigma |
query | number | required | - | Implied volatility (annualized). Invalid values return 400 invalid_input. Non-numeric values return a 400 problem-details body. |
premium |
query | number | required | - | Option premium paid (per share). Invalid values return 400 invalid_input. Non-numeric values return a 400 problem-details body. |
mu |
query | number | required | - | There is no server default: an omitted mu is read as 0, a zero-return view (for a call this usually returns "Negative expected value"). Expected annualized return of the underlying (your view, e.g. 0.12 = 12%). Range: -200% to +200%. Invalid values return 400 invalid_input. Non-numeric values return a 400 problem-details body. |
type |
query | enum | call |
call or put. Invalid values return 400 invalid_input. |
|
r |
query | number | 0.045 |
Risk-free rate. Non-numeric values return a 400 problem-details body. | |
q |
query | number | 0.013 |
Dividend yield. Non-numeric values return a 400 problem-details body. |
How mu works
The key input is mu - your expected annual return for the underlying. This is what gives you an edge over the market price, which uses r:
mu > r- you are more bullish than the market, so calls have positive edgemu < r- you are more bearish, so puts have positive edgemu = r- no edge, so Kelly recommends no position
For example, if SPY is priced with r = 4.5% but you expect mu = 12%, your calls have an edge and Kelly tells you how much to risk.
Request
curl -H "X-Api-Key: YOUR_API_KEY" \
"https://lab.flashalpha.com/v1/pricing/kelly?spot=580&strike=580&dte=30&sigma=0.18&premium=12.69&mu=0.12&type=call"import requests
resp = requests.get(
"https://lab.flashalpha.com/v1/pricing/kelly",
params={"spot": 580, "strike": 580, "dte": 30, "sigma": 0.18,
"premium": 12.69, "mu": 0.12, "type": "call"},
headers={"X-Api-Key": "YOUR_API_KEY"}
)
resp.raise_for_status()
k = resp.json()
print(k["recommendation"])const qs = new URLSearchParams({ spot: 580, strike: 580, dte: 30, sigma: 0.18, premium: 12.69, mu: 0.12, type: "call" });
const resp = await fetch(`https://lab.flashalpha.com/v1/pricing/kelly?${qs}`, {
headers: { "X-Api-Key": "YOUR_API_KEY" }
});
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const k = await resp.json();
console.log(k.recommendation);Try it live
Runs on live market data and uses 1 request from your daily quota.
Response
{
"inputs": {
"spot": 580,
"strike": 580,
"dte": 30,
"sigma": 0.18,
"premium": 12.69,
"mu": 0.12,
"type": "call",
"risk_free_rate": 0.045,
"dividend_yield": 0.013
},
"sizing": {
"kelly_fraction": 0.076842,
"half_kelly": 0.038421,
"quarter_kelly": 0.01921,
"kelly_pct": 7.68,
"half_kelly_pct": 3.84
},
"analysis": {
"expected_roi": 0.160546,
"expected_roi_pct": 16.05,
"expected_payoff": 14.7273,
"probability_of_profit": 0.391739,
"probability_of_profit_pct": 39.17,
"probability_itm": 0.557494,
"probability_itm_pct": 55.75,
"max_loss": 12.69,
"breakeven": 592.69,
"expected_growth_rate": 0.005844
},
"recommendation": "Risk 3.8% of bankroll (half-Kelly). Probability of profit: 39.2%. Expected ROI: 16.1%.",
"endpoint_version": "2026.09.30",
"data_as_of": {
"node": "fa5",
"equity_feed": "2026-10-30T13:46:18.181Z",
"equity_options_feed": "2026-10-30T13:46:18Z",
"index_feed": "2026-10-30T13:46:17.119Z",
"index_options_feed": "2026-10-30T13:46:16Z",
"futures_feed": "2026-10-30T13:46:15.271Z",
"futures_options_feed": "2026-10-30T13:46:14.335Z",
"flow_feed": "2026-10-30T13:46:00Z",
"oi_feed": "2026-10-29T20:00:00Z",
"macro_feed": "2026-10-29T21:00:20Z"
}
}Sending request…
See this endpoint on live data
Send this exact request and the real response shows up here, right next to the example.
Response Fields
| Field | Type | Description |
|---|---|---|
sizing.kelly_fraction | number | Full Kelly - optimal fraction of bankroll to risk (0-1) |
sizing.half_kelly | number | Half Kelly - recommended in practice (less volatile) |
sizing.quarter_kelly | number | Quarter Kelly - very conservative |
sizing.kelly_pct / half_kelly_pct | number | Same as above, in percent |
analysis.expected_roi | number | Expected return on investment (payoff / premium - 1) |
analysis.probability_of_profit | number | P(option profit at expiry), real-world measure using mu |
analysis.probability_itm | number | P(option in the money at expiry), real-world measure |
analysis.max_loss | number | Maximum loss per share (= premium paid) |
analysis.breakeven | number | Underlying price needed at expiry to break even |
analysis.expected_growth_rate | number | Expected log-growth rate of the bankroll at the Kelly fraction |
recommendation | string | Human-readable sizing recommendation |
inputs | object | Inputs |
sizing | object | Full Kelly - optimal fraction of bankroll to risk (0–1) |
analysis | object | Expected return on investment (payoff/premium − 1) |
analysis.expected_roi_pct | number | Analysis: expected roi (%) |
analysis.expected_payoff | number | Analysis: expected payoff |
analysis.probability_of_profit_pct | number | Analysis: probability of profit (%) |
analysis.probability_itm_pct | number | Analysis: probability itm (%) |
endpoint_version, data_as_of | string, object | Response envelope, see Response envelope. |
Fields of inputs
| Field | Type | Description |
|---|---|---|
inputs.spot | number | Inputs: spot |
inputs.strike | number | Strike price |
inputs.dte | number | Days to expiration |
inputs.sigma | number | Inputs: sigma |
inputs.premium | number | Inputs: premium |
inputs.mu | number | Inputs: mu |
inputs.type | string | Option type |
inputs.risk_free_rate | number | Inputs: risk free rate |
inputs.dividend_yield | number | Inputs: dividend yield |
Negative expected value
If the option has negative expected value (your view does not justify the premium), Kelly returns zero:
{
"sizing": { "kelly_fraction": 0, "half_kelly": 0, "quarter_kelly": 0 },
"recommendation": "Negative expected value - Kelly recommends no position."
}Notes
- All probabilities use the real-world measure (with
mu), not the risk-neutral measure (withr). - The Kelly fraction is bounded to [0, 1]: it never recommends shorting or leverage beyond 100%.
- Half-Kelly is strongly recommended in practice - full Kelly is mathematically optimal but very aggressive and assumes perfect parameter estimates.
- The integration uses 2,000 steps over ±6σ of the lognormal distribution.
Errors
| Status | Error | When |
|---|---|---|
400 | invalid_input | An input is out of range, for example a spot, strike, dte or volatility that is not positive. |
400 | - | A query value has the wrong type, or a required value is missing. The body is an RFC 7807 problem-details object with errors.<param>. |
401 | - | Missing or invalid X-Api-Key. The body is empty; check the status code before parsing JSON. |
403 | tier_restricted | Your plan is below Growth. The body includes current_plan and required_plan. |
429 | Quota exceeded | Daily quota used up. Retry-After gives the seconds until the reset at 00:00 UTC. Rejected requests (including 403) count toward the quota. |
Authentication (401) and rate-limit (429) errors use the common error format, see Error Responses.
What Is the Kelly Position Sizing Endpoint?
The Kelly criterion picks the fraction of your bankroll that maximizes long-run growth given your edge. Standard Kelly is built for fixed-odds bets; an option has an asymmetric, bounded-loss payoff, so this endpoint integrates the payoff over the full lognormal distribution of the underlying instead. You supply your own expected return mu; the gap between that view and the risk-free rate the market prices with is the edge Kelly sizes.
Common Use Cases
- Size directional option trades - turn a price target view into a bankroll fraction
- Filter trades by edge - skip contracts where Kelly returns zero
- Compare strikes - run several strikes and pick the best expected growth rate
- Add risk guardrails - cap automated orders at half or quarter Kelly
Related
Related reading
- Build a Kelly criterion options calculator - a worked sizing example
Complementary endpoints
- BSM Greeks Calculator - price the option before sizing it
- Implied Volatility Solver - get
sigmafrom the market price - Option Quote - live premiums to feed
premium