@orangecharts/wrun-chart-host 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2
- package/dist/constants/feature-flags.constants.d.ts +1 -0
- package/dist/constants/feature-flags.constants.js +5 -0
- package/dist/constants/option-venues.constants.d.ts +18 -0
- package/dist/constants/option-venues.constants.js +14 -0
- package/dist/constants/venue-presets.constants.d.ts +17 -3
- package/dist/constants/venue-presets.constants.js +17 -3
- package/dist/host-env.d.ts +24 -0
- package/dist/host-env.js +21 -0
- package/dist/host-ports.types.d.ts +12 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
- package/dist/indicators/controls/tpo-session.util.js +138 -14
- package/dist/interfaces/option-instrument.interface.d.ts +6 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +4 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +4 -0
- package/dist/settings-templates/footprint-rows.d.ts +25 -0
- package/dist/settings-templates/footprint-rows.js +127 -0
- package/dist/settings-templates/form-rows.d.ts +56 -0
- package/dist/settings-templates/form-rows.js +19 -0
- package/dist/settings-templates/frvp-fields.js +14 -0
- package/dist/settings-templates/index.d.ts +11 -0
- package/dist/settings-templates/index.js +29 -6
- package/dist/settings-templates/indicator-fields.d.ts +2 -0
- package/dist/settings-templates/indicator-fields.js +78 -0
- package/dist/settings-templates/tool-rules.d.ts +40 -4
- package/dist/settings-templates/tool-rules.js +45 -4
- package/dist/settings-templates/tool-tables.generated.js +22 -2
- package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
- package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
- package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
- package/dist/utility/chart/footprint-columns.util.js +106 -0
- package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
- package/dist/utility/chart/footprint-display-mode.util.js +62 -0
- package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
- package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +4 -2
- package/dist/utility/chart/om-panel.util.d.ts +11 -0
- package/dist/utility/chart/om-panel.util.js +59 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
- package/dist/utility/chart/window-geometry.leaf.js +78 -6
- package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
- package/dist/utility/chart/window-owner.leaf.js +5 -0
- package/dist/utility/options/cme-options-root.util.d.ts +25 -0
- package/dist/utility/options/cme-options-root.util.js +40 -0
- package/dist/utility/options/option-book.util.d.ts +27 -0
- package/dist/utility/options/option-book.util.js +76 -0
- package/dist/utility/options/option-trade-date.util.d.ts +50 -0
- package/dist/utility/options/option-trade-date.util.js +120 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
- package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
- package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
- package/dist/utility/wrun/sources/row-lane-registry.js +9 -5
- package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +100 -23
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +47 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +71 -2
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +14 -1
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +30 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +45 -5
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +115 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +10 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +57 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +60 -6
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +160 -23
- package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
- package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
- package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +7 -5
- package/dist/utility/wrun/wrun-color-settings.util.js +26 -11
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-draft-overlay.util.js +40 -3
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +4 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
- package/dist/utility/wrun/wrun-live-tick.util.js +39 -6
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +106 -0
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +159 -0
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +44 -0
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +213 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +133 -3
- package/dist/utility/wrun/wrun-option-prints.util.js +318 -8
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +96 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +215 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +342 -0
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +742 -0
- package/dist/utility/wrun/wrun-option-views.util.d.ts +183 -3
- package/dist/utility/wrun/wrun-option-views.util.js +504 -7
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
- package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +7 -2
- package/dist/utility/wrun/wrun-overlay-run.util.js +120 -18
- package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
- package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +9 -8
- package/dist/utility/wrun/wrun-pack.util.js +21 -15
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +17 -2
- package/dist/utility/wrun/wrun-panel-style.util.js +47 -9
- package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
- package/dist/utility/wrun/wrun-refusal.util.js +7 -1
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +18 -0
- package/package.json +3 -3
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
* whole registry for a spec. The folder ships EMPTY of lanes until a class lands (UW-PARITY units U10b, U11).
|
|
23
23
|
*
|
|
24
24
|
* LIGHT on purpose: it never imports the poll-lane registry (whose index loads every poll lane's file), so a module
|
|
25
|
-
* reading row lanes (the requirement table, the
|
|
26
|
-
*
|
|
25
|
+
* reading row lanes (the requirement table, the live intake) loads no poll lane; nor the packer (`wrun-pack.util`,
|
|
26
|
+
* off the boot path): the lanes' tuple widths go through the widths leaf the packer reads (`wrun-pack-widths.leaf`).
|
|
27
|
+
* The poll-lane registry binds itself as this one's peer when it loads (`bindWrunRowLanePollPeers`), and each refuses
|
|
28
|
+
* a class or a key the other holds.
|
|
27
29
|
*/
|
|
28
30
|
// First: the row lane modules evaluate before this module's other imports, the order the bundler glob gave them.
|
|
29
31
|
import { WRUN_ROW_LANE_MODULES } from './row-lanes/index.js';
|
|
@@ -31,7 +33,9 @@ import { WRUN_LANE_CHAIN_PLANES } from './wrun-row-lane.types.js';
|
|
|
31
33
|
import { assertWrunHostGridLanding } from './host-grid-landing.js';
|
|
32
34
|
import { WRUN_BROWSER_BUILTIN_SOURCE_CLASSES, wrunPollLaneClassOfFile } from '../wrun-browser-sources.leaf.js';
|
|
33
35
|
import { registerWrunRefusalFeedKeys } from '../wrun-refusal.util.js';
|
|
34
|
-
|
|
36
|
+
// The widths leaf, never the packer: this registry rides the boot path (the live intake reads row lanes) and the
|
|
37
|
+
// packer does not (tests/utility/wrun/wrun-door.closure.spec.ts); the packer reads the table this registers.
|
|
38
|
+
import { registerWrunRowLaneTupleWidths } from '../wrun-pack-widths.leaf.js';
|
|
35
39
|
const WRUN_ROW_LANE_KEY_RE = /^[a-z][a-z0-9_]*$/;
|
|
36
40
|
let pollPeers = () => ({ classes: [], keys: [] });
|
|
37
41
|
/** The poll-lane registry's binding, at its load: the lanes a row lane must not share a class or a key with. */
|
|
@@ -198,8 +202,8 @@ export function wrunRowLanesOfModules(modules) {
|
|
|
198
202
|
function indexWrunRowLanes(lanes) {
|
|
199
203
|
// A lane's own feed words, so a refusal record naming it reads them (no shared table row).
|
|
200
204
|
registerWrunRefusalFeedKeys(Object.fromEntries(lanes.flatMap((lane) => (lane.feedWords !== undefined ? [[lane.laneKey, lane.feedWords]] : []))));
|
|
201
|
-
// A lane's tuple width, so the packer counts its max_cells in the lane's tuples
|
|
202
|
-
//
|
|
205
|
+
// A lane's tuple width, so the packer counts its max_cells in the lane's tuples: registered in the widths leaf the
|
|
206
|
+
// packer reads at pack time (the packer never imports this registry, and this registry never loads the packer).
|
|
203
207
|
registerWrunRowLaneTupleWidths(Object.fromEntries(lanes.map((lane) => [lane.sourceClass, lane.width])));
|
|
204
208
|
return {
|
|
205
209
|
lanes,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as lane_option_contract_flow from './option_contract_flow.js';
|
|
2
2
|
import * as lane_option_contract_state from './option_contract_state.js';
|
|
3
3
|
import * as lane_option_prints from './option_prints.js';
|
|
4
|
+
import * as lane_option_strike_flow from './option_strike_flow.js';
|
|
4
5
|
import * as lane_option_strikes from './option_strikes.js';
|
|
5
6
|
import * as lane_option_surface from './option_surface.js';
|
|
6
7
|
export const WRUN_ROW_LANE_MODULES = {
|
|
7
8
|
'./row-lanes/option_contract_flow.ts': lane_option_contract_flow,
|
|
8
9
|
'./row-lanes/option_contract_state.ts': lane_option_contract_state,
|
|
9
10
|
'./row-lanes/option_prints.ts': lane_option_prints,
|
|
11
|
+
'./row-lanes/option_strike_flow.ts': lane_option_strike_flow,
|
|
10
12
|
'./row-lanes/option_strikes.ts': lane_option_strikes,
|
|
11
13
|
'./row-lanes/option_surface.ts': lane_option_surface,
|
|
12
14
|
};
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
* provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead contract, and a
|
|
11
11
|
* live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. A chart with no option chain
|
|
12
12
|
* is refused by the decision's own name (`no-options` / `chain`), which a declared `missing: "empty"` drops with a
|
|
13
|
-
* note.
|
|
13
|
+
* note. On the OPRA plane the chain is the plane's own by coin (G5 O1: no chain directory read).
|
|
14
14
|
* - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files the rows under),
|
|
15
15
|
* `flowExchange` (its plane follows it), `flowBook` for a book other than the underlying's own series (ONE book per
|
|
16
16
|
* input, D11: the worker keeps that book's rows) and `flowContinuous` for a CME chain read off a continuous alias.
|
|
17
17
|
* - Facets (om's facet list and words): `venue` and `book` (the chain classes' words), `expiries`, `strike_window_pct`
|
|
18
|
-
* and `min_volume` (above 0, in the chain's size unit: contracts on OPRA and CME, coin on a crypto chain),
|
|
18
|
+
* and `min_volume` (above 0, in the chain's size unit: contracts on OPRA and CME, coin on a crypto chain), and
|
|
19
|
+
* `span`, `history` and `min_premium` (OPTLOAD, kit 0.89.0; never `min_premium` beside `strike_window_pct`), each
|
|
19
20
|
* refused by name outside its words (`wrun_option_knob_invalid`); `max_cells` required (the static plan's rule).
|
|
20
21
|
* - Tiers: 1m kept 7 days, 5m 30, 1h and 1d kept. The fold is tier-invariant (the backend rolls every tier up from
|
|
21
22
|
* the 1m one: sums, the strike window's contract-weighted underlying among them, the newest last price and the
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
* provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead contract, and a
|
|
11
11
|
* live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. A chart with no option chain
|
|
12
12
|
* is refused by the decision's own name (`no-options` / `chain`), which a declared `missing: "empty"` drops with a
|
|
13
|
-
* note.
|
|
13
|
+
* note. On the OPRA plane the chain is the plane's own by coin (G5 O1: no chain directory read).
|
|
14
14
|
* - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files the rows under),
|
|
15
15
|
* `flowExchange` (its plane follows it), `flowBook` for a book other than the underlying's own series (ONE book per
|
|
16
16
|
* input, D11: the worker keeps that book's rows) and `flowContinuous` for a CME chain read off a continuous alias.
|
|
17
17
|
* - Facets (om's facet list and words): `venue` and `book` (the chain classes' words), `expiries`, `strike_window_pct`
|
|
18
|
-
* and `min_volume` (above 0, in the chain's size unit: contracts on OPRA and CME, coin on a crypto chain),
|
|
18
|
+
* and `min_volume` (above 0, in the chain's size unit: contracts on OPRA and CME, coin on a crypto chain), and
|
|
19
|
+
* `span`, `history` and `min_premium` (OPTLOAD, kit 0.89.0; never `min_premium` beside `strike_window_pct`), each
|
|
19
20
|
* refused by name outside its words (`wrun_option_knob_invalid`); `max_cells` required (the static plan's rule).
|
|
20
21
|
* - Tiers: 1m kept 7 days, 5m 30, 1h and 1d kept. The fold is tier-invariant (the backend rolls every tier up from
|
|
21
22
|
* the 1m one: sums, the strike window's contract-weighted underlying among them, the newest last price and the
|
|
@@ -48,6 +49,8 @@ import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRES
|
|
|
48
49
|
import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
|
|
49
50
|
import { refuseWrunOptionKnob, wrunOptionExpiriesKnob, wrunOptionExpiriesWord, wrunOptionStrikeWindowKnob, } from '../../wrun-option-knobs.util.js';
|
|
50
51
|
import { foldWrunOptionContractFlowBar, WRUN_OPTION_CONTRACT_FLOW_BOOK_FIELD, WRUN_OPTION_CONTRACT_FLOW_CONTINUOUS_FIELD, WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD, WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, WRUN_OPTION_CONTRACT_FLOW_WIDTH, WRUN_OPTION_PRINT_AGG_TIERS, wrunOptionContractFlowBarRows, } from '../../wrun-option-contract-flow.util.js';
|
|
52
|
+
import { WRUN_OPTION_FLOW_HISTORY, WRUN_OPTION_FLOW_SPANS } from '../../wrun-option-strike-flow-lane.util.js';
|
|
53
|
+
import { wrunHeldOpraPlaneChain } from '../../wrun-option-views.util.js';
|
|
51
54
|
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
52
55
|
/** The lane's key, its feed in a refusal record. */
|
|
53
56
|
const LANE_KEY = 'option_contract_flow';
|
|
@@ -88,8 +91,17 @@ export function wrunOptionContractFlowExtras(chain) {
|
|
|
88
91
|
export function wrunOptionContractFlowAcquisitionMoved(acquisition) {
|
|
89
92
|
return wrunLaneChainLeadMoved(acquisition[WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD], acquisition[WRUN_OPTION_CONTRACT_FLOW_CONTINUOUS_FIELD], acquisition.coin);
|
|
90
93
|
}
|
|
91
|
-
/**
|
|
92
|
-
|
|
94
|
+
/** A grouped flow word knob (`span`, `history`): its word, the absent one at its default, else a refusal by name. */
|
|
95
|
+
function flowWord(source, ctx, knob, words, absent) {
|
|
96
|
+
const value = source[knob] ?? absent;
|
|
97
|
+
if (typeof value !== 'string' || !words.includes(value)) {
|
|
98
|
+
refuseWrunOptionKnob(ctx, knob, value, words.join(', '));
|
|
99
|
+
}
|
|
100
|
+
return value;
|
|
101
|
+
}
|
|
102
|
+
/** One input's facets: the expiries word, the strike window, the volume floor, `span`, `history` and `min_premium`
|
|
103
|
+
* (each absent at its default, refused by om's name outside its words), then its chain, decided by the one chain
|
|
104
|
+
* resolver over the chart `identity` resolved (its `venue` and `book`). */
|
|
93
105
|
async function contractFlowFacets(source, ctx) {
|
|
94
106
|
const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
|
|
95
107
|
const strikeWindowPct = wrunOptionStrikeWindowKnob(source, ctx);
|
|
@@ -97,6 +109,15 @@ async function contractFlowFacets(source, ctx) {
|
|
|
97
109
|
if (minVolume !== undefined && !(typeof minVolume === 'number' && Number.isFinite(minVolume) && minVolume > 0)) {
|
|
98
110
|
refuseWrunOptionKnob(ctx, 'min_volume', minVolume, 'a size above 0 (contracts, or coin on a crypto chain)');
|
|
99
111
|
}
|
|
112
|
+
const span = flowWord(source, ctx, 'span', WRUN_OPTION_FLOW_SPANS, 'bar');
|
|
113
|
+
const history = flowWord(source, ctx, 'history', WRUN_OPTION_FLOW_HISTORY, 'window');
|
|
114
|
+
const minPremium = source.min_premium;
|
|
115
|
+
if (minPremium !== undefined && !(typeof minPremium === 'number' && Number.isFinite(minPremium) && minPremium > 0)) {
|
|
116
|
+
refuseWrunOptionKnob(ctx, 'min_premium', minPremium, 'a premium in USD above 0');
|
|
117
|
+
}
|
|
118
|
+
if (minPremium !== undefined && strikeWindowPct !== undefined) {
|
|
119
|
+
refuseWrunOptionKnob(ctx, 'min_premium', minPremium, 'a floor without strike_window_pct beside it');
|
|
120
|
+
}
|
|
100
121
|
const chart = flowCharts.get(wrunLaneChartKey(ctx));
|
|
101
122
|
if (chart === undefined) {
|
|
102
123
|
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
@@ -107,6 +128,9 @@ async function contractFlowFacets(source, ctx) {
|
|
|
107
128
|
...(expiries !== undefined ? { expiries } : {}),
|
|
108
129
|
...(strikeWindowPct !== undefined ? { strikeWindowPct } : {}),
|
|
109
130
|
...(minVolume !== undefined ? { minVolume } : {}),
|
|
131
|
+
...(span === 'session' ? { span } : {}),
|
|
132
|
+
...(history === 'today' ? { history } : {}),
|
|
133
|
+
...(minPremium !== undefined ? { minPremium } : {}),
|
|
110
134
|
};
|
|
111
135
|
}
|
|
112
136
|
export const rowLane = {
|
|
@@ -119,7 +143,8 @@ export const rowLane = {
|
|
|
119
143
|
chain: { exchangeField: WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD },
|
|
120
144
|
acquisitionMoved: wrunOptionContractFlowAcquisitionMoved,
|
|
121
145
|
identity: async (ctx) => {
|
|
122
|
-
|
|
146
|
+
const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
|
|
147
|
+
rememberFlowChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held));
|
|
123
148
|
},
|
|
124
149
|
facets: contractFlowFacets,
|
|
125
150
|
landing: {
|
|
@@ -19,9 +19,22 @@
|
|
|
19
19
|
* required`), `expiries`, `history` ("live" | "3d" | "90d") and `overflow` ("refuse" | "largest"), each refused by
|
|
20
20
|
* name outside its words (`wrun_option_knob_invalid`), and the chain classes' `venue` and `book`. One acquisition a
|
|
21
21
|
* package: two inputs whose knobs or chains differ refuse by name.
|
|
22
|
+
* - The cuts and filters (OPTLOAD G4, om kit 0.89.0 `optionCellFacets`, each absent at its default so a sheet without
|
|
23
|
+
* them keeps its acquisition): `newest` (0 to 20,000), `newest_tail_ms` (0 to 60,000, beside `newest` only),
|
|
24
|
+
* `types` ("both" | "calls" | "puts"), `sides` (a list of "ask", "bid", "mid", "none", each once), `moneyness`
|
|
25
|
+
* ("all" | "otm" | "itm") and `max_dte` (0 to 3,650), refused by the same name outside their words; and under
|
|
26
|
+
* `overflow: "largest"` the per-bar cut K, one more than the most `max_cells` among the package's inputs of the class
|
|
27
|
+
* (`WrunRowLanePlanFacts.laneMaxCells`, from the planner). A knob om lets name a setting (`min_premium`,
|
|
28
|
+
* `types`, `sides`, `moneyness`, `max_dte`, `newest_tail_ms`: the sheet records the setting's name) is read as the
|
|
29
|
+
* setting's current value by the planner before the facets judge it (wrun-poll-lanes.util
|
|
30
|
+
* `resolveWrunOptionSettingKnobs` over the class's row of the one table, om `resolveOptionParamKnobs`), so a settings
|
|
31
|
+
* change re-plans the input and its ask carries the new value; the lane reads no setting itself.
|
|
22
32
|
* - History: one ask over the window from the span the backend serves the acquisition (`horizon`: the table the
|
|
23
33
|
* floor and the history reach, the gateway's bar limit); older bars are partial. The K control `K_OPTION_PRINT`
|
|
24
|
-
* reads it on the native-rows path, keyed by second
|
|
34
|
+
* reads it on the native-rows path, keyed by second, the gateway cutting and filtering it where its answer is the
|
|
35
|
+
* lane's own (the worker twin falls back to today's read for a plane whose gateway refuses the cut by name); the
|
|
36
|
+
* answer crosses to the page packed by transfer and the landing reads its blocks in place, re-basing each print's
|
|
37
|
+
* offset on its host bar.
|
|
25
38
|
* - Projection, per input: `expiries: "nearest:N"` keeps the bar's N nearest expiries; `overflow: "largest"` cuts a
|
|
26
39
|
* bar over the input's own `max_cells` to its largest premiums (om's packer rule, bit 14 on the first kept print).
|
|
27
40
|
* - Live by coin, on the planes whose OPTION_PRINT producer streams (`chainPlanes`: OPRA and CME): the coin channel of
|
|
@@ -19,9 +19,22 @@
|
|
|
19
19
|
* required`), `expiries`, `history` ("live" | "3d" | "90d") and `overflow` ("refuse" | "largest"), each refused by
|
|
20
20
|
* name outside its words (`wrun_option_knob_invalid`), and the chain classes' `venue` and `book`. One acquisition a
|
|
21
21
|
* package: two inputs whose knobs or chains differ refuse by name.
|
|
22
|
+
* - The cuts and filters (OPTLOAD G4, om kit 0.89.0 `optionCellFacets`, each absent at its default so a sheet without
|
|
23
|
+
* them keeps its acquisition): `newest` (0 to 20,000), `newest_tail_ms` (0 to 60,000, beside `newest` only),
|
|
24
|
+
* `types` ("both" | "calls" | "puts"), `sides` (a list of "ask", "bid", "mid", "none", each once), `moneyness`
|
|
25
|
+
* ("all" | "otm" | "itm") and `max_dte` (0 to 3,650), refused by the same name outside their words; and under
|
|
26
|
+
* `overflow: "largest"` the per-bar cut K, one more than the most `max_cells` among the package's inputs of the class
|
|
27
|
+
* (`WrunRowLanePlanFacts.laneMaxCells`, from the planner). A knob om lets name a setting (`min_premium`,
|
|
28
|
+
* `types`, `sides`, `moneyness`, `max_dte`, `newest_tail_ms`: the sheet records the setting's name) is read as the
|
|
29
|
+
* setting's current value by the planner before the facets judge it (wrun-poll-lanes.util
|
|
30
|
+
* `resolveWrunOptionSettingKnobs` over the class's row of the one table, om `resolveOptionParamKnobs`), so a settings
|
|
31
|
+
* change re-plans the input and its ask carries the new value; the lane reads no setting itself.
|
|
22
32
|
* - History: one ask over the window from the span the backend serves the acquisition (`horizon`: the table the
|
|
23
33
|
* floor and the history reach, the gateway's bar limit); older bars are partial. The K control `K_OPTION_PRINT`
|
|
24
|
-
* reads it on the native-rows path, keyed by second
|
|
34
|
+
* reads it on the native-rows path, keyed by second, the gateway cutting and filtering it where its answer is the
|
|
35
|
+
* lane's own (the worker twin falls back to today's read for a plane whose gateway refuses the cut by name); the
|
|
36
|
+
* answer crosses to the page packed by transfer and the landing reads its blocks in place, re-basing each print's
|
|
37
|
+
* offset on its host bar.
|
|
25
38
|
* - Projection, per input: `expiries: "nearest:N"` keeps the bar's N nearest expiries; `overflow: "largest"` cuts a
|
|
26
39
|
* bar over the input's own `max_cells` to its largest premiums (om's packer rule, bit 14 on the first kept print).
|
|
27
40
|
* - Live by coin, on the planes whose OPTION_PRINT producer streams (`chainPlanes`: OPRA and CME): the coin channel of
|
|
@@ -42,7 +55,7 @@
|
|
|
42
55
|
import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
43
56
|
import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED } from '../wrun-poll-lane.types.js';
|
|
44
57
|
import { refuseWrunOptionKnob, wrunNearestExpiryTuples, wrunOptionExpiriesKnob, wrunOptionExpiriesOf, wrunOptionExpiriesWord, } from '../../wrun-option-knobs.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';
|
|
58
|
+
import { compareWrunOptionPrintsInTimeOrder, forEachWrunOptionPrintTuple, isWrunOptionPrintMarker, isWrunOptionPrintTuple, WRUN_OPTION_MAX_DTE_DAYS, WRUN_OPTION_PRINT_COLUMN, WRUN_OPTION_PRINT_SIDES, WRUN_OPTION_PRINTS_BOOK_FIELD, WRUN_OPTION_PRINTS_CONTINUOUS_FIELD, WRUN_OPTION_PRINTS_EXCHANGE_FIELD, WRUN_OPTION_PRINTS_HISTORY, WRUN_OPTION_PRINTS_MONEYNESS, WRUN_OPTION_PRINTS_NEWEST_MAX, WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS, WRUN_OPTION_PRINTS_OVERFLOW, WRUN_OPTION_PRINTS_TYPES, WRUN_OPTION_PRINTS_WIDTH, wrunLargestPremiumPrints, wrunNewestOptionPrintRows, wrunOptionPrintKept, wrunOptionPrintOf, wrunOptionPrintsAcquisitionOf, wrunOptionPrintsHorizon, wrunOptionPrintsInTimeOrder, wrunOptionPrintTimeMs, } from '../../wrun-option-prints.util.js';
|
|
46
59
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../../wrun-present-bits.util.js';
|
|
47
60
|
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
48
61
|
import { wrunHostBarOf } from '../../wrun-tier-grid.util.js';
|
|
@@ -86,9 +99,72 @@ export function wrunOptionPrintsExtras(chain) {
|
|
|
86
99
|
export function wrunOptionPrintsAcquisitionMoved(acquisition) {
|
|
87
100
|
return wrunLaneChainLeadMoved(acquisition[WRUN_OPTION_PRINTS_EXCHANGE_FIELD], acquisition[WRUN_OPTION_PRINTS_CONTINUOUS_FIELD], acquisition.coin);
|
|
88
101
|
}
|
|
89
|
-
/**
|
|
90
|
-
|
|
102
|
+
/** A whole-number knob from `min` to `max`, refused by name outside it; undefined when absent or at 0 (its off). */
|
|
103
|
+
function countKnob(source, ctx, knob, max, what) {
|
|
104
|
+
const value = source[knob];
|
|
105
|
+
if (value === undefined)
|
|
106
|
+
return undefined;
|
|
107
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 0 || value > max) {
|
|
108
|
+
return refuseWrunOptionKnob(ctx, knob, value, `${what}, a whole number from 0 to ${max}`);
|
|
109
|
+
}
|
|
110
|
+
return value > 0 ? value : undefined;
|
|
111
|
+
}
|
|
112
|
+
/** A word knob's word other than its default (`words[0]`, absent too), refused by name outside its words. */
|
|
113
|
+
function wordKnob(source, ctx, knob, words) {
|
|
114
|
+
const value = source[knob] ?? words[0];
|
|
115
|
+
if (typeof value !== 'string' || !words.includes(value)) {
|
|
116
|
+
return refuseWrunOptionKnob(ctx, knob, value, words.join(', '));
|
|
117
|
+
}
|
|
118
|
+
return value === words[0] ? undefined : value;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* One input's cuts and filters as acquisition fields (om `optionCellFacets`' print knobs, each absent at its default so
|
|
122
|
+
* a sheet declaring none keeps its acquisition): `newest`, `newestTailMs` (beside `newest` only), `types`, `sides`
|
|
123
|
+
* (om's facet spelling: the words in om's order joined by commas; none or all four is every side), `moneyness`,
|
|
124
|
+
* `maxDte`, and under `overflow: "largest"` the per-bar cut `largestPerBar` (`laneMaxCells` + 1). Each refused by name
|
|
125
|
+
* outside its words (`wrun_option_knob_invalid`).
|
|
126
|
+
*/
|
|
127
|
+
function optionPrintsCutFacets(source, ctx, overflow, laneMaxCells) {
|
|
128
|
+
const newest = countKnob(source, ctx, 'newest', WRUN_OPTION_PRINTS_NEWEST_MAX, 'the newest prints kept');
|
|
129
|
+
const tail = countKnob(source, ctx, 'newest_tail_ms', WRUN_OPTION_PRINTS_NEWEST_TAIL_MAX_MS, 'the ms before the oldest newest print also kept');
|
|
130
|
+
if (tail !== undefined && newest === undefined) {
|
|
131
|
+
refuseWrunOptionKnob(ctx, 'newest_tail_ms', tail, 'a tail beside newest only (declare newest, 1 and up)');
|
|
132
|
+
}
|
|
133
|
+
const types = wordKnob(source, ctx, 'types', WRUN_OPTION_PRINTS_TYPES);
|
|
134
|
+
const moneyness = wordKnob(source, ctx, 'moneyness', WRUN_OPTION_PRINTS_MONEYNESS);
|
|
135
|
+
const maxDte = countKnob(source, ctx, 'max_dte', WRUN_OPTION_MAX_DTE_DAYS, 'the days to expiry kept at most');
|
|
136
|
+
const sides = source.sides;
|
|
137
|
+
let sideWords;
|
|
138
|
+
if (sides !== undefined) {
|
|
139
|
+
if (!Array.isArray(sides) ||
|
|
140
|
+
new Set(sides).size !== sides.length ||
|
|
141
|
+
!sides.every((side) => WRUN_OPTION_PRINT_SIDES.includes(side))) {
|
|
142
|
+
refuseWrunOptionKnob(ctx, 'sides', sides, `a list of ${WRUN_OPTION_PRINT_SIDES.join(', ')}, each once`);
|
|
143
|
+
}
|
|
144
|
+
const kept = WRUN_OPTION_PRINT_SIDES.filter((side) => sides.includes(side));
|
|
145
|
+
sideWords = kept.length === 0 || kept.length === WRUN_OPTION_PRINT_SIDES.length ? undefined : kept;
|
|
146
|
+
}
|
|
147
|
+
const largestPerBar = overflow === 'largest' && typeof laneMaxCells === 'number' && Number.isInteger(laneMaxCells) && laneMaxCells >= 1
|
|
148
|
+
? laneMaxCells + 1
|
|
149
|
+
: undefined;
|
|
150
|
+
return {
|
|
151
|
+
...(newest !== undefined ? { newest } : {}),
|
|
152
|
+
...(tail !== undefined ? { newestTailMs: tail } : {}),
|
|
153
|
+
...(largestPerBar !== undefined ? { largestPerBar } : {}),
|
|
154
|
+
...(types !== undefined ? { types } : {}),
|
|
155
|
+
...(sideWords !== undefined ? { sides: sideWords.join(',') } : {}),
|
|
156
|
+
...(maxDte !== undefined ? { maxDte } : {}),
|
|
157
|
+
...(moneyness !== undefined ? { moneyness } : {}),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/** One input's facets: the floor (required), the history, the overflow rule, the expiries word and the cuts and
|
|
161
|
+
* filters, each knob naming a setting already read as its value by the planner (`resolveWrunOptionSettingKnobs`, the
|
|
162
|
+
* class's row of the one table), then its chain, decided by the one chain resolver over the chart `identity` resolved
|
|
163
|
+
* (its `venue` and `book`). */
|
|
91
164
|
async function optionPrintsFacets(source, ctx) {
|
|
165
|
+
// The planner's facts beside the chart: the package's most `max_cells` of the class (the per-bar cut under
|
|
166
|
+
// "largest" asks one more).
|
|
167
|
+
const facts = ctx;
|
|
92
168
|
const minPremium = source.min_premium;
|
|
93
169
|
if (minPremium === undefined) {
|
|
94
170
|
return refuseWrunPollInput(ctx, `declares no min_premium (${WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE}): declare the smallest premium a print ` +
|
|
@@ -106,6 +182,7 @@ async function optionPrintsFacets(source, ctx) {
|
|
|
106
182
|
return refuseWrunOptionKnob(ctx, 'overflow', overflow, WRUN_OPTION_PRINTS_OVERFLOW.join(', '));
|
|
107
183
|
}
|
|
108
184
|
const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
|
|
185
|
+
const cuts = optionPrintsCutFacets(source, ctx, overflow, facts.laneMaxCells);
|
|
109
186
|
const chart = printsCharts.get(wrunLaneChartKey(ctx));
|
|
110
187
|
if (chart === undefined) {
|
|
111
188
|
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
@@ -117,25 +194,27 @@ async function optionPrintsFacets(source, ctx) {
|
|
|
117
194
|
history,
|
|
118
195
|
overflow,
|
|
119
196
|
...(expiries !== undefined ? { expiries } : {}),
|
|
197
|
+
...cuts,
|
|
120
198
|
};
|
|
121
199
|
}
|
|
122
|
-
/** A host bar's prints: each second row's prints,
|
|
200
|
+
/** A host bar's prints: each second row's prints, read in place from its cells (the worker's packed blocks, or plain
|
|
201
|
+
* tuples), their offsets re-based on the bar's open, in time order. */
|
|
123
202
|
function landOptionPrints(group) {
|
|
203
|
+
const width = WRUN_OPTION_PRINTS_WIDTH;
|
|
124
204
|
const out = [];
|
|
125
205
|
for (const row of group.rows) {
|
|
126
206
|
const base = Number(row[0]) - group.barOpenMs;
|
|
127
207
|
if (!Number.isFinite(base))
|
|
128
208
|
continue;
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
tuple[WRUN_OPTION_PRINT_COLUMN.offset] = base + cell[WRUN_OPTION_PRINT_COLUMN.offset];
|
|
209
|
+
forEachWrunOptionPrintTuple(row, (source, offset) => {
|
|
210
|
+
const tuple = new Array(width);
|
|
211
|
+
for (let column = 0; column < width; column += 1)
|
|
212
|
+
tuple[column] = source[offset + column];
|
|
213
|
+
tuple[WRUN_OPTION_PRINT_COLUMN.offset] = base + source[offset + WRUN_OPTION_PRINT_COLUMN.offset];
|
|
135
214
|
out.push(tuple);
|
|
136
|
-
}
|
|
215
|
+
});
|
|
137
216
|
}
|
|
138
|
-
return
|
|
217
|
+
return out.sort(compareWrunOptionPrintsInTimeOrder);
|
|
139
218
|
}
|
|
140
219
|
/** A live point's print and series (the feed's point: `{ series, optionPrint }`). */
|
|
141
220
|
function livePrintOf(point) {
|
|
@@ -149,11 +228,6 @@ function livePrintOf(point) {
|
|
|
149
228
|
...(series !== null && typeof series === 'object' ? { series: series } : {}),
|
|
150
229
|
};
|
|
151
230
|
}
|
|
152
|
-
/** Whether a tuple is a partial bar's marker (every value 0, `present` bit 14 alone), never a print. */
|
|
153
|
-
function isPartialMarker(tuple) {
|
|
154
|
-
const present = tuple[WRUN_OPTION_PRINT_COLUMN.present];
|
|
155
|
-
return (wrunPresentIsPartial(present) && tuple.every((value, at) => at === WRUN_OPTION_PRINT_COLUMN.present || value === 0));
|
|
156
|
-
}
|
|
157
231
|
/**
|
|
158
232
|
* One bar's print tuples merged with more (`incoming` win on a shared `print_key`), in time order. A partial bar
|
|
159
233
|
* stays partial: when any tuple of either side says so, every print carries bit 14, and a bar left without a print
|
|
@@ -163,9 +237,10 @@ function mergeBarPrints(existing, incoming) {
|
|
|
163
237
|
const tuples = [...existing.filter(isWrunOptionPrintTuple), ...incoming];
|
|
164
238
|
const partial = tuples.some((tuple) => wrunPresentIsPartial(tuple[WRUN_OPTION_PRINT_COLUMN.present]));
|
|
165
239
|
const byKey = new Map();
|
|
166
|
-
for (const tuple of tuples)
|
|
167
|
-
if (!
|
|
240
|
+
for (const tuple of tuples) {
|
|
241
|
+
if (!isWrunOptionPrintMarker(tuple))
|
|
168
242
|
byKey.set(tuple[WRUN_OPTION_PRINT_COLUMN.key], tuple);
|
|
243
|
+
}
|
|
169
244
|
const prints = wrunOptionPrintsInTimeOrder([...byKey.values()]);
|
|
170
245
|
if (!partial)
|
|
171
246
|
return prints;
|
|
@@ -175,7 +250,8 @@ function mergeBarPrints(existing, incoming) {
|
|
|
175
250
|
}
|
|
176
251
|
/** Live prints folded into the instance's host-bar rows: each kept print (the acquisition's chain, its exchange and
|
|
177
252
|
* 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
|
|
253
|
+
* it, once per `print_key`, every touched bar's prints in time order; then the rows cut to the acquisition's newest cut
|
|
254
|
+
* over the window (`wrunNewestOptionPrintRows`), as its history was read under, so a live bar never outgrows it. */
|
|
179
255
|
function foldLiveOptionPrints(rows, points, ctx) {
|
|
180
256
|
const acquisition = wrunOptionPrintsAcquisitionOf(ctx.acquisition);
|
|
181
257
|
const byBar = new Map(rows.map((row) => [Number(row[0]), [...row]]));
|
|
@@ -202,7 +278,8 @@ function foldLiveOptionPrints(rows, points, ctx) {
|
|
|
202
278
|
const fresh = prints.filter((tuple) => !heldKeys.has(tuple[WRUN_OPTION_PRINT_COLUMN.key]));
|
|
203
279
|
byBar.set(open, [open, ...mergeBarPrints(held, fresh)]);
|
|
204
280
|
}
|
|
205
|
-
|
|
281
|
+
const folded = [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
|
|
282
|
+
return acquisition === undefined ? folded : wrunNewestOptionPrintRows(folded, acquisition);
|
|
206
283
|
}
|
|
207
284
|
/** A reconcile answer over the rows held: the answer's prints, plus every held print of the bar its key does not
|
|
208
285
|
* name (a print shown live keeps its place until history serves it), in time order. */
|
|
@@ -217,7 +294,7 @@ function reconcileOptionPrints(held, answer) {
|
|
|
217
294
|
const kept = before
|
|
218
295
|
.slice(1)
|
|
219
296
|
.filter(isWrunOptionPrintTuple)
|
|
220
|
-
.filter((tuple) => !
|
|
297
|
+
.filter((tuple) => !isWrunOptionPrintMarker(tuple) && !keys.has(tuple[WRUN_OPTION_PRINT_COLUMN.key]));
|
|
221
298
|
if (kept.length === 0)
|
|
222
299
|
return [...row];
|
|
223
300
|
return [row[0], ...mergeBarPrints(answered, kept)];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `option_strike_flow` (OPTLOAD G3, om kit 0.89.0): one underlying's option flow per strike, per expiry or per both, per
|
|
3
|
+
* chart bar or trade date, as 15-value tuples; a CHAIN lane on every chain, its chain the one chain resolver's as
|
|
4
|
+
* `option_contract_flow`'s (on the OPRA plane the plane's own by coin, G5 O1). The lane, its knobs, reads and fallback:
|
|
5
|
+
* docs/features/kscript/wrun/wrun-browser-runtime.md, `option_strike_flow`.
|
|
6
|
+
*
|
|
7
|
+
* LIGHT at module load (every row lane rides the boot path): the knobs' rules load with the class's read module inside
|
|
8
|
+
* `facets`, and the chain resolver's reads run inside `identity` and `facets`.
|
|
9
|
+
*/
|
|
10
|
+
import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
11
|
+
import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
|
|
12
|
+
import { WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD } from '../../wrun-option-contract-flow.util.js';
|
|
13
|
+
import { foldWrunOptionStrikeFlowBar, WRUN_OPTION_STRIKE_FLOW_CLASS, WRUN_OPTION_STRIKE_FLOW_TIERS, WRUN_OPTION_STRIKE_FLOW_WIDTH, wrunOptionStrikeFlowBarRows, wrunOptionStrikeFlowHorizon, } from '../../wrun-option-strike-flow-lane.util.js';
|
|
14
|
+
import { wrunOptionContractFlowAcquisitionMoved, wrunOptionContractFlowExtras } from './option_contract_flow.js';
|
|
15
|
+
import { wrunHeldOpraPlaneChain } from '../../wrun-option-views.util.js';
|
|
16
|
+
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
17
|
+
/** What `identity` resolved for a chart, read back by `facets`, keyed by the chart market; the newest kept. */
|
|
18
|
+
const STRIKE_CHARTS_KEPT = 16;
|
|
19
|
+
const strikeCharts = new Map();
|
|
20
|
+
function rememberStrikeChart(key, chart) {
|
|
21
|
+
strikeCharts.delete(key);
|
|
22
|
+
strikeCharts.set(key, chart);
|
|
23
|
+
while (strikeCharts.size > STRIKE_CHARTS_KEPT)
|
|
24
|
+
strikeCharts.delete(strikeCharts.keys().next().value);
|
|
25
|
+
}
|
|
26
|
+
/** Test seam: forget every resolved chart. */
|
|
27
|
+
export function __resetWrunStrikeFlowChartsForTests() {
|
|
28
|
+
strikeCharts.clear();
|
|
29
|
+
}
|
|
30
|
+
/** One input's facets: its knobs (om's rules, refused by name), then its chain, named in `option_contract_flow`'s
|
|
31
|
+
* fields. */
|
|
32
|
+
async function strikeFlowFacets(source, ctx) {
|
|
33
|
+
const { wrunOptionStrikeFlowKnobsOf } = await import('../../wrun-option-strike-flow.util.js');
|
|
34
|
+
const knobs = wrunOptionStrikeFlowKnobsOf(source, ctx);
|
|
35
|
+
const chart = strikeCharts.get(wrunLaneChartKey(ctx));
|
|
36
|
+
if (chart === undefined) {
|
|
37
|
+
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
38
|
+
}
|
|
39
|
+
const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
|
|
40
|
+
return { ...wrunOptionContractFlowExtras(chain), ...knobs };
|
|
41
|
+
}
|
|
42
|
+
export const rowLane = {
|
|
43
|
+
sourceClass: WRUN_OPTION_STRIKE_FLOW_CLASS,
|
|
44
|
+
laneKey: WRUN_OPTION_STRIKE_FLOW_CLASS,
|
|
45
|
+
kType: WRUN_OPTION_STRIKE_FLOW_CLASS,
|
|
46
|
+
label: 'Option strike flow',
|
|
47
|
+
feedWords: 'wrun.refusal.feed.optionStrikeFlow',
|
|
48
|
+
width: WRUN_OPTION_STRIKE_FLOW_WIDTH,
|
|
49
|
+
chain: { exchangeField: WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD },
|
|
50
|
+
acquisitionMoved: wrunOptionContractFlowAcquisitionMoved,
|
|
51
|
+
identity: async (ctx) => {
|
|
52
|
+
const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
|
|
53
|
+
rememberStrikeChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held));
|
|
54
|
+
},
|
|
55
|
+
facets: strikeFlowFacets,
|
|
56
|
+
landing: {
|
|
57
|
+
kind: 'flow',
|
|
58
|
+
tiers: WRUN_OPTION_STRIKE_FLOW_TIERS.strike,
|
|
59
|
+
tierChoice: 'coarsest',
|
|
60
|
+
fold: (group) => foldWrunOptionStrikeFlowBar(group.rows),
|
|
61
|
+
},
|
|
62
|
+
horizon: wrunOptionStrikeFlowHorizon,
|
|
63
|
+
rowBudget: { cellsPerRow: WRUN_OPTION_STRIKE_FLOW_WIDTH, barRows: wrunOptionStrikeFlowBarRows },
|
|
64
|
+
emptyAnswer: 'quiet',
|
|
65
|
+
};
|
|
@@ -33,11 +33,28 @@
|
|
|
33
33
|
* `expiries` ("all", or "nearest:N": the N earliest expiries each bar's snapshot lists, kept per input before the
|
|
34
34
|
* packer judges `max_cells`, never a fetch facet). A market pin, `history` and `min_size` are refused by name; a
|
|
35
35
|
* block over `max_cells` refuses the run (wrun_cell_block_too_large, never truncated). One chain per package.
|
|
36
|
+
* - `fold` "kit" (OPTLOAD G5, kit 0.90.0; wrun-option-views.util): `nearest`, `window_pct` (required), `lens`,
|
|
37
|
+
* `step_rows` (required), `carry` and `levels`, refused by the SDK's rules by name (`wrun_option_knob_invalid`); its
|
|
38
|
+
* `expiries` word is "all" or none (kit 0.91.1: the fold keeps its expiries with its own `nearest`, any other word
|
|
39
|
+
* refused at declaration). Each bar reads the fold of its newest
|
|
40
|
+
* minute, 14-value rows (`[1, totals..., max_pain, zero_gamma, call_wall, put_wall, spot, refused]` when `levels`,
|
|
41
|
+
* then `[0, strike, value]` at the strikes the template draws), asked of the gateway at the chart's bars
|
|
42
|
+
* (`strikeKitFold` and its params, `strikeMaxCells` the input's `max_cells`) and folded by the worker by the same
|
|
43
|
+
* rules while the gateway refuses the read. A bar whose newest minute held more rows than `max_cells` answers its
|
|
44
|
+
* levels row refused, and that refuses the run (wrun_cell_block_too_large), as a block over `max_cells` does today;
|
|
45
|
+
* an input declaring `missing: "empty"` reads that bar empty instead (C1.2b). The run carries the 14-value rows: the
|
|
46
|
+
* lane's plan, the packer and the shared aligner (kit 0.91.1) size the block by the input's width
|
|
47
|
+
* (`WRUN_OPTION_STRIKES_KIT_SERVED`).
|
|
48
|
+
* - O1 (OPTLOAD G5): on the OPRA plane the chain is the plane's own by coin (`wrunHeldOpraPlaneChain`), no chain
|
|
49
|
+
* directory read.
|
|
36
50
|
*
|
|
37
51
|
* LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
|
|
38
52
|
*/
|
|
39
53
|
import { type WrunLaneChain } from '../opra-option-lanes.util.js';
|
|
40
|
-
import
|
|
54
|
+
import { type WrunPollLaneExtras } from '../wrun-poll-lane.types.js';
|
|
55
|
+
import type { WrunRowLaneCellInput, WrunRowLaneContext, WrunRowLaneDescriptor, WrunRowLaneHorizon } from '../wrun-row-lane.types.js';
|
|
56
|
+
import type { WrunRowLanePlanFacts } from '../wrun-row-lanes.util.js';
|
|
57
|
+
import { type WrunOptionLaneAsk } from '../../wrun-option-views.util.js';
|
|
41
58
|
/** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
|
|
42
59
|
export declare const WRUN_OPTION_STRIKES_WIDTH = 12;
|
|
43
60
|
/** The columns a tuple must hold a finite number in: the strike and the expiry. */
|
|
@@ -73,4 +90,33 @@ export declare function wrunOptionStrikesExtras(chain: WrunLaneChain): Record<st
|
|
|
73
90
|
* continuous alias whose lead rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
|
|
74
91
|
* rebuilds, so no store or buffer joins the old contract's strikes to the new one's. */
|
|
75
92
|
export declare function wrunOptionStrikesAcquisitionMoved(acquisition: Readonly<Record<string, unknown>>): boolean;
|
|
93
|
+
/** om's code for a block over its input's `max_cells` (wrun-pack.util `WRUN_CELL_BLOCK_TOO_LARGE_CODE`, named here so
|
|
94
|
+
* the lane module does not pull the packer onto the boot path). */
|
|
95
|
+
export declare const WRUN_OPTION_STRIKES_BLOCK_TOO_LARGE_CODE = "wrun_cell_block_too_large";
|
|
96
|
+
/** The kit's code for a view word a host does not serve (`wrun_option_views_unserved`, kit 0.90.0). */
|
|
97
|
+
export declare const WRUN_OPTION_VIEWS_UNSERVED_REFUSAL = "wrun_option_views_unserved";
|
|
98
|
+
/**
|
|
99
|
+
* Whether this host carries the strike kit fold's 14-value rows into a run. It does: every reader of the block sizes
|
|
100
|
+
* it by the input's own width (wrun-option-views.util `wrunOptionInputTupleWidth`, the SDK's one rule): the row lane's
|
|
101
|
+
* plan, the run's packer (wrun-pack.util `packWrunRows`) and, from kit 0.91.1, the shared host's aligner (kit
|
|
102
|
+
* `alignWrunRows`), which read the block in the class's 12-value tuples before. False refuses a kit fold input by name
|
|
103
|
+
* after its knobs pass, never read wrong.
|
|
104
|
+
*/
|
|
105
|
+
export declare const WRUN_OPTION_STRIKES_KIT_SERVED = true;
|
|
106
|
+
/**
|
|
107
|
+
* The acquisition fields of an input's strike kit fold (OPTLOAD G5): the fold, its params and the input's `max_cells`,
|
|
108
|
+
* so the gateway (or the worker's fold while the gateway refuses it) answers a refused levels row for a bar whose newest
|
|
109
|
+
* minute held more rows. The fold reads every expiry of the minute (its `nearest` keeps the soonest): an `expiries`
|
|
110
|
+
* word other than "all" beside it was refused at declaration (`wrunOptionLaneAskOfSource`, the SDK's words).
|
|
111
|
+
*/
|
|
112
|
+
export declare function wrunOptionStrikesKitExtras(ask: WrunOptionLaneAsk, ctx: WrunRowLaneContext & WrunRowLanePlanFacts): WrunPollLaneExtras;
|
|
113
|
+
/** Whether a kit fold bar's rows carry the refusal: its levels row with `refused` 1 (the bar's newest minute held more
|
|
114
|
+
* rows than the input's `max_cells`). */
|
|
115
|
+
export declare function wrunOptionStrikesKitRefused(tuples: ReadonlyArray<ReadonlyArray<number>>): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* One input's block on one bar: under fold "kit" the bar's kit rows as they are, a refused levels row refusing the run
|
|
118
|
+
* (`wrun_cell_block_too_large`, the block never truncated) or, for an input declaring `missing: "empty"`, reading that
|
|
119
|
+
* bar as a present empty block (C1.2b); else the tuples its `expiries` word keeps (`wrunOptionStrikesKept`).
|
|
120
|
+
*/
|
|
121
|
+
export declare function wrunOptionStrikesCells(tuples: ReadonlyArray<ReadonlyArray<number>>, input: WrunRowLaneCellInput): ReadonlyArray<ReadonlyArray<number>>;
|
|
76
122
|
export declare const rowLane: WrunRowLaneDescriptor;
|