@tradecanvas/chart 1.70.0 → 1.71.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/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, g as l, h as u, i as ee, l as te, m as ne, n as re, o as ie, p as ae, r as oe, s as se, t as ce, u as le, v as ue, w as de, x as fe, y as pe } from "./LayoutSession-Bcy79w0l.js";
1
+ import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, g as l, h as u, i as ee, l as te, m as ne, n as re, o as ie, p as ae, r as oe, s as se, t as ce, u as le, v as ue, w as de, x as fe, y as pe } from "./LayoutSession-BOQCN6yY.js";
2
2
  import { CHART_STYLE_KEYS as me, DARK_PRICE_LIMITS as he, DARK_TERMINAL as ge, DARK_THEME as _e, DARK_THEME as ve, DEFAULT_DRAWING_STYLE as ye, DEFAULT_FONT_FAMILY as be, DEFAULT_RECONNECT as xe, DEFAULT_SIGNAL_STYLE as Se, DEFAULT_STREAM_CONFIG as Ce, DEFAULT_TIMEFRAME_FAVORITES as we, DEFAULT_TRADE_ZONE_STYLE as Te, DEFAULT_TRADING_CONFIG as Ee, HNX_SESSIONS as d, HOSE_SESSIONS as f, KRX_SESSIONS as p, KR_COLORS as m, LIGHT_PRICE_LIMITS as h, LIGHT_THEME as g, LIGHT_THEME as _, MARKET_CRYPTO as v, MARKET_HNX as y, MARKET_HOSE as b, MARKET_HOSE_ETF as x, MARKET_KRX as S, MARKET_NXT as C, MARKET_NYSE as w, MARKET_UPBIT_KRW as T, MARKET_UPCOM as E, MARKET_VN30F as D, MS_TIME_THRESHOLD as De, NXT_SESSIONS as Oe, PRICE_SOURCES as ke, SANS_FONT_FAMILY as Ae, TC_PALETTE as je, TC_SERIES_COLORS as Me, TIMEFRAMES_CRYPTO as Ne, TIMEFRAMES_FOREX as Pe, TIMEFRAMES_STOCK as Fe, UPCOM_SESSIONS as Ie, VN30F_SESSIONS as Le, VN_COLORS as Re, VOLUME_ALPHA as ze, barTimeUnit as Be, barsAreDaily as Ve, computePriceLimits as He, contrastRatio as Ue, createMarketTheme as We, createVNTheme as Ge, formatFraction as Ke, formatNumber as qe, formatVND as Je, formatVolumeLoc as Ye, fractionTick as Xe, getCurrentSession as Ze, getLocale as Qe, indicatorSource as $e, inkOn as et, isPriceSource as tt, isTimeFrame as nt, isValidTimeZone as rt, marketStatus as it, normalizeBar as at, normalizeBarTime as ot, offsetAt as st, parseIndicatorSource as ct, parseTimeframe as lt, pickBaseTimeframe as ut, priceFormatterFor as dt, priceStepAt as ft, rankSymbols as pt, readNews as mt, readQuote as ht, readableOn as gt, registerLocale as _t, resampleBars as vt, roundToPriceStep as yt, scaleMarketPrices as bt, setLocale as xt, sourcePrice as St, stepDecimals as Ct, symbolTimeZone as wt, t as Tt, tickBarCount as Et, timeframeBucketStart as Dt, timeframeBucketStart as Ot, timeframeToMs as kt, usesKoreanUnits as At, vn30fContracts as jt, vn30fLastTradingDay as Mt, volumeColor as Nt, wallToUtc as Pt, zoneOffsetMinutes as Ft } from "@tradecanvas/commons";
