@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.
Files changed (145) hide show
  1. package/README.md +2 -1
  2. package/dist/constants/feature-flags.constants.d.ts +4 -0
  3. package/dist/constants/feature-flags.constants.js +27 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/host-env.d.ts +10 -4
  11. package/dist/host-ports.types.d.ts +39 -3
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  15. package/dist/interfaces/opra-realtime.interface.js +10 -10
  16. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  17. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
  18. package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
  19. package/dist/market-data/billing.interface.d.ts +138 -17
  20. package/dist/market-data/billing.interface.js +25 -8
  21. package/dist/market-data/venues/index.d.ts +3 -3
  22. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  23. package/dist/market-data/venues/opra.d.ts +3 -3
  24. package/dist/market-data/venues/opra.js +5 -4
  25. package/dist/replay/replayLadder.js +3 -1
  26. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  27. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  28. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  29. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  30. package/dist/utility/chart/index-mode.util.js +23 -13
  31. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  32. package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
  33. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  34. package/dist/utility/chart/marketKind.util.js +17 -7
  35. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  36. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  37. package/dist/utility/chart/om-panel.util.js +6 -6
  38. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  39. package/dist/utility/chart/profile-block-size.util.js +7 -0
  40. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  41. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  42. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  43. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  44. package/dist/utility/common/transformations.util.d.ts +7 -0
  45. package/dist/utility/common/transformations.util.js +11 -0
  46. package/dist/utility/options/option-venue.util.d.ts +3 -3
  47. package/dist/utility/options/option-venue.util.js +3 -3
  48. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  49. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  50. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  51. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  52. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  53. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  54. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  55. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
  56. package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
  57. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
  58. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
  59. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  60. package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
  61. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
  62. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
  63. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
  64. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
  65. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  66. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
  67. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
  68. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  69. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  70. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  71. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  72. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  73. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  74. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  75. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  76. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  77. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  78. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  79. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  80. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  81. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  82. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  83. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  84. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  85. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  86. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  87. package/dist/utility/wrun/wrun-frames.js +5 -5
  88. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  89. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  90. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  91. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  92. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  93. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  94. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  95. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  96. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  97. package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
  98. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  99. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  100. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
  101. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
  102. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  103. package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
  104. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  105. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  106. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
  107. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
  108. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
  109. package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
  110. package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
  111. package/dist/utility/wrun/wrun-option-views.util.js +151 -28
  112. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  113. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  114. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  115. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  116. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  117. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  118. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  119. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  120. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  121. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  122. package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
  123. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  124. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  125. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  126. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  127. package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
  128. package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
  129. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  130. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  131. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  132. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  133. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  134. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  135. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
  136. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  137. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  138. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  139. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  140. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  141. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  142. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  143. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  144. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  145. package/package.json +11 -11
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The batched records' readout (WRUN-BATCHED-MARKS): a `marks`, `spans` or `rays` record's meta
3
- * decode, the number formats a template (and a marks caption) prints with, and the tooltip text.
3
+ * decode, the number formats a template (and a marks caption) prints with (THE one list,
4
+ * WRUN_BATCHED_NUMBER_FORMATS), and the tooltip text.
4
5
  * The batched mount registers the text as its readout's `text` (wrun-batched-marks.util
5
6
  * `wrunBatchedChildConfig`), so the boot-path hover inspector prints a record through the thin
6
7
  * registry (wrun-canvas-readout.util) and never loads this module itself. A timed spans or rays
@@ -51,22 +52,49 @@ export declare const WRUN_BATCHED_TIMED_TOOLTIP_TOKENS: Readonly<{
51
52
  * at the start).
52
53
  */
53
54
  export declare function wrunTimedRecordSpan(record: Pick<WrunBatchedHoverRecord, 'ts' | 'fields'>): [number, number];
