- Live API Reference
- Positions & Risk
- Position P&L Curve
Position P&L Curve API
At-expiry profit-and-loss curve, breakevens, and max profit/loss for an arbitrary multi-leg option structure.
Endpoint
X-Api-Key)
Rate Limited: Yes
Plan: Basic+
Request Body Fields
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
legs | body | array | required | - | One or more legs. Must be non-empty. |
legs[].action | body | enum | required | buy | buy (alias long) or sell (alias short). |
legs[].type | body | enum | required | call | call (alias c) or put (alias p). |
legs[].strike | body | number | required | - | Strike price. Must be > 0. |
legs[].premium | body | number | required | - | Per-contract premium paid/received. Must be >= 0. |
legs[].quantity | body | integer | 1 | Number of contracts. Must be > 0. | |
minUnderlying | body | number | derived | Lower bound of the underlying-price curve. If omitted (or not strictly below maxUnderlying), the range is derived from the leg strikes ±30%. | |
maxUnderlying | body | number | derived | Upper bound of the curve. See minUnderlying. | |
points | body | integer | 81 | Number of equally-spaced curve sample points (endpoints inclusive). Clamped to a minimum of 2. |
Request
{
"legs": [
{ "action": "buy", "type": "call", "strike": 100, "premium": 3.20, "quantity": 1 },
{ "action": "sell", "type": "call", "strike": 110, "premium": 1.10, "quantity": 1 }
],
"minUnderlying": 80,
"maxUnderlying": 130,
"points": 81
}curl -X POST "https://lab.flashalpha.com/v1/structures/pnl" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"legs": [
{ "action": "buy", "type": "call", "strike": 100, "premium": 3.20, "quantity": 1 },
{ "action": "sell", "type": "call", "strike": 110, "premium": 1.10, "quantity": 1 }
],
"minUnderlying": 80,
"maxUnderlying": 130,
"points": 81
}'import requests
resp = requests.post(
"https://lab.flashalpha.com/v1/structures/pnl",
headers={"X-Api-Key": "YOUR_API_KEY"},
json={
"legs": [
{"action": "buy", "type": "call", "strike": 100, "premium": 3.20, "quantity": 1},
{"action": "sell", "type": "call", "strike": 110, "premium": 1.10, "quantity": 1},
],
"minUnderlying": 80,
"maxUnderlying": 130,
"points": 81,
},
)
resp.raise_for_status()
data = resp.json()
print(f"Breakevens: {data['breakevens']}")const resp = await fetch(
"https://lab.flashalpha.com/v1/structures/pnl",
{
method: "POST",
headers: {
"X-Api-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
legs: [
{ action: "buy", type: "call", strike: 100, premium: 3.20, quantity: 1 },
{ action: "sell", type: "call", strike: 110, premium: 1.10, quantity: 1 }
],
minUnderlying: 80,
maxUnderlying: 130,
points: 81
})
}
);
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const data = await resp.json();
console.log("Breakevens:", data.breakevens);This is a pure-math POST endpoint: the result is computed analytically from the legs you supply, with no market-data lookup, symbol resolution, or live IV. There is no live Try-It widget for it - run the cURL example above to try it.
Response
{
"legs": [
{
"action": "buy",
"type": "call",
"strike": 100,
"premium": 3.2,
"quantity": 1
},
{
"action": "sell",
"type": "call",
"strike": 110,
"premium": 1.1,
"quantity": 1
}
],
"pnl_curve": [
{
"underlying": 80,
"pnl": -2.1
},
{
"underlying": 80.625,
"pnl": -2.1
}
],
"breakevens": [
102.1
],
"max_profit": 7.9,
"max_loss": -2.1,
"endpoint_version": "2026.09.30",
"data_as_of": {
"node": "fa4",
"equity_feed": "2026-10-30T13:46:28.231Z",
"equity_options_feed": "2026-10-30T13:46:26Z",
"index_feed": "2026-10-30T13:46:26.1488076Z",
"index_options_feed": "2026-10-30T13:46:24Z",
"futures_feed": "2026-10-30T13:46:22.778Z",
"futures_options_feed": "2026-10-30T13:46:20.351Z",
"flow_feed": "2026-10-30T13:46:00Z",
"oi_feed": "2026-10-29T20:00:00Z",
"macro_feed": "2026-10-29T21:00:20Z"
}
}Response Fields
| Field | Type | Description |
|---|---|---|
legs | array | Echoes the request body verbatim |
pnl_curve | array | Sampled payoff points, each { underlying, pnl } |
breakevens | array | Underlying prices where P&L crosses zero (may be empty) |
max_profit | number/null | Bounded maximum profit, or null when unbounded on that side |
max_loss | number/null | Bounded maximum loss, or null when unbounded on that side |
legs[].action | string | buy (alias long) or sell (alias short). |
legs[].type | string | call (alias c) or put (alias p). |
legs[].strike | number | Strike price. Must be > 0. |
legs[].premium | number | Per-contract premium paid/received. Must be >= 0. |
legs[].quantity | number | Number of contracts. Must be > 0. |
pnl_curve[].underlying | number | Pnl curve: underlying |
pnl_curve[].pnl | number | Pnl curve: pnl |
endpoint_version, data_as_of | string, object | Response envelope, see Response envelope. |
Errors
| Status | Error | When |
|---|---|---|
400 | empty_legs | legs is missing or empty. |
400 | invalid_action | leg[i].action is not buy/sell (or long/short). |
400 | invalid_type | leg[i].type is not call/put (or c/p). |
400 | invalid_strike | leg[i].strike <= 0. |
400 | invalid_premium | leg[i].premium < 0. |
400 | invalid_quantity | leg[i].quantity <= 0. |
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 Basic. 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. |
About
This endpoint is part of the Structures family of pure-math multi-leg utilities. Every result is a deterministic function of the legs you supply: there is no market-data lookup, no symbol resolution, and no live IV. You pass the legs and premiums, and the response is computed analytically.
The at-expiry payoff is piecewise-linear in the underlying, so breakevens and the bounded max/min are solved exactly from the kinks at the strikes. max_profit and max_loss are null on any side that is unbounded - for example, a naked long call has unbounded max_profit, and a naked short call has unbounded max_loss.
Common Use Cases
- Render an at-expiry payoff diagram by plotting the
pnl_curvepoints for any custom spread, condor, or butterfly - Surface exact
breakevensbefore placing a multi-leg order so you know where the trade turns profitable - Read
max_profitandmax_lossto confirm a structure is defined-risk and size the position to your risk budget - Detect unbounded exposure when
max_profitormax_losscomes backnull, flagging naked legs before you trade them - Compute reward-to-risk from
max_profitovermax_lossto rank candidate structures side by side without any market data - Set profit-target and stop levels off the
breakevensand curve kinks for an exit plan that matches the payoff - Validate a structure's shape across the supplied
minUnderlying/maxUnderlyingrange before committing capital
Related
Related reading
- Complete guide to spreads, iron condors & credit spreads - the structures whose payoff this endpoint draws
- VRP strategy scoring: pick the right structure - decide which structure to model here
Complementary endpoints
- Structure Greeks - add aggregate delta/gamma/theta/vega to the same legs
- Option Quote - pull real premiums and IV to feed the legs
- VRP - gauge whether the structure is rich or cheap to put on
Unlock DEX, VEX and CHEX with Basic
Everything in Free, plus:
- DEX, VEX and CHEX exposure
- Full max pain
- ETF & index symbols SPY, QQQ, SPX, VIX
Go full-chain with Growth
Everything in Basic, plus:
- Full-chain GEX Every expiration
- 0DTE analytics
- Exposure summary & AI narrative
- CME futures & live screener
Add history and vol surfaces with Alpha
Everything in Growth, plus:
- Historical API replay Since 2017
- SVI vol surfaces
- VRP analytics
- Greeks surfaces Vanna, charm, volga and speed grids