feat: preserve Quant OS target-package vertical slice

This commit is contained in:
2026-07-30 21:27:44 +08:00
parent 00efeb7ec2
commit 919c64c679
42 changed files with 15454 additions and 404 deletions
+190
View File
@@ -0,0 +1,190 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://boat.local/quant60/schemas/model_bundle.schema.json",
"title": "Quant60 deterministic Ridge model bundle",
"description": "Frozen train-only feature transforms, Ridge parameters, training cutoff, label semantics, and lineage hashes for deterministic replay.",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"artifact_type",
"bundle_sha256",
"trained_through",
"label",
"lineage",
"preprocessor",
"model"
],
"properties": {
"schema_version": {
"const": "1.0"
},
"artifact_type": {
"const": "quant60-deterministic-ridge-bundle"
},
"bundle_sha256": {
"$ref": "#/$defs/sha256"
},
"trained_through": {
"type": "string",
"format": "date"
},
"label": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"horizon_trading_days"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"horizon_trading_days": {
"type": "integer",
"minimum": 1
}
}
},
"lineage": {
"type": "object",
"additionalProperties": false,
"required": [
"data_sha256",
"source_sha256",
"config_sha256"
],
"properties": {
"data_sha256": {
"$ref": "#/$defs/sha256"
},
"source_sha256": {
"$ref": "#/$defs/sha256"
},
"config_sha256": {
"$ref": "#/$defs/sha256"
}
}
},
"preprocessor": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"winsor_fraction",
"feature_order",
"output_feature_order",
"transforms"
],
"properties": {
"type": {
"const": "train-only-winsor-impute-standardize"
},
"winsor_fraction": {
"type": "number",
"minimum": 0,
"maximum": 0.5
},
"feature_order": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1
}
},
"output_feature_order": {
"type": "array",
"minItems": 2,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1
}
},
"transforms": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/feature_transform"
}
}
}
},
"model": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"alpha",
"fit_intercept",
"coefficients",
"intercept"
],
"properties": {
"type": {
"const": "deterministic-ridge"
},
"alpha": {
"type": "number",
"minimum": 0
},
"fit_intercept": {
"type": "boolean"
},
"coefficients": {
"type": "array",
"minItems": 1,
"items": {
"type": "number"
}
},
"intercept": {
"type": "number"
}
}
}
},
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"feature_transform": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"lower",
"upper",
"median",
"mean",
"scale"
],
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"lower": {
"type": "number"
},
"upper": {
"type": "number"
},
"median": {
"type": "number"
},
"mean": {
"type": "number"
},
"scale": {
"type": "number",
"exclusiveMinimum": 0
}
}
}
}
}
+221
View File
@@ -0,0 +1,221 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://boat.local/quant60/schemas/release_reachability.schema.json",
"title": "Quant60 Release Reachability",
"description": "Per-layer evidence for implementation, tests, entrypoint reachability and real-platform observation. A repository source hash is not runtime evidence.",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"artifact_type",
"release_id",
"generated_at",
"layers",
"summary",
"manifest_sha256"
],
"properties": {
"schema_version": {
"const": "1.0"
},
"artifact_type": {
"const": "quant60-release-reachability"
},
"release_id": {
"$ref": "#/$defs/identifier"
},
"generated_at": {
"type": "string",
"format": "date-time",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
},
"layers": {
"$ref": "#/$defs/layers"
},
"summary": {
"$ref": "#/$defs/summary"
},
"manifest_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}$"
},
"artifact": {
"type": "object",
"additionalProperties": false,
"required": [
"artifact_id",
"kind",
"path",
"sha256",
"platform"
],
"properties": {
"artifact_id": {
"$ref": "#/$defs/identifier"
},
"kind": {
"type": "string",
"enum": [
"source",
"test",
"entrypoint",
"platform_run"
]
},
"path": {
"type": "string",
"minLength": 1
},
"sha256": {
"$ref": "#/$defs/sha256"
},
"platform": {
"type": "string",
"enum": [
"repository",
"local",
"joinquant",
"qmt"
]
},
"observed_at": {
"type": "string",
"format": "date-time",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
},
"run_id": {
"$ref": "#/$defs/identifier"
}
},
"dependentRequired": {
"observed_at": [
"run_id"
],
"run_id": [
"observed_at"
]
}
},
"claim": {
"type": "object",
"additionalProperties": false,
"required": [
"status",
"artifacts"
],
"properties": {
"status": {
"type": "boolean"
},
"artifacts": {
"type": "array",
"items": {
"$ref": "#/$defs/artifact"
}
}
}
},
"layer": {
"type": "object",
"additionalProperties": false,
"required": [
"implemented",
"unit_tested",
"local_entrypoint_reachable",
"jq_entrypoint_reachable",
"qmt_entrypoint_reachable",
"real_platform_observed"
],
"properties": {
"implemented": {
"$ref": "#/$defs/claim"
},
"unit_tested": {
"$ref": "#/$defs/claim"
},
"local_entrypoint_reachable": {
"$ref": "#/$defs/claim"
},
"jq_entrypoint_reachable": {
"$ref": "#/$defs/claim"
},
"qmt_entrypoint_reachable": {
"$ref": "#/$defs/claim"
},
"real_platform_observed": {
"$ref": "#/$defs/claim"
}
}
},
"layers": {
"type": "object",
"additionalProperties": false,
"required": [
"universe",
"alpha",
"portfolio",
"risk",
"execution"
],
"properties": {
"universe": {
"$ref": "#/$defs/layer"
},
"alpha": {
"$ref": "#/$defs/layer"
},
"portfolio": {
"$ref": "#/$defs/layer"
},
"risk": {
"$ref": "#/$defs/layer"
},
"execution": {
"$ref": "#/$defs/layer"
}
}
},
"summary": {
"type": "object",
"additionalProperties": false,
"required": [
"all_layers_implemented",
"all_layers_unit_tested",
"all_layers_local_entrypoint_reachable",
"all_layers_jq_entrypoint_reachable",
"all_layers_qmt_entrypoint_reachable",
"all_layers_real_platform_observed"
],
"properties": {
"all_layers_implemented": {
"type": "boolean"
},
"all_layers_unit_tested": {
"type": "boolean"
},
"all_layers_local_entrypoint_reachable": {
"type": "boolean"
},
"all_layers_jq_entrypoint_reachable": {
"type": "boolean"
},
"all_layers_qmt_entrypoint_reachable": {
"type": "boolean"
},
"all_layers_real_platform_observed": {
"type": "boolean"
}
}
}
}
}
+205
View File
@@ -0,0 +1,205 @@
{
"$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
}
}
}
}
}