@orangecharts/wrun-chart-host 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +2 -0
  2. package/dist/constants/feature-flags.constants.d.ts +1 -6
  3. package/dist/constants/feature-flags.constants.js +17 -87
  4. package/dist/host-env.d.ts +2 -0
  5. package/dist/host-ports.types.d.ts +10 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +2 -0
  8. package/dist/market-data/venues/index.d.ts +128 -143
  9. package/dist/market-data/venues/index.js +2 -2
  10. package/dist/market-data/venues/stocks.d.ts +1 -1
  11. package/dist/market-data/venues/stocks.js +2 -4
  12. package/dist/settings-templates/frvp-fields.js +28 -19
  13. package/dist/settings-templates/index.d.ts +25 -0
  14. package/dist/settings-templates/index.js +62 -2
  15. package/dist/settings-templates/indicator-fields.d.ts +35 -0
  16. package/dist/settings-templates/indicator-fields.js +261 -114
  17. package/dist/settings-templates/market-bound.d.ts +214 -0
  18. package/dist/settings-templates/market-bound.js +369 -0
  19. package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +8 -8
  20. package/dist/utility/chart/cme-user-scripts-gate.util.js +8 -8
  21. package/dist/utility/chart/governed-lanes-gate.util.d.ts +6 -6
  22. package/dist/utility/chart/governed-lanes-gate.util.js +6 -6
  23. package/dist/utility/chart/index-otc.leaf.d.ts +13 -0
  24. package/dist/utility/chart/index-otc.leaf.js +18 -0
  25. package/dist/utility/chart/server-built-bars.util.d.ts +4 -0
  26. package/dist/utility/chart/server-built-bars.util.js +18 -0
  27. package/dist/utility/v2/gate-plane.util.d.ts +7 -0
  28. package/dist/utility/v2/gate-plane.util.js +6 -0
  29. package/dist/utility/wrun/wrun-dark-pool.util.js +1 -1
  30. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +1 -1
  31. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +10 -0
  32. package/dist/utility/wrun/wrun-lane-warmup.util.js +32 -0
  33. package/dist/utility/wrun/wrun-live-intake.util.d.ts +3 -0
  34. package/dist/utility/wrun/wrun-live-intake.util.js +6 -0
  35. package/dist/utility/wrun/wrun-live-tick.util.js +5 -0
  36. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +2 -0
  37. package/dist/utility/wrun/wrun-overlay-recovery.util.js +1 -1
  38. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +3 -1
  39. package/dist/utility/wrun/wrun-overlay-run.util.js +128 -21
  40. package/dist/utility/wrun/wrun-replay-lane.util.js +3 -1
  41. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +4 -0
  42. package/dist/utility/wrun/wrun-twin-lookback.util.js +17 -0
  43. package/package.json +7 -7
@@ -34,12 +34,21 @@ const PER_BOX = { owner: 'profile', lanes: ['row', 'mirror'], instance: true };
34
34
  const CONSTANT = { owner: 'profile', lanes: ['row'] };
35
35
  /** Stamped by the control on every mount (engine flags, the block-size status): nothing to save. */
36
36
  const STAMPED = { owner: 'profile', lanes: [] };
