{
  "openapi": "3.0.3",
  "info": {
    "title": "Quant Strategy Overfitting and Portfolio Risk Gate",
    "version": "1.2.0",
    "description": "Institutional 7-gate trading strategy overfitting stress auditor (1,000-run Monte Carlo + Prop Firm drawdown survival), Multi-Strategy Half-Kelly portfolio optimizer, authoritative IANA RDAP domain risk gate, B2B email deliverability risk gate, and SPF/DMARC/MTA-STS domain security auditor."
  },
  "servers": [
    {
      "url": "https://quant-b2b-risk-gate-api.vercel.app"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check and available endpoints",
        "responses": {
          "200": {
            "description": "Service is healthy"
          }
        }
      }
    },
    "/v1/quant/overfitting-audit": {
      "post": {
        "operationId": "auditTradingStrategyOverfitting",
        "summary": "Audit trading strategies for overfitting & Prop Firm pass probability",
        "description": "Audits MT5, MT4, TradingView, or quant backtest trade lists across 7 institutional gates: Walk-Forward Efficiency, outlier dependency, 1,000-iteration Monte Carlo slippage/spread stress, and Prop Firm (FTMO / FundedNext) pass probability.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "initialBalance": {
                    "type": "number",
                    "default": 10000
                  },
                  "monteCarloRuns": {
                    "type": "integer",
                    "default": 1000
                  },
                  "strategies": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              },
              "example": {
                "initialBalance": 10000,
                "monteCarloRuns": 1000,
                "strategies": [
                  {
                    "name": "USDJPY_London_Breakout_v1",
                    "symbol": "USDJPY",
                    "pipValuePerTrade": 10,
                    "inSampleRatio": 0.65,
                    "mql5Code": "void OnTick(){ trade.Buy(InpLots, _Symbol, ask, sl, tp, \"LondonBreakout\"); }",
                    "trades": [
                      {
                        "date": "2024-01-10",
                        "pnl": 145
                      },
                      {
                        "date": "2024-01-18",
                        "pnl": -85
                      },
                      {
                        "date": "2024-02-02",
                        "pnl": 160
                      },
                      {
                        "date": "2024-02-14",
                        "pnl": 120
                      },
                      {
                        "date": "2024-03-01",
                        "pnl": -90
                      },
                      {
                        "date": "2024-03-15",
                        "pnl": 175
                      },
                      {
                        "date": "2024-04-04",
                        "pnl": 130
                      },
                      {
                        "date": "2024-04-19",
                        "pnl": -80
                      },
                      {
                        "date": "2024-05-08",
                        "pnl": 155
                      },
                      {
                        "date": "2024-05-22",
                        "pnl": 140
                      },
                      {
                        "date": "2024-06-07",
                        "pnl": -95
                      },
                      {
                        "date": "2024-06-21",
                        "pnl": 180
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Overfitting audit completed"
          }
        }
      }
    },
    "/v1/quant/portfolio-kelly": {
      "post": {
        "operationId": "optimizeMultiStrategyPortfolio",
        "summary": "Optimize multi-strategy portfolio via correlation pruning & Half-Kelly sizing",
        "description": "Detects collinear strategies, splits Tier-1 Live vs Tier-2 Reserve rosters, and computes Risk-Parity & Half-Kelly lot allocations within your Max Drawdown budget.",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "initialBalance": {
                    "type": "number",
                    "default": 10000
                  },
                  "targetMaxDrawdownPct": {
                    "type": "number",
                    "default": 15
                  },
                  "maxPairwiseCorrelation": {
                    "type": "number",
                    "default": 0.7
                  },
                  "strategies": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              },
              "example": {
                "initialBalance": 10000,
                "targetMaxDrawdownPct": 15,
                "maxPairwiseCorrelation": 0.7,
                "strategies": [
                  {
                    "name": "USDJPY_London_Momentum",
                    "symbol": "USDJPY",
                    "baseLots": 0.1,
                    "trades": [
                      {
                        "date": "2024-01-05",
                        "pnl": 180
                      },
                      {
                        "date": "2024-01-12",
                        "pnl": -70
                      },
                      {
                        "date": "2024-01-19",
                        "pnl": 210
                      },
                      {
                        "date": "2024-01-26",
                        "pnl": 140
                      },
                      {
                        "date": "2024-02-02",
                        "pnl": -80
                      },
                      {
                        "date": "2024-02-09",
                        "pnl": 190
                      }
                    ]
                  },
                  {
                    "name": "XAUUSD_NY_Pullback",
                    "symbol": "XAUUSD",
                    "baseLots": 0.1,
                    "trades": [
                      {
                        "date": "2024-01-05",
                        "pnl": -60
                      },
                      {
                        "date": "2024-01-12",
                        "pnl": 240
                      },
                      {
                        "date": "2024-01-19",
                        "pnl": 190
                      },
                      {
                        "date": "2024-01-26",
                        "pnl": -85
                      },
                      {
                        "date": "2024-02-02",
                        "pnl": 260
                      },
                      {
                        "date": "2024-02-09",
                        "pnl": 175
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Portfolio optimization completed"
          }
        }
      }
    },
    "/v1/b2b/rdap-domain-audit": {
      "post": {
        "operationId": "auditDomainRdapSecurity",
        "summary": "Inspect domain age, expiry, DNSSEC & transfer-lock via authoritative IANA RDAP",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domains": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expiryWarningDays": {
                    "type": "integer",
                    "default": 30
                  }
                }
              },
              "example": {
                "domains": [
                  "openai.com",
                  "apify.com"
                ],
                "expiryWarningDays": 30
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "RDAP domain audit completed"
          }
        }
      }
    },
    "/v1/b2b/email-deliverability-gate": {
      "post": {
        "operationId": "scoreEmailDeliverabilityRisk",
        "summary": "Score B2B emails (0-100) for MX, SPF, disposable & role-account risk",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "emails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "emails": [
                  "founder@stripe.com",
                  "support@apify.com",
                  "test@mailinator.com"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email deliverability risk scoring completed"
          }
        }
      }
    },
    "/v1/b2b/domain-email-security-audit": {
      "post": {
        "operationId": "auditDomainEmailSecurity",
        "summary": "Audit domain SPF, DMARC, MTA-STS, BIMI & MX spoofing risk posture",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domains": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "domains": [
                  "stripe.com",
                  "cloudflare.com"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Domain email security audit completed"
          }
        }
      }
    }
  }
}