@orangecharts/wrun-chart-host 0.8.0 → 0.10.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 +3 -1
- package/dist/constants/feature-flags.constants.d.ts +9 -0
- package/dist/constants/feature-flags.constants.js +86 -16
- 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 +15 -0
- package/dist/constants/opra-compliance.constants.js +15 -0
- package/dist/constants/option-venues.constants.d.ts +11 -6
- package/dist/constants/option-venues.constants.js +5 -2
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +20 -20
- package/dist/constants/venue-presets.constants.js +24 -26
- package/dist/host-env.d.ts +39 -9
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +108 -18
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
- package/dist/interfaces/opra-realtime.interface.js +10 -10
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
- package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
- package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
- package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
- package/dist/market-data/billing.interface.d.ts +227 -42
- package/dist/market-data/billing.interface.js +60 -12
- package/dist/market-data/venue.d.ts +88 -6
- package/dist/market-data/venues/cme.contract.copy.json +66 -0
- package/dist/market-data/venues/cme.d.ts +126 -0
- package/dist/market-data/venues/cme.js +133 -0
- package/dist/market-data/venues/index.d.ts +165 -8
- package/dist/market-data/venues/index.js +48 -6
- 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/settings-templates/index.js +7 -3
- package/dist/settings-templates/indicator-fields.d.ts +5 -4
- package/dist/settings-templates/indicator-fields.js +45 -6
- package/dist/settings-templates/tool-rules.d.ts +27 -17
- package/dist/settings-templates/tool-rules.js +27 -11
- package/dist/settings-templates/tool-tables.generated.js +91 -31
- package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
- package/dist/utility/chart/book-live-bucket.util.js +47 -0
- 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 +24 -3
- 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-drawing-safe-area.util.d.ts +35 -11
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
- package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
- package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
- package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
- package/dist/utility/chart/market-session-schedule.util.js +16 -0
- 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/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- 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/rth-session.util.d.ts +3 -2
- package/dist/utility/chart/rth-session.util.js +2 -1
- package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
- package/dist/utility/chart/window-geometry.leaf.js +22 -6
- package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
- package/dist/utility/chart/wrun-run-result.util.js +145 -7
- package/dist/utility/common/transformations.util.d.ts +7 -0
- package/dist/utility/common/transformations.util.js +11 -0
- package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
- package/dist/utility/options/option-bar-anchor.util.js +340 -0
- package/dist/utility/options/option-venue.util.d.ts +21 -3
- package/dist/utility/options/option-venue.util.js +30 -3
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
- package/dist/utility/wrun/derived-roots.util.js +471 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
- 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/lanes/option_daily.js +5 -2
- package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
- package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
- 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 +15 -6
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
- 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-builtin-twin.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
- 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 +192 -13
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
- 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 +107 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
- package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
- package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
- 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.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +78 -15
- 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-hosted-wire.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
- package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- 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 +19 -9
- package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
- 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 +205 -48
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
- package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
- 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-forecast.util.d.ts +31 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
- package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
- package/dist/utility/wrun/wrun-option-views.util.js +246 -51
- 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-output-style.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-output-style.util.js +20 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -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-lifecycle.util.d.ts +10 -1
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
- 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 +134 -37
- package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
- 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-pane-format.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
- package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
- package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
- package/dist/utility/wrun/wrun-param-map.util.js +13 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
- package/dist/utility/wrun/wrun-param-values.util.js +6 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
- package/dist/utility/wrun/wrun-refusal.util.js +10 -1
- package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
- package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
- package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
- package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
- package/dist/utility/wrun/wrun-style-words.util.js +6 -4
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
- package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
- 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/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- 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 +5 -5
|
@@ -51,13 +51,19 @@
|
|
|
51
51
|
* it keeps the hover text (the mount door's, and the mount's re-registration after a pass that
|
|
52
52
|
* failed part way); the boot-path hover inspector calls it through the thin registry and never
|
|
53
53
|
* imports this module.
|
|
54
|
+
* - The caption's and the hover's number words (r11, Big Trades 0.7.0 "Size shown as"): THE one format list,
|
|
55
|
+
* WRUN_BATCHED_NUMBER_FORMATS (wrun-batched-readout.util), which the gate's vocabulary and the engine settings read
|
|
56
|
+
* here. `usd` prints dollars, `units` a mark's quantity in the market's own unit: its dollar value over the record's
|
|
57
|
+
* price times the market's dollar unit, which every build hands in (`valuePerUnit`, the run's
|
|
58
|
+
* `wrunMarketDollarUnit`) and a marks child carries on its settings (the engine's caption) and its readout (the
|
|
59
|
+
* hover). Where no unit is proven the engine is handed `usd` in place of `units`, never a wrong number.
|
|
54
60
|
*/
|
|
55
61
|
import type { WrunBatchedMarksKind, WrunBatchedSection, WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
56
62
|
import { type WrunCellsCapSummary } from './wrun-cap-notice.util.js';
|
|
57
63
|
import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
|
|
58
64
|
import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
59
65
|
import { type WrunColorTheme } from './wrun-style-words.util.js';
|
|
60
|
-
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, wrunBatchedReadoutText, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
|
|
66
|
+
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
|
|
61
67
|
export type { WrunBatchedHoverRecord } from './wrun-canvas-readout.util.js';
|
|
62
68
|
/** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
|
|
63
69
|
export declare const WRUN_BATCHED_MARKS_KINDS: ReadonlyArray<WrunBatchedMarksKind>;
|
|
@@ -194,14 +200,21 @@ export interface WrunBatchedChildOverlay {
|
|
|
194
200
|
export declare function wrunBatchedLayoutVerdict(kind: WrunBatchedMarksKind, section: Record<string, unknown>): string | null;
|
|
195
201
|
/** The engine settings of a section's child: the geometry (`slots`, `stride`; `first_output` stays
|
|
196
202
|
* here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
|
|
197
|
-
* declared (the engine registers its drawn records for hover then). Colours stay as declared.
|
|
198
|
-
|
|
203
|
+
* declared (the engine registers its drawn records for hover then). Colours stay as declared. A marks
|
|
204
|
+
* child also carries the market's dollar unit (`valuePerUnit`) when the build hands a proven one; spans
|
|
205
|
+
* and rays never do (their records hold no quantity). */
|
|
206
|
+
export declare function wrunBatchedSettingsOf(spec: WrunBatchedSectionSpec, context?: Pick<WrunBatchedChildrenOptions, 'valuePerUnit'>): Record<string, unknown>;
|
|
199
207
|
/** What a build of the batched children takes beside the sheet and the rows. */
|
|
200
208
|
export interface WrunBatchedChildrenOptions {
|
|
201
209
|
/** A live tick's changed tail: the timestamp the tick re-evaluated from (the previous forming bar's,
|
|
202
210
|
* the session's watermark). Each child is built from the parent rows at or after it only (walked
|
|
203
211
|
* back from the newest), charges nothing and is marked `tailOnly`. */
|
|
204
212
|
tailFromTs?: number;
|
|
213
|
+
/** The chart market's dollar unit (US dollars per price unit and size unit: the run's `wrunMarketDollarUnit`,
|
|
214
|
+
* handed in beside its size unit by every result build): a marks child's caption (`settings.valuePerUnit`, the
|
|
215
|
+
* engine's `units`) and hover (`readout.valuePerUnit`) divide a record's dollar value by it. Absent, or no number
|
|
216
|
+
* above zero: none is proven, and `units` prints dollars. A tail takes the one its full build took. */
|
|
217
|
+
valuePerUnit?: number;
|
|
205
218
|
}
|
|
206
219
|
/**
|
|
207
220
|
* One child per batched section the Style rows leave visible, in mount order. A full build charges
|
|
@@ -6,8 +6,8 @@ import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
|
6
6
|
import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunPaintedDeclarationOf } from './wrun-color-settings.util.js';
|
|
7
7
|
import { WRUN_HEATMAP_TRIM_WATERMARK, wrunHeatmapCellShares, wrunHeatmapTrimTarget, } from './wrun-heatmap-cell-budget.util.js';
|
|
8
8
|
import { resolveWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord, } from './wrun-style-words.util.js';
|
|
9
|
-
import { decodeWrunMarkMeta, decodeWrunSpanMeta, wrunBatchedReadoutText } from './wrun-batched-readout.util.js';
|
|
10
|
-
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, wrunBatchedReadoutText, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
|
|
9
|
+
import { decodeWrunMarkMeta, decodeWrunSpanMeta, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkUnitValue, } from './wrun-batched-readout.util.js';
|
|
10
|
+
export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
|
|
11
11
|
// ── The vocabulary ──────────────────────────────────────────────────────────
|
|
12
12
|
/** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
|
|
13
13
|
export const WRUN_BATCHED_MARKS_KINDS = Object.freeze(['marks', 'spans', 'rays']);
|
|
@@ -312,7 +312,6 @@ function wordIndex(value, words, fallback) {
|
|
|
312
312
|
const MARK_LOOKS = ['circle', 'dot', 'ring', 'square'];
|
|
313
313
|
const MARK_TEXT_MODES = ['off', 'largest', 'all'];
|
|
314
314
|
const MARK_X_WORDS = ['bar', 'offset'];
|
|
315
|
-
const MARK_TEXT_FORMATS = new Set(['compact', 'price', 'int']);
|
|
316
315
|
const LINE_STYLES = new Set(['solid', 'dashed', 'dotted']);
|
|
317
316
|
// ── The gate: layouts newer than this chart ─────────────────────────────────
|
|
318
317
|
/** A key's rule in the gate's vocabulary: `ANY` (the reader takes any value, clamping or defaulting
|
|
@@ -346,7 +345,7 @@ const SECTION_VOCABULARY = {
|
|
|
346
345
|
size: { law: ['sqrt', 'linear'], unit: ANY, scale: ANY },
|
|
347
346
|
opacity_pct: ANY,
|
|
348
347
|
look: MARK_LOOK_VALUES,
|
|
349
|
-
text: { mode: MARK_TEXT_MODE_VALUES, field: ['qty'], format:
|
|
348
|
+
text: { mode: MARK_TEXT_MODE_VALUES, field: ['qty'], format: WRUN_BATCHED_NUMBER_FORMATS, min_px: ANY },
|
|
350
349
|
x: MARK_X_VALUES,
|
|
351
350
|
colors: ANY,
|
|
352
351
|
tooltip: ANY,
|
|
@@ -466,14 +465,20 @@ function wordsOf(value) {
|
|
|
466
465
|
/** The marks look the engine draws (r6 parity): `look` 0..3 (Bubble, Soft dot, Ring, Square), the
|
|
467
466
|
* size law over the quantity (`unit` the Min size, `scale` the Bubble size 1..10), `x` 0..1
|
|
468
467
|
* (Candle center, Trade time), `opacity_pct` 10..80, the caption (`text.mode` 0 Off, 1 Big
|
|
469
|
-
* bubbles, 2 All; its format and the smallest bubble that holds one). A key
|
|
470
|
-
* that is none of its values (look, x, law, the caption's mode and format),
|
|
471
|
-
* (LOOK_DEFAULTS.marks); a number past its range is clamped.
|
|
472
|
-
|
|
468
|
+
* bubbles, 2 All; its format, a word of the one list, and the smallest bubble that holds one). A key
|
|
469
|
+
* left out, or an option that is none of its values (look, x, law, the caption's mode and format),
|
|
470
|
+
* takes the kit's default (LOOK_DEFAULTS.marks); a number past its range is clamped. The market's
|
|
471
|
+
* dollar unit (`valuePerUnit`, proven: finite and above zero) rides at the top for the `units`
|
|
472
|
+
* caption; without one, `units` is handed to the engine as `usd`. */
|
|
473
|
+
function marksSettings(section, valuePerUnit) {
|
|
473
474
|
const defaults = LOOK_DEFAULTS.marks;
|
|
474
475
|
const size = isRecord(section.size) ? section.size : {};
|
|
475
476
|
const text = isRecord(section.text) ? section.text : {};
|
|
476
477
|
const legacyShape = section.shape;
|
|
478
|
+
const written = isWrunBatchedNumberFormat(text.format) ? text.format : defaults.text.format;
|
|
479
|
+
// `units` divides by the market's dollar unit: with none proven it would caption a wrong number, so the engine reads
|
|
480
|
+
// the same amount in dollars (the hover's rule, wrun-batched-readout.util `wrunMarkQtyInUnits`).
|
|
481
|
+
const format = written === 'units' && valuePerUnit === undefined ? 'usd' : written;
|
|
477
482
|
return {
|
|
478
483
|
look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look),
|
|
479
484
|
size: {
|
|
@@ -487,9 +492,10 @@ function marksSettings(section) {
|
|
|
487
492
|
text: {
|
|
488
493
|
mode: wordIndex(text.mode, MARK_TEXT_MODES, defaults.text.mode),
|
|
489
494
|
field: defaults.text.field,
|
|
490
|
-
format
|
|
495
|
+
format,
|
|
491
496
|
min_px: clampTo(text.min_px, 0, 64, defaults.text.min_px),
|
|
492
497
|
},
|
|
498
|
+
...(valuePerUnit !== undefined ? { valuePerUnit } : {}),
|
|
493
499
|
};
|
|
494
500
|
}
|
|
495
501
|
/** A span's edge: a `null` the sheet holds draws none; a declared edge takes each key it leaves out
|
|
@@ -531,10 +537,12 @@ function tooltipOf(section) {
|
|
|
531
537
|
}
|
|
532
538
|
/** The engine settings of a section's child: the geometry (`slots`, `stride`; `first_output` stays
|
|
533
539
|
* here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
|
|
534
|
-
* declared (the engine registers its drawn records for hover then). Colours stay as declared.
|
|
535
|
-
|
|
540
|
+
* declared (the engine registers its drawn records for hover then). Colours stay as declared. A marks
|
|
541
|
+
* child also carries the market's dollar unit (`valuePerUnit`) when the build hands a proven one; spans
|
|
542
|
+
* and rays never do (their records hold no quantity). */
|
|
543
|
+
export function wrunBatchedSettingsOf(spec, context = {}) {
|
|
536
544
|
const look = spec.kind === 'marks'
|
|
537
|
-
? marksSettings(spec.declaration)
|
|
545
|
+
? marksSettings(spec.declaration, wrunMarkUnitValue(context.valuePerUnit))
|
|
538
546
|
: spec.kind === 'spans'
|
|
539
547
|
? spansSettings(spec.declaration)
|
|
540
548
|
: raysSettings(spec.declaration);
|
|
@@ -543,8 +551,9 @@ export function wrunBatchedSettingsOf(spec) {
|
|
|
543
551
|
/** The readout a section with a tooltip registers at its mount, with the record's text (the template
|
|
544
552
|
* printed by wrun-batched-readout.util) on it: the child carries the readout it registers, so a
|
|
545
553
|
* registration from the child alone (the mount's `syncCanvasReadouts` after a pass that failed part
|
|
546
|
-
* way) keeps the hover text.
|
|
547
|
-
|
|
554
|
+
* way) keeps the hover text. A marks readout carries the market's dollar unit its `{{qty:units}}`
|
|
555
|
+
* divides by (proven only). */
|
|
556
|
+
function readoutOf(spec, valuePerUnit) {
|
|
548
557
|
const tooltip = tooltipOf(spec.declaration);
|
|
549
558
|
if (tooltip === null)
|
|
550
559
|
return undefined;
|
|
@@ -559,17 +568,18 @@ function readoutOf(spec) {
|
|
|
559
568
|
...(words.length > 0 ? { words } : {}),
|
|
560
569
|
// A timed record's `{{start}}` and `{{end}}` (their display offset is the mount door's to stamp).
|
|
561
570
|
...(timed ? { timed: true } : {}),
|
|
571
|
+
...(spec.kind === 'marks' && valuePerUnit !== undefined ? { valuePerUnit } : {}),
|
|
562
572
|
};
|
|
563
573
|
readout.text = (record, formatters) => wrunBatchedReadoutText(readout, record, formatters);
|
|
564
574
|
return readout;
|
|
565
575
|
}
|
|
566
|
-
function childOf(spec, data, extra) {
|
|
567
|
-
const readout = readoutOf(spec);
|
|
576
|
+
function childOf(spec, data, extra, valuePerUnit) {
|
|
577
|
+
const readout = readoutOf(spec, valuePerUnit);
|
|
568
578
|
return {
|
|
569
579
|
kind: spec.kind,
|
|
570
580
|
name: spec.name,
|
|
571
581
|
data,
|
|
572
|
-
settings: wrunBatchedSettingsOf(spec),
|
|
582
|
+
settings: wrunBatchedSettingsOf(spec, { valuePerUnit }),
|
|
573
583
|
...(readout !== undefined ? { readout } : {}),
|
|
574
584
|
...extra,
|
|
575
585
|
};
|
|
@@ -602,6 +612,7 @@ export function wrunBatchedMarksChildren(sheet, outputRows, options = {}) {
|
|
|
602
612
|
const specs = readWrunBatchedSections(sheet).filter((spec) => !isWrunStyleTargetHidden(spec.declaration));
|
|
603
613
|
if (specs.length === 0)
|
|
604
614
|
return [];
|
|
615
|
+
const valuePerUnit = wrunMarkUnitValue(options.valuePerUnit);
|
|
605
616
|
if (options.tailFromTs !== undefined) {
|
|
606
617
|
const from = wrunBatchedTailStart(outputRows, options.tailFromTs);
|
|
607
618
|
return specs.map((spec) => {
|
|
@@ -611,7 +622,7 @@ export function wrunBatchedMarksChildren(sheet, outputRows, options = {}) {
|
|
|
611
622
|
const data = wrunBatchedRowsOf(spec, outputRows, from, audit);
|
|
612
623
|
return audit.newer !== undefined
|
|
613
624
|
? refusedChildOf(spec, audit.newer, { tailOnly: true })
|
|
614
|
-
: childOf(spec, data, { tailOnly: true });
|
|
625
|
+
: childOf(spec, data, { tailOnly: true }, valuePerUnit);
|
|
615
626
|
});
|
|
616
627
|
}
|
|
617
628
|
const bars = outputRows.length;
|
|
@@ -661,7 +672,7 @@ export function wrunBatchedMarksChildren(sheet, outputRows, options = {}) {
|
|
|
661
672
|
cells: data[at].length * perBar,
|
|
662
673
|
bars: data[at].length,
|
|
663
674
|
},
|
|
664
|
-
});
|
|
675
|
+
}, valuePerUnit);
|
|
665
676
|
});
|
|
666
677
|
}
|
|
667
678
|
// ── The mount door ──────────────────────────────────────────────────────────
|
|
@@ -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
|
|
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
|
-
/**
|
|
55
|
-
|
|
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), `
|
|
58
|
-
*
|
|
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:<
|
|
62
|
-
* Marks read `{{side}}`, `{{qty}}` (default the full amount
|
|
63
|
-
*
|
|
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
|
|
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
|
|
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
|
-
|
|
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), `
|
|
79
|
-
*
|
|
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
|
-
|
|
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:<
|
|
103
|
-
* Marks read `{{side}}`, `{{qty}}` (default the full amount
|
|
104
|
-
*
|
|
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
|
|
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
|
-
|
|
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':
|
|
@@ -7,3 +7,15 @@ export declare const BUILTIN_TWIN_OF_SETTING = "builtinTwinOf";
|
|
|
7
7
|
* a settings value: read alone, any package could claim a built-in's saved
|
|
8
8
|
* values, guide, one-per-chart rule and theme by carrying it. */
|
|
9
9
|
export declare function builtinTwinOf(settings: unknown): string | undefined;
|
|
10
|
+
/** The built-in whose port a registry overlay RUNS, stamp or not: the stamp when
|
|
11
|
+
* it is one (builtinTwinOf), else the built-in the package itself ports
|
|
12
|
+
* (BUILTIN_TWIN_PORTS). The run contract reads this one, the stamp readers
|
|
13
|
+
* above keep the stamp: the Timeframe rule (a selection at or below the chart
|
|
14
|
+
* runs the plain chart path), the lookback the run-interval warm-up sizes from
|
|
15
|
+
* and the alert arm's guards are properties of the package's code, the same
|
|
16
|
+
* through every door (the Indicators list stamps, the store page, a share, a
|
|
17
|
+
* template, the CLI and the agent do not). Read by the stamp alone, the store's
|
|
18
|
+
* copy of an R3 port took a Timeframe finer than the chart as-is, aborted with
|
|
19
|
+
* the engine's words and never drew again after a reload. Undefined for a
|
|
20
|
+
* package that ports no built-in and for anything without a registry identity. */
|
|
21
|
+
export declare function builtinPortOf(settings: unknown): string | undefined;
|
|
@@ -38,3 +38,24 @@ export function builtinTwinOf(settings) {
|
|
|
38
38
|
return undefined;
|
|
39
39
|
return builtinTwinOfPackage(packageName) === stamp ? stamp : undefined;
|
|
40
40
|
}
|
|
41
|
+
/** The built-in whose port a registry overlay RUNS, stamp or not: the stamp when
|
|
42
|
+
* it is one (builtinTwinOf), else the built-in the package itself ports
|
|
43
|
+
* (BUILTIN_TWIN_PORTS). The run contract reads this one, the stamp readers
|
|
44
|
+
* above keep the stamp: the Timeframe rule (a selection at or below the chart
|
|
45
|
+
* runs the plain chart path), the lookback the run-interval warm-up sizes from
|
|
46
|
+
* and the alert arm's guards are properties of the package's code, the same
|
|
47
|
+
* through every door (the Indicators list stamps, the store page, a share, a
|
|
48
|
+
* template, the CLI and the agent do not). Read by the stamp alone, the store's
|
|
49
|
+
* copy of an R3 port took a Timeframe finer than the chart as-is, aborted with
|
|
50
|
+
* the engine's words and never drew again after a reload. Undefined for a
|
|
51
|
+
* package that ports no built-in and for anything without a registry identity. */
|
|
52
|
+
export function builtinPortOf(settings) {
|
|
53
|
+
const stamped = builtinTwinOf(settings);
|
|
54
|
+
if (stamped !== undefined)
|
|
55
|
+
return stamped;
|
|
56
|
+
if (!settings || typeof settings !== 'object')
|
|
57
|
+
return undefined;
|
|
58
|
+
const ref = settings.wrunRegistryRef;
|
|
59
|
+
const packageName = ref && typeof ref === 'object' ? ref.package : undefined;
|
|
60
|
+
return typeof packageName === 'string' && packageName !== '' ? builtinTwinOfPackage(packageName) : undefined;
|
|
61
|
+
}
|
|
@@ -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
|
+
}
|