@orangecharts/wrun-chart-host 0.6.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 +13 -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/indicator-fields.js +10 -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
|
@@ -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;
|
|
@@ -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`
|
|
@@ -29,18 +49,20 @@
|
|
|
29
49
|
* degrades the lane once, its chip the record below (wrun-lane-refusal.leaf), never a blank or a retry loop.
|
|
30
50
|
*/
|
|
31
51
|
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, } from '../wrun-poll-lane.types.js';
|
|
32
|
-
import {
|
|
52
|
+
import { decideWrunLaneChain, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneOpraPlaneChain, } from '../opra-option-lanes.util.js';
|
|
53
|
+
import { wrunOptionsChainFlagOffRefusal, wrunOptionsChainGatedVenueName } from '../../wrun-options-chain.util.js';
|
|
54
|
+
import { WRUN_OPTION_PRINT_AGG_SCOPE_KTYPE, WRUN_OPTION_SCOPE_READS_OFF_CODE, WRUN_OPTIONS_FLOW_BOOK_FIELD, WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD, WRUN_OPTIONS_FLOW_DTE, WRUN_OPTIONS_FLOW_EXCHANGE_FIELD, WRUN_OPTIONS_FLOW_FIELDS, WRUN_OPTIONS_FLOW_MONEYNESS, WRUN_OPTIONS_FLOW_OPRA_SCOPES, WRUN_OPTIONS_FLOW_SCOPES, WRUN_OPTIONS_FLOW_TIER_MS, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_VENUE_FIELDS, WRUN_OPTIONS_FLOW_VENUE_RE, WRUN_OPTIONS_FLOW_VENUES_FIELD, } from '../../wrun-opra-flow.leaf.js';
|
|
33
55
|
import { assertWrunProtocolType, wrunProtocolPendingSeed } from '../../wrun-protocol-pending.util.js';
|
|
34
56
|
/** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionsFlow`). */
|
|
35
57
|
export const WRUN_OPTIONS_FLOW_LANE_KEY = 'options_flow';
|
|
36
|
-
const MINUTE = 60_000;
|
|
37
58
|
const DAY = 86_400_000;
|
|
38
|
-
/** The tiers a bar is read from (rule 9, ADDENDUM-2 B3
|
|
39
|
-
* gateway rolls up from its 1m rows, which a bar older than 7 days no
|
|
59
|
+
/** 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
|
|
60
|
+
* 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
|
|
61
|
+
* longer has: that bar reads its fill). */
|
|
40
62
|
export const WRUN_OPTIONS_FLOW_TIERS = Object.freeze([
|
|
41
|
-
{ key: '1m', ms:
|
|
42
|
-
{ key: '5m', ms:
|
|
43
|
-
{ key: '1d', ms:
|
|
63
|
+
{ key: '1m', ms: WRUN_OPTIONS_FLOW_TIER_MS['1m'], retentionMs: 7 * DAY },
|
|
64
|
+
{ key: '5m', ms: WRUN_OPTIONS_FLOW_TIER_MS['5m'], retentionMs: 30 * DAY },
|
|
65
|
+
{ key: '1d', ms: WRUN_OPTIONS_FLOW_TIER_MS['1d'] },
|
|
44
66
|
]);
|
|
45
67
|
/**
|
|
46
68
|
* The Databento publisher id the data plane names each `venue` word by (the VENUE rows' `venue`, the request's
|
|
@@ -81,62 +103,176 @@ function knobWord(source, ctx, knob, words) {
|
|
|
81
103
|
return refuseWrunPollInput(ctx, `declares ${knob} '${String(declared)}': ${knob} is one of ${words.map((word) => `"${word}"`).join(', ')} ` +
|
|
82
104
|
`("${words[0]}" when absent)`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
83
105
|
}
|
|
84
|
-
/**
|
|
106
|
+
/** Scope `venue`'s rules on any plane, before the chain is resolved: the venue required and spelled as an exchange id,
|
|
107
|
+
* and the fields its rows serve with no side, DTE or moneyness split; answers the venue word. */
|
|
108
|
+
function venueScopeWord(source, ctx, dte, moneyness) {
|
|
109
|
+
const venue = source.venue;
|
|
110
|
+
if (venue === undefined) {
|
|
111
|
+
return refuseWrunPollInput(ctx, 'declares scope "venue" with no venue: name the exchange whose prints it reads (options-flow-venue-required)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
112
|
+
}
|
|
113
|
+
if (typeof venue !== 'string' || !WRUN_OPTIONS_FLOW_VENUE_RE.test(venue)) {
|
|
114
|
+
return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': a venue is an exchange id, 2 to 16 upper-case letters, digits or underscores`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
115
|
+
}
|
|
116
|
+
const field = String(source.field ?? '');
|
|
117
|
+
const served = WRUN_OPTIONS_FLOW_VENUE_FIELDS;
|
|
118
|
+
const split = !served.includes(field)
|
|
119
|
+
? `field '${field}'`
|
|
120
|
+
: dte !== 'all'
|
|
121
|
+
? `dte "${dte}"`
|
|
122
|
+
: moneyness !== 'all'
|
|
123
|
+
? `moneyness "${moneyness}"`
|
|
124
|
+
: undefined;
|
|
125
|
+
if (split !== undefined) {
|
|
126
|
+
return refuseWrunPollInput(ctx, `reads ${split} under scope "venue": the venue rows serve ${served.join(', ')}, with no side, DTE or ` +
|
|
127
|
+
'moneyness split (options-flow-venue-field)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
128
|
+
}
|
|
129
|
+
return venue;
|
|
130
|
+
}
|
|
131
|
+
/** The chart each run's plan resolved for the flow lane, by the plan's scope (`WrunPollLaneContext.runScope`): every
|
|
132
|
+
* input of one run reads one resolution (one chain, one `auto` book), and the next run resolves afresh. */
|
|
133
|
+
const flowCharts = new WeakMap();
|
|
134
|
+
/** The chart the lane decides its chain over: on the OPRA plane the plane's own chain by coin (no chain directory
|
|
135
|
+
* read: `wrunLaneOpraPlaneChain`), off it the chart's chain as the one resolver resolves it. */
|
|
136
|
+
function flowChartOf(ctx) {
|
|
137
|
+
const resolve = () => resolveWrunLaneChainChart(ctx, ctx.opraPlane === true ? wrunLaneOpraPlaneChain(ctx.coin) : undefined);
|
|
138
|
+
const scope = ctx.runScope;
|
|
139
|
+
if (scope === undefined)
|
|
140
|
+
return resolve();
|
|
141
|
+
let chart = flowCharts.get(scope);
|
|
142
|
+
if (chart === undefined) {
|
|
143
|
+
chart = resolve();
|
|
144
|
+
flowCharts.set(scope, chart);
|
|
145
|
+
}
|
|
146
|
+
return chart;
|
|
147
|
+
}
|
|
148
|
+
/** The crypto options venues of the venue table (its `plain` rows' exchanges, in its order): config, never a venue of
|
|
149
|
+
* this lane's own. Read lazily: the table rides the chain resolver's lazy graph. */
|
|
150
|
+
async function cryptoVenuesOfTable() {
|
|
151
|
+
const { OPTION_VENUES } = await import('../../../../constants/option-venues.constants.js');
|
|
152
|
+
return OPTION_VENUES.filter((venue) => venue.lane === 'plain').flatMap((venue) => {
|
|
153
|
+
const gatedName = wrunOptionsChainGatedVenueName(venue.id);
|
|
154
|
+
return venue.exchanges.map((exchange) => (gatedName === undefined ? { exchange } : { exchange, gatedName }));
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/** The exchanges of the crypto venues open to the chart: every one with the crypto-options gate on (a signed-in
|
|
158
|
+
* session), only those the gate never darkens (Deribit) with it off (a guest), as every other chain class reads it. */
|
|
159
|
+
function openCryptoVenueExchanges(venues, gateOn) {
|
|
160
|
+
return venues.filter((venue) => gateOn || venue.gatedName === undefined).map((venue) => venue.exchange);
|
|
161
|
+
}
|
|
162
|
+
/** Refuse an input whose scope the chart's options plane does not serve, with the planner's unserved-scope seed (a
|
|
163
|
+
* declared fill drops it with the market's note, `wrunLaneUnservedScopeRefusal`). The planner module is read lazily:
|
|
164
|
+
* it loads the registry, which loads this file. */
|
|
165
|
+
async function refuseUnservedScope(ctx, words) {
|
|
166
|
+
const { wrunLaneUnservedScopeSeed } = await import('../wrun-poll-lanes.util.js');
|
|
167
|
+
return refuseWrunPollInput(ctx, words, wrunLaneUnservedScopeSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
|
|
168
|
+
}
|
|
169
|
+
/** Refuse a venue word no plane's table holds: the data plane names a venue by the table's id, never a guess. */
|
|
170
|
+
function refuseUnmappedVenue(ctx, venue) {
|
|
171
|
+
return refuseWrunPollInput(ctx, `declares venue '${venue}': the data plane names a venue by its publisher id or its exchange, and this version of ` +
|
|
172
|
+
`the app holds none for ${venue} (options-flow-venue-unmapped:${venue})`, wrunProtocolPendingSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* What one input reads on the chain its run decided (the acquisition's fields beside `scope`, `dte` and `moneyness`),
|
|
176
|
+
* the scope table per plane (R7c C7-2): always the chain's exchange (`flowExchange`, the lane's chain mark); a read of
|
|
177
|
+
* one underlying its coin; a crypto ticker its ONE book (`flowBook`), a CME ticker off a continuous alias the alias
|
|
178
|
+
* (`flowContinuous`); a crypto scope across venues its venues (`flowVenues`), the ones the crypto-options gate leaves
|
|
179
|
+
* open to the chart (`gateOn`, the run's resolved chart's: every crypto venue for a signed-in session, Deribit alone for
|
|
180
|
+
* a guest, as every other chain class reads them), a gated `venue` word refused as the chain decision refuses one
|
|
181
|
+
* (`flag-off`); an OPRA venue its publisher id. A scope the plane does not serve refuses with the unserved-scope seed.
|
|
182
|
+
*/
|
|
183
|
+
async function flowReadOf(scope, venue, chain, gateOn, ctx) {
|
|
184
|
+
const exchange = { [WRUN_OPTIONS_FLOW_EXCHANGE_FIELD]: chain.exchange };
|
|
185
|
+
const coin = chain.underlying.toUpperCase();
|
|
186
|
+
const lists = `this chart's options list on ${chain.exchange}`;
|
|
187
|
+
if (scope === 'ticker') {
|
|
188
|
+
if (chain.plane === 'plain')
|
|
189
|
+
return { coin, ...exchange, [WRUN_OPTIONS_FLOW_BOOK_FIELD]: chain.book.toUpperCase() };
|
|
190
|
+
const continuous = chain.continuous !== undefined ? { [WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD]: chain.continuous } : {};
|
|
191
|
+
return { coin, ...exchange, ...continuous };
|
|
192
|
+
}
|
|
193
|
+
if (chain.plane !== 'opra' && WRUN_OPTIONS_FLOW_OPRA_SCOPES.includes(scope)) {
|
|
194
|
+
return refuseUnservedScope(ctx, `reads scope "${scope}", which only US listed options serve: ${lists}`);
|
|
195
|
+
}
|
|
196
|
+
if (scope !== 'venue') {
|
|
197
|
+
if (chain.plane !== 'plain')
|
|
198
|
+
return exchange;
|
|
199
|
+
const open = openCryptoVenueExchanges(await cryptoVenuesOfTable(), gateOn);
|
|
200
|
+
return { coin, ...exchange, [WRUN_OPTIONS_FLOW_VENUES_FIELD]: open };
|
|
201
|
+
}
|
|
202
|
+
const word = venue;
|
|
203
|
+
if (chain.plane === 'cme') {
|
|
204
|
+
return refuseUnservedScope(ctx, `reads scope "venue": ${lists}, which lists every option of the chain on that one venue (no venue to split by)`);
|
|
205
|
+
}
|
|
206
|
+
const publisherId = wrunOptionsFlowVenuePublisherId(word);
|
|
207
|
+
if (chain.plane === 'opra' && publisherId !== undefined)
|
|
208
|
+
return { venueId: publisherId, ...exchange };
|
|
209
|
+
const cryptoVenues = await cryptoVenuesOfTable();
|
|
210
|
+
const listed = cryptoVenues.find((candidate) => candidate.exchange === word);
|
|
211
|
+
if (chain.plane === 'opra') {
|
|
212
|
+
if (listed !== undefined) {
|
|
213
|
+
return refuseUnservedScope(ctx, `declares venue '${word}', a crypto options venue: ${lists}, whose venues are US exchanges (an ISO MIC)`);
|
|
214
|
+
}
|
|
215
|
+
return refuseUnmappedVenue(ctx, word);
|
|
216
|
+
}
|
|
217
|
+
const open = openCryptoVenueExchanges(cryptoVenues, gateOn);
|
|
218
|
+
if (listed !== undefined) {
|
|
219
|
+
if (listed.gatedName !== undefined && !gateOn) {
|
|
220
|
+
throw wrunLaneChainRefusalError(wrunOptionsChainFlagOffRefusal({
|
|
221
|
+
who: `Input '${ctx.inputName}' reads ${ctx.sourceClass} cells`,
|
|
222
|
+
venue: word,
|
|
223
|
+
name: listed.gatedName,
|
|
224
|
+
coin: chain.coin.toUpperCase(),
|
|
225
|
+
wayOut: `declare venue ${open.map((name) => `"${name}"`).join(' or ')} (the crypto options venues open to this chart), or scope "market"`,
|
|
226
|
+
}), ctx.sourceClass);
|
|
227
|
+
}
|
|
228
|
+
return { coin, ...exchange, [WRUN_OPTIONS_FLOW_VENUES_FIELD]: [word] };
|
|
229
|
+
}
|
|
230
|
+
if (publisherId !== undefined) {
|
|
231
|
+
return refuseUnservedScope(ctx, `declares venue '${word}', a US options exchange: ${lists}, whose venues are the crypto options venues ` +
|
|
232
|
+
`(${open.join(', ')})`);
|
|
233
|
+
}
|
|
234
|
+
return refuseUnmappedVenue(ctx, word);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* One input against the chart: its knobs (the plane-free rules first, `book` beside scope `ticker` only), a ticker read
|
|
238
|
+
* on a chart that names no underlying refused by name, the protocol gate, then the chain (the run's one resolution of
|
|
239
|
+
* the chart, `flowChartOf`: on the OPRA plane its own by coin) decided by the one chain resolver (`auto`, the input's
|
|
240
|
+
* `book` on a ticker read; its refusals are the options chain's own), and the read the scope names on that chain's
|
|
241
|
+
* plane (`flowReadOf`); the answer is the acquisition's knobs.
|
|
242
|
+
*/
|
|
85
243
|
async function planWrunOptionsFlow(source, ctx) {
|
|
86
244
|
const scope = knobWord(source, ctx, 'scope', WRUN_OPTIONS_FLOW_SCOPES);
|
|
87
245
|
const dte = knobWord(source, ctx, 'dte', WRUN_OPTIONS_FLOW_DTE);
|
|
88
246
|
const moneyness = knobWord(source, ctx, 'moneyness', WRUN_OPTIONS_FLOW_MONEYNESS);
|
|
89
|
-
let
|
|
247
|
+
let venue;
|
|
90
248
|
if (scope === 'venue') {
|
|
91
|
-
|
|
92
|
-
if (venue === undefined) {
|
|
93
|
-
return refuseWrunPollInput(ctx, 'declares scope "venue" with no venue: name the exchange whose prints it reads (options-flow-venue-required)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
94
|
-
}
|
|
95
|
-
if (typeof venue !== 'string' || !WRUN_OPTIONS_FLOW_VENUE_RE.test(venue)) {
|
|
96
|
-
return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': a venue is an exchange id, 2 to 16 upper-case letters, digits or underscores`, WRUN_POLL_AUTHOR_GATE_SEED);
|
|
97
|
-
}
|
|
98
|
-
const field = String(source.field ?? '');
|
|
99
|
-
const served = WRUN_OPTIONS_FLOW_VENUE_FIELDS;
|
|
100
|
-
const split = !served.includes(field)
|
|
101
|
-
? `field '${field}'`
|
|
102
|
-
: dte !== 'all'
|
|
103
|
-
? `dte "${dte}"`
|
|
104
|
-
: moneyness !== 'all'
|
|
105
|
-
? `moneyness "${moneyness}"`
|
|
106
|
-
: undefined;
|
|
107
|
-
if (split !== undefined) {
|
|
108
|
-
return refuseWrunPollInput(ctx, `reads ${split} under scope "venue": the venue rows serve ${served.join(', ')}, with no side, DTE or ` +
|
|
109
|
-
'moneyness split (options-flow-venue-field)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
110
|
-
}
|
|
111
|
-
const venueId = wrunOptionsFlowVenuePublisherId(venue);
|
|
112
|
-
if (venueId === undefined) {
|
|
113
|
-
return refuseWrunPollInput(ctx, `declares venue '${venue}': the data plane names a venue by its publisher id, and this version of the app ` +
|
|
114
|
-
`holds none for ${venue} (options-flow-venue-unmapped:${venue})`, wrunProtocolPendingSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
|
|
115
|
-
}
|
|
116
|
-
extras = { scope, venueId, dte, moneyness };
|
|
249
|
+
venue = venueScopeWord(source, ctx, dte, moneyness);
|
|
117
250
|
}
|
|
118
|
-
else {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
extras = { scope, coin, dte, moneyness };
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
extras = { scope, dte, moneyness };
|
|
136
|
-
}
|
|
251
|
+
else if (source.venue !== undefined) {
|
|
252
|
+
return refuseWrunPollInput(ctx, `declares venue '${String(source.venue)}' beside scope "${scope}": a venue names the exchange of scope ` +
|
|
253
|
+
'"venue" only (options-flow-venue-scope)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
254
|
+
}
|
|
255
|
+
if (scope !== 'ticker' && source.book !== undefined) {
|
|
256
|
+
return refuseWrunPollInput(ctx, `declares book '${String(source.book)}' beside scope "${scope}": a book names the one series of scope ` +
|
|
257
|
+
'"ticker" only, every other scope reads every book (options-flow-book-scope)', WRUN_POLL_AUTHOR_GATE_SEED);
|
|
258
|
+
}
|
|
259
|
+
if (scope === 'ticker' && ctx.coin.trim() === '') {
|
|
260
|
+
return refuseWrunPollInput(ctx, "reads the options flow of the chart's underlying, and this chart names none", {
|
|
261
|
+
cls: 'feed-missing',
|
|
262
|
+
variant: 'market-paused',
|
|
263
|
+
params: { feed: WRUN_OPTIONS_FLOW_LANE_KEY },
|
|
264
|
+
});
|
|
137
265
|
}
|
|
138
266
|
await assertWrunProtocolType(ctx, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_LANE_KEY);
|
|
139
|
-
|
|
267
|
+
const chart = await flowChartOf(ctx);
|
|
268
|
+
const chain = await decideWrunLaneChain(chart, { book: scope === 'ticker' ? source.book : undefined }, ctx);
|
|
269
|
+
return { scope, ...(await flowReadOf(scope, venue, chain, chart.cryptoVenues.enabled, ctx)), dte, moneyness };
|
|
270
|
+
}
|
|
271
|
+
/** Whether an acquisition no longer names the chain the lane would plan now (D12): a CME ticker read off a continuous
|
|
272
|
+
* alias whose lead future rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
|
|
273
|
+
* rebuilds, so no ask, cache or buffer joins the old future's flow to the new one's. */
|
|
274
|
+
export function wrunOptionsFlowAcquisitionMoved(acquisition) {
|
|
275
|
+
return wrunLaneChainLeadMoved(acquisition[WRUN_OPTIONS_FLOW_EXCHANGE_FIELD], acquisition[WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD], acquisition.coin);
|
|
140
276
|
}
|
|
141
277
|
export const lane = {
|
|
142
278
|
sourceClass: 'options_flow',
|
|
@@ -148,7 +284,8 @@ export const lane = {
|
|
|
148
284
|
label: 'Options flow',
|
|
149
285
|
nativeRows: true,
|
|
150
286
|
barGrid: { landing: 'flow', tiers: WRUN_OPTIONS_FLOW_TIERS },
|
|
151
|
-
|
|
287
|
+
chain: { exchangeField: WRUN_OPTIONS_FLOW_EXCHANGE_FIELD },
|
|
288
|
+
acquisitionMoved: wrunOptionsFlowAcquisitionMoved,
|
|
152
289
|
refusedAnswers: {
|
|
153
290
|
[WRUN_OPTION_SCOPE_READS_OFF_CODE]: { cls: 'service-no-answer', variant: 'switched-off' },
|
|
154
291
|
},
|
|
@@ -32,12 +32,11 @@
|
|
|
32
32
|
* Units are the gateway's: USD for the valuations, volume and price, coins for the supplies,
|
|
33
33
|
* percent for the dominance, a plain rank; documented, never converted.
|
|
34
34
|
*
|
|
35
|
-
* The kit table is
|
|
36
|
-
* the
|
|
37
|
-
*
|
|
38
|
-
* resolves at once (the `assertWrunBrowserSources` pattern).
|
|
35
|
+
* The kit table is its import-free copy (`WRUN_KIT_TOKEN_NAMES`, wrun-kit-run-tables.util, pinned
|
|
36
|
+
* to the kit's export by its kit-mirror spec): a plan never loads the 3.6 MB kit bundle on the
|
|
37
|
+
* main thread to read 62 names (OPTLOAD g1 round 3).
|
|
39
38
|
*/
|
|
40
|
-
import {
|
|
39
|
+
import { WRUN_KIT_TOKEN_NAMES } from '../../wrun-kit-run-tables.util.js';
|
|
41
40
|
import { refuseWrunPollInput, } from '../wrun-poll-lane.types.js';
|
|
42
41
|
export const WRUN_TOKEN_SUPPLY_SOURCE_CLASS = 'token_supply';
|
|
43
42
|
/** The fields in the kit's declaration order, each at its lane row column (column 0 is the
|
|
@@ -64,12 +63,6 @@ export const WRUN_TOKEN_SUPPLY_LOOKBACK_DAYS = 90;
|
|
|
64
63
|
* fill in for any it does not. */
|
|
65
64
|
const EXAMPLE_TOKEN_NAMES = ['Bitcoin', 'Ethereum', 'Solana'];
|
|
66
65
|
const EXAMPLE_COUNT = 3;
|
|
67
|
-
function isWrunTokenNamesTable(value) {
|
|
68
|
-
if (value === null || typeof value !== 'object')
|
|
69
|
-
return false;
|
|
70
|
-
const entries = Object.entries(value);
|
|
71
|
-
return entries.length > 0 && entries.every(([coin, name]) => coin !== '' && typeof name === 'string' && name !== '');
|
|
72
|
-
}
|
|
73
66
|
/** A few display names of the table, for a refusal: the well-known ones it lists first. */
|
|
74
67
|
export function wrunTokenSupplyExampleNames(table) {
|
|
75
68
|
const names = Object.values(table);
|
|
@@ -107,29 +100,10 @@ export function wrunTokenSupplyCoinOf(source, ctx, table) {
|
|
|
107
100
|
const count = Object.keys(table).length;
|
|
108
101
|
return refuseWrunPollInput(ctx, `declares token '${token}': the chart serves the ${count} tokens its table lists, by display name (${examples})`);
|
|
109
102
|
}
|
|
110
|
-
let tokenNamesLoad;
|
|
111
|
-
/** The kit's table, loaded once through the kit seam; undefined when the vendored kit exports
|
|
112
|
-
* none (a re-vendor that dropped it). A failed load is retried on the next plan. */
|
|
113
|
-
function loadWrunTokenNames() {
|
|
114
|
-
tokenNamesLoad ??= wrunChartHostEnv()
|
|
115
|
-
.transport.loadWrunKit()
|
|
116
|
-
.then(({ wrunIndicatorKit }) => {
|
|
117
|
-
const table = wrunIndicatorKit.WRUN_TOKEN_NAMES;
|
|
118
|
-
return isWrunTokenNamesTable(table) ? table : undefined;
|
|
119
|
-
}, (error) => {
|
|
120
|
-
tokenNamesLoad = undefined;
|
|
121
|
-
throw error;
|
|
122
|
-
});
|
|
123
|
-
return tokenNamesLoad;
|
|
124
|
-
}
|
|
125
103
|
/** One input against the kit's table, before any fetch: the control's ask `{ coin, tokenName }`
|
|
126
104
|
* or a refusal by name. */
|
|
127
105
|
async function planWrunTokenSupply(source, ctx) {
|
|
128
|
-
|
|
129
|
-
if (table === undefined) {
|
|
130
|
-
return refuseWrunPollInput(ctx, 'cannot be planned: the vendored indicator kit exports no WRUN_TOKEN_NAMES table');
|
|
131
|
-
}
|
|
132
|
-
return wrunTokenSupplyCoinOf({ token: source.token }, ctx, table);
|
|
106
|
+
return wrunTokenSupplyCoinOf({ token: source.token }, ctx, WRUN_KIT_TOKEN_NAMES);
|
|
133
107
|
}
|
|
134
108
|
export const lane = {
|
|
135
109
|
sourceClass: WRUN_TOKEN_SUPPLY_SOURCE_CLASS,
|
|
@@ -42,24 +42,6 @@ export interface WrunChainChartMetadata {
|
|
|
42
42
|
export declare function resolveWrunChartChain(metadata: WrunChainChartMetadata | undefined): Promise<WrunLaneChartChain>;
|
|
43
43
|
/** Resolve the chart's chain for a lane: `resolveWrunChartChain` over the lane context's market and category. */
|
|
44
44
|
export declare function resolveWrunLaneChartChain(ctx: Pick<WrunPollLaneContext, 'exchange' | 'symbol' | 'coin' | 'category'>): Promise<WrunLaneChartChain>;
|
|
45
|
-
/**
|
|
46
|
-
* The OPRA chain an OPRA-only lane reads on this chart (`option_contract_state`: admitted only where the chart's
|
|
47
|
-
* options ride the OPRA plane): its exchange and underlying, or a refusal by name with the options chain's own seeds
|
|
48
|
-
* (the directory did not answer: a service that did not answer; no chain: no options here). A wrapper over the chart's
|
|
49
|
-
* chain resolution, its words unchanged, for the OPRA-only lanes that still import it.
|
|
50
|
-
*/
|
|
51
|
-
export declare function resolveWrunLaneOpraChain(ctx: LaneCtx): Promise<{
|
|
52
|
-
exchange: string;
|
|
53
|
-
underlying: string;
|
|
54
|
-
}>;
|
|
55
|
-
/**
|
|
56
|
-
* The underlying the OPRA plane keys an OPRA-only lane's series by (`option_prints`, `option_contract_flow`: a US
|
|
57
|
-
* stock or ETF chart's ticker, an OPRA contract chart's underlying, upper case), or a refusal by name before any
|
|
58
|
-
* fetch: any failure of the chart's chain resolution is the US directory that did not answer (`service-no-answer` /
|
|
59
|
-
* `opra-directory`, Retry), and a chart OPRA lists no options for is `no-options` / `chain`. A wrapper over the
|
|
60
|
-
* chart's chain resolution, its words unchanged (wrun-opra-underlying.util re-exports it for its importers).
|
|
61
|
-
*/
|
|
62
|
-
export declare function resolveWrunOpraLaneUnderlying(ctx: LaneCtx): Promise<string>;
|
|
63
45
|
/** The crypto venue words a chain decision reads on this chart: on the OPRA plane no crypto venue lists a US
|
|
64
46
|
* stock's options (the words refuse by the flag alone, no listing asked); anywhere else the run's own resolver
|
|
65
47
|
* over every crypto word (the listing is asked once per coin, and only with the crypto-options gate on). */
|
|
@@ -136,6 +118,9 @@ export interface WrunLaneChainChart {
|
|
|
136
118
|
* run whose directory read answers.
|
|
137
119
|
*/
|
|
138
120
|
export declare function resolveWrunLaneChainAutoBook(chain: WrunLaneChainOfBook): Promise<string>;
|
|
121
|
+
/** The code of an options row lane that holds no resolved chart market for its chain (its identity step's
|
|
122
|
+
* `resolveWrunLaneChainChart` left none): the lane refuses with it, its words say Run again. */
|
|
123
|
+
export declare const WRUN_OPTION_CHART_UNRESOLVED_CODE = "wrun_option_chart_unresolved";
|
|
139
124
|
/**
|
|
140
125
|
* Resolve the chart for the one chain resolver (lazy imports: the chain directory, the venue listing and table, the
|
|
141
126
|
* continuous lead resolver): the chart's chain (`resolveWrunLaneChartChain`, the options chain lane's own, or the
|