{
  "openapi": "3.0.3",
  "info": {
    "title": "Stooper public calculation API",
    "version": "1.2.0",
    "description": "Public deterministic calculations. No credentials required. 60 requests/minute per observed IP and 1200/minute per shared limiter instance, fixed UTC minute windows; health and accepted MCP POST requests share these limits. Directory and documentation reads remain exempt. No CORS support promised. No data uploads or database writes; request bodies are not stored by the application. Results use binary floating point. Trading estimates are not investment advice. API and availability limits subject to change."
  },
  "servers": [
    {
      "url": "https://stooper.co/api/v1"
    }
  ],
  "security": [],
  "paths": {
    "/cbm": {
      "post": {
        "operationId": "calculateCbm",
        "summary": "Calculate geometric carton volume",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CbmRequest"
              },
              "example": {
                "items": [
                  {
                    "length": 60,
                    "width": 40,
                    "height": 40,
                    "unit": "cm",
                    "quantity": 120
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CbmResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or request body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "413": {
            "description": "Payload too large (application limit 16 KiB; web server may return its own error)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported media type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "422": {
            "description": "Input validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; retry after indicated interval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Rate limiter unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/convert": {
      "post": {
        "operationId": "convertMeasurement",
        "summary": "Convert shipping measurements",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertRequest"
              },
              "example": {
                "value": 1,
                "from": "m3",
                "to": "ft3"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConvertResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or request body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "413": {
            "description": "Payload too large (application limit 16 KiB; web server may return its own error)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported media type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "422": {
            "description": "Input validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; retry after indicated interval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Rate limiter unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/risk-reward": {
      "post": {
        "operationId": "calculateRiskReward",
        "summary": "Estimate trading risk and reward",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RiskRequest"
              },
              "example": {
                "direction": "long",
                "entry": 100,
                "stop": 95,
                "target": 115,
                "account_balance": 10000,
                "risk_percent": 1,
                "fee_percent": 0.1
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or request body",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "413": {
            "description": "Payload too large (application limit 16 KiB; web server may return its own error)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "415": {
            "description": "Unsupported media type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "422": {
            "description": "Input validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; retry after indicated interval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Rate limiter unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "getApiHealth",
        "summary": "Check API and rate-limit state",
        "responses": {
          "200": {
            "description": "API ready",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited; retry after indicated interval",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "Rate limiter unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Per observed IP fixed-window maximum.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests, considering global and IP budgets.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp in seconds of next minute boundary.",
                "schema": {
                  "type": "integer"
                }
              },
              "Retry-After": {
                "description": "Seconds before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "summary": "Read this OpenAPI document",
        "responses": {
          "200": {
            "description": "OpenAPI document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CbmRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "length": {
                  "type": "number",
                  "minimum": 1e-06,
                  "maximum": 1000000.0,
                  "description": "Converted dimension must not exceed 1000 metres."
                },
                "width": {
                  "type": "number",
                  "minimum": 1e-06,
                  "maximum": 1000000.0,
                  "description": "Converted dimension must not exceed 1000 metres."
                },
                "height": {
                  "type": "number",
                  "minimum": 1e-06,
                  "maximum": 1000000.0,
                  "description": "Converted dimension must not exceed 1000 metres."
                },
                "unit": {
                  "type": "string",
                  "enum": [
                    "mm",
                    "cm",
                    "m",
                    "in",
                    "ft"
                  ]
                },
                "quantity": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 1000000,
                  "default": 1
                }
              },
              "required": [
                "length",
                "width",
                "height",
                "unit"
              ]
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [
          "items"
        ]
      },
      "ConvertRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "value": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000.0
          },
          "from": {
            "type": "string",
            "enum": [
              "mm",
              "cm",
              "m",
              "km",
              "in",
              "ft",
              "yd",
              "g",
              "kg",
              "t",
              "lb",
              "oz",
              "mm3",
              "cm3",
              "m3",
              "L",
              "mL",
              "in3",
              "ft3",
              "mm2",
              "cm2",
              "m2",
              "in2",
              "ft2"
            ]
          },
          "to": {
            "type": "string",
            "enum": [
              "mm",
              "cm",
              "m",
              "km",
              "in",
              "ft",
              "yd",
              "g",
              "kg",
              "t",
              "lb",
              "oz",
              "mm3",
              "cm3",
              "m3",
              "L",
              "mL",
              "in3",
              "ft3",
              "mm2",
              "cm2",
              "m2",
              "in2",
              "ft2"
            ]
          }
        },
        "required": [
          "value",
          "from",
          "to"
        ],
        "description": "Units must be in the same dimension. Case-sensitive symbols; t is metric tonne. Non-negative quantities only."
      },
      "RiskRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "direction": {
            "type": "string",
            "enum": [
              "long",
              "short"
            ]
          },
          "entry": {
            "type": "number",
            "minimum": 1e-08,
            "maximum": 1000000000.0
          },
          "stop": {
            "type": "number",
            "minimum": 1e-08,
            "maximum": 1000000000.0
          },
          "target": {
            "type": "number",
            "minimum": 1e-08,
            "maximum": 1000000000.0
          },
          "account_balance": {
            "type": "number",
            "minimum": 1e-06,
            "maximum": 1000000000000.0
          },
          "risk_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 1
          },
          "fixed_risk": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000000.0,
            "default": 0,
            "description": "Positive value overrides risk_percent; budget cannot exceed balance."
          },
          "fee_percent": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 0,
            "description": "Percentage charged separately at entry and exit."
          },
          "leverage": {
            "type": "number",
            "minimum": 1,
            "maximum": 1000,
            "default": 1
          },
          "unit_step": {
            "type": "number",
            "minimum": 1e-08,
            "maximum": 1000000.0,
            "default": 1
          }
        },
        "required": [
          "direction",
          "entry",
          "stop",
          "target",
          "account_balance"
        ],
        "description": "Long: stop < entry < target. Short: target < entry < stop. Both price distances >= 1e-8. Gross-risk sizing, floored to unit_step; raw units <= 1e12 and raw units/step <= 1e14. Risk budget must be positive. Monetary inputs use same currency."
      },
      "CbmResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "version": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "index": {
                      "type": "integer"
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "unit_cbm": {
                      "type": "number"
                    },
                    "total_cbm": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "index",
                    "quantity",
                    "unit_cbm",
                    "total_cbm"
                  ]
                }
              },
              "total_quantity": {
                "type": "integer"
              },
              "total_cbm": {
                "type": "number"
              },
              "total_cubic_feet": {
                "type": "number"
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "items",
              "total_quantity",
              "total_cbm",
              "total_cubic_feet",
              "note"
            ]
          }
        },
        "required": [
          "ok",
          "version",
          "data"
        ]
      },
      "ConvertResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "version": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "value": {
                "type": "number"
              },
              "from": {
                "type": "string",
                "enum": [
                  "mm",
                  "cm",
                  "m",
                  "km",
                  "in",
                  "ft",
                  "yd",
                  "g",
                  "kg",
                  "t",
                  "lb",
                  "oz",
                  "mm3",
                  "cm3",
                  "m3",
                  "L",
                  "mL",
                  "in3",
                  "ft3",
                  "mm2",
                  "cm2",
                  "m2",
                  "in2",
                  "ft2"
                ]
              },
              "to": {
                "type": "string",
                "enum": [
                  "mm",
                  "cm",
                  "m",
                  "km",
                  "in",
                  "ft",
                  "yd",
                  "g",
                  "kg",
                  "t",
                  "lb",
                  "oz",
                  "mm3",
                  "cm3",
                  "m3",
                  "L",
                  "mL",
                  "in3",
                  "ft3",
                  "mm2",
                  "cm2",
                  "m2",
                  "in2",
                  "ft2"
                ]
              },
              "dimension": {
                "type": "string",
                "enum": [
                  "length",
                  "mass",
                  "volume",
                  "area"
                ]
              },
              "result": {
                "type": "number"
              }
            },
            "required": [
              "value",
              "from",
              "to",
              "dimension",
              "result"
            ]
          }
        },
        "required": [
          "ok",
          "version",
          "data"
        ]
      },
      "RiskResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "version": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "direction": {
                "type": "string",
                "enum": [
                  "long",
                  "short"
                ]
              },
              "risk_per_unit": {
                "type": "number"
              },
              "reward_per_unit": {
                "type": "number"
              },
              "gross_reward_to_risk": {
                "type": "number"
              },
              "gross_break_even_win_percent": {
                "type": "number"
              },
              "risk_budget": {
                "type": "number"
              },
              "units": {
                "type": "number"
              },
              "position_value": {
                "type": "number"
              },
              "estimated_margin": {
                "type": "number"
              },
              "gross_risk": {
                "type": "number"
              },
              "gross_reward": {
                "type": "number"
              },
              "estimated_stop_fees": {
                "type": "number"
              },
              "estimated_target_fees": {
                "type": "number"
              },
              "net_risk": {
                "type": "number"
              },
              "net_reward": {
                "type": "number"
              },
              "net_reward_to_risk": {
                "type": "number",
                "nullable": true
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "direction",
              "risk_per_unit",
              "reward_per_unit",
              "gross_reward_to_risk",
              "gross_break_even_win_percent",
              "risk_budget",
              "units",
              "position_value",
              "estimated_margin",
              "gross_risk",
              "gross_reward",
              "estimated_stop_fees",
              "estimated_target_fees",
              "net_risk",
              "net_reward",
              "net_reward_to_risk",
              "warnings",
              "note"
            ]
          }
        },
        "required": [
          "ok",
          "version",
          "data"
        ]
      },
      "HealthResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "version": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "ok"
                ]
              },
              "rate_limit": {
                "type": "string",
                "enum": [
                  "available"
                ]
              }
            },
            "required": [
              "status",
              "rate_limit"
            ]
          }
        },
        "required": [
          "ok",
          "version",
          "data"
        ]
      },
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "field": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "ok",
          "error"
        ]
      }
    }
  }
}
