@usherlabs/cex-broker 0.2.46 → 0.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/commands/cex-canonical-orderbook-export.d.ts +23 -0
  2. package/dist/commands/cex-canonical-orderbook-export.js +27731 -0
  3. package/dist/commands/cex-canonical-orderbook-export.js.map +247 -0
  4. package/dist/commands/market-data-vendor-backfill.d.ts +24 -0
  5. package/dist/commands/market-data-vendor-backfill.js +33316 -0
  6. package/dist/commands/market-data-vendor-backfill.js.map +279 -0
  7. package/dist/helpers/canonical-orderbook-export/exact-selection.d.ts +21 -0
  8. package/dist/helpers/canonical-orderbook-export/exporter.d.ts +26 -0
  9. package/dist/helpers/market-data-preparation/conformance-fixtures.d.ts +16 -0
  10. package/dist/helpers/market-data-preparation/contracts.d.ts +1690 -0
  11. package/dist/helpers/market-data-preparation/file-job.d.ts +38 -0
  12. package/dist/market-data-preparation/fixtures/conformance-v2.json +424 -0
  13. package/dist/market-data-preparation/policies/capability-policy.json +28 -0
  14. package/dist/market-data-preparation/policies/resource-policy.json +16 -0
  15. package/dist/market-data-preparation/schema-manifest.json +46 -0
  16. package/dist/market-data-preparation/schemas/archive-selection-v1.schema.json +224 -0
  17. package/dist/market-data-preparation/schemas/backfill-request-v1.schema.json +166 -0
  18. package/dist/market-data-preparation/schemas/backfill-result-v2.schema.json +212 -0
  19. package/dist/market-data-preparation/schemas/canonical-orderbook-export-request-v1.schema.json +57 -0
  20. package/dist/market-data-preparation/schemas/canonical-orderbook-export-result-v1.schema.json +238 -0
  21. package/dist/market-data-preparation/schemas/preparation-product-pin-v1.schema.json +126 -0
  22. package/dist/market-data-preparation/schemas/promotion-receipt-v1.schema.json +171 -0
  23. package/dist/market-data-preparation/schemas/required-clock-v1.schema.json +47 -0
  24. package/dist/market-data-preparation.d.ts +4 -0
  25. package/dist/market-data-preparation.js +27569 -0
  26. package/dist/market-data-preparation.js.map +249 -0
  27. package/dist/market-data-vendor-backfill.js +32 -1
  28. package/dist/market-data-vendor-backfill.js.map +3 -3
  29. package/package.json +15 -3
