Files
quant-os/schemas/target_package.schema.json
T

206 lines
4.5 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://boat.local/quant60/schemas/target_package.schema.json",
"title": "Quant60 TargetPackageV1",
"description": "Canonical post-risk portfolio weights. Share quantities, orders, fills and account facts are forbidden and belong to the downstream execution plan.",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"package_type",
"package_id",
"decision_id",
"release",
"evidence_class",
"model_id",
"signal_as_of",
"next_session",
"model_sha256",
"data_sha256",
"feature_sha256",
"risk_sha256",
"cost_sha256",
"optimizer_sha256",
"config_sha256",
"source_sha256",
"target_weights",
"universe",
"constraints",
"package_sha256"
],
"properties": {
"schema_version": {
"const": "1.0"
},
"package_type": {
"const": "TargetPackageV1"
},
"package_id": {
"$ref": "#/$defs/identifier"
},
"decision_id": {
"$ref": "#/$defs/identifier"
},
"release": {
"$ref": "#/$defs/identifier"
},
"evidence_class": {
"$ref": "#/$defs/identifier"
},
"model_id": {
"$ref": "#/$defs/identifier"
},
"signal_as_of": {
"type": "string",
"format": "date-time",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T15:00:00\\+08:00$"
},
"next_session": {
"type": "string",
"format": "date"
},
"model_sha256": {
"$ref": "#/$defs/sha256"
},
"data_sha256": {
"$ref": "#/$defs/sha256"
},
"feature_sha256": {
"$ref": "#/$defs/sha256"
},
"risk_sha256": {
"$ref": "#/$defs/sha256"
},
"cost_sha256": {
"$ref": "#/$defs/sha256"
},
"optimizer_sha256": {
"$ref": "#/$defs/sha256"
},
"config_sha256": {
"$ref": "#/$defs/sha256"
},
"source_sha256": {
"$ref": "#/$defs/sha256"
},
"target_weights": {
"type": "object",
"minProperties": 1,
"propertyNames": {
"$ref": "#/$defs/canonical_symbol"
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"universe": {
"type": "object",
"minProperties": 1,
"propertyNames": {
"$ref": "#/$defs/canonical_symbol"
},
"additionalProperties": {
"$ref": "#/$defs/universe_member"
}
},
"constraints": {
"$ref": "#/$defs/constraints"
},
"package_sha256": {
"$ref": "#/$defs/sha256"
}
},
"$defs": {
"identifier": {
"type": "string",
"minLength": 1,
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$"
},
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"canonical_symbol": {
"type": "string",
"pattern": "^[0-9]{6}\\.(XSHG|XSHE|XBSE)$"
},
"universe_member": {
"type": "object",
"additionalProperties": false,
"required": [
"state",
"reasons"
],
"properties": {
"state": {
"type": "string",
"enum": [
"openable",
"hold_only",
"sell_only",
"frozen",
"excluded"
]
},
"reasons": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"pattern": "^[A-Z][A-Z0-9_]*$"
}
}
}
},
"constraints": {
"type": "object",
"additionalProperties": false,
"required": [
"constraint_state",
"long_only",
"max_single_weight",
"max_gross_weight",
"max_one_way_turnover",
"actual_gross_weight"
],
"properties": {
"constraint_state": {
"type": "string",
"enum": [
"FEASIBLE",
"REPAIRED",
"RISK_REDUCTION_ONLY",
"NO_TRADE"
]
},
"long_only": {
"const": true
},
"max_single_weight": {
"type": "number",
"exclusiveMinimum": 0,
"maximum": 1
},
"max_gross_weight": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"max_one_way_turnover": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"actual_gross_weight": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
}
}
}