54
- /** The number formats a batched template (and a marks caption) prints with. */
55
- export type WrunBatchedNumberFormat = 'compact' | 'price' | 'int';
55
+ /**
56
+ * THE number formats a batched template and a marks caption print with, the kit's WRUN_MARK_TEXT_FORMATS (its
57
+ * WRUN_BATCHED_TOOLTIP_FORMATS): `compact` (Big Trades 0.3.2's caption, "1.2M", "1.2K"), `price` (the pane's price),
58
+ * `int` (rounded), `usd` ("$" before the compact amount, "$12M", "-$1.2K") and `units` (a mark's quantity in the
59
+ * market's own unit, `wrunMarkQtyInUnits`, printed compact; in dollars where no unit is proven). The layout gate's
60
+ * vocabulary, the engine settings and this readout read this list, and the format type derives from it: a word added
61
+ * in one hand copy alone refused the section ("Needs a newer chart") or printed the placeholder as written
62
+ * (tests/utility/wrun/wrun-batched-readout.util.spec.ts holds it to its golden and finds any second spelling of it in
63
+ * the package). TitanCharts keeps the engine's own copy for the caption, pinned to the same golden there.
64
+ */
65
+ export declare const WRUN_BATCHED_NUMBER_FORMATS: readonly ["compact", "price", "int", "usd", "units"];
66
+ /** A number format of the one list. */
67
+ export type WrunBatchedNumberFormat = (typeof WRUN_BATCHED_NUMBER_FORMATS)[number];
68
+ /** Whether a word is a number format of the one list. */
69
+ export declare function isWrunBatchedNumberFormat(word: unknown): word is WrunBatchedNumberFormat;
70
+ /** A market's dollar unit as the host hands it (`valuePerUnit`: the US dollars one price unit times one size unit is
71
+ * worth) when it is one, finite and above zero; undefined for anything else (no unit is proven). */
72
+ export declare function wrunMarkUnitValue(value: unknown): number | undefined;
73
+ /**
74
+ * A mark's quantity in the market's own unit (the `units` format): `qty`, its US dollar value, over the record's own
75
+ * price times the market's dollar unit. 25 NQ contracts at 24,000 at $20 a point ($12M) read 25, $12M of BTC at
76
+ * 100,000 reads 120. Exact for a combined trade too: the record's price is the trade's dollar VWAP, so the quotient is
77
+ * the sum of its fills' own units. Undefined where no dollar unit is proven or the price is no price above zero: the
78
+ * caller prints dollars (`usd`) then, never a wrong number.
79
+ */
80
+ export declare function wrunMarkQtyInUnits(qty: number, price: number, valuePerUnit: number | undefined): number | undefined;
56
81
  /** A number in a batched format: `compact` is Big Trades 0.3.2's caption ("1.2M", "1.2K", a whole
57
- * number from 100, one decimal from 1, two below 1), `int` the rounded whole number, `price` the
58
- * pane's price; a negative value keeps its sign. Not finite: '-'. */
82
+ * number from 100, one decimal from 1, two below 1), `usd` the same after a "$" ("$12M", "-$1.2K"),
83
+ * `units` compact (a mark's quantity reaches it converted, `wrunMarkQtyInUnits`), `int` the rounded
84
+ * whole number, `price` the pane's price; a negative value keeps its sign. Not finite: '-'. */
59
85
  export declare function formatWrunBatchedNumber(value: number, format: WrunBatchedNumberFormat | 'amount', formatPrice: (value: number) => string): string;
60
86
  /**
61
- * A batched record's tooltip (WRUN-BATCHED-MARKS): `{{name}}` or `{{name:<compact|price|int>}}`.
62
- * Marks read `{{side}}`, `{{qty}}` (default the full amount), `{{price}}` (default price) and
63
- * `{{fills}}` (default int); spans `{{top}}` and `{{bottom}}`, rays `{{y1}}` and `{{y2}}` (default
87
+ * A batched record's tooltip (WRUN-BATCHED-MARKS): `{{name}}` or `{{name:<format>}}`, a word of
88
+ * WRUN_BATCHED_NUMBER_FORMATS. Marks read `{{side}}`, `{{qty}}` (default the full amount; `{{qty:units}}`
89
+ * the quantity in the market's own unit over the record's price and the readout's `valuePerUnit`, in
90
+ * dollars where none is proven), `{{price}}` (default price) and `{{fills}}` (default int); spans
91
+ * `{{top}}` and `{{bottom}}`, rays `{{y1}}` and `{{y2}}` (default
64
92
  * price), both `{{length}}` (the length in bars, default int) and `{{word}}` (the section's word the meta
65
93
  * names, '' when none); a timed record (stride 5) `{{start}}` and `{{end}}` in place of `{{length}}`,
66
94
  * each the time as the chart prints it (`formatters.formatTime`, else wrun-chart-time.util shifted by
67
95
  * the display offset the mount door stamped on the readout), its meta its fifth field; `{{label}}` is
68
96
  * the readout's title. A placeholder
69
- * the record does not read, or a format word outside the three, stays as written; a hole (a
97
+ * the record does not read, or a format word outside the list, stays as written; a hole (a
70
98
  * non-finite field) prints '-'.
71
99
  */
72
100
  export declare function wrunBatchedReadoutText(readout: WrunCanvasReadout, record: WrunBatchedHoverRecord, formatters: {
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The batched records' readout (WRUN-BATCHED-MARKS): a `marks`, `spans` or `rays` record's meta
3
- * decode, the number formats a template (and a marks caption) prints with, and the tooltip text.
3
+ * decode, the number formats a template (and a marks caption) prints with (THE one list,
4
+ * WRUN_BATCHED_NUMBER_FORMATS), and the tooltip text.
4
5
  * The batched mount registers the text as its readout's `text` (wrun-batched-marks.util
5
6
  * `wrunBatchedChildConfig`), so the boot-path hover inspector prints a record through the thin
6
7
  * registry (wrun-canvas-readout.util) and never loads this module itself. A timed spans or rays
@@ -58,7 +59,40 @@ export function wrunTimedRecordSpan(record) {
58
59
  const end = at(TIMED_END);
59
60
  return [start, Number.isFinite(end) && end > start ? end : start];
60
61
  }
61
- const BATCHED_FORMATS = new Set(['compact', 'price', 'int']);
62
+ /**
63
+ * THE number formats a batched template and a marks caption print with, the kit's WRUN_MARK_TEXT_FORMATS (its
64
+ * WRUN_BATCHED_TOOLTIP_FORMATS): `compact` (Big Trades 0.3.2's caption, "1.2M", "1.2K"), `price` (the pane's price),
65
+ * `int` (rounded), `usd` ("$" before the compact amount, "$12M", "-$1.2K") and `units` (a mark's quantity in the
66
+ * market's own unit, `wrunMarkQtyInUnits`, printed compact; in dollars where no unit is proven). The layout gate's
67
+ * vocabulary, the engine settings and this readout read this list, and the format type derives from it: a word added
68
+ * in one hand copy alone refused the section ("Needs a newer chart") or printed the placeholder as written
69
+ * (tests/utility/wrun/wrun-batched-readout.util.spec.ts holds it to its golden and finds any second spelling of it in
70
+ * the package). TitanCharts keeps the engine's own copy for the caption, pinned to the same golden there.
71
+ */
72
+ export const WRUN_BATCHED_NUMBER_FORMATS = Object.freeze(['compact', 'price', 'int', 'usd', 'units']);
73
+ const BATCHED_FORMATS = new Set(WRUN_BATCHED_NUMBER_FORMATS);
74
+ /** Whether a word is a number format of the one list. */
75
+ export function isWrunBatchedNumberFormat(word) {
76
+ return typeof word === 'string' && BATCHED_FORMATS.has(word);
77
+ }
78
+ /** A market's dollar unit as the host hands it (`valuePerUnit`: the US dollars one price unit times one size unit is
79
+ * worth) when it is one, finite and above zero; undefined for anything else (no unit is proven). */
80
+ export function wrunMarkUnitValue(value) {
81
+ return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : undefined;
82
+ }
83
+ /**
84
+ * A mark's quantity in the market's own unit (the `units` format): `qty`, its US dollar value, over the record's own
85
+ * price times the market's dollar unit. 25 NQ contracts at 24,000 at $20 a point ($12M) read 25, $12M of BTC at
86
+ * 100,000 reads 120. Exact for a combined trade too: the record's price is the trade's dollar VWAP, so the quotient is
87
+ * the sum of its fills' own units. Undefined where no dollar unit is proven or the price is no price above zero: the
88
+ * caller prints dollars (`usd`) then, never a wrong number.
89
+ */
90
+ export function wrunMarkQtyInUnits(qty, price, valuePerUnit) {
91
+ const unit = wrunMarkUnitValue(valuePerUnit);
92
+ if (unit === undefined || !(Number.isFinite(price) && price > 0))
93
+ return undefined;
94
+ return qty / (price * unit);
95
+ }
62
96
  /** `tenths` (a whole count of tenths) as "1.5" or "2" (never "2.0"). */
63
97
  function tenthsText(tenths) {
64
98
  const whole = Math.trunc(tenths / 10);
@@ -74,9 +108,18 @@ function amountText(value) {
74
108
  return tenthsText(Math.round(value * 10));
75
109
  return (Math.round(value * 100) / 100).toFixed(2);
76
110
  }
111
+ /** A size, at least 0, compact: "1.2M", "1.2K", else the full amount. */
112
+ function compactText(size) {
113
+ if (size >= 1_000_000)
114
+ return `${tenthsText(Math.round(size / 100_000))}M`;
115
+ if (size >= 1_000)
116
+ return `${tenthsText(Math.round(size / 100))}K`;
117
+ return amountText(size);
118
+ }
77
119
  /** A number in a batched format: `compact` is Big Trades 0.3.2's caption ("1.2M", "1.2K", a whole
78
- * number from 100, one decimal from 1, two below 1), `int` the rounded whole number, `price` the
79
- * pane's price; a negative value keeps its sign. Not finite: '-'. */
120
+ * number from 100, one decimal from 1, two below 1), `usd` the same after a "$" ("$12M", "-$1.2K"),
121
+ * `units` compact (a mark's quantity reaches it converted, `wrunMarkQtyInUnits`), `int` the rounded
122
+ * whole number, `price` the pane's price; a negative value keeps its sign. Not finite: '-'. */
80
123
  export function formatWrunBatchedNumber(value, format, formatPrice) {
81
124
  if (!Number.isFinite(value))
82
125
  return '-';
@@ -88,26 +131,24 @@ export function formatWrunBatchedNumber(value, format, formatPrice) {
88
131
  const size = Math.abs(value);
89
132
  if (format === 'amount')
90
133
  return `${sign}${amountText(size)}`;
91
- if (size >= 1_000_000)
92
- return `${sign}${tenthsText(Math.round(size / 100_000))}M`;
93
- if (size >= 1_000)
94
- return `${sign}${tenthsText(Math.round(size / 100))}K`;
95
- return `${sign}${amountText(size)}`;
134
+ return `${sign}${format === 'usd' ? '$' : ''}${compactText(size)}`;
96
135
  }
97
136
  /** The side words `{{side}}` prints, the template's own register (the author writes the template
98
137
  * around them, as Big Trades 0.3.2's module wrote "Buy" and "Sell"). Sides 2 and 3 print their
99
138
  * number. */
100
139
  const SIDE_WORDS = { 0: 'Sell', 1: 'Buy' };
101
140
  /**
102
- * A batched record's tooltip (WRUN-BATCHED-MARKS): `{{name}}` or `{{name:<compact|price|int>}}`.
103
- * Marks read `{{side}}`, `{{qty}}` (default the full amount), `{{price}}` (default price) and
104
- * `{{fills}}` (default int); spans `{{top}}` and `{{bottom}}`, rays `{{y1}}` and `{{y2}}` (default
141
+ * A batched record's tooltip (WRUN-BATCHED-MARKS): `{{name}}` or `{{name:<format>}}`, a word of
142
+ * WRUN_BATCHED_NUMBER_FORMATS. Marks read `{{side}}`, `{{qty}}` (default the full amount; `{{qty:units}}`
143
+ * the quantity in the market's own unit over the record's price and the readout's `valuePerUnit`, in
144
+ * dollars where none is proven), `{{price}}` (default price) and `{{fills}}` (default int); spans
145
+ * `{{top}}` and `{{bottom}}`, rays `{{y1}}` and `{{y2}}` (default
105
146
  * price), both `{{length}}` (the length in bars, default int) and `{{word}}` (the section's word the meta
106
147
  * names, '' when none); a timed record (stride 5) `{{start}}` and `{{end}}` in place of `{{length}}`,
107
148
  * each the time as the chart prints it (`formatters.formatTime`, else wrun-chart-time.util shifted by
108
149
  * the display offset the mount door stamped on the readout), its meta its fifth field; `{{label}}` is
109
150
  * the readout's title. A placeholder
110
- * the record does not read, or a format word outside the three, stays as written; a hole (a
151
+ * the record does not read, or a format word outside the list, stays as written; a hole (a
111
152
  * non-finite field) prints '-'.
112
153
  */
113
154
  export function wrunBatchedReadoutText(readout, record, formatters) {
@@ -135,8 +176,13 @@ export function wrunBatchedReadoutText(readout, record, formatters) {
135
176
  switch (name) {
136
177
  case 'side':
137
178
  return markMeta === null ? '-' : (SIDE_WORDS[markMeta.side] ?? String(markMeta.side));
138
- case 'qty':
139
- return number(field(1), format, 'amount');
179
+ case 'qty': {
180
+ if (format !== 'units')
181
+ return number(field(1), format, 'amount');
182
+ // The quantity in the market's own unit; dollars where the readout holds no unit or the record no price.
183
+ const units = wrunMarkQtyInUnits(field(1), field(0), readout.valuePerUnit);
184
+ return units === undefined ? number(field(1), 'usd', 'amount') : number(units, 'units', 'amount');
185
+ }
140
186
  case 'price':
141
187
  return number(field(0), format, 'price');
142
188
  case 'fills':
@@ -27,6 +27,10 @@ export interface WrunCanvasReadout {
27
27
  timed?: true;
28
28
  /** The display offset (ms) a timed record's `{{start}}` and `{{end}}` print in, stamped by the mount door. */
29
29
  timeOffsetMs?: number;
30
+ /** Marks: the market's dollar unit (US dollars per price unit and size unit, the run's `wrunMarketDollarUnit`),
31
+ * which `{{qty:units}}` divides a record's dollar value by; stamped by the batched build, absent where none is
32
+ * proven (`units` then prints dollars). */
33
+ valuePerUnit?: number;
30
34
  /** A batched record's tooltip text, registered with the readout by its mount. */
31
35
  text?: (record: WrunBatchedHoverRecord, formatters: {
32
36
  formatPrice: (value: number) => string;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The tuples one bar's block of a celled input may hold in the module a run drives, read off the module's own sheet.
3
+ * Kit scaffold 97 writes `capacity` on every celled input of a sheet it builds: the tuples the build sized the input's
4
+ * buffer and `in_<name>_capacity` by (`max_cells`, or `max_cells + newest` for a print class's union). Every host sizes
5
+ * a block by `capacity ?? max_cells` (om wrun-host `wrunModuleCellCapacity`, `wrunCellBlockTuples`), never by the
6
+ * read's knobs: a module built before scaffold 96 sized a union's buffer at `max_cells`, and a sheet built before
7
+ * scaffold 97 names no capacity, so it reads `max_cells` and a union input keeps the cut before the union (each bar's
8
+ * `max_cells` largest). One rule for every module, however it reached the run: a registry package, a draft the compile
9
+ * lane built, a dev fixture, the phone app's runs.
10
+ *
11
+ * A capacity no build writes refuses the run by name (`wrun_cell_capacity_invalid`, the kit schema's rule): the browser
12
+ * reads registry and fixture sheets without the kit's schema. The packer, the row-lane plan (each input's projection)
13
+ * and the live tape read one answer (`wrunSheetCellBlockTuples`), so they never disagree.
14
+ *
15
+ * LIGHT at module load: a leaf of the packer, the row-lane plan and the live tick, importing types alone.
16
+ */
17
+ import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
18
+ /** om's refusal of a celled input's capacity no build writes (`WRUN_CELL_CAPACITY_INVALID_CODE`, stage validate). */
19
+ export declare const WRUN_CELL_CAPACITY_INVALID_CODE = "wrun_cell_capacity_invalid";
20
+ /**
21
+ * The tuples one bar of a celled input's READ holds (om `wrunOptionInputCapacity`, the rule a build sizes the module's
22
+ * buffer by and writes as the input's `capacity`): its `max_cells`, and for a print class (`option_prints`,
23
+ * `option_prints_v2`) under `overflow: "largest"` beside `newest` N (a whole number, 1 and up) `max_cells + N`: each
24
+ * bar's `max_cells` largest unioned with its prints inside the window's N newest (the lane's projection,
25
+ * sources/row-lanes/option_prints `wrunLargestOrNewestOptionPrints`). Every other input keeps `max_cells`. Never a
26
+ * module's block bound: `wrunCellBlockTuples` reads the module's own capacity.
27
+ */
28
+ export declare function wrunCellReadCapacity(source: Readonly<Record<string, unknown>> | undefined, maxCells: number): number;
29
+ /** A celled input's two caps as its sheet declares them (om `WrunCellCapacityInput`): `max_cells`, and `capacity`, the
30
+ * tuples the module's own build sized its buffer by (scaffold 97, absent on every older sheet). */
31
+ export interface WrunCellCapacityInput {
32
+ readonly max_cells?: number | undefined;
33
+ readonly capacity?: number | undefined;
34
+ }
35
+ /** The tuples the module's buffer holds for a celled input (om `wrunModuleCellCapacity`): the sheet's `capacity`, which
36
+ * its build wrote beside `max_cells`, else `max_cells`, the buffer every build gives an input. */
37
+ export declare function wrunModuleCellCapacity(input: WrunCellCapacityInput): number;
38
+ /**
39
+ * The tuples one bar's block may hold on its way into the module (om `wrunCellBlockTuples`, the rule of every host
40
+ * that hands a module a block): its capacity (`wrunModuleCellCapacity`), except a print class's union the capacity does
41
+ * not hold whole (below `max_cells + newest`), whose bar keeps its `max_cells` largest, the cut before the union.
42
+ */
43
+ export declare function wrunCellBlockTuples(input: WrunCellCapacityInput, source: Readonly<Record<string, unknown>> | undefined): number;
44
+ /**
45
+ * The refusal of a celled input's declared `capacity` (om `wrunCellCapacityIssue`, the sheet schema's rule, in its
46
+ * words), or undefined when it stands or is absent: one on a scalar input, one that is no positive whole number (the
47
+ * schema's type check), one below `max_cells` (every build gives the buffer at least that) and one above what the
48
+ * input's read can hold a bar (`wrunCellReadCapacity`). A celled input without `max_cells` refuses on its own rule.
49
+ */
50
+ export declare function wrunCellCapacityIssue(input: {
51
+ readonly name: string;
52
+ readonly cellType?: string;
53
+ readonly max_cells?: number;
54
+ readonly capacity?: unknown;
55
+ }, source: Readonly<Record<string, unknown>> | undefined): string | undefined;
56
+ /**
57
+ * The tuples one bar's block of a sheet's celled input may hold in the module the sheet pins (`wrunCellBlockTuples`
58
+ * over its `capacity ?? max_cells`): the one bound the packer refuses past, the row-lane plan hands each input's
59
+ * projection and the live tape holds a forming bar to. A capacity no build writes refuses the run by name first
60
+ * (`wrunCellCapacityIssue`), before any block is sized by it.
61
+ */
62
+ export declare function wrunSheetCellBlockTuples(metadata: Pick<WrunIndicatorMetadata, 'id' | 'inputSources'>, input: WrunIndicatorMetadata['inputs'][number]): number;
63
+ /** The bound a block refusal names (`wrun_cell_block_too_large`): `max_cells is N`, or for a module whose capacity holds
64
+ * a print union past `max_cells`, `its capacity is N (max_cells M and newest K)`. The refusal record reads N either
65
+ * way (wrun-refusal.util), the most this Indicator was built for. */
66
+ export declare function wrunCellBoundWords(maxCells: number | undefined, tuples: number): string;
@@ -0,0 +1,86 @@
1
+ /** The print classes, whose `overflow: "largest"` beside `newest` reads the union (om `isWrunOptionPrintClass`). */
2
+ const WRUN_PRINT_CLASSES = new Set(['option_prints', 'option_prints_v2']);
3
+ /** om's refusal of a celled input's capacity no build writes (`WRUN_CELL_CAPACITY_INVALID_CODE`, stage validate). */
4
+ export const WRUN_CELL_CAPACITY_INVALID_CODE = 'wrun_cell_capacity_invalid';
5
+ /**
6
+ * The tuples one bar of a celled input's READ holds (om `wrunOptionInputCapacity`, the rule a build sizes the module's
7
+ * buffer by and writes as the input's `capacity`): its `max_cells`, and for a print class (`option_prints`,
8
+ * `option_prints_v2`) under `overflow: "largest"` beside `newest` N (a whole number, 1 and up) `max_cells + N`: each
9
+ * bar's `max_cells` largest unioned with its prints inside the window's N newest (the lane's projection,
10
+ * sources/row-lanes/option_prints `wrunLargestOrNewestOptionPrints`). Every other input keeps `max_cells`. Never a
11
+ * module's block bound: `wrunCellBlockTuples` reads the module's own capacity.
12
+ */
13
+ export function wrunCellReadCapacity(source, maxCells) {
14
+ if (source === undefined || !WRUN_PRINT_CLASSES.has(String(source.source)))
15
+ return maxCells;
16
+ const newest = source.newest;
17
+ return source.overflow === 'largest' && typeof newest === 'number' && Number.isInteger(newest) && newest >= 1
18
+ ? maxCells + newest
19
+ : maxCells;
20
+ }
21
+ /** The tuples the module's buffer holds for a celled input (om `wrunModuleCellCapacity`): the sheet's `capacity`, which
22
+ * its build wrote beside `max_cells`, else `max_cells`, the buffer every build gives an input. */
23
+ export function wrunModuleCellCapacity(input) {
24
+ return input.capacity ?? input.max_cells ?? Number.POSITIVE_INFINITY;
25
+ }
26
+ /**
27
+ * The tuples one bar's block may hold on its way into the module (om `wrunCellBlockTuples`, the rule of every host
28
+ * that hands a module a block): its capacity (`wrunModuleCellCapacity`), except a print class's union the capacity does
29
+ * not hold whole (below `max_cells + newest`), whose bar keeps its `max_cells` largest, the cut before the union.
30
+ */
31
+ export function wrunCellBlockTuples(input, source) {
32
+ const capacity = wrunModuleCellCapacity(input);
33
+ const maxCells = input.max_cells ?? Number.POSITIVE_INFINITY;
34
+ return capacity >= wrunCellReadCapacity(source, maxCells) ? capacity : Math.min(capacity, maxCells);
35
+ }
36
+ /**
37
+ * The refusal of a celled input's declared `capacity` (om `wrunCellCapacityIssue`, the sheet schema's rule, in its
38
+ * words), or undefined when it stands or is absent: one on a scalar input, one that is no positive whole number (the
39
+ * schema's type check), one below `max_cells` (every build gives the buffer at least that) and one above what the
40
+ * input's read can hold a bar (`wrunCellReadCapacity`). A celled input without `max_cells` refuses on its own rule.
41
+ */
42
+ export function wrunCellCapacityIssue(input, source) {
43
+ const capacity = input.capacity;
44
+ if (capacity === undefined)
45
+ return undefined;
46
+ const declared = typeof capacity === 'number' ? String(capacity) : JSON.stringify(capacity);
47
+ const who = `${WRUN_CELL_CAPACITY_INVALID_CODE}: input '${input.name}' declares capacity ${declared}`;
48
+ if (input.cellType !== 'array') {
49
+ return `${who} without cellType "array"; capacity is the tuples a celled input's buffer holds, which a scalar input has none of`;
50
+ }
51
+ if (typeof capacity !== 'number' || !Number.isInteger(capacity) || capacity < 1) {
52
+ return `${who}, no positive whole number of tuples; the build writes capacity itself, so delete it and rebuild`;
53
+ }
54
+ const maxCells = input.max_cells;
55
+ if (maxCells === undefined)
56
+ return undefined;
57
+ if (capacity < maxCells) {
58
+ return `${who} below its max_cells ${maxCells}; every build gives the input's buffer at least max_cells tuples and writes capacity itself, so delete it and rebuild`;
59
+ }
60
+ const most = wrunCellReadCapacity(source, maxCells);
61
+ if (capacity > most) {
62
+ return `${who} above the ${most} tuples its read can hold a bar (${most === maxCells ? 'max_cells' : "max_cells + newest, a print class's union"}); the build writes capacity itself, so delete it and rebuild`;
63
+ }
64
+ return undefined;
65
+ }
66
+ /**
67
+ * The tuples one bar's block of a sheet's celled input may hold in the module the sheet pins (`wrunCellBlockTuples`
68
+ * over its `capacity ?? max_cells`): the one bound the packer refuses past, the row-lane plan hands each input's
69
+ * projection and the live tape holds a forming bar to. A capacity no build writes refuses the run by name first
70
+ * (`wrunCellCapacityIssue`), before any block is sized by it.
71
+ */
72
+ export function wrunSheetCellBlockTuples(metadata, input) {
73
+ const source = metadata.inputSources[input.name];
74
+ const issue = wrunCellCapacityIssue(input, source);
75
+ if (issue !== undefined)
76
+ throw new Error(`WRUN ${metadata.id}: ${issue}`);
77
+ return wrunCellBlockTuples(input, source);
78
+ }
79
+ /** The bound a block refusal names (`wrun_cell_block_too_large`): `max_cells is N`, or for a module whose capacity holds
80
+ * a print union past `max_cells`, `its capacity is N (max_cells M and newest K)`. The refusal record reads N either
81
+ * way (wrun-refusal.util), the most this Indicator was built for. */
82
+ export function wrunCellBoundWords(maxCells, tuples) {
83
+ return maxCells === undefined || maxCells === tuples
84
+ ? `max_cells is ${tuples}`
85
+ : `its capacity is ${tuples} (max_cells ${maxCells} and newest ${tuples - maxCells})`;
86
+ }
@@ -47,7 +47,10 @@
47
47
  * om WRUN_OPTION_FACT_FILLS, which only the chart's browser lane fills): the US
48
48
  * dollars one price unit times one size unit of an option on the chart's options
49
49
  * chain is worth, 100 on OPRA, the CME root's point value, 1 on a crypto chart,
50
- * else 0 (wrunChartOptionMultiplier).
50
+ * else 0 (wrunChartOptionMultiplier); and `market.dollar_multiplier()` (kit 0.95.0):
51
+ * the US dollars one size unit of the market's own trades at one price unit is
52
+ * worth, the market's proven dollar unit (wrunMarketDollarUnit: the CME
53
+ * registry's point value, NQ 20; 1 on a market quoted in dollars), else 0.
51
54
  *
52
55
  * The 0 rule: a fact the chart does not know is 0, never a guess. Main thread
53
56
  * only (the directory read goes through the markets service); the hosted lanes
@@ -74,12 +77,19 @@ export interface WrunOptionFacts {
74
77
  /** The US dollars one price unit times one size unit of an option on the chart's options chain is worth (0 none). */
75
78
  optionMultiplier: number;
76
79
  }
80
+ /** The trade value fact the host fill carries beside the five (kit 0.95.0, `market.dollar_multiplier()`). */
81
+ export interface WrunDollarFacts {
82
+ /** The US dollars one size unit of the market's own trades at one price unit is worth (0 while not proven). */
83
+ dollarMultiplier: number;
84
+ }
77
85
  /** The chart market the facts are of: the chart metadata's own fields. */
78
86
  export interface WrunFactsMarket {
79
87
  exchange?: unknown;
80
88
  symbol?: unknown;
81
89
  normalizedSymbol?: unknown;
82
90
  category?: unknown;
91
+ /** A continuous CME chart's lead contract as the chart stamped it (`ESZ6` under `ES1!`), when it did. */
92
+ resolvedContract?: unknown;
83
93
  }
84
94
  /** The directory row fields the facts read, duck-typed like om's (the wire
85
95
  * carries `assetClass` and `quoteAssetId` beside the declared type). */
@@ -106,6 +116,11 @@ export declare const CME_ROOT_SPECS: Readonly<Record<string, Readonly<CmeRootSpe
106
116
  * knowledge where om's answer is unknown. Pure.
107
117
  */
108
118
  export declare function wrunChartMarketFacts(market: WrunFactsMarket | undefined, row?: WrunMarketDirectoryRow): WrunMarketFacts;
119
+ /** The host_fill word of `market.dollar_multiplier()` (kit 0.95.0). */
120
+ export declare const WRUN_DOLLAR_MULTIPLIER_FILL = "dollar_multiplier";
121
+ /** A sheet reading `market.dollar_multiplier()` on a market whose dollar unit is not proven (wrunMarketDollarUnit):
122
+ * the run head's refusal by name, before any fetch (no trade could be valued). */
123
+ export declare const WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE = "wrun_dollar_multiplier_unproven";
109
124
  /**
110
125
  * `market.option_multiplier()` of the chart market `market` (kit 0.87.0): the US dollars one price unit times one
111
126
  * size unit of an option on the chart's options chain is worth, so a package's premium is size x price x the fact.
@@ -132,11 +147,18 @@ export declare function wrunChartMarketFacts(market: WrunFactsMarket | undefined
132
147
  */
133
148
  export declare function wrunChartOptionMultiplier(market: WrunFactsMarket | undefined): number;
134
149
  /** True when the sheet declares one of the market's facts (a host-filled
135
- * param on `kind`, `point_value`, `zone`, `quote_is_usd`, `session_open` or
136
- * `option_multiplier`): the runs whose host fill carries the market's facts.
137
- * Only a sheet that declares a directory fact waits for the read
138
- * (wrunMarketFactsNeedDirectory). */
150
+ * param on `kind`, `point_value`, `zone`, `quote_is_usd`, `session_open`,
151
+ * `option_multiplier` or `dollar_multiplier`): the runs whose host fill
152
+ * carries the market's facts. Only a sheet that declares a directory fact
153
+ * waits for the read (wrunMarketFactsNeedDirectory). */
139
154
  export declare function wrunReadsMarketFacts(metadata: Pick<WrunIndicatorMetadata, 'params'> | undefined): boolean;
155
+ /** True when the sheet reads the market's dollar multiplier (a host-filled param on `dollar_multiplier`, kit
156
+ * 0.95.0): its run proves the market's dollar unit at its head before any fetch (wrun-overlay-run.util), so its
157
+ * module, its batched captions and its dollar tape read one number. */
158
+ export declare function wrunReadsDollarMultiplier(metadata: Pick<WrunIndicatorMetadata, 'params'> | undefined): boolean;
159
+ /** wrunReadsDollarMultiplier over an overlay's declared inputs (`settings.scriptInputs`), for a lane that holds no
160
+ * sheet (the cloud payload): a row under the fact's generated name. */
161
+ export declare function wrunDeclaresDollarMultiplier(declarations: unknown): boolean;
140
162
  /** True when the sheet declares a fact the directory row answers (`kind`,
141
163
  * `quote_is_usd`), or a `visible_by` list on a setting or an output, or a
142
164
  * `needed_by` list on an input source (wrunLaneDemandNeedsDirectory), that
@@ -245,9 +267,125 @@ export declare function warmWrunMarketFacts(market: WrunFactsMarket | undefined)
245
267
  * directory answered, failed recently, or is never asked for its venue. */
246
268
  export declare function wrunMarketFactsSettled(market: WrunFactsMarket | undefined): boolean;
247
269
  /** The facts the chart fills for `market` now (synchronous): the five over the
248
- * directory row once warmWrunMarketFacts settled it, else without one, and
249
- * the option multiplier of its options chain (wrunChartOptionMultiplier: the
250
- * venue tables alone, no read). */
251
- export declare function wrunMarketFactsFor(market: WrunFactsMarket | undefined): WrunMarketFacts & WrunOptionFacts;
270
+ * directory row once warmWrunMarketFacts settled it, else without one, the
271
+ * option multiplier of its options chain (wrunChartOptionMultiplier: the
272
+ * venue tables alone, no read) and the dollar multiplier of its own trades
273
+ * (wrunMarketDollarUnit over the reads warmWrunMarketDollarFacts settled; 0
274
+ * while it is not proven). */
275
+ export declare function wrunMarketFactsFor(market: WrunFactsMarket | undefined): WrunMarketFacts & WrunOptionFacts & WrunDollarFacts;
276
+ /**
277
+ * What the instrument registry (StreamRegistryMetadatas, the metadata service's `getSymbolMetadata`) proves about one
278
+ * market's prices on every wire it rides, so the chart prices a print by the server's own facts, never by a table of
279
+ * ours or a venue list:
280
+ *
281
+ * pointValue the US dollars one whole point of price is worth on one contract of a point-valued product: every CME
282
+ * Group future (ES 50, 6A 100,000, ZN 1,000, and per US cent on the cents-quoted grains: ZC 50, ZL
283
+ * 600), the number the large-print writer prices the table's copies with; null elsewhere. A
284
+ * point-valued product's stored amount is contracts and live-feed never multiplies it, so its COIN arm
285
+ * is contracts too.
286
+ * quote the quote asset its normalized symbol names (`BTC-USDT` quotes USDT).
287
+ *
288
+ * Never the record's `contractMultiplier` or `inverse`: a session that reads the catalog over /v3 (the production
289
+ * route, `METHOD.STREAM_REGISTRY_METADATAS` in workers/constants/gateway-routes.ts) gets a crypto row with no unit
290
+ * field at all (workers/v3/v3-instruments.ts `CRYPTO_CATALOG_TO_V2`: the /v3 CryptoInstrument carries none), so their
291
+ * absence proves nothing; measured 2026-10-22 on a logged-in page, where gate.io futures BTC_USDT read no multiplier
292
+ * that a guest's v2 read gives as 0.0001. The CME translation keeps the point value (`cmeRegistryV2`). A stored unit's
293
+ * dollars are the writer's own rows instead (`warmWrunMarketStoredUnit`). A continuous CME chart (`ES1!`) reads its
294
+ * lead contract's record: the continuous record carries the root's raw multiplier and no point value. Recorded in
295
+ * tests/fixtures/wrun/tape-dollar-units.json: every CME Group root the large-print table floors, its registry point
296
+ * value equal to the writer's quote amount per contract and point.
297
+ */
298
+ export interface WrunMarketTradeUnits {
299
+ pointValue: number | null;
300
+ quote: string | undefined;
301
+ }
302
+ /** The trade units of one registry record (a `getSymbolMetadata` answer), null for no record. Pure. */
303
+ export declare function wrunMarketTradeUnitsOf(record: Record<string, unknown> | null | undefined): WrunMarketTradeUnits | null;
304
+ /**
305
+ * Ask the instrument registry for `market`'s trade units: once per market for the session, a definite answer (the
306
+ * record's units, or none) kept; concurrent callers share one read; a failed read, or a continuous chart whose lead is
307
+ * not known yet, is asked again a minute later. A host whose metadata service reads no registry record
308
+ * (`getSymbolMetadata` unbound) settles none. Never rejects. The read is fresh (`{ fresh: true }`, as the option units
309
+ * read is): a cached record can predate the registry's point value fill.
310
+ */
311
+ export declare function warmWrunMarketTradeUnits(market: WrunFactsMarket | undefined): Promise<void>;
312
+ /** The registry's units of `market` once a read settled them: the units, null for no record, undefined while the
313
+ * registry can still answer (not asked yet, in flight, or a failed read that is retried). Synchronous. */
314
+ export declare function wrunMarketTradeUnitsNow(market: WrunFactsMarket | undefined): WrunMarketTradeUnits | null | undefined;
315
+ /** Warm everything a market's dollar unit and stored unit read (C-DOLLAR): the directory row (a crypto market's quote)
316
+ * and the instrument registry's units. Never rejects. */
317
+ export declare function warmWrunMarketDollarFacts(market: WrunFactsMarket | undefined): Promise<void>;
318
+ /** True when a read of `market`'s dollar unit now would wait on nothing (warmWrunMarketDollarFacts): the directory row
319
+ * (wrunMarketFactsSettled) and the registry's units each answered, failed recently, or are never asked. */
320
+ export declare function wrunMarketDollarFactsSettled(market: WrunFactsMarket | undefined): boolean;
321
+ /** What one price unit times one size unit is worth in US dollars on a market (`unit`), or why that cannot be proven:
322
+ * `point-value` (no point value: ICE, PLATTS, an option contract, a CME contract the registry holds none for) or
323
+ * `quote` (the market is quoted in something other than dollars, or its quote is not known), `transient` while a read
324
+ * can still answer it (the directory row, the registry record). */
325
+ export type WrunMarketDollarUnit = {
326
+ kind: 'dollars';
327
+ unit: number;
328
+ } | {
329
+ kind: 'unproven';
330
+ reason: 'point-value' | 'quote';
331
+ transient: boolean;
332
+ };
333
+ /**
334
+ * The US dollars one price unit times one live-feed COIN-arm size unit is worth on `market` (C-DOLLAR's unit value).
335
+ * ONE rule for every market, read off the server's facts and never off a venue list or a table of ours:
336
+ *
337
+ * - A CME Group contract counts contracts on the COIN arm (live-feed never multiplies a point-valued product), so its
338
+ * unit is the instrument registry's point value, in US dollars per point (`warmWrunMarketTradeUnits`: ES 50, 6A
339
+ * 100,000, a cents-quoted grain per cent, ZC 50 and ZL 600), the number the large-print writer prices the table's
340
+ * copies with. An option contract, or a contract the registry holds no point value for, cannot be priced.
341
+ * - Every other market counts its base asset on the COIN arm (live-feed applied each instrument's contract multiplier
342
+ * and its inverse flag), so its unit is the market facts' point value (1, `market.point_value()`; 0 on ICE and
343
+ * PLATTS, whose multipliers no one serves) on a market quoted in dollars (`wrunMarketQuoteInDollars`).
344
+ *
345
+ * A candle's volume times its close times the unit is that candle's dollar volume (the dollar default,
346
+ * wrun-market-size-defaults), and a live print's price times its COIN-arm size times the unit is the print's dollar
347
+ * value (the tape's live fold). A fact that cannot be proven is a named reason, never a guess; `transient` while a read
348
+ * can still answer it. Synchronous: the reads are taken once `warmWrunMarketDollarFacts` settled them.
349
+ */
350
+ export declare function wrunMarketDollarUnit(market: WrunFactsMarket | undefined): WrunMarketDollarUnit;
351
+ /** What one unit of a market's STORED trade amount is worth in US dollars (`perUnit`, at the price of the large print
352
+ * it was read off), or why that cannot be proven: the dollar unit's reasons, `rows` (no large print to read it off:
353
+ * none in the read's windows, or a host that reads no series). */
354
+ export type WrunMarketStoredUnitDollars = {
355
+ kind: 'dollars';
356
+ perUnit: number;
357
+ } | {
358
+ kind: 'unproven';
359
+ reason: 'point-value' | 'quote' | 'rows';
360
+ transient: boolean;
361
+ };
362
+ /**
363
+ * The large-print writer's dollars per STORED unit off a TRADE_LARGE answer (decoded series frames, the TRADES
364
+ * columns): `quoteAmount / amount` of the newest row whose both are finite and above zero, undefined when no row is.
365
+ * The writer prices each copy per instrument (contracts times the contract multiplier times the price on a linear
366
+ * market, the contract's dollar face on an inverse one, contracts times the price times the point value on CME), so the
367
+ * ratio is what one stored unit was worth at that print, on every venue, with no unit of ours. Pure.
368
+ */
369
+ export declare function wrunStoredUnitDollarsOfRows(frames: readonly unknown[]): number | undefined;
370
+ /**
371
+ * Read what one STORED unit of `market` is worth in dollars off the large-print writer's own rows: the market's newest
372
+ * TRADE_LARGE print (`wrunStoredUnitDollarsOfRows`), through the host's series read on the K_TRADES history's own wire
373
+ * (the chart's market, its wire venue as the K_TRADES worker spells it; TRADE_LARGE is a v2-only read, never the /v3
374
+ * catalog, whose crypto rows carry no unit): one row, newest first, over the table's week. Once per market for the
375
+ * session; concurrent callers share one read; a failed read is asked again a minute later. A host whose v2 service
376
+ * reads no series (`sendSeriesOneShot` unbound) settles none. Never rejects. Only a run head with a raw floor to carry
377
+ * asks it (wrun-market-size-defaults.util).
378
+ */
379
+ export declare function warmWrunMarketStoredUnit(market: WrunFactsMarket | undefined): Promise<void>;
380
+ /**
381
+ * The US dollars one unit of `market`'s STORED trade amount is worth (the large-print table's `amount`, the unit a
382
+ * 0.5.0 Big Trades Min size floored by: contracts of 0.0001 BTC on gate.io futures BTC_USDT, of 0.01 BTC on an OKX
383
+ * swap, $100 contracts on Binance delivery BTCUSD_PERP, contracts on CME): the writer's own price of one, read off the
384
+ * market's newest large print (`warmWrunMarketStoredUnit`), on a market whose dollar unit is proven (its quote
385
+ * amounts are dollars). ONE rule for every venue, linear, inverse and CME alike, no venue list and no multiplier of
386
+ * ours; a fact that cannot be proven is a named reason, `transient` while a read can still answer it. Synchronous over
387
+ * `warmWrunMarketDollarFacts` and `warmWrunMarketStoredUnit`.
388
+ */
389
+ export declare function wrunMarketStoredUnitDollars(market: WrunFactsMarket | undefined): WrunMarketStoredUnitDollars;
252
390
  /** Forget every kept answer (spec isolation). */
253
391
  export declare function clearWrunMarketFactsMemo(): void;