3
- import { AlertManager as It, Animator as Lt, BarCountdown as Rt, BaseFinanceChart as O, BinanceAdapter as zt, BybitAdapter as Bt, CANDLE_PATTERNS as Vt, ChartLegend as Ht, ChartStateManager as Ut, CoinbaseAdapter as Wt, CompareRenderer as Gt, CrosshairTooltip as Kt, CurrentPriceLine as qt, DEFAULT_LEGEND_CONFIG as Jt, DEFAULT_MAX_WEBGL_CHARTS as Yt, DEFAULT_SESSION_HOURS as Xt, DataExporter as Zt, DrawingBase as Qt, Easing as $t, FinanceCrosshair as k, GROUP_HEADER as en, INDICATOR_CATEGORIES as tn, IndicatorBase as nn, IndicatorValueMap as rn, KEPT_BUCKETS as an, KeyboardHandler as on, KrakenAdapter as sn, MAX_ALERT_BARS as cn, MIN_ALERT_BARS as ln, ManualFeed as un, MockAdapter as dn, PaperExecutionAdapter as fn, PollingAdapter as pn, RANGE_PRESETS as mn, ReconnectManager as hn, ReplayController as gn, ReplayManager as _n, ResamplingAdapter as vn, ReshapeMemo as yn, Screenshot as bn, SessionBreaks as xn, SessionShading as Sn, SignalMarkerManager as A, StreamManager as Cn, TickAggregator as wn, TickBarAdapter as Tn, TickBarBuilder as En, TradeZoneManager as Dn, UndoRedoManager as On, UpbitAdapter as kn, VolumeRenderer as An, Watermark as jn, WebSocketAdapter as Mn, adapterFromFeed as Nn, axisTimes as Pn, barIndexToTime as Fn, barIndexToX as In, barIndexToX as j, canvasMeasure as Ln, computeBarLayout as Rn, computeCalendarLayout as zn, computeCounterClockLayout as Bn, computeDonutLayout as Vn, computeHistogramLayout as Hn, computeMatrixLayout as Un, computeScatterLayout as Wn, correlationMatrix as Gn, counterClockPhase as Kn, counterClockPhase as qn, counterClockPoints as Jn, counterClockPoints as Yn, detectCandlePatterns as Xn, feedFromAdapter as Zn, formatTooltipTime as Qn, histogramBins as $n, hitBar as M, hitDay as N, hitMatrixCell as P, hitSlice as F, indicatorCategory as er, isDataFeed as tr, isDataFeed as nr, isPriceLevelAlert as rr, layoutGroupedTreemap as ir, layoutSquarifiedTreemap as ar, layoutUniformGrid as or, lttbDownsample as sr, lttbVisibleIndices as cr, nearestCounterClockPoint as I, nearestPoint as L, niceScale as lr, priceToY as ur, priceToYMapper as dr, priceToYMapper as fr, rangePresetStart as pr, renderBarChart as mr, renderCalendar as hr, renderCounterClock as gr, renderDepthChart as _r, renderDonut as vr, renderEquityCurve as yr, renderGauge as br, renderHeatmap as xr, renderHistogram as Sr, renderMatrix as Cr, renderScatter as wr, renderSparkline as Tr, renderWaterfall as Er, servesTimeframe as Dr, setMaxWebGLCharts as Or, shownCount as kr, timeToX as Ar, timestampToBarIndex as jr, timestampToBarIndex as Mr, toHeikinAshi as Nr, toKagi as Pr, toLineBreak as Fr, toPointAndFigure as Ir, toRangeBars as Lr, toRenko as Rr, withResampling as zr, withTickBars as Br, xToBarIndex as Vr, xToBarIndex as R, xToTime as Hr, yToPrice as Ur, yToPrice as Wr } from "@tradecanvas/core";
3
+ import { AlertManager as It, Animator as Lt, BarCountdown as Rt, BaseFinanceChart as O, BinanceAdapter as zt, BybitAdapter as Bt, CANDLE_PATTERNS as Vt, ChartLegend as Ht, ChartStateManager as Ut, CoinbaseAdapter as Wt, CompareRenderer as Gt, CrosshairTooltip as Kt, CurrentPriceLine as qt, DEFAULT_LEGEND_CONFIG as Jt, DEFAULT_MAX_WEBGL_CHARTS as Yt, DEFAULT_SESSION_HOURS as Xt, DataExporter as Zt, DrawingBase as Qt, Easing as $t, FinanceCrosshair as k, GROUP_HEADER as en, INDICATOR_CATEGORIES as tn, IndicatorBase as nn, IndicatorValueMap as rn, KEPT_BUCKETS as an, KeyboardHandler as on, KrakenAdapter as sn, MAX_ALERT_BARS as cn, MIN_ALERT_BARS as ln, ManualFeed as un, MockAdapter as dn, PaperExecutionAdapter as fn, PollingAdapter as pn, RANGE_PRESETS as mn, ReconnectManager as hn, ReplayController as gn, ReplayManager as _n, ResamplingAdapter as vn, ReshapeMemo as yn, Screenshot as bn, SessionBreaks as xn, SessionShading as Sn, SignalMarkerManager as A, StreamManager as Cn, TickAggregator as wn, TickBarAdapter as Tn, TickBarBuilder as En, TradeZoneManager as Dn, UndoRedoManager as On, UpbitAdapter as kn, VolumeRenderer as An, Watermark as jn, WebSocketAdapter as Mn, adapterFromFeed as Nn, axisTimes as Pn, barIndexToTime as Fn, barIndexToX as In, barIndexToX as j, canvasMeasure as Ln, computeBarLayout as Rn, computeCalendarLayout as zn, computeCounterClockLayout as Bn, computeDonutLayout as Vn, computeHistogramLayout as Hn, computeMatrixLayout as Un, computeScatterLayout as Wn, correlationMatrix as Gn, counterClockPhase as Kn, counterClockPhase as qn, counterClockPoints as Jn, counterClockPoints as Yn, describeInputs as Xn, detectCandlePatterns as Zn, feedFromAdapter as Qn, formatTooltipTime as $n, histogramBins as er, hitBar as M, hitDay as N, hitMatrixCell as P, hitSlice as F, indicatorCategory as tr, isDataFeed as nr, isDataFeed as rr, isPriceLevelAlert as ir, layoutGroupedTreemap as ar, layoutSquarifiedTreemap as or, layoutUniformGrid as sr, lttbDownsample as cr, lttbVisibleIndices as lr, nearestCounterClockPoint as I, nearestPoint as L, niceScale as ur, priceToY as dr, priceToYMapper as fr, priceToYMapper as pr, rangePresetStart as mr, renderBarChart as hr, renderCalendar as gr, renderCounterClock as _r, renderDepthChart as vr, renderDonut as yr, renderEquityCurve as br, renderGauge as xr, renderHeatmap as Sr, renderHistogram as Cr, renderMatrix as wr, renderScatter as Tr, renderSparkline as Er, renderWaterfall as Dr, servesTimeframe as Or, setMaxWebGLCharts as kr, shownCount as Ar, timeToX as jr, timestampToBarIndex as Mr, timestampToBarIndex as Nr, toHeikinAshi as Pr, toKagi as Fr, toLineBreak as Ir, toPointAndFigure as Lr, toRangeBars as Rr, toRenko as zr, withResampling as Br, withTickBars as Vr, xToBarIndex as Hr, xToBarIndex as R, xToTime as Ur, yToPrice as Wr, yToPrice as Gr } from "@tradecanvas/core";
4
4
  //#region src/frameworks/syncIndicators.ts
