{
  "openapi": "3.1.0",
  "info": {
    "title": "Strikewise Options Pricing API",
    "version": "0.2.0",
    "description": "Educational options pricing and original scoring on Cloudflare; separate market-data access via Render."
  },
  "servers": [
    {
      "url": "https://syntrixlabs.net"
    }
  ],
  "paths": {
    "/api/v1/options/analysis": {
      "post": {
        "operationId": "optionsPricingAnalysis",
        "summary": "European and American options pricing, Greeks and long payoff",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "S",
                  "K",
                  "T",
                  "r",
                  "sigma",
                  "type",
                  "q"
                ],
                "properties": {
                  "S": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000,
                    "description": "Underlying USD/share"
                  },
                  "K": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000,
                    "description": "Strike USD/share"
                  },
                  "T": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 10,
                    "description": "Years to expiry"
                  },
                  "r": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "Annual risk-free rate decimal"
                  },
                  "sigma": {
                    "type": "number",
                    "minimum": 0.0001,
                    "maximum": 5,
                    "description": "Annual volatility decimal"
                  },
                  "type": {
                    "enum": [
                      "call",
                      "put"
                    ]
                  },
                  "q": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "description": "Continuous dividend yield decimal"
                  },
                  "premium": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000,
                    "description": "Paid premium USD/share; required for payoff and breakeven"
                  },
                  "terminal": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000000,
                    "description": "Hypothetical expiration price USD/share; required with premium"
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "S": 100,
                "K": 100,
                "T": 1,
                "r": 0.05,
                "sigma": 0.2,
                "type": "call",
                "q": 0,
                "premium": 5,
                "terminal": 110
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Theoretical price, Greeks, assumptions and optional payoff",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid inputs"
          },
          "413": {
            "description": "Request too large"
          }
        }
      }
    },
    "/api/v1/options/market-data": {
      "post": {
        "operationId": "optionsMarketData",
        "summary": "Retrieve public market information via Strikewise Render; bounded timeout and explicit retry",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "operation",
                  "ticker"
                ],
                "properties": {
                  "operation": {
                    "enum": [
                      "quote",
                      "expirations",
                      "chain",
                      "ivrank"
                    ]
                  },
                  "ticker": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9.\\-]{1,10}$"
                  },
                  "expiration": {
                    "type": "string",
                    "format": "date"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Structured educational result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "403": {
            "description": "Upstream access restricted"
          },
          "413": {
            "description": "Request too large"
          },
          "429": {
            "description": "Upstream rate limited"
          },
          "502": {
            "description": "Invalid upstream data"
          },
          "503": {
            "description": "Disabled, unavailable or starting; retry when indicated"
          }
        }
      }
    },
    "/api/v1/options/trade-score": {
      "post": {
        "operationId": "optionsTradeScore",
        "summary": "Compute original educational trade scoring rubric",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "S",
                  "K",
                  "T",
                  "r",
                  "sigma",
                  "type",
                  "premium",
                  "ticker"
                ],
                "properties": {
                  "S": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000
                  },
                  "K": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000
                  },
                  "T": {
                    "type": "number",
                    "minimum": 0.0027397260273972603,
                    "maximum": 10
                  },
                  "r": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "sigma": {
                    "type": "number",
                    "minimum": 0.0001,
                    "maximum": 5
                  },
                  "type": {
                    "enum": [
                      "call",
                      "put"
                    ]
                  },
                  "premium": {
                    "type": "number",
                    "exclusiveMinimum": 0,
                    "maximum": 1000000
                  },
                  "ticker": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9.\\-]{1,10}$"
                  },
                  "mode": {
                    "enum": [
                      "long",
                      "vertical_credit",
                      "iron_condor"
                    ]
                  },
                  "rv_rank": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100,
                    "description": "Caller-supplied realized-volatility rank proxy, not true IV rank."
                  },
                  "legs": {
                    "type": "array",
                    "maxItems": 4,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "strike",
                        "type",
                        "action"
                      ],
                      "properties": {
                        "strike": {
                          "type": "number",
                          "exclusiveMinimum": 0,
                          "maximum": 1000000
                        },
                        "type": {
                          "enum": [
                            "call",
                            "put"
                          ]
                        },
                        "action": {
                          "enum": [
                            "buy",
                            "sell"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Structured educational result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "413": {
            "description": "Request too large"
          }
        }
      }
    }
  }
}