@orangecharts/wrun-chart-host 0.19.1 → 0.20.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 (55) hide show
  1. package/README.md +1 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/settings-templates/frvp-fields.js +9 -3
  5. package/dist/settings-templates/index.d.ts +29 -4
  6. package/dist/settings-templates/index.js +82 -27
  7. package/dist/settings-templates/indicator-fields.d.ts +11 -0
  8. package/dist/settings-templates/indicator-fields.js +5 -4
  9. package/dist/settings-templates/market-bound.d.ts +93 -20
  10. package/dist/settings-templates/market-bound.js +229 -41
  11. package/dist/settings-templates/tool-rules.d.ts +197 -18
  12. package/dist/settings-templates/tool-rules.js +98 -4
  13. package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
  14. package/dist/settings-templates/tool-tables.generated.js +194 -11
  15. package/dist/utility/chart/calendar-interval.util.d.ts +7 -0
  16. package/dist/utility/chart/calendar-interval.util.js +9 -0
  17. package/dist/utility/chart/index-mode.util.d.ts +11 -0
  18. package/dist/utility/chart/index-mode.util.js +24 -0
  19. package/dist/utility/chart/indicator-run-interval.util.d.ts +7 -3
  20. package/dist/utility/chart/indicator-run-interval.util.js +16 -5
  21. package/dist/utility/chart/market-session-schedule.util.d.ts +2 -0
  22. package/dist/utility/chart/market-session-schedule.util.js +2 -0
  23. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +16 -1
  24. package/dist/utility/chart/run-interval-warmup.leaf.js +28 -2
  25. package/dist/utility/options/option-contract-market.leaf.d.ts +2 -0
  26. package/dist/utility/options/option-contract-market.leaf.js +21 -0
  27. package/dist/utility/options/option-trade-units.util.d.ts +35 -5
  28. package/dist/utility/options/option-trade-units.util.js +31 -5
  29. package/dist/utility/wrun/wrun-chart-market-facts.util.js +3 -3
  30. package/dist/utility/wrun/wrun-color-settings.util.d.ts +2 -13
  31. package/dist/utility/wrun/wrun-color-settings.util.js +3 -29
  32. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +1 -1
  33. package/dist/utility/wrun/wrun-lane-warmup.util.js +8 -3
  34. package/dist/utility/wrun/wrun-live-intake.util.js +13 -6
  35. package/dist/utility/wrun/wrun-live-tick.util.js +35 -18
  36. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +34 -1
  37. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +57 -0
  38. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +76 -13
  39. package/dist/utility/wrun/wrun-market-size-defaults.util.js +286 -45
  40. package/dist/utility/wrun/wrun-market-size-rank.leaf.d.ts +75 -0
  41. package/dist/utility/wrun/wrun-market-size-rank.leaf.js +154 -0
  42. package/dist/utility/wrun/wrun-overlay-run.util.js +124 -21
  43. package/dist/utility/wrun/wrun-param-values.util.d.ts +2 -1
  44. package/dist/utility/wrun/wrun-param-values.util.js +3 -9
  45. package/dist/utility/wrun/wrun-row-scalars.leaf.d.ts +30 -0
  46. package/dist/utility/wrun/wrun-row-scalars.leaf.js +73 -0
  47. package/dist/utility/wrun/wrun-run-health.util.d.ts +24 -2
  48. package/dist/utility/wrun/wrun-run-health.util.js +39 -7
  49. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +18 -0
  50. package/dist/utility/wrun/wrun-run-interval-session.util.js +25 -0
  51. package/dist/utility/wrun/wrun-run-interval.util.d.ts +52 -5
  52. package/dist/utility/wrun/wrun-run-interval.util.js +88 -7
  53. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +4 -7
  54. package/dist/utility/wrun/wrun-script-inputs.util.js +6 -33
  55. package/package.json +1 -1
@@ -246,7 +246,7 @@ import { wrunSessionChartNamesOf } from './wrun-chart-context-names.util.js';
246
246
  import { wrunReadsMarketFacts } from './wrun-chart-market-facts.util.js';
247
247
  import { wrunReadsEarningsFacts } from './wrun-earnings-facts.util.js';
