@usherlabs/cex-broker 0.2.45 → 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 (67) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/cex-canonical-orderbook-export.d.ts +23 -0
  3. package/dist/commands/cex-canonical-orderbook-export.js +27731 -0
  4. package/dist/commands/cex-canonical-orderbook-export.js.map +247 -0
  5. package/dist/commands/cli.js +16231 -15573
  6. package/dist/commands/market-data-vendor-backfill.d.ts +24 -0
  7. package/dist/commands/market-data-vendor-backfill.js +33316 -0
  8. package/dist/commands/market-data-vendor-backfill.js.map +279 -0
  9. package/dist/handlers/subscribe/handler.d.ts +2 -0
  10. package/dist/helpers/canonical-orderbook-export/exact-selection.d.ts +21 -0
  11. package/dist/helpers/canonical-orderbook-export/exporter.d.ts +26 -0
  12. package/dist/helpers/market-data-archive/capture-contract.d.ts +3 -2
  13. package/dist/helpers/market-data-archive/types.d.ts +8 -4
  14. package/dist/helpers/market-data-preparation/conformance-fixtures.d.ts +16 -0
  15. package/dist/helpers/market-data-preparation/contracts.d.ts +1690 -0
  16. package/dist/helpers/market-data-preparation/file-job.d.ts +38 -0
  17. package/dist/helpers/market-data-vendor-backfill/archive-reader.d.ts +26 -0
  18. package/dist/helpers/market-data-vendor-backfill/batching.d.ts +10 -0
  19. package/dist/helpers/market-data-vendor-backfill/conformance-fixtures.d.ts +80 -0
  20. package/dist/helpers/market-data-vendor-backfill/contracts.d.ts +393 -0
  21. package/dist/helpers/market-data-vendor-backfill/core.d.ts +100 -0
  22. package/dist/helpers/market-data-vendor-backfill/cryptohftdata.d.ts +77 -0
  23. package/dist/helpers/market-data-vendor-backfill/forwarder-client.d.ts +25 -0
  24. package/dist/helpers/market-data-vendor-backfill/identity.d.ts +10 -0
  25. package/dist/helpers/market-data-vendor-backfill/manifests.d.ts +1086 -0
  26. package/dist/helpers/market-data-vendor-backfill/promotion.d.ts +9 -0
  27. package/dist/helpers/market-data-vendor-backfill/qualification.d.ts +20 -0
  28. package/dist/helpers/market-data-vendor-backfill/selection.d.ts +30 -0
  29. package/dist/helpers/market-data-vendor-backfill/semantic-verification.d.ts +24 -0
  30. package/dist/helpers/public-market-data-feed/identity.d.ts +12 -0
  31. package/dist/helpers/public-market-data-feed/index.d.ts +5 -0
  32. package/dist/helpers/public-market-data-feed/orderbook-coalescing-evidence.d.ts +79 -0
  33. package/dist/helpers/public-market-data-feed/orderbook-profile.d.ts +54 -0
  34. package/dist/helpers/public-market-data-feed/subscriber-buffer.d.ts +31 -0
  35. package/dist/helpers/public-market-data-feed/supervisor.d.ts +82 -0
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +16221 -15563
  38. package/dist/index.js.map +21 -18
  39. package/dist/market-data-preparation/fixtures/conformance-v2.json +424 -0
  40. package/dist/market-data-preparation/policies/capability-policy.json +28 -0
  41. package/dist/market-data-preparation/policies/resource-policy.json +16 -0
  42. package/dist/market-data-preparation/schema-manifest.json +46 -0
  43. package/dist/market-data-preparation/schemas/archive-selection-v1.schema.json +224 -0
  44. package/dist/market-data-preparation/schemas/backfill-request-v1.schema.json +166 -0
  45. package/dist/market-data-preparation/schemas/backfill-result-v2.schema.json +212 -0
  46. package/dist/market-data-preparation/schemas/canonical-orderbook-export-request-v1.schema.json +57 -0
  47. package/dist/market-data-preparation/schemas/canonical-orderbook-export-result-v1.schema.json +238 -0
  48. package/dist/market-data-preparation/schemas/preparation-product-pin-v1.schema.json +126 -0
  49. package/dist/market-data-preparation/schemas/promotion-receipt-v1.schema.json +171 -0
  50. package/dist/market-data-preparation/schemas/required-clock-v1.schema.json +47 -0
  51. package/dist/market-data-preparation.d.ts +4 -0
  52. package/dist/market-data-preparation.js +27569 -0
  53. package/dist/market-data-preparation.js.map +249 -0
  54. package/dist/market-data-vendor-backfill/fixtures/conformance-v1.json +448 -0
  55. package/dist/market-data-vendor-backfill/policies/capability-policy.json +28 -0
  56. package/dist/market-data-vendor-backfill/policies/resource-policy.json +16 -0
  57. package/dist/market-data-vendor-backfill/schema-manifest.json +31 -0
  58. package/dist/market-data-vendor-backfill/schemas/archive-selection.schema.json +224 -0
  59. package/dist/market-data-vendor-backfill/schemas/promotion-receipt.schema.json +171 -0
  60. package/dist/market-data-vendor-backfill/schemas/request.schema.json +166 -0
  61. package/dist/market-data-vendor-backfill/schemas/required-clock.schema.json +47 -0
  62. package/dist/market-data-vendor-backfill/schemas/result.schema.json +198 -0
  63. package/dist/market-data-vendor-backfill.d.ts +18 -0
  64. package/dist/market-data-vendor-backfill.js +18850 -0
  65. package/dist/market-data-vendor-backfill.js.map +206 -0
  66. package/dist/server.d.ts +2 -1
  67. package/package.json +37 -3
