# Strategies API

5 endpoints under `https://apexvol.com/api/mcp/data`. Every call needs `Authorization: Bearer avmcp_<token>`; tokens are issued to paid and trial accounts under Account, then API Access. Web version: https://apexvol.com/developers/strategies-api

| Endpoint | Plan | What it answers |
|---|---|---|
| `POST /analyze-strategy` | Basic | What are the Greeks, breakevens and odds on this set of legs? |
| `POST /build-strategy` | Basic | What does a 30-delta SPY iron condor look like right now, legs and all? |
| `POST /optimize-strategy` | Basic | Which strikes give the best SPY iron condor for max profit? |
| `POST /pop` | Basic | What is the probability of profit on these legs? |
| `POST /simulate-chain` | Basic | What would the SPY chain look like if the stock rose 2% and IV rose 5 points in 10 days? |

## POST /analyze-strategy

Accepts your own legs with premiums and returns the aggregate economics. Fetches live spot when stock_price is omitted.

- **Units:** Premiums in dollars per share; totals per one-lot; probability_of_profit in percent.
- **Basis:** Analytic Black-Scholes on the leg IVs you supply, or chain IVs when omitted.
- **Markdown:** https://apexvol.com/developers/strategies-api/analyze-strategy.md

| Name | In | Default | Range | Meaning |
|---|---|---|---|---|
| `ticker` (required) | body |  | symbol | The underlying. |
| `legs` (required) | body |  | array of {type, action, strike, expiration, premium, quantity, delta, theta, vega, iv} | The legs. |
| `stock_price` | body | live | dollars | Override spot. |
| `name` | body |  | text | A label for the result. |

```bash
curl -X POST "https://apexvol.com/api/mcp/data/analyze-strategy" \
     -H "Authorization: Bearer avmcp_YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"ticker": "SPY", "legs": [{"type": "PUT", "action": "SELL", "strike": 755.0, "expiration": "2026-10-09", "premium": 6.359999999999999, "quantity": 1, "delta": -0.3014, "theta": -0.1785, "vega": 0.8379, "iv": 0.1365}, {"type": "PUT", "action": "BUY", "strike": 750.0, "expiration": "2026-10-09", "premium": 5.35, "quantity": 1, "delta": -0.2581, "theta": -0.1735, "vega": 0.7454, "iv": 0.1416}, {"type": "CALL", "action": "SELL", "strike": 785.0, "expiration": "2026-10-09", "premium": 4.785, "quantity": 1, "delta": 0.297, "theta": -0.1318, "vega": 0.8329, "iv": 0.1084}, {"type": "CALL", "action": "BUY", "strike": 790.0, "expiration": "2026-10-09", "premium": 3.275, "quantity": 1, "delta": 0.2281, "theta": -0.1136, "vega": 0.735, "iv": 0.1062}], "name": "Iron condor from /build-strategy"}'
```

- `net_premium, max_profit, max_loss, risk_reward_ratio`: The economics.
- `net_delta, net_theta, net_vega`: Aggregate Greeks.
- `breakevens[], probability_of_profit`: Where it pays and how often.
- `pnl_curve[]`: Price and P&L pairs at expiration.

## POST /build-strategy

Given a ticker and strategy type, selects strikes from the live chain around the target delta and width, and returns the legs with premium and Greeks plus net premium, max profit and loss, breakevens, probability of profit and the P&L curve.

- **Units:** Premiums in dollars per share; max_profit and max_loss in dollars per one-lot; probability_of_profit in percent; leg iv as a decimal.
- **Basis:** Strikes are chosen from the live chain by delta; premiums are mid quotes.
- **Markdown:** https://apexvol.com/developers/strategies-api/build-strategy.md

| Name | In | Default | Range | Meaning |
|---|---|---|---|---|
| `ticker` (required) | body |  | symbol | The underlying. |
| `strategy_type` (required) | body |  | iron_condor, credit_spread, straddle, strangle and others | Which structure. |
| `expiration` | body |  | YYYY-MM-DD | Expiration; dte is used when absent. |
| `dte` | body | 30 | days | Target days to expiration. |
| `width` | body | 5 | dollars | Wing width. |
| `target_delta` | body | 0.3 | 0.05 to 0.50 | Short-strike delta. |

```bash
curl -X POST "https://apexvol.com/api/mcp/data/build-strategy" \
     -H "Authorization: Bearer avmcp_YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"ticker": "SPY", "strategy_type": "iron_condor", "dte": 30}'
```