248
248
  import { wrunLaneRefusalLeavesWindowOwed, wrunLaneRefusedCodeOf } from './wrun-lane-refusal.leaf.js';
249
- import { WRUN_RUN_INTERVAL_ROWS_KEY, wrunRunIntervalComputeRows, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
249
+ import { WRUN_RUN_INTERVAL_ROWS_KEY, wrunRunIntervalComputeRows, wrunRunIntervalProjectionOf, wrunRunIntervalAnswer, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
250
250
  import { WRUN_NO_READY_ROWS_CODE, wrunNothingReadyRefusal, wrunRunHealthDiagnostics } from './wrun-run-health.util.js';
251
251
  import { attachWrunRefusal, serializeWrunRefusal, wrunOverlayEditable, wrunRefusalFor, } from './wrun-refusal.util.js';
252
252
  import { noteWrunDrawingsSameAs, noteWrunRunRetained, trimWrunRunDrawings } from './wrun-cap-notice.util.js';
@@ -3704,23 +3704,40 @@ lastMainTs) {
3704
3704
  console.warn(`[wrun] live reconcile of the ${runAsk.intervalKey} run bars failed for '${indicatorId}' (their coverage stays behind):`, outcome.reason);
3705
3705
  }
3706
3706
  else {
3707
- // The forming run bar is kept in the buffer; a bucket past the chart's
3708
- // newest bar is not, until the chart shows a bar in it.
3709
- const answer = wrunRunIntervalRowsThrough(runSession.run, outcome.value, lastMainTs);
3710
- const merged = mergeWrunRunIntervalAnswer(context, runSession, runAsk, answer);
3711
- revisedFromTs = minTs(revisedFromTs, merged.revisedFromTs);
3712
- // Fetched bars win: the chart's candle frames that queued for those
3713
- // buckets while the ask was on the wire are dropped (a re-fold would add
3714
- // their volume twice).
3715
- if (merged.served.length > 0)
3716
- dropWrunLiveQueuedLegBuckets(indicatorId, WRUN_RUN_INTERVAL_ROWS_KEY, merged.served);
3717
- noteWrunRunIntervalLive(context, runSession, {
3718
- action: 're-ask',
3719
- fromTs: runAsk.fromTs,
3720
- toTs: runAsk.toTs,
3721
- answered: answer.length,
3722
- revisedFromTs: merged.revisedFromTs,
3723
- });
3707
+ const fetchedRows = outcome.value;
3708
+ const answer = wrunRunIntervalAnswer(runSession.run, fetchedRows, lastMainTs);
3709
+ if (answer.rows === undefined) {
3710
+ // Another interval's candles (finer than the run asked) are refused like a failed ask: never merged into
3711
+ // the run bars the full run validated, and their coverage stays behind for the next window.
3712
+ wrunChartHostEnv().diagnostics.debug('wrun-run-interval-rows-finer', {
3713
+ chartIndex: context.chartIndex,
3714
+ indicatorId,
3715
+ ask: 'live-re-ask',
3716
+ askedInterval: runSession.run.interval,
3717
+ askedIntervalMs: runSession.run.intervalMs,
3718
+ medianGapMs: answer.finerGapMs,
3719
+ rows: fetchedRows.length,
3720
+ });
3721
+ console.warn(`[wrun] live reconcile of the ${runAsk.intervalKey} run bars answered rows finer than its interval for '${indicatorId}' (their coverage stays behind)`);
3722
+ }
3723
+ else {
3724
+ // The forming run bar is kept in the buffer; a bucket past the chart's
3725
+ // newest bar is not, until the chart shows a bar in it.
3726
+ const merged = mergeWrunRunIntervalAnswer(context, runSession, runAsk, answer.rows);
3727
+ revisedFromTs = minTs(revisedFromTs, merged.revisedFromTs);
3728
+ // Fetched bars win: the chart's candle frames that queued for those
3729
+ // buckets while the ask was on the wire are dropped (a re-fold would add
3730
+ // their volume twice).
3731
+ if (merged.served.length > 0)
3732
+ dropWrunLiveQueuedLegBuckets(indicatorId, WRUN_RUN_INTERVAL_ROWS_KEY, merged.served);
3733
+ noteWrunRunIntervalLive(context, runSession, {
3734
+ action: 're-ask',
3735
+ fromTs: runAsk.fromTs,
3736
+ toTs: runAsk.toTs,
3737
+ answered: answer.rows.length,
3738
+ revisedFromTs: merged.revisedFromTs,
3739
+ });
3740
+ }
3724
3741
  }
3725
3742
  }
