@orangecharts/wrun-chart-host 0.16.0 → 0.17.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 +3 -5
- package/dist/constants/feature-flags.constants.js +24 -31
- package/dist/constants/feature-limits.constants.d.ts +2 -2
- package/dist/constants/feature-limits.constants.js +8 -6
- package/dist/constants/marketCapabilities.constants.d.ts +9 -0
- package/dist/constants/marketCapabilities.constants.js +39 -11
- package/dist/constants/typed-indicator-source.leaf.d.ts +7 -0
- package/dist/constants/typed-indicator-source.leaf.js +47 -0
- package/dist/constants/typed-session-history-venue.leaf.d.ts +7 -0
- package/dist/constants/typed-session-history-venue.leaf.js +9 -0
- package/dist/constants/typed-width-fold.leaf.d.ts +7 -5
- package/dist/constants/typed-width-fold.leaf.js +7 -5
- package/dist/host-ports.types.d.ts +12 -17
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +7 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +6 -3
- package/dist/settings-templates/indicator-fields.js +5 -0
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +2 -2
- package/dist/utility/chart/index-mode.util.js +12 -6
- package/dist/utility/chart/index-otc.leaf.d.ts +37 -0
- package/dist/utility/chart/index-otc.leaf.js +68 -0
- package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +19 -0
- package/dist/utility/chart/market-session-schedule.util.js +2 -1
- package/dist/utility/chart/marketKind.util.d.ts +10 -5
- package/dist/utility/chart/marketKind.util.js +39 -5
- package/dist/utility/chart/mixed-mode.util.d.ts +1 -0
- package/dist/utility/market-events/market-events.util.js +3 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
- package/dist/utility/v2/v2-enums.leaf.js +2 -0
- package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +2 -1
- package/dist/utility/wrun/sources/row-lanes/dark_pool.js +4 -3
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +6 -2
- package/dist/utility/wrun/wrun-batched-marks.util.js +37 -6
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +15 -8
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +11 -8
- package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +10 -6
- package/dist/utility/wrun/wrun-cme-root-specs.util.js +19 -13
- package/dist/utility/wrun/wrun-live-tick.util.js +5 -1
- package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +40 -6
- package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +2 -2
- package/dist/utility/wrun/wrun-market-size-defaults.util.js +10 -8
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +44 -8
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-pin-venues.util.js +6 -3
- package/dist/utility/wrun/wrun-run-health.util.js +1 -1
- package/dist/utility/wrun/wrun-session-composition.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-session-composition.util.js +3 -2
- package/package.json +5 -5
|
@@ -11,8 +11,9 @@ import type { CmeExchangeDto } from '../../interfaces/cme-realtime.interface.js'
|
|
|
11
11
|
export interface CmeRootSpec {
|
|
12
12
|
/** What the contract trades (a futures contract reports its underlying's kind). */
|
|
13
13
|
kind: WrunMarketKind;
|
|
14
|
+
/** US dollars per whole point of the quoted price, per contract, on every row (a cents-priced grain included). */
|
|
14
15
|
pointValue: number;
|
|
15
|
-
/** The
|
|
16
|
+
/** The unit of the PRICE the chart draws (US cents on the CBOT grains): never a unit of `pointValue`. */
|
|
16
17
|
quote: WrunMarketQuoteIsUsd;
|
|
17
18
|
/** The CME Group exchange the root lists on (its contracts and its options). */
|
|
18
19
|
exchange: CmeExchangeDto;
|
|
@@ -20,16 +21,19 @@ export interface CmeRootSpec {
|
|
|
20
21
|
/** Read-only outside this module: the market facts, the paper venue and the session's dollar lane read it. */
|
|
21
22
|
export declare const CME_ROOT_SPECS: Readonly<Record<string, Readonly<CmeRootSpec>>>;
|
|
22
23
|
/**
|
|
23
|
-
* The US dollars one contract of `root` is worth for one whole point of its quoted price
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* The US dollars one contract of `root` is worth for one whole point of its quoted price, for the DOLLAR FEATURES (the
|
|
25
|
+
* session's dollar lane, the live intake's dollar fold, the option multiplier): the root's point value
|
|
26
|
+
* (CME_ROOT_SPECS) when the root is priced in US dollars, so a print of `size` contracts at `price` is worth
|
|
27
|
+
* size x price x this. Undefined for a root off the table and for one priced in another unit (the CBOT grains, priced
|
|
28
|
+
* in US cents). That gate is a product decision, not a unit conversion: the point value is US dollars on every row,
|
|
29
|
+
* and the grains stay off these features until they are checked against real trades.
|
|
27
30
|
*/
|
|
28
31
|
export declare function wrunCmeRootDollarPointValue(root: string | null | undefined): number | undefined;
|
|
29
32
|
/**
|
|
30
33
|
* The dollar point value of a market's contract (`wrunCmeRootDollarPointValue` of its root: NQ1! and NQZ6 read NQ, 20)
|
|
31
34
|
* on a CME Group venue, where prints count contracts; null on a CME Group market none prices (an option contract, a
|
|
32
|
-
* root off the table, a cents-
|
|
35
|
+
* root off the table, a cents-priced grain: `wrunCmeRootDollarPointValue`), so its contracts are never valued in
|
|
36
|
+
* dollars there; undefined off the CME family,
|
|
33
37
|
* whose prints this rule says nothing about.
|
|
34
38
|
*/
|
|
35
39
|
export declare function wrunCmeDollarPointValue(market: {
|
|
@@ -16,6 +16,9 @@ export const CME_ROOT_SPECS = {
|
|
|
16
16
|
'6B': { kind: 'forex', pointValue: 62_500, quote: 'usd', exchange: 'CME' }, // 62,500 pounds: fx/g10/british-pound
|
|
17
17
|
'6J': { kind: 'forex', pointValue: 12_500_000, quote: 'usd', exchange: 'CME' }, // 12,500,000 yen: fx/g10/japanese-yen
|
|
18
18
|
'6C': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 CAD: fx/g10/canadian-dollar
|
|
19
|
+
'6A': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 AUD: fx/g10/australian-dollar
|
|
20
|
+
'6S': { kind: 'forex', pointValue: 125_000, quote: 'usd', exchange: 'CME' }, // 125,000 CHF: fx/g10/swiss-franc
|
|
21
|
+
'6N': { kind: 'forex', pointValue: 100_000, quote: 'usd', exchange: 'CME' }, // 100,000 NZD: fx/g10/new-zealand-dollar
|
|
19
22
|
// US Treasury futures, quoted in points of par (100): the face value / 100 per point.
|
|
20
23
|
ZT: { kind: 'unknown', pointValue: 2_000, quote: 'usd', exchange: 'CBOT' }, // $200,000 face: interest-rates/us-treasury/2-year-us-treasury-note
|
|
21
24
|
ZF: { kind: 'unknown', pointValue: 1_000, quote: 'usd', exchange: 'CBOT' }, // $100,000 face: interest-rates/us-treasury/5-year-us-treasury-note
|
|
@@ -37,14 +40,14 @@ export const CME_ROOT_SPECS = {
|
|
|
37
40
|
SIL: { kind: 'metal', pointValue: 1_000, quote: 'usd', exchange: 'COMEX' }, // 1,000 troy ounces: metals/precious/1000-oz-silver
|
|
38
41
|
HG: { kind: 'metal', pointValue: 25_000, quote: 'usd', exchange: 'COMEX' }, // 25,000 pounds: metals/base/copper
|
|
39
42
|
MHG: { kind: 'metal', pointValue: 2_500, quote: 'usd', exchange: 'COMEX' }, // 2,500 pounds: metals/base/micro-copper
|
|
40
|
-
// Grains (CBOT),
|
|
41
|
-
// draws (corn near 460
|
|
42
|
-
//
|
|
43
|
-
ZC: { kind: 'unknown', pointValue:
|
|
44
|
-
ZW: { kind: 'unknown', pointValue:
|
|
45
|
-
KE: { kind: 'unknown', pointValue:
|
|
46
|
-
ZS: { kind: 'unknown', pointValue:
|
|
47
|
-
ZL: { kind: 'unknown', pointValue:
|
|
43
|
+
// Grains (CBOT), priced in US cents per bushel (soybean oil per pound), the unit the chart
|
|
44
|
+
// draws (corn near 460; Pine reads `syminfo.currency` "USX" there, so `quote` is 'other').
|
|
45
|
+
// A whole point is one cent: the contract size x $0.01, in US dollars like every row.
|
|
46
|
+
ZC: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/grains/corn
|
|
47
|
+
ZW: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/grains/wheat
|
|
48
|
+
KE: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/grains/kc-wheat
|
|
49
|
+
ZS: { kind: 'unknown', pointValue: 50, quote: 'other', exchange: 'CBOT' }, // 5,000 bushels x $0.01: agriculture/oilseeds/soybean
|
|
50
|
+
ZL: { kind: 'unknown', pointValue: 600, quote: 'other', exchange: 'CBOT' }, // 60,000 pounds x $0.01: agriculture/oilseeds/soybean-oil
|
|
48
51
|
// Cryptocurrency futures (CME), quoted in US dollars per coin.
|
|
49
52
|
BTC: { kind: 'crypto', pointValue: 5, quote: 'usd', exchange: 'CME' }, // 5 bitcoin: cryptocurrencies/bitcoin/bitcoin
|
|
50
53
|
MBT: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 bitcoin: cryptocurrencies/bitcoin/micro-bitcoin
|
|
@@ -52,10 +55,12 @@ export const CME_ROOT_SPECS = {
|
|
|
52
55
|
MET: { kind: 'crypto', pointValue: 0.1, quote: 'usd', exchange: 'CME' }, // 0.1 ether: cryptocurrencies/ether/micro-ether
|
|
53
56
|
};
|
|
54
57
|
/**
|
|
55
|
-
* The US dollars one contract of `root` is worth for one whole point of its quoted price
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
58
|
+
* The US dollars one contract of `root` is worth for one whole point of its quoted price, for the DOLLAR FEATURES (the
|
|
59
|
+
* session's dollar lane, the live intake's dollar fold, the option multiplier): the root's point value
|
|
60
|
+
* (CME_ROOT_SPECS) when the root is priced in US dollars, so a print of `size` contracts at `price` is worth
|
|
61
|
+
* size x price x this. Undefined for a root off the table and for one priced in another unit (the CBOT grains, priced
|
|
62
|
+
* in US cents). That gate is a product decision, not a unit conversion: the point value is US dollars on every row,
|
|
63
|
+
* and the grains stay off these features until they are checked against real trades.
|
|
59
64
|
*/
|
|
60
65
|
export function wrunCmeRootDollarPointValue(root) {
|
|
61
66
|
if (typeof root !== 'string')
|
|
@@ -69,7 +74,8 @@ export function wrunCmeRootDollarPointValue(root) {
|
|
|
69
74
|
/**
|
|
70
75
|
* The dollar point value of a market's contract (`wrunCmeRootDollarPointValue` of its root: NQ1! and NQZ6 read NQ, 20)
|
|
71
76
|
* on a CME Group venue, where prints count contracts; null on a CME Group market none prices (an option contract, a
|
|
72
|
-
* root off the table, a cents-
|
|
77
|
+
* root off the table, a cents-priced grain: `wrunCmeRootDollarPointValue`), so its contracts are never valued in
|
|
78
|
+
* dollars there; undefined off the CME family,
|
|
73
79
|
* whose prints this rule says nothing about.
|
|
74
80
|
*/
|
|
75
81
|
export function wrunCmeDollarPointValue(market) {
|
|
@@ -5638,7 +5638,11 @@ function publishWrunDebugTick(context, outputRows) {
|
|
|
5638
5638
|
return;
|
|
5639
5639
|
const store = wrunChartHostEnv().chart.chartStore();
|
|
5640
5640
|
// The session's own console provenance (the run that installed it), never the chart's market now.
|
|
5641
|
-
store.setIndicatorPrintOutputs(context.chartIndex, context.indicatorId, selectWrunDebugLines(context.metadata, outputRows), {
|
|
5641
|
+
store.setIndicatorPrintOutputs(context.chartIndex, context.indicatorId, selectWrunDebugLines(context.metadata, outputRows), {
|
|
5642
|
+
opra: context.opraRead === true,
|
|
5643
|
+
...(context.cmeRead === true ? { cme: true } : {}),
|
|
5644
|
+
...(context.indexOtcRead === true ? { indexOtc: true } : {}),
|
|
5645
|
+
});
|
|
5642
5646
|
}
|
|
5643
5647
|
export function __resetWrunLiveTickForTests() {
|
|
5644
5648
|
for (const state of tickStates.values()) {
|
|
@@ -116,12 +116,38 @@ const VOLUME_COLUMN = 5;
|
|
|
116
116
|
const UNKNOWN_SIZE_UNIT = WRUN_MARKET_SIZE_UNITS.indexOf('unknown');
|
|
117
117
|
const COINS_SIZE_UNIT = WRUN_MARKET_SIZE_UNITS.indexOf('coins');
|
|
118
118
|
const CONTRACTS_SIZE_UNIT = WRUN_MARKET_SIZE_UNITS.indexOf('contracts');
|
|
119
|
+
/** A candle's length: the chart's interval, or where that is not known the smallest step between two of the candles
|
|
120
|
+
* (a step is never shorter than a candle). Infinity for rows with no step. */
|
|
121
|
+
function wrunCandleBarMs(rows, intervalMs) {
|
|
122
|
+
if (intervalMs !== undefined && Number.isFinite(intervalMs) && intervalMs > 0)
|
|
123
|
+
return intervalMs;
|
|
124
|
+
let smallest = Infinity;
|
|
125
|
+
for (let at = rows.length - 1; at > 0; at -= 1) {
|
|
126
|
+
const step = Number(rows[at][0]) - Number(rows[at - 1][0]);
|
|
127
|
+
if (step > 0 && step < smallest)
|
|
128
|
+
smallest = step;
|
|
129
|
+
}
|
|
130
|
+
return smallest;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* What the step between two candles counts for on the market's own clock (BT-CLOSED-DAYS): the step less the whole
|
|
134
|
+
* days of its idle part, the time after the earlier candle closed. A market that closes for whole days (a weekend, a
|
|
135
|
+
* holiday) reopens that many days late: a stock's weekend counts as its weeknight, a futures weekend as its daily
|
|
136
|
+
* break, a day chart's Friday to Monday as one day. Idle time under a day stays whole (a quiet market's own time, a
|
|
137
|
+
* nightly close), and so does the day between two day candles (no idle part).
|
|
138
|
+
*/
|
|
139
|
+
function wrunTradingClockStep(step, barMs) {
|
|
140
|
+
const idle = step - barMs;
|
|
141
|
+
return idle >= DAY_MS ? step - Math.floor(idle / DAY_MS) * DAY_MS : step;
|
|
142
|
+
}
|
|
119
143
|
/**
|
|
120
144
|
* A candle-volume measure per day, from the chart's own candles (ascending, the newest the forming one, which is left
|
|
121
145
|
* out: its volume is partial): `barValue` of the closed candles opening in the 24 hours before the newest one's open,
|
|
122
146
|
* summed and scaled to a day by the span they cover (a fine chart loads less than a day: 500 one-minute candles count
|
|
123
|
-
* 499 minutes; a gap where nothing traded counts as covered time with no volume).
|
|
124
|
-
* (
|
|
147
|
+
* 499 minutes; a gap where nothing traded counts as covered time with no volume). The 24 hours run on the market's
|
|
148
|
+
* own clock (`wrunTradingClockStep`): whole days it stood closed are no part of them, so the day read on a Monday
|
|
149
|
+
* morning is Friday afternoon and Monday morning, never Sunday. One closed candle longer than a day (1W, 1M) is
|
|
150
|
+
* prorated by its length, the gap to the next open held to the candle's length. Undefined when the closed candles
|
|
125
151
|
* cover under an hour or hold no volume.
|
|
126
152
|
*/
|
|
127
153
|
function wrunDailyCandleSum(rows, intervalMs, barValue) {
|
|
@@ -132,22 +158,30 @@ function wrunDailyCandleSum(rows, intervalMs, barValue) {
|
|
|
132
158
|
const lastClosedOpen = Number(rows[last - 1][0]);
|
|
133
159
|
if (!Number.isFinite(newestOpen) || !Number.isFinite(lastClosedOpen))
|
|
134
160
|
return undefined;
|
|
135
|
-
const barMs =
|
|
161
|
+
const barMs = wrunCandleBarMs(rows, intervalMs);
|
|
136
162
|
const lastSpan = Math.min(newestOpen - lastClosedOpen, barMs);
|
|
137
163
|
if (lastSpan > DAY_MS) {
|
|
138
164
|
const volume = barValue(rows[last - 1]);
|
|
139
165
|
return Number.isFinite(volume) && volume > 0 ? (volume * DAY_MS) / lastSpan : undefined;
|
|
140
166
|
}
|
|
141
|
-
|
|
167
|
+
// Walk back from the newest open, each candle placed by the clock time since it opened. The walk ends at the first
|
|
168
|
+
// candle that opened over a day before (the day is then whole), or at the oldest candle (the day is what they cover).
|
|
169
|
+
let covered = 0;
|
|
170
|
+
let whole = false;
|
|
142
171
|
let volume = 0;
|
|
143
172
|
for (let at = last - 1; at >= 0; at -= 1) {
|
|
144
|
-
|
|
173
|
+
const step = wrunTradingClockStep(Number(rows[at + 1][0]) - Number(rows[at][0]), barMs);
|
|
174
|
+
if (!(step >= 0 && covered + step <= DAY_MS)) {
|
|
175
|
+
whole = true;
|
|
145
176
|
break;
|
|
177
|
+
}
|
|
178
|
+
covered += step;
|
|
146
179
|
const bar = barValue(rows[at]);
|
|
147
180
|
if (Number.isFinite(bar) && bar > 0)
|
|
148
181
|
volume += bar;
|
|
149
182
|
}
|
|
150
|
-
|
|
183
|
+
if (whole)
|
|
184
|
+
covered = DAY_MS;
|
|
151
185
|
if (!(covered >= HOUR_MS) || !(volume > 0))
|
|
152
186
|
return undefined;
|
|
153
187
|
return (volume * DAY_MS) / covered;
|
|
@@ -70,8 +70,8 @@ interface WrunMarketSizeChart {
|
|
|
70
70
|
* now), and `isCurrent` says the run is still the overlay's own (its chart and mount stand). After each await, in the
|
|
71
71
|
* task that keeps and writes, the chart still names that market (a switch during the directory's answer moves it, and
|
|
72
72
|
* neither the mount nor the refusal attempt sees a switch), and the verdict that reads the candles reads them only
|
|
73
|
-
* while they were loaded for it (`
|
|
74
|
-
* its rows replace the old market's). A fact it cannot prove reads as a transient skip: no memo, no write.
|
|
73
|
+
* while they were loaded for it (the host's `mainRowsLoadedFor`: the symbol pipeline stamps the new market's metadata
|
|
74
|
+
* before its rows replace the old market's). A fact it cannot prove reads as a transient skip: no memo, no write.
|
|
75
75
|
*/
|
|
76
76
|
export declare function reconcileWrunMarketSizeDefaults(args: {
|
|
77
77
|
chartIndex: number;
|
|
@@ -247,8 +247,8 @@ function wrunMarketSizeUnprovenFacts(families) {
|
|
|
247
247
|
* now), and `isCurrent` says the run is still the overlay's own (its chart and mount stand). After each await, in the
|
|
248
248
|
* task that keeps and writes, the chart still names that market (a switch during the directory's answer moves it, and
|
|
249
249
|
* neither the mount nor the refusal attempt sees a switch), and the verdict that reads the candles reads them only
|
|
250
|
-
* while they were loaded for it (`
|
|
251
|
-
* its rows replace the old market's). A fact it cannot prove reads as a transient skip: no memo, no write.
|
|
250
|
+
* while they were loaded for it (the host's `mainRowsLoadedFor`: the symbol pipeline stamps the new market's metadata
|
|
251
|
+
* before its rows replace the old market's). A fact it cannot prove reads as a transient skip: no memo, no write.
|
|
252
252
|
*/
|
|
253
253
|
export async function reconcileWrunMarketSizeDefaults(args) {
|
|
254
254
|
const { chartIndex, indicatorId, tc, meta, sheet, market, isCurrent } = args;
|
|
@@ -311,8 +311,8 @@ export async function reconcileWrunMarketSizeDefaults(args) {
|
|
|
311
311
|
? wrunMarketSizeFactsNow(families, {
|
|
312
312
|
tc,
|
|
313
313
|
chartMetadata: market.read() ?? undefined,
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
// The host's own answer, for the chart as it reads now (`keyed()`: still the keyed market).
|
|
315
|
+
rowsOwn: dataFetching?.mainRowsLoadedFor(chartIndex, market.read()) ?? false,
|
|
316
316
|
ownCandles: formula === undefined,
|
|
317
317
|
exchange,
|
|
318
318
|
symbol,
|
|
@@ -477,12 +477,14 @@ function wrunChartFormulaOf(exchange, symbol, transformations) {
|
|
|
477
477
|
* The facts of the keyed market, read in the caller's task once the chart is proven on that market: the size unit once
|
|
478
478
|
* the directory placed it, the venue's candle volume unit (`ownCandles`: a formula chart's candles are no market's),
|
|
479
479
|
* the market's dollar unit (the market facts, `wrunMarketDollarUnit`), and the chart's own candles while they were
|
|
480
|
-
* loaded for the keyed market (`
|
|
481
|
-
*
|
|
482
|
-
*
|
|
480
|
+
* loaded for the keyed market (`rowsOwn`: the host's answer, its data-fetching port's `mainRowsLoadedFor`; the package
|
|
481
|
+
* never compares the market's spelling with the loader's itself, since a US stock on Trades reads its tape's candles
|
|
482
|
+
* and the two never match there). Candles loaded for another market are never read: the volume verdict that would
|
|
483
|
+
* read them reads `unproven` (the candles not yet the market's own, never its own too few), and no carry prices with
|
|
484
|
+
* them. The option verdict reads no candles, so it stands then.
|
|
483
485
|
*/
|
|
484
486
|
function wrunMarketSizeFactsNow(families, facts) {
|
|
485
|
-
const rowsOwn = facts
|
|
487
|
+
const { rowsOwn } = facts;
|
|
486
488
|
const rows = rowsOwn && (families.volume !== undefined || families.coins !== undefined)
|
|
487
489
|
? wrunChartCandleRows(facts.tc)
|
|
488
490
|
: [];
|
|
@@ -350,6 +350,9 @@ export interface WrunOverlayLiveContext {
|
|
|
350
350
|
* chart, or one whose lanes read the CME plane): every debug line its ticks and reseeds publish states it. No
|
|
351
351
|
* cloud frame raises it (the Cloud lane never reads CME). */
|
|
352
352
|
cmeRead?: true;
|
|
353
|
+
/** The session reads the index and yield venue's data (the console provenance of the run that installed it,
|
|
354
|
+
* `computed.indexOtc`): every debug line its ticks and reseeds publish states it. No cloud frame raises it. */
|
|
355
|
+
indexOtcRead?: true;
|
|
353
356
|
/** The delayed CME legs its legend names (the installing run's `computed.cmeDelayed`). */
|
|
354
357
|
cmeDelayed?: ReadonlyArray<{
|
|
355
358
|
symbol: string;
|
|
@@ -275,6 +275,8 @@ export declare function surfaceWrunRunFailureOnLegend(chartIndex: number, indica
|
|
|
275
275
|
opra?: boolean;
|
|
276
276
|
/** The same for the CME plane (`computed.cme`): its runtime trap row carries the CME mark. */
|
|
277
277
|
cme?: boolean;
|
|
278
|
+
/** The same for the index and yield venue (`computed.indexOtc`): its runtime trap row carries the venue's mark. */
|
|
279
|
+
indexOtc?: boolean;
|
|
278
280
|
/** The run's refusal context (the run pass builds it from the chart it ran on). */
|
|
279
281
|
refusalContext?: WrunRefusalContext;
|
|
280
282
|
/** The attempt token the run resolved before its first await; absent or null: no toast. */
|
|
@@ -201,7 +201,8 @@ import { awaitWrunChildOverlays, mountWrunChildOverlays, prepareWrunHeatmapWindo
|
|
|
201
201
|
import { planWrunFormingPreRoll, planWrunIntrabarLegFetch, planWrunLegFetch, wrunClampedLegDiagnostics, wrunIntrabarServedNotes, wrunLegFetchReads, WRUN_COARSER_LEG_WARMUP_CANDLES, } from './wrun-leg-fetch.util.js';
|
|
202
202
|
import { barEndMs, isCalendarIntervalLabel } from '../chart/calendar-interval.util.js';
|
|
203
203
|
import { wrunCandlesLowAcross, wrunCoinTapeDayAsk, wrunCoinTapeWindow, wrunHeldCoinTapePriceLow, wrunPricedCoinTape, wrunTapeReadIdentity, WRUN_TAPE_COINS_DAY_INTERVAL, WRUN_TAPE_COINS_DAY_MS, } from './wrun-tape-coins.util.js';
|
|
204
|
-
import { normalizeTransformations, selfTransformationToken } from '../common/transformations.util.js';
|
|
204
|
+
import { normalizeTransformations, selfTransformationToken, transformationsTouchVenue, } from '../common/transformations.util.js';
|
|
205
|
+
import { checkIsIndexOtc } from '../chart/index-otc.leaf.js';
|
|
205
206
|
import { resolveWrunTapeAcquisition, WRUN_TAPE_COINS_UNPRICED_CODE, WRUN_TAPE_INTERVAL_UNSUPPORTED_CODE, WRUN_TAPE_TOO_MANY_TRADES_CODE, WRUN_TAPE_VALUE_UNPROVEN_CODE, wrunTapeAcquisitionFloor, wrunTapeFloorOf, wrunTapeFloorSettingWords, wrunTapeFloorSettings, wrunTapeFloorWords, wrunTapeLaneExtras, } from './wrun-tape-source.util.js';
|
|
206
207
|
import { wrunChartSession, wrunLegCandleClose, wrunPrimaryRowBounds } from './wrun-leg-close.util.js';
|
|
207
208
|
import { isWrunRowSourceTransientError, wrunRowBatchDeliveredSheet, wrunRowSourceSettingsLeftBy, } from './wrun-row-source.js';
|
|
@@ -526,6 +527,12 @@ export async function runWrunOverlayOnChart(target) {
|
|
|
526
527
|
// is the output's provenance, never a permission).
|
|
527
528
|
if (payloadTouchesCmeVenue(chartExchange))
|
|
528
529
|
computed.cme = true;
|
|
530
|
+
// The same on the index and yield venue (`computed.indexOtc`): every run whose chart market, or a formula leg of
|
|
531
|
+
// it, is on the venue reads its candles, and the venue's licence is display only.
|
|
532
|
+
if (wrunTouchesIndexOtc(chartExchange) ||
|
|
533
|
+
transformationsTouchVenue(chartMetadata?.transformations, checkIsIndexOtc)) {
|
|
534
|
+
computed.indexOtc = true;
|
|
535
|
+
}
|
|
529
536
|
// A run reading options decides its ONE options market here (derived-roots.util `decideWrunRunOptionsMarket`):
|
|
530
537
|
// where the options list on OPRA (a stock, an OPRA contract, a known stock twin) or the overlay's last read was
|
|
531
538
|
// OPRA's (its provenance stamp), it waits, bounded, for the `opra` flag the plane and its stop reasons are judged
|
|
@@ -843,6 +850,7 @@ export async function runWrunOverlayOnChart(target) {
|
|
|
843
850
|
outputNames,
|
|
844
851
|
opra: computed.opra === true,
|
|
845
852
|
cme: computed.cme === true,
|
|
853
|
+
indexOtc: computed.indexOtc === true,
|
|
846
854
|
refusalContext: refusal.ctx,
|
|
847
855
|
token: refusalAttempt,
|
|
848
856
|
isCurrent,
|
|
@@ -988,10 +996,19 @@ function assertWrunCmeStudyAuthCurrent(computed, indicatorId) {
|
|
|
988
996
|
new WrunChartGoneError(`wrun overlay '${indicatorId}' was superseded during its run (cme-lanes)`));
|
|
989
997
|
}
|
|
990
998
|
}
|
|
991
|
-
/** The console provenance a run's outputs carry (`setIndicatorPrintOutputs`): its OPRA fact always, its CME
|
|
992
|
-
* when set, so an output of a run that read
|
|
999
|
+
/** The console provenance a run's outputs carry (`setIndicatorPrintOutputs`): its OPRA fact always, its CME and index
|
|
1000
|
+
* venue facts only when set, so an output of a run that read neither reads exactly as before. */
|
|
993
1001
|
function wrunRunOutputProvenance(computed) {
|
|
994
|
-
return {
|
|
1002
|
+
return {
|
|
1003
|
+
opra: computed.opra === true,
|
|
1004
|
+
...(computed.cme === true ? { cme: true } : {}),
|
|
1005
|
+
...(computed.indexOtc === true ? { indexOtc: true } : {}),
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
1008
|
+
/** Whether a source exchange is on the index and yield venue (index-otc.leaf `checkIsIndexOtc`), in either form the
|
|
1009
|
+
* run head reads (a string, or the multi-exchange array: any leg on the venue). */
|
|
1010
|
+
function wrunTouchesIndexOtc(exchange) {
|
|
1011
|
+
return (Array.isArray(exchange) ? exchange : [exchange]).some((entry) => typeof entry === 'string' && checkIsIndexOtc(entry));
|
|
995
1012
|
}
|
|
996
1013
|
/** Whether a venue refusal is the display wall's (its painter stamped the one standing legend message, so the run
|
|
997
1014
|
* adds no record, chip or console row of its own): every `WrunVenueBlockedError` but the strategy and the
|
|
@@ -1021,15 +1038,16 @@ export function wrunTrapRowWithReplayToken(trap, error, overlay) {
|
|
|
1021
1038
|
details: { ...trap.details, trap: { ...record, token: parkWrunTrapSeed(seed, overlay.indicatorId) } },
|
|
1022
1039
|
};
|
|
1023
1040
|
}
|
|
1024
|
-
/** A run's runtime trap row with the run's console provenance on it (`RuntimeDiagnostic.opra
|
|
1025
|
-
* it is for a run that read
|
|
1041
|
+
/** A run's runtime trap row with the run's console provenance on it (`RuntimeDiagnostic.opra`, `.cme` and
|
|
1042
|
+
* `.indexOtc`): the row as it is for a run that read none of them. */
|
|
1026
1043
|
function wrunTrapRowWithProvenance(trap, provenance) {
|
|
1027
|
-
if (provenance.opra !== true && provenance.cme !== true)
|
|
1044
|
+
if (provenance.opra !== true && provenance.cme !== true && provenance.indexOtc !== true)
|
|
1028
1045
|
return trap;
|
|
1029
1046
|
return {
|
|
1030
1047
|
...trap,
|
|
1031
1048
|
...(provenance.opra === true ? { opra: true } : {}),
|
|
1032
1049
|
...(provenance.cme === true ? { cme: true } : {}),
|
|
1050
|
+
...(provenance.indexOtc === true ? { indexOtc: true } : {}),
|
|
1033
1051
|
};
|
|
1034
1052
|
}
|
|
1035
1053
|
/**
|
|
@@ -1287,6 +1305,12 @@ function wrunPinReadsCme(market) {
|
|
|
1287
1305
|
return false;
|
|
1288
1306
|
return wrunPinMarketsOf(market.exchange ?? '', market.symbol ?? '').some((leg) => payloadTouchesCmeVenue(leg.exchange));
|
|
1289
1307
|
}
|
|
1308
|
+
/** Whether a pin names a market on the index and yield venue (`wrunPinReadsOpra`'s twin, index-otc.leaf). */
|
|
1309
|
+
function wrunPinReadsIndexOtc(market) {
|
|
1310
|
+
if (market === undefined)
|
|
1311
|
+
return false;
|
|
1312
|
+
return wrunPinMarketsOf(market.exchange ?? '', market.symbol ?? '').some((leg) => checkIsIndexOtc(leg.exchange));
|
|
1313
|
+
}
|
|
1290
1314
|
/**
|
|
1291
1315
|
* Whether the sheet a run reads (its settings painted, its lane demand applied) pins a CME market: a secondary input's
|
|
1292
1316
|
* pinned market (an ohlcv or leg-stream pin, a trades leg, a coin leg's venue) on the CME plane (`wrunPinReadsCme`), or
|
|
@@ -3291,7 +3315,8 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
|
|
|
3291
3315
|
// a stock listing: wrun_pin_venue_unknown, a failed run, whether the sheet,
|
|
3292
3316
|
// a default or a saved pick names it); a pin on an index venue the
|
|
3293
3317
|
// gateway serves no series for to
|
|
3294
|
-
// scripts yet (
|
|
3318
|
+
// scripts yet (WRUN_PIN_UNSERVED_EXCHANGES: the index and yield venue)
|
|
3319
|
+
// is not servable, but it is no reason to
|
|
3295
3320
|
// kill the run: it is SOFT-refused per input. The leg is never fetched,
|
|
3296
3321
|
// never enters the live context (no reconcile asks for it), and every
|
|
3297
3322
|
// input served off it reads its missing fill on every row (NaN under
|
|
@@ -3466,6 +3491,14 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
|
|
|
3466
3491
|
if (delayed !== undefined)
|
|
3467
3492
|
computed.cmeDelayed = delayed;
|
|
3468
3493
|
}
|
|
3494
|
+
// The same for a leg on the index and yield venue (`computed.indexOtc`): a leg the run admitted reads its data, on
|
|
3495
|
+
// any chart. A pin there is soft-refused today (`WRUN_PIN_UNSERVED_EXCHANGES`) and never asked; the mark stands
|
|
3496
|
+
// ready for the day the gateway serves it.
|
|
3497
|
+
if (legs.some((leg) => wrunPinReadsIndexOtc(leg.market)) ||
|
|
3498
|
+
tradeLegLanes.some((lane) => !softRefusedTradeLegs.has(lane) && wrunPinReadsIndexOtc(wrunTradesLegOf(lane))) ||
|
|
3499
|
+
pinnedLaneIds.some((lane) => !softRefusedPinnedLanes.has(lane) && wrunPinReadsIndexOtc(wrunPinnedLaneOf(lane)))) {
|
|
3500
|
+
computed.indexOtc = true;
|
|
3501
|
+
}
|
|
3469
3502
|
const formingBarTs = live && replay === undefined && wrunLandsLegsOnBars(legs, tradeLegLanes)
|
|
3470
3503
|
? await wrunFormingBarTsOf(target.chartIndex, clock.intervalMs, chartMetadata)
|
|
3471
3504
|
: null;
|
|
@@ -6659,6 +6692,7 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
|
|
|
6659
6692
|
// The run's console provenance: every debug line the session's ticks and reseeds publish states it.
|
|
6660
6693
|
...(computed.opra === true ? { opraRead: true } : {}),
|
|
6661
6694
|
...(computed.cme === true ? { cmeRead: true } : {}),
|
|
6695
|
+
...(computed.indexOtc === true ? { indexOtcRead: true } : {}),
|
|
6662
6696
|
// The delayed CME legs its legend names: every tick and reseed names them alike.
|
|
6663
6697
|
...(computed.cmeDelayed !== undefined ? { cmeDelayed: computed.cmeDelayed } : {}),
|
|
6664
6698
|
// The current paint (above): the ticks and the reseeds keep the look.
|
|
@@ -7622,6 +7656,7 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
|
|
|
7622
7656
|
// The run's console provenance: every debug line the session's ticks publish states it.
|
|
7623
7657
|
...(computed.opra === true ? { opraRead: true } : {}),
|
|
7624
7658
|
...(computed.cme === true ? { cmeRead: true } : {}),
|
|
7659
|
+
...(computed.indexOtc === true ? { indexOtcRead: true } : {}),
|
|
7625
7660
|
carrySeed: emptyWrunInputCarry(),
|
|
7626
7661
|
fedBuckets: {},
|
|
7627
7662
|
pushEligible: false,
|
|
@@ -9324,6 +9359,7 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
|
|
|
9324
9359
|
await publishWrunDebugOutput(context.chartIndex, indicatorId, context.metadata, outputRows, {
|
|
9325
9360
|
opra: context.opraRead === true,
|
|
9326
9361
|
...(context.cmeRead === true ? { cme: true } : {}),
|
|
9362
|
+
...(context.indexOtcRead === true ? { indexOtc: true } : {}),
|
|
9327
9363
|
});
|
|
9328
9364
|
try {
|
|
9329
9365
|
// The canvas fill (G1) for the session's market; a mirror entry that aged
|
|
@@ -4,8 +4,9 @@ import type { WrunUnservedLeg } from './wrun-run-health.util.js';
|
|
|
4
4
|
import type { WrunPinnedLeg, WrunPinnedWire } from './wrun-source-rows.util.js';
|
|
5
5
|
/** The venues the gateway serves no series for to scripts yet: a pin on one is soft-refused per
|
|
6
6
|
* input with a `WRUN_LEG_UNSERVED` row naming why (never silently NaN). Remove a venue here the
|
|
7
|
-
* moment the gateway lists it; nothing else gates it.
|
|
8
|
-
|
|
7
|
+
* moment the gateway lists it; nothing else gates it. POLYGON_INDICES is retired and stays: a
|
|
8
|
+
* script saved with a pin on it must keep reading unserved, never unknown. */
|
|
9
|
+
export declare const WRUN_PIN_UNSERVED_EXCHANGES: readonly ["POLYGON_INDICES", "INDICES_OTC"];
|
|
9
10
|
/** A pin on a venue word the chart's lanes cannot ask (`wrunPinVenueVerdict` 'unknown'): the sheet
|
|
10
11
|
* contract's code (om's WRUN_PIN_VENUE_UNKNOWN_CODE; the shared host this chart loads does not
|
|
11
12
|
* carry it yet), refused before any fetch as a failed run. */
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* on a session venue (`wrun_pin_session_interval_unserved`: a 3d candle there groups trading days
|
|
18
18
|
* and would be confirmed early). An own-market leg carries no `market` and is never a pin (the
|
|
19
19
|
* display wall decides the chart's own venue, `isKScriptDisplayBlockedOnExchange`).
|
|
20
|
-
* - An index venue (`WRUN_PIN_UNSERVED_EXCHANGES`:
|
|
20
|
+
* - An index venue (`WRUN_PIN_UNSERVED_EXCHANGES`: the index and yield venue, and the retired
|
|
21
|
+
* POLYGON_INDICES so a saved pin on it stays unserved) is UNSERVED until the data
|
|
21
22
|
* service serves index series to scripts (WRUN-CAPS-BACKEND-REQUEST.md, ask 2a: the directory
|
|
22
23
|
* still holds the index rows out): the leg is soft-refused per input the way the lane refusals
|
|
23
24
|
* are, never fetched, never in the live context, its inputs reading their missing fill while a
|
|
@@ -54,6 +55,7 @@ import { Exchange } from '@orangecharts/orange-v2-pb-common';
|
|
|
54
55
|
import { delimiter } from '../../constants/data-source.constants.js';
|
|
55
56
|
import { Intervals } from '../../constants/interval.constants.js';
|
|
56
57
|
import { checkIsIndexMode } from '../chart/index-mode.util.js';
|
|
58
|
+
import { INDEX_OTC_EXCHANGES } from '../chart/index-otc.leaf.js';
|
|
57
59
|
import { PUBLISHER_ONLY_EXCHANGES } from '../../constants/economic.constants.js';
|
|
58
60
|
import { normalizeLegacyExchange } from '../chart/legacy-exchange.leaf.js';
|
|
59
61
|
import { extractTokensFromTransformations, parsedTransformations } from '../common/transformations.util.js';
|
|
@@ -61,8 +63,9 @@ import { wrunChartHostEnv } from '../../host-env.js';
|
|
|
61
63
|
import { attachWrunRefusal, wrunAuthorRuleSeed } from './wrun-refusal.util.js';
|
|
62
64
|
/** The venues the gateway serves no series for to scripts yet: a pin on one is soft-refused per
|
|
63
65
|
* input with a `WRUN_LEG_UNSERVED` row naming why (never silently NaN). Remove a venue here the
|
|
64
|
-
* moment the gateway lists it; nothing else gates it.
|
|
65
|
-
|
|
66
|
+
* moment the gateway lists it; nothing else gates it. POLYGON_INDICES is retired and stays: a
|
|
67
|
+
* script saved with a pin on it must keep reading unserved, never unknown. */
|
|
68
|
+
export const WRUN_PIN_UNSERVED_EXCHANGES = ['POLYGON_INDICES', ...INDEX_OTC_EXCHANGES];
|
|
66
69
|
/** A pin on a venue word the chart's lanes cannot ask (`wrunPinVenueVerdict` 'unknown'): the sheet
|
|
67
70
|
* contract's code (om's WRUN_PIN_VENUE_UNKNOWN_CODE; the shared host this chart loads does not
|
|
68
71
|
* carry it yet), refused before any fetch as a failed run. */
|
|
@@ -117,7 +117,7 @@ export function wrunFeedMissingDiagnostics(feeds, ctx) {
|
|
|
117
117
|
/** The technical words of one input on an unserved leg: the alerts engine's for the same refusal
|
|
118
118
|
* (its wrun-input-plan), so a script reads one reason on every host. */
|
|
119
119
|
function unservedInputMessage(input, leg) {
|
|
120
|
-
return (`Input '${input}' pins ${leg.symbol} on ${leg.exchange}; index
|
|
120
|
+
return (`Input '${input}' pins ${leg.symbol} on ${leg.exchange}; index and yield series are not served yet: ` +
|
|
121
121
|
`the gateway holds ${leg.exchange} out of the market directory until the backend opens it, ` +
|
|
122
122
|
`so the input reads its missing fill (NaN) on every bar.`);
|
|
123
123
|
}
|
|
@@ -26,9 +26,10 @@ export interface WrunSessionLanesView {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The one rule for the dollar lane: the US dollars one contract of the chart's market is worth per whole point of its
|
|
29
|
-
* price (CME_ROOT_SPECS: NQ1! and NQZ6 read NQ, 20) on a CME Group futures market whose root is
|
|
29
|
+
* price (CME_ROOT_SPECS: NQ1! and NQZ6 read NQ, 20) on a CME Group futures market whose root is priced in US dollars,
|
|
30
30
|
* so a side of a session-fed bar prices at contracts x this x (high + low + close) / 3. Undefined everywhere else (a
|
|
31
|
-
* root off the table, a cents-
|
|
31
|
+
* root off the table, a cents-priced grain kept off the dollar features, an option contract, a market off the CME
|
|
32
|
+
* family): a script declaring the
|
|
32
33
|
* dollar lane there is ineligible and reads OpenMarket's rows whole.
|
|
33
34
|
*/
|
|
34
35
|
export declare function wrunSessionDollarPointValue(market: WrunSessionLanesView['market']): number | undefined;
|
|
@@ -26,9 +26,10 @@ function asksOwnMarket(acquisition, market) {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The one rule for the dollar lane: the US dollars one contract of the chart's market is worth per whole point of its
|
|
29
|
-
* price (CME_ROOT_SPECS: NQ1! and NQZ6 read NQ, 20) on a CME Group futures market whose root is
|
|
29
|
+
* price (CME_ROOT_SPECS: NQ1! and NQZ6 read NQ, 20) on a CME Group futures market whose root is priced in US dollars,
|
|
30
30
|
* so a side of a session-fed bar prices at contracts x this x (high + low + close) / 3. Undefined everywhere else (a
|
|
31
|
-
* root off the table, a cents-
|
|
31
|
+
* root off the table, a cents-priced grain kept off the dollar features, an option contract, a market off the CME
|
|
32
|
+
* family): a script declaring the
|
|
32
33
|
* dollar lane there is ineligible and reads OpenMarket's rows whole.
|
|
33
34
|
*/
|
|
34
35
|
export function wrunSessionDollarPointValue(market) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangecharts/wrun-chart-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The wrun chart-host layer shared by the kiyotaka web app and the mobile app: the wrun result reader and painter model, cut from the web app (its reference implementation).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@orangecharts/indicator-kit": "0.
|
|
27
|
-
"@orangecharts/orange-v2-pb-common": "12.
|
|
26
|
+
"@orangecharts/indicator-kit": "0.121.0",
|
|
27
|
+
"@orangecharts/orange-v2-pb-common": "12.86.0",
|
|
28
28
|
"dayjs": "1.11.23",
|
|
29
29
|
"lodash-es": "4.18.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@orangecharts/indicator-kit": "0.
|
|
33
|
-
"@orangecharts/orange-v2-pb-common": "12.
|
|
32
|
+
"@orangecharts/indicator-kit": "0.121.0",
|
|
33
|
+
"@orangecharts/orange-v2-pb-common": "12.86.0",
|
|
34
34
|
"@types/lodash-es": "4.17.12",
|
|
35
35
|
"dayjs": "1.11.23",
|
|
36
36
|
"lodash-es": "4.18.1",
|