@orangecharts/wrun-chart-host 0.5.0 → 0.7.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 +17 -8
- package/dist/constants/feature-flags.constants.js +7 -2
- package/dist/constants/marketCapabilities.constants.d.ts +5 -0
- package/dist/constants/marketCapabilities.constants.js +16 -0
- package/dist/host-env.d.ts +3 -19
- package/dist/host-ports.types.d.ts +36 -17
- package/dist/index.d.ts +12 -1
- package/dist/index.js +12 -1
- package/dist/indicators/controls/tpo-session.util.js +42 -18
- package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
- package/dist/interfaces/wrun-runtime.interface.js +17 -3
- package/dist/market-data/billing.interface.d.ts +2 -1
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +12 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +32 -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-bar-count.util.d.ts +17 -6
- package/dist/utility/wrun/wrun-bar-count.util.js +27 -12
- 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 +131 -59
- package/dist/utility/wrun/wrun-host.service.js +391 -194
- 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-hover.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-hover.util.js +25 -4
- 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 +20 -5
- 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 +52 -8
- package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
- package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
- 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-prefix-cohort.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +1 -1
- 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-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +2 -2
- package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
- 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/dist/workers/wrun/wrun-abi-host.d.ts +15 -2
- package/dist/workers/wrun/wrun-abi-host.js +31 -12
- package/dist/workers/wrun/wrun-engine-handler.d.ts +11 -28
- package/dist/workers/wrun/wrun-engine-handler.js +181 -12
- 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
|
@@ -1,34 +1,94 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `option_prints` (UW-PARITY source contract v2, S3): every
|
|
3
|
-
* input's `min_premium`, one 16-value tuple per print on the bar it printed in
|
|
4
|
-
* plus live. A row lane: the host plans, asks, lands and reconciles it from this
|
|
2
|
+
* `option_prints` (UW-PARITY source contract v2, S3; on every chain since OPTIONS-PORT P7): every print of the chain's
|
|
3
|
+
* ONE book at or above the input's `min_premium`, one 16-value tuple per print on the bar it printed in
|
|
4
|
+
* (wrun-option-prints.util), history plus live. A row lane: the host plans, asks, lands and reconciles it from this
|
|
5
|
+
* descriptor.
|
|
5
6
|
*
|
|
6
|
-
* -
|
|
7
|
+
* - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `resolveWrunLaneChainChart`
|
|
8
|
+
* in `identity`, then `decideWrunLaneChain` per input in `facets`, the decision `options_chain` and `option_surface`
|
|
9
|
+
* read), and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, the
|
|
10
|
+
* provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead contract, and a
|
|
11
|
+
* live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. A chart with no option chain
|
|
12
|
+
* is refused by the decision's own name (`no-options` / `chain`), which a declared `missing: "empty"` drops with a
|
|
13
|
+
* note.
|
|
14
|
+
* - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files prints under),
|
|
15
|
+
* `printExchange` (its plane follows it), `printBook` for a book other than the underlying's own series (ONE book per
|
|
16
|
+
* input, D11: the worker and the live fold keep that book's prints) and `printContinuous` for a CME chain read off a
|
|
17
|
+
* continuous alias.
|
|
7
18
|
* - Facets (the acquisition, om's facet list and words): `min_premium` (required: `wrun_option_prints_min_premium_
|
|
8
19
|
* required`), `expiries`, `history` ("live" | "3d" | "90d") and `overflow` ("refuse" | "largest"), each refused by
|
|
9
|
-
* name outside its words (`wrun_option_knob_invalid`)
|
|
10
|
-
* refuse by name.
|
|
20
|
+
* name outside its words (`wrun_option_knob_invalid`), and the chain classes' `venue` and `book`. One acquisition a
|
|
21
|
+
* package: two inputs whose knobs or chains differ refuse by name.
|
|
11
22
|
* - History: one ask over the window from the span the backend serves the acquisition (`horizon`: the table the
|
|
12
23
|
* floor and the history reach, the gateway's bar limit); older bars are partial. The K control `K_OPTION_PRINT`
|
|
13
24
|
* reads it on the native-rows path, keyed by second; the landing re-bases each print's offset on its host bar.
|
|
14
25
|
* - Projection, per input: `expiries: "nearest:N"` keeps the bar's N nearest expiries; `overflow: "largest"` cuts a
|
|
15
26
|
* bar over the input's own `max_cells` to its largest premiums (om's packer rule, bit 14 on the first kept print).
|
|
16
|
-
* - Live by coin
|
|
17
|
-
*
|
|
18
|
-
*
|
|
27
|
+
* - Live by coin, on the planes whose OPTION_PRINT producer streams (`chainPlanes`: OPRA and CME): the coin channel of
|
|
28
|
+
* the instance's chain (`K_OPTION_PRINT` subscribes the chain's exchange and underlying, on a governed exchange at a
|
|
29
|
+
* real-time routed tier only: wrun-coin-lane-live.util) feeds every print of the underlying; the fold keeps the
|
|
30
|
+
* acquisition's chain (its exchange and its ONE book), its floor and "0dte"; a reconcile merges by `print_key`, so a
|
|
31
|
+
* print shown live never vanishes and one seen on both paths is one tuple. A crypto chain subscribes no channel: the
|
|
32
|
+
* gateway derives its prints from the venue trades ore stores each minute and serves them from history alone (no
|
|
33
|
+
* frame ever reaches a crypto coin channel), so the live tick's reconcile re-asks it, as it re-asks
|
|
34
|
+
* `option_contract_flow`, and the same merge by `print_key` keeps every print once. Never a TRADE channel: the browser
|
|
35
|
+
* builds no print from trades.
|
|
36
|
+
* - A CME chart's daily or longer bar is asked over its Globex session (the host's flow plan, wrun-tier-grid.util
|
|
37
|
+
* `wrunCmeSessionBarSpan`): an evening print belongs to the next trade date's bar, stamped 00:00Z, so its offset on it
|
|
38
|
+
* reads below 0.
|
|
39
|
+
*
|
|
40
|
+
* LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
|
|
19
41
|
*/
|
|
42
|
+
import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
20
43
|
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED } from '../wrun-poll-lane.types.js';
|
|
21
44
|
import { refuseWrunOptionKnob, wrunNearestExpiryTuples, wrunOptionExpiriesKnob, wrunOptionExpiriesOf, wrunOptionExpiriesWord, } from '../../wrun-option-knobs.util.js';
|
|
22
|
-
import { isWrunOptionPrintTuple, WRUN_OPTION_PRINT_COLUMN, WRUN_OPTION_PRINTS_HISTORY, WRUN_OPTION_PRINTS_OVERFLOW, WRUN_OPTION_PRINTS_WIDTH, wrunLargestPremiumPrints, wrunOptionPrintKept, wrunOptionPrintOf, wrunOptionPrintsAcquisitionOf, wrunOptionPrintsHorizon, wrunOptionPrintsInTimeOrder, wrunOptionPrintTimeMs, } from '../../wrun-option-prints.util.js';
|
|
23
|
-
import { resolveWrunOpraLaneUnderlying } from '../../wrun-opra-underlying.util.js';
|
|
45
|
+
import { isWrunOptionPrintTuple, WRUN_OPTION_PRINT_COLUMN, WRUN_OPTION_PRINTS_BOOK_FIELD, WRUN_OPTION_PRINTS_CONTINUOUS_FIELD, WRUN_OPTION_PRINTS_EXCHANGE_FIELD, WRUN_OPTION_PRINTS_HISTORY, WRUN_OPTION_PRINTS_OVERFLOW, WRUN_OPTION_PRINTS_WIDTH, wrunLargestPremiumPrints, wrunOptionPrintKept, wrunOptionPrintOf, wrunOptionPrintsAcquisitionOf, wrunOptionPrintsHorizon, wrunOptionPrintsInTimeOrder, wrunOptionPrintTimeMs, } from '../../wrun-option-prints.util.js';
|
|
24
46
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../../wrun-present-bits.util.js';
|
|
47
|
+
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
25
48
|
import { wrunHostBarOf } from '../../wrun-tier-grid.util.js';
|
|
26
49
|
/** The lane's key, its feed in a refusal record. */
|
|
27
50
|
const LANE_KEY = 'option_prints';
|
|
28
51
|
/** om's refusal name of a missing floor. */
|
|
29
52
|
export const WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE = 'wrun_option_prints_min_premium_required';
|
|
30
|
-
/**
|
|
31
|
-
|
|
53
|
+
/** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
|
|
54
|
+
* market; the newest entries kept. */
|
|
55
|
+
const PRINTS_CHARTS_KEPT = 16;
|
|
56
|
+
const printsCharts = new Map();
|
|
57
|
+
function rememberPrintsChart(key, chart) {
|
|
58
|
+
printsCharts.delete(key);
|
|
59
|
+
printsCharts.set(key, chart);
|
|
60
|
+
while (printsCharts.size > PRINTS_CHARTS_KEPT)
|
|
61
|
+
printsCharts.delete(printsCharts.keys().next().value);
|
|
62
|
+
}
|
|
63
|
+
/** Test seam: forget every resolved chart. */
|
|
64
|
+
export function __resetWrunPrintsChartsForTests() {
|
|
65
|
+
printsCharts.clear();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An input's chain as the ask's fields (the acquisition key: the class, the plane its exchange names, the exchange,
|
|
69
|
+
* the underlying and the book): `coin` (the chain's underlying, upper case: an OPRA chain's ticker exactly as before)
|
|
70
|
+
* and `printExchange` always, `printBook` for a book other than the underlying's own series (Deribit's BTC_USDC, OKX's
|
|
71
|
+
* BTC-USD), and `printContinuous` for a CME chain read off a continuous alias (`wrunOptionPrintsAcquisitionMoved`).
|
|
72
|
+
*/
|
|
73
|
+
export function wrunOptionPrintsExtras(chain) {
|
|
74
|
+
const coin = chain.underlying.toUpperCase();
|
|
75
|
+
const book = chain.book.toUpperCase();
|
|
76
|
+
return {
|
|
77
|
+
coin,
|
|
78
|
+
[WRUN_OPTION_PRINTS_EXCHANGE_FIELD]: chain.exchange,
|
|
79
|
+
...(book !== coin ? { [WRUN_OPTION_PRINTS_BOOK_FIELD]: book } : {}),
|
|
80
|
+
...(chain.continuous !== undefined ? { [WRUN_OPTION_PRINTS_CONTINUOUS_FIELD]: chain.continuous } : {}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** Whether an acquisition no longer names the contract the lane would plan now (D12): a CME chain read off a
|
|
84
|
+
* continuous alias whose lead rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
|
|
85
|
+
* rebuilds, so no ask, live fold or buffer joins the old contract's prints to the new one's. */
|
|
86
|
+
export function wrunOptionPrintsAcquisitionMoved(acquisition) {
|
|
87
|
+
return wrunLaneChainLeadMoved(acquisition[WRUN_OPTION_PRINTS_EXCHANGE_FIELD], acquisition[WRUN_OPTION_PRINTS_CONTINUOUS_FIELD], acquisition.coin);
|
|
88
|
+
}
|
|
89
|
+
/** One input's facets: the floor (required), the history, the overflow rule and the expiries word, then its chain,
|
|
90
|
+
* decided by the one chain resolver over the chart `identity` resolved (its `venue` and `book`). */
|
|
91
|
+
async function optionPrintsFacets(source, ctx) {
|
|
32
92
|
const minPremium = source.min_premium;
|
|
33
93
|
if (minPremium === undefined) {
|
|
34
94
|
return refuseWrunPollInput(ctx, `declares no min_premium (${WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE}): declare the smallest premium a print ` +
|
|
@@ -46,7 +106,18 @@ function optionPrintsFacets(source, ctx) {
|
|
|
46
106
|
return refuseWrunOptionKnob(ctx, 'overflow', overflow, WRUN_OPTION_PRINTS_OVERFLOW.join(', '));
|
|
47
107
|
}
|
|
48
108
|
const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
|
|
49
|
-
|
|
109
|
+
const chart = printsCharts.get(wrunLaneChartKey(ctx));
|
|
110
|
+
if (chart === undefined) {
|
|
111
|
+
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
112
|
+
}
|
|
113
|
+
const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
|
|
114
|
+
return {
|
|
115
|
+
...wrunOptionPrintsExtras(chain),
|
|
116
|
+
minPremium,
|
|
117
|
+
history,
|
|
118
|
+
overflow,
|
|
119
|
+
...(expiries !== undefined ? { expiries } : {}),
|
|
120
|
+
};
|
|
50
121
|
}
|
|
51
122
|
/** A host bar's prints: each second row's prints, their offsets re-based on the bar's open, in time order. */
|
|
52
123
|
function landOptionPrints(group) {
|
|
@@ -102,8 +173,9 @@ function mergeBarPrints(existing, incoming) {
|
|
|
102
173
|
? wrunTuplesMarkedPartial(prints, WRUN_OPTION_PRINTS_WIDTH)
|
|
103
174
|
: [wrunPartialMarkerTuple(WRUN_OPTION_PRINTS_WIDTH)];
|
|
104
175
|
}
|
|
105
|
-
/** Live prints folded into the instance's host-bar rows: each kept print (the acquisition's
|
|
106
|
-
*
|
|
176
|
+
/** Live prints folded into the instance's host-bar rows: each kept print (the acquisition's chain, its exchange and
|
|
177
|
+
* its ONE book, its floor and "0dte": a coin channel of another venue or book feeds nothing here) on the bar holding
|
|
178
|
+
* it, once per `print_key`, every touched bar's prints in time order. */
|
|
107
179
|
function foldLiveOptionPrints(rows, points, ctx) {
|
|
108
180
|
const acquisition = wrunOptionPrintsAcquisitionOf(ctx.acquisition);
|
|
109
181
|
const byBar = new Map(rows.map((row) => [Number(row[0]), [...row]]));
|
|
@@ -171,16 +243,21 @@ export const rowLane = {
|
|
|
171
243
|
label: 'Option prints',
|
|
172
244
|
feedWords: 'wrun.refusal.feed.optionPrints',
|
|
173
245
|
width: WRUN_OPTION_PRINTS_WIDTH,
|
|
174
|
-
|
|
246
|
+
chain: { exchangeField: WRUN_OPTION_PRINTS_EXCHANGE_FIELD },
|
|
247
|
+
acquisitionMoved: wrunOptionPrintsAcquisitionMoved,
|
|
248
|
+
identity: async (ctx) => {
|
|
249
|
+
rememberPrintsChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx));
|
|
250
|
+
},
|
|
175
251
|
facets: optionPrintsFacets,
|
|
176
252
|
acquisitions: 'one',
|
|
177
253
|
landing: { kind: 'flow', fold: landOptionPrints },
|
|
178
254
|
horizon: wrunOptionPrintsHorizon,
|
|
179
|
-
governed: 'opra',
|
|
180
255
|
emptyAnswer: 'quiet',
|
|
181
256
|
cells: projectOptionPrints,
|
|
182
257
|
liveByCoin: {
|
|
183
258
|
scriptSource: 'option_print',
|
|
259
|
+
// The planes whose OPTION_PRINT producer streams live (a crypto chain's prints are derived each minute: history).
|
|
260
|
+
chainPlanes: ['opra', 'cme'],
|
|
184
261
|
stampOf: (point) => {
|
|
185
262
|
const tsMs = wrunOptionPrintTimeMs(livePrintOf(point).print?.timestamp);
|
|
186
263
|
return Number.isFinite(tsMs) ? tsMs : null;
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* exchange and underlying; the K_OPTION_STRIKES control and its worker twin). A bar holding no minute (outside the
|
|
16
16
|
* session, a minute the backend missed, history past its about seven days) is an EMPTY block; an empty answer is
|
|
17
17
|
* quiet (om's `absence: "empty"`).
|
|
18
|
+
* - History: the asks reach back as far as the strike history does (`horizon`, `WRUN_OPTION_STRIKES_HISTORY_MS`),
|
|
19
|
+
* never across the whole window the run computes over: a warm-up page bought ahead of the viewport (one 500-bar
|
|
20
|
+
* page is about 105 days at 1h) or a pan back asks nothing the backend no longer holds. A bar past the reach reads
|
|
21
|
+
* its EMPTY block unasked, the same block an ask over it answered.
|
|
18
22
|
* - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `decideWrunLaneChain`), per
|
|
19
23
|
* input, and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, native
|
|
20
24
|
* rows, the provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead
|
|
@@ -33,7 +37,7 @@
|
|
|
33
37
|
* LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
|
|
34
38
|
*/
|
|
35
39
|
import { type WrunLaneChain } from '../opra-option-lanes.util.js';
|
|
36
|
-
import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
|
|
40
|
+
import type { WrunRowLaneDescriptor, WrunRowLaneHorizon } from '../wrun-row-lane.types.js';
|
|
37
41
|
/** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
|
|
38
42
|
export declare const WRUN_OPTION_STRIKES_WIDTH = 12;
|
|
39
43
|
/** The columns a tuple must hold a finite number in: the strike and the expiry. */
|
|
@@ -42,6 +46,16 @@ export declare const WRUN_OPTION_STRIKES_FINITE_COLUMNS: readonly number[];
|
|
|
42
46
|
export declare const WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE = "wrun_options_chain_market_pinned";
|
|
43
47
|
/** The payload field an instance names its chain's exchange in (its plane follows it). */
|
|
44
48
|
export declare const WRUN_OPTION_STRIKES_EXCHANGE_FIELD = "strikeExchange";
|
|
49
|
+
/**
|
|
50
|
+
* How far back the strike history reaches, on every plane: OPTION_STRIKE_AGG's minute table drops its day chunks
|
|
51
|
+
* after 7 days (`drop_after`) in a drop window that ends at 10 (`drop_before`), the same on every cluster (tsdb-gateway
|
|
52
|
+
* `charts/tsdb-gateway/schema/schema.{ore,cme,blk}.generated.yaml`, `option_strike_agg_1m`). The far edge of the drop
|
|
53
|
+
* window, so the asks reach every chunk the drop job may not have dropped yet.
|
|
54
|
+
*/
|
|
55
|
+
export declare const WRUN_OPTION_STRIKES_HISTORY_MS: number;
|
|
56
|
+
/** The lane's `horizon` (`WrunRowLaneHorizon`): its rows start where the strike history does at the clock. A bar that
|
|
57
|
+
* ends before then asks nothing and reads its EMPTY block (no `present` mask to mark it). */
|
|
58
|
+
export declare function wrunOptionStrikesHorizon(_acquisition: Readonly<Record<string, unknown>>, nowMs: number): WrunRowLaneHorizon | undefined;
|
|
45
59
|
/** Test seam: forget every resolved chart. */
|
|
46
60
|
export declare function __resetWrunStrikesChartsForTests(): void;
|
|
47
61
|
/** The tuples an input keeps under its `expiries` word: every one, or ("nearest:N") the tuples of the N earliest
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
* exchange and underlying; the K_OPTION_STRIKES control and its worker twin). A bar holding no minute (outside the
|
|
16
16
|
* session, a minute the backend missed, history past its about seven days) is an EMPTY block; an empty answer is
|
|
17
17
|
* quiet (om's `absence: "empty"`).
|
|
18
|
+
* - History: the asks reach back as far as the strike history does (`horizon`, `WRUN_OPTION_STRIKES_HISTORY_MS`),
|
|
19
|
+
* never across the whole window the run computes over: a warm-up page bought ahead of the viewport (one 500-bar
|
|
20
|
+
* page is about 105 days at 1h) or a pan back asks nothing the backend no longer holds. A bar past the reach reads
|
|
21
|
+
* its EMPTY block unasked, the same block an ask over it answered.
|
|
18
22
|
* - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `decideWrunLaneChain`), per
|
|
19
23
|
* input, and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, native
|
|
20
24
|
* rows, the provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead
|
|
@@ -32,10 +36,10 @@
|
|
|
32
36
|
*
|
|
33
37
|
* LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
|
|
34
38
|
*/
|
|
35
|
-
import { decideWrunLaneChain, decideWrunLaneChainIdentity, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
39
|
+
import { decideWrunLaneChain, decideWrunLaneChainIdentity, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
36
40
|
import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
|
|
37
41
|
import { WRUN_OPTIONS_CHAIN_EXPIRIES_CODE, wrunOptionsChainExpiries, wrunOptionsChainIdentityKey, } from '../../wrun-options-chain.util.js';
|
|
38
|
-
import { attachWrunRefusal } from '../../wrun-refusal.util.js';
|
|
42
|
+
import { attachWrunRefusal, wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
39
43
|
/** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
|
|
40
44
|
export const WRUN_OPTION_STRIKES_WIDTH = 12;
|
|
41
45
|
/** The columns a tuple must hold a finite number in: the strike and the expiry. */
|
|
@@ -44,6 +48,19 @@ export const WRUN_OPTION_STRIKES_FINITE_COLUMNS = Object.freeze([0, 1]);
|
|
|
44
48
|
export const WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE = 'wrun_options_chain_market_pinned';
|
|
45
49
|
/** The payload field an instance names its chain's exchange in (its plane follows it). */
|
|
46
50
|
export const WRUN_OPTION_STRIKES_EXCHANGE_FIELD = 'strikeExchange';
|
|
51
|
+
const DAY_MS = 86_400_000;
|
|
52
|
+
/**
|
|
53
|
+
* How far back the strike history reaches, on every plane: OPTION_STRIKE_AGG's minute table drops its day chunks
|
|
54
|
+
* after 7 days (`drop_after`) in a drop window that ends at 10 (`drop_before`), the same on every cluster (tsdb-gateway
|
|
55
|
+
* `charts/tsdb-gateway/schema/schema.{ore,cme,blk}.generated.yaml`, `option_strike_agg_1m`). The far edge of the drop
|
|
56
|
+
* window, so the asks reach every chunk the drop job may not have dropped yet.
|
|
57
|
+
*/
|
|
58
|
+
export const WRUN_OPTION_STRIKES_HISTORY_MS = 10 * DAY_MS;
|
|
59
|
+
/** The lane's `horizon` (`WrunRowLaneHorizon`): its rows start where the strike history does at the clock. A bar that
|
|
60
|
+
* ends before then asks nothing and reads its EMPTY block (no `present` mask to mark it). */
|
|
61
|
+
export function wrunOptionStrikesHorizon(_acquisition, nowMs) {
|
|
62
|
+
return Number.isFinite(nowMs) ? { servedFromMs: nowMs - WRUN_OPTION_STRIKES_HISTORY_MS } : undefined;
|
|
63
|
+
}
|
|
47
64
|
/** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
|
|
48
65
|
* market; the newest entries kept. */
|
|
49
66
|
const STRIKES_CHARTS_KEPT = 16;
|
|
@@ -103,6 +120,7 @@ export const rowLane = {
|
|
|
103
120
|
acquisitions: 'one',
|
|
104
121
|
emptyAnswer: 'quiet',
|
|
105
122
|
landing: { kind: 'snapshot' },
|
|
123
|
+
horizon: wrunOptionStrikesHorizon,
|
|
106
124
|
acquisitionMoved: wrunOptionStrikesAcquisitionMoved,
|
|
107
125
|
identity: async (ctx) => {
|
|
108
126
|
rememberStrikesChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx));
|
|
@@ -113,14 +131,11 @@ export const rowLane = {
|
|
|
113
131
|
refuseWrunLaneStrayKnob(ctx, knob, "'tape' celled");
|
|
114
132
|
}
|
|
115
133
|
if (source.symbol !== undefined || source.exchange !== undefined) {
|
|
116
|
-
refuseWrunPollInput(ctx, `pins option_strikes cells to a fixed market (${WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE}); option_strikes reads the chain of the chart's own underlying (pick the chain family with venue), so drop the symbol and exchange pin`,
|
|
134
|
+
refuseWrunPollInput(ctx, `pins option_strikes cells to a fixed market (${WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE}); option_strikes reads the chain of the chart's own underlying (pick the chain family with venue), so drop the symbol and exchange pin`, wrunAuthorRuleSeed(WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE));
|
|
117
135
|
}
|
|
118
136
|
const chart = strikesCharts.get(wrunLaneChartKey(ctx));
|
|
119
137
|
if (chart === undefined) {
|
|
120
|
-
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again',
|
|
121
|
-
cls: 'run-failed',
|
|
122
|
-
variant: 'generic',
|
|
123
|
-
});
|
|
138
|
+
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
124
139
|
}
|
|
125
140
|
// om's order: the venue word, then the expiries word, then the chain the word resolves.
|
|
126
141
|
const decision = decideWrunLaneChainIdentity(chart, source.venue, ctx);
|
|
@@ -130,7 +145,7 @@ export const rowLane = {
|
|
|
130
145
|
const expiries = source.expiries;
|
|
131
146
|
const expiriesRead = expiries === undefined || (typeof expiries === 'string' && wrunOptionsChainExpiries(expiries) !== undefined);
|
|
132
147
|
if (!expiriesRead) {
|
|
133
|
-
throw attachWrunRefusal(new Error(`Input '${ctx.inputName}' reads option_strikes cells with expiries '${String(expiries)}' (${WRUN_OPTIONS_CHAIN_EXPIRIES_CODE}): declare "all" or "nearest:N" (the N nearest live expiries, 1..999)`),
|
|
148
|
+
throw attachWrunRefusal(new Error(`Input '${ctx.inputName}' reads option_strikes cells with expiries '${String(expiries)}' (${WRUN_OPTIONS_CHAIN_EXPIRIES_CODE}): declare "all" or "nearest:N" (the N nearest live expiries, 1..999)`), wrunAuthorRuleSeed(WRUN_OPTIONS_CHAIN_EXPIRIES_CODE));
|
|
134
149
|
}
|
|
135
150
|
if (!decision.ok)
|
|
136
151
|
throw wrunLaneChainRefusalError(decision, 'option_strikes');
|
|
@@ -30,9 +30,10 @@
|
|
|
30
30
|
*
|
|
31
31
|
* LIGHT at module load: pb-common and the chain resolver are imported inside `identity`.
|
|
32
32
|
*/
|
|
33
|
-
import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChainPlaneOf, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
33
|
+
import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChainPlaneOf, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
34
34
|
import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
|
|
35
35
|
import { assertWrunProtocolType } from '../../wrun-protocol-pending.util.js';
|
|
36
|
+
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
36
37
|
const MINUTE_MS = 60_000;
|
|
37
38
|
const DAY_MS = 86_400_000;
|
|
38
39
|
/** f64s per tuple (the source contract's width, the `present` mask included). */
|
|
@@ -46,17 +47,19 @@ export const WRUN_OPTION_SURFACE_TIERS = Object.freeze([
|
|
|
46
47
|
]);
|
|
47
48
|
/** The payload field an instance names its chain's exchange in (its plane follows it). */
|
|
48
49
|
export const WRUN_OPTION_SURFACE_EXCHANGE_FIELD = 'surfaceExchange';
|
|
49
|
-
/** The knobs of the other options classes, each refused here by name
|
|
50
|
+
/** The knobs of the other options classes, each refused here by name (the print classes' knobs are option_prints_v2's
|
|
51
|
+
* too, and `structure` its own, since kit 0.88.0). */
|
|
50
52
|
const STRAY_KNOBS = [
|
|
51
53
|
[
|
|
52
54
|
'expiries',
|
|
53
|
-
"'options_chain', 'option_strikes', 'option_prints', 'option_contract_flow' and 'option_contract_state'",
|
|
55
|
+
"'options_chain', 'option_strikes', 'option_prints', 'option_prints_v2', 'option_contract_flow' and 'option_contract_state'",
|
|
54
56
|
],
|
|
55
57
|
['strike_window_pct', "'option_contract_flow' and 'option_contract_state'"],
|
|
56
|
-
['history', "'tape' and '
|
|
58
|
+
['history', "'tape', 'option_prints' and 'option_prints_v2' celled"],
|
|
57
59
|
['min_size', "'tape' celled"],
|
|
58
|
-
['min_premium', "'option_prints' celled"],
|
|
59
|
-
['overflow', "'option_prints' celled"],
|
|
60
|
+
['min_premium', "'option_prints' and 'option_prints_v2' celled"],
|
|
61
|
+
['overflow', "'option_prints' and 'option_prints_v2' celled"],
|
|
62
|
+
['structure', "'option_prints_v2' celled"],
|
|
60
63
|
['min_volume', "'option_contract_flow' celled"],
|
|
61
64
|
];
|
|
62
65
|
/** What `identity` resolved for a chart, read back by `facets` (synchronous). Keyed by the chart market; the newest
|
|
@@ -130,14 +133,11 @@ export const rowLane = {
|
|
|
130
133
|
refuseWrunLaneStrayKnob(ctx, knob, owners);
|
|
131
134
|
}
|
|
132
135
|
if (source.symbol !== undefined || source.exchange !== undefined) {
|
|
133
|
-
refuseWrunPollInput(ctx, "pins option_surface cells to a fixed market (wrun_option_market_pinned); it reads the chart's own underlying, so drop the symbol and exchange pin",
|
|
136
|
+
refuseWrunPollInput(ctx, "pins option_surface cells to a fixed market (wrun_option_market_pinned); it reads the chart's own underlying, so drop the symbol and exchange pin", wrunAuthorRuleSeed('wrun_option_market_pinned'));
|
|
134
137
|
}
|
|
135
138
|
const chart = surfaceCharts.get(wrunLaneChartKey(ctx));
|
|
136
139
|
if (chart === undefined) {
|
|
137
|
-
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again',
|
|
138
|
-
cls: 'run-failed',
|
|
139
|
-
variant: 'generic',
|
|
140
|
-
});
|
|
140
|
+
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
141
141
|
}
|
|
142
142
|
return wrunOptionSurfaceExtras(await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx));
|
|
143
143
|
},
|
|
@@ -42,7 +42,7 @@ import type { WrunInputSource } from '../../../interfaces/wrun-runtime.interface
|
|
|
42
42
|
import type { WrunDailyLanding } from '../wrun-daily-lane.util.js';
|
|
43
43
|
import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
|
|
44
44
|
import type { WrunBackendTier, WrunTierLanding } from '../wrun-tier-grid.util.js';
|
|
45
|
-
import type { WrunRowLaneChain } from './wrun-row-lane.types.js';
|
|
45
|
+
import type { WrunRowLaneChain, WrunRowLaneHorizon } from './wrun-row-lane.types.js';
|
|
46
46
|
/** An input's declaration as a lane reads it: the typed fields, and any knob the sheet carries
|
|
47
47
|
* that the interface does not name yet (`asset`, `publisher`, `series`, ...), as `unknown`. */
|
|
48
48
|
export type WrunPollLaneSource = WrunInputSource & Readonly<Record<string, unknown>>;
|
|
@@ -207,6 +207,15 @@ export interface WrunPollLane {
|
|
|
207
207
|
nativeRows?: true;
|
|
208
208
|
/** The host-grid landing of a per-bar `nativeRows` lane (required there, refused on any other lane). */
|
|
209
209
|
barGrid?: WrunPollLaneBarGrid;
|
|
210
|
+
/**
|
|
211
|
+
* The backend's span for one acquisition at the clock (`WrunRowLaneHorizon`, the row lanes' word), for a `barGrid`
|
|
212
|
+
* lane whose history no tier can name (a ten-minute row lands on any bar, so no tier width divides every bar it
|
|
213
|
+
* serves): the asks start at the first bar that ends after `servedFromMs` (an ask wholly before it is dropped), so a
|
|
214
|
+
* run over a longer window (a warm-up page, a pan back) never asks what its source no longer holds, and the bars
|
|
215
|
+
* before it read the input's `missing` policy. Called with the instance's payload and the window's clock. Absent:
|
|
216
|
+
* the tier rule alone.
|
|
217
|
+
*/
|
|
218
|
+
horizon?: (extras: Readonly<Record<string, unknown>>, nowMs: number) => WrunRowLaneHorizon | undefined;
|
|
210
219
|
/**
|
|
211
220
|
* The lane reads US options data (the OPRA plane): an input of it is refused by name before its `plan`
|
|
212
221
|
* runs for a run that may not read OPRA (`opra-official-only:<class>`, wrun-opra-lane.util), its asks name
|
|
@@ -304,6 +313,9 @@ export declare function refuseWrunPollInput(ctx: Pick<WrunPollLaneContext, 'inpu
|
|
|
304
313
|
* coin is another. A chart that names no coin has no such feed at all (the market words), so a
|
|
305
314
|
* sentence never ends on an empty coin. */
|
|
306
315
|
export declare function wrunPollCoinGateSeed(feed: string, coins: readonly string[], chartCoin: string): WrunRefusalSeed;
|
|
316
|
+
/** The code of a declared knob a lane refuses (a knob word, a fund the coin does not list, a knob the class does not
|
|
317
|
+
* take): the author's to fix in the code. */
|
|
318
|
+
export declare const WRUN_LANE_KNOB_INVALID_CODE = "wrun_lane_knob_invalid";
|
|
307
319
|
/** The seed of a gate the author fixes in the code (a knob word, a fund the coin does not list): a
|
|
308
|
-
* failed run, its text in the details. */
|
|
320
|
+
* failed run, its text in the details, `WRUN_LANE_KNOB_INVALID_CODE` its code. */
|
|
309
321
|
export declare const WRUN_POLL_AUTHOR_GATE_SEED: WrunRefusalSeed;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attachWrunRefusal } from '../wrun-refusal.util.js';
|
|
1
|
+
import { attachWrunRefusal, wrunAuthorRuleSeed } from '../wrun-refusal.util.js';
|
|
2
2
|
export const WRUN_POLL_LANE_ID_PREFIX = 'poll:';
|
|
3
3
|
export function isWrunPollLaneId(value) {
|
|
4
4
|
return typeof value === 'string' && value.startsWith(WRUN_POLL_LANE_ID_PREFIX);
|
|
@@ -21,6 +21,9 @@ export function wrunPollCoinGateSeed(feed, coins, chartCoin) {
|
|
|
21
21
|
return { cls: 'feed-missing', variant: 'market-paused', params: { feed } };
|
|
22
22
|
return { cls: 'coin-outside-feed', params: { feed, coins: coins.join(', '), coin: chartCoin } };
|
|
23
23
|
}
|
|
24
|
+
/** The code of a declared knob a lane refuses (a knob word, a fund the coin does not list, a knob the class does not
|
|
25
|
+
* take): the author's to fix in the code. */
|
|
26
|
+
export const WRUN_LANE_KNOB_INVALID_CODE = 'wrun_lane_knob_invalid';
|
|
24
27
|
/** The seed of a gate the author fixes in the code (a knob word, a fund the coin does not list): a
|
|
25
|
-
* failed run, its text in the details. */
|
|
26
|
-
export const WRUN_POLL_AUTHOR_GATE_SEED = Object.freeze(
|
|
28
|
+
* failed run, its text in the details, `WRUN_LANE_KNOB_INVALID_CODE` its code. */
|
|
29
|
+
export const WRUN_POLL_AUTHOR_GATE_SEED = Object.freeze(wrunAuthorRuleSeed(WRUN_LANE_KNOB_INVALID_CODE));
|
|
@@ -39,10 +39,12 @@
|
|
|
39
39
|
import type { WrunIndicatorMetadata, WrunInputSource } from '../../../interfaces/wrun-runtime.interface.js';
|
|
40
40
|
import type { OpraReadFacts } from '../../chart/opra-read-access.leaf.js';
|
|
41
41
|
import type { OpraOptionPlaneStop } from '../../../host-ports.types.js';
|
|
42
|
+
import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
|
|
42
43
|
import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneId, type WrunPollLaneInstance } from './wrun-poll-lane.types.js';
|
|
43
|
-
import { type WrunLaneChainPlane } from './wrun-row-lane.types.js';
|
|
44
|
+
import { type WrunLaneChainPlane, type WrunRowLaneHorizon } from './wrun-row-lane.types.js';
|
|
44
45
|
import type { WrunMissingFeed } from '../wrun-run-health.util.js';
|
|
45
46
|
import type { LiveBucketVenue } from '../../chart/live-bucket.util.js';
|
|
47
|
+
import { type WrunHostGridAsk } from '../wrun-tier-grid.util.js';
|
|
46
48
|
/** One input of a registry class under the static plan. */
|
|
47
49
|
export interface WrunPollLaneInput {
|
|
48
50
|
inputIndex: number;
|
|
@@ -132,11 +134,25 @@ export interface WrunUnservedLaneInput {
|
|
|
132
134
|
export declare function wrunUnservedLaneInput(missing: Map<string, WrunMissingFeed>, input: WrunUnservedLaneInput, fills: readonly string[], why: WrunUnservedLaneWhy, cryptoVenue: boolean | undefined): void;
|
|
133
135
|
/**
|
|
134
136
|
* Whether a lane's refusal says the chart has no option chain: its record's seed is `no-options` / `chain` (the chain
|
|
135
|
-
* decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`,
|
|
136
|
-
*
|
|
137
|
+
* decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, every options lane's since each reads the
|
|
138
|
+
* one chain resolver), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
|
|
137
139
|
* options) does not serve the feed: both planners hand the refusal to `wrunUnservedLaneInput`, so a declared fill reads.
|
|
138
140
|
*/
|
|
139
141
|
export declare function wrunLaneNoChainRefusal(error: unknown): error is Error;
|
|
142
|
+
/**
|
|
143
|
+
* The seed of a lane's refusal that the chart's options plane serves no such scope (OPTIONS-PORT P7, R7c C7-2:
|
|
144
|
+
* `options_flow`'s US issue types off the OPRA plane, its `venue` on CME, a venue word of another plane): the
|
|
145
|
+
* feed-missing record under the lane's feed ("this market has no such feed"). Made here, so the planner tells it from
|
|
146
|
+
* every other feed-missing refusal by the seed itself (`wrunLaneUnservedScopeRefusal`), never the words.
|
|
147
|
+
*/
|
|
148
|
+
export declare function wrunLaneUnservedScopeSeed(feed: string): WrunRefusalSeed;
|
|
149
|
+
/**
|
|
150
|
+
* Whether a lane's refusal says the chart's options plane serves no such scope: its seed is one
|
|
151
|
+
* `wrunLaneUnservedScopeSeed` made. Such a chart does not serve the input, as a chart with no option chain does not:
|
|
152
|
+
* the planner hands the refusal to `wrunUnservedLaneInput` as the lane's own (`noChain`), so a declared fill drops the
|
|
153
|
+
* input with the market's note and any other input refuses with the lane's own words and seed.
|
|
154
|
+
*/
|
|
155
|
+
export declare function wrunLaneUnservedScopeRefusal(error: unknown): error is Error;
|
|
140
156
|
/**
|
|
141
157
|
* A chain lane's input before its chain is resolved, both planners' one rule: where the chart's options list on OPRA
|
|
142
158
|
* (riding the plane, or kept off it by a known stop) the OPRA wall first (`opra-official-only:<class>`), every chain it
|
|
@@ -336,15 +352,34 @@ export interface WrunHostGridWindow {
|
|
|
336
352
|
barGrid?: LiveBucketVenue | null;
|
|
337
353
|
nowMs: number;
|
|
338
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that opens
|
|
357
|
+
* before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after `servedFromMs`
|
|
358
|
+
* (an ask wholly before it is dropped). A bar opens and ends where its span does (wrun-tier-grid.util
|
|
359
|
+
* `wrunHostBarSpanOf`: its Globex session under a CME session grid). No horizon: the plan as the tier rule made it.
|
|
360
|
+
* The one cut a row lane
|
|
361
|
+
* (sources/wrun-row-lanes.util `wrunRowLaneAsksWithinHorizon`) and a host-grid poll lane (`horizon`) take.
|
|
362
|
+
*/
|
|
363
|
+
export declare function wrunHostGridAsksWithinHorizon(plan: {
|
|
364
|
+
asks: WrunHostGridAsk[];
|
|
365
|
+
partialBars: number[];
|
|
366
|
+
}, window: Pick<WrunHostGridWindow, 'barOpens' | 'intervalMs'>, horizon: WrunRowLaneHorizon | undefined, sessionGrid?: LiveBucketVenue | null): {
|
|
367
|
+
asks: WrunHostGridAsk[];
|
|
368
|
+
partialBars: number[];
|
|
369
|
+
};
|
|
339
370
|
/**
|
|
340
371
|
* A lane's rows over a chart window, landed on the host bars when it is a host-grid lane (`barGrid`): its asks
|
|
341
372
|
* under the tier rule (`wrunHostGridAsks` over the window's host bars: one per run of bars on a tier, the
|
|
342
|
-
* tier's key in its extras as `tier`),
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
373
|
+
* tier's key in its extras as `tier`), cut to the lane's `horizon` for the acquisition (`wrunHostGridAsksWithinHorizon`:
|
|
374
|
+
* the bars its source no longer holds ask nothing and read the input's `missing` policy), each answer landed by the
|
|
375
|
+
* lane's landing (`wrunLandScalarRowsOnHostBars`: a flow summed per bar, a snapshot's newest sealed row, sealed by its
|
|
376
|
+
* ask's tier), ascending. A bar no tier retains asks nothing and reads no row. A flow sums every bucket inside its bar,
|
|
377
|
+
* so its plan reads the window's bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME
|
|
378
|
+
* session bar of a day or longer is asked over its Globex session, never from a UTC day bucket; a snapshot keeps its
|
|
379
|
+
* stamps. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its rows as they come. `ask` is the
|
|
380
|
+
* caller's fetch (the full run's, a reconcile's).
|
|
346
381
|
*/
|
|
347
|
-
export declare function fetchWrunPollLaneHostGridRows(lane: Pick<WrunPollLane, 'barGrid'>, extras: Readonly<Record<string, unknown>>, window: WrunHostGridWindow, fallback: {
|
|
382
|
+
export declare function fetchWrunPollLaneHostGridRows(lane: Pick<WrunPollLane, 'barGrid' | 'horizon'>, extras: Readonly<Record<string, unknown>>, window: WrunHostGridWindow, fallback: {
|
|
348
383
|
fromTs: number;
|
|
349
384
|
toTs: number;
|
|
350
385
|
}, ask: (extras: Readonly<Record<string, unknown>>, fromTs: number, toTs: number) => Promise<ArrayLike<number>[]>): Promise<ArrayLike<number>[]>;
|
|
@@ -4,7 +4,7 @@ import { refuseWrunPollInput, WRUN_POLL_LANE_ID_PREFIX, } from './wrun-poll-lane
|
|
|
4
4
|
import { wrunLaneChainPlaneOf } from './wrun-row-lane.types.js';
|
|
5
5
|
import { WRUN_DAILY_LANE_INTERVAL_KEY, wrunDailyLaneFetchFrom, wrunDailyLaneFetchTo, wrunDailyLaneReconcileFrom, wrunDailyLaneReconcileTo, } from '../wrun-daily-lane.util.js';
|
|
6
6
|
import { assertWrunOpraLaneReadable, wrunOpraLanePayloadFields } from '../wrun-opra-lane.util.js';
|
|
7
|
-
import { wrunHostGridAsks, wrunHostGridFetchTo, wrunLandScalarRowsOnHostBars } from '../wrun-tier-grid.util.js';
|
|
7
|
+
import { wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFetchTo, wrunLandScalarRowsOnHostBars, } from '../wrun-tier-grid.util.js';
|
|
8
8
|
/**
|
|
9
9
|
* The static plan: every input whose class the registry serves, in declaration order, with the
|
|
10
10
|
* lane serving its field and the field's column. Refused by name: a celled input (poll lanes
|
|
@@ -151,14 +151,37 @@ export function wrunUnservedLaneInput(missing, input, fills, why, cryptoVenue) {
|
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* Whether a lane's refusal says the chart has no option chain: its record's seed is `no-options` / `chain` (the chain
|
|
154
|
-
* decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`,
|
|
155
|
-
*
|
|
154
|
+
* decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, every options lane's since each reads the
|
|
155
|
+
* one chain resolver), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
|
|
156
156
|
* options) does not serve the feed: both planners hand the refusal to `wrunUnservedLaneInput`, so a declared fill reads.
|
|
157
157
|
*/
|
|
158
158
|
export function wrunLaneNoChainRefusal(error) {
|
|
159
159
|
const seed = wrunRefusalSeedOf(error);
|
|
160
160
|
return error instanceof Error && seed?.cls === 'no-options' && seed.variant === 'chain';
|
|
161
161
|
}
|
|
162
|
+
/** The seeds `wrunLaneUnservedScopeSeed` made: the one evidence `wrunLaneUnservedScopeRefusal` reads. */
|
|
163
|
+
const WRUN_LANE_UNSERVED_SCOPE_SEEDS = new WeakSet();
|
|
164
|
+
/**
|
|
165
|
+
* The seed of a lane's refusal that the chart's options plane serves no such scope (OPTIONS-PORT P7, R7c C7-2:
|
|
166
|
+
* `options_flow`'s US issue types off the OPRA plane, its `venue` on CME, a venue word of another plane): the
|
|
167
|
+
* feed-missing record under the lane's feed ("this market has no such feed"). Made here, so the planner tells it from
|
|
168
|
+
* every other feed-missing refusal by the seed itself (`wrunLaneUnservedScopeRefusal`), never the words.
|
|
169
|
+
*/
|
|
170
|
+
export function wrunLaneUnservedScopeSeed(feed) {
|
|
171
|
+
const seed = Object.freeze({ cls: 'feed-missing', variant: 'market-paused', params: { feed } });
|
|
172
|
+
WRUN_LANE_UNSERVED_SCOPE_SEEDS.add(seed);
|
|
173
|
+
return seed;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Whether a lane's refusal says the chart's options plane serves no such scope: its seed is one
|
|
177
|
+
* `wrunLaneUnservedScopeSeed` made. Such a chart does not serve the input, as a chart with no option chain does not:
|
|
178
|
+
* the planner hands the refusal to `wrunUnservedLaneInput` as the lane's own (`noChain`), so a declared fill drops the
|
|
179
|
+
* input with the market's note and any other input refuses with the lane's own words and seed.
|
|
180
|
+
*/
|
|
181
|
+
export function wrunLaneUnservedScopeRefusal(error) {
|
|
182
|
+
const seed = wrunRefusalSeedOf(error);
|
|
183
|
+
return error instanceof Error && seed !== undefined && WRUN_LANE_UNSERVED_SCOPE_SEEDS.has(seed);
|
|
184
|
+
}
|
|
162
185
|
/**
|
|
163
186
|
* A chain lane's input before its chain is resolved, both planners' one rule: where the chart's options list on OPRA
|
|
164
187
|
* (riding the plane, or kept off it by a known stop) the OPRA wall first (`opra-official-only:<class>`), every chain it
|
|
@@ -315,8 +338,9 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
|
|
|
315
338
|
answered = await planned.lane.plan(planned.source, ctx);
|
|
316
339
|
}
|
|
317
340
|
catch (error) {
|
|
318
|
-
// A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`)
|
|
319
|
-
|
|
341
|
+
// A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`), nor one whose options plane
|
|
342
|
+
// serves no such scope (`wrunLaneUnservedScopeRefusal`): the same one rule.
|
|
343
|
+
if (!wrunLaneNoChainRefusal(error) && !wrunLaneUnservedScopeRefusal(error))
|
|
320
344
|
throw error;
|
|
321
345
|
wrunUnservedLaneInput(missing, unserved, WRUN_POLL_LANE_UNSERVED_FILLS, { noChain: error }, cryptoVenue);
|
|
322
346
|
continue;
|
|
@@ -539,24 +563,66 @@ export function wrunPollLaneReconcileFrom(lane, fromTs, sessionFirstRowTs) {
|
|
|
539
563
|
/** The payload field a host-grid lane's ask names its backend tier in (`WrunPollLaneBarGrid.tiers`, a tier's
|
|
540
564
|
* `key`): the K control asks that tier. */
|
|
541
565
|
export const WRUN_POLL_LANE_TIER_FIELD = 'tier';
|
|
566
|
+
function finiteMsOrUndefined(value) {
|
|
567
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that opens
|
|
571
|
+
* before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after `servedFromMs`
|
|
572
|
+
* (an ask wholly before it is dropped). A bar opens and ends where its span does (wrun-tier-grid.util
|
|
573
|
+
* `wrunHostBarSpanOf`: its Globex session under a CME session grid). No horizon: the plan as the tier rule made it.
|
|
574
|
+
* The one cut a row lane
|
|
575
|
+
* (sources/wrun-row-lanes.util `wrunRowLaneAsksWithinHorizon`) and a host-grid poll lane (`horizon`) take.
|
|
576
|
+
*/
|
|
577
|
+
export function wrunHostGridAsksWithinHorizon(plan, window, horizon, sessionGrid) {
|
|
578
|
+
if (horizon === undefined)
|
|
579
|
+
return plan;
|
|
580
|
+
const servedFrom = finiteMsOrUndefined(horizon.servedFromMs);
|
|
581
|
+
const completeFrom = finiteMsOrUndefined(horizon.completeFromMs) ?? servedFrom;
|
|
582
|
+
const spanOf = (open) => wrunHostBarSpanOf(open, window.intervalMs, sessionGrid);
|
|
583
|
+
const partial = new Set(plan.partialBars);
|
|
584
|
+
if (completeFrom !== undefined) {
|
|
585
|
+
for (const open of window.barOpens)
|
|
586
|
+
if (spanOf(open).fromMs < completeFrom)
|
|
587
|
+
partial.add(open);
|
|
588
|
+
}
|
|
589
|
+
let asks = plan.asks;
|
|
590
|
+
if (servedFrom !== undefined) {
|
|
591
|
+
const firstServed = window.barOpens.find((open) => spanOf(open).toMs > servedFrom);
|
|
592
|
+
asks =
|
|
593
|
+
firstServed === undefined
|
|
594
|
+
? []
|
|
595
|
+
: plan.asks.flatMap((gridAsk) => {
|
|
596
|
+
const fromMs = Math.max(gridAsk.fromMs, spanOf(firstServed).fromMs);
|
|
597
|
+
return fromMs < gridAsk.toMs ? [{ ...gridAsk, fromMs }] : [];
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
return { asks, partialBars: [...partial].sort((a, b) => a - b) };
|
|
601
|
+
}
|
|
542
602
|
/**
|
|
543
603
|
* A lane's rows over a chart window, landed on the host bars when it is a host-grid lane (`barGrid`): its asks
|
|
544
604
|
* under the tier rule (`wrunHostGridAsks` over the window's host bars: one per run of bars on a tier, the
|
|
545
|
-
* tier's key in its extras as `tier`),
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
605
|
+
* tier's key in its extras as `tier`), cut to the lane's `horizon` for the acquisition (`wrunHostGridAsksWithinHorizon`:
|
|
606
|
+
* the bars its source no longer holds ask nothing and read the input's `missing` policy), each answer landed by the
|
|
607
|
+
* lane's landing (`wrunLandScalarRowsOnHostBars`: a flow summed per bar, a snapshot's newest sealed row, sealed by its
|
|
608
|
+
* ask's tier), ascending. A bar no tier retains asks nothing and reads no row. A flow sums every bucket inside its bar,
|
|
609
|
+
* so its plan reads the window's bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME
|
|
610
|
+
* session bar of a day or longer is asked over its Globex session, never from a UTC day bucket; a snapshot keeps its
|
|
611
|
+
* stamps. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its rows as they come. `ask` is the
|
|
612
|
+
* caller's fetch (the full run's, a reconcile's).
|
|
549
613
|
*/
|
|
550
614
|
export async function fetchWrunPollLaneHostGridRows(lane, extras, window, fallback, ask) {
|
|
551
615
|
const grid = lane.barGrid;
|
|
552
616
|
if (grid === undefined)
|
|
553
617
|
return ask(extras, fallback.fromTs, fallback.toTs);
|
|
554
|
-
const
|
|
618
|
+
const sessionGrid = grid.landing === 'flow' ? window.barGrid : undefined;
|
|
619
|
+
const { asks } = wrunHostGridAsksWithinHorizon(wrunHostGridAsks({
|
|
555
620
|
tiers: grid.tiers,
|
|
556
621
|
barOpens: window.barOpens,
|
|
557
622
|
intervalMs: window.intervalMs,
|
|
558
623
|
nowMs: window.nowMs,
|
|
559
|
-
|
|
624
|
+
...(sessionGrid !== undefined ? { sessionGrid } : {}),
|
|
625
|
+
}), window, lane.horizon?.(extras, window.nowMs), sessionGrid);
|
|
560
626
|
const answers = await Promise.all(asks.map(async (gridAsk) => {
|
|
561
627
|
const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_POLL_LANE_TIER_FIELD]: gridAsk.tier.key };
|
|
562
628
|
const rows = await ask(askExtras, gridAsk.fromMs, gridAsk.toMs);
|