@orangecharts/wrun-chart-host 0.6.0 → 0.7.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.
Files changed (136) hide show
  1. package/README.md +13 -5
  2. package/dist/constants/marketCapabilities.constants.d.ts +5 -0
  3. package/dist/constants/marketCapabilities.constants.js +16 -0
  4. package/dist/host-ports.types.d.ts +35 -3
  5. package/dist/index.d.ts +11 -1
  6. package/dist/index.js +11 -1
  7. package/dist/indicators/controls/tpo-session.util.js +42 -18
  8. package/dist/market-data/billing.interface.d.ts +2 -1
  9. package/dist/settings-templates/indicator-fields.js +10 -0
  10. package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
  11. package/dist/utility/chart/crypto-index.leaf.js +19 -0
  12. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  13. package/dist/utility/chart/index-mode.util.d.ts +11 -5
  14. package/dist/utility/chart/index-mode.util.js +22 -10
  15. package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
  16. package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
  17. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
  18. package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
  19. package/dist/utility/chart/live-bucket.util.d.ts +2 -1
  20. package/dist/utility/chart/live-bucket.util.js +47 -15
  21. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
  22. package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
  23. package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
  24. package/dist/utility/chart/market-session-schedule.util.js +24 -2
  25. package/dist/utility/chart/marketKind.util.d.ts +12 -7
  26. package/dist/utility/chart/marketKind.util.js +15 -5
  27. package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
  28. package/dist/utility/chart/ny-calendar.util.js +346 -0
  29. package/dist/utility/chart/om-panel.util.d.ts +14 -2
  30. package/dist/utility/chart/om-panel.util.js +108 -40
  31. package/dist/utility/chart/rth-session.util.d.ts +10 -7
  32. package/dist/utility/chart/rth-session.util.js +17 -22
  33. package/dist/utility/chart/trading-day.util.js +90 -18
  34. package/dist/utility/chart/us-equities-session.util.js +20 -67
  35. package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
  36. package/dist/utility/common/time.util.d.ts +7 -1
  37. package/dist/utility/common/time.util.js +11 -41
  38. package/dist/utility/number-format.util.d.ts +17 -7
  39. package/dist/utility/number-format.util.js +18 -8
  40. package/dist/utility/options/option-symbol.util.js +13 -2
  41. package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
  42. package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
  43. package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
  44. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
  45. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
  46. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
  47. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
  48. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
  49. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
  50. package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
  51. package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
  52. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
  53. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
  54. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
  55. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
  56. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
  57. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
  58. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
  59. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
  60. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
  61. package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
  62. package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
  63. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
  64. package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
  65. package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
  66. package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
  67. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
  68. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
  69. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
  70. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
  71. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
  72. package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
  73. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
  74. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
  75. package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
  76. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
  77. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
  78. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
  79. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
  80. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
  81. package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
  82. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
  83. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
  84. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
  85. package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
  86. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
  87. package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
  88. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
  89. package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
  90. package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
  91. package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
  92. package/dist/utility/wrun/wrun-failure-cause.js +14 -0
  93. package/dist/utility/wrun/wrun-frames.js +6 -2
  94. package/dist/utility/wrun/wrun-host.service.d.ts +26 -18
  95. package/dist/utility/wrun/wrun-host.service.js +49 -52
  96. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
  97. package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
  98. package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
  99. package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
  100. package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
  101. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
  102. package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
  103. package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
  104. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
  105. package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
  106. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
  107. package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
  108. package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
  109. package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
  110. package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
  111. package/dist/utility/wrun/wrun-option-views.util.js +356 -0
  112. package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
  113. package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
  114. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +18 -3
  115. package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
  116. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
  117. package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
  118. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +50 -6
  119. package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
  120. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
  121. package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
  122. package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
  123. package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
  124. package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
  125. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
  126. package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
  127. package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
  128. package/dist/utility/wrun/wrun-refusal.util.js +335 -40
  129. package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
  130. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
  131. package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
  132. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
  133. package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
  134. package/package.json +5 -5
  135. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
  136. package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
@@ -182,6 +182,7 @@ import { hostBucketResolverFor } from '../chart/host-bar-placement.util.js';
182
182
  import { attachWrunStrategy, isWrunStrategySheet, wrunStrategyOf } from './wrun-box-segment.util.js';
183
183
  import { wrunDailyLaneDayStart, wrunDailyLaneHeadEqual, wrunDailyLaneReconcileTo, } from './wrun-daily-lane.util.js';
184
184
  import { withWrunDeadline, WRUN_SOURCE_FETCH_DEADLINE_MS } from './wrun-deadline.util.js';