5
- function Gr(e) {
5
+ function Kr(e) {
6
6
  let { id: t, params: n = {}, position: r = null } = typeof e == "string" ? { id: e } : e;
7
7
  return JSON.stringify([
8
8
  t,
@@ -10,9 +10,9 @@ function Gr(e) {
10
10
  r
11
11
  ]);
12
12
  }
13
- function Kr(e, t, n) {
13
+ function qr(e, t, n) {
14
14
  let r = /* @__PURE__ */ new Map(), i = t.map((e) => {
15
- let t = Gr(e), n = r.get(t) ?? 0;
15
+ let t = Kr(e), n = r.get(t) ?? 0;
16
16
  return r.set(t, n + 1), {
17
17
  spec: e,
18
18
  key: `${t}#${n}`
@@ -27,7 +27,7 @@ function Kr(e, t, n) {
27
27
  }
28
28
  //#endregion
29
29
  //#region src/frameworks/feedBars.ts
30
- var qr = 3, z = (e) => ({
30
+ var Jr = 3, z = (e) => ({
31
31
  time: e.time,
32
32
  open: e.open,
33
33
  high: e.high,
@@ -35,16 +35,16 @@ var qr = 3, z = (e) => ({
35
35
  close: e.close,
36
36
  volume: e.volume
37
37
  }), B = (e) => e.length > 0 ? e[e.length - 1] : null;
38
- function Jr(e, n, r) {
38
+ function Yr(e, n, r) {
39
39
  for (let i = 0; i < r; i++) if (!t(e[i], n[i])) return !1;
40
40
  return !0;
41
41
  }
42
- function Yr(e, t) {
42
+ function Xr(e, t) {
43
43
  if (e.isReplayActive()) return !0;
44
44
  let n = B(e.getData());
45
45
  return t.inReplay ? n?.time === t.last?.time : n === t.shownBar ? n?.time === t.last?.time || !e.isExtendedHoursVisible() : !1;
46
46
  }
47
- function Xr(e, r, i) {
47
+ function Zr(e, r, i) {
48
48
  let a = [];
49
49
  for (let o = 0; o < r.length; o++) {
50
50
  let s = e[i + o];
@@ -55,16 +55,16 @@ function Xr(e, r, i) {
55
55
  }
56
56
  return a;
57
57
  }
58
- function Zr(e, t) {
58
+ function Qr(e, t) {
59
59
  if (t.length === 0) return !0;
60
60
  if (!e.updateBar) return !1;
61
61
  for (let n of t) if (!e.updateBar(n)) return !1;
62
62
  return !0;
63
63
  }
64
- function Qr(e) {
64
+ function $r(e) {
65
65
  return e.slice(Math.max(1, e.length - 1 - 3), -1).map(z);
66
66
  }
67
- function $r(e, t) {
67
+ function ei(e, t) {
68
68
  let r = [];
69
69
  for (let i = t; i < e.length; i++) {
70
70
  if (!n(e[i]) || !(e[i].time > e[i - 1].time)) return null;
@@ -72,32 +72,32 @@ function $r(e, t) {
72
72
  }
73
73
  return r;
74
74
  }
75
- function ei(e, r, i) {
75
+ function ti(e, r, i) {
76
76
  let a = i.length;
77
- if (a === 0 || !i.last || !n(i.last) || r.length < a || !Yr(e, i)) return !1;
77
+ if (a === 0 || !i.last || !n(i.last) || r.length < a || !Xr(e, i)) return !1;
78
78
  let o = i.recent ?? [], s = a - 1 - o.length;
79
- if (r !== i.source && (i.source.length !== a || !Jr(i.source, r, s))) return !1;
79
+ if (r !== i.source && (i.source.length !== a || !Yr(i.source, r, s))) return !1;
80
80
  let c = r[a - 1];
81
81
  if (c.time !== i.last.time || !n(c)) return !1;
82
- let l = Xr(r, o, s), u = $r(r, a);
83
- return !l || !u || !Zr(e, l) ? !1 : (t(c, i.last) || e.updateLastBar(z(c)), u.length === 1 ? e.appendBar(u[0]) : u.length > 1 && e.appendBars(u), !0);
82
+ let l = Zr(r, o, s), u = ei(r, a);
83
+ return !l || !u || !Qr(e, l) ? !1 : (t(c, i.last) || e.updateLastBar(z(c)), u.length === 1 ? e.appendBar(u[0]) : u.length > 1 && e.appendBars(u), !0);
84
84
  }
85
- function ti(e, t, n) {
86
- (!n || !ei(e, t, n)) && e.setData(t.map(z));
85
+ function ni(e, t, n) {
86
+ (!n || !ti(e, t, n)) && e.setData(t.map(z));
87
87
  let r = t.length > 0 ? z(t[t.length - 1]) : null, i = e.isReplayActive();
88
88
  return {
89
89
  source: t,
90
90
  length: t.length,
91
91
  last: r,
92
- recent: Qr(t),
92
+ recent: $r(t),
93
93
  shownBar: i ? null : B(e.getData()),
94
94
  inReplay: i
95
95
  };
96
96
  }
97
97
  //#endregion
98
98
  //#region src/plugins/overlayScale.ts
99
- function ni(e) {
100
- let { viewport: t, data: n } = e, r = fr(t), i = n.length - 1, a = Math.max(0, Math.floor(t.visibleRange.from)), o = Math.min(i, Math.ceil(t.visibleRange.to)), s = (e) => n.length > 0 ? Mr(e, n) : e;
99
+ function ri(e) {
100
+ let { viewport: t, data: n } = e, r = pr(t), i = n.length - 1, a = Math.max(0, Math.floor(t.visibleRange.from)), o = Math.min(i, Math.ceil(t.visibleRange.to)), s = (e) => n.length > 0 ? Nr(e, n) : e;
101
101
  return {
102
102
  timeToX: (e) => j(s(e), t),
103
103
  xToTime: (e) => {
@@ -107,7 +107,7 @@ function ni(e) {
107
107
  indexToX: (e) => j(e, t),
108
108
  xToIndex: (e) => R(e, t),
109
109
  priceToY: r,
110
- yToPrice: (e) => Wr(e, t),
110
+ yToPrice: (e) => Gr(e, t),
111
111
  barWidth: t.barWidth,
112
112
  visible: o < a ? {
113
113
  from: 0,
@@ -153,7 +153,7 @@ var V = {
153
153
  cols: 2,
154
154
  rows: 3
155
155
  }
156
- }, ri = class {
156
+ }, ii = class {
157
157
  root;
158
158
  cells = [];
159
159
  layout;
@@ -243,7 +243,7 @@ var V = {
243
243
  async connectAll(e, t, n, r = 500) {
244
244
  let i = [];
245
245
  for (let a = 0; a < this.cells.length && a < t.length; a++) i.push(this.connectCell(a, {
246
- ...typeof e == "function" ? { adapter: e(t[a], a) } : nr(e) ? { feed: e } : { adapter: e },
246
+ ...typeof e == "function" ? { adapter: e(t[a], a) } : rr(e) ? { feed: e } : { adapter: e },
247
247
  symbol: t[a],
248
248
  timeframe: n,
249
249
  historyLimit: r
@@ -260,13 +260,13 @@ var V = {
260
260
  this.cells = [], this.root.remove();
261
261
  }
262
262
  }
263
- }, ii = class extends O {
263
+ }, ai = class extends O {
264
264
  options;
265
265
  constructor(e, t) {
266
266
  super(e, t.theme), this.options = t, this.requestRender();
267
267
  }
268
268
  renderChart(e, t, n, r) {
269
- Tr(e, t, n, this.options, r);
269
+ Er(e, t, n, this.options, r);
270
270
  }
271
271
  update(e) {
272
272
  this.options = {
@@ -280,7 +280,7 @@ var V = {
280
280
  ...e
281
281
  }, this.requestRender();
282
282
  }
283
- }, ai = class extends O {
283
+ }, oi = class extends O {
284
284
  options;
285
285
  crosshair = null;
286
286
  constructor(e, t) {
@@ -288,7 +288,7 @@ var V = {
288
288
  }
289
289
  renderChart(e, t, n, r) {
290
290
  let i = this.crosshair?.getPosition() ?? null;
291
- _r(e, t, n, this.options, r, i);
291
+ vr(e, t, n, this.options, r, i);
292
292
  }
293
293
  update(e) {
294
294
  this.options = {
@@ -313,7 +313,7 @@ var V = {
313
313
  }
314
314
  renderChart(e, t, n, r) {
315
315
  let i = this.crosshair?.getPosition() ?? null;
316
- yr(e, t, n, this.options, r, i);
316
+ br(e, t, n, this.options, r, i);
317
317
  }
318
318
  update(e, t) {
319
319
  this.options = {
@@ -360,7 +360,7 @@ var V = {
360
360
  height: this.height
361
361
  }, t = this.options.cellPadding ?? 2;
362
362
  if (this.lastLayoutWidth = this.width, this.lastLayoutHeight = this.height, this.cachedGroups = [], this.options.grouped) {
363
- let { groups: n, cells: r } = ir(this.currentData.map((e) => ({
363
+ let { groups: n, cells: r } = ar(this.currentData.map((e) => ({
364
364
  id: e.id,
365
365
  weight: e.weight ?? (Math.abs(e.value) || 1),
366
366
  group: e.group,
@@ -372,8 +372,8 @@ var V = {
372
372
  id: e.id,
373
373
  weight: e.weight ?? (Math.abs(e.value) || 1)
374
374
  }));
375
- this.cachedRects = ar(n, e, t);
376
- } else this.cachedRects = or(this.currentData.map((e) => ({ id: e.id })), e, t);
375
+ this.cachedRects = or(n, e, t);
376
+ } else this.cachedRects = sr(this.currentData.map((e) => ({ id: e.id })), e, t);
377
377
  }
378
378
  onCanvasClick(e, t) {
379
379
  if (this.options.onCellClick) for (let n of this.cachedRects) {
@@ -388,7 +388,7 @@ var V = {
388
388
  renderChart(e, t, n, r) {
389
389
  (t !== this.lastLayoutWidth || n !== this.lastLayoutHeight) && this.recomputeLayout();
390
390
  let i = this.crosshair?.getPosition() ?? null;
391
- xr(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
391
+ Sr(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
392
392
  }
393
393
  update(e) {
394
394
  this.currentData = e, this.options = {
@@ -405,7 +405,7 @@ var V = {
405
405
  destroy() {
406
406
  this.crosshair?.destroy(), this.handleClick && this.canvas.removeEventListener("click", this.handleClick), super.destroy();
407
407
  }
408
- }, oi = class extends O {
408
+ }, si = class extends O {
409
409
  options;
410
410
  crosshair = null;
411
411
  constructor(e, t) {
@@ -413,7 +413,7 @@ var V = {
413
413
  }
414
414
  renderChart(e, t, n, r) {
415
415
  let i = this.crosshair?.getPosition() ?? null;
416
- Er(e, t, n, this.options, r, i);
416
+ Dr(e, t, n, this.options, r, i);
417
417
  }
418
418
  update(e) {
419
419
  this.options = {
@@ -430,12 +430,12 @@ var V = {
430
430
  destroy() {
431
431
  this.crosshair?.destroy(), super.destroy();
432
432
  }
433
- }, si = 500;
434
- function ci(e) {
433
+ }, ci = 500;
434
+ function li(e) {
435
435
  let t = 1 - e;
436
436
  return 1 - t * t * t;
437
437
  }
438
- var li = class extends O {
438
+ var ui = class extends O {
439
439
  options;
440
440
  currentValue;
441
441
  targetValue;
@@ -446,7 +446,7 @@ var li = class extends O {
446
446
  super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.requestRender();
447
447
  }
448
448
  renderChart(e, t, n, r) {
449
- br(e, t, n, this.options, r, this.currentValue);
449
+ xr(e, t, n, this.options, r, this.currentValue);
450
450
  }
451
451
  setValue(e) {
452
452
  if (this.options.animate === !1) {
@@ -476,7 +476,7 @@ var li = class extends O {
476
476
  if (this.animationFrameId !== null) return;
477
477
  let e = () => {
478
478
  if (this.animationFrameId = null, this.animationStart === null) return;
479
- let t = this.options.animationDuration ?? si, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = ci(r);
479
+ let t = this.options.animationDuration ?? ci, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = li(r);
480
480
  this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * i, this.requestRender(), r < 1 ? this.animationFrameId = requestAnimationFrame(e) : (this.currentValue = this.targetValue, this.animationStart = null);
481
481
  };
482
482
  this.animationFrameId = requestAnimationFrame(e);
@@ -525,12 +525,12 @@ var li = class extends O {
525
525
  destroy() {
526
526
  this.crosshair.destroy(), this.canvas.removeEventListener("click", this.onClick), this.canvas.removeEventListener("pointermove", this.onMove), super.destroy();
527
527
  }
528
- }, ui = class extends W {
528
+ }, di = class extends W {
529
529
  compute(e, t, n, r) {
530
530
  return Rn(this.options, e, t, n, r);
531
531
  }
532
532
  draw(e, t, n, r, i, a) {
533
- mr(e, t, n, this.options, r, i, a);
533
+ hr(e, t, n, this.options, r, i, a);
534
534
  }
535
535
  describe() {
536
536
  return `Bar chart of ${this.options.series.map((e) => e.name).join(", ")}, ${this.options.categories.length} categories`;
@@ -556,12 +556,12 @@ var li = class extends O {
556
556
  series: t
557
557
  });
558
558
  }
559
- }, di = class extends W {
559
+ }, fi = class extends W {
560
560
  compute(e, t, n, r) {
561
561
  return Vn(this.options, e, t, n, r);
562
562
  }
563
563
  draw(e, t, n, r, i, a) {
564
- vr(e, t, n, this.options, r, i, a);
564
+ yr(e, t, n, this.options, r, i, a);
565
565
  }
566
566
  describe() {
567
567
  let e = this.options.data.filter((e) => Number.isFinite(e.value) && e.value > 0).map((e) => e.label).join(", ");
@@ -580,12 +580,12 @@ var li = class extends O {
580
580
  update(e) {
581
581
  this.setOptions({ data: e });
582
582
  }
583
- }, fi = class extends W {
583
+ }, pi = class extends W {
584
584
  compute(e, t, n, r) {
585
585
  return Wn(this.options, e, t, n, r);
586
586
  }
587
587
  draw(e, t, n, r, i, a) {
588
- wr(e, t, n, this.options, r, i, a);
588
+ Tr(e, t, n, this.options, r, i, a);
589
589
  }
590
590
  describe() {
591
591
  let e = this.options.series.reduce((e, t) => e + t.points.length, 0);
@@ -604,12 +604,12 @@ var li = class extends O {
604
604
  update(e) {
605
605
  this.setOptions({ series: e });
606
606
  }
607
- }, pi = class extends W {
607
+ }, mi = class extends W {
608
608
  compute(e, t, n, r) {
609
609
  return Hn(this.options, e, t, n, r);
610
610
  }
611
611
  draw(e, t, n, r, i, a) {
612
- Sr(e, t, n, this.options, r, i, a);
612
+ Cr(e, t, n, this.options, r, i, a);
613
613
  }
614
614
  describe() {
615
615
  return `Histogram of ${this.options.values.length} values`;
@@ -624,12 +624,12 @@ var li = class extends O {
624
624
  update(e) {
625
625
  this.setOptions({ values: e });
626
626
  }
627
- }, mi = class extends W {
627
+ }, hi = class extends W {
628
628
  compute(e, t, n, r) {
629
629
  return zn(this.options, e, t, n, r);
630
630
  }
631
631
  draw(e, t, n, r, i, a) {
632
- hr(e, t, n, this.options, r, i, a);
632
+ gr(e, t, n, this.options, r, i, a);
633
633
  }
634
634
  describe() {
635
635
  let e = this.options.data.map((e) => e.date).filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e)).sort(), t = this.options.from ?? e[0], n = this.options.to ?? e[e.length - 1];
@@ -648,12 +648,12 @@ var li = class extends O {
648
648
  update(e) {
649
649
  this.setOptions({ data: e });
650
650
  }
651
- }, G = 12, hi = class extends W {
651
+ }, G = 12, gi = class extends W {
652
652
  compute(e, t, n, r) {
653
653
  return Un(this.options, e, t, n, r);
654
654
  }
655
655
  draw(e, t, n, r, i, a) {
656
- Cr(e, t, n, this.options, r, i, a);
656
+ wr(e, t, n, this.options, r, i, a);
657
657
  }
658
658
  describe() {
659
659
  let { rows: e, columns: t } = this.options;
@@ -672,12 +672,12 @@ var li = class extends O {
672
672
  update(e) {
673
673
  this.setOptions({ values: e });
674
674
  }
675
- }, gi = class extends W {
675
+ }, _i = class extends W {
676
676
  compute(e, t, n, r) {
677
677
  return Bn(this.options, e, t, n, r);
678
678
  }
679
679
  draw(e, t, n, r, i, a) {
680
- gr(e, t, n, this.options, r, i, a);
680
+ _r(e, t, n, this.options, r, i, a);
681
681
  }
682
682
  describe() {
683
683
  return `Counter-clock chart of price against volume, ${this.options.period ?? 25}-bar averages`;
@@ -693,12 +693,12 @@ var li = class extends O {
693
693
  r && this.options.onPointClick?.(r.point);
694
694
  }
695
695
  getPhase() {
696
- return qn(Yn(this.options.data, this.options.period ?? 25, kr(this.options)));
696
+ return qn(Yn(this.options.data, this.options.period ?? 25, Ar(this.options)));
697
697
  }
698
698
  update(e) {
699
699
  this.setOptions({ data: e });
700
700
  }
701
- }, _i = [
701
+ }, vi = [
702
702
  "Jan",
703
703
  "Feb",
704
704
  "Mar",
@@ -746,7 +746,7 @@ function J(e) {
746
746
  let a = new Date(e.key), o = a.getUTCFullYear(), s = a.getUTCMonth();
747
747
  r.push({
748
748
  id: `${o}-${String(s + 1).padStart(2, "0")}`,
749
- label: _i[s],
749
+ label: vi[s],
750
750
  group: String(o),
751
751
  value: i
752
752
  });
@@ -809,7 +809,7 @@ function Q(e) {
809
809
  function $(e) {
810
810
  return !e || e === "dark" ? ve : e === "light" ? _ : e;
811
811
  }
812
- var vi = class {
812
+ var yi = class {
813
813
  options;
814
814
  theme;
815
815
  root;
@@ -958,6 +958,6 @@ var vi = class {
958
958
  }
959
959
  };
960
960
  //#endregion
961
- export { It as AlertManager, Lt as Animator, ui as BarChart, Rt as BarCountdown, zt as BinanceAdapter, Bt as BybitAdapter, Vt as CANDLE_PATTERNS, me as CHART_STYLE_KEYS, qr as CORRECTABLE_BARS, mi as CalendarChart, c as Chart, ri as ChartGrid, Ht as ChartLegend, Ut as ChartStateManager, Wt as CoinbaseAdapter, Gt as CompareRenderer, gi as CounterClockChart, Kt as CrosshairTooltip, qt as CurrentPriceLine, he as DARK_PRICE_LIMITS, ge as DARK_TERMINAL, _e as DARK_THEME, ye as DEFAULT_DRAWING_STYLE, be as DEFAULT_FONT_FAMILY, e as DEFAULT_HISTORY_PAGE_SIZE, Jt as DEFAULT_LEGEND_CONFIG, Yt as DEFAULT_MAX_WEBGL_CHARTS, xe as DEFAULT_RECONNECT, Xt as DEFAULT_SESSION_HOURS, Se as DEFAULT_SIGNAL_STYLE, Ce as DEFAULT_STREAM_CONFIG, we as DEFAULT_TIMEFRAME_FAVORITES, Te as DEFAULT_TRADE_ZONE_STYLE, Ee as DEFAULT_TRADING_CONFIG, Zt as DataExporter, i as DataManager, ai as DepthChart, di as DonutChart, ie as DragDropImporter, Qt as DrawingBase, te as EXCHANGE_TIMEZONE, le as EXCHANGE_TIME_ZONE, $t as Easing, H as EquityCurveChart, li as GaugeChart, de as HISTORY_RETRY_MS, d as HNX_SESSIONS, f as HOSE_SESSIONS, U as HeatmapChart, pi as HistogramChart, tn as INDICATOR_CATEGORIES, nn as IndicatorBase, rn as IndicatorValueMap, an as KEPT_BUCKETS, p as KRX_SESSIONS, m as KR_COLORS, on as KeyboardHandler, sn as KrakenAdapter, h as LIGHT_PRICE_LIMITS, g as LIGHT_THEME, fe as LayoutManager, ce as LayoutSession, v as MARKET_CRYPTO, y as MARKET_HNX, b as MARKET_HOSE, x as MARKET_HOSE_ETF, S as MARKET_KRX, C as MARKET_NXT, w as MARKET_NYSE, T as MARKET_UPBIT_KRW, E as MARKET_UPCOM, D as MARKET_VN30F, cn as MAX_ALERT_BARS, re as MAX_LAYOUT_NAME, ln as MIN_ALERT_BARS, De as MS_TIME_THRESHOLD, un as ManualFeed, hi as MatrixChart, dn as MockAdapter, Oe as NXT_SESSIONS, ue as PLUGIN_API_VERSION, ke as PRICE_SOURCES, fn as PaperExecutionAdapter, vi as PerformanceDashboard, ae as PluginManager, pn as PollingAdapter, mn as RANGE_PRESETS, hn as ReconnectManager, gn as ReplayController, _n as ReplayManager, vn as ResamplingAdapter, yn as ReshapeMemo, Ae as SANS_FONT_FAMILY, fi as ScatterChart, bn as Screenshot, xn as SessionBreaks, Sn as SessionShading, A as SignalMarkerManager, ii as SparklineChart, Cn as StreamManager, je as TC_PALETTE, Me as TC_SERIES_COLORS, Ne as TIMEFRAMES_CRYPTO, Pe as TIMEFRAMES_FOREX, Fe as TIMEFRAMES_STOCK, r as ThemeManager, wn as TickAggregator, Tn as TickBarAdapter, En as TickBarBuilder, Dn as TradeZoneManager, Ie as UPCOM_SESSIONS, On as UndoRedoManager, kn as UpbitAdapter, Le as VN30F_SESSIONS, Re as VN_COLORS, ze as VOLUME_ALPHA, An as VolumeRenderer, oi as WaterfallChart, jn as Watermark, Mn as WebSocketAdapter, Nn as adapterFromFeed, Pn as axisTimes, In as barIndexToX, Be as barTimeUnit, Ve as barsAreDaily, oe as cleanLayoutName, ne as clearGlobalPlugins, q as computeDrawdownCurve, J as computeMonthlyReturns, He as computePriceLimits, Ue as contrastRatio, Gn as correlationMatrix, Kn as counterClockPhase, Jn as counterClockPoints, We as createMarketTheme, Ge as createVNTheme, Xn as detectCandlePatterns, ti as feedBars, Zn as feedFromAdapter, Ke as formatFraction, qe as formatNumber, Qn as formatTooltipTime, Je as formatVND, Ye as formatVolumeLoc, Xe as fractionTick, Ze as getCurrentSession, u as getGlobalPlugins, Qe as getLocale, $n as histogramBins, er as indicatorCategory, $e as indicatorSource, et as inkOn, tr as isDataFeed, rr as isPriceLevelAlert, tt as isPriceSource, nt as isTimeFrame, rt as isValidTimeZone, ee as localStorageLayouts, sr as lttbDownsample, cr as lttbVisibleIndices, it as marketStatus, o as memoryLayouts, lr as niceScale, at as normalizeBar, ot as normalizeBarTime, st as offsetAt, ni as overlayScale, pe as overlaysForLayer, ct as parseIndicatorSource, se as parseOHLCV, lt as parseTimeframe, ut as pickBaseTimeframe, s as pluginKey, dt as priceFormatterFor, ft as priceStepAt, ur as priceToY, dr as priceToYMapper, pr as rangePresetStart, pt as rankSymbols, mt as readNews, ht as readQuote, gt as readableOn, _t as registerLocale, l as registerPlugin, vt as resampleBars, yt as roundToPriceStep, bt as scaleMarketPrices, Q as selectKeyStats, Dr as servesTimeframe, xt as setLocale, Or as setMaxWebGLCharts, St as sourcePrice, Ct as stepDecimals, wt as symbolTimeZone, Kr as syncIndicators, Tt as t, Et as tickBarCount, Ar as timeToX, Dt as timeframeBucketStart, kt as timeframeToMs, jr as timestampToBarIndex, K as toEquityPoints, Nr as toHeikinAshi, Pr as toKagi, Fr as toLineBreak, Ir as toPointAndFigure, Lr as toRangeBars, Rr as toRenko, a as unregisterPlugin, At as usesKoreanUnits, jt as vn30fContracts, Mt as vn30fLastTradingDay, Nt as volumeColor, Pt as wallToUtc, zr as withResampling, Br as withTickBars, Vr as xToBarIndex, Hr as xToTime, Ur as yToPrice, Ft as zoneOffsetMinutes };
961
+ export { It as AlertManager, Lt as Animator, di as BarChart, Rt as BarCountdown, zt as BinanceAdapter, Bt as BybitAdapter, Vt as CANDLE_PATTERNS, me as CHART_STYLE_KEYS, Jr as CORRECTABLE_BARS, hi as CalendarChart, c as Chart, ii as ChartGrid, Ht as ChartLegend, Ut as ChartStateManager, Wt as CoinbaseAdapter, Gt as CompareRenderer, _i as CounterClockChart, Kt as CrosshairTooltip, qt as CurrentPriceLine, he as DARK_PRICE_LIMITS, ge as DARK_TERMINAL, _e as DARK_THEME, ye as DEFAULT_DRAWING_STYLE, be as DEFAULT_FONT_FAMILY, e as DEFAULT_HISTORY_PAGE_SIZE, Jt as DEFAULT_LEGEND_CONFIG, Yt as DEFAULT_MAX_WEBGL_CHARTS, xe as DEFAULT_RECONNECT, Xt as DEFAULT_SESSION_HOURS, Se as DEFAULT_SIGNAL_STYLE, Ce as DEFAULT_STREAM_CONFIG, we as DEFAULT_TIMEFRAME_FAVORITES, Te as DEFAULT_TRADE_ZONE_STYLE, Ee as DEFAULT_TRADING_CONFIG, Zt as DataExporter, i as DataManager, oi as DepthChart, fi as DonutChart, ie as DragDropImporter, Qt as DrawingBase, te as EXCHANGE_TIMEZONE, le as EXCHANGE_TIME_ZONE, $t as Easing, H as EquityCurveChart, ui as GaugeChart, de as HISTORY_RETRY_MS, d as HNX_SESSIONS, f as HOSE_SESSIONS, U as HeatmapChart, mi as HistogramChart, tn as INDICATOR_CATEGORIES, nn as IndicatorBase, rn as IndicatorValueMap, an as KEPT_BUCKETS, p as KRX_SESSIONS, m as KR_COLORS, on as KeyboardHandler, sn as KrakenAdapter, h as LIGHT_PRICE_LIMITS, g as LIGHT_THEME, fe as LayoutManager, ce as LayoutSession, v as MARKET_CRYPTO, y as MARKET_HNX, b as MARKET_HOSE, x as MARKET_HOSE_ETF, S as MARKET_KRX, C as MARKET_NXT, w as MARKET_NYSE, T as MARKET_UPBIT_KRW, E as MARKET_UPCOM, D as MARKET_VN30F, cn as MAX_ALERT_BARS, re as MAX_LAYOUT_NAME, ln as MIN_ALERT_BARS, De as MS_TIME_THRESHOLD, un as ManualFeed, gi as MatrixChart, dn as MockAdapter, Oe as NXT_SESSIONS, ue as PLUGIN_API_VERSION, ke as PRICE_SOURCES, fn as PaperExecutionAdapter, yi as PerformanceDashboard, ae as PluginManager, pn as PollingAdapter, mn as RANGE_PRESETS, hn as ReconnectManager, gn as ReplayController, _n as ReplayManager, vn as ResamplingAdapter, yn as ReshapeMemo, Ae as SANS_FONT_FAMILY, pi as ScatterChart, bn as Screenshot, xn as SessionBreaks, Sn as SessionShading, A as SignalMarkerManager, ai as SparklineChart, Cn as StreamManager, je as TC_PALETTE, Me as TC_SERIES_COLORS, Ne as TIMEFRAMES_CRYPTO, Pe as TIMEFRAMES_FOREX, Fe as TIMEFRAMES_STOCK, r as ThemeManager, wn as TickAggregator, Tn as TickBarAdapter, En as TickBarBuilder, Dn as TradeZoneManager, Ie as UPCOM_SESSIONS, On as UndoRedoManager, kn as UpbitAdapter, Le as VN30F_SESSIONS, Re as VN_COLORS, ze as VOLUME_ALPHA, An as VolumeRenderer, si as WaterfallChart, jn as Watermark, Mn as WebSocketAdapter, Nn as adapterFromFeed, Pn as axisTimes, In as barIndexToX, Be as barTimeUnit, Ve as barsAreDaily, oe as cleanLayoutName, ne as clearGlobalPlugins, q as computeDrawdownCurve, J as computeMonthlyReturns, He as computePriceLimits, Ue as contrastRatio, Gn as correlationMatrix, Kn as counterClockPhase, Jn as counterClockPoints, We as createMarketTheme, Ge as createVNTheme, Xn as describeInputs, Zn as detectCandlePatterns, ni as feedBars, Qn as feedFromAdapter, Ke as formatFraction, qe as formatNumber, $n as formatTooltipTime, Je as formatVND, Ye as formatVolumeLoc, Xe as fractionTick, Ze as getCurrentSession, u as getGlobalPlugins, Qe as getLocale, er as histogramBins, tr as indicatorCategory, $e as indicatorSource, et as inkOn, nr as isDataFeed, ir as isPriceLevelAlert, tt as isPriceSource, nt as isTimeFrame, rt as isValidTimeZone, ee as localStorageLayouts, cr as lttbDownsample, lr as lttbVisibleIndices, it as marketStatus, o as memoryLayouts, ur as niceScale, at as normalizeBar, ot as normalizeBarTime, st as offsetAt, ri as overlayScale, pe as overlaysForLayer, ct as parseIndicatorSource, se as parseOHLCV, lt as parseTimeframe, ut as pickBaseTimeframe, s as pluginKey, dt as priceFormatterFor, ft as priceStepAt, dr as priceToY, fr as priceToYMapper, mr as rangePresetStart, pt as rankSymbols, mt as readNews, ht as readQuote, gt as readableOn, _t as registerLocale, l as registerPlugin, vt as resampleBars, yt as roundToPriceStep, bt as scaleMarketPrices, Q as selectKeyStats, Or as servesTimeframe, xt as setLocale, kr as setMaxWebGLCharts, St as sourcePrice, Ct as stepDecimals, wt as symbolTimeZone, qr as syncIndicators, Tt as t, Et as tickBarCount, jr as timeToX, Dt as timeframeBucketStart, kt as timeframeToMs, Mr as timestampToBarIndex, K as toEquityPoints, Pr as toHeikinAshi, Fr as toKagi, Ir as toLineBreak, Lr as toPointAndFigure, Rr as toRangeBars, zr as toRenko, a as unregisterPlugin, At as usesKoreanUnits, jt as vn30fContracts, Mt as vn30fLastTradingDay, Nt as volumeColor, Pt as wallToUtc, Br as withResampling, Vr as withTickBars, Hr as xToBarIndex, Ur as xToTime, Wr as yToPrice, Ft as zoneOffsetMinutes };
962
962
 
963
963
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,60 @@
1
+ import { AlertManager, PriceAlert } from '@tradecanvas/core';
2
+ import { IndicatorOutput } from '@tradecanvas/commons';
3
+ /** What checking the alerts needs of them. */
4
+ export type WatchedAlerts = Pick<AlertManager, 'getAlerts' | 'setBarTime' | 'checkChannels' | 'checkDrawings'>;
5
+ /** An indicator's values at each bar, by its id (undefined: no such indicator). */
6
+ export type IndicatorLines = (instanceId: string) => IndicatorOutput['series'];
7
+ /** A moment the alerts are checked at. */
8
+ export interface AlertMoment {
9
+ /** The live price. */
10
+ price: number;
11
+ /** The time of the latest live bar; null with none. */
12
+ barTime: number | null;
13
+ /** The indicators' lines, or null when alerts on them wait (a replay, no bars). */
14
+ lines: IndicatorLines | null;
15
+ }
16
+ /**
17
+ * Alerts against a live price, and against the indicator lines they watch,
18
+ * all as of the same moment (a line crossing another compares like with
19
+ * like). A line against a line fires only with both of this moment.
20
+ */
21
+ export declare function checkAlerts(alerts: WatchedAlerts, moment: AlertMoment): void;
22
+ /** What moving alerts to other indicators needs of them. */
23
+ export type MovedAlerts = Pick<AlertManager, 'getAlerts' | 'removeAlert' | 'addAlert'>;
24
+ /**
25
+ * Alerts on the lines of indicators that went (`before`: id → kind) move to
26
+ * the one new indicator of the same kind (`added`), when there is just one;
27
+ * others stay as they are, as alerts on a removed indicator do. `kindOf` is
28
+ * an indicator's kind now, undefined for one not on the chart.
29
+ */
30
+ export declare function moveAlertsToHeirs(alerts: MovedAlerts, before: ReadonlyMap<string, string>, added: readonly string[], kindOf: (instanceId: string) => string | undefined): void;
31
+ /** A `<instanceId>:<key>` channel following its indicator to its new id (`ids`: old → new); others as they are. */
32
+ export declare function followChannel(channel: string, ids: ReadonlyMap<string, string>): string;
33
+ /** What putting a layout's alerts back needs of them. */
34
+ export type RestoredAlerts = Pick<AlertManager, 'clearAlerts' | 'addAlert' | 'addDrawingAlert'>;
35
+ /**
36
+ * A layout's alerts in place of the chart's: their lines following the
37
+ * indicators to their new ids (`ids`), an alert on a drawing only when the
38
+ * drawing has a line to cross (`crossable`). A one-shot alert that already
39
+ * fired stays fired (as AlertManager's own storage does), an expired one
40
+ * stays gone, and one that no longer fits together goes to `leftOut`.
41
+ */
42
+ export declare function restoreLayoutAlerts(alerts: RestoredAlerts, saved: readonly PriceAlert[], ids: ReadonlyMap<string, string>, crossable: (drawingId: string) => boolean, leftOut: (error: unknown) => void): void;
43
+ /** What keeping a drawing's alerts needs of them. */
44
+ export type StashedAlerts = Pick<AlertManager, 'takeDrawingAlerts' | 'restoreAlerts' | 'pruneDrawingAlerts'>;
45
+ /**
46
+ * A drawing's alerts go with it, and come back with it when an undo brings
47
+ * the drawing back.
48
+ */
49
+ export declare class DrawingAlertStash {
50
+ private readonly alerts;
51
+ private readonly kept;
52
+ constructor(alerts: StashedAlerts);
53
+ /** The drawing went: its alerts are kept aside. */
54
+ removed(drawingId: string): void;
55
+ /** The drawing is (back) on the chart: the alerts kept for it come back. */
56
+ created(drawingId: string): void;
57
+ /** The drawings were replaced: alerts on drawings not in `drawingIds` go, kept ones too. How many went. */
58
+ prune(drawingIds: ReadonlySet<string>): number;
59
+ }
60
+ //# sourceMappingURL=AlertWatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertWatch.d.ts","sourceRoot":"","sources":["../../src/model/AlertWatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,eAAe,CAAC,CAAC;AAE/G,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,eAAe,CAAC,QAAQ,CAAC,CAAC;AAE/E,0CAA0C;AAC1C,MAAM,WAAW,WAAW;IAC1B,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,mFAAmF;IACnF,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAM5E;AAwBD,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC,CAAC;AAEvF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GACjD,IAAI,CAyBN;AAED,mHAAmH;AACnH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAIvF;AAED,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,EAAE,aAAa,GAAG,UAAU,GAAG,iBAAiB,CAAC,CAAC;AAIhG;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,EACzC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAChC,IAAI,CAkBN;AAED,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,mBAAmB,GAAG,eAAe,GAAG,oBAAoB,CAAC,CAAC;AAE7G;;;GAGG;AACH,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmC;gBAE3B,MAAM,EAAE,aAAa;IAElD,mDAAmD;IACnD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKhC,4EAA4E;IAC5E,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAOhC,2GAA2G;IAC3G,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM;CAI/C"}
@@ -0,0 +1,42 @@
1
+ import { DataSeries, OHLCBar } from '@tradecanvas/commons';
2
+ import { IntrabarPath } from '../replay/intrabarPath.js';
3
+ /** A long jump goes to a paper account in at most this many chunks of bars, each giving its extremes and its close. */
4
+ export declare const MAX_REPLAY_CHUNKS = 500;
5
+ /** A price a paper account trades on, and its time: `[price, time]`. */
6
+ export type ReplayMark = [number, number];
7
+ /** How far a paper account has been given the replay: the latest time, and how far into that bar (1: all of it). */
8
+ export interface ReplayFed {
9
+ time: number | null;
10
+ fraction: number;
11
+ }
12
+ /** The marks to give a paper account, in order, and how far it has been given the replay after them. */
13
+ export interface ReplayFeed {
14
+ marks: ReplayMark[];
15
+ fed: ReplayFed;
16
+ }
17
+ /** Index of the first bar at or after `time` (the length when none is). */
18
+ export declare function firstAtOrAfter(series: DataSeries, time: number): number;
19
+ /** The first bar of `series` after `time` (its length when none is). */
20
+ export declare function firstAfter(series: DataSeries, time: number): number;
21
+ /**
22
+ * The prices a run of bars went through, in order, as far as the bars tell:
23
+ * each extreme with its time, the earlier one first (within one bar, a rising
24
+ * bar dipped first), then the close.
25
+ */
26
+ export declare function replayMarks(run: readonly OHLCBar[]): ReplayMark[];
27
+ /**
28
+ * A paper account trades on the replayed prices and times, forward only:
29
+ * it gets every step past the latest time it has seen (a jump ahead passes
30
+ * them all, a long one in chunks), and nothing after a seek back or a
31
+ * restart from an earlier bar until the replay is past that time again
32
+ * (null). At the start its mark is where the replay begins.
33
+ */
34
+ export declare function stepFeed(series: DataSeries, index: number, fed: ReplayFed): ReplayFeed | null;
35
+ /**
36
+ * A paper account trades on the prices a forming bar has been drawn
37
+ * through, forward only by (time, fraction): the rest of a bar given in
38
+ * part (along `pathOf` it), the bars a jump passes, then bar `index` of
39
+ * `coarse` along `path` up to `fraction`. Null when that is behind.
40
+ */
41
+ export declare function formingFeed(coarse: DataSeries, index: number, path: IntrabarPath, fraction: number, fed: ReplayFed, pathOf: (coarse: DataSeries, index: number) => IntrabarPath): ReplayFeed | null;
42
+ //# sourceMappingURL=ReplayMarks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReplayMarks.d.ts","sourceRoot":"","sources":["../../src/model/ReplayMarks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEpF,uHAAuH;AACvH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1C,oHAAoH;AACpH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wGAAwG;AACxG,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASvE;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASnE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,OAAO,EAAE,GAAG,UAAU,EAAE,CAYjE;AAUD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,UAAU,GAAG,IAAI,CAO7F;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,SAAS,EACd,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,YAAY,GAC1D,UAAU,GAAG,IAAI,CAanB"}
@@ -102,6 +102,7 @@ export declare class WidgetIndicatorSettings {
102
102
  private currentValue;
103
103
  private setValue;
104
104
  private renderInputs;
105
+ /** One input's row: its control follows the kind the indicator declares, or the one its default implies. */
105
106
  private fieldRow;
106
107
  private sourceControl;
107
108
  private choiceControl;
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetIndicatorSettings.d.ts","sourceRoot":"","sources":["../../src/widget/WidgetIndicatorSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAK5I,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAMzD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5D,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,6DAA6D;IAC7D,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IACtD,+EAA+E;IAC/E,WAAW,CAAC,EAAE,SAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1D,gEAAgE;IAChE,KAAK,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC1D,sFAAsF;IACtF,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CA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