{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/farmdash/json-schema/farmdash-analyze-strategy-response-schema.json",
  "title": "AnalyzeStrategyResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/farmdash-strategy-api-openapi.yml#/components/schemas/AnalyzeStrategyResponse",
  "type": "object",
  "properties": {
    "continuation": {
      "$ref": "#/$defs/ExecutionContinuation"
    },
    "next_operation": {
      "$ref": "#/$defs/ExecutionContinuationNextOperation"
    },
    "ok": {
      "type": "boolean"
    },
    "recommendation": {
      "$ref": "#/$defs/StrategyRecommendation"
    },
    "account": {
      "type": "object",
      "properties": {
        "equity": {
          "type": "string"
        },
        "availableMargin": {
          "type": "string"
        },
        "openPositions": {
          "type": "integer"
        }
      }
    },
    "guardrails": {
      "$ref": "#/$defs/Guardrails"
    },
    "timestamp": {
      "type": "integer"
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DustStormWarning"
      }
    }
  },
  "$defs": {
    "DustStormWarning": {
      "type": "object",
      "required": [
        "kind",
        "message"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "dust_storm"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "ExecutionContinuation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schema",
        "continuation_id",
        "source",
        "execution_domain",
        "network",
        "protocol_id",
        "assets",
        "action_kind",
        "lifecycle_id",
        "trail_id",
        "next_operation",
        "available_execution_modes",
        "authority",
        "prerequisites",
        "scout_trial",
        "expires_at"
      ],
      "properties": {
        "schema": {
          "type": "string",
          "const": "farmdash.execution-continuation.v1"
        },
        "continuation_id": {
          "type": "string",
          "format": "uuid"
        },
        "source": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "type",
            "ref"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "market_estimate",
                "solana_preview",
                "futures_analysis"
              ]
            },
            "ref": {
              "type": "string",
              "maxLength": 128
            }
          }
        },
        "execution_domain": {
          "type": "string",
          "enum": [
            "spot",
            "solana",
            "futures"
          ]
        },
        "network": {
          "type": "string"
        },
        "protocol_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "assets": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "namespace",
              "network",
              "identifier",
              "kind"
            ],
            "properties": {
              "namespace": {
                "type": "string",
                "enum": [
                  "eip155",
                  "solana",
                  "hyperliquid"
                ]
              },
              "network": {
                "type": "string"
              },
              "identifier": {
                "type": "string"
              },
              "symbol": {
                "type": "string"
              },
              "kind": {
                "type": "string",
                "enum": [
                  "native",
                  "wrapped_native",
                  "token",
                  "market"
                ]
              },
              "decimals": {
                "type": "integer",
                "minimum": 0,
                "maximum": 36
              }
            }
          }
        },
        "action_kind": {
          "type": "string",
          "enum": [
            "swap",
            "prepare_order"
          ]
        },
        "lifecycle_id": {
          "type": "string",
          "format": "uuid"
        },
        "trail_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "next_operation": {
          "$ref": "#/$defs/ExecutionContinuationNextOperation"
        },
        "available_execution_modes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "USER_SIGNED",
              "BOUNDED_AUTONOMOUS"
            ]
          }
        },
        "authority": {
          "type": "string",
          "const": "NOT_GRANTED"
        },
        "prerequisites": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "scout_trial": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "exists",
            "domain",
            "daily_limit",
            "remaining",
            "status",
            "after_exhaustion"
          ],
          "properties": {
            "exists": {
              "type": "boolean",
              "const": true
            },
            "domain": {
              "type": "string",
              "enum": [
                "spot",
                "futures"
              ]
            },
            "daily_limit": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000
            },
            "remaining": {
              "type": "null"
            },
            "status": {
              "type": "string",
              "enum": [
                "unknown",
                "evaluation_required"
              ]
            },
            "after_exhaustion": {
              "type": "string",
              "const": "authoritative_admission"
            }
          }
        },
        "expires_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "ExecutionContinuationNextOperation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "endpoint",
        "parameters",
        "required_fields"
      ],
      "properties": {
        "method": {
          "type": "string",
          "const": "POST"
        },
        "endpoint": {
          "type": "string",
          "enum": [
            "/api/v1/agent/quote-intent",
            "/api/agents/solana-swap",
            "/api/agents/futures/prepare-order",
            "/api/v1/agent/futures/prepare-order"
          ]
        },
        "parameters": {
          "type": "object",
          "additionalProperties": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              }
            ]
          }
        },
        "required_fields": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "FundingAnalysis": {
      "type": "object",
      "properties": {
        "coin": {
          "type": "string"
        },
        "fundingRate": {
          "type": "number"
        },
        "annualizedRate": {
          "type": "number"
        },
        "predictedRate": {
          "type": "number"
        },
        "crossVenueDelta": {
          "type": "number"
        },
        "premium": {
          "type": "number"
        },
        "openInterest": {
          "type": "number"
        },
        "isArbOpportunity": {
          "type": "boolean"
        },
        "arbDirection": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "long_spot_short_perp",
            "short_spot_long_perp",
            null
          ]
        }
      }
    },
    "FuturesAdaptiveRisk": {
      "type": "object",
      "properties": {
        "baseRiskPercent": {
          "type": "number"
        },
        "appliedRiskPercent": {
          "type": "number"
        },
        "confidenceMultiplier": {
          "type": "number"
        },
        "volatilityMultiplier": {
          "type": "number"
        },
        "drawdownMultiplier": {
          "type": "number"
        },
        "portfolioMultiplier": {
          "type": "number"
        },
        "finalRiskMultiplier": {
          "type": "number"
        }
      }
    },
    "FuturesMarketRegime": {
      "type": "string",
      "enum": [
        "trending",
        "ranging",
        "high_volatility",
        "low_liquidity"
      ]
    },
    "FuturesPortfolioContext": {
      "type": "object",
      "properties": {
        "openPositionCount": {
          "type": "integer"
        },
        "sameAssetExposureUsd": {
          "type": "number"
        },
        "sameAssetExposurePct": {
          "type": "number"
        },
        "directionalExposurePct": {
          "type": "number"
        },
        "netDirectionalBias": {
          "type": "string",
          "enum": [
            "net_long",
            "net_short",
            "balanced"
          ]
        },
        "concentrationWarning": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "FuturesStrategyObject": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "futures"
          ]
        },
        "market": {
          "type": "string"
        },
        "direction": {
          "$ref": "#/$defs/FuturesTradeDirection"
        },
        "regime": {
          "$ref": "#/$defs/FuturesMarketRegime"
        },
        "triggerConditions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "entryLogic": {
          "type": "string"
        },
        "exitLogic": {
          "type": "string"
        },
        "riskModel": {
          "type": "object",
          "properties": {
            "baseRiskPercent": {
              "type": "number"
            },
            "appliedRiskPercent": {
              "type": "number"
            },
            "riskMultiplier": {
              "type": "number"
            },
            "leverageCap": {
              "type": "number"
            },
            "stopModel": {
              "type": "string"
            }
          }
        },
        "leverageModel": {
          "type": "object",
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "adaptive"
              ]
            },
            "suggested": {
              "type": "number"
            },
            "cap": {
              "type": "number"
            },
            "drivers": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "fallbackLogic": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "telemetryTracking": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "FuturesTradeDirection": {
      "type": "string",
      "enum": [
        "long",
        "short",
        "neutral"
      ]
    },
    "FuturesTradeSimulation": {
      "type": "object",
      "properties": {
        "methodology": {
          "type": "string",
          "enum": [
            "heuristic_preflight"
          ]
        },
        "holdingWindowHours": {
          "type": "number"
        },
        "entryValueUsd": {
          "type": "number"
        },
        "marginRequiredUsd": {
          "type": "number"
        },
        "marginImpactPct": {
          "type": "number"
        },
        "liquidationPriceEstimate": {
          "type": [
            "number",
            "null"
          ]
        },
        "stopScenarioPnlUsd": {
          "type": "number"
        },
        "targetScenarioPnlUsd": {
          "type": "number"
        },
        "oneAtrMovePnlUsd": {
          "type": "number"
        },
        "estimatedFundingPnl24hUsd": {
          "type": "number"
        },
        "estimatedFundingPnl72hUsd": {
          "type": "number"
        }
      }
    },
    "Guardrails": {
      "type": "object",
      "properties": {
        "maxLeverage": {
          "type": "integer"
        },
        "maxRiskPerTrade": {
          "type": "string"
        },
        "maxPositions": {
          "type": "integer"
        },
        "dailyLossLimit": {
          "type": "string"
        },
        "weeklyLossLimit": {
          "type": "string"
        },
        "maxDrawdown": {
          "type": "string"
        }
      }
    },
    "StrategyRecommendation": {
      "type": "object",
      "properties": {
        "recommendedStrategy": {
          "type": "string",
          "enum": [
            "funding_arb",
            "momentum_long",
            "momentum_short",
            "trend_pullback_long",
            "trend_pullback_short",
            "mean_reversion",
            "no_trade"
          ]
        },
        "confidence": {
          "type": "number"
        },
        "asset": {
          "type": "string"
        },
        "marketRegime": {
          "$ref": "#/$defs/FuturesMarketRegime"
        },
        "entry": {
          "type": "number"
        },
        "stopLoss": {
          "type": "number"
        },
        "takeProfit": {
          "type": "number"
        },
        "positionSize": {
          "type": "number"
        },
        "leverage": {
          "type": "number",
          "maximum": 5
        },
        "riskPercent": {
          "type": "number",
          "maximum": 0.02
        },
        "reasoning": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "noTradeReason": {
          "type": [
            "string",
            "null"
          ]
        },
        "strategyObject": {
          "$ref": "#/$defs/FuturesStrategyObject"
        },
        "adaptiveRisk": {
          "$ref": "#/$defs/FuturesAdaptiveRisk"
        },
        "simulation": {
          "$ref": "#/$defs/FuturesTradeSimulation"
        },
        "portfolioContext": {
          "$ref": "#/$defs/FuturesPortfolioContext"
        },
        "trailHeatCrossRef": {
          "type": "object",
          "properties": {
            "protocolId": {
              "type": "string"
            },
            "score": {
              "type": "number"
            },
            "farmingOpportunity": {
              "type": "boolean"
            },
            "referralLink": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "fundingAnalysis": {
          "$ref": "#/$defs/FundingAnalysis"
        },
        "indicators": {
          "$ref": "#/$defs/TechnicalIndicators"
        }
      }
    },
    "TechnicalIndicators": {
      "type": "object",
      "properties": {
        "ema8": {
          "type": "number"
        },
        "ema34": {
          "type": "number"
        },
        "emaCross": {
          "type": "string",
          "enum": [
            "bullish",
            "bearish",
            "neutral"
          ]
        },
        "rsi": {
          "type": "number"
        },
        "macd": {
          "type": "number"
        },
        "macdSignal": {
          "type": "number"
        },
        "macdHistogram": {
          "type": "number"
        },
        "macdCross": {
          "type": "string",
          "enum": [
            "bullish_cross",
            "bearish_cross",
            "neutral"
          ]
        },
        "adx": {
          "type": "number"
        },
        "atr": {
          "type": "number"
        },
        "bbUpper": {
          "type": "number"
        },
        "bbMiddle": {
          "type": "number"
        },
        "bbLower": {
          "type": "number"
        },
        "bbWidth": {
          "type": "number"
        },
        "volumeRatio": {
          "type": "number"
        },
        "zScore": {
          "type": "number"
        }
      }
    }
  }
}