37
+ // The quantity of each numeric key (indicator-fields' header): what its number measures. The FRVP's threshold is a
38
+ // volume in the profile's unit, classified bound and never reconciled (left carried on purpose); its block size and
39
+ // row height are price units, carried as they are.
40
+ const BOX_STYLE_RELATIVE = { ...BOX_STYLE, quantity: 'relative' };
41
+ const PREFERENCE_RELATIVE = { ...PREFERENCE, quantity: 'relative' };
42
+ const PREFERENCE_BOUND = { ...PREFERENCE, quantity: 'bound' };
43
+ const PER_BOX_RELATIVE = { ...PER_BOX, quantity: 'relative' };
44
+ const PER_BOX_AMOUNT = { ...PER_BOX, quantity: 'amount' };
45
+ const CONSTANT_RELATIVE = { ...CONSTANT, quantity: 'relative' };
37
46
  export const FRVP_FIELD_ROWS = [
38
47
  // The box's style: the Style tab's boundary line rows.
39
48
  ['showBoundaryLines', BOX_STYLE],
40
49
  ['color', BOX_STYLE],
41
50
  ['lineStyle', BOX_STYLE],
42
- ['lineWidth', BOX_STYLE],
51
+ ['lineWidth', BOX_STYLE_RELATIVE],
43
52
  // "Show on": the intervals the box shows on, All intervals as [] (TEMPLATES-PLAN decision 3). A template keeps it as
44
53
  // every drawing's template does, and so does the default: a new FRVP shows where the last one did (TradingView).
45
54
  ['visibleIntervalsMs', { owner: 'box', lanes: ['template', 'default'], unset: Object.freeze([]) }],
@@ -54,8 +63,8 @@ export const FRVP_FIELD_ROWS = [
54
63
  ['hideLegendValues', STAMPED],
55
64
  ['errorMessage', STAMPED],
56
65
  // The window. On a rebuild the box's anchors win (attachFRVPCompanion).
57
- ['fromTimestamp', PER_BOX],
58
- ['toTimestamp', PER_BOX],
66
+ ['fromTimestamp', PER_BOX_RELATIVE],
67
+ ['toTimestamp', PER_BOX_RELATIVE],
59
68
  // Follow Chart: per box, never a template or a default (every future FRVP would self-advance).
60
69
  ['followChart', PER_BOX],
61
70
  // RTH or ETH: a template applies the choice the user named; a default would detach the next profile from its
@@ -64,16 +73,16 @@ export const FRVP_FIELD_ROWS = [
64
73
  ['exchange', PER_BOX],
65
74
  ['symbol', PER_BOX],
66
75
  // The instrument's block size; a restore mounts on it and the block-size reconcile heals it.
67
- ['minimumBarHeight', PER_BOX],
76
+ ['minimumBarHeight', PER_BOX_AMOUNT],
68
77
  // Derived: block size x ticks per bar, re-derived by every mount.
69
- ['barHeight', PER_BOX],
78
+ ['barHeight', PER_BOX_AMOUNT],
70
79
  ['showLabel', PER_BOX],
71
80
  // The theme ownership stamp (the panel's colour edit sets true, a theme pass false); addIndicator re-stamps it from
72
81
  // what a rebuild hands over, so a theme-owned palette keeps following the theme.
73
82
  ['colorsCustomized', PER_BOX],
74
- ['digits', CONSTANT],
75
- ['width', CONSTANT],
76
- ['verticalPadding', CONSTANT],
83
+ ['digits', CONSTANT_RELATIVE],
84
+ ['width', CONSTANT_RELATIVE],
85
+ ['verticalPadding', CONSTANT_RELATIVE],
77
86
  ['hideWeekends', CONSTANT],
78
87
  ['currency', PREFERENCE],
79
88
  ['displayMode', PREFERENCE],
@@ -81,13 +90,13 @@ export const FRVP_FIELD_ROWS = [
81
90
  ['stickToLeft', PREFERENCE],
82
91
  ['showValue', PREFERENCE],
83
92
  ['showValueArea', PREFERENCE],
84
- ['valueArea', PREFERENCE],
85
- ['barWidth', PREFERENCE],
93
+ ['valueArea', PREFERENCE_RELATIVE],
94
+ ['barWidth', PREFERENCE_RELATIVE],
86
95
  ['rowsLayout', PREFERENCE],
87
- ['barHeightMultiplier', PREFERENCE],
88
- ['rowsCount', PREFERENCE],
89
- ['threshold', PREFERENCE],
90
- ['volumeDecimals', PREFERENCE],
96
+ ['barHeightMultiplier', PREFERENCE_RELATIVE],
97
+ ['rowsCount', PREFERENCE_RELATIVE],
98
+ ['threshold', PREFERENCE_BOUND],
99
+ ['volumeDecimals', PREFERENCE_RELATIVE],
91
100
  // Legacy: the mount folds it into volumeDecimals, so a mounted profile never holds it and its copy needs none.
92
101
  ['showDecimals', { owner: 'profile', lanes: ['row', 'template', 'default'] }],
93
102
  ['colors', PREFERENCE],
@@ -110,23 +119,23 @@ export const FRVP_FIELD_ROWS = [
110
119
  ['showVAHNaked', PREFERENCE],
111
120
  ['showVALNaked', PREFERENCE],
112
121
  ['cellShading', PREFERENCE],
113
- ['shadingSteps', PREFERENCE],
114
- ['shadingThresholds', PREFERENCE],
122
+ ['shadingSteps', PREFERENCE_RELATIVE],
123
+ ['shadingThresholds', PREFERENCE_RELATIVE],
115
124
  ['shadingStepColors', PREFERENCE],
116
125
  ['profileStats', PREFERENCE],
117
126
  ['profileStatsPosition', PREFERENCE],
118
- ['levelLineWidth', PREFERENCE],
127
+ ['levelLineWidth', PREFERENCE_RELATIVE],
119
128
  ['levelLineStyle', PREFERENCE],
120
129
  // Stamped on every mount in the reader's language: mirrored so the box prints it, never saved.
121
130
  ['profileStatsLabels', { owner: 'profile', lanes: ['mirror'] }],
122
131
  // Not a setting: the stamp the saved defaults' profile half carries in the account's style memory, written with it
123
132
  // (FRVP_PROFILE_DEFAULTS_STAMP below). In the default lane so the memory keeps it; no panel, row or copy holds it.
124
- ['profileDefaultsVersion', { owner: 'profile', lanes: ['default'] }],
133
+ ['profileDefaultsVersion', { owner: 'profile', lanes: ['default'], quantity: 'relative' }],
125
134
  // Dynamic Profile parity (Exocharts, 2026-11-13). The profile's row text and imbalance marks, read with the session
126
135
  // volume profile's keys and words, and the candle the box draws for its range ('none' by default).
127
136
  ['rowText', PREFERENCE],
128
137
  ['imbalance', PREFERENCE],
129
- ['imbalanceRatio', PREFERENCE],
138
+ ['imbalanceRatio', PREFERENCE_RELATIVE],
130
139
  ['imbalanceBuyColor', PREFERENCE],
131
140
  ['imbalanceSellColor', PREFERENCE],
132
141
  ['rangeCandle', PREFERENCE],
@@ -1,7 +1,10 @@
1
+ import { type BoundCondition, type BoundKeep, type FieldQuantity } from './indicator-fields.js';
1
2
  import { type ToolTextRole } from './tool-rules.js';
2
3
  import { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS } from './tool-tables.generated.js';
3
4
  export { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS };
4
5
  export type { ToolTextRole };
6
+ export type { BoundCondition, BoundKeep, FieldQuantity };
7
+ export * from './market-bound.js';
5
8
  export type TemplateKind = 'indicator' | 'tool';
6
9
  export type FieldLane = 'row' | 'template' | 'default' | 'mirror';
7
10
  export type FieldOwner = 'settings' | 'meta' | 'box' | 'profile';
@@ -18,7 +21,20 @@ export interface FieldSpec {
18
21
  label?: boolean;
19
22
  /** The serialisable value a capture writes where the engine holds none ("all"), when the field declares one. */
20
23
  unset?: unknown;
24
+ /** What its number measures (indicator-fields' header); absent on a field that holds no number. */
25
+ quantity?: FieldQuantity;
26
+ /** On a bound field: reconciled per market (`typed` kept for its market, `measured` dropped). */
27
+ keep?: BoundKeep;
28
+ /** On a bound field: the native unit it is bound in, read off a sibling key; in another unit it is an amount. */
29
+ boundWhen?: BoundCondition;
30
+ /** On a kept bound field: the companion keys that travel with it as one unit. */
31
+ with?: readonly string[];
21
32
  }
33
+ /**
34
+ * Where a stored template keeps the market key it was captured on (inside the settings bag: the user service strips
35
+ * any other top-level field). migrateTemplate lifts it out into the document's `boundKey`.
36
+ */
37
+ export declare const TEMPLATE_BOUND_KEY_FIELD = "boundMarketKey";
22
38
  /** The schema version a capture stamps on the template envelope (never inside the settings bag). */
23
39
  export declare const TEMPLATE_SCHEMA_VERSION = 2;
24
40
  /**
@@ -29,6 +45,12 @@ export declare const TEMPLATE_SCHEMA_VERSION = 2;
29
45
  */
30
46
  export interface TemplateContext {
31
47
  market?: string;
48
+ /**
49
+ * The fuller market key of a type with typed thresholds (marketBoundKey: exchange, unit, symbol, interval): the saved
50
+ * market's on a capture, the destination's on a patch. A capture keeps it on the document only for a type with a
51
+ * kept bound field.
52
+ */
53
+ boundKey?: string;
32
54
  /** Reserved for host rules that depend on the chart interval; no rule here reads it. */
33
55
  intervalMs?: number;
34
56
  declaredInputs?: readonly string[];
@@ -44,6 +66,8 @@ export interface TemplateDocument {
44
66
  kind: TemplateKind;
45
67
  type: string;
46
68
  market?: string;
69
+ /** The market key a capture of a type with typed thresholds was taken on (TemplateContext.boundKey). */
70
+ boundKey?: string;
47
71
  settings: Record<string, unknown>;
48
72
  meta?: Record<string, unknown>;
49
73
  profile?: Record<string, unknown>;
@@ -115,6 +139,7 @@ export declare function migrateTemplate(entry: {
115
139
  settings?: unknown;
116
140
  meta?: unknown;
117
141
  market?: string;
142
+ boundKey?: string;
118
143
  schemaVersion?: number;
119
144
  }, kind: TemplateKind, type: string, _ctx?: TemplateContext): TemplateDocument;
120
145
  /**
@@ -18,6 +18,11 @@
18
18
  * - Instance state (`instance`) is never written by a patch: which instance this is stays the destination's.
19
19
  * - A market-bound field is written only when the template's market and the destination's (`ctx.market`) are both
20
20
  * named and equal; on another market it is skipped, not dropped.
21
+ * - A kept bound field (a typed threshold: `quantity: 'bound'` with `keep`, ./market-bound) that is bound right now in
22
+ * the unit the template writes is written only when the template's market key (`boundKey`, captured from
23
+ * `ctx.boundKey`) equals the destination's (`ctx.boundKey`); when either key is missing, the template's `market` and
24
+ * `ctx.market` decide, as for a market-bound field. Its group companions follow it. Skipped, not dropped. A dollar
25
+ * amount (the field in a notional unit) is written onto any market.
21
26
  * - "Show on" (`visibleIntervalsMs`): absent keeps the destination, `[]` is All intervals, a list is that list; a
22
27
  * legacy clear (`null`, or a key held as undefined) is written as `[]`. A capture writes `[]` where the engine holds
23
28
  * none, so a saved template always states it (an interval-bound drawing keeps its own, as instance state). A
@@ -32,8 +37,10 @@
32
37
  * writes it), are no loss and are not named.
33
38
  *
34
39
  * Stored shape: the user service keeps a template entry's `settings` bag, `market` and `schemaVersion` and strips any
35
- * other top-level field, so toStoredEntry folds the meta group into `settings.meta` and the FRVP profile group into
36
- * the flat bag, the shape every client reads; migrateTemplate splits them out again. An entry without a schemaVersion
40
+ * other top-level field, so toStoredEntry folds the meta group into `settings.meta`, the FRVP profile group into
41
+ * the flat bag and the market key into `settings.boundMarketKey` (TEMPLATE_BOUND_KEY_FIELD), the shape every client
42
+ * reads; migrateTemplate splits them out again. A client before 0.19.0 reads that key as one it cannot set (`dropped`)
43
+ * and writes the threshold ungated, as it always has. An entry without a schemaVersion
37
44
  * is version 1 (a save from before this contract, read with the same rules); one above TEMPLATE_SCHEMA_VERSION throws
38
45
  * TemplateSchemaVersionError, so a door refuses to apply or overwrite what a newer client wrote.
39
46
  *
@@ -46,9 +53,18 @@ import cloneDeep from 'lodash-es/cloneDeep.js';
46
53
  import { isWrunViewerRowKey } from '../utility/wrun/wrun-color-facts.util.js';
47
54
  import { FRVP_FIELD_ROWS, FRVP_TOOL_TYPE } from './frvp-fields.js';
48
55
  import { INDICATOR_COMMON_FIELDS, INDICATOR_TYPE_FIELDS, RESERVED_SCRIPT_INPUT_NAMES, SCRIPT_INDICATOR_TYPE, SCRIPT_INPUT_FIELD, VIEWER_ROW_FIELD, } from './indicator-fields.js';
56
+ import { isBoundNow } from './market-bound.js';
49
57
  import { textRoleOf, TOOL_TEMPLATE_RULES } from './tool-rules.js';
50
58
  import { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS } from './tool-tables.generated.js';
51
59
  export { TOOL_DEFAULT_STYLE, TOOL_TEMPLATE_KEYS };
60
+ // The market key and stamp of market-bound values (a heatmap row's scale, a typed threshold) and the one reconcile:
61
+ // served by this entry so a host reads the row rules and the stamp rules from one import.
62
+ export * from './market-bound.js';
63
+ /**
64
+ * Where a stored template keeps the market key it was captured on (inside the settings bag: the user service strips
65
+ * any other top-level field). migrateTemplate lifts it out into the document's `boundKey`.
66
+ */
67
+ export const TEMPLATE_BOUND_KEY_FIELD = 'boundMarketKey';
52
68
  /** The schema version a capture stamps on the template envelope (never inside the settings bag). */
53
69
  export const TEMPLATE_SCHEMA_VERSION = 2;
54
70
  /**
@@ -110,6 +126,14 @@ function specOf(key, field) {
110
126
  spec.label = true;
111
127
  if (field.unset !== undefined)
112
128
  spec.unset = field.unset;
129
+ if (field.quantity)
130
+ spec.quantity = field.quantity;
131
+ if (field.keep)
132
+ spec.keep = field.keep;
133
+ if (field.boundWhen)
134
+ spec.boundWhen = field.boundWhen;
135
+ if (field.with)
136
+ spec.with = Object.freeze([...field.with]);
113
137
  return Object.freeze(spec);
114
138
  }
115
139
  /** An indicator type's fields: the shared rows, then its own (a row of the same owner and key replaces in place). */
@@ -307,6 +331,9 @@ export function captureTemplate(kind, type, engineSettings, ctx) {
307
331
  const market = kind === 'indicator' ? nonEmpty(ctx?.market) : undefined;
308
332
  if (market)
309
333
  doc.market = market;
334
+ const boundKey = kind === 'indicator' ? nonEmpty(ctx?.boundKey) : undefined;
335
+ if (boundKey && specs.some((spec) => spec.keep))
336
+ doc.boundKey = boundKey;
310
337
  if (Object.keys(groups.meta).length)
311
338
  doc.meta = groups.meta;
312
339
  if (isFrvp(kind, type))
@@ -355,6 +382,22 @@ export function templatePatch(kind, type, live, template, ctx) {
355
382
  const metaSpecs = new Map(specs.filter((spec) => spec.owner === 'meta').map((spec) => [spec.key, spec]));
356
383
  const templateMarket = nonEmpty(template?.market);
357
384
  const sameMarket = !!templateMarket && templateMarket === nonEmpty(ctx?.market);
385
+ // A kept bound field is written on the market key it was typed on; a template or a context with no key falls back to
386
+ // the market (an in-memory older shape may still hold the key in its bag).
387
+ const savedBoundKey = kind === 'indicator' && !bagSpecs.has(TEMPLATE_BOUND_KEY_FIELD) ? saved[TEMPLATE_BOUND_KEY_FIELD] : undefined;
388
+ const templateBoundKey = nonEmpty(template?.boundKey) ?? nonEmpty(savedBoundKey);
389
+ const liveBoundKey = nonEmpty(ctx?.boundKey);
390
+ const sameBoundMarket = templateBoundKey && liveBoundKey ? templateBoundKey === liveBoundKey : sameMarket;
391
+ // The unit a template writes: its own value of the unit key, else the destination's.
392
+ const writtenBag = { ...liveBag, ...saved };
393
+ const gated = new Set();
394
+ if (!sameBoundMarket) {
395
+ for (const spec of bagSpecs.values()) {
396
+ if (spec.keep && isBoundNow(spec.boundWhen, writtenBag))
397
+ for (const key of [spec.key, ...(spec.with ?? [])])
398
+ gated.add(key);
399
+ }
400
+ }
358
401
  const groups = { settings: {}, meta: {}, profile: {} };
359
402
  const dropped = new Set();
360
403
  const take = (spec, value, name) => {
@@ -366,6 +409,9 @@ export function templatePatch(kind, type, live, template, ctx) {
366
409
  // and no loss either.
367
410
  if (spec.instance || (spec.marketBound && !sameMarket))
368
411
  return;
412
+ // A typed threshold of another market (or its companion): no loss, the destination keeps its own.
413
+ if (spec.owner !== 'meta' && gated.has(spec.key))
414
+ return;
369
415
  const written = patchedValue(spec, value);
370
416
  if (written === INVALID)
371
417
  dropped.add(name);
@@ -373,6 +419,8 @@ export function templatePatch(kind, type, live, template, ctx) {
373
419
  groupOf(groups, spec.owner)[spec.key] = written;
374
420
  };
375
421
  for (const [key, value] of Object.entries(saved)) {
422
+ if (savedBoundKey !== undefined && key === TEMPLATE_BOUND_KEY_FIELD)
423
+ continue;
376
424
  if (key !== 'meta' || value !== nestedMeta)
377
425
  take(bagSpecs.get(key), value, key);
378
426
  }
@@ -450,6 +498,15 @@ _ctx) {
450
498
  const market = nonEmpty(source.market);
451
499
  if (market)
452
500
  doc.market = market;
501
+ if (kind === 'indicator' && Object.hasOwn(settings, TEMPLATE_BOUND_KEY_FIELD)) {
502
+ const boundKey = nonEmpty(settings[TEMPLATE_BOUND_KEY_FIELD]);
503
+ delete settings[TEMPLATE_BOUND_KEY_FIELD];
504
+ if (boundKey)
505
+ doc.boundKey = boundKey;
506
+ }
507
+ const entryBoundKey = kind === 'indicator' ? nonEmpty(source.boundKey) : undefined;
508
+ if (entryBoundKey)
509
+ doc.boundKey = entryBoundKey;
453
510
  return doc;
454
511
  }
455
512
  /**
@@ -472,5 +529,8 @@ export function toStoredEntry(doc) {
472
529
  const market = nonEmpty(doc.market);
473
530
  if (market)
474
531
  entry.market = market;
532
+ const boundKey = doc.kind === 'indicator' ? nonEmpty(doc.boundKey) : undefined;
533
+ if (boundKey)
534
+ settings[TEMPLATE_BOUND_KEY_FIELD] = boundKey;
475
535
  return entry;
476
536
  }
@@ -18,7 +18,32 @@
18
18
  * object), its lanes, whether it is instance state (which instance this is: never written by a template or a saved
19
19
  * default, kept by a reset) and whether it is bound to the market it was saved on. Imports nothing, so the tool
20
20
  * tables' generator can read the FRVP table beside it without the package graph.
21
+ *
22
+ * Quantities (market-bound values, ./market-bound): every field that holds a number, or a container of numbers, says
23
+ * what the number measures, so a reader knows whether it means the same on another market:
24
+ * - `relative`: the same on any market (a percent, ratio, count, period, length, opacity, width, a time);
25
+ * - `bound`: an absolute in the market's native unit (coins, contracts, shares, price units). With `keep` it is
26
+ * reconciled per market (reconcileMarketBound): `typed` values are kept per market and given back on a return,
27
+ * `measured` ones are dropped. Without `keep` it is classified only: a heatmap's meta scale (its own path,
28
+ * settleHeatmapScale) and the FRVP's threshold (left as it is on purpose);
29
+ * - `amount`: an absolute that is carried onto any market as it is: a dollar amount, and an absolute whose unit no
30
+ * reader settles (the shared rows of a field a bound type overrides, price-unit sizes outside the typed thresholds).
31
+ * A field that is bound only in a native unit names that unit (`boundWhen`): in another unit (USD) it is an amount.
32
+ * A field's group companions (`with`) are kept, given back and removed with it as one unit.
33
+ */
34
+ /** What a number in a field measures (see the file header). */
35
+ export type FieldQuantity = 'relative' | 'bound' | 'amount';
36
+ /** What a market change does with a bound value: `typed` is kept for its market, `measured` is dropped. */
37
+ export type BoundKeep = 'typed' | 'measured';
38
+ /**
39
+ * When a bound field is bound right now, read off a sibling key of the same settings bag: bound when the sibling's
40
+ * value is one of `oneOf` (when named) and none of `noneOf` (when named). A missing sibling is undefined.
21
41
  */
42
+ export interface BoundCondition {
43
+ readonly key: string;
44
+ readonly oneOf?: readonly unknown[];
45
+ readonly noneOf?: readonly unknown[];
46
+ }
22
47
  /** A field as a table declares it: its owner (the settings bag when none is named), lanes, flags and unset value. */
23
48
  export interface DeclaredField {
24
49
  readonly owner?: 'settings' | 'meta' | 'box' | 'profile';
@@ -29,6 +54,14 @@ export interface DeclaredField {
29
54
  readonly label?: true;
30
55
  /** The value a capture writes where the engine holds none (a serialisable value: "all", never "absent"). */
31
56
  readonly unset?: unknown;
57
+ /** What its number measures; every numeric field declares one, a non-numeric field none. */
58
+ readonly quantity?: FieldQuantity;
59
+ /** On a bound field: reconciled per market, and how. */
60
+ readonly keep?: BoundKeep;
61
+ /** On a bound field: the native unit it is bound in; in any other unit it is an amount. */
62
+ readonly boundWhen?: BoundCondition;
63
+ /** On a kept bound field: the keys that travel with it as one unit (a value and its market default). */
64
+ readonly with?: readonly string[];
32
65
  }
33
66
  /** One table row: a key and its declared field. */
34
67
  export type DeclaredFieldRow = readonly [key: string, field: DeclaredField];
@@ -52,6 +85,8 @@ export declare const RESERVED_SCRIPT_INPUT_NAMES: readonly string[];
52
85
  * then the instance and runtime keys the row never keeps, then the meta fields.
53
86
  */
54
87
  export declare const INDICATOR_COMMON_FIELDS: readonly DeclaredFieldRow[];
88
+ /** The four heatmap types whose meta scale is settled by the heatmap's own path (wave 1: settleHeatmapScale). */
89
+ export declare const HEATMAP_SCALE_TYPES: readonly string[];
55
90
  /**
56
91
  * The fields one indicator type declares beyond INDICATOR_COMMON_FIELDS: a row here adds a key, or replaces the shared
57
92
  * row of the same owner and key.