|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "https://quantplatformkit.local/schemas/optimization-spec.v1.schema.json", |
| 4 | + "title": "OptimizationSpec v1", |
| 5 | + "type": "object", |
| 6 | + "required": [ |
| 7 | + "schema_version", |
| 8 | + "spec_id", |
| 9 | + "research_spec_id", |
| 10 | + "strategy_profile", |
| 11 | + "created_at", |
| 12 | + "frozen_inputs", |
| 13 | + "allowed_parameters", |
| 14 | + "objective", |
| 15 | + "search", |
| 16 | + "validation", |
| 17 | + "stop_rules", |
| 18 | + "promotion" |
| 19 | + ], |
| 20 | + "properties": { |
| 21 | + "schema_version": { "const": "optimization_spec.v1" }, |
| 22 | + "spec_id": { "type": "string", "minLength": 1 }, |
| 23 | + "research_spec_id": { "type": "string", "minLength": 1 }, |
| 24 | + "strategy_profile": { "type": "string", "minLength": 1 }, |
| 25 | + "created_at": { |
| 26 | + "type": "string", |
| 27 | + "format": "date-time", |
| 28 | + "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$" |
| 29 | + }, |
| 30 | + "frozen_inputs": { "$ref": "#/$defs/frozen_inputs" }, |
| 31 | + "allowed_parameters": { |
| 32 | + "type": "array", |
| 33 | + "minItems": 1, |
| 34 | + "x-qpk-unique-by": "name", |
| 35 | + "items": { "$ref": "#/$defs/parameter" } |
| 36 | + }, |
| 37 | + "objective": { "$ref": "#/$defs/objective" }, |
| 38 | + "search": { "$ref": "#/$defs/search" }, |
| 39 | + "validation": { "$ref": "#/$defs/validation" }, |
| 40 | + "stop_rules": { |
| 41 | + "type": "array", |
| 42 | + "minItems": 1, |
| 43 | + "items": { "type": "string", "minLength": 1 } |
| 44 | + }, |
| 45 | + "promotion": { "$ref": "#/$defs/promotion" } |
| 46 | + }, |
| 47 | + "$defs": { |
| 48 | + "frozen_inputs": { |
| 49 | + "type": "object", |
| 50 | + "required": ["data_manifest_id", "universe_id", "benchmark_ids", "cost_model_id", "code_revision"], |
| 51 | + "properties": { |
| 52 | + "data_manifest_id": { "type": "string", "minLength": 1 }, |
| 53 | + "universe_id": { "type": "string", "minLength": 1 }, |
| 54 | + "benchmark_ids": { |
| 55 | + "type": "array", |
| 56 | + "minItems": 1, |
| 57 | + "items": { "type": "string", "minLength": 1 } |
| 58 | + }, |
| 59 | + "cost_model_id": { "type": "string", "minLength": 1 }, |
| 60 | + "code_revision": { "type": "string", "minLength": 1 } |
| 61 | + }, |
| 62 | + "additionalProperties": true |
| 63 | + }, |
| 64 | + "parameter": { |
| 65 | + "type": "object", |
| 66 | + "required": ["name", "kind"], |
| 67 | + "properties": { |
| 68 | + "name": { "type": "string", "minLength": 1 }, |
| 69 | + "kind": { "enum": ["integer", "number", "choice", "boolean"] }, |
| 70 | + "bounds": { |
| 71 | + "type": "array", |
| 72 | + "minItems": 2, |
| 73 | + "maxItems": 2, |
| 74 | + "items": { "type": "number" } |
| 75 | + }, |
| 76 | + "choices": { |
| 77 | + "type": "array", |
| 78 | + "minItems": 1, |
| 79 | + "items": { "type": ["string", "number", "boolean"] } |
| 80 | + }, |
| 81 | + "step": { "type": "number", "exclusiveMinimum": 0 } |
| 82 | + }, |
| 83 | + "allOf": [ |
| 84 | + { |
| 85 | + "if": { |
| 86 | + "required": ["kind"], |
| 87 | + "properties": { "kind": { "const": "integer" } } |
| 88 | + }, |
| 89 | + "then": { |
| 90 | + "required": ["bounds"], |
| 91 | + "properties": { |
| 92 | + "bounds": { "items": { "type": "integer" } }, |
| 93 | + "step": { "type": "integer", "exclusiveMinimum": 0 } |
| 94 | + } |
| 95 | + } |
| 96 | + }, |
| 97 | + { |
| 98 | + "if": { |
| 99 | + "required": ["kind"], |
| 100 | + "properties": { "kind": { "const": "number" } } |
| 101 | + }, |
| 102 | + "then": { "required": ["bounds"] } |
| 103 | + }, |
| 104 | + { |
| 105 | + "if": { |
| 106 | + "required": ["kind"], |
| 107 | + "properties": { "kind": { "const": "choice" } } |
| 108 | + }, |
| 109 | + "then": { "required": ["choices"] } |
| 110 | + } |
| 111 | + ], |
| 112 | + "additionalProperties": true |
| 113 | + }, |
| 114 | + "objective": { |
| 115 | + "type": "object", |
| 116 | + "required": ["primary_metric", "hard_constraints"], |
| 117 | + "properties": { |
| 118 | + "primary_metric": { "type": "string", "minLength": 1 }, |
| 119 | + "secondary_metrics": { |
| 120 | + "type": "array", |
| 121 | + "items": { "type": "string", "minLength": 1 } |
| 122 | + }, |
| 123 | + "hard_constraints": { |
| 124 | + "type": "array", |
| 125 | + "minItems": 1, |
| 126 | + "items": { "type": "string", "minLength": 1 } |
| 127 | + } |
| 128 | + }, |
| 129 | + "additionalProperties": true |
| 130 | + }, |
| 131 | + "search": { |
| 132 | + "type": "object", |
| 133 | + "required": ["method", "max_trials", "random_seed"], |
| 134 | + "properties": { |
| 135 | + "method": { "enum": ["grid", "random", "bayesian"] }, |
| 136 | + "max_trials": { "type": "integer", "minimum": 1 }, |
| 137 | + "random_seed": { "type": "integer" } |
| 138 | + }, |
| 139 | + "additionalProperties": true |
| 140 | + }, |
| 141 | + "validation": { |
| 142 | + "type": "object", |
| 143 | + "required": ["nested_walk_forward", "locked_holdout", "multiple_testing", "cost_stress"], |
| 144 | + "properties": { |
| 145 | + "nested_walk_forward": { |
| 146 | + "type": "object", |
| 147 | + "required": ["enabled", "fold_count", "selection_scope"], |
| 148 | + "properties": { |
| 149 | + "enabled": { "const": true }, |
| 150 | + "fold_count": { "type": "integer", "minimum": 3 }, |
| 151 | + "selection_scope": { "const": "train_validation_only" } |
| 152 | + }, |
| 153 | + "additionalProperties": true |
| 154 | + }, |
| 155 | + "locked_holdout": { |
| 156 | + "type": "object", |
| 157 | + "required": ["enabled", "reused_for_selection"], |
| 158 | + "properties": { |
| 159 | + "enabled": { "const": true }, |
| 160 | + "reused_for_selection": { "const": false } |
| 161 | + }, |
| 162 | + "additionalProperties": true |
| 163 | + }, |
| 164 | + "multiple_testing": { |
| 165 | + "type": "object", |
| 166 | + "required": ["method", "trial_ledger_id", "record_all_trials"], |
| 167 | + "properties": { |
| 168 | + "method": { "enum": ["dsr", "pbo", "spa", "reality_check", "fdr", "other_equivalent"] }, |
| 169 | + "trial_ledger_id": { "type": "string", "minLength": 1 }, |
| 170 | + "record_all_trials": { "const": true } |
| 171 | + }, |
| 172 | + "additionalProperties": true |
| 173 | + }, |
| 174 | + "cost_stress": { |
| 175 | + "type": "object", |
| 176 | + "required": ["multipliers", "required_pass"], |
| 177 | + "properties": { |
| 178 | + "multipliers": { |
| 179 | + "type": "array", |
| 180 | + "minItems": 3, |
| 181 | + "items": { "type": "number", "minimum": 1 }, |
| 182 | + "allOf": [ |
| 183 | + { "contains": { "const": 1 } }, |
| 184 | + { "contains": { "const": 2 } }, |
| 185 | + { "contains": { "const": 3 } } |
| 186 | + ] |
| 187 | + }, |
| 188 | + "required_pass": { "const": true } |
| 189 | + }, |
| 190 | + "additionalProperties": true |
| 191 | + } |
| 192 | + }, |
| 193 | + "additionalProperties": true |
| 194 | + }, |
| 195 | + "promotion": { |
| 196 | + "type": "object", |
| 197 | + "required": [ |
| 198 | + "requires_human_approval", |
| 199 | + "automatic_risk_increase_allowed", |
| 200 | + "full_kelly_allowed", |
| 201 | + "max_fractional_kelly" |
| 202 | + ], |
| 203 | + "properties": { |
| 204 | + "requires_human_approval": { "const": true }, |
| 205 | + "automatic_risk_increase_allowed": { "const": false }, |
| 206 | + "full_kelly_allowed": { "const": false }, |
| 207 | + "max_fractional_kelly": { "type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 1 } |
| 208 | + }, |
| 209 | + "additionalProperties": true |
| 210 | + } |
| 211 | + }, |
| 212 | + "additionalProperties": true |
| 213 | +} |
0 commit comments