# POST /api/mcp/data/optimize-strategy

> Which strikes give the best SPY iron condor for max profit?

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.

- **Family:** Strategies (https://apexvol.com/developers/strategies-api)
- **Plan:** Basic and above. Every call needs `Authorization: Bearer avmcp_<token>`; tokens are issued to paid and trial accounts under Account, then API Access.
- **Units:** As /build-strategy.
- **Basis:** Candidates from the live chain; the target picks the objective.
- **MCP tools:** `optimize_strategy`
- **Background:** https://apexvol.com/learn/iron-condor-cheat-sheet

## Parameters

| 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. |

## Request

```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"}'
```

## Response (captured 2026-09-08)

Real response, lists cut to the rows nearest the money. The envelope is `{"success": true, "data": ...}`.

```json
{
  "success": true,
  "data": {
    "analysis": {
      "breakevens": [
        743.435,
        793.565
      ],
      "legs_summary": [
        {
          "action": "SELL",
          "expiration": "2026-10-09",
          "iv": 0.1433,
          "premium": 5.155,
          "quantity": 1,
          "strike": 749.0,
          "type": "PUT"
        },
        {
          "action": "SELL",
          "expiration": "2026-10-09",
          "iv": 0.1064,
          "premium": 3.805,
          "quantity": 1,
          "strike": 788.0,
          "type": "CALL"
        },
        {
          "action": "BUY",
          "expiration": "2026-10-09",
          "iv": 0.1014,
          "premium": 0.985,
          "quantity": 1,
          "strike": 804.0,
          "type": "CALL"
        }
      ],
      "max_loss": -1943.5,
      "max_profit": 556.5,
      "net_delta": -0.0046,
      "net_premium": -556.5,
      "net_theta": 0.1098,
      "net_vega": -0.6744,
      "pnl_curve": [
        [
          579.2,
          -1943.5
        ],
        [
          583.0949,
          -1943.5
        ],
        [
          586.9899,
          -1943.5
        ]
      ],
      "probability_of_profit": 49.4,
      "risk_reward_ratio": 0.2863,
      "stock_price": 770.25,
      "strategy_name": "Iron Condor",
      "ticker": "SPY"
    },
    "created_at": "2026-09-08T08:07:39.442751",
    "legs": [
      {
        "action": "SELL",
        "delta": -0.2475,
        "expiration": "2026-10-09",
        "iv": 0.1433,
        "premium": 5.155,
        "quantity": 1,
        "strike": 749.0,
        "theta": -0.1721,
        "type": "PUT",
        "vega": 0.7443
      },
      {
        "action": "SELL",
        "delta": 0.2561,
        "expiration": "2026-10-09",
        "iv": 0.1064,
        "premium": 3.805,
        "quantity": 1,
        "strike": 788.0,
        "theta": -0.121,
        "type": "CALL",
        "vega": 0.7869
      },
      {
        "action": "BUY",
        "delta": 0.1014,
        "expiration": "2026-10-09",
        "iv": 0.1014,
        "premium": 0.985,
        "quantity": 1,
        "strike": 804.0,
        "theta": -0.0655,
        "type": "CALL",
        "vega": 0.4502
      }
    ],
    "name": "Iron Condor",
    "optimization_target": "max_profit",
    "stock_price": 770.25,
    "ticker": "SPY"
  }
}
```

## Fields

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

## Errors

- `401`: no or revoked token
- `429`: Retry-After seconds
- `400`: missing or malformed body
- Full list: https://apexvol.com/developers/errors

## Ask it in an MCP client

- Find the best-probability iron condor on SPY.
- Optimize a credit spread on NVDA for risk-reward.
- Which strikes maximize credit on a QQQ condor?

Conventions for units, bases and timestamps: https://apexvol.com/developers/conventions
