@orangecharts/wrun-chart-host 0.8.0 → 0.9.0
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 +2 -1
- package/dist/constants/feature-flags.constants.d.ts +4 -0
- package/dist/constants/feature-flags.constants.js +27 -0
- package/dist/constants/marketCapabilities.constants.d.ts +14 -9
- package/dist/constants/marketCapabilities.constants.js +36 -13
- package/dist/constants/opra-compliance.constants.d.ts +14 -0
- package/dist/constants/opra-compliance.constants.js +14 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/host-env.d.ts +10 -4
- package/dist/host-ports.types.d.ts +39 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
- package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
- package/dist/market-data/billing.interface.d.ts +138 -17
- package/dist/market-data/billing.interface.js +25 -8
- package/dist/market-data/venues/index.d.ts +3 -3
- package/dist/market-data/venues/opra.contract.copy.json +5 -3
- package/dist/market-data/venues/opra.d.ts +3 -3
- package/dist/market-data/venues/opra.js +5 -4
- package/dist/replay/replayLadder.js +3 -1
- package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
- package/dist/utility/chart/crypto-index.leaf.js +2 -2
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +5 -2
- package/dist/utility/chart/index-mode.util.js +23 -13
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
- package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
- package/dist/utility/chart/marketKind.util.d.ts +12 -10
- package/dist/utility/chart/marketKind.util.js +17 -7
- package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
- package/dist/utility/chart/om-panel-push-style.util.js +17 -15
- package/dist/utility/chart/om-panel.util.js +6 -6
- package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
- package/dist/utility/chart/profile-block-size.util.js +7 -0
- package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
- package/dist/utility/chart/quote-perp.leaf.js +20 -0
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
- package/dist/utility/chart/wrun-run-result.util.js +4 -1
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-venue.util.d.ts +3 -3
- package/dist/utility/options/option-venue.util.js +3 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
- package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
- package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
- package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
- package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
- package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
- package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
- package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
- package/dist/utility/wrun/wrun-frames.js +5 -5
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
- package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
- package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
- package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
- package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-option-views.util.js +151 -28
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
- package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-pack.util.js +20 -9
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
- package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
- package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
- package/dist/utility/wrun/wrun-param-map.util.js +8 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
- package/dist/utility/wrun/wrun-param-values.util.js +2 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
- package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
- package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
- package/dist/workers/utils/volume-profile.worker.util.js +5 -2
- package/dist/workers/wrun/wrun-abi-host.js +3 -2
- package/package.json +11 -11
|
@@ -31,6 +31,7 @@ import type { WrunParamHostFill, WrunWarmupWindow } from '@orangecharts/indicato
|
|
|
31
31
|
import type { CardAnchor } from '../utility/chart/om-widget.util.js';
|
|
32
32
|
import type { ParsedPanel } from '../utility/chart/om-panel.util.js';
|
|
33
33
|
import type { WrunMiniChartsDrawing } from '@orangecharts/indicator-kit/host';
|
|
34
|
+
import type { WrunBatchedNumberFormat } from '../utility/wrun/wrun-batched-readout.util.js';
|
|
34
35
|
/** ABI capabilities accumulate: wrun-2 adds strings and cells, wrun-3
|
|
35
36
|
* adds drawings and strategy, wrun-4 adds run-level frame snapshots,
|
|
36
37
|
* wrun-5 adds the text channel (a typed text setting's UTF-8 bytes, read
|
|
@@ -286,7 +287,10 @@ export type WrunParamHost = 'source' | 'interval' | 'symbol';
|
|
|
286
287
|
* `down_color` / `grid_color` (WRUN-STYLE TH-candle-colors) the chart's
|
|
287
288
|
* bullish, bearish and grid colours packed the same way. The market facts
|
|
288
289
|
* (`kind`, `point_value`, `zone`, `quote_is_usd`, WRUN-GAPS-1005) are codes
|
|
289
|
-
* of the chart's own market (wrun-chart-market-facts.util)
|
|
290
|
+
* of the chart's own market (wrun-chart-market-facts.util), and
|
|
291
|
+
* `dollar_multiplier` (kit 0.95.0, `market.dollar_multiplier()`) the US
|
|
292
|
+
* dollars one size unit of the market's trades at one price unit is worth
|
|
293
|
+
* (wrunMarketDollarUnit; 0 where no unit is proven). */
|
|
290
294
|
export type { WrunParamHostFill };
|
|
291
295
|
/** An om style binding (the om param schema's `style`): the param is a
|
|
292
296
|
* style-only knob that never reaches init() (its slot holds a 0
|
|
@@ -680,11 +684,18 @@ export interface WrunInputSource {
|
|
|
680
684
|
block_size?: number;
|
|
681
685
|
max_depth?: number;
|
|
682
686
|
/** `tape` only (the C1 facets, `wrun-tape-source.util.ts`): the smallest
|
|
683
|
-
* print size served
|
|
684
|
-
* param (resolved from the run's current
|
|
685
|
-
* from TRADE_LARGE ("0" = the live edge
|
|
686
|
-
* most 30 days).
|
|
687
|
+
* print size served in the venue's raw stored unit, a number literal or
|
|
688
|
+
* the name of a declared numeric param (resolved from the run's current
|
|
689
|
+
* values), and the history seeded from TRADE_LARGE ("0" = the live edge
|
|
690
|
+
* only, else `^\d+(s|m|h|d)$` at most 30 days). A tape declares exactly
|
|
691
|
+
* one floor: `min_size` or `min_value`. */
|
|
687
692
|
min_size?: number | string;
|
|
693
|
+
/** `tape` only (contract C-DOLLAR): the smallest print served by its value
|
|
694
|
+
* in US dollars, spelled like `min_size` (a number literal or the name of
|
|
695
|
+
* a declared numeric param). It rides the wire as the gateway's
|
|
696
|
+
* `minQuoteAmount`, and every cell's `size` is then the print's dollar
|
|
697
|
+
* value. */
|
|
698
|
+
min_value?: number | string;
|
|
688
699
|
history?: string;
|
|
689
700
|
/** `volume_profile` only: the lane the input reads, the kScript
|
|
690
701
|
* volume_profile source's `ticksPerBar` (price ticks per bucket, an
|
|
@@ -847,8 +858,9 @@ export interface WrunInputSource {
|
|
|
847
858
|
* `needed_by` leaves out the market's size unit (wrunSheetWithLaneDemand), or a `candles` lane its
|
|
848
859
|
* `chart_interval_below` gates off on the chart's interval (wrunSheetWithLaneGate). Its lane is not
|
|
849
860
|
* demanded: no fetch, no live channel, no fold, no reconcile (wrunSourceLane answers none for it),
|
|
850
|
-
* and the row builder reads its fill on every bar without ever holding the run; a
|
|
851
|
-
*
|
|
861
|
+
* and the row builder reads its fill on every bar without ever holding the run; a celled input (a
|
|
862
|
+
* gated `candles` lane, a tape the market does not ask, kit 0.95.0) plans no leg and no cells and reads a
|
|
863
|
+
* present EMPTY block on every row, and no tape acquisition counts it (isWrunAskedTapeSource). */
|
|
852
864
|
undemanded?: true;
|
|
853
865
|
}
|
|
854
866
|
/** The four views of a pinned coarser input (`WrunInputSource.view`), and `forming_open`, a
|
|
@@ -871,6 +883,10 @@ interface WrunMetadataInput {
|
|
|
871
883
|
description?: string;
|
|
872
884
|
cellType?: 'array';
|
|
873
885
|
max_cells?: number;
|
|
886
|
+
/** A celled input's: the tuples its module's build sized the input's buffer and `in_<name>_capacity` by (kit
|
|
887
|
+
* scaffold 97 writes it beside `max_cells`; absent on every older sheet). Every block is sized by
|
|
888
|
+
* `capacity ?? max_cells` (wrun-cell-capacity.leaf `wrunSheetCellBlockTuples`). */
|
|
889
|
+
capacity?: number;
|
|
874
890
|
}
|
|
875
891
|
export interface WrunMetadataOutput {
|
|
876
892
|
index: number;
|
|
@@ -1263,8 +1279,10 @@ export interface WrunPanelStyle {
|
|
|
1263
1279
|
font_family?: WrunFontFamily;
|
|
1264
1280
|
/** SC07: hover readouts (default true). */
|
|
1265
1281
|
hover_card?: boolean;
|
|
1266
|
-
/** SC23 SC02 SC37: the pane frame (pie: box or none).
|
|
1267
|
-
|
|
1282
|
+
/** SC23 SC02 SC37: the pane frame (pie: box or none). `hairlines`, the
|
|
1283
|
+
* default on line, bars, histogram and scatter: horizontal value hairlines
|
|
1284
|
+
* only, no frame and no vertical grid. */
|
|
1285
|
+
chrome?: 'box' | 'grid' | 'none' | 'hairlines';
|
|
1268
1286
|
format?: WrunValueFormat;
|
|
1269
1287
|
decimals?: number;
|
|
1270
1288
|
signed?: boolean;
|
|
@@ -2456,8 +2474,9 @@ interface WrunBatchedSectionCommon {
|
|
|
2456
2474
|
* {{price}} {{fills}}` on marks, `{{top}} {{bottom}} {{length}} {{word}}` on spans, `{{y1}}
|
|
2457
2475
|
* {{y2}} {{length}} {{word}}` on rays (the kit's WRUN_BATCHED_TOOLTIP_TOKENS), `{{start}}` and
|
|
2458
2476
|
* `{{end}}` in place of `{{length}}` on a timed (stride-5) section (the kit's
|
|
2459
|
-
* WRUN_BATCHED_TIMED_TOOLTIP_TOKENS, printed as chart times); `{{<field
|
|
2460
|
-
*
|
|
2477
|
+
* WRUN_BATCHED_TIMED_TOOLTIP_TOKENS, printed as chart times); `{{<field>:<format>}}` picks a
|
|
2478
|
+
* number format, a word of WRUN_BATCHED_NUMBER_FORMATS (wrun-batched-readout.util:
|
|
2479
|
+
* `{{qty:units}}` prints a mark's quantity in the market's own unit, `{{qty:usd}}` in dollars). */
|
|
2461
2480
|
tooltip?: string | null;
|
|
2462
2481
|
/** The readout title, 1..40 chars (absent = the name read as words). */
|
|
2463
2482
|
label?: string;
|
|
@@ -2485,11 +2504,13 @@ export interface WrunMarksSection extends WrunBatchedSectionCommon {
|
|
|
2485
2504
|
colors?: WrunBatchedColor[];
|
|
2486
2505
|
/** The fill opacity in percent, 10..80 (default 30). */
|
|
2487
2506
|
opacity_pct?: number;
|
|
2488
|
-
/** The caption: mode 0 Off, 1 Big bubbles (the largest a bar), 2 All (default 1, `compact`, 22 px)
|
|
2507
|
+
/** The caption: mode 0 Off, 1 Big bubbles (the largest a bar), 2 All (default 1, `compact`, 22 px); its
|
|
2508
|
+
* format a word of WRUN_BATCHED_NUMBER_FORMATS (`usd` dollars, `units` the market's own unit: Big Trades
|
|
2509
|
+
* 0.7.0's Size shown as paints one of the two). */
|
|
2489
2510
|
text?: {
|
|
2490
2511
|
mode?: number;
|
|
2491
2512
|
field?: 'qty';
|
|
2492
|
-
format?:
|
|
2513
|
+
format?: WrunBatchedNumberFormat;
|
|
2493
2514
|
min_px?: number;
|
|
2494
2515
|
};
|
|
2495
2516
|
}
|
|
@@ -54,7 +54,9 @@ export type TradesLargeFloor = {
|
|
|
54
54
|
export interface TradesLaneLimits {
|
|
55
55
|
/** The history reads the TRADE_LARGE table: a `large` acquisition on a market the table holds. */
|
|
56
56
|
readsLargeTable: boolean;
|
|
57
|
-
/** The seed cap: the table's retention on the large lane, two hours on the raw tape
|
|
57
|
+
/** The seed cap: the table's retention on the large lane, two hours on the raw tape, and 0 (the live edge only)
|
|
58
|
+
* for a dollar floor on the raw tape, whose rows no writer priced in dollars. Every reader of the tape's served
|
|
59
|
+
* history reads this cap: the request builder, the reconcile's served start and the queue loss's repair. */
|
|
58
60
|
historyCapSec: number;
|
|
59
61
|
retentionSec: number;
|
|
60
62
|
/** The gateway's bar limit on the large lane (`tradesBarLimitStartMs`); none on the raw tape. */
|
|
@@ -62,10 +64,24 @@ export interface TradesLaneLimits {
|
|
|
62
64
|
}
|
|
63
65
|
export type LiveTradeCell = [number, number, number, number];
|
|
64
66
|
export type LiveTradesRow = [number, ...LiveTradeCell[]];
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
/** A tape acquisition's floor as the live rules read it (the K_TRADES payload's own fields): `minSize`
|
|
68
|
+
* in the raw unit a live print arrives in, or `minValue` in US dollars (C-DOLLAR) with the market's
|
|
69
|
+
* `valuePerUnit` (the US dollars one price unit times one size unit is worth there, the run head's
|
|
70
|
+
* `wrunMarketDollarUnit`); an option book's registry units price a dollar floor instead. */
|
|
71
|
+
export interface TradesTapeFloor {
|
|
72
|
+
/** The size floor: a print below it never folds; absent, non-finite or non-positive = no floor. */
|
|
68
73
|
minSize?: unknown;
|
|
74
|
+
/** The dollar floor: when finite and above zero it replaces `minSize`, a print folds only when its
|
|
75
|
+
* dollar value reaches it, and the cell's size is that value. */
|
|
76
|
+
minValue?: unknown;
|
|
77
|
+
/** The US dollars one price unit times one size unit of a live print is worth on the acquisition's
|
|
78
|
+
* market; absent, non-finite or non-positive, no print can be valued and none folds under a dollar
|
|
79
|
+
* floor (never a guessed multiplier). */
|
|
80
|
+
valuePerUnit?: unknown;
|
|
81
|
+
/** An option book's registry trade units: its prints are valued by their USD premium. */
|
|
82
|
+
optionUnits?: OptionTradeUnits | null;
|
|
83
|
+
}
|
|
84
|
+
export interface LiveTradesMergeOptions extends TradesTapeFloor {
|
|
69
85
|
/** The large lane's table floor (the `large` acquisition): a print the large-print table never
|
|
70
86
|
* holds (`tradesBelowLargeFloor`; the print's envelope names the market, else this one) never
|
|
71
87
|
* folds, so no live print appears that the next reconcile cannot answer. */
|
|
@@ -145,6 +161,26 @@ export declare function readLiveTradePrint(newPoint: unknown): LiveTradePrint |
|
|
|
145
161
|
* dollar stablecoin. Any other quote (KRW, a coin) is never copied: the table holds none of its
|
|
146
162
|
* prints at all. */
|
|
147
163
|
export declare function tradesLargeQuotedInDollars(normalizedSymbol: unknown): boolean;
|
|
164
|
+
/** Whether a quote asset's amounts are US dollars: USD or a dollar stablecoin (the gateway writer's
|
|
165
|
+
* `peggedUSDQuotes`, the list the large-print table copies by). */
|
|
166
|
+
export declare function isTradesDollarQuoteAsset(asset: unknown): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* The size a live print's cell carries on a tape, or null when the print does not reach the tape's floor: the ONE
|
|
169
|
+
* floor rule the wrun intake's enqueue, its fold and the K_TRADES control's fold share.
|
|
170
|
+
*
|
|
171
|
+
* - A dollar floor (`minValue` finite and above zero, C-DOLLAR): the print's dollar value, and the print folds only
|
|
172
|
+
* when it reaches the floor. On an option book (`optionUnits`) its USD premium by the registry units
|
|
173
|
+
* (`liveOptionPrintUsdPremium`: a coin-premium book has none); on every other market price x size x `valuePerUnit`.
|
|
174
|
+
* The size is the live-feed COIN arm's: live-feed already applied each instrument's contract multiplier and its
|
|
175
|
+
* inverse flag (coins on a crypto contract or inverse venue), and a CME Group contract stays one contract, whose
|
|
176
|
+
* point value `valuePerUnit` carries. A print that cannot be valued (no `valuePerUnit`, units that cannot say) is
|
|
177
|
+
* null: it never folds, whatever its size.
|
|
178
|
+
* - Otherwise the raw size, below a finite positive `minSize` null.
|
|
179
|
+
*/
|
|
180
|
+
export declare function tradesTapeCellSize(print: Pick<LiveTradePrint, 'price' | 'size'>, floor: TradesTapeFloor): number | null;
|
|
181
|
+
/** Whether a tape floor can value a live print at all: a raw floor always can; a dollar floor needs the market's
|
|
182
|
+
* `valuePerUnit` or an option book's units. The live intake records a dollar tape that cannot, by name. */
|
|
183
|
+
export declare function tradesTapeFloorValuesPrints(floor: TradesTapeFloor): boolean;
|
|
148
184
|
/** A live print's notional: its quote amount when the frame carries one, else price x size. On an option
|
|
149
185
|
* book (`optionUnits`) the premium in the book's own currency by the resolver's live-print rule
|
|
150
186
|
* (option-trade-units.util `liveOptionPrintPremium`): a live print's size arrives in coin, live-feed having
|
|
@@ -164,19 +200,26 @@ export declare function tradesCmeProductRoot(market: TradesLargeMarket): string
|
|
|
164
200
|
* skips it); elsewhere the notional floor on a market quoted in dollars, null on any other quote
|
|
165
201
|
* (KRW, a coin): the table holds none of its prints. */
|
|
166
202
|
export declare function tradesLargeFloorOfMarket(market: TradesLargeMarket): TradesLargeFloor | null;
|
|
203
|
+
/** Whether a tape floor is a dollar floor (C-DOLLAR's `minValue`, finite and above zero). */
|
|
204
|
+
export declare function tradesTapeFloorIsDollars(floor: Pick<TradesTapeFloor, 'minValue'>): boolean;
|
|
167
205
|
/** The tape lane an acquisition rides on a market: the large lane (the table's retention, the
|
|
168
206
|
* gateway's bar limit, the declared history) when it asks `large` and the large-print table holds
|
|
169
207
|
* the market, else the raw tape (a two-hour seed inside the raw table's retention). On a CME Group
|
|
170
208
|
* venue a product root the writer lists no floor for is never copied, so a large acquisition on it
|
|
171
209
|
* reads the raw tape in place of an empty table and its live prints fold unfloored, the same rows
|
|
172
|
-
* either way, until the server lists the root. A
|
|
173
|
-
*
|
|
174
|
-
|
|
210
|
+
* either way, until the server lists the root. A dollar floor (`floor.minValue`) on that raw tape
|
|
211
|
+
* reads no history at all (`historyCapSec` 0, the live edge): the raw tape's quote amounts are priced
|
|
212
|
+
* by no writer rule (a backfill gap is NULL), so its rows are no proven dollars. A market quoted
|
|
213
|
+
* outside dollars keeps the table (the control cannot tell its quote: the table answers it empty, by
|
|
214
|
+
* its own rule). The ONE rule of a tape's served history: the request builder, the reconcile's served
|
|
215
|
+
* start and the queue loss's repair all read it with the acquisition's floor. */
|
|
216
|
+
export declare function tradesLaneLimits(large: boolean, market?: TradesLargeMarket, floor?: Pick<TradesTapeFloor, 'minValue'>): TradesLaneLimits;
|
|
175
217
|
/** Whether a history re-ask on a large acquisition answers a market's prints (the tape reconcile
|
|
176
218
|
* restoring what the queue cap dropped): the table on a market it holds, the raw tape on a CME
|
|
177
|
-
* Group root it skips
|
|
178
|
-
*
|
|
179
|
-
|
|
219
|
+
* Group root it skips under a size floor; never a lane that serves no history under the floor
|
|
220
|
+
* (`tradesLaneLimits`: a dollar floor on the raw tape), never a market quoted outside dollars. A
|
|
221
|
+
* market naming no normalized symbol is assumed held. */
|
|
222
|
+
export declare function tradesLargeHistoryAnswers(market: TradesLargeMarket, floor?: Pick<TradesTapeFloor, 'minValue'>): boolean;
|
|
180
223
|
/** True for a live print the large-print table never holds on a market it floors: a dollar-quoted
|
|
181
224
|
* print whose notional is under TRADES_LARGE_MIN_QUOTE_AMOUNT (the gateway copies a print whose
|
|
182
225
|
* quote amount reaches the floor), a CME Group print of fewer contracts than its root's floor (the
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
//
|
|
8
8
|
// The fold's rules, in order: a print needs a BUY or SELL series side, a
|
|
9
9
|
// finite positive amount, a finite price and a wire timestamp; a print below
|
|
10
|
-
// the acquisition's
|
|
10
|
+
// the acquisition's floor is rejected (`tradesTapeCellSize`: its `minSize` in
|
|
11
|
+
// raw units, or its `minValue` in dollars, C-DOLLAR, where the cell's size is
|
|
12
|
+
// then the print's dollar value), and on the large lane a print the
|
|
11
13
|
// large-print table never holds (`tradesBelowLargeFloor`: a dollar-quoted
|
|
12
14
|
// market's print under the notional floor, a CME Group print under its
|
|
13
15
|
// product root's contracts floor); the print lands in the chart bar
|
|
@@ -20,7 +22,7 @@ import { Intervals } from '../../constants/interval.constants.js';
|
|
|
20
22
|
import { barEndMs, barStartMs } from '../../utility/chart/calendar-interval.util.js';
|
|
21
23
|
import { cmeSessionBarEndMs, cmeSessionBarOpenMs, cmeSessionBucketMs, isCmeSessionLatticeExchange, isCmeSessionLatticeIntervalMs, } from '../../utility/chart/cme-session-bucket.util.js';
|
|
22
24
|
import { findMonday } from '../../workers/utils/time.worker.util.js';
|
|
23
|
-
import { liveOptionPrintPremium } from '../../utility/options/option-trade-units.util.js';
|
|
25
|
+
import { liveOptionPrintPremium, liveOptionPrintUsdPremium, } from '../../utility/options/option-trade-units.util.js';
|
|
24
26
|
export const LIVE_MAX_CELLS_PER_BAR = 20_000;
|
|
25
27
|
/** The most prints one history ask reads (the history worker's cap, mirroring the historical service's
|
|
26
28
|
* HIST_TRADES_MAX_CELLS): past it the ask fails loudly instead of truncating the tape, and the wrun tape's refusal
|
|
@@ -45,7 +47,9 @@ const TRADES_LARGE_BAR_LIMIT_MARGIN_SEC = 600;
|
|
|
45
47
|
* is copied into the table when its quote amount reaches it. */
|
|
46
48
|
export const TRADES_LARGE_MIN_QUOTE_AMOUNT = 10_000;
|
|
47
49
|
/** The quote assets whose quote amount is dollars (the gateway writer's `peggedUSDQuotes`): only the
|
|
48
|
-
* prints of a market quoted in one of these are copied into trade_large, every other quote never.
|
|
50
|
+
* prints of a market quoted in one of these are copied into trade_large, every other quote never. The
|
|
51
|
+
* dollar rule of a market's value (wrun-chart-market-facts.util `wrunMarketDollarUnit`) reads the same
|
|
52
|
+
* list (`isTradesDollarQuoteAsset`). */
|
|
49
53
|
const TRADES_LARGE_USD_QUOTES = new Set([
|
|
50
54
|
'USD',
|
|
51
55
|
'USDT',
|
|
@@ -235,6 +239,50 @@ export function tradesLargeQuotedInDollars(normalizedSymbol) {
|
|
|
235
239
|
const quote = normalizedSymbol.split('-')[1];
|
|
236
240
|
return quote !== undefined && TRADES_LARGE_USD_QUOTES.has(quote);
|
|
237
241
|
}
|
|
242
|
+
/** Whether a quote asset's amounts are US dollars: USD or a dollar stablecoin (the gateway writer's
|
|
243
|
+
* `peggedUSDQuotes`, the list the large-print table copies by). */
|
|
244
|
+
export function isTradesDollarQuoteAsset(asset) {
|
|
245
|
+
return typeof asset === 'string' && TRADES_LARGE_USD_QUOTES.has(asset.trim().toUpperCase());
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* The size a live print's cell carries on a tape, or null when the print does not reach the tape's floor: the ONE
|
|
249
|
+
* floor rule the wrun intake's enqueue, its fold and the K_TRADES control's fold share.
|
|
250
|
+
*
|
|
251
|
+
* - A dollar floor (`minValue` finite and above zero, C-DOLLAR): the print's dollar value, and the print folds only
|
|
252
|
+
* when it reaches the floor. On an option book (`optionUnits`) its USD premium by the registry units
|
|
253
|
+
* (`liveOptionPrintUsdPremium`: a coin-premium book has none); on every other market price x size x `valuePerUnit`.
|
|
254
|
+
* The size is the live-feed COIN arm's: live-feed already applied each instrument's contract multiplier and its
|
|
255
|
+
* inverse flag (coins on a crypto contract or inverse venue), and a CME Group contract stays one contract, whose
|
|
256
|
+
* point value `valuePerUnit` carries. A print that cannot be valued (no `valuePerUnit`, units that cannot say) is
|
|
257
|
+
* null: it never folds, whatever its size.
|
|
258
|
+
* - Otherwise the raw size, below a finite positive `minSize` null.
|
|
259
|
+
*/
|
|
260
|
+
export function tradesTapeCellSize(print, floor) {
|
|
261
|
+
if (tradesTapeFloorIsDollars(floor)) {
|
|
262
|
+
const minValue = Number(floor.minValue);
|
|
263
|
+
let value;
|
|
264
|
+
if (floor.optionUnits) {
|
|
265
|
+
value = liveOptionPrintUsdPremium(print.price, print.size, floor.optionUnits);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
const unit = Number(floor.valuePerUnit);
|
|
269
|
+
value = Number.isFinite(unit) && unit > 0 ? print.price * print.size * unit : null;
|
|
270
|
+
}
|
|
271
|
+
return value !== null && Number.isFinite(value) && value >= minValue ? value : null;
|
|
272
|
+
}
|
|
273
|
+
const minSize = Number(floor.minSize);
|
|
274
|
+
return Number.isFinite(minSize) && minSize > 0 && print.size < minSize ? null : print.size;
|
|
275
|
+
}
|
|
276
|
+
/** Whether a tape floor can value a live print at all: a raw floor always can; a dollar floor needs the market's
|
|
277
|
+
* `valuePerUnit` or an option book's units. The live intake records a dollar tape that cannot, by name. */
|
|
278
|
+
export function tradesTapeFloorValuesPrints(floor) {
|
|
279
|
+
if (!tradesTapeFloorIsDollars(floor))
|
|
280
|
+
return true;
|
|
281
|
+
if (floor.optionUnits)
|
|
282
|
+
return true;
|
|
283
|
+
const unit = Number(floor.valuePerUnit);
|
|
284
|
+
return Number.isFinite(unit) && unit > 0;
|
|
285
|
+
}
|
|
238
286
|
/** A live print's notional: its quote amount when the frame carries one, else price x size. On an option
|
|
239
287
|
* book (`optionUnits`) the premium in the book's own currency by the resolver's live-print rule
|
|
240
288
|
* (option-trade-units.util `liveOptionPrintPremium`): a live print's size arrives in coin, live-feed having
|
|
@@ -279,29 +327,46 @@ export function tradesLargeFloorOfMarket(market) {
|
|
|
279
327
|
? { kind: 'notional', min: TRADES_LARGE_MIN_QUOTE_AMOUNT }
|
|
280
328
|
: null;
|
|
281
329
|
}
|
|
330
|
+
/** Whether a tape floor is a dollar floor (C-DOLLAR's `minValue`, finite and above zero). */
|
|
331
|
+
export function tradesTapeFloorIsDollars(floor) {
|
|
332
|
+
const minValue = Number(floor.minValue);
|
|
333
|
+
return Number.isFinite(minValue) && minValue > 0;
|
|
334
|
+
}
|
|
282
335
|
/** The tape lane an acquisition rides on a market: the large lane (the table's retention, the
|
|
283
336
|
* gateway's bar limit, the declared history) when it asks `large` and the large-print table holds
|
|
284
337
|
* the market, else the raw tape (a two-hour seed inside the raw table's retention). On a CME Group
|
|
285
338
|
* venue a product root the writer lists no floor for is never copied, so a large acquisition on it
|
|
286
339
|
* reads the raw tape in place of an empty table and its live prints fold unfloored, the same rows
|
|
287
|
-
* either way, until the server lists the root. A
|
|
288
|
-
*
|
|
289
|
-
|
|
340
|
+
* either way, until the server lists the root. A dollar floor (`floor.minValue`) on that raw tape
|
|
341
|
+
* reads no history at all (`historyCapSec` 0, the live edge): the raw tape's quote amounts are priced
|
|
342
|
+
* by no writer rule (a backfill gap is NULL), so its rows are no proven dollars. A market quoted
|
|
343
|
+
* outside dollars keeps the table (the control cannot tell its quote: the table answers it empty, by
|
|
344
|
+
* its own rule). The ONE rule of a tape's served history: the request builder, the reconcile's served
|
|
345
|
+
* start and the queue loss's repair all read it with the acquisition's floor. */
|
|
346
|
+
export function tradesLaneLimits(large, market = {}, floor = {}) {
|
|
290
347
|
const readsLargeTable = large && (!isCmeSessionLatticeExchange(market.exchange) || tradesLargeFloorOfMarket(market) !== null);
|
|
291
|
-
|
|
292
|
-
|
|
348
|
+
if (readsLargeTable) {
|
|
349
|
+
return {
|
|
293
350
|
readsLargeTable,
|
|
294
351
|
historyCapSec: TRADES_LARGE_RETENTION_SEC,
|
|
295
352
|
retentionSec: TRADES_LARGE_RETENTION_SEC,
|
|
296
353
|
barLimitSec: TRADES_LARGE_BAR_LIMIT_SEC,
|
|
297
|
-
}
|
|
298
|
-
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
readsLargeTable,
|
|
358
|
+
historyCapSec: tradesTapeFloorIsDollars(floor) ? 0 : TRADES_MAX_HISTORY_SEC,
|
|
359
|
+
retentionSec: TRADES_RETENTION_SEC,
|
|
360
|
+
};
|
|
299
361
|
}
|
|
300
362
|
/** Whether a history re-ask on a large acquisition answers a market's prints (the tape reconcile
|
|
301
363
|
* restoring what the queue cap dropped): the table on a market it holds, the raw tape on a CME
|
|
302
|
-
* Group root it skips
|
|
303
|
-
*
|
|
304
|
-
|
|
364
|
+
* Group root it skips under a size floor; never a lane that serves no history under the floor
|
|
365
|
+
* (`tradesLaneLimits`: a dollar floor on the raw tape), never a market quoted outside dollars. A
|
|
366
|
+
* market naming no normalized symbol is assumed held. */
|
|
367
|
+
export function tradesLargeHistoryAnswers(market, floor = {}) {
|
|
368
|
+
if (!(tradesLaneLimits(true, market, floor).historyCapSec > 0))
|
|
369
|
+
return false;
|
|
305
370
|
if (isCmeSessionLatticeExchange(market.exchange))
|
|
306
371
|
return true;
|
|
307
372
|
return market.normalizedSymbol === undefined || tradesLargeQuotedInDollars(market.normalizedSymbol);
|
|
@@ -336,8 +401,8 @@ export function mergeLiveTradesDataPoint(lastDataPoint, newPoint, intervalMs, op
|
|
|
336
401
|
const print = readLiveTradePrint(newPoint);
|
|
337
402
|
if (print === null)
|
|
338
403
|
return null;
|
|
339
|
-
const
|
|
340
|
-
if (
|
|
404
|
+
const size = tradesTapeCellSize(print, options);
|
|
405
|
+
if (size === null)
|
|
341
406
|
return null;
|
|
342
407
|
if (options.largeFloor !== undefined && tradesBelowLargeFloor(print, options.largeFloor))
|
|
343
408
|
return null;
|
|
@@ -347,7 +412,7 @@ export function mergeLiveTradesDataPoint(lastDataPoint, newPoint, intervalMs, op
|
|
|
347
412
|
// A delayed closed-bar print must not append an out-of-order row.
|
|
348
413
|
if (last && last[0] > barTs)
|
|
349
414
|
return null;
|
|
350
|
-
const cell = [print.tsMs - barTs, print.price,
|
|
415
|
+
const cell = [print.tsMs - barTs, print.price, size, print.side];
|
|
351
416
|
if (!last || last[0] !== barTs)
|
|
352
417
|
return [...rows, [barTs, cell]];
|
|
353
418
|
// Live folds receive a shallow snapshot copy: never mutate its shared row
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* never re-priced), an EXPLICIT agreement acceptance (never inferred from a grant or a subscription), and pay first:
|
|
11
11
|
* the declaration and the agreement bind real-time ACCESS, not the payment, so checkout needs neither and the server
|
|
12
12
|
* serves real-time only once the account is both paid and qualified (delayed otherwise).
|
|
13
|
+
*
|
|
14
|
+
* The agreement itself is the server's (contracts K1 and K2 of the OPRA compliance round): `GET <basePath>/agreement`
|
|
15
|
+
* serves the complete populated text with its version and hash, the acceptance names that version and both hashes,
|
|
16
|
+
* and an acceptance counts only for the version the server presents now, never for a version a build carries.
|
|
13
17
|
*/
|
|
14
18
|
import type { CancelFeedback } from '../interfaces/cancel-reason.interface.js';
|
|
15
19
|
import type { MarketDataBillingInterval, MarketDataClassification, MarketDataVenue } from './venue.js';
|
|
@@ -38,8 +42,9 @@ export interface MarketDataAttestationRecordDto {
|
|
|
38
42
|
attestedAt: string;
|
|
39
43
|
formVersion: string;
|
|
40
44
|
/**
|
|
41
|
-
* ISO end of the declaration's validity (a year after it was made).
|
|
42
|
-
*
|
|
45
|
+
* ISO end of the declaration's validity (a year after it was made). A non-professional record that names none reads
|
|
46
|
+
* lapsed (`isMarketDataAttestationLive`): status is reconfirmed every 12 months, and a record with no end can never be
|
|
47
|
+
* shown to be inside its year.
|
|
43
48
|
*/
|
|
44
49
|
expiresAt?: string;
|
|
45
50
|
}
|
|
@@ -54,15 +59,39 @@ export interface MarketDataCheckoutDto {
|
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
56
61
|
* POST <basePath>/checkout -> 200: a Stripe redirect, or a refusal. 'professional_unavailable' is terminal (the UI
|
|
57
|
-
* shows "not available").
|
|
58
|
-
*
|
|
62
|
+
* shows "not available"). 'review_held' and 'review_withdrawn': a review of the account's answers only an operator
|
|
63
|
+
* resolves, or one that withdrew real-time (the review card says which). Pay first, the server no longer answers
|
|
64
|
+
* 'attestation_required' or 'agreement_required'; they stay in the union and are handled defensively (the flow routes
|
|
65
|
+
* into that step).
|
|
59
66
|
*/
|
|
60
67
|
export type MarketDataCheckoutResponseDto = {
|
|
61
68
|
url: string;
|
|
62
69
|
} | {
|
|
63
70
|
refused: MarketDataPurchaseRefusalCode;
|
|
64
71
|
};
|
|
65
|
-
export type MarketDataPurchaseRefusalCode = 'professional_unavailable' | 'agreement_required' | 'attestation_required';
|
|
72
|
+
export type MarketDataPurchaseRefusalCode = 'professional_unavailable' | 'review_held' | 'review_withdrawn' | 'agreement_required' | 'attestation_required';
|
|
73
|
+
/**
|
|
74
|
+
* GET <basePath>/subscription `review`: the review of the account's answers that bears on real-time (Exhibit A Q19.2),
|
|
75
|
+
* or null. 'pending': an employer or occupation that suggests a financial firm or a registered person asks the
|
|
76
|
+
* subscriber to confirm the declaration before `deadline` (POST <basePath>/attestation/review/confirm); real-time runs
|
|
77
|
+
* until the deadline passes. 'held': an operator reviews the declaration and real-time waits. 'withdrawn': an operator
|
|
78
|
+
* withdrew real-time (`resolvedAt`); the way back is a new declaration.
|
|
79
|
+
*/
|
|
80
|
+
export interface MarketDataReviewDto {
|
|
81
|
+
state: 'pending' | 'held' | 'withdrawn';
|
|
82
|
+
reason: string;
|
|
83
|
+
openedAt: string;
|
|
84
|
+
deadline: string | null;
|
|
85
|
+
resolvedAt: string | null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* POST <basePath>/attestation/review/confirm (no body) -> 200: the pending review confirmed; 409
|
|
89
|
+
* `<VENUE>_REVIEW_NOT_OPEN` when no review is pending (none, or one only an operator resolves).
|
|
90
|
+
*/
|
|
91
|
+
export interface MarketDataReviewConfirmDto {
|
|
92
|
+
confirmed: boolean;
|
|
93
|
+
confirmedAt: string;
|
|
94
|
+
}
|
|
66
95
|
/**
|
|
67
96
|
* Why the server set a subscription to end at its period end on its own: 'unqualified', the account is paid but has
|
|
68
97
|
* not completed the subscriber questions and the agreement.
|
|
@@ -85,6 +114,8 @@ export interface MarketDataSubscriptionDto {
|
|
|
85
114
|
}
|
|
86
115
|
export interface GetMarketDataSubscriptionResponseDto {
|
|
87
116
|
subscription: MarketDataSubscriptionDto | null;
|
|
117
|
+
/** Additive (a server from before the review answers none). */
|
|
118
|
+
review?: MarketDataReviewDto | null;
|
|
88
119
|
}
|
|
89
120
|
/**
|
|
90
121
|
* GET <basePath>/data-terms -> 200; POST <basePath>/data-terms -> 201. Acceptance is an explicit record of the
|
|
@@ -110,9 +141,65 @@ export interface MarketDataAttestationSubmitResult {
|
|
|
110
141
|
attestationId: number;
|
|
111
142
|
withdrawal: MarketDataAttestationWithdrawal | null;
|
|
112
143
|
}
|
|
113
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* GET <basePath>/agreement -> 200 (signed in, any tier), contract K1: the subscriber agreement the server presents now.
|
|
146
|
+
* `text` is the complete populated agreement followed by its addendum (UTF-8, LF line ends, one blank line between
|
|
147
|
+
* paragraphs, no hard wraps): exactly the characters `sha256` hashes. `addendumOffset` is the character index where the
|
|
148
|
+
* addendum starts. The server is the single source of the text (the frontend never bundles a copy), and its `version`
|
|
149
|
+
* is the version an acceptance must name to count, never the version a build carries.
|
|
150
|
+
*/
|
|
151
|
+
export interface MarketDataAgreementDocumentDto {
|
|
152
|
+
version: string;
|
|
153
|
+
sha256: string;
|
|
154
|
+
addendumVersion: string;
|
|
155
|
+
vendor: {
|
|
156
|
+
name: string;
|
|
157
|
+
address: string;
|
|
158
|
+
email: string;
|
|
159
|
+
};
|
|
160
|
+
text: string;
|
|
161
|
+
addendumOffset: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* GET <basePath>/agreement/accepted -> 200, contract K1: the exact agreement text the caller accepted and how; 404
|
|
165
|
+
* `<VENUE>_AGREEMENT_NOT_ACCEPTED` when the caller accepted none.
|
|
166
|
+
*/
|
|
167
|
+
export interface MarketDataAcceptedAgreementDto {
|
|
168
|
+
version: string;
|
|
169
|
+
sha256: string;
|
|
170
|
+
addendumVersion: string;
|
|
171
|
+
text: string;
|
|
172
|
+
acceptedAt: string;
|
|
173
|
+
manner: string;
|
|
174
|
+
attestationId: number | string | null;
|
|
175
|
+
}
|
|
176
|
+
/** The four addendum statements a subscriber confirms at assent: Addendum 1(a), 1(b), 1(c) and 2. */
|
|
177
|
+
export interface MarketDataAgreementRepresentations {
|
|
178
|
+
/** 1(a): a natural person or a qualifying trust, not an entity. */
|
|
179
|
+
naturalPerson: boolean;
|
|
180
|
+
/** 1(b): the data is used only for personal investment activities. */
|
|
181
|
+
personalUseOnly: boolean;
|
|
182
|
+
/** 1(c): not a Professional. */
|
|
183
|
+
notProfessional: boolean;
|
|
184
|
+
/** 2: notifies the vendor promptly when a statement of Section 1 stops being true. */
|
|
185
|
+
notifyOnChange: boolean;
|
|
186
|
+
}
|
|
187
|
+
/** The manner of assent an acceptance records: the click on the agreement's own "I AGREE" button. */
|
|
188
|
+
export declare const MARKET_DATA_ASSENT_MANNER = "click:i-agree";
|
|
189
|
+
/**
|
|
190
|
+
* POST <basePath>/data-terms request body, contract K2: the agreement the subscriber was shown (the K1 version, hash and
|
|
191
|
+
* addendum version, and the browser's own SHA-256 of the exact text it displayed), the manner of assent and the four
|
|
192
|
+
* addendum representations. The server records it only when all four are true, both versions are the ones it serves
|
|
193
|
+
* and both hashes equal its hash (else 409 `<VENUE>_AGREEMENT_STALE`), the account holds a current non-professional
|
|
194
|
+
* declaration (else 409 `<VENUE>_ATTESTATION_REQUIRED`) and its email is verified (else 403 `<VENUE>_EMAIL_UNVERIFIED`).
|
|
195
|
+
*/
|
|
114
196
|
export interface AcceptMarketDataDataTermsDto {
|
|
115
197
|
agreementVersion: string;
|
|
198
|
+
agreementSha256: string;
|
|
199
|
+
addendumVersion: string;
|
|
200
|
+
manner: typeof MARKET_DATA_ASSENT_MANNER;
|
|
201
|
+
displayedTextSha256: string;
|
|
202
|
+
representations: MarketDataAgreementRepresentations;
|
|
116
203
|
}
|
|
117
204
|
/** POST <basePath>/subscription/cancel and DELETE <basePath>/subscription/cancel -> 200 body. */
|
|
118
205
|
export interface MarketDataCancelResponseDto {
|
|
@@ -131,12 +218,23 @@ export interface MarketDataRegistration {
|
|
|
131
218
|
}
|
|
132
219
|
export type MarketDataAttestation = MarketDataAttestationRecordDto;
|
|
133
220
|
export type MarketDataSubscription = MarketDataSubscriptionDto;
|
|
221
|
+
/** The review of the account's answers, as served (`MarketDataReviewDto`). */
|
|
222
|
+
export type MarketDataReview = MarketDataReviewDto;
|
|
223
|
+
/** GET <basePath>/subscription in the domain: the subscription and the review its answer carries, each or none. */
|
|
224
|
+
export interface MarketDataSubscriptionAnswer {
|
|
225
|
+
subscription: MarketDataSubscription | null;
|
|
226
|
+
review: MarketDataReview | null;
|
|
227
|
+
}
|
|
134
228
|
/** The explicit agreement record: accepted, for which version, and when. */
|
|
135
229
|
export interface MarketDataAgreement {
|
|
136
230
|
accepted: boolean;
|
|
137
231
|
agreementVersion: string;
|
|
138
232
|
acceptedAt: string | null;
|
|
139
233
|
}
|
|
234
|
+
/** The agreement the server presents now (K1), as the store holds it: the text, its version, hash and addendum. */
|
|
235
|
+
export type MarketDataAgreementDocument = MarketDataAgreementDocumentDto;
|
|
236
|
+
/** The exact agreement the account accepted (K1), as the subscription page and the notice reopen it. */
|
|
237
|
+
export type MarketDataAcceptedAgreement = MarketDataAcceptedAgreementDto;
|
|
140
238
|
/** A form's answers, keyed by the venue's question ids. A missing answer never qualifies. */
|
|
141
239
|
export type MarketDataQualificationAnswers = Partial<Record<string, boolean>>;
|
|
142
240
|
/** Every question of the venue's questionnaire answered with its qualifying answer. */
|
|
@@ -144,21 +242,30 @@ export declare function isMarketDataNonProfessional(venue: MarketDataVenue, answ
|
|
|
144
242
|
/**
|
|
145
243
|
* A declaration on the venue's current form (a new question set means a new declaration) whose validity has not ended
|
|
146
244
|
* at `now`, either classification. The client owns expiry: `now` is the caller's clock (the store's last evaluation),
|
|
147
|
-
* never an implied Date.now(). A record without `expiresAt`
|
|
148
|
-
*
|
|
245
|
+
* never an implied Date.now(). A record without `expiresAt` reads lapsed, as does one whose `expiresAt` does not parse
|
|
246
|
+
* (ask again rather than trust it): status is reconfirmed every 12 months (Exhibit A Q19.3), and a record that names
|
|
247
|
+
* no end can never be shown to be inside its year.
|
|
149
248
|
*/
|
|
150
249
|
export declare function isMarketDataAttestationLive(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
|
|
151
250
|
/** A non-professional declaration on the current form, still valid at `now`: the account may buy real-time. */
|
|
152
251
|
export declare function isMarketDataAttestationCurrent(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
|
|
153
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* A professional declaration on the current form, still valid at `now`: real-time is not sold to the account. A
|
|
254
|
+
* professional record that names no expiry still refuses: a missing field never lifts a refusal (only a new
|
|
255
|
+
* non-professional declaration the server records does).
|
|
256
|
+
*/
|
|
154
257
|
export declare function isMarketDataProfessionalDeclaration(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): boolean;
|
|
155
258
|
/**
|
|
156
259
|
* The expiry (ISO, as served) a still-current non-professional declaration must be renewed by, once `now` is inside
|
|
157
260
|
* the venue's renewal window before it; null otherwise (no expiry named, further off, or already lapsed).
|
|
158
261
|
*/
|
|
159
262
|
export declare function marketDataAttestationRenewBy(venue: MarketDataVenue, attestation: MarketDataAttestation | null | undefined, now: number): string | null;
|
|
160
|
-
/**
|
|
161
|
-
|
|
263
|
+
/**
|
|
264
|
+
* An acceptance counts only for the agreement version the SERVER presents now (`current`: its K1 answer), never for an
|
|
265
|
+
* older text and never for the version a build carries (the venue card's `agreement.version` is the contract export's
|
|
266
|
+
* pin, not the current text). With no current agreement read, nothing counts.
|
|
267
|
+
*/
|
|
268
|
+
export declare function isMarketDataAgreementCurrent(current: Pick<MarketDataAgreementDocument, 'version'> | null | undefined, agreement: MarketDataAgreement | null | undefined): boolean;
|
|
162
269
|
/**
|
|
163
270
|
* Normalized checkout outcome. 'redirect' = leave for Stripe. 'refused' = the server declined (or the store answered a
|
|
164
271
|
* professional account itself); 'professional_unavailable' ends the purchase until a later non-professional declaration,
|
|
@@ -175,11 +282,15 @@ export type MarketDataCheckoutResult = {
|
|
|
175
282
|
kind: 'busy';
|
|
176
283
|
};
|
|
177
284
|
/**
|
|
178
|
-
* Transport-free failure surface for the billing calls. Unlike CME, a 403 is NOT an attestation gate (refusals ride
|
|
179
|
-
* 200 checkout body), so it never routes back into the declaration: it is a route the account may not use (the
|
|
180
|
-
* register's suspended account included). 'invoice_owed' is the tagged 409 while Stripe still collects an invoice.
|
|
285
|
+
* Transport-free failure surface for the billing calls. Unlike CME, a bare 403 is NOT an attestation gate (refusals ride
|
|
286
|
+
* the 200 checkout body), so it never routes back into the declaration: it is a route the account may not use (the
|
|
287
|
+
* register's suspended account included). 'invoice_owed' is the tagged 409 while Stripe still collects an invoice. The
|
|
288
|
+
* agreement's typed refusals (K2), read from the body's tag: 'agreement_stale' (409 `<VENUE>_AGREEMENT_STALE`: the text
|
|
289
|
+
* changed, read it again), 'attestation_required' (409 `<VENUE>_ATTESTATION_REQUIRED`: declare first) and
|
|
290
|
+
* 'email_unverified' (403 `<VENUE>_EMAIL_UNVERIFIED`: verify the email first); the review's 'review_not_open' (409
|
|
291
|
+
* `<VENUE>_REVIEW_NOT_OPEN`: no pending review to confirm, read the records again).
|
|
181
292
|
*/
|
|
182
|
-
export type MarketDataBillingErrorKind = 'conflict' | 'invoice_owed' | 'unauthorized' | 'forbidden' | 'network' | 'aborted' | 'server';
|
|
293
|
+
export type MarketDataBillingErrorKind = 'conflict' | 'invoice_owed' | 'agreement_stale' | 'attestation_required' | 'email_unverified' | 'review_not_open' | 'unauthorized' | 'forbidden' | 'network' | 'aborted' | 'server';
|
|
183
294
|
export declare class MarketDataBillingError extends Error {
|
|
184
295
|
readonly kind: MarketDataBillingErrorKind;
|
|
185
296
|
readonly status: number | null;
|
|
@@ -197,7 +308,12 @@ export declare class MarketDataBillingError extends Error {
|
|
|
197
308
|
export interface MarketDataBillingRepository {
|
|
198
309
|
getAttestation(signal?: AbortSignal): Promise<MarketDataAttestation | null>;
|
|
199
310
|
submitAttestation(body: MarketDataAttestationDto, signal?: AbortSignal): Promise<MarketDataAttestationSubmitResult>;
|
|
200
|
-
|
|
311
|
+
/** GET <basePath>/subscription: the subscription and the review of the account's answers, each or none. */
|
|
312
|
+
getSubscription(signal?: AbortSignal): Promise<MarketDataSubscriptionAnswer>;
|
|
313
|
+
/** POST <basePath>/attestation/review/confirm: the subscriber confirms a pending review (a typed refusal throws). */
|
|
314
|
+
confirmReview(signal?: AbortSignal): Promise<{
|
|
315
|
+
confirmedAt: string;
|
|
316
|
+
}>;
|
|
201
317
|
/** Never resolves 'busy' (that is the store's own answer); a refusal resolves, a failure throws. */
|
|
202
318
|
checkout(body: MarketDataCheckoutDto, options: {
|
|
203
319
|
idempotencyId: string;
|
|
@@ -213,7 +329,12 @@ export interface MarketDataBillingRepository {
|
|
|
213
329
|
message: string | null;
|
|
214
330
|
}>;
|
|
215
331
|
getDataTerms(signal?: AbortSignal): Promise<MarketDataAgreement>;
|
|
216
|
-
|
|
332
|
+
/** GET <basePath>/agreement (K1): the agreement the server presents now; a body that is not one throws 'server'. */
|
|
333
|
+
getAgreement(signal?: AbortSignal): Promise<MarketDataAgreementDocument>;
|
|
334
|
+
/** GET <basePath>/agreement/accepted (K1): the exact text the account accepted, or null on the 404 (none). */
|
|
335
|
+
getAcceptedAgreement(signal?: AbortSignal): Promise<MarketDataAcceptedAgreement | null>;
|
|
336
|
+
/** POST <basePath>/data-terms (K2): the assent; a typed refusal throws its kind. */
|
|
337
|
+
acceptDataTerms(body: AcceptMarketDataDataTermsDto, signal?: AbortSignal): Promise<MarketDataAgreement>;
|
|
217
338
|
/** The free registration: resolves only on the confirmed 201 `{ registered: true }`; a failure throws (a 403 is
|
|
218
339
|
* 'forbidden'). */
|
|
219
340
|
register(signal?: AbortSignal): Promise<MarketDataRegistration>;
|