- `legs[].type, action, strike, expiration, premium, delta, theta, vega, iv`: The legs.
- `analysis.net_premium, max_profit, max_loss, breakevens`: The economics.
- `analysis.probability_of_profit, pnl_curve`: The odds and the curve.
- `name, stock_price`: Context.

## POST /optimize-strategy

Searches strike combinations for iron condors and credit spreads against a target (max profit, min loss, risk-reward or probability) and returns the winning legs with the full analysis.

- **Units:** As /build-strategy.
- **Basis:** Candidates from the live chain; the target picks the objective.
- **Markdown:** https://apexvol.com/developers/strategies-api/optimize-strategy.md

| Name | In | Default | Range | Meaning |
|---|---|---|---|---|
| `ticker` (required) | body |  | symbol | The underlying. |
| `strategy_type` (required) | body |  | iron_condor or credit_spread | Which structure. |
| `target` | body | max_profit | max_profit, min_loss, risk_reward, probability | What to optimize. |

```bash
curl -X POST "https://apexvol.com/api/mcp/data/optimize-strategy" \
     -H "Authorization: Bearer avmcp_YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"ticker": "SPY", "strategy_type": "iron_condor", "target": "max_profit"}'
```

- `legs[]`: The winning legs.
- `analysis`: The economics of the winner.
- `optimization_target`: Echo of the objective.

## POST /pop

Given legs with IV and premium, the spot and days to expiry, returns the probability the position finishes profitable.

- **Units:** probability_of_profit in percent.
- **Basis:** N(d2)-style probability at expiration from the supplied IVs.
- **Markdown:** https://apexvol.com/developers/strategies-api/pop.md

| Name | In | Default | Range | Meaning |
|---|---|---|---|---|
| `legs` (required) | body |  | array of {option_type, action, strike, iv, premium, quantity} | The legs. |
| `stock_price` (required) | body |  | dollars | Spot. |
| `days_to_exp` (required) | body |  | days | Days to expiration. |

```bash
curl -X POST "https://apexvol.com/api/mcp/data/pop" \
     -H "Authorization: Bearer avmcp_YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"legs": [{"option_type": "PUT", "action": "SELL", "strike": 755.0, "premium": 6.359999999999999, "quantity": 1, "iv": 0.1365}, {"option_type": "PUT", "action": "BUY", "strike": 750.0, "premium": 5.35, "quantity": 1, "iv": 0.1416}, {"option_type": "CALL", "action": "SELL", "strike": 785.0, "premium": 4.785, "quantity": 1, "iv": 0.1084}, {"option_type": "CALL", "action": "BUY", "strike": 790.0, "premium": 3.275, "quantity": 1, "iv": 0.1062}], "stock_price": 770.25, "days_to_exp": 30}'
```

- `probability_of_profit`: Percent.
- `legs_count`: How many legs were read.

## POST /simulate-chain

Black-Scholes what-if: pass chain rows from /chain, or just a ticker and the server fetches the chain, and get every contract re-priced with new Greeks at your scenario.

- **Units:** sim_price in dollars; sim_dte in days; iv_adjustment in IV percentage points; output prices in dollars, IVs as decimals.
- **Basis:** Re-pricing holds each contract's IV plus the shift and moves spot and time.
- **Markdown:** https://apexvol.com/developers/strategies-api/simulate-chain.md

| Name | In | Default | Range | Meaning |
|---|---|---|---|---|
| `sim_price` (required) | body |  | dollars | Hypothetical spot. |
| `sim_dte` (required) | body |  | days | Days to expiration in the scenario. |
| `iv_adjustment` | body | 0 | IV points | Shift applied to every IV. |
| `chain` | body |  | rows from /chain | Rows to re-price. |
| `ticker` | body |  | symbol | Fetch the chain when rows are omitted. |
| `expiration` | body | nearest | YYYY-MM-DD | Which expiration to fetch. |
| `strikes_around` | body | 20 | 0 for all | Strikes per side. |

```bash
curl -X POST "https://apexvol.com/api/mcp/data/simulate-chain" \
     -H "Authorization: Bearer avmcp_YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"ticker": "SPY", "sim_price": 785.65, "sim_dte": 10, "iv_adjustment": 5, "strikes_around": 3}'
```

- `chain[].Strike, Call Bid, Call Ask, Put Bid, Put Ask`: Re-priced quotes.
- `chain[].Delta Call, Gamma Call, Theta Call, Vega Call and the put twins`: Re-priced Greeks.
- `sim_price, sim_dte, iv_adjustment, expiration`: The scenario echoed.

Conventions: https://apexvol.com/developers/conventions. Errors: https://apexvol.com/developers/errors. Whole API in one file: https://apexvol.com/docs/api/apexvol-api.md
