@orangecharts/wrun-chart-host 0.15.0 → 0.17.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/economic.constants.d.ts +2 -0
- package/dist/constants/economic.constants.js +2 -0
- package/dist/constants/feature-flags.constants.d.ts +13 -5
- package/dist/constants/feature-flags.constants.js +76 -35
- package/dist/constants/feature-limits.constants.d.ts +72 -4
- package/dist/constants/feature-limits.constants.js +104 -24
- package/dist/constants/interval.constants.js +5 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +12 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +14 -0
- package/dist/constants/marketCapabilities.constants.d.ts +9 -0
- package/dist/constants/marketCapabilities.constants.js +39 -11
- package/dist/constants/typed-indicator-source.leaf.d.ts +7 -0
- package/dist/constants/typed-indicator-source.leaf.js +47 -0
- package/dist/constants/typed-session-history-venue.leaf.d.ts +7 -0
- package/dist/constants/typed-session-history-venue.leaf.js +9 -0
- package/dist/constants/typed-width-fold.leaf.d.ts +52 -0
- package/dist/constants/typed-width-fold.leaf.js +101 -0
- package/dist/constants/typed-width-source.leaf.d.ts +24 -0
- package/dist/constants/typed-width-source.leaf.js +126 -0
- package/dist/constants/typed-width.leaf.d.ts +57 -0
- package/dist/constants/typed-width.leaf.js +78 -0
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +7 -0
- package/dist/host-ports.types.d.ts +23 -17
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +35 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +66 -3
- package/dist/interfaces/wrun-runtime.interface.js +11 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
- package/dist/market-data/billing.interface.d.ts +12 -45
- package/dist/market-data/billing.interface.js +2 -2
- package/dist/replay/replayLadder.js +7 -4
- package/dist/settings-templates/footprint-rows.d.ts +6 -0
- package/dist/settings-templates/footprint-rows.js +6 -0
- package/dist/settings-templates/frvp-fields.js +14 -0
- package/dist/settings-templates/indicator-fields.js +36 -0
- package/dist/settings-templates/tool-tables.generated.js +19 -1
- package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
- package/dist/utility/chart/cache-alignment.util.js +88 -18
- package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
- package/dist/utility/chart/calendar-interval.util.js +152 -4
- package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
- package/dist/utility/chart/candle-bar-end.util.js +17 -6
- package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
- package/dist/utility/chart/chart-time-domain.util.js +13 -4
- package/dist/utility/chart/feed-interval.util.d.ts +4 -2
- package/dist/utility/chart/feed-interval.util.js +5 -2
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
- package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
- package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
- package/dist/utility/chart/footprint-display-mode.util.js +5 -0
- package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
- package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
- package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
- package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
- package/dist/utility/chart/history-wall.util.d.ts +13 -2
- package/dist/utility/chart/history-wall.util.js +11 -4
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +2 -2
- package/dist/utility/chart/index-mode.util.js +12 -6
- package/dist/utility/chart/index-otc.leaf.d.ts +37 -0
- package/dist/utility/chart/index-otc.leaf.js +68 -0
- package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
- package/dist/utility/chart/interval-ladder.util.js +44 -4
- package/dist/utility/chart/interval-registry.util.d.ts +22 -1
- package/dist/utility/chart/interval-registry.util.js +50 -2
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
- package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
- package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
- package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
- package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
- package/dist/utility/chart/live-bucket.util.d.ts +29 -4
- package/dist/utility/chart/live-bucket.util.js +45 -12
- package/dist/utility/chart/market-session-schedule.util.d.ts +19 -0
- package/dist/utility/chart/market-session-schedule.util.js +2 -1
- package/dist/utility/chart/market-session.util.d.ts +62 -10
- package/dist/utility/chart/market-session.util.js +93 -13
- package/dist/utility/chart/marketKind.util.d.ts +11 -12
- package/dist/utility/chart/marketKind.util.js +45 -13
- package/dist/utility/chart/mixed-mode.util.d.ts +18 -0
- package/dist/utility/chart/om-target.util.js +6 -4
- package/dist/utility/chart/price-precision.util.d.ts +20 -6
- package/dist/utility/chart/price-precision.util.js +34 -7
- package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
- package/dist/utility/chart/profile-frame-window.util.js +12 -0
- package/dist/utility/chart/rth-session.util.d.ts +3 -1
- package/dist/utility/chart/rth-session.util.js +3 -1
- package/dist/utility/chart/script-source-session.util.d.ts +43 -0
- package/dist/utility/chart/script-source-session.util.js +61 -0
- package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
- package/dist/utility/chart/typed-width-grid.util.js +203 -0
- package/dist/utility/common/transformations.util.d.ts +6 -0
- package/dist/utility/common/transformations.util.js +28 -4
- package/dist/utility/market-events/market-events.util.js +3 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +22 -4
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +115 -0
- package/dist/utility/v2/v2-enums.leaf.js +5 -0
- package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +2 -1
- package/dist/utility/wrun/sources/row-lanes/dark_pool.js +4 -3
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +96 -17
- package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-canvases.util.js +7 -12
- package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
- package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-card-style.util.js +2 -2
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +23 -8
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +24 -9
- package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
- package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
- package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
- package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +10 -6
- package/dist/utility/wrun/wrun-cme-root-specs.util.js +19 -13
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
- package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
- package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
- package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
- package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
- package/dist/utility/wrun/wrun-frames.d.ts +1 -1
- package/dist/utility/wrun/wrun-frames.js +2 -2
- package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-handles.util.js +1 -1
- package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
- package/dist/utility/wrun/wrun-host.service.js +44 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
- package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
- package/dist/utility/wrun/wrun-live-tick.util.js +64 -5
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +40 -6
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +10 -8
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +17 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +318 -55
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-pin-venues.util.js +11 -4
- package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-refusal.util.js +102 -13
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
- package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
- package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
- package/dist/utility/wrun/wrun-run-health.util.js +1 -1
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
- package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
- package/dist/utility/wrun/wrun-session-composition.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-session-composition.util.js +3 -2
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
- package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
- package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
- package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
- package/dist/utility/wrun/wrun-style-words.util.js +46 -15
- package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
- package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
- package/dist/utility/wrun-display-name.util.d.ts +10 -0
- package/dist/utility/wrun-display-name.util.js +21 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
- package/dist/utils/replay/replay-buffer-math.js +2 -0
- package/dist/workers/constants/socket-slots.d.ts +1 -1
- package/dist/workers/utils/time.worker.util.js +2 -2
- package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
- package/dist/workers/utils/volume-profile.worker.util.js +20 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
- package/dist/workers/wrun/wrun-abi-host.js +82 -5
- package/dist/workers/wrun/wrun-engine-handler.js +53 -4
- package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
- package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
- package/package.json +11 -11
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
* (CME_ROOT_SPECS), an economic venue 6. A crypto venue settles
|
|
24
24
|
* no kind on its own (it lists stock, ETF and metal perpetuals
|
|
25
25
|
* too), so a coin there reads 1 once the row answers, 0 before.
|
|
26
|
-
* point_value the CME contract's point value (CME_ROOT_SPECS
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* point_value the CME contract's point value (CME_ROOT_SPECS: US
|
|
27
|
+
* dollars per whole point of the quoted price on every
|
|
28
|
+
* root, ZC 50 for a cent of corn; 0 for a root off the
|
|
29
|
+
* table and for an option contract); 0 on ICE and
|
|
29
30
|
* PLATTS, whose multipliers the chart does not hold; 1 on every
|
|
30
31
|
* other market the chart serves, all priced per unit (spot,
|
|
31
32
|
* perpetuals, stocks, ETFs, forex, indices, metals, prediction
|
|
@@ -114,6 +115,11 @@ export interface WrunMarketDirectoryRow {
|
|
|
114
115
|
coin?: unknown;
|
|
115
116
|
underlyingSymbol?: unknown;
|
|
116
117
|
}
|
|
118
|
+
/** om `packages/cli/src/shared/session-venues.ts` CME_FAMILY_EXCHANGES (the
|
|
119
|
+
* chart's governed codes, isCmeGoverned, are all in it). Exported read-only for
|
|
120
|
+
* the point value golden (src/fixtures/wrun-cme-point-values/golden.json), which
|
|
121
|
+
* states the venues a CME root's point value answers on. */
|
|
122
|
+
export declare const CME_FAMILY_EXCHANGES: ReadonlySet<string>;
|
|
117
123
|
export { CME_ROOT_SPECS, type CmeRootSpec } from './wrun-cme-root-specs.util.js';
|
|
118
124
|
/** The CME Group exchange a futures root lists on (`CME_ROOT_SPECS`), or undefined for a root off the table. */
|
|
119
125
|
export declare function wrunCmeRootExchange(root: string): CmeExchangeDto | undefined;
|
|
@@ -137,8 +143,8 @@ export declare const WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE = "wrun_dollar_multipl
|
|
|
137
143
|
* chart's own exchange and the venue table:
|
|
138
144
|
*
|
|
139
145
|
* CME a CME-governed chart reads the chain of its own root: the root's point value (CME_ROOT_SPECS, ES 50,
|
|
140
|
-
* NQ 20) when the root is
|
|
141
|
-
* grain
|
|
146
|
+
* NQ 20) when the root is priced in US dollars (wrunCmeRootDollarPointValue); a root off the table, or a
|
|
147
|
+
* CBOT grain (priced in US cents, kept off the dollar features), is 0.
|
|
142
148
|
* OPRA a chart whose options list on OPRA (the venue table over the options seam's market, `optionsExchange`
|
|
143
149
|
* else the chart's own: an OPRA contract chart, a US stock or ETF chart, a stock twin while the opra flag
|
|
144
150
|
* is lit): 100.
|
|
@@ -331,14 +337,23 @@ export declare function wrunMarketFactsSettled(market: WrunFactsMarket | undefin
|
|
|
331
337
|
* warmWrunMarketDollarFacts settled; 0 while it is not proven). Every word is
|
|
332
338
|
* written on every market, 0 included, so the block keeps one shape. */
|
|
333
339
|
export declare function wrunMarketFactsFor(market: WrunFactsMarket | undefined): WrunMarketFacts & WrunOptionFacts & WrunDollarFacts;
|
|
340
|
+
/**
|
|
341
|
+
* THE point value a strategy package's broker takes for `market` (`WrunStrategyRunInput.pointValue`, carried to the
|
|
342
|
+
* kit's `WrunStrategyHost` as its `pointValue`): the same fact `market.point_value()` reads (wrunMarketFactsFor), when
|
|
343
|
+
* it is a positive number other than 1. Undefined on a market with no point value (1: coins, shares; 0: unknown), so
|
|
344
|
+
* the broker keeps 1 there and its output carries no `declared.pointValue`. A size is then in contracts and every
|
|
345
|
+
* money figure the broker returns is price x size x this value.
|
|
346
|
+
*/
|
|
347
|
+
export declare function wrunStrategyPointValue(market: WrunFactsMarket | undefined): number | undefined;
|
|
334
348
|
/**
|
|
335
349
|
* What the instrument registry (StreamRegistryMetadatas, the metadata service's `getSymbolMetadata`) proves about one
|
|
336
350
|
* market's prices on every wire it rides, so the chart prices a print by the server's own facts, never by a table of
|
|
337
351
|
* ours or a venue list:
|
|
338
352
|
*
|
|
339
353
|
* pointValue the US dollars one whole point of price is worth on one contract of a point-valued product: every CME
|
|
340
|
-
* Group future (ES 50, 6A 100,000, ZN 1,000, and per US cent on the cents-
|
|
341
|
-
* 600), the number the large-print writer prices the table's copies
|
|
354
|
+
* Group future (ES 50, 6A 100,000, ZN 1,000, and per US cent on the cents-priced grains: ZC 50, ZL
|
|
355
|
+
* 600, the same numbers as CME_ROOT_SPECS), the number the large-print writer prices the table's copies
|
|
356
|
+
* with; null elsewhere. A
|
|
342
357
|
* point-valued product's stored amount is contracts and live-feed never multiplies it, so its COIN arm
|
|
343
358
|
* is contracts too.
|
|
344
359
|
* quote the quote asset its normalized symbol names (`BTC-USDT` quotes USDT).
|
|
@@ -397,7 +412,7 @@ export type WrunMarketDollarUnit = {
|
|
|
397
412
|
*
|
|
398
413
|
* - A CME Group contract counts contracts on the COIN arm (live-feed never multiplies a point-valued product), so its
|
|
399
414
|
* unit is the instrument registry's point value, in US dollars per point (`warmWrunMarketTradeUnits`: ES 50, 6A
|
|
400
|
-
* 100,000, a cents-
|
|
415
|
+
* 100,000, a cents-priced grain per cent, ZC 50 and ZL 600), the number the large-print writer prices the table's
|
|
401
416
|
* copies with. An option contract, or a contract the registry holds no point value for, cannot be priced.
|
|
402
417
|
* - Every other market counts its base asset on the COIN arm (live-feed applied each instrument's contract multiplier
|
|
403
418
|
* and its inverse flag), so its unit is the market facts' point value (1, `market.point_value()`; 0 on ICE and
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
* (CME_ROOT_SPECS), an economic venue 6. A crypto venue settles
|
|
24
24
|
* no kind on its own (it lists stock, ETF and metal perpetuals
|
|
25
25
|
* too), so a coin there reads 1 once the row answers, 0 before.
|
|
26
|
-
* point_value the CME contract's point value (CME_ROOT_SPECS
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* point_value the CME contract's point value (CME_ROOT_SPECS: US
|
|
27
|
+
* dollars per whole point of the quoted price on every
|
|
28
|
+
* root, ZC 50 for a cent of corn; 0 for a root off the
|
|
29
|
+
* table and for an option contract); 0 on ICE and
|
|
29
30
|
* PLATTS, whose multipliers the chart does not hold; 1 on every
|
|
30
31
|
* other market the chart serves, all priced per unit (spot,
|
|
31
32
|
* perpetuals, stocks, ETFs, forex, indices, metals, prediction
|
|
@@ -69,6 +70,7 @@ import { wrunChartHostEnv } from '../../host-env.js';
|
|
|
69
70
|
import { isCmeGoverned } from '../chart/cme-realtime.util.js';
|
|
70
71
|
import { isContinuousSymbol } from '../chart/continuous-contracts.util.js';
|
|
71
72
|
import { governedContractCoin } from '../chart/governed-contract-coin.util.js';
|
|
73
|
+
import { PUBLISHER_ONLY_EXCHANGES } from '../../constants/economic.constants.js';
|
|
72
74
|
import { checkIsEconomic, getMarketKind } from '../chart/marketKind.util.js';
|
|
73
75
|
import { optionsMarketUnderlyingVenue, optionVenueForExchange } from '../options/option-venue.util.js';
|
|
74
76
|
import { isPlainOptionContract } from '../options/option-trade-units.util.js';
|
|
@@ -129,8 +131,10 @@ const US_LISTING_EXCHANGES = new Set([
|
|
|
129
131
|
'CBOE.F',
|
|
130
132
|
]);
|
|
131
133
|
/** om `packages/cli/src/shared/session-venues.ts` CME_FAMILY_EXCHANGES (the
|
|
132
|
-
* chart's governed codes, isCmeGoverned, are all in it).
|
|
133
|
-
|
|
134
|
+
* chart's governed codes, isCmeGoverned, are all in it). Exported read-only for
|
|
135
|
+
* the point value golden (src/fixtures/wrun-cme-point-values/golden.json), which
|
|
136
|
+
* states the venues a CME root's point value answers on. */
|
|
137
|
+
export const CME_FAMILY_EXCHANGES = new Set([
|
|
134
138
|
'CME',
|
|
135
139
|
'CME_MINI',
|
|
136
140
|
'CBOT',
|
|
@@ -355,8 +359,8 @@ function cmeChainRoot(market) {
|
|
|
355
359
|
* chart's own exchange and the venue table:
|
|
356
360
|
*
|
|
357
361
|
* CME a CME-governed chart reads the chain of its own root: the root's point value (CME_ROOT_SPECS, ES 50,
|
|
358
|
-
* NQ 20) when the root is
|
|
359
|
-
* grain
|
|
362
|
+
* NQ 20) when the root is priced in US dollars (wrunCmeRootDollarPointValue); a root off the table, or a
|
|
363
|
+
* CBOT grain (priced in US cents, kept off the dollar features), is 0.
|
|
360
364
|
* OPRA a chart whose options list on OPRA (the venue table over the options seam's market, `optionsExchange`
|
|
361
365
|
* else the chart's own: an OPRA contract chart, a US stock or ETF chart, a stock twin while the opra flag
|
|
362
366
|
* is lit): 100.
|
|
@@ -762,7 +766,7 @@ class DirectoryIncomplete extends Error {
|
|
|
762
766
|
* the caller retries those after a minute, never settles them as absent. */
|
|
763
767
|
async function findDirectoryRow(venue, symbol) {
|
|
764
768
|
const exchange = Exchange[venue];
|
|
765
|
-
if (typeof exchange !== 'number')
|
|
769
|
+
if (typeof exchange !== 'number' || PUBLISHER_ONLY_EXCHANGES.has(venue))
|
|
766
770
|
return null;
|
|
767
771
|
const [{ default: metadataService }, { normalizeMarketSymbols }] = await Promise.all([
|
|
768
772
|
wrunChartHostEnv().market.loadMetadataService(),
|
|
@@ -836,6 +840,17 @@ export function wrunMarketFactsFor(market) {
|
|
|
836
840
|
dollarMultiplier: dollars.kind === 'dollars' ? dollars.unit : 0,
|
|
837
841
|
};
|
|
838
842
|
}
|
|
843
|
+
/**
|
|
844
|
+
* THE point value a strategy package's broker takes for `market` (`WrunStrategyRunInput.pointValue`, carried to the
|
|
845
|
+
* kit's `WrunStrategyHost` as its `pointValue`): the same fact `market.point_value()` reads (wrunMarketFactsFor), when
|
|
846
|
+
* it is a positive number other than 1. Undefined on a market with no point value (1: coins, shares; 0: unknown), so
|
|
847
|
+
* the broker keeps 1 there and its output carries no `declared.pointValue`. A size is then in contracts and every
|
|
848
|
+
* money figure the broker returns is price x size x this value.
|
|
849
|
+
*/
|
|
850
|
+
export function wrunStrategyPointValue(market) {
|
|
851
|
+
const { pointValue } = wrunMarketFactsFor(market);
|
|
852
|
+
return Number.isFinite(pointValue) && pointValue > 0 && pointValue !== 1 ? pointValue : undefined;
|
|
853
|
+
}
|
|
839
854
|
/** A registry field that is a finite number above zero, else null (absent, zero, negative or unreadable). */
|
|
840
855
|
function positiveUnit(value) {
|
|
841
856
|
const number = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : Number.NaN;
|
|
@@ -964,7 +979,7 @@ function wrunMarketQuoteInDollars(market, venue, row, units) {
|
|
|
964
979
|
*
|
|
965
980
|
* - A CME Group contract counts contracts on the COIN arm (live-feed never multiplies a point-valued product), so its
|
|
966
981
|
* unit is the instrument registry's point value, in US dollars per point (`warmWrunMarketTradeUnits`: ES 50, 6A
|
|
967
|
-
* 100,000, a cents-
|
|
982
|
+
* 100,000, a cents-priced grain per cent, ZC 50 and ZL 600), the number the large-print writer prices the table's
|
|
968
983
|
* copies with. An option contract, or a contract the registry holds no point value for, cannot be priced.
|
|
969
984
|
* - Every other market counts its base asset on the COIN arm (live-feed applied each instrument's contract multiplier
|
|
970
985
|
* and its inverse flag), so its unit is the market facts' point value (1, `market.point_value()`; 0 on ICE and
|
|
@@ -11,3 +11,13 @@ export declare function wrunChildOverlayParentId(id: string): string | null;
|
|
|
11
11
|
export declare function wrunChildHiddenRowKey(id: string): string | null;
|
|
12
12
|
/** True for a key wrunChildHiddenRowKey mints (a viewer row, never a param). */
|
|
13
13
|
export declare function isWrunChildHiddenRowKey(key: string): boolean;
|
|
14
|
+
/** The viewer row that keeps the height a reader dragged a child's pane to: `<kind>:<name>:gridHeight` on the OWNING
|
|
15
|
+
* Indicator's settings (`series:lower:gridHeight`), the pane's share of the chart. A child has no workspace row, so
|
|
16
|
+
* the one height writer (the store's saveGridHeights) writes it there and the child mount reads it back whenever it
|
|
17
|
+
* mounts the child (a layout or tab switch, a reload). Keyed past the owner id, which a draft swap may change. Null
|
|
18
|
+
* for any id that is no pane-owning child's. */
|
|
19
|
+
export declare function wrunChildPaneHeightRowKey(id: string): string | null;
|
|
20
|
+
/** True for a key wrunChildPaneHeightRowKey mints (a viewer row, never a param). */
|
|
21
|
+
export declare function isWrunChildPaneHeightRowKey(key: string): boolean;
|
|
22
|
+
/** The child overlay id a pane height row names under `overlayId`, null for any other key. */
|
|
23
|
+
export declare function wrunChildPaneHeightRowChildId(overlayId: string, key: string): string | null;
|
|
@@ -43,3 +43,27 @@ export function wrunChildHiddenRowKey(id) {
|
|
|
43
43
|
export function isWrunChildHiddenRowKey(key) {
|
|
44
44
|
return CHILD_HIDDEN_ROW_PATTERN.test(key);
|
|
45
45
|
}
|
|
46
|
+
/** The child kinds that own a pane below the chart a reader can drag: the mount sizes exactly these from a plan
|
|
47
|
+
* (wrun-panel-mount.util `ctx.planned`), so exactly these remember a dragged height. */
|
|
48
|
+
const CHILD_PANE_KIND_WORDS = { panel: true, series: true };
|
|
49
|
+
const CHILD_PANE_KINDS = `(?:${Object.keys(CHILD_PANE_KIND_WORDS).join('|')})`;
|
|
50
|
+
const CHILD_PANE_ID_PARTS = new RegExp(`^.+::(${CHILD_PANE_KINDS}:.+)$`);
|
|
51
|
+
const CHILD_PANE_HEIGHT_ROW_PATTERN = new RegExp(`^(${CHILD_PANE_KINDS}:.+):gridHeight$`);
|
|
52
|
+
/** The viewer row that keeps the height a reader dragged a child's pane to: `<kind>:<name>:gridHeight` on the OWNING
|
|
53
|
+
* Indicator's settings (`series:lower:gridHeight`), the pane's share of the chart. A child has no workspace row, so
|
|
54
|
+
* the one height writer (the store's saveGridHeights) writes it there and the child mount reads it back whenever it
|
|
55
|
+
* mounts the child (a layout or tab switch, a reload). Keyed past the owner id, which a draft swap may change. Null
|
|
56
|
+
* for any id that is no pane-owning child's. */
|
|
57
|
+
export function wrunChildPaneHeightRowKey(id) {
|
|
58
|
+
const child = CHILD_PANE_ID_PARTS.exec(id)?.[1];
|
|
59
|
+
return child === undefined ? null : `${child}:gridHeight`;
|
|
60
|
+
}
|
|
61
|
+
/** True for a key wrunChildPaneHeightRowKey mints (a viewer row, never a param). */
|
|
62
|
+
export function isWrunChildPaneHeightRowKey(key) {
|
|
63
|
+
return CHILD_PANE_HEIGHT_ROW_PATTERN.test(key);
|
|
64
|
+
}
|
|
65
|
+
/** The child overlay id a pane height row names under `overlayId`, null for any other key. */
|
|
66
|
+
export function wrunChildPaneHeightRowChildId(overlayId, key) {
|
|
67
|
+
const child = CHILD_PANE_HEIGHT_ROW_PATTERN.exec(key)?.[1];
|
|
68
|
+
return child === undefined ? null : `${overlayId}::${child}`;
|
|
69
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CME provenance of a hosted (Cloud) run, the twin of the OPRA mark (wrun-cloud-opra-stamp.util). One rule never
|
|
3
|
+
* opens with the governed-lanes cutover: no CME data reaches Kata or any AI feature, so every row a run derives from
|
|
4
|
+
* CME data carries the CME stamp (`settings.metaCmeExchange = 'CME'`, the key the hosted chart read, the MCP withhold
|
|
5
|
+
* and the governed-source inventory read), whatever lane or author produced it.
|
|
6
|
+
*
|
|
7
|
+
* A browser run is stamped by the chart's fetch door when it admits a CME source. A hosted run fetches nothing in the
|
|
8
|
+
* browser, so its result batch is stamped here before any of its rows lands (`integrateWrunRowSourceBatch`), by two
|
|
9
|
+
* readings joined (`wrunHostedRunReadsCme`):
|
|
10
|
+
*
|
|
11
|
+
* - the head mark: the chart is on the CME plane, or the sheet the run reads pins a CME market (the run head's
|
|
12
|
+
* `wrunSheetPinsCme`), read from the sheet and the chart alone;
|
|
13
|
+
* - the server mark: the reply's `output.wrunGoverned.cme` (the hosted wire's `wrunGoverned`, `readWrunGovernedMark`),
|
|
14
|
+
* which the batch carries as `governed` (`wrunBatchGovernedOf`): what the server knows the run read, even where the
|
|
15
|
+
* sheet shows no CME.
|
|
16
|
+
*
|
|
17
|
+
* Lane-blind and author-blind: a first-party hosted run that reads CME is stamped too. Fail closed: a host that binds
|
|
18
|
+
* no CME writer (`setOverlayCmeProvenance`), a writer that throws, a run that no longer owns its overlay, or a stamp the
|
|
19
|
+
* mounted overlay does not read back all fail the batch, so no unstamped CME row is integrated. The stamp is sticky for
|
|
20
|
+
* the mount, as the browser's is (cme-overlay-provenance.util): no result sheds it.
|
|
21
|
+
*/
|
|
22
|
+
import { type WrunGovernedMark } from './wrun-hosted-wire.util.js';
|
|
23
|
+
/** A batch as the stamp reads it: the server's governed-plane mark, when the source carries it. */
|
|
24
|
+
export interface WrunGovernedBatchFields {
|
|
25
|
+
/** The reply's `output.wrunGoverned`, as `readWrunGovernedMark` read it. */
|
|
26
|
+
governed?: WrunGovernedMark;
|
|
27
|
+
}
|
|
28
|
+
/** Whether a mounted overlay's settings carry the CME provenance stamp (cme-overlay-provenance.leaf
|
|
29
|
+
* `overlayCarriesCmeStamp`). */
|
|
30
|
+
export declare function wrunOverlayCmeStamped(meta: {
|
|
31
|
+
settings?: unknown;
|
|
32
|
+
} | null | undefined): boolean;
|
|
33
|
+
/** The server's governed-plane mark a batch carries, if any. */
|
|
34
|
+
export declare function wrunBatchGovernedOf(batch: object): WrunGovernedMark | undefined;
|
|
35
|
+
/** Whether the server's mark names the CME plane. */
|
|
36
|
+
export declare function wrunGovernedReadsCme(governed: WrunGovernedMark | undefined): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Carry the overlay's sticky governed-plane mark on a failure the socket row source rejects with (hidden, like a
|
|
39
|
+
* refusal record): the run pass reads it back (`wrunFailureGovernedOf`) so a failed run that read CME surfaces marked.
|
|
40
|
+
* A non-object failure, or no mark, is returned as it is.
|
|
41
|
+
*/
|
|
42
|
+
export declare function markWrunFailureGoverned<T>(error: T, mark: WrunGovernedMark | undefined): T;
|
|
43
|
+
/**
|
|
44
|
+
* The governed-plane mark a failure carries: the sticky mark the source attached (`markWrunFailureGoverned`), else the
|
|
45
|
+
* error frame's relayed `details.wrunGoverned` (wrun-hosted-wire-caps `wrunGovernedDetailsOfText`) read by the one
|
|
46
|
+
* fail-closed reader (`wrunGovernedMarkOf`), on the failure or any `cause` it wraps. Undefined: no mark anywhere.
|
|
47
|
+
*/
|
|
48
|
+
export declare function wrunFailureGovernedOf(error: unknown): WrunGovernedMark | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Read a failure's governed-plane mark (`wrunFailureGovernedOf`), then take the relayed governed trailer off the text
|
|
51
|
+
* of the failure and every `cause` it wraps, so every reader past it (the trap row, the refusal records, the console)
|
|
52
|
+
* reads the frame's words as before. Answers the mark.
|
|
53
|
+
*/
|
|
54
|
+
export declare function takeWrunFailureGoverned(error: unknown): WrunGovernedMark | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a hosted run's result read CME: the chart is on the CME plane, the sheet pins a CME market (`sheetPinsCme`,
|
|
57
|
+
* the run head's reading), or the server's mark names CME. Never the run's author or lane.
|
|
58
|
+
*/
|
|
59
|
+
export declare function wrunHostedRunReadsCme(args: {
|
|
60
|
+
chartExchange: unknown;
|
|
61
|
+
sheetPinsCme: boolean;
|
|
62
|
+
governed: WrunGovernedMark | undefined;
|
|
63
|
+
}): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Stamp the overlay a hosted run's CME result lands on, through the host's CME writer (`setOverlayCmeProvenance`, both
|
|
66
|
+
* settings copies), then read the stamp back off the mounted overlay. `owns` judges, in the same task as the write,
|
|
67
|
+
* that the run still owns its overlay (a replacement mounted under the same id is another overlay, never written).
|
|
68
|
+
* Answers whether the overlay carries the stamp now; false fails the batch (fail closed). Never clears.
|
|
69
|
+
*/
|
|
70
|
+
export declare function stampWrunHostedCme(chartIndex: number, indicatorId: string, meta: {
|
|
71
|
+
settings?: unknown;
|
|
72
|
+
}, owns: () => boolean): Promise<boolean>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CME provenance of a hosted (Cloud) run, the twin of the OPRA mark (wrun-cloud-opra-stamp.util). One rule never
|
|
3
|
+
* opens with the governed-lanes cutover: no CME data reaches Kata or any AI feature, so every row a run derives from
|
|
4
|
+
* CME data carries the CME stamp (`settings.metaCmeExchange = 'CME'`, the key the hosted chart read, the MCP withhold
|
|
5
|
+
* and the governed-source inventory read), whatever lane or author produced it.
|
|
6
|
+
*
|
|
7
|
+
* A browser run is stamped by the chart's fetch door when it admits a CME source. A hosted run fetches nothing in the
|
|
8
|
+
* browser, so its result batch is stamped here before any of its rows lands (`integrateWrunRowSourceBatch`), by two
|
|
9
|
+
* readings joined (`wrunHostedRunReadsCme`):
|
|
10
|
+
*
|
|
11
|
+
* - the head mark: the chart is on the CME plane, or the sheet the run reads pins a CME market (the run head's
|
|
12
|
+
* `wrunSheetPinsCme`), read from the sheet and the chart alone;
|
|
13
|
+
* - the server mark: the reply's `output.wrunGoverned.cme` (the hosted wire's `wrunGoverned`, `readWrunGovernedMark`),
|
|
14
|
+
* which the batch carries as `governed` (`wrunBatchGovernedOf`): what the server knows the run read, even where the
|
|
15
|
+
* sheet shows no CME.
|
|
16
|
+
*
|
|
17
|
+
* Lane-blind and author-blind: a first-party hosted run that reads CME is stamped too. Fail closed: a host that binds
|
|
18
|
+
* no CME writer (`setOverlayCmeProvenance`), a writer that throws, a run that no longer owns its overlay, or a stamp the
|
|
19
|
+
* mounted overlay does not read back all fail the batch, so no unstamped CME row is integrated. The stamp is sticky for
|
|
20
|
+
* the mount, as the browser's is (cme-overlay-provenance.util): no result sheds it.
|
|
21
|
+
*/
|
|
22
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
23
|
+
import { payloadTouchesCmeVenue } from '../chart/kscript-venue-policy.util.js';
|
|
24
|
+
import { wrunGovernedDetailsOfText, wrunTextWithoutGovernedTrailer } from './wrun-hosted-wire-caps.js';
|
|
25
|
+
import { wrunGovernedMarkOf } from './wrun-hosted-wire.util.js';
|
|
26
|
+
/** The provenance word a CME-stamped overlay carries (cme-overlay-provenance.leaf `CME_PROVENANCE`). */
|
|
27
|
+
const CME_PROVENANCE = 'CME';
|
|
28
|
+
/** Whether a mounted overlay's settings carry the CME provenance stamp (cme-overlay-provenance.leaf
|
|
29
|
+
* `overlayCarriesCmeStamp`). */
|
|
30
|
+
export function wrunOverlayCmeStamped(meta) {
|
|
31
|
+
const settings = meta?.settings;
|
|
32
|
+
return (typeof settings === 'object' &&
|
|
33
|
+
settings !== null &&
|
|
34
|
+
settings.metaCmeExchange === CME_PROVENANCE);
|
|
35
|
+
}
|
|
36
|
+
/** The server's governed-plane mark a batch carries, if any. */
|
|
37
|
+
export function wrunBatchGovernedOf(batch) {
|
|
38
|
+
const governed = batch.governed;
|
|
39
|
+
return typeof governed === 'object' && governed !== null ? governed : undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Whether the server's mark names the CME plane. */
|
|
42
|
+
export function wrunGovernedReadsCme(governed) {
|
|
43
|
+
return governed?.cme !== undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The key a failed ask's error carries its overlay's sticky governed-plane mark under (`markWrunFailureGoverned`). */
|
|
46
|
+
const FAILURE_GOVERNED_KEY = 'wrunGovernedFailureMark';
|
|
47
|
+
/** How deep a failure's `cause` chain is read for the mark (a transport wraps the frame's error once or twice). */
|
|
48
|
+
const FAILURE_CAUSE_DEPTH = 8;
|
|
49
|
+
/**
|
|
50
|
+
* Carry the overlay's sticky governed-plane mark on a failure the socket row source rejects with (hidden, like a
|
|
51
|
+
* refusal record): the run pass reads it back (`wrunFailureGovernedOf`) so a failed run that read CME surfaces marked.
|
|
52
|
+
* A non-object failure, or no mark, is returned as it is.
|
|
53
|
+
*/
|
|
54
|
+
export function markWrunFailureGoverned(error, mark) {
|
|
55
|
+
if (mark === undefined || typeof error !== 'object' || error === null)
|
|
56
|
+
return error;
|
|
57
|
+
try {
|
|
58
|
+
Object.defineProperty(error, FAILURE_GOVERNED_KEY, {
|
|
59
|
+
value: mark,
|
|
60
|
+
enumerable: false,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// A frozen failure keeps its text: the reader below still reads the relayed trailer off it.
|
|
67
|
+
}
|
|
68
|
+
return error;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The governed-plane mark a failure carries: the sticky mark the source attached (`markWrunFailureGoverned`), else the
|
|
72
|
+
* error frame's relayed `details.wrunGoverned` (wrun-hosted-wire-caps `wrunGovernedDetailsOfText`) read by the one
|
|
73
|
+
* fail-closed reader (`wrunGovernedMarkOf`), on the failure or any `cause` it wraps. Undefined: no mark anywhere.
|
|
74
|
+
*/
|
|
75
|
+
export function wrunFailureGovernedOf(error) {
|
|
76
|
+
let at = error;
|
|
77
|
+
for (let depth = 0; depth < FAILURE_CAUSE_DEPTH && at !== undefined && at !== null; depth += 1) {
|
|
78
|
+
if (typeof at === 'string')
|
|
79
|
+
return wrunGovernedMarkOf(wrunGovernedDetailsOfText(at));
|
|
80
|
+
if (typeof at !== 'object')
|
|
81
|
+
return undefined;
|
|
82
|
+
const held = at[FAILURE_GOVERNED_KEY];
|
|
83
|
+
if (typeof held === 'object' && held !== null)
|
|
84
|
+
return held;
|
|
85
|
+
const message = at.message;
|
|
86
|
+
const relayed = typeof message === 'string' ? wrunGovernedMarkOf(wrunGovernedDetailsOfText(message)) : undefined;
|
|
87
|
+
if (relayed !== undefined)
|
|
88
|
+
return relayed;
|
|
89
|
+
at = at.cause;
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Read a failure's governed-plane mark (`wrunFailureGovernedOf`), then take the relayed governed trailer off the text
|
|
95
|
+
* of the failure and every `cause` it wraps, so every reader past it (the trap row, the refusal records, the console)
|
|
96
|
+
* reads the frame's words as before. Answers the mark.
|
|
97
|
+
*/
|
|
98
|
+
export function takeWrunFailureGoverned(error) {
|
|
99
|
+
const mark = wrunFailureGovernedOf(error);
|
|
100
|
+
let at = error;
|
|
101
|
+
for (let depth = 0; depth < FAILURE_CAUSE_DEPTH && typeof at === 'object' && at !== null; depth += 1) {
|
|
102
|
+
const message = at.message;
|
|
103
|
+
if (typeof message === 'string') {
|
|
104
|
+
const stripped = wrunTextWithoutGovernedTrailer(message);
|
|
105
|
+
if (stripped !== message) {
|
|
106
|
+
try {
|
|
107
|
+
at.message = stripped;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// A read-only message keeps its text: the mark is read already.
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
at = at.cause;
|
|
115
|
+
}
|
|
116
|
+
return mark;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether a hosted run's result read CME: the chart is on the CME plane, the sheet pins a CME market (`sheetPinsCme`,
|
|
120
|
+
* the run head's reading), or the server's mark names CME. Never the run's author or lane.
|
|
121
|
+
*/
|
|
122
|
+
export function wrunHostedRunReadsCme(args) {
|
|
123
|
+
return payloadTouchesCmeVenue(args.chartExchange) || args.sheetPinsCme || wrunGovernedReadsCme(args.governed);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Stamp the overlay a hosted run's CME result lands on, through the host's CME writer (`setOverlayCmeProvenance`, both
|
|
127
|
+
* settings copies), then read the stamp back off the mounted overlay. `owns` judges, in the same task as the write,
|
|
128
|
+
* that the run still owns its overlay (a replacement mounted under the same id is another overlay, never written).
|
|
129
|
+
* Answers whether the overlay carries the stamp now; false fails the batch (fail closed). Never clears.
|
|
130
|
+
*/
|
|
131
|
+
export async function stampWrunHostedCme(chartIndex, indicatorId, meta, owns) {
|
|
132
|
+
let write;
|
|
133
|
+
try {
|
|
134
|
+
write = (await wrunChartHostEnv().chart.loadOptionsOverlayProvenance()).setOverlayCmeProvenance;
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
console.warn(`[wrun] the CME writer for '${indicatorId}' did not load; its hosted result is dropped:`, error);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
if (write === undefined || !owns())
|
|
141
|
+
return false;
|
|
142
|
+
// Written even over a stamped mount: both copies carry it after (the writer is idempotent).
|
|
143
|
+
try {
|
|
144
|
+
write(chartIndex, indicatorId, true);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.warn(`[wrun] the CME stamp of '${indicatorId}' was not written; its hosted result is dropped:`, error);
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return wrunOverlayCmeStamped(meta);
|
|
151
|
+
}
|
|
@@ -11,8 +11,9 @@ import type { CmeExchangeDto } from '../../interfaces/cme-realtime.interface.js'
|
|
|
11
11
|
export interface CmeRootSpec {
|
|
12
12
|
/** What the contract trades (a futures contract reports its underlying's kind). */
|
|
13
13
|
kind: WrunMarketKind;
|
|
14
|
+
/** US dollars per whole point of the quoted price, per contract, on every row (a cents-priced grain included). */
|
|
14
15
|
pointValue: number;
|
|
15
|
-
/** The
|
|
16
|
+
/** The unit of the PRICE the chart draws (US cents on the CBOT grains): never a unit of `pointValue`. */
|
|
16
17
|
quote: WrunMarketQuoteIsUsd;
|
|
17
18
|
/** The CME Group exchange the root lists on (its contracts and its options). */
|
|
18
19
|
exchange: CmeExchangeDto;
|
|
@@ -20,16 +21,19 @@ export interface CmeRootSpec {
|
|
|
20
21
|
/** Read-only outside this module: the market facts, the paper venue and the session's dollar lane read it. */
|
|
21
22
|
export declare const CME_ROOT_SPECS: Readonly<Record<string, Readonly<CmeRootSpec>>>;
|
|
22
23
|
/**
|
|
23
|
-
* The US dollars one contract of `root` is worth for one whole point of its quoted price
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* The US dollars one contract of `root` is worth for one whole point of its quoted price, for the DOLLAR FEATURES (the
|
|
25
|
+
* session's dollar lane, the live intake's dollar fold, the option multiplier): the root's point value
|
|
26
|
+
* (CME_ROOT_SPECS) when the root is priced in US dollars, so a print of `size` contracts at `price` is worth
|
|
27
|
+
* size x price x this. Undefined for a root off the table and for one priced in another unit (the CBOT grains, priced
|
|
28
|
+
* in US cents). That gate is a product decision, not a unit conversion: the point value is US dollars on every row,
|
|
29
|
+
* and the grains stay off these features until they are checked against real trades.
|
|
27
30
|
*/
|
|
28
31
|
export declare function wrunCmeRootDollarPointValue(root: string | null | undefined): number | undefined;
|
|
29
32
|
/**
|
|
30
33
|
* The dollar point value of a market's contract (`wrunCmeRootDollarPointValue` of its root: NQ1! and NQZ6 read NQ, 20)
|
|
31
34
|
* on a CME Group venue, where prints count contracts; null on a CME Group market none prices (an option contract, a
|
|
32
|
-
* root off the table, a cents-
|
|
35
|
+
* root off the table, a cents-priced grain: `wrunCmeRootDollarPointValue`), so its contracts are never valued in
|
|
36
|
+
* dollars there; undefined off the CME family,
|
|
33
37
|
* whose prints this rule says nothing about.
|
|
34
38
|
*/
|
|
35
39
|
export declare function wrunCmeDollarPointValue(market: {
|
|
@@ -16,6 +16,9 @@ export const CME_ROOT_SPECS = {
|
|
|
16
16
|
'6B': { kind: 'forex', pointValue: 62_500, quote: 'usd', exchange: 'CME' }, // 62,500 pounds: fx/g10/british-pound
|
|
17
17
|
'6J': { kind: 'forex', pointValue: 12_500_000, quote: 'usd', exchange: 'CME' }, // 12,500,000 yen: fx/g10/japanese-yen
|
|
18
18
|
'6C': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 CAD: fx/g10/canadian-dollar
|
|
19
|
+
'6A': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 AUD: fx/g10/australian-dollar
|
|
20
|
+
'6S': { kind: 'forex', pointValue: 125_000, quote: 'usd', exchange: 'CME' }, // 125,000 CHF: fx/g10/swiss-franc
|
|
21
|
+
'6N': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 NZD: fx/g10/new-zealand-dollar
|
|
19
22
|
// US Treasury futures, quoted in points of par (100): the face value / 100 per point.
|
|
20
23
|
ZT: { kind: 'unknown', pointValue: 2_000, quote: 'usd', exchange: 'CBOT' }, // $200,000 face: interest-rates/us-treasury/2-year-us-treasury-note
|
|
21
24
|
ZF: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/5-year-us-treasury-note
|
|
@@ -37,14 +40,14 @@ export const CME_ROOT_SPECS = {
|
|
|
37
40
|
SIL: { kind: 'metal', pointValue: 1_000, quote: 'usd', exchange: 'COMEX' }, // 1,000 troy ounces: metals/precious/1000-oz-silver
|
|
38
41
|
HG: { kind: 'metal', pointValue: 25_000, quote: 'usd', exchange: 'COMEX' }, // 25,000 pounds: metals/base/copper
|
|
39
42
|
MHG: { kind: 'metal', pointValue: 2_500, quote: 'usd', exchange: 'COMEX' }, // 2,500 pounds: metals/base/micro-copper
|
|
40
|
-
// Grains (CBOT),
|
|
41
|
-
// draws (corn near 460
|
|
42
|
-
//
|
|
43
|
-
ZC: { kind: 'unknown', pointValue:
|
|
44
|
-
ZW: { kind: 'unknown', pointValue:
|
|
45
|
-
KE: { kind: 'unknown', pointValue:
|
|
46
|
-
ZS: { kind: 'unknown', pointValue:
|
|
47
|
-
ZL: { kind: 'unknown', pointValue:
|
|
43
|
+
// Grains (CBOT), priced in US cents per bushel (soybean oil per pound), the unit the chart
|
|
44
|
+
// draws (corn near 460; Pine reads `syminfo.currency` "USX" there, so `quote` is 'other').
|
|
45
|
+
// A whole point is one cent: the contract size x $0.01, in US dollars like every row.
|
|
46
|
+
ZC: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/grains/corn
|
|
47
|
+
ZW: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/grains/wheat
|
|
48
|
+
KE: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/grains/kc-wheat
|
|
49
|
+
ZS: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/oilseeds/soybean
|
|
50
|
+
ZL: { kind: 'unknown', pointValue: 600, quote: 'other', exchange: 'CBOT' }, // 60,000 pounds x $0.01: agriculture/oilseeds/soybean-oil
|
|
48
51
|
// Cryptocurrency futures (CME), quoted in US dollars per coin.
|
|
49
52
|
BTC: { kind: 'crypto', pointValue: 5, quote: 'usd', exchange: 'CME' }, // 5 bitcoin: cryptocurrencies/bitcoin/bitcoin
|
|
50
53
|
MBT: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 bitcoin: cryptocurrencies/bitcoin/micro-bitcoin
|
|
@@ -52,10 +55,12 @@ export const CME_ROOT_SPECS = {
|
|
|
52
55
|
MET: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 ether: cryptocurrencies/ether/micro-ether
|
|
53
56
|
};
|
|
54
57
|
/**
|
|
55
|
-
* The US dollars one contract of `root` is worth for one whole point of its quoted price
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
58
|
+
* The US dollars one contract of `root` is worth for one whole point of its quoted price, for the DOLLAR FEATURES (the
|
|
59
|
+
* session's dollar lane, the live intake's dollar fold, the option multiplier): the root's point value
|
|
60
|
+
* (CME_ROOT_SPECS) when the root is priced in US dollars, so a print of `size` contracts at `price` is worth
|
|
61
|
+
* size x price x this. Undefined for a root off the table and for one priced in another unit (the CBOT grains, priced
|
|
62
|
+
* in US cents). That gate is a product decision, not a unit conversion: the point value is US dollars on every row,
|
|
63
|
+
* and the grains stay off these features until they are checked against real trades.
|
|
59
64
|
*/
|
|
60
65
|
export function wrunCmeRootDollarPointValue(root) {
|
|
61
66
|
if (typeof root !== 'string')
|
|
@@ -69,7 +74,8 @@ export function wrunCmeRootDollarPointValue(root) {
|
|
|
69
74
|
/**
|
|
70
75
|
* The dollar point value of a market's contract (`wrunCmeRootDollarPointValue` of its root: NQ1! and NQZ6 read NQ, 20)
|
|
71
76
|
* on a CME Group venue, where prints count contracts; null on a CME Group market none prices (an option contract, a
|
|
72
|
-
* root off the table, a cents-
|
|
77
|
+
* root off the table, a cents-priced grain: `wrunCmeRootDollarPointValue`), so its contracts are never valued in
|
|
78
|
+
* dollars there; undefined off the CME family,
|
|
73
79
|
* whose prints this rule says nothing about.
|
|
74
80
|
*/
|
|
75
81
|
export function wrunCmeDollarPointValue(market) {
|
|
@@ -37,9 +37,9 @@ export declare function isWrunHudViewerRowKey(key: string): boolean;
|
|
|
37
37
|
export declare const WRUN_HEATMAP_SENSITIVITY_ROW_RE: RegExp;
|
|
38
38
|
export declare function isWrunHeatmapSensitivityRowKey(key: string): boolean;
|
|
39
39
|
/** Every viewer row of a browser-run Indicator (a HUD's rows, a heatmap's
|
|
40
|
-
* Sensitivity, a child the reader hid on its own legend row
|
|
41
|
-
* overlay settings that persist by key and
|
|
42
|
-
* param or a host param. */
|
|
40
|
+
* Sensitivity, a child the reader hid on its own legend row, the height a
|
|
41
|
+
* reader dragged a child's pane to): overlay settings that persist by key and
|
|
42
|
+
* are never a sheet param, an alert param or a host param. */
|
|
43
43
|
export declare function isWrunViewerRowKey(key: string): boolean;
|
|
44
44
|
/** `((r * 256 + g) * 256 + b) * 1024 + round(alpha * 1000)`, arithmetic
|
|
45
45
|
* (the value outgrows 32-bit bitwise ops). */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* (docs/features/kscript/wrun/wrun-browser-runtime.md, "Boot doors"); the colour settings module
|
|
8
8
|
* re-exports every name here for its own readers.
|
|
9
9
|
*/
|
|
10
|
-
import { isWrunChildHiddenRowKey } from './wrun-child-overlay-id.util.js';
|
|
10
|
+
import { isWrunChildHiddenRowKey, isWrunChildPaneHeightRowKey } from './wrun-child-overlay-id.util.js';
|
|
11
11
|
/** The Style page row key of one output property (frozen, plan 1.7):
|
|
12
12
|
* `__style__<output>__<property>`; the target may also name a text
|
|
13
13
|
* renderer, heatmap, profile or levels declaration (C1, parseWrunStyleTarget). */
|
|
@@ -52,11 +52,14 @@ export function isWrunHeatmapSensitivityRowKey(key) {
|
|
|
52
52
|
return WRUN_HEATMAP_SENSITIVITY_ROW_RE.test(key);
|
|
53
53
|
}
|
|
54
54
|
/** Every viewer row of a browser-run Indicator (a HUD's rows, a heatmap's
|
|
55
|
-
* Sensitivity, a child the reader hid on its own legend row
|
|
56
|
-
* overlay settings that persist by key and
|
|
57
|
-
* param or a host param. */
|
|
55
|
+
* Sensitivity, a child the reader hid on its own legend row, the height a
|
|
56
|
+
* reader dragged a child's pane to): overlay settings that persist by key and
|
|
57
|
+
* are never a sheet param, an alert param or a host param. */
|
|
58
58
|
export function isWrunViewerRowKey(key) {
|
|
59
|
-
return isWrunHudViewerRowKey(key) ||
|
|
59
|
+
return (isWrunHudViewerRowKey(key) ||
|
|
60
|
+
isWrunHeatmapSensitivityRowKey(key) ||
|
|
61
|
+
isWrunChildHiddenRowKey(key) ||
|
|
62
|
+
isWrunChildPaneHeightRowKey(key));
|
|
60
63
|
}
|
|
61
64
|
/** `((r * 256 + g) * 256 + b) * 1024 + round(alpha * 1000)`, arithmetic
|
|
62
65
|
* (the value outgrows 32-bit bitwise ops). */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boot path's door to the mark side colour (`wrun-colour-tone.util`):
|
|
3
|
+
* `wrun-style-words.util` is on the pre-candle closure and answers
|
|
4
|
+
* `theme.up_mark` / `theme.down_mark` through here, so the OKLab maths stay
|
|
5
|
+
* off it (docs/features/kscript/wrun/wrun-browser-runtime.md, "Boot doors").
|
|
6
|
+
*
|
|
7
|
+
* - Bound: the maths bind themselves as they evaluate; every surface that
|
|
8
|
+
* paints a mark colour (the batched marks build, the canvases and HUD
|
|
9
|
+
* fallbacks, the settings dialog's swatches) imports them statically.
|
|
10
|
+
* - Late: unbound, a mark colour is its candle colour unchanged.
|
|
11
|
+
*
|
|
12
|
+
* Pure on purpose (no import): the style words ride the worker graphs too.
|
|
13
|
+
*/
|
|
14
|
+
type WrunMarkSideColour = (candle: string, background: string) => string;
|
|
15
|
+
/** Hand the maths over: wrun-colour-tone.util calls this as it evaluates. */
|
|
16
|
+
export declare function bindWrunMarkSideColour(loaded: WrunMarkSideColour): void;
|
|
17
|
+
/** The mark colour of a candle colour on a background when bound, else the
|
|
18
|
+
* candle colour unchanged. */
|
|
19
|
+
export declare function wrunMarkSideColour(candle: string, background: string): string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boot path's door to the mark side colour (`wrun-colour-tone.util`):
|
|
3
|
+
* `wrun-style-words.util` is on the pre-candle closure and answers
|
|
4
|
+
* `theme.up_mark` / `theme.down_mark` through here, so the OKLab maths stay
|
|
5
|
+
* off it (docs/features/kscript/wrun/wrun-browser-runtime.md, "Boot doors").
|
|
6
|
+
*
|
|
7
|
+
* - Bound: the maths bind themselves as they evaluate; every surface that
|
|
8
|
+
* paints a mark colour (the batched marks build, the canvases and HUD
|
|
9
|
+
* fallbacks, the settings dialog's swatches) imports them statically.
|
|
10
|
+
* - Late: unbound, a mark colour is its candle colour unchanged.
|
|
11
|
+
*
|
|
12
|
+
* Pure on purpose (no import): the style words ride the worker graphs too.
|
|
13
|
+
*/
|
|
14
|
+
let stepped;
|
|
15
|
+
/** Hand the maths over: wrun-colour-tone.util calls this as it evaluates. */
|
|
16
|
+
export function bindWrunMarkSideColour(loaded) {
|
|
17
|
+
stepped = loaded;
|
|
18
|
+
}
|
|
19
|
+
/** The mark colour of a candle colour on a background when bound, else the
|
|
20
|
+
* candle colour unchanged. */
|
|
21
|
+
export function wrunMarkSideColour(candle, background) {
|
|
22
|
+
return stepped === undefined ? candle : stepped(candle, background);
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** How far a mark side colour steps from its candle colour, in OKLab lightness. */
|
|
2
|
+
export declare const WRUN_MARK_SIDE_STEP = 0.2;
|
|
3
|
+
/**
|
|
4
|
+
* The colour a mark of one side draws in (`theme.up_mark`, `theme.down_mark`):
|
|
5
|
+
* the candle colour stepped {@link WRUN_MARK_SIDE_STEP} in OKLab lightness away
|
|
6
|
+
* from the background, hue and chroma kept (chroma reduced only to stay in
|
|
7
|
+
* sRGB). A background whose lightness is under 0.5 is dark: the step goes up,
|
|
8
|
+
* unless it would pass 0.93 (a near-white candle steps down instead); on a
|
|
9
|
+
* light background the step goes down, unless it would fall under 0.12. The
|
|
10
|
+
* result is held to 0.05..0.985. `#rrggbb` (lowercase); a candle colour with
|
|
11
|
+
* an alpha under 1 keeps it as `rgba(r, g, b, a)`. A colour that does not
|
|
12
|
+
* parse (either one) returns the candle colour unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export declare function markSideColour(candleHex: string, backgroundHex: string): string;
|