@orangecharts/wrun-chart-host 0.9.0 → 0.10.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 +1 -0
- package/dist/constants/feature-flags.constants.d.ts +6 -1
- package/dist/constants/feature-flags.constants.js +67 -24
- package/dist/constants/opra-compliance.constants.d.ts +3 -2
- package/dist/constants/opra-compliance.constants.js +3 -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 +29 -5
- package/dist/host-env.js +6 -0
- package/dist/host-ports.types.d.ts +69 -15
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
- package/dist/interfaces/replay.interface.d.ts +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +18 -2
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +41 -4
- package/dist/kscript-data/controls/live-trades-merge.util.js +52 -7
- package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
- package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
- package/dist/market-data/billing.interface.d.ts +95 -31
- package/dist/market-data/billing.interface.js +36 -5
- package/dist/market-data/venue.d.ts +88 -6
- 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 +162 -5
- package/dist/market-data/venues/index.js +48 -6
- 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 +45 -6
- package/dist/settings-templates/tool-rules.d.ts +27 -17
- package/dist/settings-templates/tool-rules.js +27 -11
- package/dist/settings-templates/tool-tables.generated.js +91 -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/index-mode-admission.util.js +15 -2
- 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 +7 -2
- package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -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 +54 -35
- package/dist/utility/chart/kscript-venue-policy.util.js +78 -42
- 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/opra-read-access.leaf.d.ts +5 -3
- package/dist/utility/chart/opra-read-access.leaf.js +5 -3
- package/dist/utility/chart/rth-session.util.d.ts +3 -2
- package/dist/utility/chart/rth-session.util.js +2 -1
- 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/wrun-run-result.util.d.ts +12 -0
- package/dist/utility/chart/wrun-run-result.util.js +141 -6
- 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 +2 -0
- package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
- package/dist/utility/wrun/derived-roots.util.js +471 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
- 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/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 +39 -10
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
- package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -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 +174 -13
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +685 -27
- 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 +53 -12
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +101 -53
- 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-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-latest-snapshot.d.ts +11 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +13 -7
- package/dist/utility/wrun/wrun-live-intake.util.js +82 -29
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +158 -14
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +49 -10
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +65 -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-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 +47 -13
- package/dist/utility/wrun/wrun-option-views.util.js +98 -26
- 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 +17 -0
- 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-run.util.d.ts +100 -31
- package/dist/utility/wrun/wrun-overlay-run.util.js +733 -114
- 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 +63 -13
- 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.js +12 -11
- 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-refused-latest.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
- package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
- 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 +113 -8
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +5 -1
- package/dist/utility/wrun/wrun-source-rows.util.js +16 -3
- 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 +26 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
- package/dist/utils/replay/replay-buffer-math.js +227 -20
- package/package.json +11 -11
|
@@ -555,8 +555,10 @@ import { assertWrunCandleMemberLook, isWrunGlowClampDisabled, landWrunGlowPx, la
|
|
|
555
555
|
import { wrunAbiVersion, wrunFramesOf } from '../wrun/wrun-pack.util.js';
|
|
556
556
|
import { formatWrunValue, isWrunValueFormat, WRUN_VALUE_FORMATS } from '../wrun/wrun-pane-format.util.js';
|
|
557
557
|
import { createWrunRenderBudget, selectWrunRenderables, wrunRenderValueBytes, wrunSelectionBytes, } from '../wrun/wrun-render-select.util.js';
|
|
558
|
-
import { parseWrunThemeToken, wrunThemeTokenOfPacked, wrunThemeTokenScaleAlpha, wrunThemeTokenWithAlpha, wrunThemeTokenWord, } from '../wrun/wrun-style-words.util.js';
|
|
558
|
+
import { formatWrunNumber, parseWrunThemeToken, wrunThemeTokenOfPacked, wrunThemeTokenScaleAlpha, wrunThemeTokenWithAlpha, wrunThemeTokenWord, } from '../wrun/wrun-style-words.util.js';
|
|
559
|
+
import { substituteWrunChartNames } from '../wrun/wrun-chart-names.util.js';
|
|
559
560
|
import { wrunCornerLabelLook, wrunTextLookPayload } from '../wrun/wrun-text-look.util.js';
|
|
561
|
+
import { wrunPanelFrameNotices, } from '../wrun/wrun-frames.js';
|
|
560
562
|
import { resolveWrunCustomTitle, wrunParamChoices, wrunParamWordsShape, wrunRunOverlayPalette, wrunVisibilityTargets, } from '../wrun/wrun-script-inputs.util.js';
|
|
561
563
|
import { wrunCodedWords } from '../wrun/wrun-setting-words.util.js';
|
|
562
564
|
import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunColorSettingString, wrunVisibilityOwnedOutputs, } from '../wrun/wrun-color-settings.util.js';
|
|
@@ -744,7 +746,13 @@ export function buildWrunRunResult(options) {
|
|
|
744
746
|
// A strategy output exists only after a run, which loaded the shared host first.
|
|
745
747
|
if (strategy !== undefined)
|
|
746
748
|
budget.spend(wrunChartHostEnv().sharedHost().wrunStrategyWireBytes(strategy));
|
|
747
|
-
|
|
749
|
+
const result = buildWrunRunResultWithSelection({ ...options, selection, handles, strategy }, memo);
|
|
750
|
+
// The HUD headline rides the result (the object as built: nothing keys it by identity yet), so a pane whose frame
|
|
751
|
+
// carries no rows can say why with the run's own words.
|
|
752
|
+
const headline = wrunHudHeadlineOf(options);
|
|
753
|
+
if (headline !== undefined)
|
|
754
|
+
result.headline = headline;
|
|
755
|
+
return result;
|
|
748
756
|
}
|
|
749
757
|
catch (error) {
|
|
750
758
|
if (!(error instanceof Error) || !error.message.startsWith('wrun_frame_invalid:'))
|
|
@@ -769,6 +777,55 @@ export function buildWrunRunResult(options) {
|
|
|
769
777
|
};
|
|
770
778
|
}
|
|
771
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* The run's HUD headline (WrunRunResult.headline): the first tile of `presentation.hud` declared `headline: true`
|
|
782
|
+
* (LK05, one per card; the first card that has one), read on the last ready row the way the latest-values snapshot
|
|
783
|
+
* reads it (wrun-overlay-run.util wrunLatestSnapshotOf): a `slot` tile's string slot text (the chart's names put in),
|
|
784
|
+
* else an `output` tile's value formatted like the card's (formatWrunNumber over the tile's `format`, the chart's
|
|
785
|
+
* price digits). Volatility Character's card names its character word this way ("Mean-reverting"). Undefined when no
|
|
786
|
+
* tile is a headline, no row is ready, or the row holds no text, a blank text or a non-finite value for it.
|
|
787
|
+
*/
|
|
788
|
+
function wrunHudHeadlineOf(options) {
|
|
789
|
+
const cards = options.metadata.presentation?.hud;
|
|
790
|
+
if (!Array.isArray(cards))
|
|
791
|
+
return undefined;
|
|
792
|
+
let tile;
|
|
793
|
+
for (const card of cards) {
|
|
794
|
+
tile = (Array.isArray(card?.tiles) ? card.tiles : []).find((candidate) => candidate?.headline === true);
|
|
795
|
+
if (tile !== undefined)
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
if (tile === undefined)
|
|
799
|
+
return undefined;
|
|
800
|
+
let last;
|
|
801
|
+
for (let at = options.rows.length - 1; at >= 0 && last === undefined; at -= 1) {
|
|
802
|
+
const row = options.rows[at];
|
|
803
|
+
if (row?.outputs !== null && row?.outputs !== undefined && Number.isFinite(row.ts))
|
|
804
|
+
last = row;
|
|
805
|
+
}
|
|
806
|
+
if (last === undefined)
|
|
807
|
+
return undefined;
|
|
808
|
+
let text;
|
|
809
|
+
if (typeof tile.slot === 'string') {
|
|
810
|
+
const slot = (options.metadata.string_slots ?? []).find((candidate) => candidate.name === tile.slot);
|
|
811
|
+
const raw = slot === undefined ? undefined : last.strings?.[slot.index];
|
|
812
|
+
if (typeof raw === 'string')
|
|
813
|
+
text = substituteWrunChartNames(raw, options.selectContext?.chartNames);
|
|
814
|
+
}
|
|
815
|
+
else if (typeof tile.output === 'string') {
|
|
816
|
+
const output = options.metadata.outputs.find((candidate) => candidate.name === tile.output);
|
|
817
|
+
const value = output === undefined ? undefined : last.outputs?.[output.index];
|
|
818
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
819
|
+
const priceDigits = options.selectContext?.priceDigits;
|
|
820
|
+
text = formatWrunNumber(value, {
|
|
821
|
+
...(typeof tile.format === 'string' ? { format: tile.format } : {}),
|
|
822
|
+
...(priceDigits !== undefined ? { priceDigits } : {}),
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
const trimmed = text?.trim();
|
|
827
|
+
return trimmed ? trimmed : undefined;
|
|
828
|
+
}
|
|
772
829
|
/** A run result's author-facing notices (every canvas child's, in child
|
|
773
830
|
* order; a fresh array, empty when there are none). A run seam publishes
|
|
774
831
|
* them as warning rows (wrun-canvases.util `wrunCanvasNoticeDiagnostics`). */
|
|
@@ -1204,6 +1261,56 @@ function wrunRowsCarryValue(rows, columns) {
|
|
|
1204
1261
|
return typeof value === 'number' && Number.isFinite(value);
|
|
1205
1262
|
}));
|
|
1206
1263
|
}
|
|
1264
|
+
/** Each painted sheet's visibility targets, walked once: a live session builds every tick from one sheet. */
|
|
1265
|
+
const emptyTargetSheets = new WeakMap();
|
|
1266
|
+
/**
|
|
1267
|
+
* The Style targets a run drew nothing for (WrunRunResult.emptyTargets), in the visibility table's order. A drawn
|
|
1268
|
+
* output (a candle group as its first output, all four values on one row), a range (both edges on one row) or a fill
|
|
1269
|
+
* (both sides on one row) whose columns no ready row carries finite: the `rowsCarry` rule `omit_if_empty` mounts
|
|
1270
|
+
* by, so every declaration that rule left out is one, and so is a plain output an input switched off (NaN on every
|
|
1271
|
+
* row: it mounts and draws nothing). A `drawing` group target (a drawing, a segment, a handle kind) no delivered
|
|
1272
|
+
* record names. A target the market leaves out (`visible_by`) is never one: it mounts nothing whatever its values.
|
|
1273
|
+
* Not judged here: an inset output, a box and every `skip` target (renderers, canvases, levels, panels), whose own
|
|
1274
|
+
* builders hold whether they drew, and a shape's `shape_where` gate (its value column decides).
|
|
1275
|
+
*/
|
|
1276
|
+
function wrunRunEmptyTargets(metadata, facts) {
|
|
1277
|
+
let targets = emptyTargetSheets.get(metadata);
|
|
1278
|
+
if (targets === undefined) {
|
|
1279
|
+
targets = wrunVisibilityTargets(metadata);
|
|
1280
|
+
emptyTargetSheets.set(metadata, targets);
|
|
1281
|
+
}
|
|
1282
|
+
const columnOf = (name) => typeof name === 'string' && !facts.hidden.has(name) ? facts.outputIndexByName.get(name) : undefined;
|
|
1283
|
+
const empty = [];
|
|
1284
|
+
for (const target of targets) {
|
|
1285
|
+
if (target.group === 'drawing') {
|
|
1286
|
+
if (!facts.drawn.has(target.target))
|
|
1287
|
+
empty.push(target.target);
|
|
1288
|
+
continue;
|
|
1289
|
+
}
|
|
1290
|
+
let columns;
|
|
1291
|
+
if (target.section === 'outputs' && target.group === 'nested') {
|
|
1292
|
+
const group = facts.candleGroupByOpen.get(target.target);
|
|
1293
|
+
columns =
|
|
1294
|
+
group === undefined || facts.hidden.has(target.target)
|
|
1295
|
+
? [columnOf(target.target)]
|
|
1296
|
+
: group.map((member) => member.index);
|
|
1297
|
+
}
|
|
1298
|
+
else if (target.section === 'ranges') {
|
|
1299
|
+
columns = [columnOf(target.entry.upper), columnOf(target.entry.lower)];
|
|
1300
|
+
}
|
|
1301
|
+
else if (target.section === 'fills') {
|
|
1302
|
+
const between = Array.isArray(target.entry.between) ? target.entry.between : [];
|
|
1303
|
+
columns = between.length === 2 ? between.map(columnOf) : [undefined];
|
|
1304
|
+
}
|
|
1305
|
+
else {
|
|
1306
|
+
continue;
|
|
1307
|
+
}
|
|
1308
|
+
if (columns.every((column) => column !== undefined) && !facts.carries(columns)) {
|
|
1309
|
+
empty.push(target.target);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
return empty;
|
|
1313
|
+
}
|
|
1207
1314
|
/** A payload with its declared look (WRUN-STYLE DW26) folded in: the frozen
|
|
1208
1315
|
* fields keep their engine key order and their per-record values (a ladder
|
|
1209
1316
|
* pick wins over the look's static word); the look adds every key the
|
|
@@ -3842,12 +3949,32 @@ function buildWrunRunResultWithSelection(options, memo) {
|
|
|
3842
3949
|
// A parent that homes in a declared pane takes that pane's scale look and
|
|
3843
3950
|
// axis format on its own define (OT18 OT19).
|
|
3844
3951
|
const homeDeclaration = homePane === undefined ? undefined : paneByName.get(homePane);
|
|
3845
|
-
// Every canvas child's author-facing notices (a coarsened TPO)
|
|
3846
|
-
//
|
|
3952
|
+
// Every canvas child's author-facing notices (a coarsened TPO) and every panel's (a legend text drawn
|
|
3953
|
+
// clipped to its cap, wrun-frames), in child order, then a line per dropped entry (WrunRunNote), so the
|
|
3954
|
+
// author sees why the fill is missing.
|
|
3847
3955
|
const notices = [
|
|
3848
|
-
...childOverlays.flatMap((child) => child.kind === 'heatmap' || child.kind === 'profile' || child.kind === 'matrix'
|
|
3956
|
+
...childOverlays.flatMap((child) => child.kind === 'heatmap' || child.kind === 'profile' || child.kind === 'matrix'
|
|
3957
|
+
? (child.notices ?? [])
|
|
3958
|
+
: child.kind === 'panel'
|
|
3959
|
+
? wrunPanelFrameNotices(child.frame)
|
|
3960
|
+
: []),
|
|
3849
3961
|
...runNotes.map((note) => note.message),
|
|
3850
3962
|
];
|
|
3963
|
+
// The Style targets this run drew nothing for (WrunRunResult.emptyTargets), read before the commit: a live
|
|
3964
|
+
// build's memo answers `rowsCarry` over these rows only until then.
|
|
3965
|
+
const drawnTargets = new Set();
|
|
3966
|
+
const paneDrawings = seriesChildren.flatMap((child) => child.kind === 'series' ? (child.result.drawings ?? []) : []);
|
|
3967
|
+
for (const drawing of [...drawings, ...paneDrawings]) {
|
|
3968
|
+
if (drawing.styleTarget !== undefined)
|
|
3969
|
+
drawnTargets.add(drawing.styleTarget);
|
|
3970
|
+
}
|
|
3971
|
+
const emptyTargets = wrunRunEmptyTargets(metadata, {
|
|
3972
|
+
carries: rowsCarry,
|
|
3973
|
+
hidden: hiddenOutputs,
|
|
3974
|
+
candleGroupByOpen,
|
|
3975
|
+
outputIndexByName,
|
|
3976
|
+
drawn: drawnTargets,
|
|
3977
|
+
});
|
|
3851
3978
|
// The build completed: the memo now holds its units.
|
|
3852
3979
|
memo?.commit();
|
|
3853
3980
|
// The child list rides a wrun-4 result, a result with children, and every result of a sheet that declares
|
|
@@ -3863,6 +3990,7 @@ function buildWrunRunResultWithSelection(options, memo) {
|
|
|
3863
3990
|
...(carriesChildren ? { childOverlays } : {}),
|
|
3864
3991
|
...(notices.length > 0 ? { notices } : {}),
|
|
3865
3992
|
...(runNotes.length > 0 ? { notes: runNotes } : {}),
|
|
3993
|
+
...(emptyTargets.length > 0 ? { emptyTargets } : {}),
|
|
3866
3994
|
...(drawings.length > 0 ||
|
|
3867
3995
|
handleSet !== undefined ||
|
|
3868
3996
|
metadata.drawings?.some((drawing) => drawing.kind === 'card' || drawing.kind === 'ladder' || drawing.kind === 'feed' || drawing.kind === 'meter')
|
|
@@ -5170,7 +5298,13 @@ const ENGINE_LABEL_Y_ALIGN = new Map([
|
|
|
5170
5298
|
* from the anchored edge (left and top to the right and down, right and
|
|
5171
5299
|
* bottom to the left and up, a centre axis signed: the rule titan's
|
|
5172
5300
|
* paneAnchorOffset places every other anchored mark by), so x flips on a
|
|
5173
|
-
* right anchor and y on a bottom one.
|
|
5301
|
+
* right anchor and y on a bottom one. A top corner (top_left, top_center,
|
|
5302
|
+
* top_right) also carries `safeArea: 'chrome'`: titan moves that label down
|
|
5303
|
+
* by the host's card safe-area insets for its pane (`topLeft` on the left,
|
|
5304
|
+
* `topRight` on the centre and the right), so a note never draws behind the
|
|
5305
|
+
* chart's top chrome (the symbol title, interval pill and info button row
|
|
5306
|
+
* over the canvas). A kScript plotLabel never carries the flag, and the
|
|
5307
|
+
* hosted lane (om `wrunCornerLabelPayload`) sets the same one. */
|
|
5174
5308
|
function cornerLabelPayload(label, position, color, size, offset, look) {
|
|
5175
5309
|
const horizontal = position.includes('left') ? 'left' : position.includes('right') ? 'right' : 'center';
|
|
5176
5310
|
const vertical = position.includes('top') ? 'top' : position.includes('bottom') ? 'bottom' : 'middle';
|
|
@@ -5194,5 +5328,6 @@ function cornerLabelPayload(label, position, color, size, offset, look) {
|
|
|
5194
5328
|
y: vertical === 'bottom' ? flipped(payload.y) : payload.y,
|
|
5195
5329
|
xAlign: ENGINE_LABEL_X_ALIGN.get(String(payload.xAlign)) ?? payload.xAlign,
|
|
5196
5330
|
yAlign: ENGINE_LABEL_Y_ALIGN.get(String(payload.yAlign)) ?? payload.yAlign,
|
|
5331
|
+
...(vertical === 'top' ? { safeArea: 'chrome' } : {}),
|
|
5197
5332
|
};
|
|
5198
5333
|
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bars a grouped option read lays (OPTLOAD-READ-CONTRACT 3.2 to 3.4): the app's ONE mirror of tsdb-gateway's anchor
|
|
3
|
+
* rules, read at origin/main d83cbbf20 (pkg/tsdb/selects/option_read_shape.go `barAnchorRules`, `optionReadAnchorReads`,
|
|
4
|
+
* `OptionReadGridOf` and each rule's `fitTier`, `bar`, `session`, `boundary`, `barEnd` and `lays`;
|
|
5
|
+
* option_print_agg_group.go `optionPrintAggCMESessionScopes`; trade_agg.go `cmeRegularSessionAnchor` and
|
|
6
|
+
* `cmeEnergySessionAnchor`; cme.go `cmeSessionDay`, `cmeSessionOpen`, `cmeCurrentSessionLabel` and `isCMEGroupExchange`).
|
|
7
|
+
* Every option read that names a `barAnchor` takes the anchors, their bars, the venues they lay and the reads that take
|
|
8
|
+
* them from here: the strike and contract flow groupings (wrun-option-strike-flow.util), the flow scopes' bars
|
|
9
|
+
* (option-print-agg-scope.worker.util), the prints' per-bar cut (k-option-print.worker), the surface pick
|
|
10
|
+
* (k-option-surface.worker) and the delayed bound's grid (option-read-grid.util). The rules are keyed by pb-common's
|
|
11
|
+
* `BarAnchor`, so an anchor the protocol adds fails the type check until it has a rule here, and the class guard
|
|
12
|
+
* (tests/utility/options/option-bar-anchor.class.spec.ts) fails by name on any other module that names an anchor.
|
|
13
|
+
*
|
|
14
|
+
* - UTC: bars on the Unix epoch, every row counted; its session is the UTC date.
|
|
15
|
+
* - US_EQUITY_RTH, CME_RTH and CME_ENERGY_RTH: a regular session on the New York wall clock (09:30 to 16:00; 09:30 to
|
|
16
|
+
* 16:15, the CME platform session the CME candles keep; 09:00 to 14:30, the energy pit session), weekdays only, bars
|
|
17
|
+
* open + k * width, only rows of [open, close) counted, the last bar of a day short; no holiday is modelled, as the
|
|
18
|
+
* charts model none. The two CME anchors lay bars over the CME group's rows alone, built from tiers dividing 15 and 30
|
|
19
|
+
* minutes; daylight saving comes from the tz database on both sides.
|
|
20
|
+
* - CME_SESSION: the Globex trade date (17:00 Chicago opens the next; a weekday holiday's session belongs to the next
|
|
21
|
+
* trade date on the CME calendar, a weekend day keeps its own date), each bar stamped at the 17:00 open of its first
|
|
22
|
+
* session day; a 604,800 s bar is the ISO week of a trade date. The CME group's alone, taken by OPTION_PRINT_AGG's
|
|
23
|
+
* COIN, MARKET, STRIKE, EXPIRY, EXPIRY_STRIKE and CONTRACT scopes alone, from a tier dividing an hour. It drops no
|
|
24
|
+
* row: an always-on root's weekend rows land on their own dates, as the chart's lattice books them.
|
|
25
|
+
*
|
|
26
|
+
* A decider proves an anchor's bars against the chart's own: a bucket the anchor lays no bar for may fall on a chart bar
|
|
27
|
+
* only where the chart's product holds no trading (`optionChartClosedAt`, its schedule), never because the anchor's own
|
|
28
|
+
* hours leave it out (a CME regular session's weekend on an always-on root).
|
|
29
|
+
*
|
|
30
|
+
* Pure and worker-safe: the zone clock (ny-calendar.util), the CME lattice's trade calendar (cme-session-bucket.util) and
|
|
31
|
+
* the CME products' schedules (market-session-schedule.util).
|
|
32
|
+
*/
|
|
33
|
+
import { BarAnchor } from '@orangecharts/orange-v2-pb-common';
|
|
34
|
+
/** pb-common `BarAnchor` by name: the values a request names (the gateway decodes JSON enums as numbers). */
|
|
35
|
+
export declare const OPTION_BAR_ANCHOR: Readonly<{
|
|
36
|
+
readonly UTC: BarAnchor.UTC;
|
|
37
|
+
readonly US_EQUITY_RTH: BarAnchor.US_EQUITY_RTH;
|
|
38
|
+
readonly CME_SESSION: BarAnchor.CME_SESSION;
|
|
39
|
+
readonly CME_RTH: BarAnchor.CME_RTH;
|
|
40
|
+
readonly CME_ENERGY_RTH: BarAnchor.CME_ENERGY_RTH;
|
|
41
|
+
}>;
|
|
42
|
+
/** A read that names `barAnchor`, as the gateway registers it: its type, and on OPTION_PRINT_AGG its scope. */
|
|
43
|
+
export type OptionBarAnchorRead = 'OPTION_PRINT_AGG/COIN' | 'OPTION_PRINT_AGG/MARKET' | 'OPTION_PRINT_AGG/VENUE' | 'OPTION_PRINT_AGG/PRINTS' | 'OPTION_PRINT_AGG/STRIKE' | 'OPTION_PRINT_AGG/EXPIRY' | 'OPTION_PRINT_AGG/EXPIRY_STRIKE' | 'OPTION_PRINT_AGG/CONTRACT' | 'OPTION_PRINT' | 'OPTION_SURFACE' | 'OPTION_STRIKE_AGG' | 'OPTION_STRIKE_FLOW_AGG';
|
|
44
|
+
/** A regular session on a wall clock: its zone, and its open and close as minutes after the zone's midnight. */
|
|
45
|
+
export interface OptionBarAnchorSession {
|
|
46
|
+
zone: string;
|
|
47
|
+
openMinutes: number;
|
|
48
|
+
closeMinutes: number;
|
|
49
|
+
}
|
|
50
|
+
/** One anchor's rule: the gateway's `barAnchorRule` and what admits it (`optionReadAnchorReads`, `lays`). */
|
|
51
|
+
export interface OptionBarAnchorRule {
|
|
52
|
+
readonly anchor: BarAnchor;
|
|
53
|
+
/** pb-common's name of the anchor (the read shape's words name it). */
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** The trade date its sessions key by (`sessionKeySQL`): a zone's wall clock plus hours, cut to a date. */
|
|
56
|
+
readonly tradeDate: Readonly<{
|
|
57
|
+
zone: string;
|
|
58
|
+
offsetHours: number;
|
|
59
|
+
}>;
|
|
60
|
+
/** The regular session it lays (the three RTH anchors); undefined for UTC and CME_SESSION. */
|
|
61
|
+
readonly session?: Readonly<OptionBarAnchorSession>;
|
|
62
|
+
/** The venues it lays bars over: every venue's rows, or the CME group's alone. */
|
|
63
|
+
readonly venues: 'every' | 'cme';
|
|
64
|
+
/** Whether it lays bars over an exchange's rows (`lays`); a read reaching any other venue is refused by name. */
|
|
65
|
+
lays(exchange: unknown): boolean;
|
|
66
|
+
/** Whether a read takes it (`optionReadAnchorReads`): every read naming `barAnchor`, but CME_SESSION's few. */
|
|
67
|
+
takes(read: OptionBarAnchorRead): boolean;
|
|
68
|
+
/** Whether a tier `tierMs` wide builds its bars `barMs` wide (0: the tier's own buckets), or sessions (`fitTier`). */
|
|
69
|
+
fitsTier(tierMs: number, barMs: number, session: boolean): boolean;
|
|
70
|
+
/** The open of the bar `barMs` wide holding `tMs` (`tMs` itself at 0), null where it lands in none (`bar`). */
|
|
71
|
+
barOpenMs(tMs: number, barMs: number): number | null;
|
|
72
|
+
/** The open of the session `tMs` trades in, null where none (`session`). */
|
|
73
|
+
sessionOpenMs(tMs: number): number | null;
|
|
74
|
+
/** Whether a window may start or end at `tMs` without splitting a bar or a session (`boundary`). */
|
|
75
|
+
isBoundary(tMs: number, barMs: number, session: boolean): boolean;
|
|
76
|
+
/** The latest instant at or before `tMs` a window may end at: a boundary. */
|
|
77
|
+
floorBoundaryMs(tMs: number, barMs: number, session: boolean): number;
|
|
78
|
+
/** The end of the bar (or session) stamped `openMs` (`barEnd`). */
|
|
79
|
+
barEndMs(openMs: number, barMs: number, session: boolean): number;
|
|
80
|
+
}
|
|
81
|
+
/** Every anchor's rule, by pb-common's value (`barAnchorRules`): a value without a rule fails the type check. */
|
|
82
|
+
export declare const OPTION_BAR_ANCHOR_RULES: Readonly<Record<BarAnchor, OptionBarAnchorRule>>;
|
|
83
|
+
/** The rule of an anchor value, or undefined for a value no rule lays (the gateway refuses it by name). */
|
|
84
|
+
export declare function optionBarAnchorRuleOf(anchor: unknown): OptionBarAnchorRule | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* The anchors a read takes on a venue, in pb-common's order: every anchor the read takes that lays every venue's rows,
|
|
87
|
+
* and one laid over a venue group's alone only when the read names a venue of that group (`exchange`, the chain's): the
|
|
88
|
+
* gateway refuses a CME anchor by name on any other venue (OPRA, Deribit) and on a read that names none.
|
|
89
|
+
*/
|
|
90
|
+
export declare function optionBarAnchorsTaken(read: OptionBarAnchorRead, exchange?: string): OptionBarAnchorRule[];
|
|
91
|
+
/**
|
|
92
|
+
* Where a bar proof may drop a bucket the chart lays a bar for: only at an instant the chart's own product holds no
|
|
93
|
+
* trading at, by its schedule (market-session-schedule.util `isGovernedFuturesSymbolOpenAt`). This is the one drop
|
|
94
|
+
* exemption every decider proves an anchor's bars with (the strike and contract flow groupings, the flow scopes' bars,
|
|
95
|
+
* the prints' per-bar cut). An anchor's own hours are not it: a CME regular session lays no bar on a weekend day, which a
|
|
96
|
+
* weekday product's regular-hours chart lays empty bars for, while an always-on root (crypto since 2026-05-29, 1OZ since
|
|
97
|
+
* 2026-07-24) trades through it. So on an always-on root's chart the session lands on no bars that hold weekend rows,
|
|
98
|
+
* and the decider falls back (UTC bars where they land, else today's fold). A chart off the CME group has no schedule
|
|
99
|
+
* here, so nothing it lays may be dropped.
|
|
100
|
+
*/
|
|
101
|
+
export declare function optionChartClosedAt(grid: {
|
|
102
|
+
exchange?: unknown;
|
|
103
|
+
symbol?: unknown;
|
|
104
|
+
} | null | undefined): (tMs: number) => boolean;
|
|
105
|
+
/** A chain's trade-date clock, as option-trade-date.util decides it. */
|
|
106
|
+
export interface OptionBarAnchorClock {
|
|
107
|
+
zone: string;
|
|
108
|
+
rule: {
|
|
109
|
+
offsetHours: number;
|
|
110
|
+
weekendsToMonday?: true;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The anchor whose sessions are a chain's trade dates (contract 3.4), or undefined where none is: the first anchor the
|
|
115
|
+
* read takes on the venue whose session key (`tradeDate`) is the clock's own rule, a clock that moves its weekends to
|
|
116
|
+
* Monday matching none. New York's clock reads US_EQUITY_RTH's sessions, the UTC date UTC's, the Globex trade date
|
|
117
|
+
* (Chicago's wall clock plus 7 hours) CME_SESSION's on a CME group venue; a CME crypto root's clock (16:00 Chicago,
|
|
118
|
+
* weekends on Monday) is no anchor's.
|
|
119
|
+
*/
|
|
120
|
+
export declare function optionSessionAnchorOf(clock: OptionBarAnchorClock, read: OptionBarAnchorRead, exchange?: string): OptionBarAnchorRule | undefined;
|
|
121
|
+
/** Where a grouped read's rows land (`OptionReadGrid`): bars `seconds` wide laid by `anchor`, or with `session` one
|
|
122
|
+
* group per trade date of the anchor. */
|
|
123
|
+
export interface OptionBarAnchorGrid {
|
|
124
|
+
anchor: BarAnchor;
|
|
125
|
+
seconds: number;
|
|
126
|
+
session: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The grid an `optionRead` groups on (`OptionReadGridOf`), or null when it groups nothing (no `barSeconds`, span BAR). A
|
|
130
|
+
* day bar is a UTC day's row on UTC and US_EQUITY_RTH, and keeps its anchor on every other (a trade date on
|
|
131
|
+
* CME_SESSION).
|
|
132
|
+
*/
|
|
133
|
+
export declare function optionBarAnchorGridOf(shape: unknown): OptionBarAnchorGrid | null;
|
|
134
|
+
/** The open of the bar (or session) holding `tMs` on a grid (`OptionReadGrid.Bar`), null where it lands in none or
|
|
135
|
+
* where no rule lays the grid's anchor. */
|
|
136
|
+
export declare function optionGridBarOpenMs(grid: OptionBarAnchorGrid, tMs: number): number | null;
|
|
137
|
+
/** Whether a window may start or end at `tMs` on a grid (`OptionReadGrid.Boundary`); an anchor no rule lays splits
|
|
138
|
+
* nothing. */
|
|
139
|
+
export declare function optionGridIsBoundary(grid: OptionBarAnchorGrid, tMs: number): boolean;
|
|
140
|
+
/** The latest instant at or before `tMs` a window may end at on a grid, so a window cut there ends with its last whole
|
|
141
|
+
* bar. */
|
|
142
|
+
export declare function optionGridFloorBoundaryMs(grid: OptionBarAnchorGrid, tMs: number): number;
|
|
143
|
+
/** The first instant at or after `tMs` a window may start or end at on a grid (`OptionReadGrid.Ceil`): `tMs` on a
|
|
144
|
+
* boundary, else the end of the bar (or session) holding it, or of the bar after it, until one ends on a boundary. */
|
|
145
|
+
export declare function optionGridCeilBoundaryMs(grid: OptionBarAnchorGrid, tMs: number): number;
|