{
  "properties": {
    "capital_model": {
      "default": "partitioned",
      "description": "How the basket shares capital. 'partitioned': each instrument gets its own capital slice (the default \u2014 sleeves cannot borrow from one another). 'shared_pool': all instruments draw from one cash-bounded pool.",
      "enum": [
        "partitioned",
        "shared_pool"
      ],
      "title": "Capital Model",
      "type": "string"
    },
    "collection_risk": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Book-level reactive risk controls applied to the WHOLE basket (cash + total exposure), as a dict. All fields optional: 'max_daily_loss_pct' (0.1-50) halts ALL new entries across the book if the book's daily P&L drops below -X% (soft = resume next UTC day, hard = manual reset; 'halt_behavior', 'cooldown_bars' tune it); 'max_entries_per_day' / 'max_total_entries' cap NEW entries across the book per day / per run; 'min_cash_pct' (0<=x<1) holds a cash reserve so an entry can't push pool cash below that fraction of book equity. Example: {'max_daily_loss_pct': 5.0, 'max_entries_per_day': 3, 'min_cash_pct': 0.1}. Omit for no book-level risk controls. Distinct from the per-instrument 'risk_policy' breaker \u2014 this governs the whole book.",
      "title": "Collection Risk"
    },
    "constraints": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Construction concentration bounds applied when cross-instrument weights are computed, as a dict. Enforced fields: 'max_position_pct' (0<x<=1) caps any single instrument's weight; 'min_position_pct' (0<=x<1) is a per-instrument MINIMUM received weight \u2014 an instrument that would receive less is dropped (not held) and its weight redistributes to the rest ('no dust positions'); 'asset_class_caps' ({asset_class: max_weight}) caps aggregate weight per asset class \u2014 ALL THREE apply ONLY to a construction-managed rotation (rank_based / signal_proportional + a calendar rebalance); they are rejected on a static / equal_weight basket because they would silently no-op. 'max_active_sleeves' (>=1) caps how many instruments may hold a position at once (book-level max positions) and applies to ANY basket. Example for a top-N rotation: {'max_position_pct': 0.4, 'min_position_pct': 0.1}. Other fields (sector_caps, gross/net leverage) are not yet enforced and are rejected. Omit for no construction constraints.",
      "title": "Constraints"
    },
    "exit_top_n": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional looser exit rank for entry/exit hysteresis on mode='rank_based' only. When set, an already-held instrument stays held until it drops out of the top exit_top_n (not just top_n); a NOT-yet-held instrument still only enters at top_n. Must be strictly greater than top_n. Omit for no hysteresis (today's behavior \u2014 a single top_n cutoff for both entry and exit). Example: top_n=2, exit_top_n=3 approximates 'enter top 40%, exit top 60%' on a 5-name basket.",
      "title": "Exit Top N"
    },
    "mode": {
      "description": "How capital is WEIGHTED across the instruments of a BASKET strategy (len(instruments) >= 2) \u2014 distinct from within-leaf 'allocation' (sizing). 'equal_weight': every active instrument gets the same weight. This is STATIC and MUST use rebalance='none' \u2014 equal_weight + a calendar rebalance is REJECTED (periodic rebalancing of static weights is deferred P3.x). 'rank_based': hold the top_n instruments by 'score', equal-weighted \u2014 this is a rotation (e.g. 'rotate into the top 3 by momentum'). Optionally pair with 'exit_top_n' for entry/exit hysteresis (reduces rank-boundary whipsaw). 'signal_proportional': weight EVERY instrument in proportion to its 'score'. rank_based and signal_proportional rank/weight on a live signal and therefore REQUIRE a calendar rebalance (daily/weekly/monthly). Sets intent-level construction, NOT per-symbol weights.",
      "enum": [
        "equal_weight",
        "rank_based",
        "signal_proportional"
      ],
      "title": "Mode",
      "type": "string"
    },
    "rebalance": {
      "default": "none",
      "description": "When construction weights are recomputed. 'none' (set once and hold; the ONLY valid value for equal_weight) vs 'daily'/'weekly'/'monthly' (REQUIRED for rank_based/signal_proportional to re-rank). See mode.",
      "enum": [
        "none",
        "daily",
        "weekly",
        "monthly"
      ],
      "title": "Rebalance",
      "type": "string"
    },
    "score": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The raw per-instrument signal to rank/weight on, as an inline IndicatorRef. Required for rank_based / signal_proportional; omit for equal_weight. Example (20-bar momentum): {'indicator_type': 'ROC', 'params': {'period': 20}}. Higher values rank/weight higher. This must be a RAW per-instrument metric (an indicator like ROC / SMA / RSI) \u2014 the constructor performs the cross-sectional ranking itself, so cross-sectional refs (RankRef / ZScoreRef / cross_sectional_percentile / sibling) are rejected.",
      "title": "Score"
    },
    "strategy_id": {
      "description": "Strategy ID",
      "title": "Strategy Id",
      "type": "string"
    },
    "top_n": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Number of top-ranked instruments to hold (equal-weighted). REQUIRED for mode='rank_based'; must be omitted for the other modes. Example: top_n=3 to rotate into the 3 strongest instruments.",
      "title": "Top N"
    }
  },
  "required": [
    "strategy_id",
    "mode"
  ],
  "title": "builder_set_allocationArguments",
  "type": "object"
}