3726
3743
  if (overCap !== undefined) {
@@ -52,7 +52,8 @@
52
52
  * (`wrunMarketScaledFamilies`): each family has its own verdict and memo, so a volume rule waiting on its candles never
53
53
  * holds the option back.
54
54
  *
55
- * Pure: the specs and the phone app read the same rules. Its one import is the import-free size unit table.
55
+ * Pure: the specs and the phone app read the same rules. Its imports are the import-free size unit table and the
56
+ * import-free row scalars (wrun-row-scalars.leaf).
56
57
  */
57
58
  import type { WrunScriptInputDeclaration } from './wrun-script-inputs.util.js';
58
59
  /** How a market-scaled param's default follows the market. */
@@ -109,6 +110,13 @@ export declare const WRUN_CME_ROOT_MIN_CONTRACTS_OTHER = 10;
109
110
  export declare const WRUN_MARKET_SCALED_PARAMS: Readonly<Record<string, Readonly<Record<string, WrunMarketScaledRule>>>>;
110
111
  /** The scaled params of a package, or undefined for a package that scales none. */
111
112
  export declare function wrunMarketScaledParamsOf(packageName: string | undefined): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
113
+ /**
114
+ * The scaled params of a package that are bound to the market they were typed on (settings-templates/market-bound): a
115
+ * size in coins or contracts, by rule kind alone (the coin rule, the contracts rule and the multiples of either). A
116
+ * size typed in a market's own unit means nothing on another market, so it is kept per market; a dollar size is an
117
+ * amount and an option is no size, so neither is named. None for a package outside WRUN_MARKET_SCALED_PARAMS.
118
+ */
119
+ export declare function wrunMarketBoundParamsOf(packageName: string | undefined): readonly string[];
112
120
  /** The scaled rules a sheet declares params for (a version of the package declares its own: 0.5.0 the coin rule,
113
121
  * 0.6.0 the dollar rule, 0.7.0 and 0.8.0 the option rule beside it), or undefined when it declares none. */
114
122
  export declare function wrunMarketScaledRulesOfSheet(rules: Readonly<Record<string, WrunMarketScaledRule>> | undefined, paramNames: Iterable<string>): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
@@ -147,6 +155,15 @@ export declare function wrunNiceFloor(value: number): number | undefined;
147
155
  * here (its default is `wrunMarketOptionVerdict`'s).
148
156
  */
149
157
  export declare function wrunMarketScaledDefaults(rules: Readonly<Record<string, WrunMarketScaledRule>>, dailyVolume: number | undefined, dailyDollarVolume?: number): Record<string, number> | undefined;
158
+ /**
159
+ * The default an UNTOUCHED `times` row (a Whale) takes while the row it multiplies (its Min) holds a value the user
160
+ * chose (typed or carried), Q-0166: never under `factor` times that value, so a Min typed above the Whale's market (or
161
+ * ranked) default never leaves every trade shown counted as a whale. `marketDefault` is the Whale's market or ranked
162
+ * default, `chosenBase` the Min in force. The run head's record patch (`wrunMarketSizeSettingsPatch`) is its only
163
+ * caller, so the engine copy, the workspace row, a carried value and a ranked commit all read it. The one rule to swap.
164
+ * Pure.
165
+ */
166
+ export declare function wrunTimesDefaultOverChosenBase(marketDefault: number, factor: number, chosenBase: number): number;
150
167
  /** The dollar unit a market's facts prove (wrun-chart-market-facts.util `wrunMarketDollarUnit`, read by the head): the
151
168
  * US dollars one price unit times one size unit is worth, or why it cannot be proven. */
152
169
  export type WrunMarketSizeDollarUnit = {
@@ -271,3 +288,19 @@ export declare function wrunRowsKeepingMarketDefaults(rows: WrunScriptInputDecla
271
288
  /** Whether a settings row can hold the market default of `rule`: a select for an option rule (`contracts-option`), a
272
289
  * number kind for every other rule and for no rule given; a sheet that retyped the param keeps its own. */
273
290
  export declare function isWrunMarketScaledRow(row: Pick<WrunScriptInputDeclaration, 'type'>, rule?: WrunMarketScaledRule): boolean;
291
+ /**
292
+ * A market-scaled row's value as the settings panel reads it (wrun-script-inputs.util `wrunRowValue`, the same reads):
293
+ * the stored value in the row's kind, a select's through the ONE select read and a number kind's through
294
+ * `numericValue`, else the row's default. Every kind `isWrunMarketScaledRow` accepts reads exactly as `wrunRowValue`
295
+ * does; a row of another kind (a sheet that retyped the param) reads its stored value as it is.
296
+ */
297
+ export declare function wrunMarketScaledRowValue(record: Readonly<Record<string, unknown>>, row: WrunScriptInputDeclaration): unknown;
298
+ /**
299
+ * Whether a market-scaled row holds a value the user chose (the market defaults never move it): a value off its row's
300
+ * default (the settings panel's reset test, `wrunRowValuesEqual` over the row's value), or the value a carry priced
301
+ * into it (`carriedValue`, C-DOLLAR), which counts as chosen even where it equals the row's default: a 0.5.0 Min size
302
+ * of 5,000 Binance delivery contracts of $100 carries $500,000, the sheet's default, and must not follow the next
303
+ * market's default. The ONE "typed" test: the run head (wrun-market-size-defaults.util) and settings-templates/
304
+ * market-bound both read it, and wrun-script-inputs.util re-exports it. Pure.
305
+ */
306
+ export declare function wrunMarketScaledRowChanged(record: Readonly<Record<string, unknown>>, row: WrunScriptInputDeclaration): boolean;
@@ -1,4 +1,5 @@
1
1
  import { WRUN_MARKET_SIZE_UNITS } from './wrun-market-facts.util.js';
2
+ import { numericValue, wrunRowValuesEqual, wrunSelectOptionValue } from './wrun-row-scalars.leaf.js';
2
3
  /**
3
4
  * Big Trades' Min size in contracts on a CME Group market whose prints are judged per aggressor order, by product root:
4
5
  * the smallest 1, 2 or 5 floor with at most 30 orders an hour on Friday 2026-10-23's open hour (at a flat 10, NQ showed
@@ -57,6 +58,20 @@ export function wrunMarketScaledParamsOf(packageName) {
57
58
  return undefined;
58
59
  return WRUN_MARKET_SCALED_PARAMS[packageName];
59
60
  }
61
+ /**
62
+ * The scaled params of a package that are bound to the market they were typed on (settings-templates/market-bound): a
63
+ * size in coins or contracts, by rule kind alone (the coin rule, the contracts rule and the multiples of either). A
64
+ * size typed in a market's own unit means nothing on another market, so it is kept per market; a dollar size is an
65
+ * amount and an option is no size, so neither is named. None for a package outside WRUN_MARKET_SCALED_PARAMS.
66
+ */
67
+ export function wrunMarketBoundParamsOf(packageName) {
68
+ const rules = wrunMarketScaledParamsOf(packageName);
69
+ if (rules === undefined)
70
+ return [];
71
+ return Object.entries(rules)
72
+ .filter(([, rule]) => isWrunCoinRule(rule, rules) || isWrunContractsRule(rule, rules))
73
+ .map(([name]) => name);
74
+ }
60
75
  /** The scaled rules a sheet declares params for (a version of the package declares its own: 0.5.0 the coin rule,
61
76
  * 0.6.0 the dollar rule, 0.7.0 and 0.8.0 the option rule beside it), or undefined when it declares none. */
62
77
  export function wrunMarketScaledRulesOfSheet(rules, paramNames) {
@@ -241,6 +256,17 @@ export function wrunMarketScaledDefaults(rules, dailyVolume, dailyDollarVolume)
241
256
  }
242
257
  return defaults;
243
258
  }
259
+ /**
260
+ * The default an UNTOUCHED `times` row (a Whale) takes while the row it multiplies (its Min) holds a value the user
261
+ * chose (typed or carried), Q-0166: never under `factor` times that value, so a Min typed above the Whale's market (or
262
+ * ranked) default never leaves every trade shown counted as a whale. `marketDefault` is the Whale's market or ranked
263
+ * default, `chosenBase` the Min in force. The run head's record patch (`wrunMarketSizeSettingsPatch`) is its only
264
+ * caller, so the engine copy, the workspace row, a carried value and a ranked commit all read it. The one rule to swap.
265
+ * Pure.
266
+ */
267
+ export function wrunTimesDefaultOverChosenBase(marketDefault, factor, chosenBase) {
268
+ return Math.max(marketDefault, Number((chosenBase * factor).toPrecision(12)));
269
+ }
244
270
  /** Whether a set of rules is the dollar family's (a dollar volume rule, or a multiple of one). */
245
271
  function readsDollarVolume(rules) {
246
272
  return Object.values(rules).some((rule) => rule.kind === 'daily-dollar-volume');
@@ -451,3 +477,34 @@ const WRUN_MARKET_SCALED_ROW_TYPES = new Set(['number', 'int', 'price']);
451
477
  export function isWrunMarketScaledRow(row, rule) {
452
478
  return rule?.kind === 'contracts-option' ? row.type === 'select' : WRUN_MARKET_SCALED_ROW_TYPES.has(row.type);
453
479
  }
480
+ /**
481
+ * A market-scaled row's value as the settings panel reads it (wrun-script-inputs.util `wrunRowValue`, the same reads):
482
+ * the stored value in the row's kind, a select's through the ONE select read and a number kind's through
483
+ * `numericValue`, else the row's default. Every kind `isWrunMarketScaledRow` accepts reads exactly as `wrunRowValue`
484
+ * does; a row of another kind (a sheet that retyped the param) reads its stored value as it is.
485
+ */
486
+ export function wrunMarketScaledRowValue(record, row) {
487
+ const stored = record[row.name];
488
+ if (stored === undefined || stored === null)
489
+ return row.defaultValue;
490
+ const fit = row.type === 'select'
491
+ ? wrunSelectOptionValue(row.options ?? [], row.optionLabels ?? [], stored)
492
+ : WRUN_MARKET_SCALED_ROW_TYPES.has(row.type)
493
+ ? numericValue(stored)
494
+ : stored;
495
+ return fit ?? row.defaultValue;
496
+ }
497
+ /**
498
+ * Whether a market-scaled row holds a value the user chose (the market defaults never move it): a value off its row's
499
+ * default (the settings panel's reset test, `wrunRowValuesEqual` over the row's value), or the value a carry priced
500
+ * into it (`carriedValue`, C-DOLLAR), which counts as chosen even where it equals the row's default: a 0.5.0 Min size
501
+ * of 5,000 Binance delivery contracts of $100 carries $500,000, the sheet's default, and must not follow the next
502
+ * market's default. The ONE "typed" test: the run head (wrun-market-size-defaults.util) and settings-templates/
503
+ * market-bound both read it, and wrun-script-inputs.util re-exports it. Pure.
504
+ */
505
+ export function wrunMarketScaledRowChanged(record, row) {
506
+ const value = wrunMarketScaledRowValue(record, row);
507
+ if (!wrunRowValuesEqual(row, value, row.defaultValue))
508
+ return true;
509
+ return typeof row.carriedValue === 'number' && wrunRowValuesEqual(row, value, row.carriedValue);
510
+ }
@@ -1,14 +1,7 @@
1
1
  import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
2
- import { type WrunMarketScaledRule, type WrunMarketSizeStoredUnit } from './wrun-market-size-defaults.leaf.js';
3
- import { type WrunScriptInputDeclaration } from './wrun-script-inputs.util.js';
4
- /**
5
- * Whether a market-scaled row holds a value the user chose (the market defaults never move it): a value off its row's
6
- * default (the settings panel's reset test, `wrunRowValuesEqual` over `wrunRowValue`), or the value a carry priced into
7
- * it (`carriedValue`, C-DOLLAR), which counts as chosen even where it equals the row's default: a 0.5.0 Min size of
8
- * 5,000 Binance delivery contracts of $100 carries $500,000, the sheet's default, and must not follow the next market's
9
- * default. Pure.
10
- */
11
- export declare function wrunMarketScaledRowChanged(record: Readonly<Record<string, unknown>>, row: WrunScriptInputDeclaration): boolean;
2
+ import { wrunMarketScaledRowChanged, type WrunMarketScaledRule, type WrunMarketSizeStoredUnit } from './wrun-market-size-defaults.leaf.js';
3
+ import { type WrunRankedCutoffs } from './wrun-market-size-rank.leaf.js';
4
+ export { wrunMarketScaledRowChanged };
12
5
  /**
13
6
  * The patch that moves a record (`settings`: its `scriptInputs` rows and each value flat under its row's name) to a
14
7
  * market's `defaults`: every scaled row whose value the user never chose (`wrunMarketScaledRowChanged`) takes the
@@ -19,7 +12,9 @@ export declare function wrunMarketScaledRowChanged(record: Readonly<Record<strin
19
12
  * as never changed on the first market whose default equals it, and the next market would move it (SOL 200, then ETH
20
13
  * whose default is 200, then SOL reset it to 1000). Its reset goes to the default of the market where the user changed
21
14
  * it, a save whose run head then moves the unchanged value on. A carried value (`carriedValue`) is a changed one too,
22
- * whatever its row's default. Undefined when the record already reads the defaults. Pure.
15
+ * whatever its row's default. An untouched `times` row (a Whale) whose base row (its Min) the user chose takes its
16
+ * default lifted over that value (`wrunTimesDefaultOverChosenBase`, Q-0166; read off `rules`). Undefined when the
17
+ * record already reads the defaults. Pure.
23
18
  */
24
19
  export declare function wrunMarketSizeSettingsPatch(settings: unknown, defaults: Readonly<Record<string, number>>, rules?: Readonly<Record<string, WrunMarketScaledRule>>): Record<string, unknown> | undefined;
25
20
  /** A pending carry: a dollar param (`to`) and the raw-unit value an older version's param (`from`) left for it. */
@@ -60,11 +55,78 @@ interface WrunMarketSizeChart {
60
55
  category?: unknown;
61
56
  resolvedContract?: unknown;
62
57
  }
58
+ /** A ranked tape floor's market default (the base the tape is asked at) and its whale param's, where that row is
59
+ * untouched too. */
60
+ export interface WrunMarketSizeBase {
61
+ readonly min: number;
62
+ /** The market's whale default (held to its row), whether or not the user set Whale: the ranked whale never drops
63
+ * under it, so a later reset of Whale never lands below the market's default. */
64
+ readonly whale?: number;
65
+ /** Whether the whale row is untouched, so the ranked whale may be written to it. */
66
+ readonly writesWhale: boolean;
67
+ }
68
+ /** What the rank step hands a ticket's commit for one floor param: the cutoffs (wrun-market-size-rank.leaf
69
+ * `wrunRankedCutoffs`) and the facts the ring line names. */
70
+ export interface WrunMarketSizeRanked {
71
+ readonly min: number;
72
+ readonly whale: number;
73
+ readonly source?: WrunRankedCutoffs['source'];
74
+ readonly n?: number;
75
+ readonly orders?: number;
76
+ readonly candles?: number;
77
+ }
78
+ /**
79
+ * The head's ticket for a run whose rows this browser computes ("the head decides, the row write waits for the
80
+ * rows"): the head wrote the engine copy (the ranked memo's value, else the base) and left the workspace row and the
81
+ * persist to `commit`, so a run writes the row once, with the ranked value when its tape rows reached the rank step,
82
+ * else with what the head resolved.
83
+ */
84
+ export interface WrunMarketSizeTicket {
85
+ readonly packageName: string;
86
+ /** Each ranked floor param the sheet declares whose row is untouched: its base (and its whale's). */
87
+ readonly base: Readonly<Record<string, WrunMarketSizeBase>>;
88
+ /** The value each of those params held before the head moved it (a previous session's stored untouched value). */
89
+ readonly held: Readonly<Record<string, number>>;
90
+ /** Whether the ranked memo held a value for each of those params (no ranking this run). */
91
+ readonly memo: Readonly<Record<string, boolean>>;
92
+ /** The floors the tape is asked at: the base of every ranked floor param untouched in `settings`, none for a param
93
+ * the user changed. Spread over the run's param values, so an untouched row is always asked at the base. */
94
+ askFloors(settings: unknown): Record<string, number>;
95
+ /** Idempotent (the first call wins), never rejects: with `ranked`, the memo, the engine copy and the row take the
96
+ * ranked values (value and default together); without, the row takes what the head resolved. One persist. */
97
+ commit(ranked?: Readonly<Record<string, WrunMarketSizeRanked>>): Promise<void>;
98
+ }
99
+ /**
100
+ * The rank step of a run that holds a ticket (pure): the orders the tape rows hold inside the candles the tape
101
+ * covers, ranked against the floor param the acquisition asked with. `servedFromMs` is the first stamp the tape ask
102
+ * serves (its history counted back from its as-of, `tradesServedStartMs`); the span runs from the later of it and the
103
+ * chart's first candle to the close of its last, so a replay's runway and a warm-up head before the first candle never
104
+ * count, and `candles` counts the chart's candles inside it (never the tape's dense grid). Coins rank each dollar
105
+ * cell over `price x valuePerUnit` (the tape is asked in dollars); dollars and contracts rank the cell as served.
106
+ * Undefined when there is nothing to rank: the param is no ticket floor (touched, no base) or its memo held a value, no
107
+ * candle lies in the span, or a coins tape has no proven unit.
108
+ */
109
+ export declare function wrunMarketSizeRankOf(input: {
110
+ ticket: WrunMarketSizeTicket;
111
+ floorParam: string | undefined;
112
+ rows: ReadonlyArray<ArrayLike<unknown>> | undefined;
113
+ chartRows: ReadonlyArray<ArrayLike<number>>;
114
+ chartIntervalMs: number;
115
+ servedFromMs: number;
116
+ valuePerUnit?: number;
117
+ }): Record<string, WrunMarketSizeRanked> | undefined;
63
118
  /**
64
119
  * Move an overlay's record to its chart market's scaled defaults (above), at the head of a full run, before the
65
120
  * lanes read the settings. Resolves once the engine copy reads the defaults (the persist is the routing's own); a
66
121
  * package that scales nothing returns at once, and nothing here ever throws over the run.
67
122
  *
123
+ * `ranks` (a run whose rows this browser computes, the sandbox source): a package with ranked tape floors
124
+ * (wrun-market-size-rank.leaf `WRUN_TAPE_RANKED_PARAMS`) the sheet declares gets a ticket back
125
+ * (`WrunMarketSizeTicket`). The head still writes the engine copy, an untouched ranked floor at the ranked memo's value
126
+ * for this market (`replay` keys a replay apart), else at the base; the workspace row and its persist wait for the
127
+ * ticket's `commit`. Without `ranks` (a record the server computes: it receives literal numbers) the head writes both
128
+ * as it always did and returns undefined.
129
+ *
68
130
  * Every fact is proven the keyed market's before it is kept or written: `market` is the market the run computes for
69
131
  * (C4: the chart's market identity at the run head, `wrunChartMarketIdentity`, and the reader of the chart's metadata
70
132
  * now), and `isCurrent` says the run is still the overlay's own (its chart and mount stand). After each await, in the
@@ -84,5 +146,6 @@ export declare function reconcileWrunMarketSizeDefaults(args: {
84
146
  read: () => WrunMarketSizeChart | null | undefined;
85
147
  };
86
148
  isCurrent: () => boolean;
87
- }): Promise<void>;
88
- export {};
149
+ ranks?: boolean;
150
+ replay?: boolean;
151
+ }): Promise<WrunMarketSizeTicket | undefined>;