@orangecharts/wrun-chart-host 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/constants/feature-flags.constants.d.ts +15 -1
- package/dist/constants/feature-flags.constants.js +130 -24
- package/dist/constants/governed-exchanges.constants.d.ts +12 -0
- package/dist/constants/governed-exchanges.constants.js +16 -0
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -2
- package/dist/constants/option-venues.constants.d.ts +2 -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 +21 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +102 -19
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
- package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
- package/dist/interfaces/cme-realtime.interface.js +6 -3
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
- package/dist/interfaces/prediction-market.interface.d.ts +7 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
- package/dist/interfaces/stocks-realtime.interface.js +32 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
- package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
- package/dist/market-data/billing.interface.d.ts +174 -36
- package/dist/market-data/billing.interface.js +58 -8
- package/dist/market-data/venue.d.ts +152 -7
- 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 +294 -7
- package/dist/market-data/venues/index.js +49 -6
- package/dist/market-data/venues/opra.contract.copy.json +3 -2
- package/dist/market-data/venues/opra.d.ts +2 -2
- package/dist/market-data/venues/opra.js +5 -2
- package/dist/market-data/venues/stocks.contract.copy.json +64 -0
- package/dist/market-data/venues/stocks.d.ts +130 -0
- package/dist/market-data/venues/stocks.js +117 -0
- package/dist/settings-templates/footprint-rows.js +35 -2
- package/dist/settings-templates/form-rows.d.ts +2 -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 +79 -10
- package/dist/settings-templates/tool-rules.d.ts +32 -15
- package/dist/settings-templates/tool-rules.js +33 -11
- package/dist/settings-templates/tool-tables.generated.js +95 -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/cme-cache-context.util.d.ts +5 -3
- package/dist/utility/chart/cme-cache-context.util.js +10 -6
- package/dist/utility/chart/cme-realtime.util.js +10 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
- package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
- package/dist/utility/chart/effective-chart-session.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
- package/dist/utility/chart/host-bar-placement.util.js +170 -30
- package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
- package/dist/utility/chart/index-host-tier.util.js +7 -2
- package/dist/utility/chart/index-mode-admission.util.js +30 -3
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
- 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 +9 -7
- package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
- package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -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 +156 -43
- package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
- package/dist/utility/chart/live-bucket.util.d.ts +24 -8
- package/dist/utility/chart/live-bucket.util.js +85 -27
- 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.js +5 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
- package/dist/utility/chart/mixed-mode.util.js +14 -0
- 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/opra-user-scripts-gate.util.d.ts +11 -16
- package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
- package/dist/utility/chart/rth-session.util.d.ts +12 -10
- package/dist/utility/chart/rth-session.util.js +25 -21
- package/dist/utility/chart/trading-day.util.d.ts +17 -0
- package/dist/utility/chart/trading-day.util.js +59 -0
- 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/window-owner.leaf.d.ts +23 -2
- package/dist/utility/chart/window-owner.leaf.js +45 -3
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
- package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
- package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
- package/dist/utility/chart/wrun-run-result.util.js +141 -6
- package/dist/utility/intl-locale.util.js +5 -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 +18 -0
- package/dist/utility/options/option-venue.util.js +27 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
- package/dist/utility/v2/gate-plane.util.d.ts +12 -3
- package/dist/utility/v2/gate-plane.util.js +30 -4
- package/dist/utility/v2/gate-session-latch.util.js +1 -1
- package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
- package/dist/utility/v2/stocks-governed.util.js +34 -0
- package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
- package/dist/utility/wrun/derived-roots.leaf.js +27 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
- package/dist/utility/wrun/derived-roots.util.js +451 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
- 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 +4 -2
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
- 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-lanes/option_contract_flow.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
- 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-chart-market-facts.util.d.ts +60 -16
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
- 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-frames.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +73 -10
- package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-handles.util.js +9 -8
- 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 +18 -4
- package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
- package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
- package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
- package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
- 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-book-rows.util.d.ts +56 -0
- package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
- 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 +23 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
- package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
- package/dist/utility/wrun/wrun-option-views.util.js +484 -71
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
- 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 +32 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
- 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.js +3 -1
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
- package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
- 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 +114 -19
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
- package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
- package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
- package/dist/utility/wrun/wrun-param-map.util.js +10 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
- package/dist/utility/wrun/wrun-param-values.util.js +4 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
- package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
- 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.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal.util.js +22 -0
- 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-registry-errors.util.d.ts +26 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
- package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
- package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -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 +118 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
- package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
- 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 +7 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
- package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/dist/workers/constants/socket-slots.d.ts +91 -6
- package/dist/workers/constants/socket-slots.js +85 -6
- package/package.json +5 -5
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The download budget's plan (OPTLOAD wave 3, unit R2; UW-PARITY/reports/OPTLOAD-W3/guard-design.md sections 3.3 and
|
|
3
|
+
* 3.7): before any fetch, a run prices its reads with the kit's rule (`wrunDownloadReadCost`, the class table the
|
|
4
|
+
* publish gate charges) on its real window and market, and so decides its mode (`wrunRunDownloadMode`):
|
|
5
|
+
* - at or under the run's budget (1 MB per 252 bars, `wrunRunDownloadBudgetBytes`): WHOLE, today's asks unchanged, the
|
|
6
|
+
* meter only counts;
|
|
7
|
+
* - over it: BUDGETED. Snapshot and scalar reads reserve their projected bytes and are never cut; the history reads (a
|
|
8
|
+
* row lane with a flow or snapshot landing, the chart's own celled classes) share what is left in proportion to their
|
|
9
|
+
* projections. Each asks its newest slice first and alone whatever its share (it draws at least its newest bar), then
|
|
10
|
+
* the newest older bars its share fits by the slice's own wire bytes, and no others (wrun-row-lanes.util
|
|
11
|
+
* `fetchWrunRowLaneRows` `download`).
|
|
12
|
+
*
|
|
13
|
+
* The reads are the sheet's own (`wrunRunDownloadReads`: the kit's declared reads of every input the market demands,
|
|
14
|
+
* its setting-bound knobs at the run's values). A read whose lane downloads more than it declares carries the lane's own
|
|
15
|
+
* projection (`projectedBytes`, FE-FOLD-CAP: a strike flow read the lane will fold from the chain's contract rows),
|
|
16
|
+
* which replaces the kit's. The kit prices a 1h and a 5m window; a run on another interval is priced at the nearer one
|
|
17
|
+
* over its own bars (`wrunDownloadKitInterval`), so the rule holds exactly on the windows it is defined on and
|
|
18
|
+
* approximately elsewhere, where the meter still counts every byte.
|
|
19
|
+
*
|
|
20
|
+
* Behind the flag `wrun-download-budget-cut` (the run reads it): off, every run is whole.
|
|
21
|
+
*/
|
|
22
|
+
import type { WrunDownloadInputCost, WrunDownloadInterval, WrunDownloadMarket, WrunDownloadReadFacts } from '@orangecharts/indicator-kit/host';
|
|
23
|
+
import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
24
|
+
import { type WrunDownloadMeterPort } from './wrun-download-meter.util.js';
|
|
25
|
+
/** One read's tally beside the run's meter (`createWrunLaneDownloadMeter`): what its own asks downloaded. */
|
|
26
|
+
export interface WrunLaneDownloadMeter extends WrunDownloadMeterPort {
|
|
27
|
+
/** Bytes the read's asks downloaded: the wire a stamp measured, else the answer's cell bytes. */
|
|
28
|
+
spentBytes(): number;
|
|
29
|
+
/** The read's asks, and those a stamp measured at 0 bytes (a cache, a follower of another ask's request). */
|
|
30
|
+
asks(): number;
|
|
31
|
+
cachedAsks(): number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A read's own meter: every charge goes on to the run's meter unchanged (the run's summary counts every read once) and
|
|
35
|
+
* into the read's tally, so a budgeted read learns what its newest slice downloaded while the run's other reads
|
|
36
|
+
* download beside it (wrun-row-lanes.util `fetchWrunRowLaneRows` `download`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function createWrunLaneDownloadMeter(run: WrunDownloadMeterPort): WrunLaneDownloadMeter;
|
|
39
|
+
/** The market shapes the kit prices (`WRUN_DOWNLOAD_MARKETS`). */
|
|
40
|
+
export type WrunDownloadPlanMarket = WrunDownloadMarket;
|
|
41
|
+
/** The kit's window nearest a chart's bar (`wrunDownloadReadCost` prices '1h' and '5m' alone). */
|
|
42
|
+
export declare function wrunDownloadKitInterval(intervalMs: number): WrunDownloadInterval;
|
|
43
|
+
/** A chart's market shape as the kit prices it: a CME Group exchange `cme`, a session market (a stock, an ETF, an index
|
|
44
|
+
* mode chart) `us-stock`, every other (a crypto venue, 24/7) `crypto`. */
|
|
45
|
+
export declare function wrunDownloadMarketOf(chart: {
|
|
46
|
+
cme: boolean;
|
|
47
|
+
indexMode: boolean;
|
|
48
|
+
}): WrunDownloadPlanMarket;
|
|
49
|
+
/** One read of a run as the plan prices it: the kit's facts, and the run's own words for it. */
|
|
50
|
+
export interface WrunDownloadPlanRead extends WrunDownloadReadFacts {
|
|
51
|
+
/** The run's name for the read (a row lane instance's id, a built-in lane's): the shares are keyed by it. Absent: the
|
|
52
|
+
* read's inputs, joined. */
|
|
53
|
+
key?: string;
|
|
54
|
+
/** A read the run can cut by bars (a history read). Absent or false: a snapshot or scalar read, reserved. */
|
|
55
|
+
history?: boolean;
|
|
56
|
+
/** The lane's own projection where the read downloads more than it declares (FE-FOLD-CAP), replacing the kit's. */
|
|
57
|
+
projectedBytes?: number;
|
|
58
|
+
}
|
|
59
|
+
/** The run's window as the plan prices it: its bars (the budget's), its bar and its market shape. */
|
|
60
|
+
export interface WrunDownloadPlanWindow {
|
|
61
|
+
bars: number;
|
|
62
|
+
intervalMs: number;
|
|
63
|
+
market: WrunDownloadPlanMarket;
|
|
64
|
+
}
|
|
65
|
+
export type WrunDownloadMode = {
|
|
66
|
+
mode: 'whole';
|
|
67
|
+
projectedBytes: number;
|
|
68
|
+
} | {
|
|
69
|
+
mode: 'budgeted';
|
|
70
|
+
projectedBytes: number;
|
|
71
|
+
budgetBytes: number;
|
|
72
|
+
shares: ReadonlyMap<string, number>;
|
|
73
|
+
};
|
|
74
|
+
/** One read's worst case on the run's window (the kit's `wrunDownloadReadCost`, by default through the shared host). */
|
|
75
|
+
export type WrunDownloadPrice = (read: WrunDownloadReadFacts, market: WrunDownloadMarket, interval: WrunDownloadInterval) => WrunDownloadInputCost;
|
|
76
|
+
/** The key a read's share is filed under. */
|
|
77
|
+
export declare function wrunDownloadPlanKeyOf(read: Pick<WrunDownloadPlanRead, 'key' | 'inputs'>): string;
|
|
78
|
+
/** A read's projected bytes on the window: the lane's own projection where it carries one, else the kit's. */
|
|
79
|
+
export declare function wrunDownloadPlanReadBytes(read: WrunDownloadPlanRead, window: Pick<WrunDownloadPlanWindow, 'intervalMs' | 'market'>, price?: WrunDownloadPrice): number;
|
|
80
|
+
/**
|
|
81
|
+
* The run's mode, before any fetch: WHOLE when the reads' projection is at or under the run's budget, else BUDGETED
|
|
82
|
+
* with each history read's share of what the reserved reads leave, in proportion to its projection (a read the run
|
|
83
|
+
* cannot cut, a snapshot or a scalar read, keeps its projection and is never cut). A read's share never holds it to
|
|
84
|
+
* nothing: it asks its newest slice whatever the share (the lane's rule), so a share is what its older bars may spend.
|
|
85
|
+
*/
|
|
86
|
+
export declare function wrunRunDownloadMode(reads: readonly WrunDownloadPlanRead[], window: WrunDownloadPlanWindow, price?: WrunDownloadPrice): WrunDownloadMode;
|
|
87
|
+
/**
|
|
88
|
+
* The sheet's reads as the kit charges them (`wrunDownloadPlanReads`, the declared-read half: every input it is handed
|
|
89
|
+
* is a read the plan left unasked, so each is charged from its declaration over the window), one per class and knob set
|
|
90
|
+
* with the inputs it serves: its knobs (a view, a fold, `history`, the strike knobs), its setting-bound knobs at the
|
|
91
|
+
* run's values (`settingOf`), its cap a bar (the input's capacity) and its width. `inputs` names the inputs the run
|
|
92
|
+
* reads (an input the market leaves undemanded is no read); the window is the run's, warm-up included
|
|
93
|
+
* (`[fromMs, toMs)`, at its bar). The chart's own candles are no read of the run (its rows answer them).
|
|
94
|
+
*/
|
|
95
|
+
export declare function wrunRunDownloadReads(sheet: WrunIndicatorMetadata, window: {
|
|
96
|
+
fromMs: number;
|
|
97
|
+
toMs: number;
|
|
98
|
+
intervalMs: number;
|
|
99
|
+
}, inputs: readonly string[], settingOf?: (name: string) => number | undefined): WrunDownloadReadFacts[];
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
2
|
+
import { wrunRunDownloadBudgetBytes } from './wrun-download-meter.util.js';
|
|
3
|
+
const MINUTE_MS = 60_000;
|
|
4
|
+
function countOf(value) {
|
|
5
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A read's own meter: every charge goes on to the run's meter unchanged (the run's summary counts every read once) and
|
|
9
|
+
* into the read's tally, so a budgeted read learns what its newest slice downloaded while the run's other reads
|
|
10
|
+
* download beside it (wrun-row-lanes.util `fetchWrunRowLaneRows` `download`).
|
|
11
|
+
*/
|
|
12
|
+
export function createWrunLaneDownloadMeter(run) {
|
|
13
|
+
let bytes = 0;
|
|
14
|
+
let asks = 0;
|
|
15
|
+
let cachedAsks = 0;
|
|
16
|
+
return {
|
|
17
|
+
charge(charge) {
|
|
18
|
+
run.charge(charge);
|
|
19
|
+
asks += 1;
|
|
20
|
+
const wire = charge.verdict?.wireBytes;
|
|
21
|
+
if (typeof wire === 'number' && Number.isFinite(wire) && wire >= 0) {
|
|
22
|
+
bytes += wire;
|
|
23
|
+
if (wire === 0)
|
|
24
|
+
cachedAsks += 1;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
bytes += countOf(charge.cellBytes);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
spentBytes: () => bytes,
|
|
31
|
+
asks: () => asks,
|
|
32
|
+
cachedAsks: () => cachedAsks,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Where the kit's two windows meet on a log scale (the geometric mean of 5 minutes and an hour, about 17 minutes): a
|
|
36
|
+
* bar narrower is priced as the 5m window's, a wider one as the 1h window's. */
|
|
37
|
+
const KIT_INTERVAL_SPLIT_MS = Math.sqrt(5 * MINUTE_MS * 60 * MINUTE_MS);
|
|
38
|
+
/** The kit's window nearest a chart's bar (`wrunDownloadReadCost` prices '1h' and '5m' alone). */
|
|
39
|
+
export function wrunDownloadKitInterval(intervalMs) {
|
|
40
|
+
return Number.isFinite(intervalMs) && intervalMs > 0 && intervalMs < KIT_INTERVAL_SPLIT_MS ? '5m' : '1h';
|
|
41
|
+
}
|
|
42
|
+
/** A chart's market shape as the kit prices it: a CME Group exchange `cme`, a session market (a stock, an ETF, an index
|
|
43
|
+
* mode chart) `us-stock`, every other (a crypto venue, 24/7) `crypto`. */
|
|
44
|
+
export function wrunDownloadMarketOf(chart) {
|
|
45
|
+
if (chart.cme)
|
|
46
|
+
return 'cme';
|
|
47
|
+
return chart.indexMode ? 'us-stock' : 'crypto';
|
|
48
|
+
}
|
|
49
|
+
function sharedHostPrice(read, market, interval) {
|
|
50
|
+
return wrunChartHostEnv().sharedHost().wrunDownloadReadCost(read, market, interval);
|
|
51
|
+
}
|
|
52
|
+
/** The key a read's share is filed under. */
|
|
53
|
+
export function wrunDownloadPlanKeyOf(read) {
|
|
54
|
+
return read.key ?? read.inputs.join(',');
|
|
55
|
+
}
|
|
56
|
+
/** A read's projected bytes on the window: the lane's own projection where it carries one, else the kit's. */
|
|
57
|
+
export function wrunDownloadPlanReadBytes(read, window, price = sharedHostPrice) {
|
|
58
|
+
const own = read.projectedBytes;
|
|
59
|
+
if (typeof own === 'number' && Number.isFinite(own) && own >= 0)
|
|
60
|
+
return own;
|
|
61
|
+
const bytes = price(read, window.market, wrunDownloadKitInterval(window.intervalMs)).bytes;
|
|
62
|
+
return Number.isFinite(bytes) && bytes > 0 ? bytes : 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The run's mode, before any fetch: WHOLE when the reads' projection is at or under the run's budget, else BUDGETED
|
|
66
|
+
* with each history read's share of what the reserved reads leave, in proportion to its projection (a read the run
|
|
67
|
+
* cannot cut, a snapshot or a scalar read, keeps its projection and is never cut). A read's share never holds it to
|
|
68
|
+
* nothing: it asks its newest slice whatever the share (the lane's rule), so a share is what its older bars may spend.
|
|
69
|
+
*/
|
|
70
|
+
export function wrunRunDownloadMode(reads, window, price = sharedHostPrice) {
|
|
71
|
+
const priced = reads.map((read) => ({ read, bytes: wrunDownloadPlanReadBytes(read, window, price) }));
|
|
72
|
+
const projectedBytes = priced.reduce((sum, { bytes }) => sum + bytes, 0);
|
|
73
|
+
const budgetBytes = wrunRunDownloadBudgetBytes(window.bars);
|
|
74
|
+
if (projectedBytes <= budgetBytes)
|
|
75
|
+
return { mode: 'whole', projectedBytes };
|
|
76
|
+
const reserved = priced.filter(({ read }) => read.history !== true).reduce((sum, { bytes }) => sum + bytes, 0);
|
|
77
|
+
const history = priced.filter(({ read }) => read.history === true);
|
|
78
|
+
const historyBytes = history.reduce((sum, { bytes }) => sum + bytes, 0);
|
|
79
|
+
const left = Math.max(0, budgetBytes - reserved);
|
|
80
|
+
const shares = new Map();
|
|
81
|
+
for (const { read, bytes } of history) {
|
|
82
|
+
const key = wrunDownloadPlanKeyOf(read);
|
|
83
|
+
const share = historyBytes > 0 ? Math.floor((left * bytes) / historyBytes) : 0;
|
|
84
|
+
shares.set(key, (shares.get(key) ?? 0) + share);
|
|
85
|
+
}
|
|
86
|
+
return { mode: 'budgeted', projectedBytes, budgetBytes, shares };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The sheet's reads as the kit charges them (`wrunDownloadPlanReads`, the declared-read half: every input it is handed
|
|
90
|
+
* is a read the plan left unasked, so each is charged from its declaration over the window), one per class and knob set
|
|
91
|
+
* with the inputs it serves: its knobs (a view, a fold, `history`, the strike knobs), its setting-bound knobs at the
|
|
92
|
+
* run's values (`settingOf`), its cap a bar (the input's capacity) and its width. `inputs` names the inputs the run
|
|
93
|
+
* reads (an input the market leaves undemanded is no read); the window is the run's, warm-up included
|
|
94
|
+
* (`[fromMs, toMs)`, at its bar). The chart's own candles are no read of the run (its rows answer them).
|
|
95
|
+
*/
|
|
96
|
+
export function wrunRunDownloadReads(sheet, window, inputs, settingOf = () => undefined) {
|
|
97
|
+
if (inputs.length === 0 || !(window.intervalMs > 0) || !(window.toMs > window.fromMs))
|
|
98
|
+
return [];
|
|
99
|
+
const primary = {
|
|
100
|
+
key: 'wrun-download-window',
|
|
101
|
+
class: 'ohlcv',
|
|
102
|
+
exchange: '',
|
|
103
|
+
symbol: '',
|
|
104
|
+
foreign: false,
|
|
105
|
+
primary: true,
|
|
106
|
+
intervalMs: window.intervalMs,
|
|
107
|
+
fromMs: window.fromMs,
|
|
108
|
+
toMs: window.toMs,
|
|
109
|
+
fields: [],
|
|
110
|
+
};
|
|
111
|
+
// No wire names an ask of the plan, so every input is charged from its declaration.
|
|
112
|
+
const wires = inputs.map((inputName) => ({ kind: 'scalar', inputName, fetchKey: '' }));
|
|
113
|
+
const plan = { fetches: [primary], wires };
|
|
114
|
+
const host = wrunChartHostEnv().sharedHost();
|
|
115
|
+
// The kit asks a knob's setting by the knob's own words ("@rows" or "rows"): both read the setting `rows`.
|
|
116
|
+
const reads = host.wrunDownloadPlanReads(sheet, plan, (name) => settingOf(name.startsWith('@') ? name.slice(1) : name));
|
|
117
|
+
return reads.filter((read) => read.inputs.length > 0);
|
|
118
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WrunOpraServedReceipt } from './wrun-opra-lane.util.js';
|
|
1
2
|
export declare function wrunDraftLegendNote(settings: unknown): string | undefined;
|
|
2
3
|
/**
|
|
3
4
|
* The served tier of the chain a run's options_chain lane read (its acquisition record), named only
|
|
@@ -12,10 +13,17 @@ export declare function wrunChainServedTierNote(acquisition: Readonly<Record<str
|
|
|
12
13
|
* alike). Undefined when every OPRA read rode real-time, or none was made.
|
|
13
14
|
*/
|
|
14
15
|
export declare function wrunOpraLanesServedTierNote(acquisitions: Iterable<unknown> | undefined): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The served tier of a hosted (Cloud) run's OPRA reads as its frame's receipt names it (`WrunOpraServedReceipt`,
|
|
18
|
+
* contract opra-server-lanes C4), in the chain's own words: OPRA's delay notice for a delayed receipt (its minutes the
|
|
19
|
+
* receipt's own figure, else the venue's nominal delay), nothing for a real-time one. Nothing for no receipt: a frame
|
|
20
|
+
* that named no tier is unknown, and the account's current tier is never read in its place.
|
|
21
|
+
*/
|
|
22
|
+
export declare function wrunCloudOpraServedNote(served: WrunOpraServedReceipt | undefined): string | undefined;
|
|
15
23
|
/** The whole note a run's legend carries: the draft's word, then the served tier of its OPRA reads (the chain's,
|
|
16
|
-
* else any OPRA lane's among `acquisitions`, the run's record by lane
|
|
17
|
-
* applies. */
|
|
18
|
-
export declare function wrunOverlayLegendNote(settings: unknown, chainAcquisition?: Readonly<Record<string, unknown>>, acquisitions?: Readonly<Record<string, unknown
|
|
24
|
+
* else any OPRA lane's among `acquisitions`, the run's record by lane, else a Cloud run's frame receipt,
|
|
25
|
+
* `cloudOpraServed`), joined by " · "; undefined when none applies. */
|
|
26
|
+
export declare function wrunOverlayLegendNote(settings: unknown, chainAcquisition?: Readonly<Record<string, unknown>>, acquisitions?: Readonly<Record<string, unknown>>, cloudOpraServed?: WrunOpraServedReceipt): string | undefined;
|
|
19
27
|
/**
|
|
20
28
|
* Every wording a legend note can hold in a SAVED title that today's words do not produce: the title is
|
|
21
29
|
* written by the run and kept in the overlay's settings, so a title written under an older build or another
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* lane (a poll lane's `opra`, a row lane's `governed: 'opra'`) names the tier its ask was routed to
|
|
14
14
|
* by the same rule and the same words (its acquisition's `servedTier`, wrun-opra-lane.util), once
|
|
15
15
|
* for every OPRA read the run made.
|
|
16
|
+
* - the served tier of a hosted (Cloud) run's OPRA reads, as its newest frame's receipt names it
|
|
17
|
+
* (contract opra-server-lanes C4: `wrunOpraTier` beside the cloud's OPRA mark, `WrunOpraServedReceipt`):
|
|
18
|
+
* the same delayed line for a delayed receipt, none for a real-time one, and none for a frame that
|
|
19
|
+
* named no tier (an unknown tier shows no word: the account's current tier is never put in its place).
|
|
16
20
|
* The note lands in the define's custom title, which the overlay's settings keep: every reader of the
|
|
17
21
|
* inputs alone (the indicator menu, the settings headers) drops it through `wrunWithoutLegendNote`, the
|
|
18
22
|
* one stripper of whatever `wrunOverlayLegendNote` appends, in today's words and in every wording a saved
|
|
@@ -62,12 +66,30 @@ export function wrunOpraLanesServedTierNote(acquisitions) {
|
|
|
62
66
|
}
|
|
63
67
|
return undefined;
|
|
64
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* The served tier of a hosted (Cloud) run's OPRA reads as its frame's receipt names it (`WrunOpraServedReceipt`,
|
|
71
|
+
* contract opra-server-lanes C4), in the chain's own words: OPRA's delay notice for a delayed receipt (its minutes the
|
|
72
|
+
* receipt's own figure, else the venue's nominal delay), nothing for a real-time one. Nothing for no receipt: a frame
|
|
73
|
+
* that named no tier is unknown, and the account's current tier is never read in its place.
|
|
74
|
+
*/
|
|
75
|
+
export function wrunCloudOpraServedNote(served) {
|
|
76
|
+
if (served?.tier !== 'delayed')
|
|
77
|
+
return undefined;
|
|
78
|
+
const venue = optionVenueForExchange('OPRA');
|
|
79
|
+
if (!venue)
|
|
80
|
+
return undefined;
|
|
81
|
+
const minutes = typeof served.delaySeconds === 'number' && served.delaySeconds > 0
|
|
82
|
+
? Math.max(1, Math.round(served.delaySeconds / 60))
|
|
83
|
+
: optionVenueDelayMinutes(venue);
|
|
84
|
+
return optionVenueDisclosure(venue, 'delayed', minutes, wrunChartHostEnv().t);
|
|
85
|
+
}
|
|
65
86
|
/** The whole note a run's legend carries: the draft's word, then the served tier of its OPRA reads (the chain's,
|
|
66
|
-
* else any OPRA lane's among `acquisitions`, the run's record by lane
|
|
67
|
-
* applies. */
|
|
68
|
-
export function wrunOverlayLegendNote(settings, chainAcquisition, acquisitions) {
|
|
87
|
+
* else any OPRA lane's among `acquisitions`, the run's record by lane, else a Cloud run's frame receipt,
|
|
88
|
+
* `cloudOpraServed`), joined by " · "; undefined when none applies. */
|
|
89
|
+
export function wrunOverlayLegendNote(settings, chainAcquisition, acquisitions, cloudOpraServed) {
|
|
69
90
|
const opra = wrunChainServedTierNote(chainAcquisition) ??
|
|
70
|
-
(acquisitions === undefined ? undefined : wrunOpraLanesServedTierNote(Object.values(acquisitions)))
|
|
91
|
+
(acquisitions === undefined ? undefined : wrunOpraLanesServedTierNote(Object.values(acquisitions))) ??
|
|
92
|
+
wrunCloudOpraServedNote(cloudOpraServed);
|
|
71
93
|
const notes = [wrunDraftLegendNote(settings), opra].filter((note) => typeof note === 'string' && note.trim() !== '');
|
|
72
94
|
return notes.length > 0 ? notes.join(' · ') : undefined;
|
|
73
95
|
}
|
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
* columns`). The frame payload types live here beside their parsers (X24);
|
|
16
16
|
* the sheet declaration types stay in wrun-runtime.interface.ts.
|
|
17
17
|
*
|
|
18
|
+
* One exception to refusing: a panel's legend text past its cap (a frame
|
|
19
|
+
* `title`, `caption` or `hole_caption`) draws clipped to the cap with an
|
|
20
|
+
* ellipsis, and the parsed frame carries a notice that says so
|
|
21
|
+
* (`wrunPanelFrameNotices`). A long caption is no reason to lose the panel.
|
|
22
|
+
*
|
|
18
23
|
* Guard G2 (the no-disguises rule) runs on every string a frame carries,
|
|
19
24
|
* after the JSON decode, before the grammar.
|
|
20
25
|
*/
|
|
21
|
-
import type { WrunFontWeight, WrunLevels, WrunMatrix, WrunPanel, WrunPanelGuide, WrunPanelHighlight, WrunPanelBadge, WrunPanelMarker, WrunPanelQuadrants } from '../../interfaces/wrun-runtime.interface.js';
|
|
26
|
+
import type { WrunFontWeight, WrunLevels, WrunMatrix, WrunPanel, WrunPanelGuide, WrunPanelHighlight, WrunPanelBadge, WrunPanelMarker, WrunPanelQuadrants, WrunPanelXLabels } from '../../interfaces/wrun-runtime.interface.js';
|
|
22
27
|
import { type ParsedPanel } from '../chart/om-panel.util.js';
|
|
23
28
|
import type { FeedLine, LadderProps, LadderRow } from '../chart/om-widget.util.js';
|
|
24
29
|
import type { WrunMiniChartsFrame } from '@orangecharts/indicator-kit/host';
|
|
@@ -159,8 +164,17 @@ export interface WrunPanelFrameChrome {
|
|
|
159
164
|
/** A table's rows' markets (UW-PARITY H4), one per row: null or the market
|
|
160
165
|
* a click on the row opens (wrun-row-market.util). */
|
|
161
166
|
markets?: (WrunRowMarket | null)[];
|
|
167
|
+
/** C3: a numeric-x line's or bars' label per row, "" for a row without one
|
|
168
|
+
* (WrunPanelXLabels); the pane prints it where the row's x number would be. */
|
|
169
|
+
x_labels?: WrunPanelXLabels;
|
|
162
170
|
}
|
|
163
171
|
export type WrunPanelFrameWord = keyof WrunPanelFrameChrome;
|
|
172
|
+
/** A parsed panel frame and the notices of what the host changed to draw it:
|
|
173
|
+
* one plain-English line per chrome text drawn clipped to its cap (the
|
|
174
|
+
* register of the canvas notices); absent when the frame drew as written. */
|
|
175
|
+
export type WrunParsedPanelFrame = ParsedPanel & {
|
|
176
|
+
notices?: string[];
|
|
177
|
+
};
|
|
164
178
|
/** A styled matrix cell: at least one field. */
|
|
165
179
|
export interface WrunMatrixCellStyle {
|
|
166
180
|
value?: number;
|
|
@@ -204,7 +218,7 @@ export declare const WRUN_LEVELS_SPAN_KEYS: readonly ["start", "end", "prices",
|
|
|
204
218
|
export declare function parseWrunLevelsFrame(raw: string, slot: string, declaration?: Partial<Pick<WrunLevels, 'name' | 'span'>>): WrunLevelsFrame | WrunLevelsSpansFrame;
|
|
205
219
|
type PanelKind = WrunPanel['kind'];
|
|
206
220
|
/** Which kinds take each frame key; x_min / x_max also need x "index" or
|
|
207
|
-
* "number" on a line, like the declared words. */
|
|
221
|
+
* "number" on a line, like the declared words, and x_labels x "number" (C3). */
|
|
208
222
|
export declare const WRUN_PANEL_FRAME_WORD_KINDS: Readonly<Record<WrunPanelFrameWord, ReadonlyArray<PanelKind>>>;
|
|
209
223
|
/** The frame keys this panel's kind accepts beside `rows`. */
|
|
210
224
|
export declare function wrunPanelFrameWords(kind: PanelKind): WrunPanelFrameWord[];
|
|
@@ -212,13 +226,20 @@ export declare function wrunPanelFrameWords(kind: PanelKind): WrunPanelFrameWord
|
|
|
212
226
|
* any key outside the kind's words refuses by name, each value goes
|
|
213
227
|
* through its declared word's ranges, then the cross rules against the
|
|
214
228
|
* declaration. Returns the parsed chrome (empty when the frame carries
|
|
215
|
-
* only rows)
|
|
216
|
-
export declare function parseWrunPanelChrome(frame: Record<string, unknown>, declaration: WrunPanel, slot: string): WrunPanelFrameChrome;
|
|
229
|
+
* only rows); a legend text drawn clipped adds its line to `notices`. */
|
|
230
|
+
export declare function parseWrunPanelChrome(frame: Record<string, unknown>, declaration: WrunPanel, slot: string, notices?: string[]): WrunPanelFrameChrome;
|
|
217
231
|
/** Parses a panel frame: `rows` through the receive-lane validator (one row
|
|
218
232
|
* grammar on both lanes; the wrun lane carries the declaration's style
|
|
219
233
|
* words) plus the kind's chrome keys through {@link parseWrunPanelChrome},
|
|
220
|
-
* returned as `ParsedPanel.chrome` when the frame carries any
|
|
221
|
-
|
|
234
|
+
* returned as `ParsedPanel.chrome` when the frame carries any, and the
|
|
235
|
+
* notices of a legend text drawn clipped as `notices` when there are any. */
|
|
236
|
+
export declare function parseWrunPanelFrame(raw: string, slot: string, declaration: WrunPanel): WrunParsedPanelFrame;
|
|
237
|
+
/** A parsed panel frame's notices (a legend text drawn clipped to its cap), a
|
|
238
|
+
* fresh array, empty when the frame drew as written: the panel's share of a
|
|
239
|
+
* run result's `notices`, the warning rows the Indicator's legend shows. It
|
|
240
|
+
* takes the `ParsedPanel` a panel child carries; the lines ride the object
|
|
241
|
+
* parseWrunPanelFrame returned. */
|
|
242
|
+
export declare function wrunPanelFrameNotices(frame: ParsedPanel): string[];
|
|
222
243
|
export declare function parseWrunLadderFrame(raw: string, slot: string): WrunLadderFrame;
|
|
223
244
|
export declare function parseWrunFeedFrame(raw: string, slot: string): WrunFeedFrame;
|
|
224
245
|
/** Parses a matrix frame through the kit's grammar (`WrunMatrixFrameSchema`:
|
|
@@ -424,7 +424,7 @@ const ALL_PANEL_KINDS = [
|
|
|
424
424
|
];
|
|
425
425
|
const AXIS_PANEL_KINDS = ['line', 'bars', 'histogram', 'scatter'];
|
|
426
426
|
/** Which kinds take each frame key; x_min / x_max also need x "index" or
|
|
427
|
-
* "number" on a line, like the declared words. */
|
|
427
|
+
* "number" on a line, like the declared words, and x_labels x "number" (C3). */
|
|
428
428
|
export const WRUN_PANEL_FRAME_WORD_KINDS = {
|
|
429
429
|
title: ALL_PANEL_KINDS,
|
|
430
430
|
caption: ALL_PANEL_KINDS,
|
|
@@ -443,6 +443,7 @@ export const WRUN_PANEL_FRAME_WORD_KINDS = {
|
|
|
443
443
|
hole_text: ['pie'],
|
|
444
444
|
hole_caption: ['pie'],
|
|
445
445
|
markets: ['table'],
|
|
446
|
+
x_labels: ['line', 'bars'],
|
|
446
447
|
};
|
|
447
448
|
const PANEL_FRAME_WORDS = Object.keys(WRUN_PANEL_FRAME_WORD_KINDS);
|
|
448
449
|
/** The frame keys this panel's kind accepts beside `rows`. */
|
|
@@ -471,6 +472,40 @@ const RICH_CHROME_MESSAGE = "needs chrome 'grid' or 'none' on a time, category o
|
|
|
471
472
|
function panelText(value, key, max, at, path) {
|
|
472
473
|
return text(value, max) ? value : at(path, `${key} must be 1 to ${max} characters`);
|
|
473
474
|
}
|
|
475
|
+
/** A panel's legend text (a frame `title`, `caption` or `hole_caption`).
|
|
476
|
+
* Past its cap it draws clipped and `clipped` records it: the OPRA QA OI
|
|
477
|
+
* Changes frame (2026-10-22) lost its whole panel to an 88-character
|
|
478
|
+
* caption. An empty or non-text value still refuses, with the kit's message. */
|
|
479
|
+
function panelClippedText(value, key, max, at, clipped) {
|
|
480
|
+
if (typeof value !== 'string' || value.length < 1)
|
|
481
|
+
return at([key], `${key} must be 1 to ${max} characters`);
|
|
482
|
+
if (value.length <= max)
|
|
483
|
+
return value;
|
|
484
|
+
clipped(key, value.length, max);
|
|
485
|
+
return clipText(value, max);
|
|
486
|
+
}
|
|
487
|
+
/** `value` cut to `max` UTF-16 units (the caps' unit: the kit counts string
|
|
488
|
+
* length) with an ellipsis as the last one, never splitting a surrogate pair. */
|
|
489
|
+
function clipText(value, max) {
|
|
490
|
+
let end = max - 1;
|
|
491
|
+
const last = value.charCodeAt(end - 1);
|
|
492
|
+
if (last >= 0xd800 && last <= 0xdbff)
|
|
493
|
+
end -= 1;
|
|
494
|
+
return `${value.slice(0, end)}…`;
|
|
495
|
+
}
|
|
496
|
+
/** C3 `x_labels`: one entry per row, "" for a row without a label. The count
|
|
497
|
+
* against the rows waits for the row parse (parseWrunPanelFrame). */
|
|
498
|
+
function xLabelsRowsMessage(rows) {
|
|
499
|
+
const count = rows === undefined ? '' : ` (${rows})`;
|
|
500
|
+
return `x_labels must hold one entry per row${count}, "" for a row without a label`;
|
|
501
|
+
}
|
|
502
|
+
function panelXLabels(value, at) {
|
|
503
|
+
if (!Array.isArray(value))
|
|
504
|
+
return at(['x_labels'], xLabelsRowsMessage());
|
|
505
|
+
return value.map((label, i) => text(label, WRUN_PANEL_MAX_LABEL_CHARS, 0)
|
|
506
|
+
? label
|
|
507
|
+
: at(['x_labels', i], `x_labels entries must be 0 to ${WRUN_PANEL_MAX_LABEL_CHARS} characters`));
|
|
508
|
+
}
|
|
474
509
|
function panelNumber(value, key, at, path) {
|
|
475
510
|
return finite(value) ? value : at(path, `${key} must be a finite number`);
|
|
476
511
|
}
|
|
@@ -670,9 +705,13 @@ function effectivePanelChrome(panel) {
|
|
|
670
705
|
* x_max on a numeric line or a scatter, the box-line rule on markers,
|
|
671
706
|
* category marker keys, a point marker's series among the declared ones
|
|
672
707
|
* (C3), the paired ranges (a frame half against the declared other half),
|
|
673
|
-
* hole text needs a hole. */
|
|
708
|
+
* hole text needs a hole, x_labels needs x "number" (C3). */
|
|
674
709
|
function refinePanelChrome(panel, chrome, at) {
|
|
675
710
|
const numeric = panel.x === 'index' || panel.x === 'number';
|
|
711
|
+
// A label stands in for a row's x number, so only a numeric x has one to replace.
|
|
712
|
+
if (chrome.x_labels !== undefined && panel.x !== 'number') {
|
|
713
|
+
at(['x_labels'], "x_labels is only valid for a line or bars with x 'number'");
|
|
714
|
+
}
|
|
676
715
|
for (const word of ['x_min', 'x_max']) {
|
|
677
716
|
if (chrome[word] !== undefined && panel.kind !== 'scatter' && !numeric) {
|
|
678
717
|
at([word], `${word} is only valid for a line with x 'index' or 'number', and scatter`);
|
|
@@ -714,9 +753,13 @@ function refinePanelChrome(panel, chrome, at) {
|
|
|
714
753
|
* any key outside the kind's words refuses by name, each value goes
|
|
715
754
|
* through its declared word's ranges, then the cross rules against the
|
|
716
755
|
* declaration. Returns the parsed chrome (empty when the frame carries
|
|
717
|
-
* only rows)
|
|
718
|
-
export function parseWrunPanelChrome(frame, declaration, slot) {
|
|
756
|
+
* only rows); a legend text drawn clipped adds its line to `notices`. */
|
|
757
|
+
export function parseWrunPanelChrome(frame, declaration, slot, notices) {
|
|
719
758
|
const at = refuser(slot);
|
|
759
|
+
// The panel's name leads the line, as a TPO's does in the canvas notices.
|
|
760
|
+
const clipped = (key, written, max) => {
|
|
761
|
+
notices?.push(`panel '${declaration.name}': ${key} clipped from ${written} to ${max} characters`);
|
|
762
|
+
};
|
|
720
763
|
const allowed = wrunPanelFrameWords(declaration.kind);
|
|
721
764
|
for (const key of Object.keys(frame)) {
|
|
722
765
|
if (key !== 'rows' && !allowed.includes(key)) {
|
|
@@ -730,10 +773,10 @@ export function parseWrunPanelChrome(frame, declaration, slot) {
|
|
|
730
773
|
continue;
|
|
731
774
|
switch (word) {
|
|
732
775
|
case 'title':
|
|
733
|
-
chrome.title =
|
|
776
|
+
chrome.title = panelClippedText(value, word, WRUN_PANEL_MAX_TITLE_CHARS, at, clipped);
|
|
734
777
|
break;
|
|
735
778
|
case 'caption':
|
|
736
|
-
chrome.caption =
|
|
779
|
+
chrome.caption = panelClippedText(value, word, WRUN_PANEL_MAX_CAPTION_CHARS, at, clipped);
|
|
737
780
|
break;
|
|
738
781
|
case 'badge':
|
|
739
782
|
chrome.badge = panelBadge(value, at);
|
|
@@ -762,8 +805,13 @@ export function parseWrunPanelChrome(frame, declaration, slot) {
|
|
|
762
805
|
chrome.summary = panelSummary(value, at);
|
|
763
806
|
break;
|
|
764
807
|
case 'hole_text':
|
|
808
|
+
chrome.hole_text = panelText(value, word, WRUN_PANEL_MAX_LABEL_CHARS, at, [word]);
|
|
809
|
+
break;
|
|
765
810
|
case 'hole_caption':
|
|
766
|
-
chrome
|
|
811
|
+
chrome.hole_caption = panelClippedText(value, word, WRUN_PANEL_MAX_LABEL_CHARS, at, clipped);
|
|
812
|
+
break;
|
|
813
|
+
case 'x_labels':
|
|
814
|
+
chrome.x_labels = panelXLabels(value, at);
|
|
767
815
|
break;
|
|
768
816
|
case 'markets': {
|
|
769
817
|
// The entries here; their count against the rows once the rows parsed (parseWrunPanelFrame).
|
|
@@ -782,10 +830,12 @@ export function parseWrunPanelChrome(frame, declaration, slot) {
|
|
|
782
830
|
/** Parses a panel frame: `rows` through the receive-lane validator (one row
|
|
783
831
|
* grammar on both lanes; the wrun lane carries the declaration's style
|
|
784
832
|
* words) plus the kind's chrome keys through {@link parseWrunPanelChrome},
|
|
785
|
-
* returned as `ParsedPanel.chrome` when the frame carries any
|
|
833
|
+
* returned as `ParsedPanel.chrome` when the frame carries any, and the
|
|
834
|
+
* notices of a legend text drawn clipped as `notices` when there are any. */
|
|
786
835
|
export function parseWrunPanelFrame(raw, slot, declaration) {
|
|
787
836
|
const frame = decodeFrame(raw, slot);
|
|
788
|
-
const
|
|
837
|
+
const notices = [];
|
|
838
|
+
const chrome = parseWrunPanelChrome(frame, declaration, slot, notices);
|
|
789
839
|
if (!('rows' in frame))
|
|
790
840
|
refuser(slot)(['rows'], 'a panel frame must be an object with rows');
|
|
791
841
|
const { name: _name, frame: _frame, ...panel } = declaration;
|
|
@@ -808,7 +858,20 @@ export function parseWrunPanelFrame(raw, slot, declaration) {
|
|
|
808
858
|
if (chrome.markets !== undefined && chrome.markets.length !== result.data.rows.length) {
|
|
809
859
|
refuser(slot)(['markets'], wrunRowMarketsLengthMessage('row', result.data.rows.length));
|
|
810
860
|
}
|
|
811
|
-
|
|
861
|
+
if (chrome.x_labels !== undefined && chrome.x_labels.length !== result.data.rows.length) {
|
|
862
|
+
refuser(slot)(['x_labels'], xLabelsRowsMessage(result.data.rows.length));
|
|
863
|
+
}
|
|
864
|
+
const parsed = Object.keys(chrome).length > 0 ? { ...result.data, chrome } : result.data;
|
|
865
|
+
return notices.length > 0 ? { ...parsed, notices } : parsed;
|
|
866
|
+
}
|
|
867
|
+
/** A parsed panel frame's notices (a legend text drawn clipped to its cap), a
|
|
868
|
+
* fresh array, empty when the frame drew as written: the panel's share of a
|
|
869
|
+
* run result's `notices`, the warning rows the Indicator's legend shows. It
|
|
870
|
+
* takes the `ParsedPanel` a panel child carries; the lines ride the object
|
|
871
|
+
* parseWrunPanelFrame returned. */
|
|
872
|
+
export function wrunPanelFrameNotices(frame) {
|
|
873
|
+
const { notices } = frame;
|
|
874
|
+
return notices !== undefined ? [...notices] : [];
|
|
812
875
|
}
|
|
813
876
|
// ---------------------------------------------------------------------------
|
|
814
877
|
// Ladder and feed frames (g3 DW15, DW38)
|
|
@@ -224,9 +224,10 @@ export declare function wrunDrawStylePropClears(spec: WrunDrawStylePropSpec): bo
|
|
|
224
224
|
* polygon fill) and a line's fill toward its `fill_to` line (`fillColor`,
|
|
225
225
|
* on the wire only while a target is set; alpha is the fill's opacity);
|
|
226
226
|
* `border` is a label's `border`; `glow` is every kind's `glowColor`;
|
|
227
|
-
* `emblem` a label's `emblemColor`; `gradient_end` a box's
|
|
228
|
-
* [
|
|
229
|
-
*
|
|
227
|
+
* `emblem` a label's `emblemColor`; `gradient_end` a box's or (since kit
|
|
228
|
+
* scaffold 104) a polyline's `gradient: [its fill at the call, end]` (a
|
|
229
|
+
* box's `backgroundColor`, a polyline's `fillColor`; and `gradientDirection:
|
|
230
|
+
* "vertical"` when unset); `text` a box's `textColor`. */
|
|
230
231
|
export declare const WRUN3_COLOR_PROPS: {
|
|
231
232
|
readonly stroke: 0;
|
|
232
233
|
readonly fill: 1;
|
|
@@ -495,6 +496,9 @@ export interface WrunHandlePolylineLookProps {
|
|
|
495
496
|
opacity?: number;
|
|
496
497
|
zOrder?: number;
|
|
497
498
|
fillColor?: string;
|
|
499
|
+
/** Colour prop 5 and style prop 26 (DW34 on a polyline, kit scaffold 104). */
|
|
500
|
+
gradient?: string[];
|
|
501
|
+
gradientDirection?: WrunHandleGradientDirection;
|
|
498
502
|
closed?: true;
|
|
499
503
|
smooth?: true;
|
|
500
504
|
arrow?: WrunHandleArrow;
|
|
@@ -284,7 +284,7 @@ export const WRUN3_STYLE_PROP_SPECS = [
|
|
|
284
284
|
{
|
|
285
285
|
prop: WRUN3_STYLE_PROPS.gradient_direction,
|
|
286
286
|
name: 'gradient_direction',
|
|
287
|
-
kinds: ['box'],
|
|
287
|
+
kinds: ['box', 'polyline'],
|
|
288
288
|
integer: true,
|
|
289
289
|
words: WRUN_GRADIENT_DIRECTIONS,
|
|
290
290
|
},
|
|
@@ -322,9 +322,10 @@ export function wrunDrawStylePropClears(spec) {
|
|
|
322
322
|
* polygon fill) and a line's fill toward its `fill_to` line (`fillColor`,
|
|
323
323
|
* on the wire only while a target is set; alpha is the fill's opacity);
|
|
324
324
|
* `border` is a label's `border`; `glow` is every kind's `glowColor`;
|
|
325
|
-
* `emblem` a label's `emblemColor`; `gradient_end` a box's
|
|
326
|
-
* [
|
|
327
|
-
*
|
|
325
|
+
* `emblem` a label's `emblemColor`; `gradient_end` a box's or (since kit
|
|
326
|
+
* scaffold 104) a polyline's `gradient: [its fill at the call, end]` (a
|
|
327
|
+
* box's `backgroundColor`, a polyline's `fillColor`; and `gradientDirection:
|
|
328
|
+
* "vertical"` when unset); `text` a box's `textColor`. */
|
|
328
329
|
export const WRUN3_COLOR_PROPS = {
|
|
329
330
|
stroke: 0,
|
|
330
331
|
fill: 1,
|
|
@@ -341,7 +342,7 @@ export const WRUN3_COLOR_PROP_SPECS = [
|
|
|
341
342
|
{ prop: WRUN3_COLOR_PROPS.border, name: 'border', kinds: ['label'] },
|
|
342
343
|
{ prop: WRUN3_COLOR_PROPS.glow, name: 'glow', kinds: ['line', 'box', 'label', 'polyline'] },
|
|
343
344
|
{ prop: WRUN3_COLOR_PROPS.emblem, name: 'emblem', kinds: ['label'] },
|
|
344
|
-
{ prop: WRUN3_COLOR_PROPS.gradient_end, name: 'gradient_end', kinds: ['box'] },
|
|
345
|
+
{ prop: WRUN3_COLOR_PROPS.gradient_end, name: 'gradient_end', kinds: ['box', 'polyline'] },
|
|
345
346
|
{ prop: WRUN3_COLOR_PROPS.text, name: 'text', kinds: ['box'] },
|
|
346
347
|
];
|
|
347
348
|
/** Caps: a breach refuses the evaluation by name, never drops or truncates.
|
|
@@ -1920,8 +1921,8 @@ function applyStyle(kind, spec, value, slotText, props) {
|
|
|
1920
1921
|
* fill keys, a label's background, a polyline's polygon fill, and a line's
|
|
1921
1922
|
* fill half (kept raw, on the wire only beside its fill_to target); border,
|
|
1922
1923
|
* glow, emblem and text land on their own keys; gradient_end snapshots the
|
|
1923
|
-
*
|
|
1924
|
-
* direction to vertical. */
|
|
1924
|
+
* fill colour at the call (a box's backgroundColor, a polyline's fillColor)
|
|
1925
|
+
* as the first stop and defaults the direction to vertical. */
|
|
1925
1926
|
function applyColor(kind, spec, color, props) {
|
|
1926
1927
|
switch (spec.name) {
|
|
1927
1928
|
case 'stroke':
|
|
@@ -1952,7 +1953,7 @@ function applyColor(kind, spec, color, props) {
|
|
|
1952
1953
|
props.emblemColor = color;
|
|
1953
1954
|
break;
|
|
1954
1955
|
case 'gradient_end':
|
|
1955
|
-
props.gradient = [props.backgroundColor, color];
|
|
1956
|
+
props.gradient = [kind === 'polyline' ? props.fillColor : props.backgroundColor, color];
|
|
1956
1957
|
if (props.gradientDirection === undefined)
|
|
1957
1958
|
props.gradientDirection = 'vertical';
|
|
1958
1959
|
break;
|
|
@@ -37,7 +37,13 @@ export interface WrunHostedRunLevel {
|
|
|
37
37
|
/** The reply's OPRA mark (UW-PARITY contract opra-server-lanes 10b): true when the run's plan reads OPRA, on every
|
|
38
38
|
* frame of such a run. Only the JSON boolean `true` counts; anything else reads as absent. */
|
|
39
39
|
wrunOpra?: true;
|
|
40
|
+
/** The receipt of the OPRA rows the frame was computed from (contract opra-server-lanes C4): the tier the gate
|
|
41
|
+
* served (`wrunOpraTier`, `realtime` or `delayed`), read only beside the mark; any other word reads as absent. */
|
|
42
|
+
wrunOpraTier?: 'realtime' | 'delayed';
|
|
43
|
+
/** That tier's delay in seconds (`wrunOpraDelaySeconds`, a finite number from 0), read only beside a tier. */
|
|
44
|
+
wrunOpraDelaySeconds?: number;
|
|
40
45
|
}
|
|
41
46
|
/** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it (the OPRA mark only as
|
|
42
|
-
* the boolean `true
|
|
47
|
+
* the boolean `true`, its receipt only beside it), never a key inside `wrunHost`. A reply that is not a record
|
|
48
|
+
* carries none. */
|
|
43
49
|
export declare function readWrunHostedRunLevel(output: unknown): WrunHostedRunLevel;
|
|
@@ -7,7 +7,8 @@ export async function readWrunHostedWire(output) {
|
|
|
7
7
|
return decodeWrunHostedWire(output);
|
|
8
8
|
}
|
|
9
9
|
/** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it (the OPRA mark only as
|
|
10
|
-
* the boolean `true
|
|
10
|
+
* the boolean `true`, its receipt only beside it), never a key inside `wrunHost`. A reply that is not a record
|
|
11
|
+
* carries none. */
|
|
11
12
|
export function readWrunHostedRunLevel(output) {
|
|
12
13
|
if (!isRecord(output))
|
|
13
14
|
return {};
|
|
@@ -20,8 +21,17 @@ export function readWrunHostedRunLevel(output) {
|
|
|
20
21
|
if (Object.hasOwn(output, 'wrunServedLegs') && output.wrunServedLegs !== undefined) {
|
|
21
22
|
level.wrunServedLegs = output.wrunServedLegs;
|
|
22
23
|
}
|
|
23
|
-
if (Object.hasOwn(output, 'wrunOpra') && output.wrunOpra === true)
|
|
24
|
+
if (Object.hasOwn(output, 'wrunOpra') && output.wrunOpra === true) {
|
|
24
25
|
level.wrunOpra = true;
|
|
26
|
+
// The frame's receipt rides the mark alone: a tier without the mark names rows the run never read.
|
|
27
|
+
const tier = Object.hasOwn(output, 'wrunOpraTier') ? output.wrunOpraTier : undefined;
|
|
28
|
+
if (tier === 'realtime' || tier === 'delayed') {
|
|
29
|
+
level.wrunOpraTier = tier;
|
|
30
|
+
const delay = Object.hasOwn(output, 'wrunOpraDelaySeconds') ? output.wrunOpraDelaySeconds : undefined;
|
|
31
|
+
if (typeof delay === 'number' && Number.isFinite(delay) && delay >= 0)
|
|
32
|
+
level.wrunOpraDelaySeconds = delay;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
25
35
|
return level;
|
|
26
36
|
}
|
|
27
37
|
function isRecord(value) {
|