{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/quantifyme-ai/json-schema/quantifyme-ai-one-shot-status-response-schema.json",
  "title": "OneShotStatusResponse",
  "description": "Poll snapshot. Keep polling every few seconds while `done` is false.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/quantifyme-ai-openapi.json#/components/schemas/OneShotStatusResponse",
  "properties": {
    "author": {
      "description": "Community strategy author, when source='community'.",
      "type": "string"
    },
    "channels": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "code": {
      "description": "The generated Python strategy.",
      "type": "string"
    },
    "community_id": {
      "type": [
        "integer",
        "null"
      ]
    },
    "done": {
      "description": "True once the job is terminal (success OR failure).",
      "type": "boolean"
    },
    "error": {
      "description": "Failure reason when done=true and ok=false: the sentence to show the user.",
      "type": [
        "string",
        "null"
      ]
    },
    "error_code": {
      "description": "On a failure: a fixed word a program can branch on (the error event's `code`; this snapshot's own `code` is the strategy code); with the refusal's numbers (credits_remaining, credits_required, top_up_url, retry_after_s) when it has them. 'internal_error' (an unexpected server error) carries request_id, the reference to quote to support.",
      "type": [
        "string",
        "null"
      ]
    },
    "live_url": {
      "description": "Live dashboard for the deployed model. Show this to the user.",
      "type": "string"
    },
    "model": {
      "type": "string"
    },
    "msg": {
      "description": "Human-readable progress line.",
      "type": "string"
    },
    "ok": {
      "description": "Only meaningful once done=true.",
      "type": "boolean"
    },
    "pct": {
      "description": "0-100 progress.",
      "type": "integer"
    },
    "source": {
      "description": "'community' means a PRE-EXISTING strategy by `author` was deployed, not a fresh one; only when the caller sent its community_id. A vague prompt deploys a curated 'preset', or a 'generated' build when the market has none.",
      "enum": [
        "generated",
        "community",
        "preset"
      ],
      "type": "string"
    },
    "stage": {
      "enum": [
        "generate",
        "train",
        "deploy"
      ],
      "type": "string"
    },
    "stats": {
      "description": "Backtest result. `ret`/`mdd` are fractions (0.119 = 11.9%), `wr` is a fraction, `n` is trade count.",
      "properties": {
        "mdd": {
          "type": "number"
        },
        "n": {
          "type": "integer"
        },
        "pf": {
          "type": "number"
        },
        "ret": {
          "type": "number"
        },
        "wr": {
          "type": "number"
        }
      },
      "type": "object"
    },
    "stem": {
      "type": "string"
    },
    "strategy_url": {
      "type": "string"
    },
    "suggestion": {
      "description": "After a vague prompt: a community strategy that matched, OFFERED and not deployed (#1686). Deploy it only if the user picks it after seeing its author and code, by calling one_shot with its community_id.",
      "properties": {
        "author": {
          "type": "string"
        },
        "community_id": {
          "type": "integer"
        },
        "title": {
          "type": "string"
        }
      },
      "type": [
        "object",
        "null"
      ]
    },
    "symbol": {
      "type": "string"
    },
    "timeframe": {
      "type": "string"
    }
  },
  "type": "object"
}