@@ -0,0 +1,238 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.usher.so/cex-canonical-orderbook-export-result/v1",
4
+ "title": "CEX canonical order-book exact-selection export result v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "result_sha256",
10
+ "job_id",
11
+ "request_file_sha256",
12
+ "producer",
13
+ "started_at",
14
+ "completed_at",
15
+ "outcome"
16
+ ],
17
+ "properties": {
18
+ "schema_id": {
19
+ "const": "https://schemas.usher.so/cex-canonical-orderbook-export-result/v1"
20
+ },
21
+ "result_sha256": { "$ref": "#/$defs/sha256" },
22
+ "job_id": { "$ref": "#/$defs/uuid" },
23
+ "request_file_sha256": {
24
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
25
+ },
26
+ "producer": { "$ref": "#/$defs/producer" },
27
+ "started_at": { "$ref": "#/$defs/timestamp" },
28
+ "completed_at": { "$ref": "#/$defs/timestamp" },
29
+ "outcome": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "required": [
33
+ "status",
34
+ "reason_code",
35
+ "reason_subcode",
36
+ "request_id",
37
+ "target",
38
+ "selection_sha256",
39
+ "query_sha256",
40
+ "query_segments",
41
+ "promotion_receipt_ids",
42
+ "artifacts",
43
+ "diagnostics"
44
+ ],
45
+ "properties": {
46
+ "status": {
47
+ "enum": [
48
+ "exported",
49
+ "request_invalid",
50
+ "archive_query_failed",
51
+ "archive_data_invalid",
52
+ "artifact_write_failed"
53
+ ]
54
+ },
55
+ "reason_code": {
56
+ "type": "string",
57
+ "pattern": "^[a-z][a-z0-9_]{0,127}$"
58
+ },
59
+ "reason_subcode": {
60
+ "oneOf": [
61
+ { "type": "null" },
62
+ { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,127}$" }
63
+ ]
64
+ },
65
+ "request_id": {
66
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/uuid" }]
67
+ },
68
+ "target": {
69
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/target" }]
70
+ },
71
+ "selection_sha256": {
72
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
73
+ },
74
+ "query_sha256": {
75
+ "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
76
+ },
77
+ "query_segments": {
78
+ "type": "array",
79
+ "items": { "$ref": "#/$defs/segment" }
80
+ },
81
+ "promotion_receipt_ids": {
82
+ "type": "array",
83
+ "uniqueItems": true,
84
+ "items": { "$ref": "#/$defs/sha256" }
85
+ },
86
+ "artifacts": {
87
+ "oneOf": [
88
+ { "type": "null" },
89
+ {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": ["levels", "summary"],
93
+ "properties": {
94
+ "levels": { "$ref": "#/$defs/artifact" },
95
+ "summary": { "$ref": "#/$defs/artifact" }
96
+ }
97
+ }
98
+ ]
99
+ },
100
+ "diagnostics": {
101
+ "type": "object",
102
+ "maxProperties": 64,
103
+ "additionalProperties": {
104
+ "oneOf": [
105
+ { "type": "string", "maxLength": 1024 },
106
+ { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
107
+ { "type": "boolean" }
108
+ ]
109
+ }
110
+ }
111
+ },
112
+ "allOf": [
113
+ {
114
+ "if": {
115
+ "type": "object",
116
+ "properties": { "status": { "const": "exported" } },
117
+ "required": ["status"]
118
+ },
119
+ "then": {
120
+ "type": "object",
121
+ "properties": {
122
+ "request_id": { "$ref": "#/$defs/uuid" },
123
+ "target": { "$ref": "#/$defs/target" },
124
+ "selection_sha256": { "$ref": "#/$defs/sha256" },
125
+ "query_sha256": { "$ref": "#/$defs/sha256" },
126
+ "query_segments": { "type": "array", "minItems": 1 },
127
+ "artifacts": { "type": "object" }
128
+ }
129
+ },
130
+ "else": {
131
+ "type": "object",
132
+ "properties": { "artifacts": { "type": "null" } }
133
+ }
134
+ }
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
+ "producer": {
168
+ "type": "object",
169
+ "additionalProperties": false,
170
+ "required": [
171
+ "product_id",
172
+ "product_version",
173
+ "package",
174
+ "executable_sha256",
175
+ "runtime"
176
+ ],
177
+ "properties": {
178
+ "product_id": { "const": "cex-canonical-orderbook-export" },
179
+ "product_version": { "const": "cex-canonical-orderbook-export/v1" },
180
+ "package": {
181
+ "type": "object",
182
+ "additionalProperties": false,
183
+ "required": ["name", "version", "git_head"],
184
+ "properties": {
185
+ "name": { "const": "@usherlabs/cex-broker" },
186
+ "version": { "$ref": "#/$defs/semver" },
187
+ "git_head": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
188
+ }
189
+ },
190
+ "executable_sha256": { "$ref": "#/$defs/sha256" },
191
+ "runtime": {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "required": ["name", "version"],
195
+ "properties": {
196
+ "name": { "const": "node" },
197
+ "version": { "$ref": "#/$defs/semver" }
198
+ }
199
+ }
200
+ }
201
+ },
202
+ "segment": {
203
+ "type": "object",
204
+ "additionalProperties": false,
205
+ "required": ["start_at", "end_at", "capture_bundle_id", "capture_origin"],
206
+ "properties": {
207
+ "start_at": { "$ref": "#/$defs/timestamp" },
208
+ "end_at": { "$ref": "#/$defs/timestamp" },
209
+ "capture_bundle_id": { "$ref": "#/$defs/sha256" },
210
+ "capture_origin": {
211
+ "enum": ["production_capture", "vendor_historical_backfill"]
212
+ }
213
+ }
214
+ },
215
+ "artifact": {
216
+ "type": "object",
217
+ "additionalProperties": false,
218
+ "required": ["file_name", "rows", "bytes", "sha256"],
219
+ "properties": {
220
+ "file_name": {
221
+ "type": "string",
222
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$"
223
+ },
224
+ "rows": {
225
+ "type": "integer",
226
+ "minimum": 1,
227
+ "maximum": 9007199254740991
228
+ },
229
+ "bytes": {
230
+ "type": "integer",
231
+ "minimum": 8,
232
+ "maximum": 9007199254740991
233
+ },
234
+ "sha256": { "$ref": "#/$defs/sha256" }
235
+ }
236
+ }
237
+ }
238
+ }
@@ -0,0 +1,126 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "cex-market-data-preparation-product-pin/v1",
4
+ "title": "CEX market-data preparation product pin v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_id",
9
+ "package",
10
+ "executables",
11
+ "schema_manifest",
12
+ "schema_pins",
13
+ "capability_policy",
14
+ "resource_policy"
15
+ ],
16
+ "properties": {
17
+ "schema_id": { "const": "cex-market-data-preparation-product-pin/v1" },
18
+ "package": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": [
22
+ "name",
23
+ "version",
24
+ "registry_tarball_url",
25
+ "integrity",
26
+ "tarball_sha256",
27
+ "npm_git_head"
28
+ ],
29
+ "properties": {
30
+ "name": { "const": "@usherlabs/cex-broker" },
31
+ "version": { "$ref": "#/$defs/semver" },
32
+ "registry_tarball_url": {
33
+ "type": "string",
34
+ "pattern": "^https://registry\\.npmjs\\.org/@usherlabs/cex-broker/-/cex-broker-[0-9A-Za-z.-]+\\.tgz$"
35
+ },
36
+ "integrity": {
37
+ "type": "string",
38
+ "pattern": "^sha512-[A-Za-z0-9+/]+={0,2}$"
39
+ },
40
+ "tarball_sha256": { "$ref": "#/$defs/sha256" },
41
+ "npm_git_head": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
42
+ }
43
+ },
44
+ "executables": {
45
+ "type": "array",
46
+ "minItems": 2,
47
+ "maxItems": 2,
48
+ "items": {
49
+ "type": "object",
50
+ "additionalProperties": false,
51
+ "required": [
52
+ "product_id",
53
+ "product_version",
54
+ "relative_path",
55
+ "executable_sha256"
56
+ ],
57
+ "properties": {
58
+ "product_id": {
59
+ "enum": [
60
+ "market-data-vendor-backfill",
61
+ "cex-canonical-orderbook-export"
62
+ ]
63
+ },
64
+ "product_version": {
65
+ "enum": [
66
+ "market-data-vendor-backfill/v1",
67
+ "cex-canonical-orderbook-export/v1"
68
+ ]
69
+ },
70
+ "relative_path": {
71
+ "type": "string",
72
+ "pattern": "^dist/commands/[A-Za-z0-9._-]+\\.js$"
73
+ },
74
+ "executable_sha256": { "$ref": "#/$defs/sha256" }
75
+ }
76
+ }
77
+ },
78
+ "schema_manifest": {
79
+ "type": "object",
80
+ "additionalProperties": false,
81
+ "required": ["schema_id", "manifest_sha256", "relative_path"],
82
+ "properties": {
83
+ "schema_id": {
84
+ "const": "https://schemas.usher.so/market-data-vendor-backfill-schema-manifest/v2"
85
+ },
86
+ "manifest_sha256": { "$ref": "#/$defs/sha256" },
87
+ "relative_path": {
88
+ "const": "dist/market-data-preparation/schema-manifest.json"
89
+ }
90
+ }
91
+ },
92
+ "schema_pins": {
93
+ "type": "array",
94
+ "minItems": 8,
95
+ "maxItems": 8,
96
+ "uniqueItems": true,
97
+ "items": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": ["schema_id", "schema_sha256"],
101
+ "properties": {
102
+ "schema_id": { "type": "string", "minLength": 1, "maxLength": 256 },
103
+ "schema_sha256": { "$ref": "#/$defs/sha256" }
104
+ }
105
+ }
106
+ },
107
+ "capability_policy": { "$ref": "#/$defs/policyPin" },
108
+ "resource_policy": { "$ref": "#/$defs/policyPin" }
109
+ },
110
+ "$defs": {
111
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
112
+ "semver": {
113
+ "type": "string",
114
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$"
115
+ },
116
+ "policyPin": {
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "required": ["policy_id", "policy_sha256"],
120
+ "properties": {
121
+ "policy_id": { "type": "string", "minLength": 1, "maxLength": 256 },
122
+ "policy_sha256": { "$ref": "#/$defs/sha256" }
123
+ }
124
+ }
125
+ }
126
+ }
@@ -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,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
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./helpers/canonical-orderbook-export/exact-selection";
2
+ export * from "./helpers/canonical-orderbook-export/exporter";
3
+ export * from "./helpers/market-data-preparation/conformance-fixtures";
4
+ export * from "./helpers/market-data-preparation/contracts";