185
+ import { wrunAnswerKeepsHeldOverMarkers } from './wrun-present-bits.util.js';
185
186
  import { wrunParamValuesFromSettings } from './wrun-script-inputs.util.js';
186
187
  import { wrunOverlayLegendNote } from './wrun-draft-legend-note.util.js';
187
188
  import { wrunTextParamValuesFromSettings } from './wrun-text-params.util.js';
@@ -1996,22 +1997,33 @@ async function wrunEditorTabProbe() {
1996
1997
  * The note a tick's failure leaves, or null when the record does not classify
1997
1998
  * it (a generic failure, or a class the full run owns: no bars, a deadline).
1998
1999
  * A tick drew before, so its record is a note wherever the C2 table leaves the
1999
- * severity to the raiser (too-big: paused for a run, a note for a tick); the
2000
- * raiser's technical text stays its details.
2000
+ * severity to the raiser (too-big: paused for a run, a note for a tick). The
2001
+ * note re-words the record and keeps everything else the record read off the
2002
+ * failure: the raiser's technical text (its details), its cause
2003
+ * (`telemetry.cause`, which `wrun_failure_shown` reports and the transient
2004
+ * grace reads, as for the run's own record), the run attempt and the answer's
2005
+ * flags. Only the ask's own stamp (`clientRequestId`) stays off: every drain
2006
+ * is a new ask, and the note's key (one write per session) must not change
2007
+ * with it.
2001
2008
  */
2002
2009
  export function wrunLiveTickRefusalOf(error, ctx) {
2003
2010
  const record = wrunRefusalFor(error, ctx);
2004
2011
  if (WRUN_TICK_QUIET_REFUSAL_CLASSES.has(record.cls))
2005
2012
  return null;
2006
- const note = wrunRefusalFor({
2007
- cls: record.cls,
2008
- variant: record.variant,
2009
- params: { ...record.params },
2010
- ...(record.market ? { market: record.market } : {}),
2011
- out: record.out,
2012
- severity: 'note',
2013
- }, ctx);
2014
- return { ...note, details: record.details };
2013
+ const note = {
2014
+ ...record,
2015
+ ...wrunRefusalFor({
2016
+ cls: record.cls,
2017
+ variant: record.variant,
2018
+ params: { ...record.params },
2019
+ ...(record.market ? { market: record.market } : {}),
2020
+ out: record.out,
2021
+ severity: 'note',
2022
+ }, ctx),
2023
+ details: record.details,
2024
+ };
2025
+ delete note.clientRequestId;
2026
+ return note;
2015
2027
  }
2016
2028
  /** Say a drain's classified failure once, as a note for the `tick` owner (no
2017
2029
  * toast; the last good result stays drawn), while the session the drain ran
@@ -3174,6 +3186,7 @@ async function askWrunReconcileSourceAnswer(context, ledger, ask, meta) {
3174
3186
  // (the chart's, or a session's run interval).
3175
3187
  ...(ask.interval === undefined ? wrunReconcileRunIntervalOption(context) : { interval: ask.interval }),
3176
3188
  ...(ask.nativeRows === true ? { nativeRows: true } : {}),
3189
+ ...(ask.endExclusive === true ? { endExclusive: true } : {}),
3177
3190
  }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${ask.type}' (${ask.key}) for '${context.fetchKey}'`);
3178
3191
  return Array.isArray(fetched) ? fetched : null;
3179
3192
  }
@@ -3811,13 +3824,19 @@ function wrunRowLaneKeepsHeld(context, lane) {
3811
3824
  return instance !== undefined && wrunRowLaneByKey(instance.laneKey)?.liveByCoin?.reconcile !== undefined;
3812
3825
  }
3813
3826
  /** A row lane's answer merged over the rows it held by its lane's own rule (a `liveByCoin` lane's `reconcile`:
3814
- * a print shown live never vanishes on the next poll), else the answer as it came. */
3827
+ * a print shown live never vanishes on the next poll), else the answer as it came; then, on a lane with a `present`
3828
+ * mask, a held row that carries data stands where the answer names its bar only with the partial marker
3829
+ * (`wrunAnswerKeepsHeldOverMarkers`). */
3815
3830
  function wrunRowLaneReconcileAnswer(context, lane, held, answer) {
3816
3831
  const instance = context.rowLanes?.find((candidate) => candidate.key === lane);
3817
- const reconcile = instance === undefined ? undefined : wrunRowLaneByKey(instance.laneKey)?.liveByCoin?.reconcile;
3818
- if (reconcile === undefined)
3819
- return answer;
3820
- return reconcile(held, answer);
3832
+ const descriptor = instance === undefined ? undefined : wrunRowLaneByKey(instance.laneKey);
3833
+ const reconcile = descriptor?.liveByCoin?.reconcile;
3834
+ const merged = reconcile === undefined
3835
+ ? answer
3836
+ : reconcile(held, answer);
3837
+ return descriptor === undefined || descriptor.presentMask === false
3838
+ ? merged
3839
+ : wrunAnswerKeepsHeldOverMarkers(held, merged);
3821
3840
  }
3822
3841
  function laneRowsOf(context, lane) {
3823
3842
  if (isWrunPollLaneId(lane))
@@ -1,18 +1,21 @@
1
1
  /**
2
- * The `options_flow` source class (UW-PARITY source S2) as both threads read it: the field list and its order (the
3
- * lane row's columns after the stamp), the knob words, and how each knob names the OPTION_PRINT_AGG flow scope rows a
4
- * bar sums. The lane file (main thread), the K control and its worker twin read this one table, never copies.
2
+ * The `options_flow` source class (UW-PARITY source S2, on every chain since OPTIONS-PORT P7) as both threads read it:
3
+ * the field list and its order (the lane row's columns after the stamp), the knob words, the acquisition's fields, and
4
+ * how each ask names the OPTION_PRINT_AGG flow scope rows a bar sums. The lane file (main thread), the K control and
5
+ * its worker twin read this one table, never copies.
5
6
  *
6
7
  * The rows (tsdb-gateway `pkg/tsdb/selects/option_print_agg.go`, U4; columns `contracts/flow-scope-columns.md`; the
7
- * dimensions U6's `1792198478_add_option_print_agg_scopes` migration computes):
8
- * - scope `ticker`: COIN rows of the chart's underlying (raw symbol `COIN`, the coin beside it);
9
- * - scope `market`: MARKET rows of every issue type (`MARKET`); `equity`, `etf`, `index`: MARKET rows of that issue
10
- * type (`EQUITY` stock 4, `ETF` 3, `INDEX` 7);
11
- * - scope `venue`: VENUE rows of one venue (`VENUE:<publisher id>`, the Databento publisher id the rows carry);
8
+ * dimensions U6's `1792198478_add_option_print_agg_scopes` migration computes; on crypto and CME R7c's contract C7-1):
9
+ * - COIN rows of one underlying on the ask's exchange or venues (raw symbol `COIN`, the coin beside it): an OPRA
10
+ * ticker read, a CME ticker read (the future), and a crypto chain's every read (its ticker names its ONE book as
11
+ * `COIN:<book>`; `market` and `venue` read the coin across venues, every book);
12
+ * - MARKET rows of one exchange (`MARKET`): OPRA's every issue type, or one (`EQUITY` stock 4, `ETF` 3, `INDEX` 7), and
13
+ * a CME exchange's;
14
+ * - VENUE rows of one OPRA venue (`VENUE:<publisher id>`, the Databento publisher id the rows carry);
12
15
  * - a COIN or MARKET row is keyed by option type, `dte_bucket` (1 the print's trade date, 2 one to seven days, 3 eight
13
16
  * to thirty-five, 4 later; 0 a print past its expiry) and `moneyness` (+1 out of the money, -1 in the money, unset
14
17
  * without an underlying price); a VENUE row by option type and issue type. Side is never a dimension: every row
15
- * splits its totals by side in its `_ask`, `_bid`, `_mid` and `_none` columns.
18
+ * splits its totals by side in its `_ask`, `_bid`, `_mid` and `_none` columns (off OPRA the taker's side: no mid).
16
19
  *
17
20
  * Import-free: a lane file stays light at module load and the worker twin reads it too.
18
21
  */
@@ -25,6 +28,8 @@ export declare const WRUN_OPTIONS_FLOW_VENUE_FIELDS: readonly WrunOptionsFlowFie
25
28
  /** `scope` (om `WRUN_OPTIONS_FLOW_SCOPES`); an absent knob reads `ticker`. */
26
29
  export declare const WRUN_OPTIONS_FLOW_SCOPES: readonly ["ticker", "market", "equity", "etf", "index", "venue"];
27
30
  export type WrunOptionsFlowScope = (typeof WRUN_OPTIONS_FLOW_SCOPES)[number];
31
+ /** The scopes US listed options alone serve (an issue type of the US market, R7c C7-2): unserved off the OPRA plane. */
32
+ export declare const WRUN_OPTIONS_FLOW_OPRA_SCOPES: readonly WrunOptionsFlowScope[];
28
33
  /** `dte` (om `WRUN_OPTIONS_FLOW_DTE`); an absent knob reads `all`. */
29
34
  export declare const WRUN_OPTIONS_FLOW_DTE: readonly ["all", "0dte", "week", "month", "later"];
30
35
  export type WrunOptionsFlowDte = (typeof WRUN_OPTIONS_FLOW_DTE)[number];
@@ -50,16 +55,38 @@ export declare const WRUN_OPTION_SCOPE_READS_OFF_CODE = "option-scope-reads-off"
50
55
  * good. The keys are the intervals the K control asks. */
51
56
  export declare const WRUN_OPTIONS_FLOW_TIER_KEYS: readonly ["1m", "5m", "1d"];
52
57
  export type WrunOptionsFlowTier = (typeof WRUN_OPTIONS_FLOW_TIER_KEYS)[number];
58
+ /** Each tier's bucket width, ms (a row's stamp is its bucket's start, on the UTC floor). */
59
+ export declare const WRUN_OPTIONS_FLOW_TIER_MS: Readonly<Record<WrunOptionsFlowTier, number>>;
60
+ /**
61
+ * The acquisition's fields beside `scope`, `coin`, `venueId`, `dte` and `moneyness` (the lane's plan answers them, the
62
+ * K control forwards them): the exchange the chart's chain lists on (the lane's `chain` mark: its plane decides the
63
+ * walls, the tier and the fold), a crypto ticker read's ONE book, the venues a crypto scope across venues reads, and a
64
+ * CME chain's continuous alias (`acquisitionMoved` reads it).
65
+ */
66
+ export declare const WRUN_OPTIONS_FLOW_EXCHANGE_FIELD = "flowExchange";
67
+ export declare const WRUN_OPTIONS_FLOW_BOOK_FIELD = "flowBook";
68
+ export declare const WRUN_OPTIONS_FLOW_VENUES_FIELD = "flowVenues";
69
+ export declare const WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD = "flowContinuous";
53
70
  /** One acquisition: the payload the lane's plan answers and the K control forwards (plus the tier it is asked at). */
54
71
  export interface WrunOptionsFlowAsk {
55
72
  scope: WrunOptionsFlowScope;
56
- /** Scope `ticker`: the chart's underlying, upper case. */
73
+ /** The exchange the chart's chain lists on (pb-common `Exchange` name): the read's venue unless `venues` names them. */
74
+ exchange: string;
75
+ /** A COIN read's underlying, upper case: every ticker read's, a crypto scope across venues' (the chart's coin). */
57
76
  coin?: string;
58
- /** Scope `venue`: the venue's Databento publisher id. */
77
+ /** A crypto ticker read's ONE book (a series name, upper case), read as `COIN:<book>`; absent: every book. */
78
+ book?: string;
79
+ /** A crypto scope across venues (`market`, `venue`): the venues its COIN rows are read on. */
80
+ venues?: readonly string[];
81
+ /** Scope `venue` on OPRA: the venue's Databento publisher id. */
59
82
  venueId?: number;
60
83
  dte: WrunOptionsFlowDte;
61
84
  moneyness: WrunOptionsFlowMoneyness;
62
85
  tier: WrunOptionsFlowTier;
63
86
  }
64
- /** The raw symbol a scope's read names (the scope word alone; a ticker read adds its coin beside it). */
65
- export declare function wrunOptionsFlowScopeSymbol(ask: Pick<WrunOptionsFlowAsk, 'scope' | 'venueId'>): string;
87
+ /** Whether an ask reads VENUE rows (scope `venue` on OPRA, by publisher id: no side, DTE or moneyness split); a crypto
88
+ * scope `venue` reads its venue's COIN rows. */
89
+ export declare function wrunOptionsFlowReadsVenueRows(ask: Pick<WrunOptionsFlowAsk, 'scope' | 'coin'>): boolean;
90
+ /** The raw symbol an ask's read names: `COIN` for a read of one underlying (`COIN:<book>` when it names its ONE book),
91
+ * `VENUE:<publisher id>` for an OPRA venue, else the scope's MARKET word. */
92
+ export declare function wrunOptionsFlowScopeSymbol(ask: Pick<WrunOptionsFlowAsk, 'scope' | 'coin' | 'book' | 'venueId'>): string;
@@ -1,18 +1,21 @@
1
1
  /**
2
- * The `options_flow` source class (UW-PARITY source S2) as both threads read it: the field list and its order (the
3
- * lane row's columns after the stamp), the knob words, and how each knob names the OPTION_PRINT_AGG flow scope rows a
4
- * bar sums. The lane file (main thread), the K control and its worker twin read this one table, never copies.
2
+ * The `options_flow` source class (UW-PARITY source S2, on every chain since OPTIONS-PORT P7) as both threads read it:
3
+ * the field list and its order (the lane row's columns after the stamp), the knob words, the acquisition's fields, and
4
+ * how each ask names the OPTION_PRINT_AGG flow scope rows a bar sums. The lane file (main thread), the K control and
5
+ * its worker twin read this one table, never copies.
5
6
  *
6
7
  * The rows (tsdb-gateway `pkg/tsdb/selects/option_print_agg.go`, U4; columns `contracts/flow-scope-columns.md`; the
7
- * dimensions U6's `1792198478_add_option_print_agg_scopes` migration computes):
8
- * - scope `ticker`: COIN rows of the chart's underlying (raw symbol `COIN`, the coin beside it);
9
- * - scope `market`: MARKET rows of every issue type (`MARKET`); `equity`, `etf`, `index`: MARKET rows of that issue
10
- * type (`EQUITY` stock 4, `ETF` 3, `INDEX` 7);
11
- * - scope `venue`: VENUE rows of one venue (`VENUE:<publisher id>`, the Databento publisher id the rows carry);
8
+ * dimensions U6's `1792198478_add_option_print_agg_scopes` migration computes; on crypto and CME R7c's contract C7-1):
9
+ * - COIN rows of one underlying on the ask's exchange or venues (raw symbol `COIN`, the coin beside it): an OPRA
10
+ * ticker read, a CME ticker read (the future), and a crypto chain's every read (its ticker names its ONE book as
11
+ * `COIN:<book>`; `market` and `venue` read the coin across venues, every book);
12
+ * - MARKET rows of one exchange (`MARKET`): OPRA's every issue type, or one (`EQUITY` stock 4, `ETF` 3, `INDEX` 7), and
13
+ * a CME exchange's;
14
+ * - VENUE rows of one OPRA venue (`VENUE:<publisher id>`, the Databento publisher id the rows carry);
12
15
  * - a COIN or MARKET row is keyed by option type, `dte_bucket` (1 the print's trade date, 2 one to seven days, 3 eight
13
16
  * to thirty-five, 4 later; 0 a print past its expiry) and `moneyness` (+1 out of the money, -1 in the money, unset
14
17
  * without an underlying price); a VENUE row by option type and issue type. Side is never a dimension: every row
15
- * splits its totals by side in its `_ask`, `_bid`, `_mid` and `_none` columns.
18
+ * splits its totals by side in its `_ask`, `_bid`, `_mid` and `_none` columns (off OPRA the taker's side: no mid).
16
19
  *
17
20
  * Import-free: a lane file stays light at module load and the worker twin reads it too.
18
21
  */
@@ -62,6 +65,8 @@ export const WRUN_OPTIONS_FLOW_VENUE_FIELDS = Object.freeze([
62
65
  ]);
63
66
  /** `scope` (om `WRUN_OPTIONS_FLOW_SCOPES`); an absent knob reads `ticker`. */
64
67
  export const WRUN_OPTIONS_FLOW_SCOPES = Object.freeze(['ticker', 'market', 'equity', 'etf', 'index', 'venue']);
68
+ /** The scopes US listed options alone serve (an issue type of the US market, R7c C7-2): unserved off the OPRA plane. */
69
+ export const WRUN_OPTIONS_FLOW_OPRA_SCOPES = Object.freeze(['equity', 'etf', 'index']);
65
70
  /** `dte` (om `WRUN_OPTIONS_FLOW_DTE`); an absent knob reads `all`. */
66
71
  export const WRUN_OPTIONS_FLOW_DTE = Object.freeze(['all', '0dte', 'week', 'month', 'later']);
67
72
  /** `moneyness` (om `WRUN_OPTIONS_FLOW_MONEYNESS`); an absent knob reads `all`. */
@@ -84,10 +89,32 @@ export const WRUN_OPTION_SCOPE_READS_OFF_CODE = 'option-scope-reads-off';
84
89
  /** The backend tiers a bar is read from (UW-PARITY rule 9, ADDENDUM-2 B3): 1m kept 7 days, 5m kept 30, 1d kept for
85
90
  * good. The keys are the intervals the K control asks. */
86
91
  export const WRUN_OPTIONS_FLOW_TIER_KEYS = Object.freeze(['1m', '5m', '1d']);
87
- /** The raw symbol a scope's read names (the scope word alone; a ticker read adds its coin beside it). */
92
+ /** Each tier's bucket width, ms (a row's stamp is its bucket's start, on the UTC floor). */
93
+ export const WRUN_OPTIONS_FLOW_TIER_MS = Object.freeze({
94
+ '1m': 60_000,
95
+ '5m': 300_000,
96
+ '1d': 86_400_000,
97
+ });
98
+ /**
99
+ * The acquisition's fields beside `scope`, `coin`, `venueId`, `dte` and `moneyness` (the lane's plan answers them, the
100
+ * K control forwards them): the exchange the chart's chain lists on (the lane's `chain` mark: its plane decides the
101
+ * walls, the tier and the fold), a crypto ticker read's ONE book, the venues a crypto scope across venues reads, and a
102
+ * CME chain's continuous alias (`acquisitionMoved` reads it).
103
+ */
104
+ export const WRUN_OPTIONS_FLOW_EXCHANGE_FIELD = 'flowExchange';
105
+ export const WRUN_OPTIONS_FLOW_BOOK_FIELD = 'flowBook';
106
+ export const WRUN_OPTIONS_FLOW_VENUES_FIELD = 'flowVenues';
107
+ export const WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD = 'flowContinuous';
108
+ /** Whether an ask reads VENUE rows (scope `venue` on OPRA, by publisher id: no side, DTE or moneyness split); a crypto
109
+ * scope `venue` reads its venue's COIN rows. */
110
+ export function wrunOptionsFlowReadsVenueRows(ask) {
111
+ return ask.scope === 'venue' && ask.coin === undefined;
112
+ }
113
+ /** The raw symbol an ask's read names: `COIN` for a read of one underlying (`COIN:<book>` when it names its ONE book),
114
+ * `VENUE:<publisher id>` for an OPRA venue, else the scope's MARKET word. */
88
115
  export function wrunOptionsFlowScopeSymbol(ask) {
89
- if (ask.scope === 'ticker')
90
- return 'COIN';
116
+ if (ask.scope === 'ticker' || ask.coin !== undefined)
117
+ return ask.book !== undefined ? `COIN:${ask.book}` : 'COIN';
91
118
  if (ask.scope === 'venue')
92
119
  return `VENUE:${ask.venueId}`;
93
120
  return WRUN_OPTIONS_FLOW_MARKET_WORDS[ask.scope];
@@ -29,8 +29,9 @@ export declare const WRUN_OPTION_CONTRACT_FLOW_BIT: Readonly<{
29
29
  readonly iv: 1;
30
30
  readonly shareDelta: 2;
31
31
  }>;
32
- /** OPTION_PRINT_AGG's contract tiers (tsdb-gateway `option_print_agg_{1m,5m,1h,1d}`): 1m kept 7 days, 5m 30, the
33
- * hour and the day for good. Each key is the interval word the K control asks the tier by.
32
+ /** OPTION_PRINT_AGG's contract tiers (tsdb-gateway `option_print_agg_{1m,5m,1h,1d}`, the same on the cme and ore
33
+ * planes, contract C7-1): 1m kept 7 days, 5m 30, the hour and the day for good. Each key is the interval word the K
34
+ * control asks the tier by.
34
35
  * `servedLagMs` (read by the coarsest tier choice only: the 1m tier stays the fallback for every bar): how long after
35
36
  * a bar ends a coarser tier may serve it.
36
37
  * - Every coarser tier waits out the delayed window's lag, so a delayed read's end never falls inside one of its
@@ -41,27 +42,41 @@ export declare const WRUN_OPTION_CONTRACT_FLOW_BIT: Readonly<{
41
42
  * minutes, 5 minutes back), the day by `option-print-slow` (hourly at :30, 4 hours back); the lags add a margin for
42
43
  * the run. */
43
44
  export declare const WRUN_OPTION_PRINT_AGG_TIERS: readonly WrunBackendTier[];
44
- /** The most contract rows one read may hold: the worker twin fails a window past it loudly, never truncated, and the
45
- * lane's row budget keeps its asks under it before any fetch. */
46
- export declare const WRUN_OPTION_CONTRACT_FLOW_MAX_ROWS = 500000;
47
45
  /**
48
- * The contract rows one regular session holds at each tier (one row per contract per bucket it traded in), the row
49
- * budget's projection for EVERY underlying: SPY's, measured on 2026-10-14 (120 of its 13,168 listed contracts sampled
50
- * at random, every 1m trade bar of the session, scaled to the chain), the upper end of a bootstrap 90% interval (the
51
- * point estimates: 169k, 84k, 23k and 6.0k). A smaller chain is projected as SPY's (its older bars go partial sooner
52
- * than they need to); a larger one could still reach the worker's cap, which then fails loudly.
46
+ * The contract rows one regular OPRA session holds at each tier (one row per contract per bucket it traded in), the row
47
+ * budget's projection for EVERY underlying on the OPRA plane: SPY's, measured on 2026-10-14 (120 of its 13,168 listed
48
+ * contracts sampled at random, every 1m trade bar of the session, scaled to the chain), the upper end of a bootstrap 90%
49
+ * interval (the point estimates: 169k, 84k, 23k and 6.0k). A smaller chain is projected as SPY's (its older bars go
50
+ * partial sooner than they need to); a larger one could still reach the worker's cap, which then fails loudly. A CME
51
+ * chain is projected with the same rows per Globex trade day until one is measured: its OPTION_PRINT_AGG rows start
52
+ * with the CME print producer, and the ore gateway carries no CME option trades to measure.
53
53
  */
54
54
  export declare const WRUN_OPTION_CONTRACT_FLOW_SESSION_ROWS: Readonly<Record<string, number>>;
55
+ /**
56
+ * The contract rows one UTC day of a crypto chain holds at each tier, the projection for every crypto chain: measured on
57
+ * 2026-10-20 over the ore gateway's TRADE_AGG minute bars of the venues' option trades (one row per contract per bucket
58
+ * that traded, the rows the print rollups write), the busiest chain at each tier doubled: Bybit BTC at 1m, 5m and 1h
59
+ * (2026-10-16: 28,084, 15,754 and 4,283 rows), Deribit BTC at 1d (at most 756 over 13 days from 2026-09-22; Deribit's
60
+ * busiest 1m day 7,133, OKX BTC 5,678).
61
+ */
62
+ export declare const WRUN_OPTION_CONTRACT_FLOW_CRYPTO_DAY_ROWS: Readonly<Record<string, number>>;
55
63
  /** The regular-session print minutes inside `[fromMs, toMs)`: each weekday's 09:30 to 16:15 New York (a holiday
56
64
  * counts as a session, so the projection only errs high). */
57
65
  export declare function wrunOptionPrintSessionMinutes(fromMs: number, toMs: number): number;
58
- /** The rows one host bar is projected to read at its tier, up to the clock (the lane's row budget): the session's
59
- * rows at that tier in proportion to the print minutes the bar covers. No tier: none. */
66
+ /** The CME Globex print minutes inside `[fromMs, toMs)`: Sunday 17:00 Chicago to Friday 16:00, less the daily 16:00
67
+ * to 17:00 halt (a holiday counts as a trade day, so the projection only errs high). */
68
+ export declare function wrunOptionGlobexPrintMinutes(fromMs: number, toMs: number): number;
69
+ /**
70
+ * The rows one host bar is projected to read at its tier, up to the clock (the lane's row budget), on the plane of the
71
+ * instance's chain (`acquisition`, its payload: the exchange it names, which the host hands every projection): the
72
+ * plane's rows per trade day at that tier in proportion to the print minutes the bar covers on the plane's calendar.
73
+ * No tier: none.
74
+ */
60
75
  export declare function wrunOptionContractFlowBarRows(bar: {
61
76
  openMs: number;
62
77
  endMs: number;
63
78
  tier?: WrunBackendTier;
64
- }, nowMs: number): number;
79
+ }, nowMs: number, acquisition: Readonly<Record<string, unknown>>): number;
65
80
  /** One bucket's sums for one contract, as the worker hands them to the fold. */
66
81
  export declare const WRUN_OPTION_CONTRACT_FLOW_RAW: Readonly<{
67
82
  readonly root: 0;
@@ -89,9 +104,34 @@ export declare const WRUN_OPTION_CONTRACT_FLOW_RAW: Readonly<{
89
104
  readonly sizePriced: 20;
90
105
  }>;
91
106
  export declare const WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH = 21;
107
+ /** The most contract rows one read may hold: the source answer CEILING (kscript-source-answer-budget.leaf) in raw
108
+ * tuples, about 99,900. The worker twin fails a window past it loudly, never truncated; the lane's row budget plans
109
+ * its asks to half of it (the budget), so only a session busier than twice its projection reaches it. */
110
+ export declare const WRUN_OPTION_CONTRACT_FLOW_MAX_ROWS: number;
111
+ /**
112
+ * A bucket's raw tuples packed as the worker hands them over: one Float64Array of `count x RAW_WIDTH` values, the
113
+ * tuples back to back. The page receives the block by transfer (no structured clone walks it), the row cache copies
114
+ * and weighs it by its bytes, and the fold reads it in place; a raw tuple as a plain array (a spec's, a JSON shape)
115
+ * reads the same.
116
+ */
117
+ export declare function packWrunOptionContractFlowRaws(raws: ReadonlyArray<ReadonlyArray<number>>): Float64Array;
118
+ /**
119
+ * The payload fields an instance names its chain in (the lane's acquisition, and the K control's request to the worker
120
+ * twin under the same names): the exchange the chain lists on (its plane follows it), the ONE book when it is not the
121
+ * underlying's own series, and the continuous alias a CME chain was read off (its lead contract is `coin`).
122
+ */
123
+ export declare const WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD = "flowExchange";
124
+ export declare const WRUN_OPTION_CONTRACT_FLOW_BOOK_FIELD = "flowBook";
125
+ export declare const WRUN_OPTION_CONTRACT_FLOW_CONTINUOUS_FIELD = "flowContinuous";
92
126
  /** The acquisition an `option_contract_flow` instance asks with. */
93
127
  export interface WrunOptionContractFlowAcquisition {
128
+ /** The chain's underlying, upper case: the key its plane files the rows under (the OPRA ticker, a crypto venue's
129
+ * root coin, the CME futures contract). */
94
130
  coin: string;
131
+ /** The exchange the chain lists on, upper case ('' when the payload names none: no read is served then). */
132
+ exchange: string;
133
+ /** The ONE book read, upper case: the payload's book, else the underlying's own series. */
134
+ book: string;
95
135
  /** "nearest:N" or "0dte"; absent is "all". */
96
136
  expiries?: string;
97
137
  strikeWindowPct?: number;
@@ -101,8 +141,9 @@ export interface WrunOptionContractFlowAcquisition {
101
141
  }
102
142
  /** An instance's payload as its acquisition (knob fields that are not valid read absent). */
103
143
  export declare function wrunOptionContractFlowAcquisitionOf(extras: Readonly<Record<string, unknown>> | null | undefined): WrunOptionContractFlowAcquisition;
104
- /** Whether a payload is an `option_contract_flow` lane ask the K control serves: it names the OPRA plane, a coin and
105
- * one of the contract tiers (any other caller is declined, fail closed). */
144
+ /** Whether a payload is an `option_contract_flow` lane ask the K control serves: a coin, one of the contract tiers
145
+ * and a chain whose OPRA stamp holds (the print classes' one rule, wrun-option-prints.util
146
+ * `wrunOptionChainAskStampHolds`); any other caller is declined, fail closed. */
106
147
  export declare function isWrunOptionContractFlowAsk(payload: Readonly<Record<string, unknown>> | null | undefined): boolean;
107
148
  /** The tier a key names (one of the contract tiers), or undefined. */
108
149
  export declare function wrunOptionPrintAggTierOf(key: unknown): WrunBackendTier | undefined;
@@ -119,14 +160,22 @@ export interface WrunOptionContractFlowRow {
119
160
  }
120
161
  /**
121
162
  * One OPTION_PRINT_AGG CONTRACT row as a raw tuple (the history shape: a reshaped protobuf-es message, int64 as
122
- * bigint, unset optionals undefined; a JSON shape reads the same). `series` names the contract (its OSI symbol, the
123
- * option type). A scope row, a row missing its time or contract, or one whose root the codec refuses is dropped and
124
- * counted.
163
+ * bigint, unset optionals undefined; a JSON shape reads the same). `series` names the contract (its exchange, by name
164
+ * or pb-common id, its raw symbol, parsed by the venue of the exchange, and the option type). A scope row, a row missing its time or contract
165
+ * (a series naming no exchange, or a symbol its venue does not spell), or one whose root the codec refuses is dropped
166
+ * and counted.
125
167
  */
126
168
  export declare function wrunOptionContractFlowRowOf(point: Readonly<Record<string, unknown>> | null | undefined, series: Readonly<Record<string, unknown>> | null | undefined): WrunOptionContractFlowRow | WrunOptionContractFlowDrop;
127
- /** Whether a contract row is a "0dte" row: its expiry falls on the trade date of its bucket (the New York date at
128
- * the bucket's middle, so a UTC day bucket reads its own session's date). */
129
- export declare function wrunOptionContractFlowRowIsZeroDte(row: WrunOptionContractFlowRow, tierMs: number): boolean;
169
+ /**
170
+ * Whether a contract row is a "0dte" row: its expiry falls on the trade date of its bucket, on the clock of the chain's
171
+ * market (`tradeDay`, the trade date an instant falls on in days: the worker hands the chain summary's one rule,
172
+ * option-contract-state.worker.util `optionChainTradeDay` over the chain's exchange: OPRA's New York date, a CME Group
173
+ * exchange's Globex session date, a crypto venue's UTC date), read at the bucket's middle so a UTC day bucket reads its
174
+ * own session's date.
175
+ */
176
+ export declare function wrunOptionContractFlowRowIsZeroDte(row: WrunOptionContractFlowRow, tierMs: number, tradeDay: (instantMs: number) => number): boolean;
177
+ /** The raw tuples a bucket row holds (a packed block counts each of its tuples). */
178
+ export declare function wrunOptionContractFlowRawCount(row: ReadonlyArray<unknown>): number;
130
179
  /**
131
180
  * One host bar's contract tuples from its buckets' raw rows (in bucket order), under the acquisition's knobs:
132
181
  * - every contract's sums over the bar, its last price from its newest bucket and its IV from its newest bucket that