@orangecharts/wrun-chart-host 0.9.0 → 0.11.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 +2 -0
- package/dist/constants/feature-flags.constants.d.ts +15 -1
- package/dist/constants/feature-flags.constants.js +130 -24
- package/dist/constants/governed-exchanges.constants.d.ts +12 -0
- package/dist/constants/governed-exchanges.constants.js +16 -0
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -2
- package/dist/constants/option-venues.constants.d.ts +2 -2
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
- package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
- package/dist/constants/venue-presets.constants.d.ts +20 -20
- package/dist/constants/venue-presets.constants.js +24 -26
- package/dist/host-env.d.ts +21 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +102 -19
- package/dist/index.d.ts +18 -0
- package/dist/index.js +18 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +1 -1
- package/dist/interfaces/cme-realtime.interface.d.ts +16 -9
- package/dist/interfaces/cme-realtime.interface.js +6 -3
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +12 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +1 -5
- package/dist/interfaces/prediction-market.interface.d.ts +7 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/stocks-realtime.interface.d.ts +57 -0
- package/dist/interfaces/stocks-realtime.interface.js +32 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +62 -94
- package/dist/kscript-data/controls/live-trades-merge.util.js +106 -171
- package/dist/market-data/billing.interface.d.ts +174 -36
- package/dist/market-data/billing.interface.js +58 -8
- package/dist/market-data/venue.d.ts +152 -7
- package/dist/market-data/venues/cme.contract.copy.json +66 -0
- package/dist/market-data/venues/cme.d.ts +126 -0
- package/dist/market-data/venues/cme.js +133 -0
- package/dist/market-data/venues/index.d.ts +294 -7
- package/dist/market-data/venues/index.js +49 -6
- package/dist/market-data/venues/opra.contract.copy.json +3 -2
- package/dist/market-data/venues/opra.d.ts +2 -2
- package/dist/market-data/venues/opra.js +5 -2
- package/dist/market-data/venues/stocks.contract.copy.json +64 -0
- package/dist/market-data/venues/stocks.d.ts +130 -0
- package/dist/market-data/venues/stocks.js +117 -0
- package/dist/settings-templates/footprint-rows.js +35 -2
- package/dist/settings-templates/form-rows.d.ts +2 -1
- package/dist/settings-templates/index.js +7 -3
- package/dist/settings-templates/indicator-fields.d.ts +5 -4
- package/dist/settings-templates/indicator-fields.js +79 -10
- package/dist/settings-templates/tool-rules.d.ts +32 -15
- package/dist/settings-templates/tool-rules.js +33 -11
- package/dist/settings-templates/tool-tables.generated.js +95 -31
- package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
- package/dist/utility/chart/book-live-bucket.util.js +47 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +5 -3
- package/dist/utility/chart/cme-cache-context.util.js +10 -6
- package/dist/utility/chart/cme-realtime.util.js +10 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.d.ts +83 -0
- package/dist/utility/chart/cme-user-scripts-gate.util.js +142 -0
- package/dist/utility/chart/effective-chart-session.util.d.ts +14 -0
- package/dist/utility/chart/effective-chart-session.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +28 -0
- package/dist/utility/chart/host-bar-placement.util.js +170 -30
- package/dist/utility/chart/index-host-tier.util.d.ts +3 -1
- package/dist/utility/chart/index-host-tier.util.js +7 -2
- package/dist/utility/chart/index-mode-admission.util.js +30 -3
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +1 -1
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +9 -7
- package/dist/utility/chart/kscript-live-coalesce.util.js +13 -8
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +9 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +10 -1
- package/dist/utility/chart/kscript-provenance-keys.util.js +13 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +5 -1
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +156 -43
- package/dist/utility/chart/kscript-venue-policy.util.js +249 -59
- package/dist/utility/chart/live-bucket.util.d.ts +24 -8
- package/dist/utility/chart/live-bucket.util.js +85 -27
- package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
- package/dist/utility/chart/market-session-schedule.util.js +16 -0
- package/dist/utility/chart/marketKind.util.js +5 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +7 -0
- package/dist/utility/chart/mixed-mode.util.js +14 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +11 -16
- package/dist/utility/chart/opra-user-scripts-gate.util.js +12 -28
- package/dist/utility/chart/rth-session.util.d.ts +12 -10
- package/dist/utility/chart/rth-session.util.js +25 -21
- package/dist/utility/chart/trading-day.util.d.ts +17 -0
- package/dist/utility/chart/trading-day.util.js +59 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
- package/dist/utility/chart/window-geometry.leaf.js +22 -6
- package/dist/utility/chart/window-owner.leaf.d.ts +23 -2
- package/dist/utility/chart/window-owner.leaf.js +45 -3
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +33 -15
- package/dist/utility/chart/wrun-bar-session-facts.util.js +70 -20
- package/dist/utility/chart/wrun-run-result.util.d.ts +12 -0
- package/dist/utility/chart/wrun-run-result.util.js +141 -6
- package/dist/utility/intl-locale.util.js +5 -0
- package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
- package/dist/utility/options/option-bar-anchor.util.js +340 -0
- package/dist/utility/options/option-venue.util.d.ts +18 -0
- package/dist/utility/options/option-venue.util.js +27 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +4 -0
- package/dist/utility/v2/gate-plane.util.d.ts +12 -3
- package/dist/utility/v2/gate-plane.util.js +30 -4
- package/dist/utility/v2/gate-session-latch.util.js +1 -1
- package/dist/utility/v2/stocks-governed.util.d.ts +16 -0
- package/dist/utility/v2/stocks-governed.util.js +34 -0
- package/dist/utility/wrun/derived-roots.leaf.d.ts +13 -0
- package/dist/utility/wrun/derived-roots.leaf.js +27 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +205 -0
- package/dist/utility/wrun/derived-roots.util.js +451 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +43 -7
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -2
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -2
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +24 -3
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +46 -10
- package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
- package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +2 -1
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +3 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +19 -4
- package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +52 -13
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +88 -19
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +2 -1
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +24 -9
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +41 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +111 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +133 -0
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +15 -3
- package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +22 -3
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +197 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +761 -27
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +1 -2
- package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +60 -16
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +113 -61
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +33 -0
- package/dist/utility/wrun/wrun-download-meter.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-download-meter.util.js +14 -2
- package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
- package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
- package/dist/utility/wrun/wrun-frames.d.ts +27 -6
- package/dist/utility/wrun/wrun-frames.js +73 -10
- package/dist/utility/wrun/wrun-handles.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-handles.util.js +9 -8
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
- package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +18 -4
- package/dist/utility/wrun/wrun-hud-looks.util.js +45 -13
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +68 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +163 -7
- package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +59 -23
- package/dist/utility/wrun/wrun-leg-close.util.js +186 -28
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +35 -15
- package/dist/utility/wrun/wrun-live-intake.util.js +243 -126
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +13 -5
- package/dist/utility/wrun/wrun-live-tick.util.js +279 -99
- package/dist/utility/wrun/wrun-market-facts.util.d.ts +13 -3
- package/dist/utility/wrun/wrun-market-facts.util.js +13 -3
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +60 -11
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +70 -5
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +31 -5
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
- package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
- package/dist/utility/wrun/wrun-option-book-rows.util.d.ts +56 -0
- package/dist/utility/wrun/wrun-option-book-rows.util.js +96 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
- package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +23 -6
- package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +47 -11
- package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +86 -19
- package/dist/utility/wrun/wrun-option-strike-flow.util.js +168 -62
- package/dist/utility/wrun/wrun-option-views.util.d.ts +323 -28
- package/dist/utility/wrun/wrun-option-views.util.js +484 -71
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-options-chain.util.js +2 -0
- package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-output-style.util.js +20 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +32 -2
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +13 -3
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +3 -1
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +160 -42
- package/dist/utility/wrun/wrun-overlay-run.util.js +1244 -209
- package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +114 -19
- package/dist/utility/wrun/wrun-panel-style.util.d.ts +10 -9
- package/dist/utility/wrun/wrun-panel-style.util.js +58 -9
- package/dist/utility/wrun/wrun-param-map.util.d.ts +14 -11
- package/dist/utility/wrun/wrun-param-map.util.js +10 -5
- package/dist/utility/wrun/wrun-param-values.util.d.ts +14 -4
- package/dist/utility/wrun/wrun-param-values.util.js +4 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +15 -2
- package/dist/utility/wrun/wrun-pin-spelling.util.js +39 -14
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal.util.js +22 -0
- package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +26 -0
- package/dist/utility/wrun/wrun-registry-errors.util.js +34 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +3 -2
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +20 -6
- package/dist/utility/wrun/wrun-run-interval-session.util.js +22 -7
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +43 -9
- package/dist/utility/wrun/wrun-run-interval.util.js +58 -15
- package/dist/utility/wrun/wrun-script-inputs.util.d.ts +45 -1
- package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
- package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
- package/dist/utility/wrun/wrun-socket-row-source.js +118 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +29 -18
- package/dist/utility/wrun/wrun-source-rows.util.js +61 -27
- package/dist/utility/wrun/wrun-style-words.util.js +6 -4
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
- package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-tape-per-order.util.js +7 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +17 -9
- package/dist/utility/wrun/wrun-tape-source.util.js +20 -12
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/dist/workers/constants/socket-slots.d.ts +91 -6
- package/dist/workers/constants/socket-slots.js +85 -6
- package/package.json +5 -5
|
@@ -25,7 +25,7 @@ import { peekRegisteredContinuousLead } from '../../chart/continuous-contracts.u
|
|
|
25
25
|
import { cmeOptionsContract } from '../../options/cme-options-root.util.js';
|
|
26
26
|
import { refuseWrunPollInput, WRUN_LANE_KNOB_INVALID_CODE } from './wrun-poll-lane.types.js';
|
|
27
27
|
import { wrunLaneChainPlaneOf } from './wrun-row-lane.types.js';
|
|
28
|
-
import { decideWrunOptionsChainIdentity, WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS, WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE, WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, WRUN_OPTIONS_CHAIN_VENUE_CODE, } from '../wrun-options-chain.util.js';
|
|
28
|
+
import { decideWrunOptionsChainIdentity, isWrunOptionsChainCryptoVenueWord, WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS, WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE, WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, WRUN_OPTIONS_CHAIN_VENUE_CODE, } from '../wrun-options-chain.util.js';
|
|
29
29
|
import { refuseWrunOptionKnob } from '../wrun-option-knobs.util.js';
|
|
30
30
|
import { attachWrunRefusal, wrunAuthorRuleSeed, wrunOptionsStopSeed } from '../wrun-refusal.util.js';
|
|
31
31
|
import { gateSessionHeldElsewhere } from '../../v2/gate-session-latch.util.js';
|
|
@@ -33,71 +33,118 @@ import { gateSessionHeldElsewhere } from '../../v2/gate-session-latch.util.js';
|
|
|
33
33
|
export function wrunLaneChartKey(ctx) {
|
|
34
34
|
return `${ctx.exchange}|${ctx.symbol}|${ctx.coin}`;
|
|
35
35
|
}
|
|
36
|
+
/** A chart's metadata as the options decisions take it: its market, coin and category (`ChartOptionsMarketRef`). */
|
|
37
|
+
function wrunChainChartMarketOf(metadata) {
|
|
38
|
+
return {
|
|
39
|
+
exchange: typeof metadata?.exchange === 'string' ? metadata.exchange : undefined,
|
|
40
|
+
symbol: typeof metadata?.symbol === 'string' ? metadata.symbol : undefined,
|
|
41
|
+
...(typeof metadata?.coin === 'string' ? { coin: metadata.coin } : {}),
|
|
42
|
+
...(metadata?.category !== undefined ? { category: metadata.category } : {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
36
45
|
/**
|
|
37
46
|
* Resolve the chart's chain (lazy imports: the resolver reaches the chain directory service): the ONE resolution every
|
|
38
47
|
* chain class reads, the options chain lane's (over the chart's own metadata) and each row lane's
|
|
39
|
-
* (`resolveWrunLaneChartChain`, over its context's market and category).
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
48
|
+
* (`resolveWrunLaneChartChain`, over its context's market and category). First the swap: the market whose options the
|
|
49
|
+
* chart reads, `decision.market` when the caller holds the run's one decision (derived-roots.util
|
|
50
|
+
* `decideWrunRunOptionsMarket`), else the options seam now (the gate port's `chartOptionsMarket`): a stock twin's US
|
|
51
|
+
* stock while the `opra` flag is lit (its chain is the stock's OPRA chain, read exactly as a stock chart's, and names
|
|
52
|
+
* the twin, `stockTwinOf`), the chart's own market otherwise (its metadata read as before, its category included). The
|
|
53
|
+
* chart's options controls' resolver (`resolveOptionsChartSource`: an option contract chart on a crypto venue reads its
|
|
54
|
+
* own contract's chain), and a chain directory's own failure on a chart its plane governs (a CME futures chart, a chart
|
|
55
|
+
* on the OPRA plane) as that plane's evidence; any other resolver failure fails the run. Off every plane, the chart's
|
|
56
|
+
* stop reason rides along (`opraStop`, opra-options-gate.util `opraOptionPlaneStop`: the `opra` flag dark, an index
|
|
57
|
+
* chart), so every chain decision over the chart says why it reads no US chain. On a plane another screen holds the
|
|
58
|
+
* session of, nothing is read (`heldElsewhere`): the chain stops by that name at once. With a decision the plane and
|
|
59
|
+
* the stop are the decision's, frozen when the run's head took it, and the resolver is handed that plane (a twin
|
|
60
|
+
* answer or a flag landing since never moves the run's chain onto another plane); without one each is read now, over
|
|
61
|
+
* the market (exchange and symbol), never the venue alone.
|
|
46
62
|
*/
|
|
47
|
-
export async function resolveWrunChartChain(metadata) {
|
|
48
|
-
const [{ resolveOptionsChartSource },
|
|
63
|
+
export async function resolveWrunChartChain(metadata, decision) {
|
|
64
|
+
const [{ resolveOptionsChartSource }, gate] = await Promise.all([
|
|
49
65
|
wrunChartHostEnv().market.loadOptionsChartSource(),
|
|
50
66
|
wrunChartHostEnv().market.loadOptionsGate(),
|
|
51
67
|
]);
|
|
52
|
-
const
|
|
68
|
+
const { governedOptionPlane, opraOptionPlaneStop } = gate;
|
|
69
|
+
const resolve = resolveOptionsChartSource;
|
|
70
|
+
const chart = wrunChainChartMarketOf(metadata);
|
|
71
|
+
const decided = decision?.market ?? gate.chartOptionsMarket?.(chart) ?? chart;
|
|
72
|
+
const twinOf = decided.twinOf;
|
|
73
|
+
// A twin's stock is judged and read as a stock chart is (its market alone); every other chart by its own market, its
|
|
74
|
+
// metadata read as before.
|
|
75
|
+
const market = twinOf === undefined ? chart : decided;
|
|
76
|
+
const source = twinOf === undefined ? metadata : { exchange: market.exchange, symbol: market.symbol, coin: market.coin };
|
|
77
|
+
const named = (chain) => twinOf === undefined ? chain : { ...chain, stockTwinOf: { exchange: twinOf.exchange, symbol: twinOf.symbol } };
|
|
78
|
+
const exchange = typeof market.exchange === 'string' ? market.exchange : undefined;
|
|
79
|
+
// The plane and the stop: the run's frozen decision when the caller holds one, else read now.
|
|
80
|
+
const planeOf = () => (decision !== undefined ? decision.plane : governedOptionPlane(market));
|
|
81
|
+
const stopOf = () => (decision !== undefined ? decision.opraStop : opraOptionPlaneStop(market));
|
|
53
82
|
// Another screen holds the session of the plane this chart's chain lists on (gate-session-latch.util): its reader
|
|
54
83
|
// dials nothing until the take-back, so a directory read would wait out its budget. None is sent. The chart's plane
|
|
55
84
|
// is read only while a latch is held, so every other resolution reads exactly as before.
|
|
56
85
|
if (gateSessionHeldElsewhere('cme') || gateSessionHeldElsewhere('opra')) {
|
|
57
|
-
const plane =
|
|
86
|
+
const plane = planeOf();
|
|
58
87
|
if (plane !== null && gateSessionHeldElsewhere(plane))
|
|
59
|
-
return { heldElsewhere: plane };
|
|
88
|
+
return named({ heldElsewhere: plane });
|
|
60
89
|
}
|
|
61
90
|
let chartSource;
|
|
62
91
|
try {
|
|
63
|
-
|
|
92
|
+
// The decided plane rides to the resolver, so it never decides again; without a decision it reads its own now.
|
|
93
|
+
chartSource = (decision !== undefined ? await resolve(source, decision.plane) : await resolve(source));
|
|
64
94
|
}
|
|
65
95
|
catch (error) {
|
|
66
96
|
if (isCmeGoverned(exchange))
|
|
67
97
|
return { directoryFailed: 'cme' };
|
|
68
|
-
if (
|
|
69
|
-
return { directoryFailed: 'opra' };
|
|
98
|
+
if (planeOf() === 'opra')
|
|
99
|
+
return named({ directoryFailed: 'opra' });
|
|
70
100
|
// A chart whose options list on OPRA but ride no plane stops for a known reason (the flag, the router): that
|
|
71
101
|
// reason decides without a chain, whatever the fallback resolver threw.
|
|
72
|
-
const opraStop =
|
|
102
|
+
const opraStop = stopOf();
|
|
73
103
|
if (opraStop !== undefined)
|
|
74
|
-
return { opraStop };
|
|
104
|
+
return named({ opraStop });
|
|
75
105
|
throw error;
|
|
76
106
|
}
|
|
77
107
|
// A chain on a gate plane stopped nothing. Off every plane, the known reason a chart whose options list on OPRA
|
|
78
108
|
// rides none (the flag, the router) is decided beside the chain the resolver fell back to: that fallback (the coin's
|
|
79
109
|
// Deribit chain) reads "no option chain", which is not why.
|
|
80
110
|
if (chartSource.venue === 'opra' || chartSource.venue === 'cme')
|
|
81
|
-
return { chartSource };
|
|
82
|
-
const opraStop =
|
|
83
|
-
return { chartSource, ...(opraStop !== undefined ? { opraStop } : {}) };
|
|
111
|
+
return named({ chartSource });
|
|
112
|
+
const opraStop = stopOf();
|
|
113
|
+
return named({ chartSource, ...(opraStop !== undefined ? { opraStop } : {}) });
|
|
84
114
|
}
|
|
85
|
-
/** Resolve the chart's chain for a lane: `resolveWrunChartChain` over the lane context's market and category.
|
|
115
|
+
/** Resolve the chart's chain for a lane: `resolveWrunChartChain` over the lane context's market and category. In a
|
|
116
|
+
* run's plan the context IS the run's one options market (the planner swapped a stock twin's chain lanes onto its
|
|
117
|
+
* stock, derived-roots.util `wrunUnderlyingLaneContext`) and carries the run's decision (`optionsDecision`): the chain
|
|
118
|
+
* resolves under that decision's plane, never the seam's or the flag's of now. Outside a plan (no decision) both are
|
|
119
|
+
* read now. */
|
|
86
120
|
export function resolveWrunLaneChartChain(ctx) {
|
|
87
|
-
|
|
121
|
+
const metadata = {
|
|
88
122
|
exchange: ctx.exchange,
|
|
89
123
|
symbol: ctx.symbol,
|
|
90
124
|
coin: ctx.coin,
|
|
91
125
|
...(typeof ctx.category === 'number' ? { category: ctx.category } : {}),
|
|
126
|
+
};
|
|
127
|
+
const decided = ctx.optionsDecision;
|
|
128
|
+
if (decided === undefined)
|
|
129
|
+
return resolveWrunChartChain(metadata);
|
|
130
|
+
return resolveWrunChartChain(metadata, {
|
|
131
|
+
market: { ...metadata, ...(ctx.stockTwinOf !== undefined ? { twinOf: ctx.stockTwinOf } : {}) },
|
|
132
|
+
plane: decided.plane,
|
|
133
|
+
...(decided.opraStop !== undefined ? { opraStop: decided.opraStop } : {}),
|
|
92
134
|
});
|
|
93
135
|
}
|
|
94
136
|
/** The crypto venue words a chain decision reads on this chart: on the OPRA plane no crypto venue lists a US
|
|
95
|
-
* stock's options (the words refuse by the flag alone, no listing asked)
|
|
96
|
-
*
|
|
97
|
-
|
|
137
|
+
* stock's options (the words refuse by the flag alone, no listing asked), unless the chain is a stock twin's
|
|
138
|
+
* (`stockTwinOf`: the chart trades on a crypto venue, and a word naming one reads that venue's chain of the coin, so a
|
|
139
|
+
* script pinning `bybit` keeps Bybit's); anywhere else the run's own resolver over the crypto words among `venues`
|
|
140
|
+
* (every crypto word when absent; the listing is asked once per coin, and only for a crypto word with the
|
|
141
|
+
* crypto-options gate on: `[]` reads the gate and the coin alone). */
|
|
142
|
+
export async function resolveWrunLaneCryptoVenues(chain, chartCoin, venues) {
|
|
98
143
|
const { resolveWrunOptionsChainCryptoVenues } = await wrunChartHostEnv().market.loadOptionsChainVenues();
|
|
99
|
-
const
|
|
100
|
-
const
|
|
144
|
+
const asked = venues ?? Object.keys(WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS);
|
|
145
|
+
const words = asked.filter((word) => typeof word === 'string' && isWrunOptionsChainCryptoVenueWord(word));
|
|
146
|
+
const onOpraPlane = chain.stockTwinOf === undefined &&
|
|
147
|
+
(chain.chartSource?.venue === 'opra' || chain.directoryFailed === 'opra' || chain.heldElsewhere === 'opra');
|
|
101
148
|
const resolved = await resolveWrunOptionsChainCryptoVenues({
|
|
102
149
|
words: onOpraPlane ? [] : words,
|
|
103
150
|
chartSource: chain.chartSource,
|
|
@@ -223,12 +270,19 @@ export const WRUN_OPTION_CHART_UNRESOLVED_CODE = 'wrun_option_chart_unresolved';
|
|
|
223
270
|
* words (`resolveWrunLaneCryptoVenues`), for a CME chain on a continuous alias the contract leading it now
|
|
224
271
|
* (option-chain.service `resolveChainContract`, the roll rule the terminal identity admits the alias by; MES1!'s as
|
|
225
272
|
* MESF's contract), and each decided chain's default book (`resolveWrunLaneChainAutoBook`, asked once per chain for
|
|
226
|
-
* this chart).
|
|
273
|
+
* this chart). The crypto venue listing is asked here for every crypto word, or on demand (`options`).
|
|
227
274
|
*/
|
|
228
|
-
export async function resolveWrunLaneChainChart(ctx, held) {
|
|
229
|
-
const
|
|
275
|
+
export async function resolveWrunLaneChainChart(ctx, held, options) {
|
|
276
|
+
const resolved = held ?? (await resolveWrunLaneChartChain(ctx));
|
|
277
|
+
// A stock twin's lane context names the chart market it stands in for: its chain names it too, held or resolved, so
|
|
278
|
+
// its crypto venue words still read their venues' chains (`resolveWrunLaneCryptoVenues`).
|
|
279
|
+
const twinOf = ctx.stockTwinOf;
|
|
280
|
+
const chain = twinOf !== undefined && resolved.stockTwinOf === undefined
|
|
281
|
+
? { ...resolved, stockTwinOf: { exchange: twinOf.exchange, symbol: twinOf.symbol } }
|
|
282
|
+
: resolved;
|
|
283
|
+
const onDemand = options?.cryptoListingOnDemand === true;
|
|
230
284
|
const [cryptoVenues, { hasDeribitOptions }, { OPTION_VENUES }] = await Promise.all([
|
|
231
|
-
resolveWrunLaneCryptoVenues(chain, ctx.coin),
|
|
285
|
+
resolveWrunLaneCryptoVenues(chain, ctx.coin, onDemand ? [] : undefined),
|
|
232
286
|
wrunChartHostEnv().market.loadDeribitOptions(),
|
|
233
287
|
import('../../../constants/option-venues.constants.js'),
|
|
234
288
|
]);
|
|
@@ -247,9 +301,11 @@ export async function resolveWrunLaneChainChart(ctx, held) {
|
|
|
247
301
|
cmeLead = { alias: source.underlying, contract };
|
|
248
302
|
}
|
|
249
303
|
const autoBooks = new Map();
|
|
304
|
+
let listed;
|
|
250
305
|
return {
|
|
251
306
|
chain,
|
|
252
307
|
cryptoVenues,
|
|
308
|
+
...(onDemand ? { cryptoVenuesOnDemand: () => (listed ??= resolveWrunLaneCryptoVenues(chain, ctx.coin)) } : {}),
|
|
253
309
|
deribitListed: hasDeribitOptions,
|
|
254
310
|
venueExchange: (word) => plainVenueOf(word)?.exchanges[0],
|
|
255
311
|
...(cmeLead !== undefined ? { cmeLead } : {}),
|
|
@@ -273,9 +329,13 @@ export async function resolveWrunLaneChainChart(ctx, held) {
|
|
|
273
329
|
* failing, refuses nothing before the read (an empty answer, and the empty-answer rule speaks). The venue and book words
|
|
274
330
|
* are still decided over it (`decideWrunLaneChain`), with no read either.
|
|
275
331
|
*/
|
|
276
|
-
export function wrunLaneOpraPlaneChain(coin) {
|
|
332
|
+
export function wrunLaneOpraPlaneChain(coin, stockTwinOf) {
|
|
277
333
|
return {
|
|
278
334
|
chartSource: { venue: 'opra', exchange: OPRA_GOVERNED_EXCHANGES[0], underlying: coin.trim().toUpperCase() },
|
|
335
|
+
// A stock twin's chain by its ticker (`coin`) names the chart market it stands in for (`stockTwinOf`).
|
|
336
|
+
...(stockTwinOf !== undefined
|
|
337
|
+
? { stockTwinOf: { exchange: stockTwinOf.exchange, symbol: stockTwinOf.symbol } }
|
|
338
|
+
: {}),
|
|
279
339
|
};
|
|
280
340
|
}
|
|
281
341
|
/**
|
|
@@ -286,6 +346,12 @@ export function wrunLaneOpraPlaneChain(coin) {
|
|
|
286
346
|
* flag, the listing, the directory and the OPRA wall by name). A refusal comes back as the decision's own.
|
|
287
347
|
*/
|
|
288
348
|
export function decideWrunLaneChainIdentity(chart, venue, who) {
|
|
349
|
+
// A chart whose listing is asked on demand holds none yet: a crypto word read over the gate and the coin alone would
|
|
350
|
+
// refuse a venue that lists the coin.
|
|
351
|
+
if (chart.cryptoVenuesOnDemand !== undefined && isWrunOptionsChainCryptoVenueWord(String(venue))) {
|
|
352
|
+
throw new Error(`[wrun] input '${who.inputName}': venue "${String(venue)}" over a chart whose crypto venue listing is asked on ` +
|
|
353
|
+
'demand is decided through decideWrunLaneChain');
|
|
354
|
+
}
|
|
289
355
|
return decideWrunOptionsChainIdentity({
|
|
290
356
|
venue: venue === undefined ? undefined : String(venue),
|
|
291
357
|
chartSource: chart.chain.chartSource,
|
|
@@ -318,10 +384,14 @@ export function wrunLaneChainBook(value, ctx) {
|
|
|
318
384
|
* exchange, the underlying the plane files the series under (a CME continuous alias read as the contract leading it
|
|
319
385
|
* now), the coin and the book. Refuses by name with the options chain's own reasons and seeds (a coin no venue lists:
|
|
320
386
|
* `no-chain`), a continuous CME chart whose lead cannot be resolved (`cme-unresolved`, Retry), and a book outside its
|
|
321
|
-
* words.
|
|
387
|
+
* words. A crypto word over a chart whose listing is asked on demand asks it here, once per chart.
|
|
322
388
|
*/
|
|
323
389
|
export async function decideWrunLaneChain(chart, knobs, ctx) {
|
|
324
|
-
const
|
|
390
|
+
const { cryptoVenuesOnDemand, ...resolved } = chart;
|
|
391
|
+
const listed = cryptoVenuesOnDemand !== undefined && isWrunOptionsChainCryptoVenueWord(String(knobs.venue))
|
|
392
|
+
? { ...resolved, cryptoVenues: await cryptoVenuesOnDemand() }
|
|
393
|
+
: chart;
|
|
394
|
+
const decision = decideWrunLaneChainIdentity(listed, knobs.venue, ctx);
|
|
325
395
|
if (!decision.ok)
|
|
326
396
|
throw wrunLaneChainRefusalError(decision, ctx.sourceClass);
|
|
327
397
|
const book = wrunLaneChainBook(knobs.book, ctx);
|
|
@@ -144,7 +144,8 @@ export const rowLane = {
|
|
|
144
144
|
acquisitionMoved: wrunOptionContractFlowAcquisitionMoved,
|
|
145
145
|
identity: async (ctx) => {
|
|
146
146
|
const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
|
|
147
|
-
|
|
147
|
+
// Every input decides through decideWrunLaneChain: the crypto venue listing waits for a crypto venue word.
|
|
148
|
+
rememberFlowChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held, { cryptoListingOnDemand: true }));
|
|
148
149
|
},
|
|
149
150
|
facets: contractFlowFacets,
|
|
150
151
|
landing: {
|
|
@@ -112,7 +112,8 @@ export const rowLane = {
|
|
|
112
112
|
identity: async (ctx) => {
|
|
113
113
|
// On the OPRA plane the chain is the plane's own by coin: no chain directory is read (O1).
|
|
114
114
|
const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
|
|
115
|
-
|
|
115
|
+
// Every input decides through decideWrunLaneChain: the crypto venue listing waits for a crypto venue word.
|
|
116
|
+
rememberStateChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held, { cryptoListingOnDemand: true }));
|
|
116
117
|
},
|
|
117
118
|
facets: async (source, ctx) => {
|
|
118
119
|
// A knob a declared view takes is that view's param, never another class's stray knob.
|
|
@@ -11,6 +11,9 @@
|
|
|
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
13
|
* note.
|
|
14
|
+
* - On the OPRA plane the chain is held by coin (`wrunHeldOpraPlaneChain`): no chain directory read before the first
|
|
15
|
+
* ask, but for an input naming an expiry facet (`max_dte`, `expiries`). The crypto venue listing is asked only for a
|
|
16
|
+
* crypto venue word (`cryptoListingOnDemand`): a CME chain asks none.
|
|
14
17
|
* - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files prints under),
|
|
15
18
|
* `printExchange` (its plane follows it), `printBook` for a book other than the underlying's own series (ONE book per
|
|
16
19
|
* input, D11: the worker and the live fold keep that book's prints) and `printContinuous` for a CME chain read off a
|
|
@@ -11,6 +11,9 @@
|
|
|
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
13
|
* note.
|
|
14
|
+
* - On the OPRA plane the chain is held by coin (`wrunHeldOpraPlaneChain`): no chain directory read before the first
|
|
15
|
+
* ask, but for an input naming an expiry facet (`max_dte`, `expiries`). The crypto venue listing is asked only for a
|
|
16
|
+
* crypto venue word (`cryptoListingOnDemand`): a CME chain asks none.
|
|
14
17
|
* - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files prints under),
|
|
15
18
|
* `printExchange` (its plane follows it), `printBook` for a book other than the underlying's own series (ONE book per
|
|
16
19
|
* input, D11: the worker and the live fold keep that book's prints) and `printContinuous` for a CME chain read off a
|
|
@@ -68,14 +71,13 @@ import { compareWrunOptionPrintsInTimeOrder, forEachWrunOptionPrintTuple, isWrun
|
|
|
68
71
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../../wrun-present-bits.util.js';
|
|
69
72
|
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
70
73
|
import { wrunHostBarOf } from '../../wrun-tier-grid.util.js';
|
|
74
|
+
import { wrunHeldOpraPlaneChain } from '../../wrun-option-views.util.js';
|
|
71
75
|
/** The lane's key, its feed in a refusal record. */
|
|
72
76
|
const LANE_KEY = 'option_prints';
|
|
73
77
|
/** om's refusal name of a missing floor. */
|
|
74
78
|
export const WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE = 'wrun_option_prints_min_premium_required';
|
|
75
79
|
/** om's refusal name of a tail beside `overflow: "largest"` (the union's capacity is `max_cells` + `newest`). */
|
|
76
80
|
export const WRUN_OPTION_PRINTS_TAIL_LARGEST_CODE = 'wrun_option_prints_tail_largest';
|
|
77
|
-
/** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
|
|
78
|
-
* market; the newest entries kept. */
|
|
79
81
|
const PRINTS_CHARTS_KEPT = 16;
|
|
80
82
|
const printsCharts = new Map();
|
|
81
83
|
function rememberPrintsChart(key, chart) {
|
|
@@ -200,7 +202,10 @@ async function optionPrintsFacets(source, ctx) {
|
|
|
200
202
|
}
|
|
201
203
|
const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
|
|
202
204
|
const cuts = optionPrintsCutFacets(source, ctx, overflow, facts.laneMaxCells);
|
|
203
|
-
const
|
|
205
|
+
const resolved = printsCharts.get(wrunLaneChartKey(ctx));
|
|
206
|
+
const chart = resolved?.directory !== undefined && (source.max_dte !== undefined || source.expiries !== undefined)
|
|
207
|
+
? await resolved.directory()
|
|
208
|
+
: resolved?.chart;
|
|
204
209
|
if (chart === undefined) {
|
|
205
210
|
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
206
211
|
}
|
|
@@ -376,7 +381,17 @@ export const rowLane = {
|
|
|
376
381
|
chain: { exchangeField: WRUN_OPTION_PRINTS_EXCHANGE_FIELD },
|
|
377
382
|
acquisitionMoved: wrunOptionPrintsAcquisitionMoved,
|
|
378
383
|
identity: async (ctx) => {
|
|
379
|
-
|
|
384
|
+
// On the OPRA plane the chain is the plane's own by coin, as `option_contract_state` holds it: no chain directory
|
|
385
|
+
// read before the first ask. The listing is asked only for an input naming a crypto venue.
|
|
386
|
+
const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
|
|
387
|
+
const options = { cryptoListingOnDemand: true };
|
|
388
|
+
let directory;
|
|
389
|
+
rememberPrintsChart(wrunLaneChartKey(ctx), {
|
|
390
|
+
chart: await resolveWrunLaneChainChart(ctx, held, options),
|
|
391
|
+
...(held !== undefined
|
|
392
|
+
? { directory: () => (directory ??= resolveWrunLaneChainChart(ctx, undefined, options)) }
|
|
393
|
+
: {}),
|
|
394
|
+
});
|
|
380
395
|
},
|
|
381
396
|
facets: optionPrintsFacets,
|
|
382
397
|
acquisitions: 'one',
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
|
|
11
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';
|
|
12
|
+
import { WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD, WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, } from '../../wrun-option-contract-flow.util.js';
|
|
13
|
+
import { foldWrunOptionStrikeFlowBar, WRUN_OPTION_STRIKE_FLOW_CLASS, WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD, WRUN_OPTION_STRIKE_FLOW_TIERS, WRUN_OPTION_STRIKE_FLOW_WIDTH, wrunOptionStrikeFlowBarRows, wrunOptionStrikeFlowHorizon, wrunOptionStrikeFlowMaxCellsField, } from '../../wrun-option-strike-flow-lane.util.js';
|
|
14
14
|
import { wrunOptionContractFlowAcquisitionMoved, wrunOptionContractFlowExtras } from './option_contract_flow.js';
|
|
15
15
|
import { wrunHeldOpraPlaneChain } from '../../wrun-option-views.util.js';
|
|
16
16
|
import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
|
|
@@ -28,7 +28,7 @@ export function __resetWrunStrikeFlowChartsForTests() {
|
|
|
28
28
|
strikeCharts.clear();
|
|
29
29
|
}
|
|
30
30
|
/** One input's facets: its knobs (om's rules, refused by name), then its chain, named in `option_contract_flow`'s
|
|
31
|
-
* fields. */
|
|
31
|
+
* fields, and the package's bound on a bar where it is under the knobs' projection (`maxCells`). */
|
|
32
32
|
async function strikeFlowFacets(source, ctx) {
|
|
33
33
|
const { wrunOptionStrikeFlowKnobsOf } = await import('../../wrun-option-strike-flow.util.js');
|
|
34
34
|
const knobs = wrunOptionStrikeFlowKnobsOf(source, ctx);
|
|
@@ -37,7 +37,16 @@ async function strikeFlowFacets(source, ctx) {
|
|
|
37
37
|
return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
|
|
38
38
|
}
|
|
39
39
|
const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
|
|
40
|
-
|
|
40
|
+
const extras = { ...wrunOptionContractFlowExtras(chain), ...knobs };
|
|
41
|
+
const { laneMaxCells } = ctx;
|
|
42
|
+
return { ...extras, ...wrunOptionStrikeFlowMaxCellsField(extras, laneMaxCells) };
|
|
43
|
+
}
|
|
44
|
+
/** FE-FOLD-CAP (OPTLOAD W3, R2's projection): the bytes a read of one input is forecast to download where the worker
|
|
45
|
+
* folds it from the chain's contract rows in the browser (wrun-option-strike-flow-forecast.util, loaded here only on a
|
|
46
|
+
* run with the download budget's flag on). */
|
|
47
|
+
async function strikeFlowForecastBytes(source, ctx, chart) {
|
|
48
|
+
const { wrunOptionStrikeFlowForecastBytes } = await import('../../wrun-option-strike-flow-forecast.util.js');
|
|
49
|
+
return wrunOptionStrikeFlowForecastBytes(source, ctx, chart);
|
|
41
50
|
}
|
|
42
51
|
export const rowLane = {
|
|
43
52
|
sourceClass: WRUN_OPTION_STRIKE_FLOW_CLASS,
|
|
@@ -62,4 +71,8 @@ export const rowLane = {
|
|
|
62
71
|
horizon: wrunOptionStrikeFlowHorizon,
|
|
63
72
|
rowBudget: { cellsPerRow: WRUN_OPTION_STRIKE_FLOW_WIDTH, barRows: wrunOptionStrikeFlowBarRows },
|
|
64
73
|
emptyAnswer: 'quiet',
|
|
74
|
+
download: {
|
|
75
|
+
forecastBytes: strikeFlowForecastBytes,
|
|
76
|
+
fold: { field: WRUN_OPTION_STRIKE_FLOW_FOLD_BUDGET_FIELD, cellsPerRow: WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH },
|
|
77
|
+
},
|
|
65
78
|
};
|
|
@@ -34,19 +34,32 @@
|
|
|
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
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
|
|
38
|
-
* `expiries` word is "all" or none (kit 0.91.1: the fold keeps its
|
|
39
|
-
* refused at declaration). Each bar reads the fold of its newest
|
|
37
|
+
* `step_rows` (required), `carry`, `levels` and `curve` (kit 0.96.0, beside `levels` only), refused by the SDK's
|
|
38
|
+
* rules by name (`wrun_option_knob_invalid`); its `expiries` word is "all" or none (kit 0.91.1: the fold keeps its
|
|
39
|
+
* expiries with its own `nearest`, any other word refused at declaration). Each bar reads the fold of its newest
|
|
40
40
|
* minute, 14-value rows (`[1, totals..., max_pain, zero_gamma, call_wall, put_wall, spot, refused]` when `levels`,
|
|
41
|
+
* with `curve` the curve row `[2, gex_at_spot, gamma_flip, curve_spot, priced_at_ms, contracts, 0...]` after it,
|
|
41
42
|
* 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
|
|
43
|
-
*
|
|
43
|
+
* (`strikeKitFold` and its params, `strikeMaxCells` the input's `max_cells`, with `curve` `strikeKitCurve` and
|
|
44
|
+
* `strikeKitMultiplier`, the chart's `market.option_multiplier()`) and folded by the worker with the kit's own fold
|
|
45
|
+
* while the gateway refuses the read. A bar whose newest minute held more rows than `max_cells` answers its
|
|
44
46
|
* levels row refused, and that refuses the run (wrun_cell_block_too_large), as a block over `max_cells` does today;
|
|
45
47
|
* an input declaring `missing: "empty"` reads that bar empty instead (C1.2b). The run carries the 14-value rows: the
|
|
46
48
|
* lane's plan, the packer and the shared aligner (kit 0.91.1) size the block by the input's width
|
|
47
49
|
* (`WRUN_OPTION_STRIKES_KIT_SERVED`).
|
|
48
50
|
* - O1 (OPTLOAD G5): on the OPRA plane the chain is the plane's own by coin (`wrunHeldOpraPlaneChain`), no chain
|
|
49
51
|
* directory read.
|
|
52
|
+
* - `velocity_windows` (SKYLIT-PARITY contract H; the om schema takes the knob by this name and shape): 1 to 7 distinct
|
|
53
|
+
* windows in minutes from 1, 5, 10, 15, 60, 240 and 1440, a literal list. It rides the ask
|
|
54
|
+
* (`strikeVelocityWindowsMin`, the knob's order) and each tuple appends four lists after `underlying`, each one entry
|
|
55
|
+
* per window in the knob's order: `[...12 values, net_gex_velocity..., net_dex_velocity..., net_vex_velocity...,
|
|
56
|
+
* oi_velocity...]`, width 12 + 4N (`wrunOptionStrikesVelocityWidth`). Without the knob the 12-value tuple is
|
|
57
|
+
* byte-identical. The gateway answers velocity on its fold BAR state read alone, whose rows are per strike (every
|
|
58
|
+
* live expiry of the bar summed), so every tuple of one strike in one bar carries the strike's lists; NaN where the
|
|
59
|
+
* gateway has no lagged minute, where it does not draw the chart's bars, on a crypto chain (the state fold sums every
|
|
60
|
+
* book of the coin) and wherever the read fails. Refused by name beside `fold: "kit"` (the gateway refuses velocity
|
|
61
|
+
* on the kit fold) and, while the kit sizes an input by the class width alone, by this host
|
|
62
|
+
* (`WRUN_OPTION_STRIKES_VELOCITY_SERVED`).
|
|
50
63
|
*
|
|
51
64
|
* LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
|
|
52
65
|
*/
|
|
@@ -105,19 +118,45 @@ export declare const WRUN_OPTION_VIEWS_UNSERVED_REFUSAL = "wrun_option_views_uns
|
|
|
105
118
|
export declare const WRUN_OPTION_STRIKES_KIT_SERVED = true;
|
|
106
119
|
/**
|
|
107
120
|
* Whether this host answers the strike kit fold's curve row (kit 0.96.0: `curve: true` beside `levels: true`, a row of
|
|
108
|
-
* the gamma curve's readings after each bar's levels row).
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
121
|
+
* the gamma curve's readings after each bar's levels row). It does (OPTLOAD W3 U4): the ask names `strikeKitCurve` and
|
|
122
|
+
* `strikeKitMultiplier`, the worker reads the gateway's curve fields into the row (pb-common 12.74.0, fields 24 to 28)
|
|
123
|
+
* and folds it with the kit's own fold while the gateway refuses the read; a grouped answer without the curve fields
|
|
124
|
+
* is refused, never drawn. False refuses a `curve: true` input by name after its knobs pass.
|
|
112
125
|
*/
|
|
113
|
-
export declare const WRUN_OPTION_STRIKES_KIT_CURVE_SERVED =
|
|
126
|
+
export declare const WRUN_OPTION_STRIKES_KIT_CURVE_SERVED = true;
|
|
127
|
+
/**
|
|
128
|
+
* Whether this host carries the velocity lists (`velocity_windows`) into a run. Not yet: the shared host plans and
|
|
129
|
+
* aligns each input at the KIT's width rule (kit `planWrunRun`, `alignWrunRows`, `wrunOptionInputTupleWidth`), and the
|
|
130
|
+
* kit sizes an option_strikes input at the class's 12 values until the om schema names the knob, so a velocity block
|
|
131
|
+
* (12 + 4N values a tuple) would split wrong there. So an input declaring the knob is refused by name after its words
|
|
132
|
+
* pass, never read wrong; the kit bump whose rule sizes it (`wrunOptionStrikesVelocityWidth`) sets this true
|
|
133
|
+
* (tests/utility/wrun/sources/option_strikes.velocity.spec.ts holds the two together).
|
|
134
|
+
*/
|
|
135
|
+
export declare const WRUN_OPTION_STRIKES_VELOCITY_SERVED = false;
|
|
136
|
+
/**
|
|
137
|
+
* An input's velocity windows as the ask carries them (`strikeVelocityWindowsMin`, the knob's order), none without the
|
|
138
|
+
* knob, or a refusal by name: a value outside the knob's words (`wrun_option_knob_invalid`), the knob beside
|
|
139
|
+
* `fold: "kit"` (the gateway answers velocity on the state fold alone), and while this host does not carry the lists
|
|
140
|
+
* into a run (`WRUN_OPTION_STRIKES_VELOCITY_SERVED`).
|
|
141
|
+
*/
|
|
142
|
+
export declare function wrunOptionStrikesVelocityExtras(source: Readonly<Record<string, unknown>>, ctx: WrunRowLaneContext): WrunPollLaneExtras | undefined;
|
|
114
143
|
/**
|
|
115
144
|
* The acquisition fields of an input's strike kit fold (OPTLOAD G5): the fold, its params and the input's `max_cells`,
|
|
116
145
|
* so the gateway (or the worker's fold while the gateway refuses it) answers a refused levels row for a bar whose newest
|
|
117
|
-
* minute held more rows
|
|
118
|
-
*
|
|
146
|
+
* minute held more rows; with `curve`, the curve fields and `optionMultiplier` (the chart's
|
|
147
|
+
* `market.option_multiplier()`, `wrunOptionStrikesChartMultiplier`). The fold reads every expiry of the minute (its
|
|
148
|
+
* `nearest` keeps the soonest): an `expiries` word other than "all" beside it was refused at declaration
|
|
149
|
+
* (`wrunOptionLaneAskOfSource`, the SDK's words).
|
|
150
|
+
*/
|
|
151
|
+
export declare function wrunOptionStrikesKitExtras(ask: WrunOptionLaneAsk, ctx: WrunRowLaneContext & WrunRowLanePlanFacts, optionMultiplier?: number): WrunPollLaneExtras;
|
|
152
|
+
/**
|
|
153
|
+
* The multiplier the curve reads: the chart's `market.option_multiplier()` as the host fill computes it
|
|
154
|
+
* (wrun-chart-market-facts.util `wrunChartOptionMultiplier`: OPRA 100, a CME root's point value, crypto 1, else 0), so
|
|
155
|
+
* the gateway's curve values the chain as the template's own curve did. The lane context's market is the one the
|
|
156
|
+
* chain is read as: a stock twin's context names its stock on the OPRA plane (100). Loaded with the facts module at
|
|
157
|
+
* the first curve ask: the lane module stays off the boot path's weight.
|
|
119
158
|
*/
|
|
120
|
-
export declare function
|
|
159
|
+
export declare function wrunOptionStrikesChartMultiplier(ctx: Pick<WrunRowLaneContext, 'exchange' | 'symbol'>): Promise<number>;
|
|
121
160
|
/** Whether a kit fold bar's rows carry the refusal: its levels row with `refused` 1 (the bar's newest minute held more
|
|
122
161
|
* rows than the input's `max_cells`). */
|
|
123
162
|
export declare function wrunOptionStrikesKitRefused(tuples: ReadonlyArray<ReadonlyArray<number>>): boolean;
|