@usherlabs/cex-broker 0.2.44 → 0.2.46
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.
- package/README.md +1 -1
- package/dist/commands/cli.js +16231 -15573
- package/dist/handlers/subscribe/handler.d.ts +2 -0
- package/dist/helpers/market-data-archive/capture-contract.d.ts +3 -2
- package/dist/helpers/market-data-archive/types.d.ts +8 -4
- package/dist/helpers/market-data-vendor-backfill/archive-reader.d.ts +26 -0
- package/dist/helpers/market-data-vendor-backfill/batching.d.ts +10 -0
- package/dist/helpers/market-data-vendor-backfill/conformance-fixtures.d.ts +80 -0
- package/dist/helpers/market-data-vendor-backfill/contracts.d.ts +393 -0
- package/dist/helpers/market-data-vendor-backfill/core.d.ts +100 -0
- package/dist/helpers/market-data-vendor-backfill/cryptohftdata.d.ts +77 -0
- package/dist/helpers/market-data-vendor-backfill/forwarder-client.d.ts +25 -0
- package/dist/helpers/market-data-vendor-backfill/identity.d.ts +10 -0
- package/dist/helpers/market-data-vendor-backfill/manifests.d.ts +1086 -0
- package/dist/helpers/market-data-vendor-backfill/promotion.d.ts +9 -0
- package/dist/helpers/market-data-vendor-backfill/qualification.d.ts +20 -0
- package/dist/helpers/market-data-vendor-backfill/selection.d.ts +30 -0
- package/dist/helpers/market-data-vendor-backfill/semantic-verification.d.ts +24 -0
- package/dist/helpers/public-market-data-feed/identity.d.ts +12 -0
- package/dist/helpers/public-market-data-feed/index.d.ts +5 -0
- package/dist/helpers/public-market-data-feed/orderbook-coalescing-evidence.d.ts +79 -0
- package/dist/helpers/public-market-data-feed/orderbook-profile.d.ts +54 -0
- package/dist/helpers/public-market-data-feed/subscriber-buffer.d.ts +31 -0
- package/dist/helpers/public-market-data-feed/supervisor.d.ts +82 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16221 -15563
- package/dist/index.js.map +21 -18
- package/dist/market-data-vendor-backfill/fixtures/conformance-v1.json +448 -0
- package/dist/market-data-vendor-backfill/policies/capability-policy.json +28 -0
- package/dist/market-data-vendor-backfill/policies/resource-policy.json +16 -0
- package/dist/market-data-vendor-backfill/schema-manifest.json +31 -0
- package/dist/market-data-vendor-backfill/schemas/archive-selection.schema.json +224 -0
- package/dist/market-data-vendor-backfill/schemas/promotion-receipt.schema.json +171 -0
- package/dist/market-data-vendor-backfill/schemas/request.schema.json +166 -0
- package/dist/market-data-vendor-backfill/schemas/required-clock.schema.json +47 -0
- package/dist/market-data-vendor-backfill/schemas/result.schema.json +198 -0
- package/dist/market-data-vendor-backfill.d.ts +18 -0
- package/dist/market-data-vendor-backfill.js +18819 -0
- package/dist/market-data-vendor-backfill.js.map +206 -0
- package/dist/server.d.ts +2 -1
- package/package.json +24 -2
|
@@ -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,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.usher.so/market-data-vendor-backfill-promotion-receipt/v1",
|
|
4
|
+
"title": "Market data vendor backfill promotion receipt v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_id",
|
|
9
|
+
"receipt_id",
|
|
10
|
+
"promotion_identity_sha256",
|
|
11
|
+
"verified_at",
|
|
12
|
+
"request_id",
|
|
13
|
+
"idempotency_key",
|
|
14
|
+
"source",
|
|
15
|
+
"capture_origin",
|
|
16
|
+
"source_mode",
|
|
17
|
+
"provider",
|
|
18
|
+
"adapter_version",
|
|
19
|
+
"effective_policies",
|
|
20
|
+
"capture_bundle_id",
|
|
21
|
+
"scope",
|
|
22
|
+
"window",
|
|
23
|
+
"depth",
|
|
24
|
+
"construction_mode",
|
|
25
|
+
"canonical_schema",
|
|
26
|
+
"coverage_policy",
|
|
27
|
+
"selection_sha256",
|
|
28
|
+
"vendor_semantic_digest",
|
|
29
|
+
"canonical_semantic_digest",
|
|
30
|
+
"prefix_digest",
|
|
31
|
+
"suffix_digest",
|
|
32
|
+
"seam_verified",
|
|
33
|
+
"coverage_verified",
|
|
34
|
+
"dataset_objects"
|
|
35
|
+
],
|
|
36
|
+
"properties": {
|
|
37
|
+
"schema_id": {
|
|
38
|
+
"const": "https://schemas.usher.so/market-data-vendor-backfill-promotion-receipt/v1"
|
|
39
|
+
},
|
|
40
|
+
"receipt_id": { "$ref": "#/$defs/sha256" },
|
|
41
|
+
"promotion_identity_sha256": { "$ref": "#/$defs/sha256" },
|
|
42
|
+
"verified_at": { "$ref": "#/$defs/timestamp" },
|
|
43
|
+
"request_id": { "$ref": "#/$defs/uuid" },
|
|
44
|
+
"idempotency_key": { "$ref": "#/$defs/sha256" },
|
|
45
|
+
"source": { "const": "external_backfill" },
|
|
46
|
+
"capture_origin": { "const": "vendor_historical_backfill" },
|
|
47
|
+
"source_mode": { "const": "vendor_historical_backfill_v1" },
|
|
48
|
+
"provider": { "type": "string", "minLength": 1, "maxLength": 128 },
|
|
49
|
+
"adapter_version": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
50
|
+
"effective_policies": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"required": [
|
|
54
|
+
"capability_policy",
|
|
55
|
+
"resource_policy",
|
|
56
|
+
"adapter_policy",
|
|
57
|
+
"acquisition_policy"
|
|
58
|
+
],
|
|
59
|
+
"properties": {
|
|
60
|
+
"capability_policy": { "$ref": "#/$defs/policyPin" },
|
|
61
|
+
"resource_policy": { "$ref": "#/$defs/policyPin" },
|
|
62
|
+
"adapter_policy": { "$ref": "#/$defs/policyPin" },
|
|
63
|
+
"acquisition_policy": { "$ref": "#/$defs/policyPin" }
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"capture_bundle_id": { "$ref": "#/$defs/sha256" },
|
|
67
|
+
"scope": { "$ref": "#/$defs/scope" },
|
|
68
|
+
"window": { "$ref": "#/$defs/interval" },
|
|
69
|
+
"depth": { "type": "integer", "minimum": 1, "maximum": 500 },
|
|
70
|
+
"construction_mode": {
|
|
71
|
+
"enum": ["sampled_top_n_snapshot", "exact_l2_reconstruction"]
|
|
72
|
+
},
|
|
73
|
+
"canonical_schema": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"required": ["schema_id", "schema_sha256"],
|
|
77
|
+
"properties": {
|
|
78
|
+
"schema_id": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
79
|
+
"schema_sha256": { "$ref": "#/$defs/sha256" }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"coverage_policy": { "$ref": "#/$defs/coveragePolicy" },
|
|
83
|
+
"selection_sha256": { "$ref": "#/$defs/sha256" },
|
|
84
|
+
"vendor_semantic_digest": { "$ref": "#/$defs/sha256" },
|
|
85
|
+
"canonical_semantic_digest": { "$ref": "#/$defs/sha256" },
|
|
86
|
+
"prefix_digest": { "$ref": "#/$defs/sha256" },
|
|
87
|
+
"suffix_digest": { "$ref": "#/$defs/sha256" },
|
|
88
|
+
"seam_verified": { "const": true },
|
|
89
|
+
"coverage_verified": { "const": true },
|
|
90
|
+
"dataset_objects": {
|
|
91
|
+
"type": "array",
|
|
92
|
+
"minItems": 1,
|
|
93
|
+
"maxItems": 10000,
|
|
94
|
+
"items": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"additionalProperties": false,
|
|
97
|
+
"required": ["identity", "checksum", "bytes", "rows"],
|
|
98
|
+
"properties": {
|
|
99
|
+
"identity": { "type": "string", "minLength": 1, "maxLength": 2048 },
|
|
100
|
+
"checksum": { "$ref": "#/$defs/sha256" },
|
|
101
|
+
"bytes": { "$ref": "#/$defs/safeInteger" },
|
|
102
|
+
"rows": { "$ref": "#/$defs/safeInteger" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"$defs": {
|
|
108
|
+
"uuid": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
111
|
+
},
|
|
112
|
+
"sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
113
|
+
"timestamp": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"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$"
|
|
116
|
+
},
|
|
117
|
+
"safeInteger": {
|
|
118
|
+
"type": "integer",
|
|
119
|
+
"minimum": 0,
|
|
120
|
+
"maximum": 9007199254740991
|
|
121
|
+
},
|
|
122
|
+
"scope": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"additionalProperties": false,
|
|
125
|
+
"required": ["exchange", "trading_pair", "market_type", "feed"],
|
|
126
|
+
"properties": {
|
|
127
|
+
"exchange": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
|
|
130
|
+
},
|
|
131
|
+
"trading_pair": { "type": "string", "minLength": 3, "maxLength": 128 },
|
|
132
|
+
"market_type": { "enum": ["spot", "swap", "future"] },
|
|
133
|
+
"feed": { "const": "ORDERBOOK" }
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"interval": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"additionalProperties": false,
|
|
139
|
+
"required": ["start_at", "end_at"],
|
|
140
|
+
"properties": {
|
|
141
|
+
"start_at": { "$ref": "#/$defs/timestamp" },
|
|
142
|
+
"end_at": { "$ref": "#/$defs/timestamp" }
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"coveragePolicy": {
|
|
146
|
+
"type": "object",
|
|
147
|
+
"additionalProperties": false,
|
|
148
|
+
"required": [
|
|
149
|
+
"policy_id",
|
|
150
|
+
"max_asof_lag_ms",
|
|
151
|
+
"future_rows",
|
|
152
|
+
"missing_required_event"
|
|
153
|
+
],
|
|
154
|
+
"properties": {
|
|
155
|
+
"policy_id": { "const": "prior-asof-strict/v1" },
|
|
156
|
+
"max_asof_lag_ms": { "$ref": "#/$defs/safeInteger" },
|
|
157
|
+
"future_rows": { "const": "reject" },
|
|
158
|
+
"missing_required_event": { "const": "fail" }
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"policyPin": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"additionalProperties": false,
|
|
164
|
+
"required": ["policy_id", "policy_sha256"],
|
|
165
|
+
"properties": {
|
|
166
|
+
"policy_id": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
167
|
+
"policy_sha256": { "$ref": "#/$defs/sha256" }
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -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,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.usher.so/market-data-vendor-backfill-required-clock/v1",
|
|
4
|
+
"title": "Market data vendor backfill required clock v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_id",
|
|
9
|
+
"clock_id",
|
|
10
|
+
"clock_sha256",
|
|
11
|
+
"created_at",
|
|
12
|
+
"targets"
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"schema_id": {
|
|
16
|
+
"const": "https://schemas.usher.so/market-data-vendor-backfill-required-clock/v1"
|
|
17
|
+
},
|
|
18
|
+
"clock_id": { "$ref": "#/$defs/uuid" },
|
|
19
|
+
"clock_sha256": { "$ref": "#/$defs/sha256" },
|
|
20
|
+
"created_at": { "$ref": "#/$defs/timestamp" },
|
|
21
|
+
"targets": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"minItems": 1,
|
|
24
|
+
"maxItems": 100000,
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["target_id", "target_at"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"target_id": { "$ref": "#/$defs/uuid" },
|
|
31
|
+
"target_at": { "$ref": "#/$defs/timestamp" }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
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
|
+
"sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
42
|
+
"timestamp": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"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$"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|