@@ -0,0 +1,224 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1",
4
+ "title": "Market data vendor backfill archive selection v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "selection_sha256",
10
+ "scope",
11
+ "required_clock",
12
+ "coverage_policy",
13
+ "source_policy",
14
+ "coverage_class",
15
+ "requested_intervals",
16
+ "selected_intervals",
17
+ "precedence",
18
+ "bundles",
19
+ "support_anchors",
20
+ "receipt_ids",
21
+ "qualification_event_ids",
22
+ "resolved_at"
23
+ ],
24
+ "properties": {
25
+ "schema_id": {
26
+ "const": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1"
27
+ },
28
+ "selection_sha256": { "$ref": "#/$defs/sha256" },
29
+ "scope": { "$ref": "#/$defs/scope" },
30
+ "required_clock": { "$ref": "#/$defs/clockReference" },
31
+ "coverage_policy": { "$ref": "#/$defs/coveragePolicy" },
32
+ "source_policy": { "enum": ["authoritative_window", "fill_gaps"] },
33
+ "coverage_class": { "enum": ["complete", "partial", "missing"] },
34
+ "requested_intervals": {
35
+ "type": "array",
36
+ "minItems": 1,
37
+ "items": { "$ref": "#/$defs/interval" }
38
+ },
39
+ "selected_intervals": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": [
45
+ "start_at",
46
+ "end_at",
47
+ "capture_bundle_id",
48
+ "capture_origin"
49
+ ],
50
+ "properties": {
51
+ "start_at": { "$ref": "#/$defs/timestamp" },
52
+ "end_at": { "$ref": "#/$defs/timestamp" },
53
+ "capture_bundle_id": { "$ref": "#/$defs/sha256" },
54
+ "capture_origin": { "$ref": "#/$defs/captureOrigin" }
55
+ }
56
+ }
57
+ },
58
+ "precedence": {
59
+ "type": "array",
60
+ "minItems": 1,
61
+ "maxItems": 2,
62
+ "uniqueItems": true,
63
+ "items": { "enum": ["archive", "vendor"] }
64
+ },
65
+ "bundles": {
66
+ "type": "array",
67
+ "items": {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": [
71
+ "capture_bundle_id",
72
+ "capture_origin",
73
+ "interval",
74
+ "qualification"
75
+ ],
76
+ "properties": {
77
+ "capture_bundle_id": { "$ref": "#/$defs/sha256" },
78
+ "capture_origin": { "$ref": "#/$defs/captureOrigin" },
79
+ "interval": { "$ref": "#/$defs/interval" },
80
+ "qualification": {
81
+ "oneOf": [
82
+ { "type": "null" },
83
+ {
84
+ "type": "object",
85
+ "additionalProperties": false,
86
+ "required": [
87
+ "qualification_event_id",
88
+ "state",
89
+ "receipt_id",
90
+ "promotion_identity_sha256"
91
+ ],
92
+ "properties": {
93
+ "qualification_event_id": { "$ref": "#/$defs/uuid" },
94
+ "state": { "const": "qualified" },
95
+ "receipt_id": { "$ref": "#/$defs/sha256" },
96
+ "promotion_identity_sha256": { "$ref": "#/$defs/sha256" }
97
+ }
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "support_anchors": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "object",
108
+ "additionalProperties": false,
109
+ "required": [
110
+ "capture_bundle_id",
111
+ "raw_capture_id",
112
+ "snapshot_id",
113
+ "source_time",
114
+ "normalized_summary_checksum",
115
+ "metadata_ref"
116
+ ],
117
+ "properties": {
118
+ "capture_bundle_id": { "$ref": "#/$defs/sha256" },
119
+ "raw_capture_id": { "$ref": "#/$defs/sha256" },
120
+ "snapshot_id": { "$ref": "#/$defs/sha256" },
121
+ "source_time": { "$ref": "#/$defs/timestamp" },
122
+ "normalized_summary_checksum": { "$ref": "#/$defs/sha256" },
123
+ "metadata_ref": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "capture_origin",
128
+ "qualification_event_id",
129
+ "receipt_id"
130
+ ],
131
+ "properties": {
132
+ "capture_origin": { "$ref": "#/$defs/captureOrigin" },
133
+ "qualification_event_id": {
134
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/uuid" }]
135
+ },
136
+ "receipt_id": {
137
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ },
144
+ "receipt_ids": {
145
+ "type": "array",
146
+ "uniqueItems": true,
147
+ "items": { "$ref": "#/$defs/sha256" }
148
+ },
149
+ "qualification_event_ids": {
150
+ "type": "array",
151
+ "uniqueItems": true,
152
+ "items": { "$ref": "#/$defs/uuid" }
153
+ },
154
+ "resolved_at": { "$ref": "#/$defs/timestamp" }
155
+ },
156
+ "$defs": {
157
+ "uuid": {
158
+ "type": "string",
159
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
160
+ },
161
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
162
+ "timestamp": {
163
+ "type": "string",
164
+ "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$"
165
+ },
166
+ "safeInteger": {
167
+ "type": "integer",
168
+ "minimum": 0,
169
+ "maximum": 9007199254740991
170
+ },
171
+ "captureOrigin": {
172
+ "enum": ["production_capture", "vendor_historical_backfill"]
173
+ },
174
+ "scope": {
175
+ "type": "object",
176
+ "additionalProperties": false,
177
+ "required": ["exchange", "trading_pair", "market_type", "feed"],
178
+ "properties": {
179
+ "exchange": {
180
+ "type": "string",
181
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
182
+ },
183
+ "trading_pair": { "type": "string", "minLength": 3, "maxLength": 128 },
184
+ "market_type": { "enum": ["spot", "swap", "future"] },
185
+ "feed": { "const": "ORDERBOOK" }
186
+ }
187
+ },
188
+ "clockReference": {
189
+ "type": "object",
190
+ "additionalProperties": false,
191
+ "required": ["clock_id", "clock_sha256", "event_count"],
192
+ "properties": {
193
+ "clock_id": { "$ref": "#/$defs/uuid" },
194
+ "clock_sha256": { "$ref": "#/$defs/sha256" },
195
+ "event_count": { "$ref": "#/$defs/safeInteger" }
196
+ }
197
+ },
198
+ "coveragePolicy": {
199
+ "type": "object",
200
+ "additionalProperties": false,
201
+ "required": [
202
+ "policy_id",
203
+ "max_asof_lag_ms",
204
+ "future_rows",
205
+ "missing_required_event"
206
+ ],
207
+ "properties": {
208
+ "policy_id": { "const": "prior-asof-strict/v1" },
209
+ "max_asof_lag_ms": { "$ref": "#/$defs/safeInteger" },
210
+ "future_rows": { "const": "reject" },
211
+ "missing_required_event": { "const": "fail" }
212
+ }
213
+ },
214
+ "interval": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "required": ["start_at", "end_at"],
218
+ "properties": {
219
+ "start_at": { "$ref": "#/$defs/timestamp" },
220
+ "end_at": { "$ref": "#/$defs/timestamp" }
221
+ }
222
+ }
223
+ }
224
+ }
@@ -0,0 +1,166 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.usher.so/market-data-vendor-backfill-request/v1",
4
+ "title": "Market data vendor backfill request v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "request_id",
10
+ "attempt_id",
11
+ "idempotency_key",
12
+ "scope",
13
+ "window",
14
+ "depth",
15
+ "construction_mode",
16
+ "source_policy",
17
+ "target",
18
+ "coverage_policy",
19
+ "required_clock",
20
+ "initial_selection",
21
+ "expected_canonical_schema",
22
+ "product_pins",
23
+ "production_authorization_id"
24
+ ],
25
+ "properties": {
26
+ "schema_id": {
27
+ "const": "https://schemas.usher.so/market-data-vendor-backfill-request/v1"
28
+ },
29
+ "request_id": { "$ref": "#/$defs/uuid" },
30
+ "attempt_id": { "$ref": "#/$defs/uuid" },
31
+ "idempotency_key": { "$ref": "#/$defs/sha256" },
32
+ "scope": { "$ref": "#/$defs/scope" },
33
+ "window": { "$ref": "#/$defs/interval" },
34
+ "depth": { "type": "integer", "minimum": 1, "maximum": 500 },
35
+ "construction_mode": {
36
+ "enum": ["sampled_top_n_snapshot", "exact_l2_reconstruction"]
37
+ },
38
+ "source_policy": { "enum": ["authoritative_window", "fill_gaps"] },
39
+ "target": {
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": ["environment", "cluster"],
43
+ "properties": {
44
+ "environment": {
45
+ "type": "string",
46
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
47
+ },
48
+ "cluster": {
49
+ "type": "string",
50
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,127}$"
51
+ }
52
+ }
53
+ },
54
+ "coverage_policy": { "$ref": "#/$defs/coveragePolicy" },
55
+ "required_clock": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": [
59
+ "schema_id",
60
+ "clock_id",
61
+ "file_name",
62
+ "clock_sha256",
63
+ "event_count"
64
+ ],
65
+ "properties": {
66
+ "schema_id": {
67
+ "const": "https://schemas.usher.so/market-data-vendor-backfill-required-clock/v1"
68
+ },
69
+ "clock_id": { "$ref": "#/$defs/uuid" },
70
+ "file_name": {
71
+ "type": "string",
72
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$"
73
+ },
74
+ "clock_sha256": { "$ref": "#/$defs/sha256" },
75
+ "event_count": { "$ref": "#/$defs/safeInteger" }
76
+ }
77
+ },
78
+ "initial_selection": {
79
+ "$ref": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1"
80
+ },
81
+ "expected_canonical_schema": { "$ref": "#/$defs/artifactPin" },
82
+ "product_pins": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "required": ["capability_policy", "resource_policy"],
86
+ "properties": {
87
+ "capability_policy": { "$ref": "#/$defs/policyPin" },
88
+ "resource_policy": { "$ref": "#/$defs/policyPin" }
89
+ }
90
+ },
91
+ "production_authorization_id": { "$ref": "#/$defs/uuid" }
92
+ },
93
+ "$defs": {
94
+ "uuid": {
95
+ "type": "string",
96
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
97
+ },
98
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
99
+ "timestamp": {
100
+ "type": "string",
101
+ "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$"
102
+ },
103
+ "safeInteger": {
104
+ "type": "integer",
105
+ "minimum": 0,
106
+ "maximum": 9007199254740991
107
+ },
108
+ "scope": {
109
+ "type": "object",
110
+ "additionalProperties": false,
111
+ "required": ["exchange", "trading_pair", "market_type", "feed"],
112
+ "properties": {
113
+ "exchange": {
114
+ "type": "string",
115
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
116
+ },
117
+ "trading_pair": { "type": "string", "minLength": 3, "maxLength": 128 },
118
+ "market_type": { "enum": ["spot", "swap", "future"] },
119
+ "feed": { "const": "ORDERBOOK" }
120
+ }
121
+ },
122
+ "interval": {
123
+ "type": "object",
124
+ "additionalProperties": false,
125
+ "required": ["start_at", "end_at"],
126
+ "properties": {
127
+ "start_at": { "$ref": "#/$defs/timestamp" },
128
+ "end_at": { "$ref": "#/$defs/timestamp" }
129
+ }
130
+ },
131
+ "coveragePolicy": {
132
+ "type": "object",
133
+ "additionalProperties": false,
134
+ "required": [
135
+ "policy_id",
136
+ "max_asof_lag_ms",
137
+ "future_rows",
138
+ "missing_required_event"
139
+ ],
140
+ "properties": {
141
+ "policy_id": { "const": "prior-asof-strict/v1" },
142
+ "max_asof_lag_ms": { "$ref": "#/$defs/safeInteger" },
143
+ "future_rows": { "const": "reject" },
144
+ "missing_required_event": { "const": "fail" }
145
+ }
146
+ },
147
+ "artifactPin": {
148
+ "type": "object",
149
+ "additionalProperties": false,
150
+ "required": ["schema_id", "schema_sha256"],
151
+ "properties": {
152
+ "schema_id": { "type": "string", "minLength": 1, "maxLength": 256 },
153
+ "schema_sha256": { "$ref": "#/$defs/sha256" }
154
+ }
155
+ },
156
+ "policyPin": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "required": ["policy_id", "policy_sha256"],
160
+ "properties": {
161
+ "policy_id": { "type": "string", "minLength": 1, "maxLength": 256 },
162
+ "policy_sha256": { "$ref": "#/$defs/sha256" }
163
+ }
164
+ }
165
+ }
166
+ }
@@ -0,0 +1,212 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.usher.so/market-data-vendor-backfill-result/v2",
4
+ "title": "CEX Broker market data vendor backfill file-job result v2",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "result_sha256",
10
+ "job_id",
11
+ "request_file_sha256",
12
+ "schema_manifest_sha256",
13
+ "producer",
14
+ "capability_policy",
15
+ "resource_policy",
16
+ "started_at",
17
+ "completed_at",
18
+ "outcome"
19
+ ],
20
+ "properties": {
21
+ "schema_id": {
22
+ "const": "https://schemas.usher.so/market-data-vendor-backfill-result/v2"
23
+ },
24
+ "result_sha256": { "$ref": "#/$defs/sha256" },
25
+ "job_id": { "$ref": "#/$defs/uuid" },
26
+ "request_file_sha256": {
27
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
28
+ },
29
+ "schema_manifest_sha256": { "$ref": "#/$defs/sha256" },
30
+ "producer": { "$ref": "#/$defs/producer" },
31
+ "capability_policy": { "$ref": "#/$defs/policyPin" },
32
+ "resource_policy": { "$ref": "#/$defs/policyPin" },
33
+ "started_at": { "$ref": "#/$defs/timestamp" },
34
+ "completed_at": { "$ref": "#/$defs/timestamp" },
35
+ "outcome": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": [
39
+ "status",
40
+ "reason_code",
41
+ "reason_subcode",
42
+ "request_id",
43
+ "idempotency_key",
44
+ "target",
45
+ "selection",
46
+ "receipt",
47
+ "diagnostics"
48
+ ],
49
+ "properties": {
50
+ "status": {
51
+ "enum": [
52
+ "request_invalid",
53
+ "archive_preflight_failed",
54
+ "already_covered",
55
+ "promoted",
56
+ "capability_unsupported",
57
+ "credentials_missing",
58
+ "vendor_fetch_failed",
59
+ "archive_ingest_failed",
60
+ "promotion_verification_failed"
61
+ ]
62
+ },
63
+ "reason_code": {
64
+ "type": "string",
65
+ "pattern": "^[a-z][a-z0-9_]{0,127}$"
66
+ },
67
+ "reason_subcode": {
68
+ "oneOf": [
69
+ { "type": "null" },
70
+ { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,127}$" }
71
+ ]
72
+ },
73
+ "request_id": {
74
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/uuid" }]
75
+ },
76
+ "idempotency_key": {
77
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
78
+ },
79
+ "target": {
80
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/target" }]
81
+ },
82
+ "selection": {
83
+ "oneOf": [
84
+ { "type": "null" },
85
+ {
86
+ "$ref": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1"
87
+ }
88
+ ]
89
+ },
90
+ "receipt": {
91
+ "oneOf": [
92
+ { "type": "null" },
93
+ {
94
+ "$ref": "https://schemas.usher.so/market-data-vendor-backfill-promotion-receipt/v1"
95
+ }
96
+ ]
97
+ },
98
+ "diagnostics": {
99
+ "type": "object",
100
+ "maxProperties": 64,
101
+ "additionalProperties": {
102
+ "oneOf": [
103
+ { "type": "string", "maxLength": 1024 },
104
+ { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
105
+ { "type": "boolean" }
106
+ ]
107
+ }
108
+ }
109
+ }
110
+ }
111
+ },
112
+ "allOf": [
113
+ {
114
+ "if": {
115
+ "type": "object",
116
+ "properties": {
117
+ "outcome": {
118
+ "type": "object",
119
+ "properties": {
120
+ "status": { "const": "request_invalid" },
121
+ "reason_subcode": { "const": "request_file_unreadable" }
122
+ },
123
+ "required": ["status", "reason_subcode"]
124
+ }
125
+ },
126
+ "required": ["outcome"]
127
+ },
128
+ "then": {
129
+ "type": "object",
130
+ "properties": { "request_file_sha256": { "type": "null" } }
131
+ },
132
+ "else": {
133
+ "type": "object",
134
+ "properties": { "request_file_sha256": { "$ref": "#/$defs/sha256" } }
135
+ }
136
+ }
137
+ ],
138
+ "$defs": {
139
+ "uuid": {
140
+ "type": "string",
141
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
142
+ },
143
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
144
+ "timestamp": {
145
+ "type": "string",
146
+ "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$"
147
+ },
148
+ "semver": {
149
+ "type": "string",
150
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$"
151
+ },
152
+ "target": {
153
+ "type": "object",
154
+ "additionalProperties": false,
155
+ "required": ["environment", "cluster"],
156
+ "properties": {
157
+ "environment": {
158
+ "type": "string",
159
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
160
+ },
161
+ "cluster": {
162
+ "type": "string",
163
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,127}$"
164
+ }
165
+ }
166
+ },
167
+ "policyPin": {
168
+ "type": "object",
169
+ "additionalProperties": false,
170
+ "required": ["policy_id", "policy_sha256"],
171
+ "properties": {
172
+ "policy_id": { "type": "string", "minLength": 1, "maxLength": 256 },
173
+ "policy_sha256": { "$ref": "#/$defs/sha256" }
174
+ }
175
+ },
176
+ "producer": {
177
+ "type": "object",
178
+ "additionalProperties": false,
179
+ "required": [
180
+ "product_id",
181
+ "product_version",
182
+ "package",
183
+ "executable_sha256",
184
+ "runtime"
185
+ ],
186
+ "properties": {
187
+ "product_id": { "const": "market-data-vendor-backfill" },
188
+ "product_version": { "const": "market-data-vendor-backfill/v1" },
189
+ "package": {
190
+ "type": "object",
191
+ "additionalProperties": false,
192
+ "required": ["name", "version", "git_head"],
193
+ "properties": {
194
+ "name": { "const": "@usherlabs/cex-broker" },
195
+ "version": { "$ref": "#/$defs/semver" },
196
+ "git_head": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
197
+ }
198
+ },
199
+ "executable_sha256": { "$ref": "#/$defs/sha256" },
200
+ "runtime": {
201
+ "type": "object",
202
+ "additionalProperties": false,
203
+ "required": ["name", "version"],
204
+ "properties": {
205
+ "name": { "const": "node" },
206
+ "version": { "$ref": "#/$defs/semver" }
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.usher.so/cex-canonical-orderbook-export-request/v1",
4
+ "title": "CEX canonical order-book exact-selection export request v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "request_id",
10
+ "target",
11
+ "selection",
12
+ "depth",
13
+ "construction_mode",
14
+ "canonical_schema_version",
15
+ "checksum_algorithm"
16
+ ],
17
+ "properties": {
18
+ "schema_id": {
19
+ "const": "https://schemas.usher.so/cex-canonical-orderbook-export-request/v1"
20
+ },
21
+ "request_id": { "$ref": "#/$defs/uuid" },
22
+ "target": { "$ref": "#/$defs/target" },
23
+ "selection": {
24
+ "$ref": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1"
25
+ },
26
+ "depth": { "type": "integer", "minimum": 1, "maximum": 500 },
27
+ "construction_mode": {
28
+ "enum": ["sampled_top_n_snapshot", "exact_l2_reconstruction"]
29
+ },
30
+ "canonical_schema_version": {
31
+ "type": "string",
32
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
33
+ },
34
+ "checksum_algorithm": { "const": "sha256-canonical-json-v1" }
35
+ },
36
+ "$defs": {
37
+ "uuid": {
38
+ "type": "string",
39
+ "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
40
+ },
41
+ "target": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": ["environment", "cluster"],
45
+ "properties": {
46
+ "environment": {
47
+ "type": "string",
48
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
49
+ },
50
+ "cluster": {
51
+ "type": "string",
52
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,127}$"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }