@orangecharts/wrun-chart-host 0.7.0 → 0.8.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 +25 -2
- package/dist/constants/feature-flags.constants.d.ts +1 -0
- package/dist/constants/feature-flags.constants.js +5 -0
- package/dist/constants/option-venues.constants.d.ts +18 -0
- package/dist/constants/option-venues.constants.js +14 -0
- package/dist/constants/venue-presets.constants.d.ts +17 -3
- package/dist/constants/venue-presets.constants.js +17 -3
- package/dist/host-env.d.ts +24 -0
- package/dist/host-env.js +21 -0
- package/dist/host-ports.types.d.ts +12 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
- package/dist/indicators/controls/tpo-session.util.js +138 -14
- package/dist/interfaces/option-instrument.interface.d.ts +6 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +4 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +4 -0
- package/dist/settings-templates/footprint-rows.d.ts +25 -0
- package/dist/settings-templates/footprint-rows.js +127 -0
- package/dist/settings-templates/form-rows.d.ts +56 -0
- package/dist/settings-templates/form-rows.js +19 -0
- package/dist/settings-templates/frvp-fields.js +14 -0
- package/dist/settings-templates/index.d.ts +11 -0
- package/dist/settings-templates/index.js +29 -6
- package/dist/settings-templates/indicator-fields.d.ts +2 -0
- package/dist/settings-templates/indicator-fields.js +78 -0
- package/dist/settings-templates/tool-rules.d.ts +40 -4
- package/dist/settings-templates/tool-rules.js +45 -4
- package/dist/settings-templates/tool-tables.generated.js +22 -2
- package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
- package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
- package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
- package/dist/utility/chart/footprint-columns.util.js +106 -0
- package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
- package/dist/utility/chart/footprint-display-mode.util.js +62 -0
- package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
- package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +4 -2
- package/dist/utility/chart/om-panel.util.d.ts +11 -0
- package/dist/utility/chart/om-panel.util.js +59 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
- package/dist/utility/chart/window-geometry.leaf.js +78 -6
- package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
- package/dist/utility/chart/window-owner.leaf.js +5 -0
- package/dist/utility/options/cme-options-root.util.d.ts +25 -0
- package/dist/utility/options/cme-options-root.util.js +40 -0
- package/dist/utility/options/option-book.util.d.ts +27 -0
- package/dist/utility/options/option-book.util.js +76 -0
- package/dist/utility/options/option-trade-date.util.d.ts +50 -0
- package/dist/utility/options/option-trade-date.util.js +120 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
- package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
- package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
- package/dist/utility/wrun/sources/row-lane-registry.js +9 -5
- package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +100 -23
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +47 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +71 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +14 -1
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +30 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +45 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +115 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +10 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +57 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +60 -6
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +160 -23
- package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
- package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
- package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-color-settings.util.js +26 -11
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-draft-overlay.util.js +40 -3
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +4 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
- package/dist/utility/wrun/wrun-live-tick.util.js +39 -6
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +106 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +159 -0
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +44 -0
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +213 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +133 -3
- package/dist/utility/wrun/wrun-option-prints.util.js +318 -8
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +96 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +215 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +342 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +742 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +183 -3
- package/dist/utility/wrun/wrun-option-views.util.js +504 -7
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
- package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +7 -2
- package/dist/utility/wrun/wrun-overlay-run.util.js +120 -18
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +9 -8
- package/dist/utility/wrun/wrun-pack.util.js +21 -15
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +17 -2
- package/dist/utility/wrun/wrun-panel-style.util.js +47 -9
- package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
- package/dist/utility/wrun/wrun-refusal.util.js +7 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +18 -0
- package/package.json +3 -3
|
@@ -48,12 +48,14 @@
|
|
|
48
48
|
* change follow it, the way a timeframe or symbol param rewrites its pins.
|
|
49
49
|
* A value equal to the baked `ticks_per_bar` writes nothing; the lane util
|
|
50
50
|
* clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
|
|
51
|
-
* -
|
|
51
|
+
* - An option word's params (OPTLOAD G5, wrun-option-views.util,
|
|
52
52
|
* `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
|
|
53
|
-
* input that declares views,
|
|
54
|
-
*
|
|
55
|
-
* param
|
|
56
|
-
*
|
|
53
|
+
* input that declares views, an `option_surface` input its `pick` and an
|
|
54
|
+
* `option_strikes` input its kit `fold` (the classes the words' own tables
|
|
55
|
+
* name), each param knob bound to a declared param (`"@<param>"`, or
|
|
56
|
+
* `<knob>_param` beside a literal default) takes the param's current value,
|
|
57
|
+
* the `ticks_per_bar` rule, so a settings change asks the gateway with the
|
|
58
|
+
* new values.
|
|
57
59
|
* - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
|
|
58
60
|
* - A Style page row (`__style__<output>__<property>`, an FE-only declared
|
|
59
61
|
* input that never reaches any host) writes the output's `width`,
|
|
@@ -48,12 +48,14 @@
|
|
|
48
48
|
* change follow it, the way a timeframe or symbol param rewrites its pins.
|
|
49
49
|
* A value equal to the baked `ticks_per_bar` writes nothing; the lane util
|
|
50
50
|
* clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
|
|
51
|
-
* -
|
|
51
|
+
* - An option word's params (OPTLOAD G5, wrun-option-views.util,
|
|
52
52
|
* `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
|
|
53
|
-
* input that declares views,
|
|
54
|
-
*
|
|
55
|
-
* param
|
|
56
|
-
*
|
|
53
|
+
* input that declares views, an `option_surface` input its `pick` and an
|
|
54
|
+
* `option_strikes` input its kit `fold` (the classes the words' own tables
|
|
55
|
+
* name), each param knob bound to a declared param (`"@<param>"`, or
|
|
56
|
+
* `<knob>_param` beside a literal default) takes the param's current value,
|
|
57
|
+
* the `ticks_per_bar` rule, so a settings change asks the gateway with the
|
|
58
|
+
* new values.
|
|
57
59
|
* - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
|
|
58
60
|
* - A Style page row (`__style__<output>__<property>`, an FE-only declared
|
|
59
61
|
* input that never reaches any host) writes the output's `width`,
|
|
@@ -91,7 +93,7 @@ import { WRUN_SOURCE_FIELD_WORDS, wrunInputGateOn } from './wrun-market-facts.ut
|
|
|
91
93
|
import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
|
|
92
94
|
import { bindWrunColorSettings } from './wrun-color-settings.lazy.js';
|
|
93
95
|
import { WRUN_LEVELS_COLOR_PICKED_KEY } from './wrun-style-flags.util.js';
|
|
94
|
-
import { wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
|
|
96
|
+
import { WRUN_OPTION_LANE_WORDS, WRUN_OPTION_VIEWS, wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
|
|
95
97
|
import { findWrunVisibilityTarget, wrunVisibilitySectionOfPrefix, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
|
|
96
98
|
import { isWrunHudViewerRowKey, packWrunColor, parseWrunColor, WRUN_HEATMAP_SENSITIVITY_ROW_RE, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_LOOK_ROW_RE, } from './wrun-color-facts.util.js';
|
|
97
99
|
// The key predicates and the colour parse are thin facts boot-path readers take without this
|
|
@@ -1093,11 +1095,24 @@ function viewParamBinding(source, knob) {
|
|
|
1093
1095
|
? reference.slice(1)
|
|
1094
1096
|
: undefined;
|
|
1095
1097
|
}
|
|
1098
|
+
let optionParamClasses;
|
|
1099
|
+
/** The classes whose declared words take params, off the words' own tables (OPTLOAD G5): a chain view's class
|
|
1100
|
+
* (`WRUN_OPTION_VIEWS`) and a per-bar word's (`WRUN_OPTION_LANE_WORDS`: the `option_surface` pick, the `option_strikes`
|
|
1101
|
+
* kit fold), never a list here, so a class the tables gain has its handles written the run it lands. */
|
|
1102
|
+
function wrunOptionParamClasses() {
|
|
1103
|
+
optionParamClasses ??= new Set([
|
|
1104
|
+
...Object.values(WRUN_OPTION_VIEWS).map((spec) => spec.cls),
|
|
1105
|
+
...Object.keys(WRUN_OPTION_LANE_WORDS),
|
|
1106
|
+
]);
|
|
1107
|
+
return optionParamClasses;
|
|
1108
|
+
}
|
|
1096
1109
|
/**
|
|
1097
|
-
* The
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
*
|
|
1110
|
+
* The option word param bindings (OPTLOAD G5, wrun-option-views.util): on an input of a class whose words take params
|
|
1111
|
+
* (`wrunOptionParamClasses`: an `options_chain` or `option_contract_state` input declaring views, `page_view` or
|
|
1112
|
+
* `page_views`; an `option_surface` input declaring its `pick`, an `option_strikes` input its `fold`), every param knob
|
|
1113
|
+
* its declared words take (`wrunOptionViewParamKnobs`; a flag takes none) bound to a declared param takes that param's
|
|
1114
|
+
* current value (`wrunValueParamSetting`: the setting, else the declared default; a select's picked value), so the
|
|
1115
|
+
* lane's ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
|
|
1101
1116
|
* nothing; an unknown param or a value that is not a finite number writes nothing either, so the handle reaches the
|
|
1102
1117
|
* lane, which refuses it by name.
|
|
1103
1118
|
*/
|
|
@@ -1106,7 +1121,7 @@ function optionViewParamWrites(metadata, settings) {
|
|
|
1106
1121
|
const params = Array.isArray(metadata.params) ? metadata.params : [];
|
|
1107
1122
|
const writes = [];
|
|
1108
1123
|
for (const [name, source] of Object.entries(sources)) {
|
|
1109
|
-
if (!isRecord(source) || (
|
|
1124
|
+
if (!isRecord(source) || !wrunOptionParamClasses().has(source.source))
|
|
1110
1125
|
continue;
|
|
1111
1126
|
for (const knob of wrunOptionViewParamKnobs(source)) {
|
|
1112
1127
|
const bound = viewParamBinding(source, knob);
|
|
@@ -92,9 +92,11 @@ export interface WrunSourceCountMetadataLike {
|
|
|
92
92
|
* - `stream_currency`: a lane stream's quote (`oi_candles`, `volume_profile_candles`: absent or any word but "USD"
|
|
93
93
|
* reads Coin, the streams' default), one leg fetch per quote;
|
|
94
94
|
* - `ticks_per_bar`: a profile stream's bucket size as the profile lane normalizes it (a whole number 1 to 500,
|
|
95
|
-
* absent or invalid 1); an unresolved `"@<param>"` reads as written (its param resolves it before the run)
|
|
95
|
+
* absent or invalid 1); an unresolved `"@<param>"` reads as written (its param resolves it before the run);
|
|
96
|
+
* - the grouped flow knobs (OPTLOAD G3, each value its own read): numbers as they are, a setting's name as written, a
|
|
97
|
+
* flag true or false, `flow_expiries` absent "all", `span` absent "bar", `flow_history` (`history`) absent "window".
|
|
96
98
|
*/
|
|
97
|
-
export type WrunKScriptPayloadKey = 'market' | 'odds' | 'interval' | 'expiries' | 'delta' | 'venue' | 'fund' | 'publisher' | 'series' | 'token' | 'asset' | 'ref' | 'min_size' | 'history' | 'scope' | 'dte' | 'moneyness' | 'chain_venue' | 'book' | 'stream_currency' | 'ticks_per_bar';
|
|
99
|
+
export type WrunKScriptPayloadKey = 'market' | 'odds' | 'interval' | 'expiries' | 'delta' | 'venue' | 'fund' | 'publisher' | 'series' | 'token' | 'asset' | 'ref' | 'min_size' | 'history' | 'scope' | 'dte' | 'moneyness' | 'chain_venue' | 'book' | 'stream_currency' | 'ticks_per_bar' | 'group' | 'flow_expiries' | 'strike_window_pct' | 'strike_rows' | 'min_volume' | 'min_premium' | 'split_dte' | 'fold_types' | 'span' | 'flow_history';
|
|
98
100
|
/** How a wrun source class reads as a kScript source call. */
|
|
99
101
|
export interface WrunKScriptSourceMapping {
|
|
100
102
|
/** The kScript-equivalent source type (a SOURCE_TYPE_CONFIG key, or a K data
|
|
@@ -166,9 +166,30 @@ export const WRUN_KSCRIPT_SOURCE_CLASSES = Object.freeze({
|
|
|
166
166
|
// until the identity reaches the chart (wrun-browser-sources.leaf WRUN_BROWSER_REFUSED_CLASS_CODES).
|
|
167
167
|
option_prints_v2: { type: null, payload: ['chain_venue', 'book'] },
|
|
168
168
|
// The per-contract flow of the chart's chain (sources/row-lanes/option_contract_flow, a chain lane): one read per
|
|
169
|
-
// chart market, venue word and book at the bars' tier;
|
|
170
|
-
// and the volume floor fold on the chart).
|
|
171
|
-
option_contract_flow: {
|
|
169
|
+
// chart market, venue word and book at the bars' tier; `0dte`, the span, the history and the premium floor narrow it
|
|
170
|
+
// (the nearest expiries, the strike window and the volume floor fold on the chart).
|
|
171
|
+
option_contract_flow: {
|
|
172
|
+
type: null,
|
|
173
|
+
payload: ['market', 'expiries', 'chain_venue', 'book', 'span', 'flow_history', 'min_premium'],
|
|
174
|
+
},
|
|
175
|
+
// The flow by strike and expiry of the chart's chain (OPTLOAD G3): every knob value is a read of its own.
|
|
176
|
+
option_strike_flow: {
|
|
177
|
+
type: null,
|
|
178
|
+
payload: [
|
|
179
|
+
'market',
|
|
180
|
+
'chain_venue',
|
|
181
|
+
'book',
|
|
182
|
+
'group',
|
|
183
|
+
'flow_expiries',
|
|
184
|
+
'strike_window_pct',
|
|
185
|
+
'strike_rows',
|
|
186
|
+
'split_dte',
|
|
187
|
+
'fold_types',
|
|
188
|
+
'span',
|
|
189
|
+
'flow_history',
|
|
190
|
+
'min_volume',
|
|
191
|
+
],
|
|
192
|
+
},
|
|
172
193
|
series: { type: null, payload: ['ref'] },
|
|
173
194
|
// The flow scope rows of the chart's chain (sources/lanes/options_flow, a chain lane read by `auto`, its `venue` a
|
|
174
195
|
// scope's venue): one fetch per scope, dte, moneyness, venue and a ticker's book.
|
|
@@ -300,6 +321,22 @@ function payloadEntry(key, entry) {
|
|
|
300
321
|
return ['currency', entry.currency === 'USD' ? 'USD' : 'Coin'];
|
|
301
322
|
case 'ticks_per_bar':
|
|
302
323
|
return ['ticks_per_bar', streamTicksPerBar(entry.ticks_per_bar)];
|
|
324
|
+
case 'flow_expiries':
|
|
325
|
+
return ['expiries', knobWord(entry.expiries) ?? 'all'];
|
|
326
|
+
case 'strike_window_pct':
|
|
327
|
+
case 'strike_rows':
|
|
328
|
+
case 'min_volume':
|
|
329
|
+
case 'min_premium': {
|
|
330
|
+
const value = entry[key];
|
|
331
|
+
return [key, typeof value === 'number' ? value : (knobWord(value) ?? null)];
|
|
332
|
+
}
|
|
333
|
+
case 'split_dte':
|
|
334
|
+
case 'fold_types':
|
|
335
|
+
return [key, entry[key] === true];
|
|
336
|
+
case 'span':
|
|
337
|
+
return ['span', knobWord(entry.span) ?? 'bar'];
|
|
338
|
+
case 'flow_history':
|
|
339
|
+
return ['history', knobWord(entry.history) ?? 'window'];
|
|
303
340
|
default:
|
|
304
341
|
return [key, knobWord(entry[key]) ?? null];
|
|
305
342
|
}
|
|
@@ -341,7 +341,7 @@ export declare function wrunFrameRefusalMemory(text: string): 'window' | 'identi
|
|
|
341
341
|
*/
|
|
342
342
|
export declare const WRUN_KIT_REFUSAL_STAGES: {
|
|
343
343
|
readonly validate: readonly ["wrun_abi_unsupported", "wrun_pin_venue_unknown", "wrun_sheet_over_cap", "wrun_abi_channel_missing", "wrun_intrabar_interval_required", "wrun_intrabar_primary", "wrun_candles_interval_required", "wrun_candles_primary", "wrun_options_chain_venue", "wrun_options_chain_expiries", "wrun_options_chain_market_pinned", "wrun_offset_needs_view", "wrun_offset_count_required", "wrun_bars_needs_leg", "wrun_chart_interval_below_needs_candles", "wrun_chart_interval_below_primary", "wrun_chart_interval_below_forming", "wrun_pin_venue_refused", "wrun_pin_symbol_literal", "wrun_tape_history_unavailable", "wrun_strategy_feed_not_ohlcv", "wrun_strategy_slippage_model_unsupported", "wrun_strategy_reserved_output", "wrun_tape_min_size_invalid", "wrun_option_knob_invalid", "wrun_option_market_pinned", "wrun_option_prints_min_premium_required", "wrun_options_flow_venue_field", "wrun_options_flow_venue_required", "wrun_options_flow_venue_scope", "wrun_oi_candles_interval_required", "wrun_oi_candles_primary", "wrun_volume_profile_candles_interval_required", "wrun_volume_profile_candles_primary"];
|
|
344
|
-
readonly plan: readonly ["wrun_options_coin_unknown", "wrun_source_unsupported", "wrun_not_in_10m_universe", "wrun_opra_lane_refused", "wrun_opra_official_only", "wrun_option_contract_flow_unsupported", "wrun_option_contract_state_unsupported", "wrun_option_daily_unsupported", "wrun_option_prints_one_acquisition", "wrun_option_prints_unsupported", "wrun_option_prints_v2_unsupported", "wrun_option_stats_10m_unsupported", "wrun_option_surface_unsupported", "wrun_options_flow_unsupported", "wrun_field_unsupported", "wrun_tenor_unsupported", "wrun_view_unsupported", "wrun_family_unsupported", "wrun_displacement_needs_cap", "wrun_options_chain_venue_unavailable", "wrun_options_chain_unavailable", "wrun_options_chain_one_venue", "wrun_lane_input_refused", "wrun_permission_denied", "wrun_coin_leg_unsupported", "wrun_coin_leg_unresolved", "wrun_pin_unsupported", "wrun_custom_interval_unsupported", "wrun_intrabar_leg_off_grid", "wrun_intrabar_ratio_over_cap", "wrun_intrabar_unsupported", "wrun_candles_bars_over_cap", "wrun_candles_ratio_over_cap", "wrun_oi_candles_unsupported", "wrun_volume_profile_candles_unsupported", "wrun_trade_volume_by_size_unsupported", "wrun_view_leg_off_grid", "wrun_view_leg_equal", "wrun_time_facts_unsupported", "wrun_etf_flow_unsupported", "wrun_volatility_index_unsupported", "wrun_long_short_ratio_unsupported", "wrun_options_oi_unsupported", "wrun_options_volume_unsupported", "wrun_ethena_positions_unsupported", "wrun_etf_holdings_unsupported", "wrun_etf_premium_unsupported", "wrun_economic_unsupported", "wrun_treasury_balance_unsupported", "wrun_bitfinex_funding_unsupported", "wrun_strategy_costs_in_sheet", "wrun_window_bars_invalid", "wrun_cells_unavailable", "wrun_tape_unavailable", "wrun_tape_interval_unsupported", "wrun_metric_source_missing_policy", "wrun_series_source_primary", "wrun_series_source_densification", "wrun_metric_pin_coarser_than_primary", "wrun_forming_primary_not_own_candles", "wrun_package_lock_invalid", "wrun_package_lock_missing", "wrun_package_not_installed", "wrun_package_lock_mismatch", "wrun_composition_cycle", "wrun_composition_depth", "wrun_options_chain_unsupported", "wrun_volume_profile_ticks_unsupported", "wrun_celled_metric_unsupported", "wrun_series_source_missing", "wrun_series_source_invalid", "wrun_params_invalid", "wrun_source_bindings_invalid", "wrun_output_displaced", "wrun_pin_unresolvable"];
|
|
344
|
+
readonly plan: readonly ["wrun_options_coin_unknown", "wrun_source_unsupported", "wrun_not_in_10m_universe", "wrun_opra_lane_refused", "wrun_opra_official_only", "wrun_option_contract_flow_unsupported", "wrun_option_contract_state_unsupported", "wrun_option_daily_unsupported", "wrun_option_prints_one_acquisition", "wrun_option_prints_unsupported", "wrun_option_prints_v2_unsupported", "wrun_option_stats_10m_unsupported", "wrun_option_strike_flow_unsupported", "wrun_option_surface_unsupported", "wrun_option_views_unserved", "wrun_options_flow_unsupported", "wrun_field_unsupported", "wrun_tenor_unsupported", "wrun_view_unsupported", "wrun_family_unsupported", "wrun_displacement_needs_cap", "wrun_options_chain_venue_unavailable", "wrun_options_chain_unavailable", "wrun_options_chain_one_venue", "wrun_lane_input_refused", "wrun_permission_denied", "wrun_coin_leg_unsupported", "wrun_coin_leg_unresolved", "wrun_pin_unsupported", "wrun_custom_interval_unsupported", "wrun_intrabar_leg_off_grid", "wrun_intrabar_ratio_over_cap", "wrun_intrabar_unsupported", "wrun_candles_bars_over_cap", "wrun_candles_ratio_over_cap", "wrun_oi_candles_unsupported", "wrun_volume_profile_candles_unsupported", "wrun_trade_volume_by_size_unsupported", "wrun_view_leg_off_grid", "wrun_view_leg_equal", "wrun_time_facts_unsupported", "wrun_etf_flow_unsupported", "wrun_volatility_index_unsupported", "wrun_long_short_ratio_unsupported", "wrun_options_oi_unsupported", "wrun_options_volume_unsupported", "wrun_ethena_positions_unsupported", "wrun_etf_holdings_unsupported", "wrun_etf_premium_unsupported", "wrun_economic_unsupported", "wrun_treasury_balance_unsupported", "wrun_bitfinex_funding_unsupported", "wrun_strategy_costs_in_sheet", "wrun_window_bars_invalid", "wrun_cells_unavailable", "wrun_tape_unavailable", "wrun_tape_interval_unsupported", "wrun_metric_source_missing_policy", "wrun_series_source_primary", "wrun_series_source_densification", "wrun_metric_pin_coarser_than_primary", "wrun_forming_primary_not_own_candles", "wrun_package_lock_invalid", "wrun_package_lock_missing", "wrun_package_not_installed", "wrun_package_lock_mismatch", "wrun_composition_cycle", "wrun_composition_depth", "wrun_options_chain_unsupported", "wrun_volume_profile_ticks_unsupported", "wrun_celled_metric_unsupported", "wrun_series_source_missing", "wrun_series_source_invalid", "wrun_params_invalid", "wrun_source_bindings_invalid", "wrun_output_displaced", "wrun_pin_unresolvable"];
|
|
345
345
|
readonly shape: readonly ["wrun_draw_kind_limit", "wrun_draw_total_limit", "wrun_draw_polyline_too_large", "wrun_draw_calls_per_row", "wrun_render_result_too_large", "wrun_draw_kind_mismatch", "wrun_draw_handle_missing", "wrun_draw_label_slot_absent", "wrun_draw_non_finite", "wrun_draw_phase", "wrun_draw_id_negative", "wrun_draw_kind_undeclared", "wrun_draw_prop_unknown", "wrun_draw_prop_unsupported", "wrun_draw_style_out_of_range", "wrun_draw_polyline_empty", "wrun_draw_polyline_out_of_bounds", "wrun_draw_label_slot_undeclared", "wrun_draw_polyline_budget", "wrun_strategy_id_limit", "wrun_strategy_id_too_long", "wrun_strategy_id_invalid_utf8", "wrun_strategy_calls_per_row", "wrun_strategy_trade_limit", "wrun_strategy_non_finite", "wrun_strategy_bad_direction", "wrun_strategy_not_declared", "wrun_strategy_phase", "wrun_strategy_id_out_of_bounds", "wrun_text_param_phase", "wrun_text_param_memory", "wrun_bar_count_phase", "wrun_frame_invalid", "wrun_frame_phase", "wrun_frame_undeclared", "wrun_frame_length", "wrun_frame_too_large", "wrun_frame_run_too_large", "wrun_frame_memory", "wrun_frame_utf8"];
|
|
346
346
|
readonly pack: readonly ["wrun_cell_block_invalid", "wrun_run_cells_too_large", "wrun_cell_block_too_large"];
|
|
347
347
|
readonly align: readonly ["wrun_densify_empty_fetch", "wrun_densify_mixed_phase", "wrun_liquidation_side_unmatched", "wrun_bound_series_empty", "wrun_cell_data_malformed"];
|
|
@@ -536,7 +536,11 @@ export const WRUN_KIT_REFUSAL_STAGES = {
|
|
|
536
536
|
// kit 0.88.0 (OPTIONS-PORT P7): the prints with their block and RFQ identity, a host that does not serve them.
|
|
537
537
|
'wrun_option_prints_v2_unsupported',
|
|
538
538
|
'wrun_option_stats_10m_unsupported',
|
|
539
|
+
// kit 0.89.0 (OPTLOAD G3): a host that does not serve the per-strike and per-expiry option flow.
|
|
540
|
+
'wrun_option_strike_flow_unsupported',
|
|
539
541
|
'wrun_option_surface_unsupported',
|
|
542
|
+
// kit 0.90.0 (OPTLOAD G5): a chain page view, surface pick or strike kit fold on a host that serves no view.
|
|
543
|
+
'wrun_option_views_unserved',
|
|
540
544
|
'wrun_options_flow_unsupported',
|
|
541
545
|
'wrun_field_unsupported',
|
|
542
546
|
'wrun_tenor_unsupported',
|
|
@@ -8,15 +8,41 @@
|
|
|
8
8
|
* (`wrunLaneRefusedText`), and the main thread reads the code back off whatever error wraps that text on its way
|
|
9
9
|
* (`wrunLaneRefusedCodeOf`: the transport keeps the worker's words);
|
|
10
10
|
* - the run degrades the lane under its name, terminally (the chip says the source is missing and no ladder re-asks
|
|
11
|
-
* it), in the record its lane declares for the code (`WrunPollLane.refusedAnswers
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* it), in the record its lane declares for the code (`WrunPollLane.refusedAnswers`, a row-builder lane's in the run's
|
|
12
|
+
* own table: the tape over the trades worker's cap) when it declares one;
|
|
13
|
+
* - a run that holds on such a lane settles `held` with `WRUN_LANE_REFUSED_SETTLE_REASON`, so the chart store's
|
|
14
|
+
* settings reconcile shows the edit as not applied at once instead of running the same settings again;
|
|
15
|
+
* - a live reconcile reads it by what its code declares (`WRUN_LANE_REFUSALS`): a read the plane serves nothing for
|
|
16
|
+
* is an answer with no new rows (its window covered, the held rows kept, no warning, so the session never widens
|
|
17
|
+
* its window or warns on every poll); a window over the read's cap holds data the chart lacks, so it stays owed and
|
|
18
|
+
* the session hands the overlay back to a full run, whose record names the way out.
|
|
14
19
|
*
|
|
15
20
|
* Import-free: the worker twins and the main thread read the same mark.
|
|
16
21
|
*/
|
|
22
|
+
/** The reason a run that held on a lane refused by name settles with (`held`): the same settings ask the same read
|
|
23
|
+
* and are refused again, so the chart store's settings reconcile spends no rerun on them. */
|
|
24
|
+
export declare const WRUN_LANE_REFUSED_SETTLE_REASON = "lane-refused";
|
|
17
25
|
/** The mark a named refusal's text carries before its code. */
|
|
18
26
|
export declare const WRUN_LANE_REFUSED_MARK = "wrun-lane-refused:";
|
|
19
27
|
/** The text a worker twin ends a refused read with: the mark, the code (lower case, digits and dashes), the detail. */
|
|
20
28
|
export declare function wrunLaneRefusedText(code: string, detail: string): string;
|
|
21
29
|
/** The code of a named refusal an error (or its text) carries, or undefined for any other failure. */
|
|
22
30
|
export declare function wrunLaneRefusedCodeOf(error: unknown): string | undefined;
|
|
31
|
+
/** What a refusal by name says of the window it was asked for. */
|
|
32
|
+
export type WrunLaneRefusalMeaning =
|
|
33
|
+
/** The plane serves nothing for this read, on any ask (a switch keeps it off, a series it samples elsewhere only, a
|
|
34
|
+
* request this host does not read): the window holds nothing the chart lacks. */
|
|
35
|
+
'nothing-served'
|
|
36
|
+
/** The window holds more than the read takes (the trades worker's cap): the data is there, so the window is not
|
|
37
|
+
* covered, and only another ask (a higher floor, a shorter window) can read it. */
|
|
38
|
+
| 'over-cap';
|
|
39
|
+
/**
|
|
40
|
+
* Every code a worker twin refuses by name, with what it says of the window (the codes' own modules name them:
|
|
41
|
+
* wrun-option-views.util, wrun-protocol-pending.util, wrun-opra-stats.leaf, wrun-opra-flow.leaf, wrun-tape-source.util
|
|
42
|
+
* and the twins' literal ask refusals). tests/utility/wrun/wrun-lane-refusal.leaf.spec.ts walks every
|
|
43
|
+
* `wrunLaneRefusedText` call in the workers and the package and fails on a code missing here, so a new refusal says
|
|
44
|
+
* whether a live reconcile may read its window as covered before it ships.
|
|
45
|
+
*/
|
|
46
|
+
export declare const WRUN_LANE_REFUSALS: Readonly<Record<string, WrunLaneRefusalMeaning>>;
|
|
47
|
+
/** Whether a refusal by name leaves its window owed (`over-cap`): a live reconcile never reads it as covered. */
|
|
48
|
+
export declare function wrunLaneRefusalLeavesWindowOwed(code: string): boolean;
|
|
@@ -8,12 +8,20 @@
|
|
|
8
8
|
* (`wrunLaneRefusedText`), and the main thread reads the code back off whatever error wraps that text on its way
|
|
9
9
|
* (`wrunLaneRefusedCodeOf`: the transport keeps the worker's words);
|
|
10
10
|
* - the run degrades the lane under its name, terminally (the chip says the source is missing and no ladder re-asks
|
|
11
|
-
* it), in the record its lane declares for the code (`WrunPollLane.refusedAnswers
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* it), in the record its lane declares for the code (`WrunPollLane.refusedAnswers`, a row-builder lane's in the run's
|
|
12
|
+
* own table: the tape over the trades worker's cap) when it declares one;
|
|
13
|
+
* - a run that holds on such a lane settles `held` with `WRUN_LANE_REFUSED_SETTLE_REASON`, so the chart store's
|
|
14
|
+
* settings reconcile shows the edit as not applied at once instead of running the same settings again;
|
|
15
|
+
* - a live reconcile reads it by what its code declares (`WRUN_LANE_REFUSALS`): a read the plane serves nothing for
|
|
16
|
+
* is an answer with no new rows (its window covered, the held rows kept, no warning, so the session never widens
|
|
17
|
+
* its window or warns on every poll); a window over the read's cap holds data the chart lacks, so it stays owed and
|
|
18
|
+
* the session hands the overlay back to a full run, whose record names the way out.
|
|
14
19
|
*
|
|
15
20
|
* Import-free: the worker twins and the main thread read the same mark.
|
|
16
21
|
*/
|
|
22
|
+
/** The reason a run that held on a lane refused by name settles with (`held`): the same settings ask the same read
|
|
23
|
+
* and are refused again, so the chart store's settings reconcile spends no rerun on them. */
|
|
24
|
+
export const WRUN_LANE_REFUSED_SETTLE_REASON = 'lane-refused';
|
|
17
25
|
/** The mark a named refusal's text carries before its code. */
|
|
18
26
|
export const WRUN_LANE_REFUSED_MARK = 'wrun-lane-refused:';
|
|
19
27
|
const WRUN_LANE_REFUSED_RE = /wrun-lane-refused:([a-z0-9][a-z0-9-]*)/;
|
|
@@ -30,3 +38,25 @@ export function wrunLaneRefusedCodeOf(error) {
|
|
|
30
38
|
return undefined;
|
|
31
39
|
return WRUN_LANE_REFUSED_RE.exec(text)?.[1];
|
|
32
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Every code a worker twin refuses by name, with what it says of the window (the codes' own modules name them:
|
|
43
|
+
* wrun-option-views.util, wrun-protocol-pending.util, wrun-opra-stats.leaf, wrun-opra-flow.leaf, wrun-tape-source.util
|
|
44
|
+
* and the twins' literal ask refusals). tests/utility/wrun/wrun-lane-refusal.leaf.spec.ts walks every
|
|
45
|
+
* `wrunLaneRefusedText` call in the workers and the package and fails on a code missing here, so a new refusal says
|
|
46
|
+
* whether a live reconcile may read its window as covered before it ships.
|
|
47
|
+
*/
|
|
48
|
+
export const WRUN_LANE_REFUSALS = Object.freeze({
|
|
49
|
+
'option-views-ask': 'nothing-served',
|
|
50
|
+
'option-views-unserved': 'nothing-served',
|
|
51
|
+
'option-stats-ask': 'nothing-served',
|
|
52
|
+
'not-in-10m-universe': 'nothing-served',
|
|
53
|
+
'options-flow-ask': 'nothing-served',
|
|
54
|
+
'options-flow-prints-unserved': 'nothing-served',
|
|
55
|
+
'option-scope-reads-off': 'nothing-served',
|
|
56
|
+
'protocol-pending': 'nothing-served',
|
|
57
|
+
'tape-too-many-trades': 'over-cap',
|
|
58
|
+
});
|
|
59
|
+
/** Whether a refusal by name leaves its window owed (`over-cap`): a live reconcile never reads it as covered. */
|
|
60
|
+
export function wrunLaneRefusalLeavesWindowOwed(code) {
|
|
61
|
+
return Object.hasOwn(WRUN_LANE_REFUSALS, code) && WRUN_LANE_REFUSALS[code] === 'over-cap';
|
|
62
|
+
}
|
|
@@ -95,7 +95,10 @@
|
|
|
95
95
|
* acquisition the lane would plan otherwise now (its `acquisitionMoved`: a
|
|
96
96
|
* CME surface or a CME chain's statistics read off a continuous alias whose
|
|
97
97
|
* lead rolled; the full run re-plans it and the fresh session holds none of
|
|
98
|
-
* its old rows)
|
|
98
|
+
* its old rows), or a reconcile lane whose window held more than its read
|
|
99
|
+
* takes (a refusal by name the leaf declares `over-cap`: the tape past the
|
|
100
|
+
* trades worker's cap), whose window stays owed while the session is held
|
|
101
|
+
* and hands ONE full run off (`handWrunLiveOverCapBack`). A pan-back page left to its wave
|
|
99
102
|
* (contract C1: a verified backward extension under an owner pending or
|
|
100
103
|
* landed over it, or on a prefix-capable session within the grace its wave
|
|
101
104
|
* has to stamp one) moves no history: the wave lands the page's rows into
|
|
@@ -95,7 +95,10 @@
|
|
|
95
95
|
* acquisition the lane would plan otherwise now (its `acquisitionMoved`: a
|
|
96
96
|
* CME surface or a CME chain's statistics read off a continuous alias whose
|
|
97
97
|
* lead rolled; the full run re-plans it and the fresh session holds none of
|
|
98
|
-
* its old rows)
|
|
98
|
+
* its old rows), or a reconcile lane whose window held more than its read
|
|
99
|
+
* takes (a refusal by name the leaf declares `over-cap`: the tape past the
|
|
100
|
+
* trades worker's cap), whose window stays owed while the session is held
|
|
101
|
+
* and hands ONE full run off (`handWrunLiveOverCapBack`). A pan-back page left to its wave
|
|
99
102
|
* (contract C1: a verified backward extension under an owner pending or
|
|
100
103
|
* landed over it, or on a prefix-capable session within the grace its wave
|
|
101
104
|
* has to stamp one) moves no history: the wave lands the page's rows into
|
|
@@ -223,7 +226,7 @@ import { wrunLegNativeRowsOption } from './wrun-pin-venues.util.js';
|
|
|
223
226
|
import { wrunSessionChartNamesOf } from './wrun-chart-context-names.util.js';
|
|
224
227
|
import { wrunChartSizeUnit, wrunReadsMarketFacts } from './wrun-chart-market-facts.util.js';
|
|
225
228
|
import { wrunReadsEarningsFacts } from './wrun-earnings-facts.util.js';
|
|
226
|
-
import { wrunLaneRefusedCodeOf } from './wrun-lane-refusal.leaf.js';
|
|
229
|
+
import { wrunLaneRefusalLeavesWindowOwed, wrunLaneRefusedCodeOf } from './wrun-lane-refusal.leaf.js';
|
|
227
230
|
import { WRUN_RUN_INTERVAL_ROWS_KEY, wrunRunIntervalComputeRows, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
|
|
228
231
|
import { WRUN_NO_READY_ROWS_CODE, wrunNothingReadyRefusal, wrunRunHealthDiagnostics } from './wrun-run-health.util.js';
|
|
229
232
|
import { attachWrunRefusal, serializeWrunRefusal, wrunOverlayEditable, wrunRefusalFor, } from './wrun-refusal.util.js';
|
|
@@ -1464,7 +1467,8 @@ export async function runWrunOverlayLiveTick(indicatorId) {
|
|
|
1464
1467
|
: null;
|
|
1465
1468
|
if (plan.kind === 'reconcile') {
|
|
1466
1469
|
const verdict = await reconcileWrunOverlayLanes(context, ledger, plan, meta, mainClock, lastTs);
|
|
1467
|
-
|
|
1470
|
+
// A window over its read's cap held the session and handed the overlay back to a full run: nothing more drains.
|
|
1471
|
+
if (!wrunLiveContextCurrent(context, generation) || verdict === 'handed-back')
|
|
1468
1472
|
return;
|
|
1469
1473
|
const owed = verdict === 'closed-bar-revised' || (context.dirtyFromTs !== null && reseedBudgetOpen(ledger));
|
|
1470
1474
|
// A page ahead of the session holds the reseed (wrunPrefixHoldsReseed):
|
|
@@ -1837,6 +1841,21 @@ function suspendWrunLiveOnTapeRefusal(context, ledger, generation, error) {
|
|
|
1837
1841
|
console.warn(`[wrun] live session suspended for '${context.indicatorId}' (${error.message})`);
|
|
1838
1842
|
void noteWrunLiveTickRefusal(context, ledger, generation, error);
|
|
1839
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* A reconcile lane whose window held more than its read takes (wrunLaneRefusalLeavesWindowOwed: the tape held more
|
|
1846
|
+
* prints at its floor than the trades worker reads, `tape-too-many-trades`): its prints are there, so the window stays
|
|
1847
|
+
* owed, and the next poll would ask the same window at the same floor and meet the same cap. The session is held (no
|
|
1848
|
+
* drains, its picture kept) and hands the overlay back to the full run once, the handoff a reseed's failed reopen
|
|
1849
|
+
* makes: the full run asks the declared history at the same floor, which holds the window, so it meets the cap too
|
|
1850
|
+
* and shows the lane's record (the tape's: too much data, Open the settings), and a settings save with a higher floor
|
|
1851
|
+
* installs a fresh session. Like the budget holds it leaves `liveSuspendedBy` unset: a heal run over the same history
|
|
1852
|
+
* is refused again, so the heal ladder leaves the held session alone.
|
|
1853
|
+
*/
|
|
1854
|
+
function handWrunLiveOverCapBack(context, ledger, lane, reason) {
|
|
1855
|
+
context.liveSuspended = true;
|
|
1856
|
+
console.warn(`[wrun] live reconcile lane '${lane}' for '${context.indicatorId}' held more than its read takes (its window stays owed); live suspended, rebuilding once through the full run:`, reason);
|
|
1857
|
+
noteWrunLiveRebuild(ledger, context.indicatorId);
|
|
1858
|
+
}
|
|
1840
1859
|
/** A rebuild handoff to the full-run driver, counted here and in the intake's
|
|
1841
1860
|
* stats. Its reason is 'live-rebuild': the session cannot extend, so the run
|
|
1842
1861
|
* is never merged as a range refresh nor skipped as a duplicate range. */
|
|
@@ -2910,12 +2929,22 @@ lastMainTs) {
|
|
|
2910
2929
|
let revisedFromTs = null;
|
|
2911
2930
|
const liveCandleOnlyLegs = wrunLiveCandleOnlyLegKeys(context);
|
|
2912
2931
|
const formingOpenLegs = wrunFormingOpenLegKeys(context);
|
|
2932
|
+
// The first lane whose window held more than its read takes (handed back below, once).
|
|
2933
|
+
let overCap;
|
|
2913
2934
|
plan.lanes.forEach((lane, at) => {
|
|
2914
2935
|
const outcome = settled[at];
|
|
2915
|
-
|
|
2916
|
-
//
|
|
2936
|
+
const refusedCode = outcome.status === 'rejected' ? wrunLaneRefusedCodeOf(outcome.reason) : undefined;
|
|
2937
|
+
// A window over its read's cap (wrunLaneRefusalLeavesWindowOwed: the tape held more prints at its floor than
|
|
2938
|
+
// the trades worker reads) holds data the chart lacks: it keeps its obligation as a failed lane does (its fed
|
|
2939
|
+
// buckets outstanding, its coverage behind), and the session hands the overlay back to a full run below.
|
|
2940
|
+
if (outcome.status === 'rejected' && refusedCode !== undefined && wrunLaneRefusalLeavesWindowOwed(refusedCode)) {
|
|
2941
|
+
overCap ??= { lane, reason: outcome.reason };
|
|
2942
|
+
return;
|
|
2943
|
+
}
|
|
2944
|
+
// Any other answer the data plane refused by name (wrun-lane-refusal.leaf: a read switched off, a series it does
|
|
2945
|
+
// not sample here) is refused the same way on every ask: read as an answer with no new rows (its window covered,
|
|
2917
2946
|
// the held rows kept), so the session neither warns nor widens its window on every poll.
|
|
2918
|
-
const refused =
|
|
2947
|
+
const refused = refusedCode !== undefined;
|
|
2919
2948
|
if (outcome.status === 'rejected' && !refused) {
|
|
2920
2949
|
// A failed lane keeps its obligation: its fed buckets stay outstanding
|
|
2921
2950
|
// and the next reconcile window reaches back to them.
|
|
@@ -3016,6 +3045,10 @@ lastMainTs) {
|
|
|
3016
3045
|
});
|
|
3017
3046
|
}
|
|
3018
3047
|
}
|
|
3048
|
+
if (overCap !== undefined) {
|
|
3049
|
+
handWrunLiveOverCapBack(context, ledger, overCap.lane, overCap.reason);
|
|
3050
|
+
return 'handed-back';
|
|
3051
|
+
}
|
|
3019
3052
|
if (revisedFromTs === null)
|
|
3020
3053
|
return 'clean';
|
|
3021
3054
|
// A revised closed bar is a committed bar the session evaluated on other
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The size thresholds a built-in package declares in trade units (coins on crypto, contracts on futures) as ONE
|
|
3
|
+
* number for every market. Big Trades' Min size 10 was tuned on BTC, where 10 BTC is about $830k; on a market whose
|
|
4
|
+
* coin is worth a sliver of BTC the same number keeps a whole tape: 10 ETH (about $24k) kept 487,132 prints over its
|
|
5
|
+
* seven days of BINANCE_FUTURES ETHUSDT, past the trades worker's 300,000-print cap, so every attempt failed. A
|
|
6
|
+
* threshold that means "big" follows the market instead: the table below names the params that do (keyed by package
|
|
7
|
+
* and param name, never by a label, a hint or a pattern), and this leaf holds the rule; the run head applies it once
|
|
8
|
+
* per mount and market (wrun-market-size-defaults.util).
|
|
9
|
+
*
|
|
10
|
+
* The rule (product decision 2026-10-21): on a market whose size unit is coins and whose candle volume is in base
|
|
11
|
+
* coins, Min size defaults to 0.01% of the market's daily base volume rounded down to 1, 2 or 5 times a power of ten
|
|
12
|
+
* (`wrunNiceFloor`, below 1 too), and Whale size to ten times that, so BTC keeps 10 and 100 (131.7K BTC a day) while
|
|
13
|
+
* ETH reads 200 and 2000 (3.13M ETH). The daily volume comes from the chart's own candles (`wrunDailyCandleVolume`).
|
|
14
|
+
* A market whose facts never yield a market default reads the package's defaults, so a record never keeps the last
|
|
15
|
+
* coin market's scaled one there: sized in contracts (CME, every contract market), placed by the directory in another
|
|
16
|
+
* unit (shares), or candles in another unit than the tape (an inverse or OKX swap, a formula chart). A market whose
|
|
17
|
+
* size unit is not known yet and a chart whose closed candles cover under an hour move nothing: the next run asks
|
|
18
|
+
* again.
|
|
19
|
+
*
|
|
20
|
+
* Pure: the specs and the phone app read the same rule. Its one import is the import-free size unit table.
|
|
21
|
+
*/
|
|
22
|
+
import type { WrunScriptInputDeclaration } from './wrun-script-inputs.util.js';
|
|
23
|
+
/** How a market-scaled param's default follows the market. */
|
|
24
|
+
export type WrunMarketScaledRule =
|
|
25
|
+
/** A share of the market's daily base volume, rounded down to 1, 2 or 5 times a power of ten. */
|
|
26
|
+
{
|
|
27
|
+
readonly kind: 'daily-volume';
|
|
28
|
+
readonly share: number;
|
|
29
|
+
}
|
|
30
|
+
/** A multiple of another scaled param's market default (resolved after the ones read off the volume). */
|
|
31
|
+
| {
|
|
32
|
+
readonly kind: 'times';
|
|
33
|
+
readonly param: string;
|
|
34
|
+
readonly factor: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The params whose default follows the market, by package name, then param name (the sheet's own names). A built-in
|
|
38
|
+
* twin whose sheet binds a param to a trade size floor lists it here or in the guard's exemptions with a reason
|
|
39
|
+
* (tests/utility/wrun/wrun-market-size-defaults.twins.spec.ts walks every proven twin's frozen sheet).
|
|
40
|
+
*/
|
|
41
|
+
export declare const WRUN_MARKET_SCALED_PARAMS: Readonly<Record<string, Readonly<Record<string, WrunMarketScaledRule>>>>;
|
|
42
|
+
/** The scaled params of a package, or undefined for a package that scales none. */
|
|
43
|
+
export declare function wrunMarketScaledParamsOf(packageName: string | undefined): Readonly<Record<string, WrunMarketScaledRule>> | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* A market's daily volume in its candles' unit, from the chart's own candles (ascending, the newest the forming
|
|
46
|
+
* one, which is left out: its volume is partial): the closed candles opening in the 24 hours before the newest one's
|
|
47
|
+
* open, summed and scaled to a day by the span they cover (a fine chart loads less than a day: 500 one-minute candles
|
|
48
|
+
* count 499 minutes; a gap where nothing traded counts as covered time with no volume). One closed candle longer than
|
|
49
|
+
* a day (1W, 1M) is prorated by its length, the gap to the next open held to `intervalMs`. Undefined when the closed
|
|
50
|
+
* candles cover under an hour or hold no volume.
|
|
51
|
+
*/
|
|
52
|
+
export declare function wrunDailyCandleVolume(rows: ReadonlyArray<ArrayLike<number>>, intervalMs?: number): number | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* The largest 1, 2 or 5 times a power of ten at or below `value` (5,000,000, 200, 10, then 0.5, 0.2, 0.1 below 1), as
|
|
55
|
+
* a clean decimal; undefined for a value that is not finite and above zero.
|
|
56
|
+
*/
|
|
57
|
+
export declare function wrunNiceFloor(value: number): number | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Each scaled param's default on a market trading `dailyVolume` base units a day: the daily-volume rules first, then
|
|
60
|
+
* the multiples of them. Undefined when the volume yields no default (not finite and above zero).
|
|
61
|
+
*/
|
|
62
|
+
export declare function wrunMarketScaledDefaults(rules: Readonly<Record<string, WrunMarketScaledRule>>, dailyVolume: number): Record<string, number> | undefined;
|
|
63
|
+
/** The market facts the rule reads: the size unit (`wrunChartSizeUnit`), whether the candles' volume is in base
|
|
64
|
+
* coins (the venue's unit profile, candle-volume-unit.leaf), the chart's own candle rows and its bar length. */
|
|
65
|
+
export interface WrunMarketSizeFacts {
|
|
66
|
+
sizeUnit: number;
|
|
67
|
+
candleVolumeInCoins: boolean;
|
|
68
|
+
rows: ReadonlyArray<ArrayLike<number>>;
|
|
69
|
+
intervalMs?: number;
|
|
70
|
+
}
|
|
71
|
+
/** What a market's facts make of the scaled params' defaults. */
|
|
72
|
+
export type WrunMarketSizeVerdict =
|
|
73
|
+
/** The market's own defaults: a coin market whose candles say how much it trades a day. */
|
|
74
|
+
{
|
|
75
|
+
kind: 'market';
|
|
76
|
+
defaults: Record<string, number>;
|
|
77
|
+
}
|
|
78
|
+
/** The package's declared defaults, on facts that never change for the market, so a record moves back to them
|
|
79
|
+
* instead of keeping another market's scaled default: sized in contracts (`contracts`: CME, every contract
|
|
80
|
+
* market), placed by the directory in another unit (`size-unit`: shares), candles in another unit than the tape
|
|
81
|
+
* (`candle-unit`: contracts on an inverse or an OKX swap, a formula chart's candles, which are no market's). */
|
|
82
|
+
| {
|
|
83
|
+
kind: 'package';
|
|
84
|
+
reason: 'contracts' | 'size-unit' | 'candle-unit';
|
|
85
|
+
}
|
|
86
|
+
/** Nothing moves yet (the record keeps what it holds, and the next run asks again), on facts that can still change:
|
|
87
|
+
* a size unit not known yet (`size-unit`: the directory has not placed the market, or its lookup failed), closed
|
|
88
|
+
* candles covering under an hour or holding no volume (`cover`). */
|
|
89
|
+
| {
|
|
90
|
+
kind: 'skip';
|
|
91
|
+
reason: 'size-unit' | 'cover';
|
|
92
|
+
};
|
|
93
|
+
/** The verdict of a market's facts on a package's scaled params (`rules`). */
|
|
94
|
+
export declare function wrunMarketSizeVerdict(rules: Readonly<Record<string, WrunMarketScaledRule>>, facts: WrunMarketSizeFacts): WrunMarketSizeVerdict;
|
|
95
|
+
/** A number row's value held to its bounds, or undefined for one that is not finite. */
|
|
96
|
+
export declare function wrunMarketDefaultWithinRow(row: Pick<WrunScriptInputDeclaration, 'constraints'>, value: unknown): number | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* `rows` (the rows a sheet builds, `buildWrunScriptInputs`) with the market defaults a record holds: each scaled
|
|
99
|
+
* param's row takes the default its row in `held` (the record's own `scriptInputs`) carries, the one the run head last
|
|
100
|
+
* moved it to, so a rebuild of the rows from the sheet (a delivered sheet's reconcile, a pin move) never moves a market
|
|
101
|
+
* default back to the sheet's, and a value at it never reads as changed. A held default that is not a number within
|
|
102
|
+
* the row's bounds stays the sheet's. The same array when nothing moves.
|
|
103
|
+
*/
|
|
104
|
+
export declare function wrunRowsKeepingMarketDefaults(rows: WrunScriptInputDeclaration[], held: unknown, packageName: string | undefined): WrunScriptInputDeclaration[];
|
|
105
|
+
/** Whether a settings row can hold a market default (a number kind; a sheet that retyped the param keeps its own). */
|
|
106
|
+
export declare function isWrunMarketScaledRow(row: Pick<WrunScriptInputDeclaration, 'type'>): boolean;
|