@orangecharts/wrun-chart-host 0.6.0 → 0.7.1
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 +14 -5
- package/dist/constants/marketCapabilities.constants.d.ts +5 -0
- package/dist/constants/marketCapabilities.constants.js +16 -0
- package/dist/host-ports.types.d.ts +35 -3
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/indicators/controls/tpo-session.util.js +42 -18
- package/dist/market-data/billing.interface.d.ts +2 -1
- package/dist/settings-templates/index.d.ts +2 -0
- package/dist/settings-templates/index.js +19 -5
- package/dist/settings-templates/indicator-fields.d.ts +2 -0
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/settings-templates/tool-rules.d.ts +12 -2
- package/dist/settings-templates/tool-rules.js +9 -2
- package/dist/settings-templates/tool-tables.generated.js +9 -0
- package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
- package/dist/utility/chart/crypto-index.leaf.js +19 -0
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +11 -5
- package/dist/utility/chart/index-mode.util.js +22 -10
- package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
- package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
- package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
- package/dist/utility/chart/live-bucket.util.d.ts +2 -1
- package/dist/utility/chart/live-bucket.util.js +47 -15
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
- package/dist/utility/chart/market-session-schedule.util.js +24 -2
- package/dist/utility/chart/marketKind.util.d.ts +12 -7
- package/dist/utility/chart/marketKind.util.js +15 -5
- package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
- package/dist/utility/chart/ny-calendar.util.js +346 -0
- package/dist/utility/chart/om-panel.util.d.ts +14 -2
- package/dist/utility/chart/om-panel.util.js +108 -40
- package/dist/utility/chart/rth-session.util.d.ts +10 -7
- package/dist/utility/chart/rth-session.util.js +17 -22
- package/dist/utility/chart/trading-day.util.js +90 -18
- package/dist/utility/chart/us-equities-session.util.js +20 -67
- package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
- package/dist/utility/common/time.util.d.ts +7 -1
- package/dist/utility/common/time.util.js +11 -41
- package/dist/utility/number-format.util.d.ts +17 -7
- package/dist/utility/number-format.util.js +18 -8
- package/dist/utility/options/option-symbol.util.js +13 -2
- package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
- package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
- package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
- package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
- package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
- package/dist/utility/wrun/wrun-failure-cause.js +14 -0
- package/dist/utility/wrun/wrun-frames.js +6 -2
- package/dist/utility/wrun/wrun-host.service.d.ts +26 -18
- package/dist/utility/wrun/wrun-host.service.js +49 -52
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
- package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
- package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
- package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
- package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
- package/dist/utility/wrun/wrun-option-views.util.js +356 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
- package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +18 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +50 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
- package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
- package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
- package/dist/utility/wrun/wrun-refusal.util.js +335 -40
- package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
- package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
- package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
- package/package.json +5 -5
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
- package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The feeds a pan-back prefix run computes over, the lanes rule widened to the daily-joined poll lanes and the row lanes
|
|
3
|
+
* (run scheduling, 2026-10-20). The rule this builds on (wrun-prefix-lanes.util `planWrunPrefixLanes`) refused both: a
|
|
4
|
+
* daily lane by its clause (`daily`) and every row lane as an input outside every admitted source (`input-source`). So
|
|
5
|
+
* the chart's first lazy history load (252 to 753 bars) re-ran an options indicator whole and re-asked every one of its
|
|
6
|
+
* sources (16 indicators, 25 cells on INT, 2026-10-20: Skew History at 1h blocked 10.1 s after its first paint). Here
|
|
7
|
+
* a page asks only what it adds:
|
|
8
|
+
*
|
|
9
|
+
* - A daily-joined poll lane (`join: { kind: 'daily' }`, the stock's daily options statistics, an economic series, a
|
|
10
|
+
* supply series): the page asks the days the session's buffer does not hold yet, from the lane's lookback before the
|
|
11
|
+
* page's first bar (`wrunPollLaneFetchFrom`, a whole run's own ask start for the wider window) up to the buffer's
|
|
12
|
+
* first row (cut strictly before it), and asks nothing when the buffer already reaches back that far. The window
|
|
13
|
+
* reads the page, then every buffered day through the window's end (a daily join reads the standing observation, the
|
|
14
|
+
* lookback days before the session's first row included); the splice lands the page before the whole buffer.
|
|
15
|
+
* - A row lane of a `flow` or `snapshot` landing (the per-bar options classes): the page asks the page's own host
|
|
16
|
+
* bars `[fromMs, firstRowTs)` through the lane's own host-grid read (sources/wrun-row-lanes.util
|
|
17
|
+
* `fetchWrunRowLaneRows`: the tier rule, the horizon and the partial bars decide per bar at the clock, as a whole
|
|
18
|
+
* run's asks do), with the acquisition a whole run would plan now; the window and the splice are the bar-joined
|
|
19
|
+
* lanes' (the page, then the session's rows from its first row on).
|
|
20
|
+
* - A row lane of a `latest` landing (the live bar only, the options chain's rule): no ask, its page rows read the empty
|
|
21
|
+
* block a whole run's older bars read; a window reaching the session's live row while the lane holds a snapshot is
|
|
22
|
+
* refused (`live-row`), as the options chain's is.
|
|
23
|
+
*
|
|
24
|
+
* Still refused, each by a named clause (`lanes:<clause>`): a row lane under a row budget (`row-budget`: a whole run
|
|
25
|
+
* keeps the NEWEST bars of its whole window that fit, a page would keep the page's own), a row lane this build does
|
|
26
|
+
* not know or holds no buffer of (`input-source`), a daily lane under a host-grid landing, or with no recorded ask or
|
|
27
|
+
* no buffer to stand on (`daily`), a primary under carry reading a daily lane (`primary-carry`), and any of these
|
|
28
|
+
* lanes on an index-mode chart unless it
|
|
29
|
+
* rides the native-rows path (`index-mode`: there the chart's fetch replaces an explicit window with the chart's whole
|
|
30
|
+
* span, which the native-rows path never does). Every other feed is the base rule's, unchanged: the base judges the
|
|
31
|
+
* session with these lanes set aside (their inputs read as undemanded, their instances and acquisitions out), and its
|
|
32
|
+
* refusal wins.
|
|
33
|
+
*
|
|
34
|
+
* Pure and synchronous: the asks ride the run pass's lane machinery (wrun-overlay-run.util `acquireWrunPrefixLanePages`).
|
|
35
|
+
*/
|
|
36
|
+
import { checkIsIndexMode } from '../../chart/index-mode.util.js';
|
|
37
|
+
import { wrunPollLaneByKey } from '../sources/registry.js';
|
|
38
|
+
import { wrunRowLaneByKey, wrunRowLaneOfClass } from '../sources/row-lane-registry.js';
|
|
39
|
+
import { wrunPollLaneFetchOptions } from '../sources/wrun-poll-lanes.util.js';
|
|
40
|
+
import { wrunRowLaneFetchOptions } from '../sources/wrun-row-lanes.util.js';
|
|
41
|
+
import { applyWrunPrefixLaneSplice, planWrunPrefixLanes, wrunPrefixHeldLanes, wrunPrefixLaneSplice, wrunPrefixLiveRowRefused, wrunPrefixWindowLanes, } from '../wrun-prefix-lanes.util.js';
|
|
42
|
+
/** The fetch-key suffix of a row lane instance's page ask: `rows-<instance id>`. */
|
|
43
|
+
export function wrunPrefixRowSuffix(instance) {
|
|
44
|
+
return `rows-${instance.key}`;
|
|
45
|
+
}
|
|
46
|
+
/** Whether a poll lane instance is daily-joined (its rows one per UTC day, landed by the daily rules). */
|
|
47
|
+
function isWrunDailyInstance(instance) {
|
|
48
|
+
const lane = wrunPollLaneByKey(instance.laneKey);
|
|
49
|
+
return lane !== undefined && lane.join !== 'bar';
|
|
50
|
+
}
|
|
51
|
+
/** The session with the daily poll lanes and the row lanes set aside: their inputs undemanded, their instances and their
|
|
52
|
+
* acquisitions out, so the base rule judges every other feed exactly as before. */
|
|
53
|
+
function wrunPrefixBaseContext(context, daily, rows) {
|
|
54
|
+
const sheet = context.metadata;
|
|
55
|
+
const setAside = new Set([
|
|
56
|
+
...daily.flatMap((instance) => instance.inputIndexes),
|
|
57
|
+
...rows.flatMap((instance) => instance.inputIndexes),
|
|
58
|
+
]);
|
|
59
|
+
const inputSources = { ...sheet.inputSources };
|
|
60
|
+
for (const input of sheet.inputs) {
|
|
61
|
+
const entry = sheet.inputSources[input.name];
|
|
62
|
+
// A row lane's class, read by no instance (the plan dropped it: a fill on every row), is no input-source either.
|
|
63
|
+
if (entry !== undefined && (setAside.has(input.index) || wrunRowLaneOfClass(entry.source) !== undefined)) {
|
|
64
|
+
inputSources[input.name] = { ...entry, undemanded: true };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const laneIds = new Set([...daily.map((instance) => instance.key), ...rows.map((instance) => instance.key)]);
|
|
68
|
+
const acquisition = Object.fromEntries(Object.entries(context.acquisition).filter(([lane]) => !laneIds.has(lane)));
|
|
69
|
+
return {
|
|
70
|
+
...context,
|
|
71
|
+
metadata: { ...sheet, inputSources },
|
|
72
|
+
acquisition,
|
|
73
|
+
pollLanes: (context.pollLanes ?? []).filter((instance) => !laneIds.has(instance.key)),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Whether a daily lane is read by the primary (input 0) under carry: its first page rows would carry from an
|
|
77
|
+
* observation the page's own ask may not reach (the base rule's `primary-carry`). */
|
|
78
|
+
function wrunDailyPrimaryCarries(sheet, instance) {
|
|
79
|
+
return sheet.inputs.some((input) => {
|
|
80
|
+
if (input.index !== 0 || !instance.inputIndexes.includes(0) || input.cellType === 'array')
|
|
81
|
+
return false;
|
|
82
|
+
const entry = sheet.inputSources[input.name];
|
|
83
|
+
return entry !== undefined && entry.missing !== 'nan' && entry.missing !== 'zero';
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** The prefix feed rule (the module note): the clause that refuses, or what a page asks. */
|
|
87
|
+
export function planWrunPrefixFeeds(context) {
|
|
88
|
+
const refused = (clause) => ({ refused: clause });
|
|
89
|
+
const daily = (context.pollLanes ?? []).filter(isWrunDailyInstance);
|
|
90
|
+
const rowInstances = context.rowLanes ?? [];
|
|
91
|
+
const base = planWrunPrefixLanes(wrunPrefixBaseContext(context, daily, rowInstances));
|
|
92
|
+
if ('refused' in base)
|
|
93
|
+
return base;
|
|
94
|
+
const indexMode = checkIsIndexMode(context.market?.exchange);
|
|
95
|
+
const plan = { ...base.plan, daily: [], rows: [], emptyRows: [] };
|
|
96
|
+
for (const instance of daily) {
|
|
97
|
+
const lane = wrunPollLaneByKey(instance.laneKey);
|
|
98
|
+
// A daily lane the page cannot ask the way the session did: no recorded ask or no buffer to stand on.
|
|
99
|
+
if (lane === undefined || lane.barGrid !== undefined)
|
|
100
|
+
return refused('daily');
|
|
101
|
+
if (context.acquisition[instance.key] === undefined || context.pollLaneRows?.[instance.key] === undefined) {
|
|
102
|
+
return refused('daily');
|
|
103
|
+
}
|
|
104
|
+
if (wrunDailyPrimaryCarries(context.metadata, instance))
|
|
105
|
+
return refused('primary-carry');
|
|
106
|
+
if (indexMode && lane.fetch === undefined && wrunPollLaneFetchOptions(lane)?.nativeRows !== true) {
|
|
107
|
+
return refused('index-mode');
|
|
108
|
+
}
|
|
109
|
+
plan.daily.push(instance);
|
|
110
|
+
}
|
|
111
|
+
for (const instance of rowInstances) {
|
|
112
|
+
const lane = wrunRowLaneByKey(instance.laneKey);
|
|
113
|
+
if (lane === undefined || context.rowLaneRows?.[instance.key] === undefined)
|
|
114
|
+
return refused('input-source');
|
|
115
|
+
if (lane.landing.kind === 'latest') {
|
|
116
|
+
plan.emptyRows.push(instance);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (lane.rowBudget !== undefined)
|
|
120
|
+
return refused('row-budget');
|
|
121
|
+
if (context.acquisition[instance.key] === undefined)
|
|
122
|
+
return refused('input-source');
|
|
123
|
+
if (indexMode && lane.fetch === undefined && wrunRowLaneFetchOptions(lane)?.nativeRows !== true) {
|
|
124
|
+
return refused('index-mode');
|
|
125
|
+
}
|
|
126
|
+
plan.rows.push(instance);
|
|
127
|
+
}
|
|
128
|
+
return { plan };
|
|
129
|
+
}
|
|
130
|
+
/** The feed rule's clause for a session, null when it admits (`planWrunPrefixFeeds`). */
|
|
131
|
+
export function wrunPrefixFeedClauseOf(context) {
|
|
132
|
+
const verdict = planWrunPrefixFeeds(context);
|
|
133
|
+
return 'refused' in verdict ? verdict.refused : null;
|
|
134
|
+
}
|
|
135
|
+
/** Whether a planned window reaches the session's live row while a lane that lands there alone holds a snapshot: the
|
|
136
|
+
* options chain (the base rule) or a row lane of a `latest` landing. */
|
|
137
|
+
export function wrunPrefixFeedsLiveRowRefused(context, toMs) {
|
|
138
|
+
if (wrunPrefixLiveRowRefused(context, toMs))
|
|
139
|
+
return true;
|
|
140
|
+
if (toMs < context.lastRowTs)
|
|
141
|
+
return false;
|
|
142
|
+
return (context.rowLanes ?? []).some((instance) => wrunRowLaneByKey(instance.laneKey)?.landing.kind === 'latest' &&
|
|
143
|
+
(context.rowLaneRows?.[instance.key]?.length ?? 0) > 0);
|
|
144
|
+
}
|
|
145
|
+
/** The first row a daily lane's session buffer holds (its page asks the days before it), NaN when the buffer is empty. */
|
|
146
|
+
export function wrunPrefixDailyHeldFirstTs(context, instance) {
|
|
147
|
+
return Number(context.pollLaneRows?.[instance.key]?.[0]?.[0]);
|
|
148
|
+
}
|
|
149
|
+
/** A buffer's rows at or before `toMs`. */
|
|
150
|
+
function wrunRowsThrough(rows, toMs) {
|
|
151
|
+
return (rows ?? []).filter((row) => Number(row[0]) <= toMs);
|
|
152
|
+
}
|
|
153
|
+
/** A buffer's rows inside `[fromTs, toTs]`. */
|
|
154
|
+
function wrunRowsInside(rows, fromTs, toTs) {
|
|
155
|
+
return (rows ?? []).filter((row) => {
|
|
156
|
+
const ts = Number(row[0]);
|
|
157
|
+
return ts >= fromTs && ts <= toTs;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* The window build's lane rows (the base rule's window split, `wrunPrefixWindowLanes`), and the daily and row lanes
|
|
162
|
+
* beside it: a daily lane reads its page, then every buffered day through the window's end; an asked row lane its page,
|
|
163
|
+
* then the session's rows over the overlap; a `latest` row lane reads empty. The lane evidence names every asked lane
|
|
164
|
+
* (the proof compares each inside the overlap, where both sides hold the session's own row objects).
|
|
165
|
+
*/
|
|
166
|
+
export function wrunPrefixFeedWindowLanes(context, plan, pages, firstRowTs, toMs) {
|
|
167
|
+
const base = wrunPrefixWindowLanes(context, plan, pages, firstRowTs, toMs);
|
|
168
|
+
const sourceRows = { ...base.sourceRows };
|
|
169
|
+
const lanes = [...base.lanes];
|
|
170
|
+
if (plan.daily.length > 0) {
|
|
171
|
+
const pollLaneRows = {
|
|
172
|
+
...(sourceRows.pollLaneRows ?? {}),
|
|
173
|
+
};
|
|
174
|
+
for (const instance of plan.daily) {
|
|
175
|
+
const rows = [...(pages.get(instance.key) ?? []), ...wrunRowsThrough(context.pollLaneRows?.[instance.key], toMs)];
|
|
176
|
+
pollLaneRows[instance.key] = rows;
|
|
177
|
+
lanes.push({ lane: instance.key, rows });
|
|
178
|
+
}
|
|
179
|
+
sourceRows.pollLanes = context.pollLanes ?? [];
|
|
180
|
+
sourceRows.pollLaneRows = pollLaneRows;
|
|
181
|
+
}
|
|
182
|
+
const rowInstances = context.rowLanes ?? [];
|
|
183
|
+
if (rowInstances.length > 0) {
|
|
184
|
+
const rowLaneRows = {};
|
|
185
|
+
for (const instance of plan.rows) {
|
|
186
|
+
const rows = [
|
|
187
|
+
...(pages.get(instance.key) ?? []),
|
|
188
|
+
...wrunRowsInside(context.rowLaneRows?.[instance.key], firstRowTs, toMs),
|
|
189
|
+
];
|
|
190
|
+
rowLaneRows[instance.key] = rows;
|
|
191
|
+
lanes.push({ lane: instance.key, rows });
|
|
192
|
+
}
|
|
193
|
+
for (const instance of plan.emptyRows)
|
|
194
|
+
rowLaneRows[instance.key] = [];
|
|
195
|
+
sourceRows.rowLanes = rowInstances;
|
|
196
|
+
sourceRows.rowLaneRows = rowLaneRows;
|
|
197
|
+
}
|
|
198
|
+
return { sourceRows: sourceRows, lanes };
|
|
199
|
+
}
|
|
200
|
+
/** The session's buffers of the lanes a window's evidence names, as they stand now: the proof's mounted side. */
|
|
201
|
+
export function wrunPrefixFeedHeldLanes(context, plan) {
|
|
202
|
+
return [
|
|
203
|
+
...wrunPrefixHeldLanes(context, plan),
|
|
204
|
+
...plan.daily.map((instance) => ({ lane: instance.key, rows: context.pollLaneRows?.[instance.key] ?? [] })),
|
|
205
|
+
...plan.rows.map((instance) => ({ lane: instance.key, rows: context.rowLaneRows?.[instance.key] ?? [] })),
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
/** The commit's splice, all or none (`wrunPrefixLaneSplice`): null when an asked lane has no buffer to splice. */
|
|
209
|
+
export function wrunPrefixFeedSplice(context, plan, pages, firstRowTs) {
|
|
210
|
+
const base = wrunPrefixLaneSplice(context, plan, pages, firstRowTs);
|
|
211
|
+
if (base === null)
|
|
212
|
+
return null;
|
|
213
|
+
const splice = { base, daily: {}, rows: {} };
|
|
214
|
+
for (const instance of plan.daily) {
|
|
215
|
+
const held = context.pollLaneRows?.[instance.key];
|
|
216
|
+
if (held === undefined)
|
|
217
|
+
return null;
|
|
218
|
+
splice.daily[instance.key] = [...(pages.get(instance.key) ?? []), ...held];
|
|
219
|
+
}
|
|
220
|
+
for (const instance of plan.rows) {
|
|
221
|
+
const held = context.rowLaneRows?.[instance.key];
|
|
222
|
+
if (held === undefined)
|
|
223
|
+
return null;
|
|
224
|
+
splice.rows[instance.key] = [
|
|
225
|
+
...(pages.get(instance.key) ?? []),
|
|
226
|
+
...held.filter((row) => Number(row[0]) >= firstRowTs),
|
|
227
|
+
];
|
|
228
|
+
}
|
|
229
|
+
return splice;
|
|
230
|
+
}
|
|
231
|
+
/** Write a splice onto its session (synchronous; the buffers as new records, the reseed and the tail builder read the
|
|
232
|
+
* context's own). */
|
|
233
|
+
export function applyWrunPrefixFeedSplice(context, splice) {
|
|
234
|
+
applyWrunPrefixLaneSplice(context, splice.base);
|
|
235
|
+
if (Object.keys(splice.daily).length > 0)
|
|
236
|
+
context.pollLaneRows = { ...context.pollLaneRows, ...splice.daily };
|
|
237
|
+
if (Object.keys(splice.rows).length > 0)
|
|
238
|
+
context.rowLaneRows = { ...context.rowLaneRows, ...splice.rows };
|
|
239
|
+
}
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
* as-of join, since a bar between two rows reads the input's `missing` policy (`carry` holds the last row). A stock
|
|
11
11
|
* chart's 09:30 New York bars, a crypto chart's and an OPRA contract chart's UTC bars alike.
|
|
12
12
|
*
|
|
13
|
+
* Its reach (`horizon`, `WRUN_OPTION_STATS_10M_HISTORY_MS`): OPTION_UNDERLYING_STATS keeps the ten-minute rows a year,
|
|
14
|
+
* so the asks start where that history does and a run over a longer window (a daily chart's years, a warm-up page)
|
|
15
|
+
* never asks what the table no longer holds; those bars read the input's `missing` policy. A horizon, never a tier: a
|
|
16
|
+
* ten-minute tier would leave every 1m, 5m and 15m bar unread (a tier fits only the bars its width divides).
|
|
17
|
+
*
|
|
13
18
|
* A CHAIN lane like `option_daily` (`planWrunOptionStatsInput`): the chart's chain on whichever plane it lists on (on
|
|
14
19
|
* the OPRA plane its own by coin, with no chain directory read), one book per input, a plane per instance, a continuous
|
|
15
20
|
* CME chart's lead contract (`acquisitionMoved`).
|
|
@@ -22,6 +27,17 @@
|
|
|
22
27
|
* `protocol-pending:OPTION_UNDERLYING_STATS` until the protocol release, and the chain's own refusals.
|
|
23
28
|
*/
|
|
24
29
|
import type { WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
30
|
+
import type { WrunRowLaneHorizon } from '../wrun-row-lane.types.js';
|
|
25
31
|
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionStats10m`). */
|
|
26
32
|
export declare const WRUN_OPTION_STATS_10M_LANE_KEY = "option_stats_10m";
|
|
33
|
+
/**
|
|
34
|
+
* How far back the ten-minute statistics reach, on every plane: OPTION_UNDERLYING_STATS' ten-minute table drops its
|
|
35
|
+
* four-week chunks after 365 days (`drop_after`) in a drop window that ends at 400 (`drop_before`), the same on every
|
|
36
|
+
* cluster (tsdb-gateway `charts/tsdb-gateway/schema/schema.{ore,cme,blk}.generated.yaml`,
|
|
37
|
+
* `option_underlying_stats_agg_10m`). The far edge of the drop window, so the asks reach every chunk the drop job may
|
|
38
|
+
* not have dropped yet (the `option_strikes` lane's rule).
|
|
39
|
+
*/
|
|
40
|
+
export declare const WRUN_OPTION_STATS_10M_HISTORY_MS: number;
|
|
41
|
+
/** The lane's `horizon` (`WrunRowLaneHorizon`): its rows start where the ten-minute history does at the clock. */
|
|
42
|
+
export declare function wrunOptionStats10mHorizon(_acquisition: Readonly<Record<string, unknown>>, nowMs: number): WrunRowLaneHorizon | undefined;
|
|
27
43
|
export declare const lane: WrunPollLane;
|
|
@@ -2,6 +2,19 @@ import { planWrunOptionStatsInput, wrunOptionStatsAcquisitionMoved } from './opt
|
|
|
2
2
|
import { WRUN_NOT_IN_10M_UNIVERSE_CODE, WRUN_OPTION_STATS_EXCHANGE_FIELD, WRUN_OPTION_STATS_FIELDS, WRUN_OPTION_STATS_INTERVALS, WRUN_OPTION_STATS_KTYPES, } from '../../wrun-opra-stats.leaf.js';
|
|
3
3
|
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionStats10m`). */
|
|
4
4
|
export const WRUN_OPTION_STATS_10M_LANE_KEY = 'option_stats_10m';
|
|
5
|
+
const DAY_MS = 86_400_000;
|
|
6
|
+
/**
|
|
7
|
+
* How far back the ten-minute statistics reach, on every plane: OPTION_UNDERLYING_STATS' ten-minute table drops its
|
|
8
|
+
* four-week chunks after 365 days (`drop_after`) in a drop window that ends at 400 (`drop_before`), the same on every
|
|
9
|
+
* cluster (tsdb-gateway `charts/tsdb-gateway/schema/schema.{ore,cme,blk}.generated.yaml`,
|
|
10
|
+
* `option_underlying_stats_agg_10m`). The far edge of the drop window, so the asks reach every chunk the drop job may
|
|
11
|
+
* not have dropped yet (the `option_strikes` lane's rule).
|
|
12
|
+
*/
|
|
13
|
+
export const WRUN_OPTION_STATS_10M_HISTORY_MS = 400 * DAY_MS;
|
|
14
|
+
/** The lane's `horizon` (`WrunRowLaneHorizon`): its rows start where the ten-minute history does at the clock. */
|
|
15
|
+
export function wrunOptionStats10mHorizon(_acquisition, nowMs) {
|
|
16
|
+
return Number.isFinite(nowMs) ? { servedFromMs: nowMs - WRUN_OPTION_STATS_10M_HISTORY_MS } : undefined;
|
|
17
|
+
}
|
|
5
18
|
export const lane = {
|
|
6
19
|
sourceClass: 'option_stats_10m',
|
|
7
20
|
laneKey: WRUN_OPTION_STATS_10M_LANE_KEY,
|
|
@@ -13,6 +26,7 @@ export const lane = {
|
|
|
13
26
|
label: '10-minute options statistics',
|
|
14
27
|
nativeRows: true,
|
|
15
28
|
barGrid: { landing: 'snapshot' },
|
|
29
|
+
horizon: wrunOptionStats10mHorizon,
|
|
16
30
|
chain: { exchangeField: WRUN_OPTION_STATS_EXCHANGE_FIELD },
|
|
17
31
|
acquisitionMoved: wrunOptionStatsAcquisitionMoved,
|
|
18
32
|
refusedAnswers: {
|
|
@@ -1,27 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `options_flow` lane (UW-PARITY source S2): one bar's
|
|
3
|
-
* of a
|
|
4
|
-
*
|
|
2
|
+
* The `options_flow` lane (UW-PARITY source S2, a CHAIN lane since OPTIONS-PORT P7): one bar's option flow of the
|
|
3
|
+
* chart's options chain, or of a scope across underlyings or venues, as 32 scalars per bar: premium in USD, contracts
|
|
4
|
+
* (coin on a crypto chain, contracts on CME and OPRA) and prints as counts, share delta in the chart's size unit, vega
|
|
5
|
+
* in USD per IV point (`input("calls", options_flow.net_call_prem, { scope: "market", dte: "0dte" })`).
|
|
5
6
|
*
|
|
6
|
-
* It reads OPTION_PRINT_AGG flow scope rows (wrun-opra-flow.leaf: which rows each
|
|
7
|
+
* It reads OPTION_PRINT_AGG flow scope rows (wrun-opra-flow.leaf: which rows each ask names) through the
|
|
7
8
|
* `K_OPTION_PRINT_AGG_SCOPE` control and its worker twin, which sums a bucket's matching rows into the 32 fields
|
|
8
9
|
* (`foldWrunOptionsFlowRows`); this lane lands the buckets on the chart's bars under the tier rule (rule 9: 1m kept 7
|
|
9
10
|
* days, 5m kept 30, 1d kept, the finest that fits the bar and still holds it; a stock chart's 09:30 New York bars, an
|
|
10
|
-
* OPRA contract chart's UTC ones
|
|
11
|
+
* OPRA contract chart's and a crypto chart's UTC ones, a CME chart's intraday ones on their stamps; a CME bar of a day
|
|
12
|
+
* or longer over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, which no UTC day bucket fits:
|
|
13
|
+
* such a bar older than the 5m tier reads its fill, never a misdated day), summed per bar. A bar no tier holds any more
|
|
14
|
+
* reads the input's `missing` fill.
|
|
11
15
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `resolveWrunLaneChainChart`
|
|
17
|
+
* then `decideWrunLaneChain`, `auto`: the chain `options_chain` reads), resolved once per run for every input, and its
|
|
18
|
+
* plane is per instance: OPRA's rules on a US stock or OPRA contract chart (the wall, the plane and its routed tier in
|
|
19
|
+
* the ask, the provenance stamp), CME's on a CME futures chart (the display wall, the routed tier; a continuous chart
|
|
20
|
+
* reads its lead future and a live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. On
|
|
21
|
+
* the OPRA plane (`ctx.opraPlane`) the chain is the plane's own by coin (`wrunLaneOpraPlaneChain`): no chain directory
|
|
22
|
+
* read, and its reads stay byte-identical. It rides the native-rows path on every plane (`nativeRows` + `barGrid`), so
|
|
23
|
+
* the index-mode stock chart serves it too.
|
|
24
|
+
*
|
|
25
|
+
* Knobs (acquisition facets, each validated here before any fetch, refused by name otherwise), the scope words per
|
|
26
|
+
* plane (R7c C7-2):
|
|
27
|
+
* - `scope`: `ticker` (the default: COIN rows of the chain's underlying; on a crypto chain on its venue, ONE book),
|
|
28
|
+
* `market` (OPRA: MARKET rows of every issue type; CME: MARKET rows of the chain's exchange; crypto: COIN rows of the
|
|
29
|
+
* chart's coin on every crypto venue of the venue table the crypto-options gate leaves open, every book: Deribit
|
|
30
|
+
* alone for a guest, as every other chain class reads the gate), `equity`, `etf`, `index` (MARKET rows of that US
|
|
31
|
+
* issue type: OPRA only), `venue` (OPRA: VENUE rows of the `venue` knob's exchange; crypto: COIN rows of the chart's
|
|
32
|
+
* coin on that venue, every book, a venue the gate keeps dark refused `flag-off` as the chain decision refuses it;
|
|
33
|
+
* CME, one venue: none);
|
|
15
34
|
* - `dte`: `all` (the default), `0dte`, `week` (1 to 7 days), `month` (8 to 35), `later`;
|
|
16
35
|
* - `moneyness`: `all` (the default), `otm`, `itm`;
|
|
17
|
-
* - `venue`: scope `venue` only, required there: an exchange's ISO MIC (`XCBO`), read by its Databento
|
|
18
|
-
* (`WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS`)
|
|
19
|
-
* `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
36
|
+
* - `venue`: scope `venue` only, required there: on OPRA an exchange's ISO MIC (`XCBO`), read by its Databento
|
|
37
|
+
* publisher id (`WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS`); on a crypto chain a crypto venue's exchange name
|
|
38
|
+
* (`OKEX_OPTIONS`, the venue table's). That scope serves `call_prem_total`, `put_prem_total`,
|
|
39
|
+
* `call_contracts_total`, `put_contracts_total` and `prints` alone, with no `dte` or `moneyness` split;
|
|
40
|
+
* - `book`: scope `ticker` only: `auto` (the default, the chain's default book) or one series of the chain, decided
|
|
41
|
+
* when the run plans; a crypto chain's ask names it, an OPRA or CME chain's one book is its underlying.
|
|
42
|
+
* A scope the chart's plane does not serve (a US issue type off OPRA, `venue` on CME, a venue word of another plane) is
|
|
43
|
+
* refused with `wrunLaneUnservedScopeSeed`'s seed, so the planner drops an input that declared a fill with the market's
|
|
44
|
+
* note, as on a chart with no option chain (the options chain's `no-chain`, a LINK perp).
|
|
25
45
|
*
|
|
26
46
|
* Before the protocol package names OPTION_PRINT_AGG, every input refuses by name before any fetch
|
|
27
47
|
* (`protocol-pending:OPTION_PRINT_AGG`). The gateway's scope reads stay behind its `read.option_print_scopes`
|
|
@@ -32,8 +52,9 @@ import { type WrunPollLane } from '../wrun-poll-lane.types.js';
|
|
|
32
52
|
import type { WrunBackendTier } from '../../wrun-tier-grid.util.js';
|
|
33
53
|
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionsFlow`). */
|
|
34
54
|
export declare const WRUN_OPTIONS_FLOW_LANE_KEY = "options_flow";
|
|
35
|
-
/** The tiers a bar is read from (rule 9, ADDENDUM-2 B3
|
|
36
|
-
* gateway rolls up from its 1m rows, which a bar older than 7 days no
|
|
55
|
+
/** The tiers a bar is read from (rule 9, ADDENDUM-2 B3, the cme plane's scope families and ore's alike: C7-1; the VENUE
|
|
56
|
+
* family keeps no 5m tier, so a 5m ask of it the gateway rolls up from its 1m rows, which a bar older than 7 days no
|
|
57
|
+
* longer has: that bar reads its fill). */
|
|
37
58
|
export declare const WRUN_OPTIONS_FLOW_TIERS: readonly WrunBackendTier[];
|
|
38
59
|
/**
|
|
39
60
|
* The Databento publisher id the data plane names each `venue` word by (the VENUE rows' `venue`, the request's
|
|
@@ -47,4 +68,8 @@ export declare const WRUN_OPTIONS_FLOW_TIERS: readonly WrunBackendTier[];
|
|
|
47
68
|
*/
|
|
48
69
|
export declare const WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS: Readonly<Record<string, number>>;
|
|
49
70
|
export declare function wrunOptionsFlowVenuePublisherId(venue: string): number | undefined;
|
|
71
|
+
/** Whether an acquisition no longer names the chain the lane would plan now (D12): a CME ticker read off a continuous
|
|
72
|
+
* alias whose lead future rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
|
|
73
|
+
* rebuilds, so no ask, cache or buffer joins the old future's flow to the new one's. */
|
|
74
|
+
export declare function wrunOptionsFlowAcquisitionMoved(acquisition: Readonly<Record<string, unknown>>): boolean;
|
|
50
75
|
export declare const lane: WrunPollLane;
|