@tradecanvas/core 0.14.0 → 1.0.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/charts/AreaRenderer.d.ts.map +1 -1
- package/dist/charts/LineRenderer.d.ts.map +1 -1
- package/dist/charts/downsample.d.ts +15 -0
- package/dist/charts/downsample.d.ts.map +1 -0
- package/dist/charts/index.d.ts +1 -0
- package/dist/charts/index.d.ts.map +1 -1
- package/dist/charts/lttb.bench.d.ts +2 -0
- package/dist/charts/lttb.bench.d.ts.map +1 -0
- package/dist/engine/RenderEngine.d.ts +2 -0
- package/dist/engine/RenderEngine.d.ts.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1373 -547
- package/dist/index.js.map +1 -1
- package/dist/interaction/InteractionManager.d.ts +4 -0
- package/dist/interaction/InteractionManager.d.ts.map +1 -1
- package/dist/interaction/PaneResizeHandler.d.ts +36 -0
- package/dist/interaction/PaneResizeHandler.d.ts.map +1 -0
- package/dist/interaction/index.d.ts +1 -0
- package/dist/interaction/index.d.ts.map +1 -1
- package/dist/realtime/adapters/BybitAdapter.d.ts +29 -0
- package/dist/realtime/adapters/BybitAdapter.d.ts.map +1 -0
- package/dist/realtime/adapters/CoinbaseAdapter.d.ts +25 -0
- package/dist/realtime/adapters/CoinbaseAdapter.d.ts.map +1 -0
- package/dist/realtime/adapters/KrakenAdapter.d.ts +26 -0
- package/dist/realtime/adapters/KrakenAdapter.d.ts.map +1 -0
- package/dist/realtime/adapters/PollingAdapter.d.ts +50 -0
- package/dist/realtime/adapters/PollingAdapter.d.ts.map +1 -0
- package/dist/realtime/adapters/WebSocketAdapter.d.ts +79 -0
- package/dist/realtime/adapters/WebSocketAdapter.d.ts.map +1 -0
- package/dist/realtime/adapters/index.d.ts +10 -0
- package/dist/realtime/adapters/index.d.ts.map +1 -1
- package/dist/realtime/adapters/parseUtils.d.ts +5 -0
- package/dist/realtime/adapters/parseUtils.d.ts.map +1 -0
- package/dist/trading/OrderDraftTool.d.ts +37 -0
- package/dist/trading/OrderDraftTool.d.ts.map +1 -0
- package/dist/trading/PaperExecutionAdapter.d.ts +45 -0
- package/dist/trading/PaperExecutionAdapter.d.ts.map +1 -0
- package/dist/trading/TradingManager.d.ts +7 -0
- package/dist/trading/TradingManager.d.ts.map +1 -1
- package/dist/trading/index.d.ts +4 -0
- package/dist/trading/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -216,7 +216,7 @@ var ee = class {
|
|
|
216
216
|
if (e.has(l.Background) && this.bgLayer && (this.bgLayer.clear(), t.gridRenderer?.render(this.bgLayer.ctx, n, r), t.sessionShading?.render(this.bgLayer.ctx, i, n, r), t.sessionBreaks?.render(this.bgLayer.ctx, n, r, i), t.watermark?.render(this.bgLayer.ctx, n, r)), e.has(l.Main) && this.mainLayer) {
|
|
217
217
|
this.mainLayer.clear();
|
|
218
218
|
let e = this.mainLayer.ctx;
|
|
219
|
-
e.save(), e.beginPath(), e.rect(n.chartRect.x, n.chartRect.y, n.chartRect.width, n.chartRect.height), e.clip(), t.depthHeatmap?.render(e, n, r), t.volumeRenderer?.render(e, i, n, r), t.volumeProfile?.render(e, i, n, r), t.marketProfile?.render(e, i, n, r), t.chartRenderer?.render(e, i, n, r), t.compareRenderer?.render(e, i, n, r), t.indicatorEngine?.renderOverlays(e, n), t.periodLevels?.render(e, i, n, r), t.pivotMarkers?.render(e, i, n, r), e.restore();
|
|
219
|
+
e.save(), e.beginPath(), e.rect(n.chartRect.x, n.chartRect.y, n.chartRect.width, n.chartRect.height), e.clip(), t.depthHeatmap?.render(e, n, r), t.volumeRenderer?.render(e, i, n, r), t.volumeProfile?.render(e, i, n, r), t.marketProfile?.render(e, i, n, r), t.chartRenderer?.render(e, i, n, r), t.compareRenderer?.render(e, i, n, r), t.indicatorEngine?.renderOverlays(e, n), t.periodLevels?.render(e, i, n, r), t.pivotMarkers?.render(e, i, n, r), t.renderOverlayPlugins?.(e, "main"), e.restore();
|
|
220
220
|
let a = t.panels, o = t.indicatorEngine;
|
|
221
221
|
if (o && a.length > 0) {
|
|
222
222
|
let t = `10px ${r.font.family}`, n = o.getPanelIndicators(), i = /* @__PURE__ */ new Map();
|
|
@@ -232,7 +232,7 @@ var ee = class {
|
|
|
232
232
|
if (e.has(l.Overlay) && this.overlayLayer) {
|
|
233
233
|
this.overlayLayer.clear();
|
|
234
234
|
let e = this.overlayLayer.ctx;
|
|
235
|
-
t.priceLimits && this.renderPriceLimits(e, n, r, t.priceLimits), t.tradeZoneManager?.render(e, n, r), t.drawingRenderer?.render(e, n), t.tradingRenderer?.render(e, n, r), t.signalMarkerManager?.render(e, n, r), t.alertManager?.render(e, n, r), t.measureOverlay?.render(e, n, r), t.crosshairHandler?.render(e, n, r);
|
|
235
|
+
t.priceLimits && this.renderPriceLimits(e, n, r, t.priceLimits), t.tradeZoneManager?.render(e, n, r), t.drawingRenderer?.render(e, n), t.tradingRenderer?.render(e, n, r), t.signalMarkerManager?.render(e, n, r), t.alertManager?.render(e, n, r), t.measureOverlay?.render(e, n, r), t.crosshairHandler?.render(e, n, r), t.renderOverlayPlugins?.(e, "overlay");
|
|
236
236
|
let i = t.crosshairHandler?.getPosition();
|
|
237
237
|
if (i && t.panels.length > 0) for (let n of t.panels) {
|
|
238
238
|
let a = n.rect;
|
|
@@ -246,7 +246,7 @@ var ee = class {
|
|
|
246
246
|
if (e.has(l.UI) && this.uiLayer) {
|
|
247
247
|
this.uiLayer.clear();
|
|
248
248
|
let e = this.uiLayer.ctx;
|
|
249
|
-
if (t.priceAxis?.render(e, n, r), t.tradingRenderer?.renderAxisBadges(e, n, r), t.currentPriceLine?.render(e, n, r), t.timeAxis?.render(e, n, r, i, t.timeAxisY), t.crosshairHandler?.renderAxisLabels(e, n, r, i, t.timeAxisY), t.chartLegend?.render(e, n, r, i), t.barCountdown?.render(e, n, r, i), t.panels.length > 0) {
|
|
249
|
+
if (t.priceAxis?.render(e, n, r), t.tradingRenderer?.renderAxisBadges(e, n, r), t.currentPriceLine?.render(e, n, r), t.timeAxis?.render(e, n, r, i, t.timeAxisY), t.crosshairHandler?.renderAxisLabels(e, n, r, i, t.timeAxisY), t.chartLegend?.render(e, n, r, i), t.barCountdown?.render(e, n, r, i), t.renderOverlayPlugins?.(e, "ui"), t.panels.length > 0) {
|
|
250
250
|
let n = t.crosshairHandler?.getPosition(), o = t.indicatorEngine, s = `${r.font.sizeSmall}px ${r.font.family}`, c;
|
|
251
251
|
if (o) {
|
|
252
252
|
let e = o.getPanelIndicators();
|
|
@@ -466,7 +466,53 @@ var re = class {
|
|
|
466
466
|
}
|
|
467
467
|
e.strokeStyle = r.candleUpWick, e.lineWidth = 1, e.stroke(_), e.strokeStyle = r.candleDownWick, e.stroke(v), e.fillStyle = r.candleUp, e.fill(y), e.fillStyle = r.candleDown, e.fill(b);
|
|
468
468
|
}
|
|
469
|
-
}
|
|
469
|
+
};
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region src/charts/downsample.ts
|
|
472
|
+
function ie(e, t, n) {
|
|
473
|
+
if (t >= e) {
|
|
474
|
+
let t = Array(Math.max(0, e));
|
|
475
|
+
for (let n = 0; n < e; n++) t[n] = n;
|
|
476
|
+
return t;
|
|
477
|
+
}
|
|
478
|
+
if (t <= 2) return e >= 2 ? [0, e - 1] : e === 1 ? [0] : [];
|
|
479
|
+
let r = [0], i = (e - 2) / (t - 2), a = 0;
|
|
480
|
+
for (let o = 0; o < t - 2; o++) {
|
|
481
|
+
let t = Math.floor((o + 1) * i) + 1, s = Math.floor((o + 2) * i) + 1;
|
|
482
|
+
s > e && (s = e);
|
|
483
|
+
let c = 0, l = 0, u = 0;
|
|
484
|
+
for (let e = t; e < s; e++) c += e, l += n(e), u++;
|
|
485
|
+
if (u > 0) c /= u, l /= u;
|
|
486
|
+
else {
|
|
487
|
+
let r = Math.min(t, e - 1);
|
|
488
|
+
c = r, l = n(r);
|
|
489
|
+
}
|
|
490
|
+
let d = Math.floor(o * i) + 1, f = Math.floor((o + 1) * i) + 1, p = n(a), m = -1, h = d;
|
|
491
|
+
for (let e = d; e < f; e++) {
|
|
492
|
+
let t = Math.abs((a - c) * (n(e) - p) - (a - e) * (l - p));
|
|
493
|
+
t > m && (m = t, h = e);
|
|
494
|
+
}
|
|
495
|
+
r.push(h), a = h;
|
|
496
|
+
}
|
|
497
|
+
return r.push(e - 1), r;
|
|
498
|
+
}
|
|
499
|
+
var ae = 64;
|
|
500
|
+
function oe(e, t, n, r, i) {
|
|
501
|
+
let a = Math.max(0, e), o = Math.min(t, n - 1);
|
|
502
|
+
if (o < a) return [];
|
|
503
|
+
let s = o - a + 1, c = Math.max(ae, Math.ceil(r * 2));
|
|
504
|
+
if (s <= c) {
|
|
505
|
+
let e = Array(s);
|
|
506
|
+
for (let t = 0; t < s; t++) e[t] = a + t;
|
|
507
|
+
return e;
|
|
508
|
+
}
|
|
509
|
+
let l = ie(s, c, (e) => i(a + e));
|
|
510
|
+
for (let e = 0; e < l.length; e++) l[e] += a;
|
|
511
|
+
return l;
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/charts/LineRenderer.ts
|
|
515
|
+
var se = class {
|
|
470
516
|
render(e, t, n, r) {
|
|
471
517
|
let { from: i, to: a } = n.visibleRange;
|
|
472
518
|
if (i > a || t.length === 0) return;
|
|
@@ -474,28 +520,36 @@ var re = class {
|
|
|
474
520
|
if (u === 0) return;
|
|
475
521
|
let d = n.chartRect.y, f = n.chartRect.height / u;
|
|
476
522
|
e.beginPath(), e.strokeStyle = r.lineColor, e.lineWidth = 2, e.lineJoin = "round";
|
|
477
|
-
let p = !1;
|
|
478
|
-
for (let n
|
|
523
|
+
let p = oe(i, a, t.length, n.chartRect.width, (e) => t[e].close), m = !1;
|
|
524
|
+
for (let n of p) {
|
|
479
525
|
let r = n * o + s, i = d + (l - t[n].close) * f;
|
|
480
|
-
|
|
526
|
+
m ? e.lineTo(r, i) : (e.moveTo(r, i), m = !0);
|
|
481
527
|
}
|
|
482
528
|
e.stroke();
|
|
483
529
|
}
|
|
484
|
-
},
|
|
530
|
+
}, ce = class {
|
|
485
531
|
render(e, t, n, r) {
|
|
486
532
|
let { from: i, to: a } = n.visibleRange;
|
|
487
533
|
if (i > a || t.length === 0) return;
|
|
488
534
|
let o = n.barWidth + n.barSpacing, s = -n.offset + n.chartRect.x + n.barWidth / 2, { min: c, max: l } = n.priceRange, u = l - c;
|
|
489
535
|
if (u === 0) return;
|
|
490
|
-
let d = n.chartRect.y, f = n.chartRect.height, p = f / u, m = d + f, h = i
|
|
491
|
-
|
|
492
|
-
let v =
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
for (let n =
|
|
536
|
+
let d = n.chartRect.y, f = n.chartRect.height, p = f / u, m = d + f, h = oe(i, a, t.length, n.chartRect.width, (e) => t[e].close);
|
|
537
|
+
if (h.length === 0) return;
|
|
538
|
+
let g = h[0], _ = g * o + s, v = d + (l - t[g].close) * p, y = e.createLinearGradient(0, d, 0, m);
|
|
539
|
+
y.addColorStop(0, r.areaTopColor), y.addColorStop(1, r.areaBottomColor), e.beginPath(), e.moveTo(_, m), e.lineTo(_, v);
|
|
540
|
+
let b = _;
|
|
541
|
+
for (let n = 1; n < h.length; n++) {
|
|
542
|
+
let r = h[n];
|
|
543
|
+
b = r * o + s, e.lineTo(b, d + (l - t[r].close) * p);
|
|
544
|
+
}
|
|
545
|
+
e.lineTo(b, m), e.closePath(), e.fillStyle = y, e.fill(), e.beginPath(), e.strokeStyle = r.lineColor, e.lineWidth = 2, e.lineJoin = "round", e.moveTo(_, v);
|
|
546
|
+
for (let n = 1; n < h.length; n++) {
|
|
547
|
+
let r = h[n];
|
|
548
|
+
e.lineTo(r * o + s, d + (l - t[r].close) * p);
|
|
549
|
+
}
|
|
496
550
|
e.stroke();
|
|
497
551
|
}
|
|
498
|
-
},
|
|
552
|
+
}, le = class {
|
|
499
553
|
render(e, t, n, r) {
|
|
500
554
|
let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
|
|
501
555
|
if (f === 0) return;
|
|
@@ -506,7 +560,7 @@ var re = class {
|
|
|
506
560
|
}
|
|
507
561
|
e.lineWidth = 1, e.strokeStyle = r.candleUp, e.stroke(_), e.strokeStyle = r.candleDown, e.stroke(v);
|
|
508
562
|
}
|
|
509
|
-
},
|
|
563
|
+
}, ue = class {
|
|
510
564
|
render(e, t, n, r) {
|
|
511
565
|
let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
|
|
512
566
|
if (f === 0) return;
|
|
@@ -525,7 +579,7 @@ var re = class {
|
|
|
525
579
|
e.strokeStyle = r.candleDown;
|
|
526
580
|
for (let t of b) e.strokeRect(t.x, t.y, t.w, t.h);
|
|
527
581
|
}
|
|
528
|
-
},
|
|
582
|
+
}, de = class {
|
|
529
583
|
baselinePrice = null;
|
|
530
584
|
setBaseline(e) {
|
|
531
585
|
this.baselinePrice = e;
|
|
@@ -566,7 +620,7 @@ var re = class {
|
|
|
566
620
|
for (let a = t; a <= n && a < e.length; a++) r += e[a].close, i++;
|
|
567
621
|
return i > 0 ? r / i : 0;
|
|
568
622
|
}
|
|
569
|
-
},
|
|
623
|
+
}, fe = class {
|
|
570
624
|
render(e, t, n, r) {
|
|
571
625
|
let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
|
|
572
626
|
if (f === 0) return;
|
|
@@ -577,7 +631,7 @@ var re = class {
|
|
|
577
631
|
}
|
|
578
632
|
e.fillStyle = r.candleUp, e.fill(_), e.fillStyle = r.candleDown, e.fill(v), e.lineWidth = 1, e.strokeStyle = r.candleUp, e.stroke(y), e.strokeStyle = r.candleDown, e.stroke(b);
|
|
579
633
|
}
|
|
580
|
-
},
|
|
634
|
+
}, pe = class {
|
|
581
635
|
render(e, t, n, r) {
|
|
582
636
|
let { from: i, to: a } = n.visibleRange, o = n.barWidth, s = o / 2, c = o + n.barSpacing, l = -n.offset + n.chartRect.x + s, { min: u, max: d } = n.priceRange, f = d - u;
|
|
583
637
|
if (f === 0) return;
|
|
@@ -591,7 +645,7 @@ var re = class {
|
|
|
591
645
|
}
|
|
592
646
|
e.strokeStyle = r.candleUp, e.lineWidth = 3, e.stroke(_), e.strokeStyle = r.candleDown, e.lineWidth = 1, e.stroke(v);
|
|
593
647
|
}
|
|
594
|
-
},
|
|
648
|
+
}, me = class {
|
|
595
649
|
boxSize = 1;
|
|
596
650
|
setBoxSize(e) {
|
|
597
651
|
this.boxSize = e;
|
|
@@ -609,7 +663,7 @@ var re = class {
|
|
|
609
663
|
}
|
|
610
664
|
e.lineWidth = 1.5, e.strokeStyle = r.candleUp, e.stroke(y), e.strokeStyle = r.candleDown, e.stroke(b);
|
|
611
665
|
}
|
|
612
|
-
},
|
|
666
|
+
}, he = class {
|
|
613
667
|
render(e, t, n, r) {
|
|
614
668
|
let { from: i, to: a } = n.visibleRange, { min: o, max: s } = n.priceRange, c = s - o;
|
|
615
669
|
if (c === 0 || i > a || t.length === 0) return;
|
|
@@ -625,7 +679,7 @@ var re = class {
|
|
|
625
679
|
}
|
|
626
680
|
e.strokeStyle = r.candleUpWick, e.lineWidth = 1, e.stroke(h), e.strokeStyle = r.candleDownWick, e.stroke(g), e.fillStyle = r.candleUp, e.fill(_), e.fillStyle = r.candleDown, e.fill(v);
|
|
627
681
|
}
|
|
628
|
-
},
|
|
682
|
+
}, ge = class {
|
|
629
683
|
render(e, t, n, r) {
|
|
630
684
|
let { from: i, to: a } = n.visibleRange, { min: o, max: s } = n.priceRange, c = s - o;
|
|
631
685
|
if (c === 0 || i > a || t.length === 0) return;
|
|
@@ -637,10 +691,10 @@ var re = class {
|
|
|
637
691
|
let n = t[e], r = e > 0 ? t[e - 1] : n, i = y(e), a = b(n.high), o = b(n.low), s = n.close >= r.close, c = p * Math.max(.15, n.volume / m), l = c / 2, u = Math.max(o - a, 1), d = s ? h : g, f = s ? _ : v;
|
|
638
692
|
d.rect(i - l, a, c, u), f.rect(i - l, a, c, u);
|
|
639
693
|
}
|
|
640
|
-
e.fillStyle =
|
|
694
|
+
e.fillStyle = _e(r.candleUp, .55), e.fill(h), e.fillStyle = _e(r.candleDown, .55), e.fill(g), e.lineWidth = 1, e.strokeStyle = r.candleUpWick, e.stroke(_), e.strokeStyle = r.candleDownWick, e.stroke(v);
|
|
641
695
|
}
|
|
642
696
|
};
|
|
643
|
-
function
|
|
697
|
+
function _e(e, t) {
|
|
644
698
|
if (e.startsWith("#")) {
|
|
645
699
|
let n = Math.round(Math.max(0, Math.min(1, t)) * 255).toString(16).padStart(2, "0");
|
|
646
700
|
if (e.length === 7) return `${e}${n}`;
|
|
@@ -650,7 +704,7 @@ function me(e, t) {
|
|
|
650
704
|
}
|
|
651
705
|
//#endregion
|
|
652
706
|
//#region src/charts/HLCAreaRenderer.ts
|
|
653
|
-
var
|
|
707
|
+
var ve = class {
|
|
654
708
|
render(e, t, n, r) {
|
|
655
709
|
let { from: i, to: a } = n.visibleRange;
|
|
656
710
|
if (i > a || t.length === 0) return;
|
|
@@ -679,7 +733,7 @@ var he = class {
|
|
|
679
733
|
}
|
|
680
734
|
e.stroke();
|
|
681
735
|
}
|
|
682
|
-
},
|
|
736
|
+
}, ye = class {
|
|
683
737
|
render(e, t, n, r) {
|
|
684
738
|
let { from: i, to: a } = n.visibleRange;
|
|
685
739
|
if (i > a || t.length === 0) return;
|
|
@@ -694,7 +748,7 @@ var he = class {
|
|
|
694
748
|
}
|
|
695
749
|
e.stroke();
|
|
696
750
|
}
|
|
697
|
-
},
|
|
751
|
+
}, be = class {
|
|
698
752
|
render(e, t, n, r) {
|
|
699
753
|
let { from: i, to: a } = n.visibleRange;
|
|
700
754
|
if (i > a || t.length === 0) return;
|
|
@@ -715,7 +769,7 @@ var he = class {
|
|
|
715
769
|
for (let { x: e, y: t } of h) _.moveTo(e + g, t), _.arc(e, t, g, 0, Math.PI * 2);
|
|
716
770
|
e.fillStyle = r.lineColor, e.fill(_), e.strokeStyle = r.background, e.lineWidth = 1, e.stroke(_);
|
|
717
771
|
}
|
|
718
|
-
},
|
|
772
|
+
}, xe = class {
|
|
719
773
|
visible = !0;
|
|
720
774
|
heightRatio = .2;
|
|
721
775
|
setVisible(e) {
|
|
@@ -736,7 +790,7 @@ var he = class {
|
|
|
736
790
|
}
|
|
737
791
|
e.globalAlpha = .35, e.fillStyle = r.candleUp, e.fill(h), e.fillStyle = r.candleDown, e.fill(g), e.globalAlpha = 1;
|
|
738
792
|
}
|
|
739
|
-
},
|
|
793
|
+
}, Se = class {
|
|
740
794
|
visible = !1;
|
|
741
795
|
buckets = 48;
|
|
742
796
|
widthRatio = .18;
|
|
@@ -789,17 +843,17 @@ var he = class {
|
|
|
789
843
|
};
|
|
790
844
|
//#endregion
|
|
791
845
|
//#region src/charts/marketProfile.ts
|
|
792
|
-
function
|
|
846
|
+
function Ce(e, t) {
|
|
793
847
|
return e < 0 ? 0 : e > t ? t : e;
|
|
794
848
|
}
|
|
795
|
-
function
|
|
849
|
+
function we(e, t, n, r = {}) {
|
|
796
850
|
let i = Math.max(4, Math.min(500, Math.floor(r.buckets ?? 48))), a = n - t;
|
|
797
851
|
if (a <= 0 || e.length === 0) return null;
|
|
798
852
|
let o = a / i, s = new Float64Array(i);
|
|
799
853
|
for (let r of e) {
|
|
800
854
|
let e = Math.min(r.low, r.high), a = Math.max(r.low, r.high);
|
|
801
855
|
if (a < t || e > n) continue;
|
|
802
|
-
let c =
|
|
856
|
+
let c = Ce(Math.floor((e - t) / o), i - 1), l = Ce(Math.floor((a - t) / o), i - 1);
|
|
803
857
|
for (let e = c; e <= l; e++) s[e] += 1;
|
|
804
858
|
}
|
|
805
859
|
let c = 0, l = 0, u = 0;
|
|
@@ -829,11 +883,11 @@ function xe(e, t, n, r = {}) {
|
|
|
829
883
|
valueAreaHigh: t + (p + 1) * o
|
|
830
884
|
};
|
|
831
885
|
}
|
|
832
|
-
function
|
|
886
|
+
function Te(e) {
|
|
833
887
|
let t = (e % 52 + 52) % 52;
|
|
834
888
|
return t < 26 ? String.fromCharCode(65 + t) : String.fromCharCode(97 + t - 26);
|
|
835
889
|
}
|
|
836
|
-
function
|
|
890
|
+
function Ee(e, t, n, r = 48) {
|
|
837
891
|
let i = Math.max(4, Math.min(500, Math.floor(r))), a = n - t, o = Array.from({ length: i }, () => []);
|
|
838
892
|
if (a <= 0) return o;
|
|
839
893
|
let s = a / i;
|
|
@@ -844,10 +898,10 @@ function Ce(e, t, n, r = 48) {
|
|
|
844
898
|
for (let e = l; e <= u; e++) o[e].push(r);
|
|
845
899
|
}), o;
|
|
846
900
|
}
|
|
847
|
-
function
|
|
901
|
+
function De(e, t, n, r = {}) {
|
|
848
902
|
if (e.length === 0 || n - t <= 0) return [];
|
|
849
903
|
let i = [], a = 0, o = b(e[0].time, "1d"), s = (a, o, s) => {
|
|
850
|
-
let c =
|
|
904
|
+
let c = we(e.slice(a, o + 1), t, n, r);
|
|
851
905
|
c && i.push({
|
|
852
906
|
startIndex: a,
|
|
853
907
|
endIndex: o,
|
|
@@ -863,7 +917,7 @@ function we(e, t, n, r = {}) {
|
|
|
863
917
|
}
|
|
864
918
|
//#endregion
|
|
865
919
|
//#region src/charts/MarketProfileRenderer.ts
|
|
866
|
-
var
|
|
920
|
+
var Oe = class {
|
|
867
921
|
visible = !1;
|
|
868
922
|
buckets = 48;
|
|
869
923
|
widthRatio = .18;
|
|
@@ -919,7 +973,7 @@ var Te = class {
|
|
|
919
973
|
this.lastStats = null, this.renderSplit(e, u, c, n, r);
|
|
920
974
|
return;
|
|
921
975
|
}
|
|
922
|
-
let d =
|
|
976
|
+
let d = we(u, s.min, s.max, {
|
|
923
977
|
buckets: this.buckets,
|
|
924
978
|
valueAreaPct: this.valueAreaPct
|
|
925
979
|
});
|
|
@@ -955,7 +1009,7 @@ var Te = class {
|
|
|
955
1009
|
this.showStats && this.drawStats(e, o.x + 6, o.y + 6, f, d.valueAreaHigh, d.valueAreaLow, r), e.restore();
|
|
956
1010
|
}
|
|
957
1011
|
renderSplit(e, t, n, r, i) {
|
|
958
|
-
let { chartRect: a, priceRange: o } = r, s =
|
|
1012
|
+
let { chartRect: a, priceRange: o } = r, s = De(t, o.min, o.max, {
|
|
959
1013
|
buckets: this.buckets,
|
|
960
1014
|
valueAreaPct: this.valueAreaPct
|
|
961
1015
|
});
|
|
@@ -963,7 +1017,7 @@ var Te = class {
|
|
|
963
1017
|
let c = o.max - o.min, l = (e) => a.y + a.height * (1 - (e - o.min) / c), u = r.barWidth / 2;
|
|
964
1018
|
e.save();
|
|
965
1019
|
for (let c of s) {
|
|
966
|
-
let s = c.profile, d = s.buckets.length, f = a.height / d, p = O(n + c.startIndex, r) - u, m = O(n + c.endIndex, r) + u, h = Math.max(2, m - p), g = 1 / s.maxCount, _ = this.letters && f >= 7, v = _ ?
|
|
1020
|
+
let s = c.profile, d = s.buckets.length, f = a.height / d, p = O(n + c.startIndex, r) - u, m = O(n + c.endIndex, r) + u, h = Math.max(2, m - p), g = 1 / s.maxCount, _ = this.letters && f >= 7, v = _ ? Ee(t.slice(c.startIndex, c.endIndex + 1), o.min, o.max, this.buckets) : null;
|
|
967
1021
|
if (_ && v) {
|
|
968
1022
|
e.font = `${Math.min(11, Math.floor(f))}px ui-monospace, monospace`, e.textBaseline = "middle", e.textAlign = "left";
|
|
969
1023
|
let t = Math.max(1, Math.floor(h / 6));
|
|
@@ -973,7 +1027,7 @@ var Te = class {
|
|
|
973
1027
|
let o = a.y + a.height - (n + .5) * f, c = s.buckets[n].mid >= s.valueAreaLow && s.buckets[n].mid <= s.valueAreaHigh;
|
|
974
1028
|
e.globalAlpha = c ? .95 : .6, e.fillStyle = c ? i.candleUp : i.textSecondary;
|
|
975
1029
|
let l = Math.min(r.length, t);
|
|
976
|
-
for (let t = 0; t < l; t++) e.fillText(
|
|
1030
|
+
for (let t = 0; t < l; t++) e.fillText(Te(r[t]), p + t * 6, o);
|
|
977
1031
|
}
|
|
978
1032
|
} else for (let t = 0; t < d; t++) {
|
|
979
1033
|
let n = s.buckets[t];
|
|
@@ -989,7 +1043,7 @@ var Te = class {
|
|
|
989
1043
|
e.restore();
|
|
990
1044
|
}
|
|
991
1045
|
drawStats(e, t, n, r, i, a, o) {
|
|
992
|
-
let s =
|
|
1046
|
+
let s = ke(r), c = [
|
|
993
1047
|
[
|
|
994
1048
|
"POC",
|
|
995
1049
|
r.toFixed(s),
|
|
@@ -1010,22 +1064,22 @@ var Te = class {
|
|
|
1010
1064
|
let l = 0;
|
|
1011
1065
|
for (let [, t] of c) l = Math.max(l, e.measureText(t).width);
|
|
1012
1066
|
let u = 38 + l, d = 6 + c.length * 14;
|
|
1013
|
-
e.fillStyle = o.background, e.globalAlpha = .82,
|
|
1067
|
+
e.fillStyle = o.background, e.globalAlpha = .82, Ae(e, t, n, u, d, 4), e.fill(), e.globalAlpha = 1, c.forEach(([r, i, a], s) => {
|
|
1014
1068
|
let c = n + 6 / 2 + 14 / 2 + s * 14;
|
|
1015
1069
|
e.fillStyle = a, e.textAlign = "left", e.fillText(r, t + 6, c), e.fillStyle = o.text, e.textAlign = "right", e.fillText(i, t + u - 6, c);
|
|
1016
1070
|
}), e.textAlign = "left";
|
|
1017
1071
|
}
|
|
1018
1072
|
};
|
|
1019
|
-
function
|
|
1073
|
+
function ke(e) {
|
|
1020
1074
|
let t = Math.abs(e);
|
|
1021
1075
|
return t >= 1e3 ? 2 : t >= 1 ? 4 : 6;
|
|
1022
1076
|
}
|
|
1023
|
-
function
|
|
1077
|
+
function Ae(e, t, n, r, i, a) {
|
|
1024
1078
|
e.beginPath(), e.moveTo(t + a, n), e.arcTo(t + r, n, t + r, n + i, a), e.arcTo(t + r, n + i, t, n + i, a), e.arcTo(t, n + i, t, n, a), e.arcTo(t, n, t + r, n, a), e.closePath();
|
|
1025
1079
|
}
|
|
1026
1080
|
//#endregion
|
|
1027
1081
|
//#region src/charts/periodLevels.ts
|
|
1028
|
-
function
|
|
1082
|
+
function je(e, t) {
|
|
1029
1083
|
let n = t === "day" ? "1d" : "1w", r = [];
|
|
1030
1084
|
for (let t of e) {
|
|
1031
1085
|
let e = b(t.time, n), i = r[r.length - 1];
|
|
@@ -1039,8 +1093,8 @@ function Oe(e, t) {
|
|
|
1039
1093
|
}
|
|
1040
1094
|
return r;
|
|
1041
1095
|
}
|
|
1042
|
-
function
|
|
1043
|
-
let n =
|
|
1096
|
+
function Me(e, t = "day") {
|
|
1097
|
+
let n = je(e, t);
|
|
1044
1098
|
if (n.length < 2) return [];
|
|
1045
1099
|
let r = n[n.length - 2], i = n[n.length - 1], a = t === "day" ? "D" : "W";
|
|
1046
1100
|
return [
|
|
@@ -1068,7 +1122,7 @@ function ke(e, t = "day") {
|
|
|
1068
1122
|
}
|
|
1069
1123
|
//#endregion
|
|
1070
1124
|
//#region src/charts/PeriodLevelsRenderer.ts
|
|
1071
|
-
var
|
|
1125
|
+
var Ne = class {
|
|
1072
1126
|
visible = !1;
|
|
1073
1127
|
period = "day";
|
|
1074
1128
|
setVisible(e) {
|
|
@@ -1085,14 +1139,14 @@ var Ae = class {
|
|
|
1085
1139
|
}
|
|
1086
1140
|
render(e, t, n, r) {
|
|
1087
1141
|
if (!this.visible || t.length === 0) return;
|
|
1088
|
-
let i =
|
|
1142
|
+
let i = Me(t, this.period);
|
|
1089
1143
|
if (i.length === 0) return;
|
|
1090
1144
|
let { chartRect: a } = n, o = a.y, s = a.y + a.height;
|
|
1091
1145
|
e.save(), e.font = `600 10px ${r.font.family}`, e.textBaseline = "middle";
|
|
1092
1146
|
for (let t of i) {
|
|
1093
1147
|
let i = k(t.price, n);
|
|
1094
1148
|
if (i < o || i > s) continue;
|
|
1095
|
-
let c =
|
|
1149
|
+
let c = Pe(t, r);
|
|
1096
1150
|
e.strokeStyle = c, e.globalAlpha = .7, e.lineWidth = 1, e.setLineDash([5, 4]), e.beginPath(), e.moveTo(a.x, Math.round(i) + .5), e.lineTo(a.x + a.width, Math.round(i) + .5), e.stroke(), e.setLineDash([]), e.globalAlpha = 1;
|
|
1097
1151
|
let l = t.label, u = e.measureText(l).width, d = a.x + a.width - u - 10;
|
|
1098
1152
|
e.fillStyle = r.background, e.globalAlpha = .85, e.fillRect(d - 4, i - 7, u + 8, 14), e.globalAlpha = 1, e.fillStyle = c, e.textAlign = "left", e.fillText(l, d, i + .5);
|
|
@@ -1100,12 +1154,12 @@ var Ae = class {
|
|
|
1100
1154
|
e.restore();
|
|
1101
1155
|
}
|
|
1102
1156
|
};
|
|
1103
|
-
function
|
|
1157
|
+
function Pe(e, t) {
|
|
1104
1158
|
return e.id.endsWith("h") ? t.candleUp : e.id.endsWith("l") ? t.candleDown : t.textSecondary;
|
|
1105
1159
|
}
|
|
1106
1160
|
//#endregion
|
|
1107
1161
|
//#region src/charts/pivots.ts
|
|
1108
|
-
function
|
|
1162
|
+
function Fe(e) {
|
|
1109
1163
|
let t, n;
|
|
1110
1164
|
return e.map((e) => {
|
|
1111
1165
|
let r;
|
|
@@ -1115,7 +1169,7 @@ function Me(e) {
|
|
|
1115
1169
|
};
|
|
1116
1170
|
});
|
|
1117
1171
|
}
|
|
1118
|
-
function
|
|
1172
|
+
function Ie(e, t = 5, n = 5) {
|
|
1119
1173
|
let r = Math.max(1, Math.floor(t)), i = Math.max(1, Math.floor(n)), a = [];
|
|
1120
1174
|
for (let t = r; t < e.length - i; t++) {
|
|
1121
1175
|
let n = e[t].high, o = e[t].low, s = !0, c = !0;
|
|
@@ -1134,7 +1188,7 @@ function Ne(e, t = 5, n = 5) {
|
|
|
1134
1188
|
}
|
|
1135
1189
|
//#endregion
|
|
1136
1190
|
//#region src/charts/PivotMarkersRenderer.ts
|
|
1137
|
-
var
|
|
1191
|
+
var Le = class {
|
|
1138
1192
|
visible = !1;
|
|
1139
1193
|
left = 5;
|
|
1140
1194
|
right = 5;
|
|
@@ -1157,27 +1211,27 @@ var Pe = class {
|
|
|
1157
1211
|
}
|
|
1158
1212
|
render(e, t, n, r) {
|
|
1159
1213
|
if (!this.visible || t.length === 0) return;
|
|
1160
|
-
let i =
|
|
1214
|
+
let i = Ie(t, this.left, this.right);
|
|
1161
1215
|
if (i.length === 0) return;
|
|
1162
|
-
let a = this.structureLabels ?
|
|
1216
|
+
let a = this.structureLabels ? Fe(i) : i, { from: o, to: s } = n.visibleRange;
|
|
1163
1217
|
e.save(), e.font = `10px ${r.font.family}`, e.textAlign = "center";
|
|
1164
1218
|
for (let t of a) {
|
|
1165
1219
|
if (t.index < o - 1 || t.index > s + 1) continue;
|
|
1166
1220
|
let i = O(t.index, n), a = k(t.price, n), c = t.type === "high", l = c ? r.candleDown : r.candleUp, u = c ? a - 8 : a + 8;
|
|
1167
1221
|
e.fillStyle = l, e.beginPath(), c ? (e.moveTo(i - 5, u - 5), e.lineTo(i + 5, u - 5), e.lineTo(i, u)) : (e.moveTo(i - 5, u + 5), e.lineTo(i + 5, u + 5), e.lineTo(i, u)), e.closePath(), e.fill();
|
|
1168
|
-
let d = this.structureLabels && "label" in t ? String(t.label) : this.showLabels ?
|
|
1222
|
+
let d = this.structureLabels && "label" in t ? String(t.label) : this.showLabels ? Re(t.price) : null;
|
|
1169
1223
|
d && (e.textBaseline = c ? "bottom" : "top", e.fillText(d, i, c ? u - 5 - 1 : u + 5 + 1));
|
|
1170
1224
|
}
|
|
1171
1225
|
e.restore();
|
|
1172
1226
|
}
|
|
1173
1227
|
};
|
|
1174
|
-
function
|
|
1228
|
+
function Re(e) {
|
|
1175
1229
|
let t = Math.abs(e);
|
|
1176
1230
|
return t >= 1e3 || t >= 1 ? e.toFixed(2) : e.toPrecision(4);
|
|
1177
1231
|
}
|
|
1178
1232
|
//#endregion
|
|
1179
1233
|
//#region src/charts/DepthHeatmapBuffer.ts
|
|
1180
|
-
var
|
|
1234
|
+
var ze = class {
|
|
1181
1235
|
buffer = [];
|
|
1182
1236
|
constructor(e = 240) {
|
|
1183
1237
|
this.capacity = e, this.capacity = Math.max(1, Math.floor(e));
|
|
@@ -1210,8 +1264,8 @@ var Ie = class {
|
|
|
1210
1264
|
get size() {
|
|
1211
1265
|
return this.buffer.length;
|
|
1212
1266
|
}
|
|
1213
|
-
},
|
|
1214
|
-
buffer = new
|
|
1267
|
+
}, Be = class {
|
|
1268
|
+
buffer = new ze(240);
|
|
1215
1269
|
visible = !1;
|
|
1216
1270
|
opacity = .7;
|
|
1217
1271
|
setVisible(e) {
|
|
@@ -1250,7 +1304,7 @@ var Ie = class {
|
|
|
1250
1304
|
}
|
|
1251
1305
|
drawSide(e, t, n, r, i, a, o, s, c) {
|
|
1252
1306
|
if (t.length === 0) return;
|
|
1253
|
-
let l =
|
|
1307
|
+
let l = Ve(t, a);
|
|
1254
1308
|
e.fillStyle = n;
|
|
1255
1309
|
for (let n of t) {
|
|
1256
1310
|
let t = k(n.price, a);
|
|
@@ -1259,7 +1313,7 @@ var Ie = class {
|
|
|
1259
1313
|
e.globalAlpha = 1;
|
|
1260
1314
|
}
|
|
1261
1315
|
};
|
|
1262
|
-
function
|
|
1316
|
+
function Ve(e, t) {
|
|
1263
1317
|
if (e.length < 2) return 3;
|
|
1264
1318
|
let n = e.map((e) => e.price).sort((e, t) => e - t), r = [];
|
|
1265
1319
|
for (let e = 1; e < n.length; e++) {
|
|
@@ -1273,7 +1327,7 @@ function Re(e, t) {
|
|
|
1273
1327
|
}
|
|
1274
1328
|
//#endregion
|
|
1275
1329
|
//#region src/charts/CompareRenderer.ts
|
|
1276
|
-
var
|
|
1330
|
+
var He = class {
|
|
1277
1331
|
symbols = /* @__PURE__ */ new Map();
|
|
1278
1332
|
mode = "percent";
|
|
1279
1333
|
setMode(e) {
|
|
@@ -1328,7 +1382,7 @@ var ze = class {
|
|
|
1328
1382
|
};
|
|
1329
1383
|
//#endregion
|
|
1330
1384
|
//#region src/charts/transforms/heikinAshi.ts
|
|
1331
|
-
function
|
|
1385
|
+
function Ue(e) {
|
|
1332
1386
|
if (e.length === 0) return [];
|
|
1333
1387
|
let t = [], n = e[0].open, r = (e[0].open + e[0].high + e[0].low + e[0].close) / 4;
|
|
1334
1388
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -1346,10 +1400,10 @@ function Be(e) {
|
|
|
1346
1400
|
}
|
|
1347
1401
|
//#endregion
|
|
1348
1402
|
//#region src/charts/transforms/renko.ts
|
|
1349
|
-
function
|
|
1403
|
+
function We(e, t) {
|
|
1350
1404
|
if (e.length === 0) return [];
|
|
1351
1405
|
let n = t.brickSize;
|
|
1352
|
-
t.useATR && e.length > (t.atrPeriod ?? 14) && (n =
|
|
1406
|
+
t.useATR && e.length > (t.atrPeriod ?? 14) && (n = Ge(e, t.atrPeriod ?? 14)), n <= 0 && (n = 1);
|
|
1353
1407
|
let r = [], i = Math.round(e[0].close / n) * n, a = e[0].time;
|
|
1354
1408
|
for (let t = 1; t < e.length; t++) {
|
|
1355
1409
|
let o = e[t].close - i, s = Math.floor(Math.abs(o) / n);
|
|
@@ -1370,7 +1424,7 @@ function Ve(e, t) {
|
|
|
1370
1424
|
}
|
|
1371
1425
|
return r;
|
|
1372
1426
|
}
|
|
1373
|
-
function
|
|
1427
|
+
function Ge(e, t) {
|
|
1374
1428
|
let n = 0;
|
|
1375
1429
|
for (let r = 1; r <= Math.min(t, e.length - 1); r++) {
|
|
1376
1430
|
let t = Math.max(e[r].high - e[r].low, Math.abs(e[r].high - e[r - 1].close), Math.abs(e[r].low - e[r - 1].close));
|
|
@@ -1380,7 +1434,7 @@ function He(e, t) {
|
|
|
1380
1434
|
}
|
|
1381
1435
|
//#endregion
|
|
1382
1436
|
//#region src/charts/transforms/lineBreak.ts
|
|
1383
|
-
function
|
|
1437
|
+
function Ke(e, t = 3) {
|
|
1384
1438
|
if (e.length === 0) return [];
|
|
1385
1439
|
let n = [], r = 0;
|
|
1386
1440
|
n.push({
|
|
@@ -1421,7 +1475,7 @@ function Ue(e, t = 3) {
|
|
|
1421
1475
|
}
|
|
1422
1476
|
//#endregion
|
|
1423
1477
|
//#region src/charts/transforms/kagi.ts
|
|
1424
|
-
function
|
|
1478
|
+
function qe(e, t = 4) {
|
|
1425
1479
|
if (e.length < 2) return e.slice();
|
|
1426
1480
|
let n = [], r = e[1].close >= e[0].close ? 1 : -1, i = e[0].close, a = e[0].close, o = e[0].close, s = 0;
|
|
1427
1481
|
for (let c = 1; c < e.length; c++) {
|
|
@@ -1460,7 +1514,7 @@ function We(e, t = 4) {
|
|
|
1460
1514
|
}
|
|
1461
1515
|
//#endregion
|
|
1462
1516
|
//#region src/charts/transforms/pointAndFigure.ts
|
|
1463
|
-
function
|
|
1517
|
+
function Je(e, t, n = 3) {
|
|
1464
1518
|
if (e.length === 0 || t <= 0) return [];
|
|
1465
1519
|
let r = [], i = 0, a = 0, o = 0, s = 0, c = Math.round(e[0].close / t) * t;
|
|
1466
1520
|
a = c, o = c, i = 1;
|
|
@@ -1493,7 +1547,7 @@ function Ge(e, t, n = 3) {
|
|
|
1493
1547
|
}
|
|
1494
1548
|
//#endregion
|
|
1495
1549
|
//#region src/charts/transforms/rangeBars.ts
|
|
1496
|
-
function
|
|
1550
|
+
function Ye(e, t) {
|
|
1497
1551
|
if (e.length === 0 || t.rangeSize <= 0) return [];
|
|
1498
1552
|
let n = [], r = e[0].time, i = e[0].open, a = i, o = i, s = 0, c = (e, c) => {
|
|
1499
1553
|
for (e > a && (a = e), e < o && (o = e), s += c; a - o >= t.rangeSize;) {
|
|
@@ -1559,7 +1613,7 @@ var I = class {
|
|
|
1559
1613
|
}
|
|
1560
1614
|
return i;
|
|
1561
1615
|
}
|
|
1562
|
-
},
|
|
1616
|
+
}, Xe = 1, Ze = class {
|
|
1563
1617
|
registry = /* @__PURE__ */ new Map();
|
|
1564
1618
|
instances = /* @__PURE__ */ new Map();
|
|
1565
1619
|
register(e) {
|
|
@@ -1571,7 +1625,7 @@ var I = class {
|
|
|
1571
1625
|
addIndicator(e, t = {}, n) {
|
|
1572
1626
|
let r = this.registry.get(e);
|
|
1573
1627
|
if (!r) throw Error(`Unknown indicator: ${e}`);
|
|
1574
|
-
let i = `tc_${e}_${
|
|
1628
|
+
let i = `tc_${e}_${Xe++}`, a = {
|
|
1575
1629
|
id: e,
|
|
1576
1630
|
instanceId: i,
|
|
1577
1631
|
params: {
|
|
@@ -1689,7 +1743,7 @@ function R(e, t, n, r = 1) {
|
|
|
1689
1743
|
}
|
|
1690
1744
|
//#endregion
|
|
1691
1745
|
//#region src/indicators/overlay/SMA.ts
|
|
1692
|
-
var
|
|
1746
|
+
var Qe = class extends I {
|
|
1693
1747
|
descriptor = {
|
|
1694
1748
|
id: "sma",
|
|
1695
1749
|
name: "Simple Moving Average",
|
|
@@ -1721,7 +1775,7 @@ var Ye = class extends I {
|
|
|
1721
1775
|
}
|
|
1722
1776
|
e.stroke();
|
|
1723
1777
|
}
|
|
1724
|
-
},
|
|
1778
|
+
}, $e = class extends I {
|
|
1725
1779
|
descriptor = {
|
|
1726
1780
|
id: "ema",
|
|
1727
1781
|
name: "Exponential Moving Average",
|
|
@@ -1758,7 +1812,7 @@ var Ye = class extends I {
|
|
|
1758
1812
|
}
|
|
1759
1813
|
e.stroke();
|
|
1760
1814
|
}
|
|
1761
|
-
},
|
|
1815
|
+
}, et = class extends I {
|
|
1762
1816
|
descriptor = {
|
|
1763
1817
|
id: "bb",
|
|
1764
1818
|
name: "Bollinger Bands",
|
|
@@ -1813,7 +1867,7 @@ var Ye = class extends I {
|
|
|
1813
1867
|
e.stroke();
|
|
1814
1868
|
}
|
|
1815
1869
|
}
|
|
1816
|
-
},
|
|
1870
|
+
}, tt = class extends I {
|
|
1817
1871
|
descriptor = {
|
|
1818
1872
|
id: "vwap",
|
|
1819
1873
|
name: "Volume Weighted Average Price",
|
|
@@ -1848,7 +1902,7 @@ var Ye = class extends I {
|
|
|
1848
1902
|
}
|
|
1849
1903
|
e.stroke();
|
|
1850
1904
|
}
|
|
1851
|
-
},
|
|
1905
|
+
}, nt = class extends I {
|
|
1852
1906
|
descriptor = {
|
|
1853
1907
|
id: "ichimoku",
|
|
1854
1908
|
name: "Ichimoku Cloud",
|
|
@@ -1908,7 +1962,7 @@ var Ye = class extends I {
|
|
|
1908
1962
|
};
|
|
1909
1963
|
b(c, l, u, r.colors[0], r.lineWidths[0]), b(d, f, p, r.colors[1] ?? "#FF9800", r.lineWidths[0]), b(m, h, g, r.colors[2] ?? "#26A69A", 1), b(_, v, y, r.colors[3] ?? "#EF5350", 1);
|
|
1910
1964
|
}
|
|
1911
|
-
},
|
|
1965
|
+
}, rt = class extends I {
|
|
1912
1966
|
descriptor = {
|
|
1913
1967
|
id: "psar",
|
|
1914
1968
|
name: "Parabolic SAR",
|
|
@@ -1954,7 +2008,7 @@ var Ye = class extends I {
|
|
|
1954
2008
|
e.beginPath(), e.arc(o, c, s, 0, Math.PI * 2), e.fillStyle = a.trend === 1 ? r.colors[0] : r.colors[1] ?? "#EF5350", e.fill();
|
|
1955
2009
|
}
|
|
1956
2010
|
}
|
|
1957
|
-
},
|
|
2011
|
+
}, it = class extends I {
|
|
1958
2012
|
descriptor = {
|
|
1959
2013
|
id: "supertrend",
|
|
1960
2014
|
name: "Supertrend",
|
|
@@ -2002,7 +2056,7 @@ var Ye = class extends I {
|
|
|
2002
2056
|
d !== 0 && (e.beginPath(), e.strokeStyle = p === 1 ? s : c, e.lineWidth = r.lineWidths[0] + .5, e.moveTo(l, u), e.lineTo(o, f), e.stroke()), l = o, u = f, d = p;
|
|
2003
2057
|
}
|
|
2004
2058
|
}
|
|
2005
|
-
},
|
|
2059
|
+
}, at = class extends I {
|
|
2006
2060
|
descriptor = {
|
|
2007
2061
|
id: "keltner",
|
|
2008
2062
|
name: "Keltner Channel",
|
|
@@ -2059,7 +2113,7 @@ var Ye = class extends I {
|
|
|
2059
2113
|
}
|
|
2060
2114
|
this.drawBand(e, s, l, C(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? r.colors[0], r.lineWidths[0]), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
|
|
2061
2115
|
}
|
|
2062
|
-
},
|
|
2116
|
+
}, ot = class extends I {
|
|
2063
2117
|
descriptor = {
|
|
2064
2118
|
id: "donchian",
|
|
2065
2119
|
name: "Donchian Channel",
|
|
@@ -2104,7 +2158,7 @@ var Ye = class extends I {
|
|
|
2104
2158
|
}
|
|
2105
2159
|
this.drawBand(e, s, l, C(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? "#787B86", 1), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
|
|
2106
2160
|
}
|
|
2107
|
-
},
|
|
2161
|
+
}, st = [
|
|
2108
2162
|
"s3",
|
|
2109
2163
|
"s2",
|
|
2110
2164
|
"s1",
|
|
@@ -2112,7 +2166,7 @@ var Ye = class extends I {
|
|
|
2112
2166
|
"r1",
|
|
2113
2167
|
"r2",
|
|
2114
2168
|
"r3"
|
|
2115
|
-
],
|
|
2169
|
+
], ct = class extends I {
|
|
2116
2170
|
descriptor = {
|
|
2117
2171
|
id: "pivots",
|
|
2118
2172
|
name: "Pivot Points (Classic)",
|
|
@@ -2148,7 +2202,7 @@ var Ye = class extends I {
|
|
|
2148
2202
|
let i = t.series;
|
|
2149
2203
|
if (!i) return;
|
|
2150
2204
|
let { from: a, to: o } = n.visibleRange, s = r.colors[0], c = r.colors[1] ?? "#EF5350", l = r.colors[2] ?? "#26A69A", u = r.lineWidths[0], d = (e) => e === "pp" ? s : e.startsWith("r") ? c : l;
|
|
2151
|
-
for (let t of
|
|
2205
|
+
for (let t of st) {
|
|
2152
2206
|
e.beginPath(), e.strokeStyle = d(t), e.lineWidth = t === "pp" ? u : Math.max(1, u - 1), t !== "pp" && e.setLineDash([4, 3]);
|
|
2153
2207
|
let r = !1;
|
|
2154
2208
|
for (let s = a; s <= o && s < i.length; s++) {
|
|
@@ -2160,7 +2214,7 @@ var Ye = class extends I {
|
|
|
2160
2214
|
e.stroke(), e.setLineDash([]);
|
|
2161
2215
|
}
|
|
2162
2216
|
}
|
|
2163
|
-
},
|
|
2217
|
+
}, lt = class extends I {
|
|
2164
2218
|
descriptor = {
|
|
2165
2219
|
id: "avwap",
|
|
2166
2220
|
name: "Anchored VWAP",
|
|
@@ -2200,7 +2254,7 @@ var Ye = class extends I {
|
|
|
2200
2254
|
}
|
|
2201
2255
|
e.stroke();
|
|
2202
2256
|
}
|
|
2203
|
-
},
|
|
2257
|
+
}, ut = class extends I {
|
|
2204
2258
|
descriptor = {
|
|
2205
2259
|
id: "zigzag",
|
|
2206
2260
|
name: "ZigZag",
|
|
@@ -2265,7 +2319,7 @@ var Ye = class extends I {
|
|
|
2265
2319
|
e.stroke();
|
|
2266
2320
|
}
|
|
2267
2321
|
}
|
|
2268
|
-
},
|
|
2322
|
+
}, dt = class extends I {
|
|
2269
2323
|
descriptor = {
|
|
2270
2324
|
id: "lrc",
|
|
2271
2325
|
name: "Linear Regression Channel",
|
|
@@ -2328,7 +2382,7 @@ var Ye = class extends I {
|
|
|
2328
2382
|
}
|
|
2329
2383
|
this.drawBand(e, s, l, C(r.colors[0], .08)), this.drawLine(e, s, r.colors[0], r.lineWidths[0]), this.drawLine(e, c, r.colors[1] ?? r.colors[0], r.lineWidths[0]), this.drawLine(e, l, r.colors[0], r.lineWidths[0]);
|
|
2330
2384
|
}
|
|
2331
|
-
},
|
|
2385
|
+
}, ft = class extends I {
|
|
2332
2386
|
descriptor = {
|
|
2333
2387
|
id: "hma",
|
|
2334
2388
|
name: "Hull Moving Average",
|
|
@@ -2341,7 +2395,7 @@ var Ye = class extends I {
|
|
|
2341
2395
|
values: r,
|
|
2342
2396
|
series: i
|
|
2343
2397
|
};
|
|
2344
|
-
let a = e.map((e) => e.close), o = Math.max(2, Math.floor(n / 2)), s = Math.max(2, Math.floor(Math.sqrt(n))), c =
|
|
2398
|
+
let a = e.map((e) => e.close), o = Math.max(2, Math.floor(n / 2)), s = Math.max(2, Math.floor(Math.sqrt(n))), c = pt(a, n), l = pt(a, o), u = mt(a.map((e, t) => c[t] === null || l[t] === null ? null : 2 * l[t] - c[t]), s);
|
|
2345
2399
|
for (let t = 0; t < e.length; t++) {
|
|
2346
2400
|
if (u[t] === null) continue;
|
|
2347
2401
|
let n = { value: u[t] };
|
|
@@ -2367,7 +2421,7 @@ var Ye = class extends I {
|
|
|
2367
2421
|
e.stroke();
|
|
2368
2422
|
}
|
|
2369
2423
|
};
|
|
2370
|
-
function
|
|
2424
|
+
function pt(e, t) {
|
|
2371
2425
|
let n = Array(e.length).fill(null);
|
|
2372
2426
|
if (e.length < t) return n;
|
|
2373
2427
|
let r = t * (t + 1) / 2;
|
|
@@ -2378,7 +2432,7 @@ function ut(e, t) {
|
|
|
2378
2432
|
}
|
|
2379
2433
|
return n;
|
|
2380
2434
|
}
|
|
2381
|
-
function
|
|
2435
|
+
function mt(e, t) {
|
|
2382
2436
|
let n = Array(e.length).fill(null), r = t * (t + 1) / 2;
|
|
2383
2437
|
for (let i = t - 1; i < e.length; i++) {
|
|
2384
2438
|
let a = 0, o = !0;
|
|
@@ -2396,7 +2450,7 @@ function dt(e, t) {
|
|
|
2396
2450
|
}
|
|
2397
2451
|
//#endregion
|
|
2398
2452
|
//#region src/indicators/overlay/MTFMovingAverage.ts
|
|
2399
|
-
var
|
|
2453
|
+
var ht = class extends I {
|
|
2400
2454
|
descriptor = {
|
|
2401
2455
|
id: "mtfma",
|
|
2402
2456
|
name: "MTF Moving Average",
|
|
@@ -2444,7 +2498,7 @@ var ft = class extends I {
|
|
|
2444
2498
|
}
|
|
2445
2499
|
e.stroke();
|
|
2446
2500
|
}
|
|
2447
|
-
},
|
|
2501
|
+
}, gt = class extends I {
|
|
2448
2502
|
descriptor = {
|
|
2449
2503
|
id: "svwap",
|
|
2450
2504
|
name: "Session VWAP",
|
|
@@ -2501,7 +2555,7 @@ var ft = class extends I {
|
|
|
2501
2555
|
}
|
|
2502
2556
|
e.stroke();
|
|
2503
2557
|
}
|
|
2504
|
-
},
|
|
2558
|
+
}, _t = class extends I {
|
|
2505
2559
|
descriptor = {
|
|
2506
2560
|
id: "chandelier",
|
|
2507
2561
|
name: "Chandelier Exit",
|
|
@@ -2559,7 +2613,7 @@ var ft = class extends I {
|
|
|
2559
2613
|
};
|
|
2560
2614
|
s("long", r.colors[0] ?? "#26A69A"), s("short", r.colors[1] ?? "#EF5350");
|
|
2561
2615
|
}
|
|
2562
|
-
},
|
|
2616
|
+
}, vt = class extends I {
|
|
2563
2617
|
descriptor = {
|
|
2564
2618
|
id: "alligator",
|
|
2565
2619
|
name: "Alligator",
|
|
@@ -2579,7 +2633,7 @@ var ft = class extends I {
|
|
|
2579
2633
|
values: c,
|
|
2580
2634
|
series: u
|
|
2581
2635
|
};
|
|
2582
|
-
let d = e.map((e) => (e.high + e.low) / 2), f =
|
|
2636
|
+
let d = e.map((e) => (e.high + e.low) / 2), f = yt(d, n), p = yt(d, r), m = yt(d, i), h = Array(l).fill(void 0), g = Array(l).fill(void 0), _ = Array(l).fill(void 0);
|
|
2583
2637
|
for (let e = 0; e < l; e++) f[e] !== void 0 && e + a < l && (h[e + a] = f[e]), p[e] !== void 0 && e + o < l && (g[e + o] = p[e]), m[e] !== void 0 && e + s < l && (_[e + s] = m[e]);
|
|
2584
2638
|
for (let t = 0; t < l; t++) {
|
|
2585
2639
|
if (h[t] === void 0 && g[t] === void 0 && _[t] === void 0) continue;
|
|
@@ -2611,7 +2665,7 @@ var ft = class extends I {
|
|
|
2611
2665
|
s("jaw", r.colors[0] ?? "#2962FF"), s("teeth", r.colors[1] ?? "#EF5350"), s("lips", r.colors[2] ?? "#26A69A");
|
|
2612
2666
|
}
|
|
2613
2667
|
};
|
|
2614
|
-
function
|
|
2668
|
+
function yt(e, t) {
|
|
2615
2669
|
let n = e.length, r = Array(n).fill(void 0);
|
|
2616
2670
|
if (n < t) return r;
|
|
2617
2671
|
let i = 0;
|
|
@@ -2623,7 +2677,7 @@ function gt(e, t) {
|
|
|
2623
2677
|
}
|
|
2624
2678
|
//#endregion
|
|
2625
2679
|
//#region src/indicators/panel/AwesomeOscillator.ts
|
|
2626
|
-
var
|
|
2680
|
+
var bt = class extends I {
|
|
2627
2681
|
descriptor = {
|
|
2628
2682
|
id: "ao",
|
|
2629
2683
|
name: "Awesome Oscillator",
|
|
@@ -2671,7 +2725,7 @@ var _t = class extends I {
|
|
|
2671
2725
|
e.fillStyle = r.up ? m : h, e.fillRect(a - p, s, n.barWidth, c);
|
|
2672
2726
|
}
|
|
2673
2727
|
}
|
|
2674
|
-
},
|
|
2728
|
+
}, xt = class extends I {
|
|
2675
2729
|
descriptor = {
|
|
2676
2730
|
id: "chaikinOsc",
|
|
2677
2731
|
name: "Chaikin Oscillator",
|
|
@@ -2720,7 +2774,7 @@ var _t = class extends I {
|
|
|
2720
2774
|
e.fillStyle = r.value >= 0 ? m : h, e.fillRect(a - p, s, n.barWidth, c);
|
|
2721
2775
|
}
|
|
2722
2776
|
}
|
|
2723
|
-
},
|
|
2777
|
+
}, St = class extends I {
|
|
2724
2778
|
descriptor = {
|
|
2725
2779
|
id: "rsi",
|
|
2726
2780
|
name: "Relative Strength Index",
|
|
@@ -2771,7 +2825,7 @@ var _t = class extends I {
|
|
|
2771
2825
|
}
|
|
2772
2826
|
e.stroke();
|
|
2773
2827
|
}
|
|
2774
|
-
},
|
|
2828
|
+
}, Ct = class extends I {
|
|
2775
2829
|
descriptor = {
|
|
2776
2830
|
id: "macd",
|
|
2777
2831
|
name: "MACD",
|
|
@@ -2838,7 +2892,7 @@ var _t = class extends I {
|
|
|
2838
2892
|
}
|
|
2839
2893
|
e.fillStyle = m, e.fill(v), e.fillStyle = h, e.fill(y), e.strokeStyle = g, e.lineWidth = r.lineWidths[0], e.lineJoin = "round", e.stroke(S), e.strokeStyle = _, e.stroke(C);
|
|
2840
2894
|
}
|
|
2841
|
-
},
|
|
2895
|
+
}, wt = class extends I {
|
|
2842
2896
|
descriptor = {
|
|
2843
2897
|
id: "stochastic",
|
|
2844
2898
|
name: "Stochastic Oscillator",
|
|
@@ -2913,7 +2967,7 @@ var _t = class extends I {
|
|
|
2913
2967
|
};
|
|
2914
2968
|
l("k", r.colors[0]), l("d", r.colors[1] ?? "#FF9800");
|
|
2915
2969
|
}
|
|
2916
|
-
},
|
|
2970
|
+
}, Tt = class extends I {
|
|
2917
2971
|
descriptor = {
|
|
2918
2972
|
id: "atr",
|
|
2919
2973
|
name: "Average True Range",
|
|
@@ -2967,7 +3021,7 @@ var _t = class extends I {
|
|
|
2967
3021
|
}
|
|
2968
3022
|
e.stroke();
|
|
2969
3023
|
}
|
|
2970
|
-
},
|
|
3024
|
+
}, Et = class extends I {
|
|
2971
3025
|
descriptor = {
|
|
2972
3026
|
id: "adx",
|
|
2973
3027
|
name: "Average Directional Index",
|
|
@@ -3040,7 +3094,7 @@ var _t = class extends I {
|
|
|
3040
3094
|
};
|
|
3041
3095
|
l("adx", r.colors[0]), l("plusDI", r.colors[1] ?? "#26A69A"), l("minusDI", r.colors[2] ?? "#EF5350");
|
|
3042
3096
|
}
|
|
3043
|
-
},
|
|
3097
|
+
}, Dt = class extends I {
|
|
3044
3098
|
descriptor = {
|
|
3045
3099
|
id: "obv",
|
|
3046
3100
|
name: "On Balance Volume",
|
|
@@ -3086,7 +3140,7 @@ var _t = class extends I {
|
|
|
3086
3140
|
}
|
|
3087
3141
|
e.stroke();
|
|
3088
3142
|
}
|
|
3089
|
-
},
|
|
3143
|
+
}, Ot = class extends I {
|
|
3090
3144
|
descriptor = {
|
|
3091
3145
|
id: "williamsR",
|
|
3092
3146
|
name: "Williams %R",
|
|
@@ -3126,7 +3180,7 @@ var _t = class extends I {
|
|
|
3126
3180
|
}
|
|
3127
3181
|
e.stroke();
|
|
3128
3182
|
}
|
|
3129
|
-
},
|
|
3183
|
+
}, kt = class extends I {
|
|
3130
3184
|
descriptor = {
|
|
3131
3185
|
id: "cci",
|
|
3132
3186
|
name: "Commodity Channel Index",
|
|
@@ -3181,7 +3235,7 @@ var _t = class extends I {
|
|
|
3181
3235
|
}
|
|
3182
3236
|
e.stroke();
|
|
3183
3237
|
}
|
|
3184
|
-
},
|
|
3238
|
+
}, At = class extends I {
|
|
3185
3239
|
descriptor = {
|
|
3186
3240
|
id: "mfi",
|
|
3187
3241
|
name: "Money Flow Index",
|
|
@@ -3226,7 +3280,7 @@ var _t = class extends I {
|
|
|
3226
3280
|
}
|
|
3227
3281
|
e.stroke();
|
|
3228
3282
|
}
|
|
3229
|
-
},
|
|
3283
|
+
}, jt = class extends I {
|
|
3230
3284
|
descriptor = {
|
|
3231
3285
|
id: "aroon",
|
|
3232
3286
|
name: "Aroon",
|
|
@@ -3268,7 +3322,7 @@ var _t = class extends I {
|
|
|
3268
3322
|
};
|
|
3269
3323
|
l("up", r.colors[0]), l("down", r.colors[1] ?? "#EF5350");
|
|
3270
3324
|
}
|
|
3271
|
-
},
|
|
3325
|
+
}, Mt = class extends I {
|
|
3272
3326
|
descriptor = {
|
|
3273
3327
|
id: "roc",
|
|
3274
3328
|
name: "Rate of Change",
|
|
@@ -3312,7 +3366,7 @@ var _t = class extends I {
|
|
|
3312
3366
|
}
|
|
3313
3367
|
e.stroke();
|
|
3314
3368
|
}
|
|
3315
|
-
},
|
|
3369
|
+
}, Nt = class extends I {
|
|
3316
3370
|
descriptor = {
|
|
3317
3371
|
id: "tsi",
|
|
3318
3372
|
name: "True Strength Index",
|
|
@@ -3381,7 +3435,7 @@ var _t = class extends I {
|
|
|
3381
3435
|
};
|
|
3382
3436
|
h("tsi", r.colors[0]), h("signal", r.colors[1] ?? "#FF9800");
|
|
3383
3437
|
}
|
|
3384
|
-
},
|
|
3438
|
+
}, Pt = class extends I {
|
|
3385
3439
|
descriptor = {
|
|
3386
3440
|
id: "cmf",
|
|
3387
3441
|
name: "Chaikin Money Flow",
|
|
@@ -3426,7 +3480,7 @@ var _t = class extends I {
|
|
|
3426
3480
|
}
|
|
3427
3481
|
}
|
|
3428
3482
|
}
|
|
3429
|
-
},
|
|
3483
|
+
}, Ft = class extends I {
|
|
3430
3484
|
descriptor = {
|
|
3431
3485
|
id: "voldelta",
|
|
3432
3486
|
name: "Volume Delta",
|
|
@@ -3466,7 +3520,7 @@ var _t = class extends I {
|
|
|
3466
3520
|
e.fillStyle = r.up ? f : p, e.fillRect(a - d, s, n.barWidth, c);
|
|
3467
3521
|
}
|
|
3468
3522
|
}
|
|
3469
|
-
},
|
|
3523
|
+
}, It = class extends I {
|
|
3470
3524
|
descriptor = {
|
|
3471
3525
|
id: "vortex",
|
|
3472
3526
|
name: "Vortex Indicator",
|
|
@@ -3531,7 +3585,7 @@ var _t = class extends I {
|
|
|
3531
3585
|
};
|
|
3532
3586
|
p("viPlus", r.colors[0] ?? "#26A69A"), p("viMinus", r.colors[1] ?? "#EF5350");
|
|
3533
3587
|
}
|
|
3534
|
-
},
|
|
3588
|
+
}, Lt = class extends I {
|
|
3535
3589
|
descriptor = {
|
|
3536
3590
|
id: "chop",
|
|
3537
3591
|
name: "Choppiness Index",
|
|
@@ -3583,7 +3637,7 @@ var _t = class extends I {
|
|
|
3583
3637
|
}
|
|
3584
3638
|
e.stroke();
|
|
3585
3639
|
}
|
|
3586
|
-
},
|
|
3640
|
+
}, Rt = class extends I {
|
|
3587
3641
|
descriptor = {
|
|
3588
3642
|
id: "uo",
|
|
3589
3643
|
name: "Ultimate Oscillator",
|
|
@@ -3611,7 +3665,7 @@ var _t = class extends I {
|
|
|
3611
3665
|
return r;
|
|
3612
3666
|
};
|
|
3613
3667
|
for (let t = i; t < e.length; t++) {
|
|
3614
|
-
let u =
|
|
3668
|
+
let u = zt(l(s, t, n), l(c, t, n)), d = zt(l(s, t, r), l(c, t, r)), f = zt(l(s, t, i), l(c, t, i)), p = { value: 100 * (4 * u + 2 * d + f) / 7 };
|
|
3615
3669
|
a.set(e[t].time, p), o[t] = p;
|
|
3616
3670
|
}
|
|
3617
3671
|
return {
|
|
@@ -3639,12 +3693,12 @@ var _t = class extends I {
|
|
|
3639
3693
|
e.stroke();
|
|
3640
3694
|
}
|
|
3641
3695
|
};
|
|
3642
|
-
function
|
|
3696
|
+
function zt(e, t) {
|
|
3643
3697
|
return t === 0 ? 0 : e / t;
|
|
3644
3698
|
}
|
|
3645
3699
|
//#endregion
|
|
3646
3700
|
//#region src/indicators/panel/ForceIndex.ts
|
|
3647
|
-
var
|
|
3701
|
+
var Bt = class extends I {
|
|
3648
3702
|
descriptor = {
|
|
3649
3703
|
id: "fi",
|
|
3650
3704
|
name: "Force Index",
|
|
@@ -3690,7 +3744,7 @@ var Lt = class extends I {
|
|
|
3690
3744
|
}
|
|
3691
3745
|
e.stroke();
|
|
3692
3746
|
}
|
|
3693
|
-
},
|
|
3747
|
+
}, Vt = class extends I {
|
|
3694
3748
|
descriptor = {
|
|
3695
3749
|
id: "crsi",
|
|
3696
3750
|
name: "Connors RSI",
|
|
@@ -3707,9 +3761,9 @@ var Lt = class extends I {
|
|
|
3707
3761
|
values: a,
|
|
3708
3762
|
series: o
|
|
3709
3763
|
};
|
|
3710
|
-
let c = e.map((e) => e.close), l =
|
|
3764
|
+
let c = e.map((e) => e.close), l = Ht(c, n), u = Array(s).fill(0);
|
|
3711
3765
|
for (let e = 1; e < s; e++) c[e] > c[e - 1] ? u[e] = u[e - 1] > 0 ? u[e - 1] + 1 : 1 : c[e] < c[e - 1] ? u[e] = u[e - 1] < 0 ? u[e - 1] - 1 : -1 : u[e] = 0;
|
|
3712
|
-
let d =
|
|
3766
|
+
let d = Ht(u, r), f = Array(s).fill(0);
|
|
3713
3767
|
for (let e = 1; e < s; e++) f[e] = c[e - 1] === 0 ? 0 : (c[e] - c[e - 1]) / c[e - 1] * 100;
|
|
3714
3768
|
for (let t = 0; t < s; t++) {
|
|
3715
3769
|
if (t < i + 1) continue;
|
|
@@ -3745,7 +3799,7 @@ var Lt = class extends I {
|
|
|
3745
3799
|
e.stroke();
|
|
3746
3800
|
}
|
|
3747
3801
|
};
|
|
3748
|
-
function
|
|
3802
|
+
function Ht(e, t) {
|
|
3749
3803
|
let n = e.length, r = Array(n).fill(void 0);
|
|
3750
3804
|
if (n <= t) return r;
|
|
3751
3805
|
let i = 0, a = 0;
|
|
@@ -3762,7 +3816,7 @@ function zt(e, t) {
|
|
|
3762
3816
|
}
|
|
3763
3817
|
//#endregion
|
|
3764
3818
|
//#region src/indicators/panel/Coppock.ts
|
|
3765
|
-
var
|
|
3819
|
+
var Ut = class extends I {
|
|
3766
3820
|
descriptor = {
|
|
3767
3821
|
id: "coppock",
|
|
3768
3822
|
name: "Coppock Curve",
|
|
@@ -3821,7 +3875,7 @@ var Bt = class extends I {
|
|
|
3821
3875
|
}
|
|
3822
3876
|
e.stroke();
|
|
3823
3877
|
}
|
|
3824
|
-
},
|
|
3878
|
+
}, Wt = class extends I {
|
|
3825
3879
|
descriptor = {
|
|
3826
3880
|
id: "kst",
|
|
3827
3881
|
name: "Know Sure Thing",
|
|
@@ -3844,9 +3898,9 @@ var Bt = class extends I {
|
|
|
3844
3898
|
values: d,
|
|
3845
3899
|
series: f
|
|
3846
3900
|
};
|
|
3847
|
-
let m = e.map((e) => e.close), h =
|
|
3901
|
+
let m = e.map((e) => e.close), h = z(Gt(m, n), o), g = z(Gt(m, r), s), _ = z(Gt(m, i), c), v = z(Gt(m, a), l), y = Array(p).fill(void 0);
|
|
3848
3902
|
for (let e = 0; e < p; e++) h[e] === void 0 || g[e] === void 0 || _[e] === void 0 || v[e] === void 0 || (y[e] = h[e] * 1 + g[e] * 2 + _[e] * 3 + v[e] * 4);
|
|
3849
|
-
let b =
|
|
3903
|
+
let b = z(y, u);
|
|
3850
3904
|
for (let t = 0; t < p; t++) {
|
|
3851
3905
|
if (y[t] === void 0) continue;
|
|
3852
3906
|
let n = { value: y[t] };
|
|
@@ -3888,12 +3942,12 @@ var Bt = class extends I {
|
|
|
3888
3942
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
3889
3943
|
}
|
|
3890
3944
|
};
|
|
3891
|
-
function
|
|
3945
|
+
function Gt(e, t) {
|
|
3892
3946
|
let n = Array(e.length).fill(void 0);
|
|
3893
3947
|
for (let r = t; r < e.length; r++) n[r] = e[r - t] === 0 ? 0 : (e[r] - e[r - t]) / e[r - t] * 100;
|
|
3894
3948
|
return n;
|
|
3895
3949
|
}
|
|
3896
|
-
function
|
|
3950
|
+
function z(e, t) {
|
|
3897
3951
|
let n = Array(e.length).fill(void 0);
|
|
3898
3952
|
for (let r = t - 1; r < e.length; r++) {
|
|
3899
3953
|
let i = 0, a = !0;
|
|
@@ -3911,7 +3965,7 @@ function B(e, t) {
|
|
|
3911
3965
|
}
|
|
3912
3966
|
//#endregion
|
|
3913
3967
|
//#region src/indicators/panel/ElderRay.ts
|
|
3914
|
-
var
|
|
3968
|
+
var Kt = class extends I {
|
|
3915
3969
|
descriptor = {
|
|
3916
3970
|
id: "elderray",
|
|
3917
3971
|
name: "Elder Ray",
|
|
@@ -3967,7 +4021,7 @@ var Ht = class extends I {
|
|
|
3967
4021
|
}
|
|
3968
4022
|
e.globalAlpha = 1;
|
|
3969
4023
|
}
|
|
3970
|
-
},
|
|
4024
|
+
}, qt = class extends I {
|
|
3971
4025
|
descriptor = {
|
|
3972
4026
|
id: "stc",
|
|
3973
4027
|
name: "Schaff Trend Cycle",
|
|
@@ -3986,7 +4040,7 @@ var Ht = class extends I {
|
|
|
3986
4040
|
};
|
|
3987
4041
|
let c = e.map((e) => e.close), l = 2 / (n + 1), u = 2 / (r + 1), d = c[0], f = c[0], p = Array(s);
|
|
3988
4042
|
for (let e = 0; e < s; e++) d = e === 0 ? c[0] : c[e] * l + d * (1 - l), f = e === 0 ? c[0] : c[e] * u + f * (1 - u), p[e] = d - f;
|
|
3989
|
-
let m =
|
|
4043
|
+
let m = Jt(Jt(p, i), i);
|
|
3990
4044
|
for (let t = 0; t < s; t++) {
|
|
3991
4045
|
let n = m[t];
|
|
3992
4046
|
if (n === void 0) continue;
|
|
@@ -4018,7 +4072,7 @@ var Ht = class extends I {
|
|
|
4018
4072
|
e.stroke();
|
|
4019
4073
|
}
|
|
4020
4074
|
};
|
|
4021
|
-
function
|
|
4075
|
+
function Jt(e, t) {
|
|
4022
4076
|
let n = e.length, r = Array(n).fill(void 0), i;
|
|
4023
4077
|
for (let a = 0; a < n; a++) {
|
|
4024
4078
|
if (a < t - 1) continue;
|
|
@@ -4039,7 +4093,7 @@ function Wt(e, t) {
|
|
|
4039
4093
|
}
|
|
4040
4094
|
//#endregion
|
|
4041
4095
|
//#region src/indicators/panel/Klinger.ts
|
|
4042
|
-
var
|
|
4096
|
+
var Yt = class extends I {
|
|
4043
4097
|
descriptor = {
|
|
4044
4098
|
id: "kvo",
|
|
4045
4099
|
name: "Klinger Oscillator",
|
|
@@ -4106,7 +4160,7 @@ var Gt = class extends I {
|
|
|
4106
4160
|
};
|
|
4107
4161
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
4108
4162
|
}
|
|
4109
|
-
},
|
|
4163
|
+
}, Xt = class extends I {
|
|
4110
4164
|
descriptor = {
|
|
4111
4165
|
id: "fisher",
|
|
4112
4166
|
name: "Fisher Transform",
|
|
@@ -4167,7 +4221,7 @@ var Gt = class extends I {
|
|
|
4167
4221
|
};
|
|
4168
4222
|
d("value", r.colors[0] ?? "#2962FF"), d("trigger", r.colors[1] ?? "#FF9800");
|
|
4169
4223
|
}
|
|
4170
|
-
},
|
|
4224
|
+
}, Zt = class extends I {
|
|
4171
4225
|
descriptor = {
|
|
4172
4226
|
id: "dpo",
|
|
4173
4227
|
name: "Detrended Price Oscillator",
|
|
@@ -4209,7 +4263,7 @@ var Gt = class extends I {
|
|
|
4209
4263
|
e.fillStyle = r.value >= 0 ? f : p, e.fillRect(a - d, Math.min(o, u), n.barWidth, Math.max(1, Math.abs(o - u)));
|
|
4210
4264
|
}
|
|
4211
4265
|
}
|
|
4212
|
-
},
|
|
4266
|
+
}, Qt = class extends I {
|
|
4213
4267
|
descriptor = {
|
|
4214
4268
|
id: "bop",
|
|
4215
4269
|
name: "Balance of Power",
|
|
@@ -4251,7 +4305,7 @@ var Gt = class extends I {
|
|
|
4251
4305
|
}
|
|
4252
4306
|
e.stroke();
|
|
4253
4307
|
}
|
|
4254
|
-
},
|
|
4308
|
+
}, $t = class extends I {
|
|
4255
4309
|
descriptor = {
|
|
4256
4310
|
id: "massindex",
|
|
4257
4311
|
name: "Mass Index",
|
|
@@ -4308,7 +4362,7 @@ var Gt = class extends I {
|
|
|
4308
4362
|
}
|
|
4309
4363
|
e.stroke();
|
|
4310
4364
|
}
|
|
4311
|
-
},
|
|
4365
|
+
}, en = class extends I {
|
|
4312
4366
|
descriptor = {
|
|
4313
4367
|
id: "cmo",
|
|
4314
4368
|
name: "Chande Momentum",
|
|
@@ -4359,7 +4413,7 @@ var Gt = class extends I {
|
|
|
4359
4413
|
}
|
|
4360
4414
|
e.stroke();
|
|
4361
4415
|
}
|
|
4362
|
-
},
|
|
4416
|
+
}, tn = class extends I {
|
|
4363
4417
|
descriptor = {
|
|
4364
4418
|
id: "trix",
|
|
4365
4419
|
name: "TRIX",
|
|
@@ -4375,9 +4429,9 @@ var Gt = class extends I {
|
|
|
4375
4429
|
values: i,
|
|
4376
4430
|
series: a
|
|
4377
4431
|
};
|
|
4378
|
-
let s =
|
|
4432
|
+
let s = B(B(B(e.map((e) => e.close), n), n), n), c = Array(o).fill(0);
|
|
4379
4433
|
for (let e = 1; e < o; e++) c[e] = s[e - 1] === 0 ? 0 : (s[e] - s[e - 1]) / s[e - 1] * 100;
|
|
4380
|
-
let l =
|
|
4434
|
+
let l = B(c, r), u = 3 * n;
|
|
4381
4435
|
for (let t = u; t < o; t++) {
|
|
4382
4436
|
let n = {
|
|
4383
4437
|
value: c[t],
|
|
@@ -4421,7 +4475,7 @@ var Gt = class extends I {
|
|
|
4421
4475
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
4422
4476
|
}
|
|
4423
4477
|
};
|
|
4424
|
-
function
|
|
4478
|
+
function B(e, t) {
|
|
4425
4479
|
let n = 2 / (t + 1), r = Array(e.length).fill(0), i = e[0] ?? 0;
|
|
4426
4480
|
r[0] = i;
|
|
4427
4481
|
for (let t = 1; t < e.length; t++) i = e[t] * n + i * (1 - n), r[t] = i;
|
|
@@ -4429,7 +4483,7 @@ function V(e, t) {
|
|
|
4429
4483
|
}
|
|
4430
4484
|
//#endregion
|
|
4431
4485
|
//#region src/indicators/panel/EaseOfMovement.ts
|
|
4432
|
-
var
|
|
4486
|
+
var nn = class extends I {
|
|
4433
4487
|
descriptor = {
|
|
4434
4488
|
id: "emv",
|
|
4435
4489
|
name: "Ease of Movement",
|
|
@@ -4458,10 +4512,10 @@ var Qt = class extends I {
|
|
|
4458
4512
|
};
|
|
4459
4513
|
}
|
|
4460
4514
|
render(e, t, n, r) {
|
|
4461
|
-
|
|
4515
|
+
rn(e, t, n, r);
|
|
4462
4516
|
}
|
|
4463
4517
|
};
|
|
4464
|
-
function
|
|
4518
|
+
function rn(e, t, n, r) {
|
|
4465
4519
|
let i = t.series;
|
|
4466
4520
|
if (!i) return;
|
|
4467
4521
|
let { chartRect: a } = n, { from: o, to: s } = n.visibleRange, c = 0;
|
|
@@ -4483,7 +4537,7 @@ function H(e, t, n, r) {
|
|
|
4483
4537
|
}
|
|
4484
4538
|
//#endregion
|
|
4485
4539
|
//#region src/indicators/panel/WilliamsAD.ts
|
|
4486
|
-
var
|
|
4540
|
+
var an = class extends I {
|
|
4487
4541
|
descriptor = {
|
|
4488
4542
|
id: "wad",
|
|
4489
4543
|
name: "Williams A/D",
|
|
@@ -4510,10 +4564,10 @@ var $t = class extends I {
|
|
|
4510
4564
|
};
|
|
4511
4565
|
}
|
|
4512
4566
|
render(e, t, n, r) {
|
|
4513
|
-
|
|
4567
|
+
on(e, t, n, r, O);
|
|
4514
4568
|
}
|
|
4515
4569
|
};
|
|
4516
|
-
function
|
|
4570
|
+
function on(e, t, n, r, i) {
|
|
4517
4571
|
let a = t.series;
|
|
4518
4572
|
if (!a) return;
|
|
4519
4573
|
let { chartRect: o } = n, { from: s, to: c } = n.visibleRange, l = Infinity, u = -Infinity;
|
|
@@ -4535,7 +4589,7 @@ function en(e, t, n, r, i) {
|
|
|
4535
4589
|
}
|
|
4536
4590
|
//#endregion
|
|
4537
4591
|
//#region src/indicators/panel/PriceVolumeTrend.ts
|
|
4538
|
-
var
|
|
4592
|
+
var sn = class extends I {
|
|
4539
4593
|
descriptor = {
|
|
4540
4594
|
id: "pvt",
|
|
4541
4595
|
name: "Price Volume Trend",
|
|
@@ -4562,9 +4616,9 @@ var tn = class extends I {
|
|
|
4562
4616
|
};
|
|
4563
4617
|
}
|
|
4564
4618
|
render(e, t, n, r) {
|
|
4565
|
-
|
|
4619
|
+
on(e, t, n, r, O);
|
|
4566
4620
|
}
|
|
4567
|
-
},
|
|
4621
|
+
}, cn = class extends I {
|
|
4568
4622
|
descriptor = {
|
|
4569
4623
|
id: "chaikinvol",
|
|
4570
4624
|
name: "Chaikin Volatility",
|
|
@@ -4593,9 +4647,9 @@ var tn = class extends I {
|
|
|
4593
4647
|
};
|
|
4594
4648
|
}
|
|
4595
4649
|
render(e, t, n, r) {
|
|
4596
|
-
|
|
4650
|
+
rn(e, t, n, r);
|
|
4597
4651
|
}
|
|
4598
|
-
},
|
|
4652
|
+
}, ln = class extends I {
|
|
4599
4653
|
descriptor = {
|
|
4600
4654
|
id: "rvi",
|
|
4601
4655
|
name: "Relative Vigor Index",
|
|
@@ -4658,7 +4712,7 @@ var tn = class extends I {
|
|
|
4658
4712
|
};
|
|
4659
4713
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
4660
4714
|
}
|
|
4661
|
-
},
|
|
4715
|
+
}, un = class extends I {
|
|
4662
4716
|
descriptor = {
|
|
4663
4717
|
id: "stochrsi",
|
|
4664
4718
|
name: "Stochastic RSI",
|
|
@@ -4676,7 +4730,7 @@ var tn = class extends I {
|
|
|
4676
4730
|
values: o,
|
|
4677
4731
|
series: s
|
|
4678
4732
|
};
|
|
4679
|
-
let l =
|
|
4733
|
+
let l = dn(e.map((e) => e.close), n), u = Array(c).fill(void 0);
|
|
4680
4734
|
for (let e = 0; e < c; e++) {
|
|
4681
4735
|
if (l[e] === void 0) continue;
|
|
4682
4736
|
let t = Infinity, n = -Infinity, i = !0;
|
|
@@ -4689,7 +4743,7 @@ var tn = class extends I {
|
|
|
4689
4743
|
}
|
|
4690
4744
|
i && (u[e] = n - t > 0 ? (l[e] - t) / (n - t) * 100 : 0);
|
|
4691
4745
|
}
|
|
4692
|
-
let d =
|
|
4746
|
+
let d = fn(u, i), f = fn(d, a);
|
|
4693
4747
|
for (let t = 0; t < c; t++) {
|
|
4694
4748
|
if (d[t] === void 0) continue;
|
|
4695
4749
|
let n = { k: d[t] };
|
|
@@ -4727,7 +4781,7 @@ var tn = class extends I {
|
|
|
4727
4781
|
l("k", r.colors[0] ?? "#2962FF"), l("d", r.colors[1] ?? "#FF9800");
|
|
4728
4782
|
}
|
|
4729
4783
|
};
|
|
4730
|
-
function
|
|
4784
|
+
function dn(e, t) {
|
|
4731
4785
|
let n = e.length, r = Array(n).fill(void 0);
|
|
4732
4786
|
if (n <= t) return r;
|
|
4733
4787
|
let i = 0, a = 0;
|
|
@@ -4742,7 +4796,7 @@ function on(e, t) {
|
|
|
4742
4796
|
}
|
|
4743
4797
|
return r;
|
|
4744
4798
|
}
|
|
4745
|
-
function
|
|
4799
|
+
function fn(e, t) {
|
|
4746
4800
|
let n = Array(e.length).fill(void 0);
|
|
4747
4801
|
for (let r = t - 1; r < e.length; r++) {
|
|
4748
4802
|
let i = 0, a = !0;
|
|
@@ -4759,7 +4813,7 @@ function sn(e, t) {
|
|
|
4759
4813
|
}
|
|
4760
4814
|
//#endregion
|
|
4761
4815
|
//#region src/indicators/panel/PercentagePriceOscillator.ts
|
|
4762
|
-
var
|
|
4816
|
+
var pn = class extends I {
|
|
4763
4817
|
descriptor = {
|
|
4764
4818
|
id: "ppo",
|
|
4765
4819
|
name: "Percentage Price Oscillator",
|
|
@@ -4776,9 +4830,9 @@ var cn = class extends I {
|
|
|
4776
4830
|
values: a,
|
|
4777
4831
|
series: o
|
|
4778
4832
|
};
|
|
4779
|
-
let c = e.map((e) => e.close), l =
|
|
4833
|
+
let c = e.map((e) => e.close), l = mn(c, n), u = mn(c, r), d = Array(s).fill(void 0);
|
|
4780
4834
|
for (let e = 0; e < s; e++) l[e] === void 0 || u[e] === void 0 || u[e] === 0 || (d[e] = (l[e] - u[e]) / u[e] * 100);
|
|
4781
|
-
let f =
|
|
4835
|
+
let f = mn(d, i);
|
|
4782
4836
|
for (let t = 0; t < s; t++) {
|
|
4783
4837
|
if (d[t] === void 0) continue;
|
|
4784
4838
|
let n = { value: d[t] };
|
|
@@ -4832,7 +4886,7 @@ var cn = class extends I {
|
|
|
4832
4886
|
f("value", r.colors[0] ?? "#2962FF"), f("signal", r.colors[1] ?? "#FF9800");
|
|
4833
4887
|
}
|
|
4834
4888
|
};
|
|
4835
|
-
function
|
|
4889
|
+
function mn(e, t) {
|
|
4836
4890
|
let n = e.length, r = Array(n).fill(void 0), i = 2 / (t + 1), a, o = 0, s = 0;
|
|
4837
4891
|
for (let c = 0; c < n; c++) {
|
|
4838
4892
|
let n = e[c];
|
|
@@ -4842,7 +4896,7 @@ function ln(e, t) {
|
|
|
4842
4896
|
}
|
|
4843
4897
|
//#endregion
|
|
4844
4898
|
//#region src/indicators/panel/AcceleratorOscillator.ts
|
|
4845
|
-
var
|
|
4899
|
+
var hn = class extends I {
|
|
4846
4900
|
descriptor = {
|
|
4847
4901
|
id: "ac",
|
|
4848
4902
|
name: "Accelerator Oscillator",
|
|
@@ -4856,7 +4910,7 @@ var un = class extends I {
|
|
|
4856
4910
|
series: n
|
|
4857
4911
|
};
|
|
4858
4912
|
let i = e.map((e) => (e.high + e.low) / 2), a = Array(r).fill(void 0);
|
|
4859
|
-
for (let e = 33; e < r; e++) a[e] =
|
|
4913
|
+
for (let e = 33; e < r; e++) a[e] = gn(i, e, 5) - gn(i, e, 34);
|
|
4860
4914
|
for (let i = 37; i < r; i++) {
|
|
4861
4915
|
let r = 0;
|
|
4862
4916
|
for (let e = i - 4; e <= i; e++) r += a[e];
|
|
@@ -4893,14 +4947,14 @@ var un = class extends I {
|
|
|
4893
4947
|
}
|
|
4894
4948
|
}
|
|
4895
4949
|
};
|
|
4896
|
-
function
|
|
4950
|
+
function gn(e, t, n) {
|
|
4897
4951
|
let r = 0;
|
|
4898
4952
|
for (let i = t - n + 1; i <= t; i++) r += e[i];
|
|
4899
4953
|
return r / n;
|
|
4900
4954
|
}
|
|
4901
4955
|
//#endregion
|
|
4902
4956
|
//#region src/indicators/panel/RelativeMomentumIndex.ts
|
|
4903
|
-
var
|
|
4957
|
+
var _n = class extends I {
|
|
4904
4958
|
descriptor = {
|
|
4905
4959
|
id: "rmi",
|
|
4906
4960
|
name: "Relative Momentum Index",
|
|
@@ -4957,7 +5011,7 @@ var fn = class extends I {
|
|
|
4957
5011
|
}
|
|
4958
5012
|
e.stroke();
|
|
4959
5013
|
}
|
|
4960
|
-
},
|
|
5014
|
+
}, vn = class extends I {
|
|
4961
5015
|
descriptor = {
|
|
4962
5016
|
id: "disparity",
|
|
4963
5017
|
name: "Disparity Index",
|
|
@@ -4981,9 +5035,9 @@ var fn = class extends I {
|
|
|
4981
5035
|
};
|
|
4982
5036
|
}
|
|
4983
5037
|
render(e, t, n, r) {
|
|
4984
|
-
|
|
5038
|
+
rn(e, t, n, r);
|
|
4985
5039
|
}
|
|
4986
|
-
},
|
|
5040
|
+
}, yn = class extends I {
|
|
4987
5041
|
descriptor = {
|
|
4988
5042
|
id: "qstick",
|
|
4989
5043
|
name: "Qstick",
|
|
@@ -5010,9 +5064,9 @@ var fn = class extends I {
|
|
|
5010
5064
|
};
|
|
5011
5065
|
}
|
|
5012
5066
|
render(e, t, n, r) {
|
|
5013
|
-
|
|
5067
|
+
rn(e, t, n, r);
|
|
5014
5068
|
}
|
|
5015
|
-
},
|
|
5069
|
+
}, bn = class extends I {
|
|
5016
5070
|
descriptor = {
|
|
5017
5071
|
id: "pgo",
|
|
5018
5072
|
name: "Pretty Good Oscillator",
|
|
@@ -5079,7 +5133,7 @@ var fn = class extends I {
|
|
|
5079
5133
|
}
|
|
5080
5134
|
e.stroke();
|
|
5081
5135
|
}
|
|
5082
|
-
},
|
|
5136
|
+
}, xn = class extends I {
|
|
5083
5137
|
descriptor = {
|
|
5084
5138
|
id: "stddev",
|
|
5085
5139
|
name: "Standard Deviation",
|
|
@@ -5125,7 +5179,7 @@ var fn = class extends I {
|
|
|
5125
5179
|
}
|
|
5126
5180
|
e.stroke();
|
|
5127
5181
|
}
|
|
5128
|
-
},
|
|
5182
|
+
}, Sn = class extends I {
|
|
5129
5183
|
descriptor = {
|
|
5130
5184
|
id: "volumeProfile",
|
|
5131
5185
|
name: "Volume Profile",
|
|
@@ -5175,7 +5229,7 @@ var fn = class extends I {
|
|
|
5175
5229
|
e.fillStyle = l[t] > u * .7 ? r.colors[1] ?? "rgba(255, 152, 0, 0.5)" : r.colors[0] ?? "rgba(33, 150, 243, 0.3)", e.fillRect(i.x, s - d / 2, p, Math.max(d - 1, 1));
|
|
5176
5230
|
}
|
|
5177
5231
|
}
|
|
5178
|
-
},
|
|
5232
|
+
}, Cn = class extends I {
|
|
5179
5233
|
descriptor = {
|
|
5180
5234
|
id: "ad",
|
|
5181
5235
|
name: "Accumulation/Distribution",
|
|
@@ -5221,7 +5275,7 @@ var fn = class extends I {
|
|
|
5221
5275
|
}
|
|
5222
5276
|
e.stroke();
|
|
5223
5277
|
}
|
|
5224
|
-
},
|
|
5278
|
+
}, wn = class extends I {
|
|
5225
5279
|
descriptor = {
|
|
5226
5280
|
id: "vroc",
|
|
5227
5281
|
name: "Volume Rate of Change",
|
|
@@ -5263,19 +5317,19 @@ var fn = class extends I {
|
|
|
5263
5317
|
};
|
|
5264
5318
|
//#endregion
|
|
5265
5319
|
//#region src/indicators/registry.ts
|
|
5266
|
-
function
|
|
5267
|
-
e.register(new
|
|
5320
|
+
function Tn(e) {
|
|
5321
|
+
e.register(new Qe()), e.register(new $e()), e.register(new et()), e.register(new tt()), e.register(new nt()), e.register(new rt()), e.register(new it()), e.register(new at()), e.register(new ot()), e.register(new ct()), e.register(new lt()), e.register(new ut()), e.register(new dt()), e.register(new ft()), e.register(new ht()), e.register(new gt()), e.register(new _t()), e.register(new vt()), e.register(new St()), e.register(new Ct()), e.register(new wt()), e.register(new Tt()), e.register(new Et()), e.register(new Dt()), e.register(new Ot()), e.register(new kt()), e.register(new At()), e.register(new jt()), e.register(new Mt()), e.register(new Nt()), e.register(new Pt()), e.register(new xn()), e.register(new Sn()), e.register(new Cn()), e.register(new wn()), e.register(new bt()), e.register(new xt()), e.register(new Ft()), e.register(new It()), e.register(new Lt()), e.register(new Rt()), e.register(new Bt()), e.register(new Vt()), e.register(new Ut()), e.register(new Wt()), e.register(new Kt()), e.register(new qt()), e.register(new Yt()), e.register(new Xt()), e.register(new Zt()), e.register(new Qt()), e.register(new $t()), e.register(new en()), e.register(new tn()), e.register(new nn()), e.register(new sn()), e.register(new an()), e.register(new cn()), e.register(new ln()), e.register(new un()), e.register(new pn()), e.register(new hn()), e.register(new _n()), e.register(new vn()), e.register(new yn()), e.register(new bn());
|
|
5268
5322
|
}
|
|
5269
5323
|
//#endregion
|
|
5270
5324
|
//#region src/indicators/worker/messages.ts
|
|
5271
|
-
function
|
|
5325
|
+
function En(e) {
|
|
5272
5326
|
if (typeof e != "object" || !e) return !1;
|
|
5273
5327
|
let t = e;
|
|
5274
5328
|
return typeof t.requestId == "number" ? t.type === "result" || t.type === "pong" || t.type === "error" : !1;
|
|
5275
5329
|
}
|
|
5276
5330
|
//#endregion
|
|
5277
5331
|
//#region src/indicators/worker/IndicatorWorkerHost.ts
|
|
5278
|
-
var
|
|
5332
|
+
var Dn = class {
|
|
5279
5333
|
worker;
|
|
5280
5334
|
fallbackPlugins;
|
|
5281
5335
|
timeoutMs;
|
|
@@ -5340,7 +5394,7 @@ var Sn = class {
|
|
|
5340
5394
|
handleMessage(e) {
|
|
5341
5395
|
let t = e.data;
|
|
5342
5396
|
if (t !== void 0) {
|
|
5343
|
-
if (!
|
|
5397
|
+
if (!En(t)) return;
|
|
5344
5398
|
this.dispatchResponse(t);
|
|
5345
5399
|
return;
|
|
5346
5400
|
}
|
|
@@ -5361,7 +5415,7 @@ var Sn = class {
|
|
|
5361
5415
|
t.resolve(e.output);
|
|
5362
5416
|
}
|
|
5363
5417
|
}
|
|
5364
|
-
},
|
|
5418
|
+
}, On = class {
|
|
5365
5419
|
visible = !0;
|
|
5366
5420
|
setVisible(e) {
|
|
5367
5421
|
this.visible = e;
|
|
@@ -5390,7 +5444,7 @@ var Sn = class {
|
|
|
5390
5444
|
}
|
|
5391
5445
|
e.stroke();
|
|
5392
5446
|
}
|
|
5393
|
-
},
|
|
5447
|
+
}, kn = class {
|
|
5394
5448
|
locale = "en-US";
|
|
5395
5449
|
setLocale(e) {
|
|
5396
5450
|
this.locale = e;
|
|
@@ -5413,7 +5467,7 @@ var Sn = class {
|
|
|
5413
5467
|
e.stroke(), e.globalAlpha = 1, e.fillStyle = n.axisLabel;
|
|
5414
5468
|
for (let { y: t, text: n } of h) e.fillText(n, a + 8, t);
|
|
5415
5469
|
}
|
|
5416
|
-
},
|
|
5470
|
+
}, An = (e) => e < 10 ? "0" + e : "" + e, jn = class {
|
|
5417
5471
|
tzOffsetMinutes = null;
|
|
5418
5472
|
setTimezoneOffset(e) {
|
|
5419
5473
|
this.tzOffsetMinutes = e;
|
|
@@ -5427,12 +5481,12 @@ var Sn = class {
|
|
|
5427
5481
|
for (let t = l; t <= u && t < r.length; t++) {
|
|
5428
5482
|
if (t % c !== 0) continue;
|
|
5429
5483
|
let n = t * s + d, i = r[t].time, { day: a, month: l, hours: u, minutes: p } = y(i > 0xe8d4a51000 ? i : i * 1e3, this.tzOffsetMinutes), m;
|
|
5430
|
-
a === f ? m = `${
|
|
5484
|
+
a === f ? m = `${An(u)}:${An(p)}` : (m = `${l}/${a}`, f = a), e.fillText(m, n, o + 7);
|
|
5431
5485
|
}
|
|
5432
5486
|
let p = a.x + a.width - 4, m = o + 7;
|
|
5433
5487
|
e.font = `500 ${n.font.sizeSmall - 1}px ${n.font.family}`, e.textAlign = "right", e.textBaseline = "top", e.globalAlpha = .75, e.fillStyle = n.textSecondary, e.fillText(S(this.tzOffsetMinutes), p, m), e.globalAlpha = 1;
|
|
5434
5488
|
}
|
|
5435
|
-
},
|
|
5489
|
+
}, Mn = class {
|
|
5436
5490
|
panHandler = null;
|
|
5437
5491
|
zoomHandler = null;
|
|
5438
5492
|
crosshairHandler = null;
|
|
@@ -5451,6 +5505,7 @@ var Sn = class {
|
|
|
5451
5505
|
pressForClick = !1;
|
|
5452
5506
|
drawingManager = null;
|
|
5453
5507
|
tradingManager = null;
|
|
5508
|
+
paneResizeHandler = null;
|
|
5454
5509
|
viewportGetter = null;
|
|
5455
5510
|
onOverlayDirty = null;
|
|
5456
5511
|
boundHandlers = [];
|
|
@@ -5510,6 +5565,9 @@ var Sn = class {
|
|
|
5510
5565
|
setTradingManager(e, t) {
|
|
5511
5566
|
this.tradingManager = e, this.viewportGetter = t;
|
|
5512
5567
|
}
|
|
5568
|
+
setPaneResizeHandler(e) {
|
|
5569
|
+
this.paneResizeHandler = e;
|
|
5570
|
+
}
|
|
5513
5571
|
attach() {
|
|
5514
5572
|
let e = () => this.viewportGetter?.() ?? null, t = (e) => {
|
|
5515
5573
|
let t = this.axisViewportGetter?.();
|
|
@@ -5525,20 +5583,22 @@ var Sn = class {
|
|
|
5525
5583
|
this.axisDragHandler.begin(a, r);
|
|
5526
5584
|
return;
|
|
5527
5585
|
}
|
|
5528
|
-
if (
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
this.onAltClick
|
|
5534
|
-
|
|
5535
|
-
}
|
|
5536
|
-
if (!(this.tradingManager && i && this.tradingManager.onPointerDown(r, i)) && !(this.drawingManager && i && this.drawingManager.onPointerDown(r, i))) {
|
|
5537
|
-
if (this.alertDragHandler?.tryBegin(r)) {
|
|
5538
|
-
this.onOverlayDirty?.();
|
|
5586
|
+
if (!this.paneResizeHandler?.tryBegin(r)) {
|
|
5587
|
+
if (n.shiftKey && this.measureHandlers) {
|
|
5588
|
+
this.measuring = !0, this.measureHandlers.begin(r), this.onOverlayDirty?.();
|
|
5589
|
+
return;
|
|
5590
|
+
}
|
|
5591
|
+
if (n.altKey && this.onAltClick) {
|
|
5592
|
+
this.onAltClick(r);
|
|
5539
5593
|
return;
|
|
5540
5594
|
}
|
|
5541
|
-
this.
|
|
5595
|
+
if (!(this.tradingManager && i && this.tradingManager.onPointerDown(r, i)) && !(this.drawingManager && i && this.drawingManager.onPointerDown(r, i))) {
|
|
5596
|
+
if (this.alertDragHandler?.tryBegin(r)) {
|
|
5597
|
+
this.onOverlayDirty?.();
|
|
5598
|
+
return;
|
|
5599
|
+
}
|
|
5600
|
+
this.pressForClick = !0, this.panHandler?.onPointerDown(r);
|
|
5601
|
+
}
|
|
5542
5602
|
}
|
|
5543
5603
|
}, r = (n) => {
|
|
5544
5604
|
let r = this.getMousePos(n), i = e();
|
|
@@ -5550,6 +5610,10 @@ var Sn = class {
|
|
|
5550
5610
|
this.axisDragHandler.move(r);
|
|
5551
5611
|
return;
|
|
5552
5612
|
}
|
|
5613
|
+
if (this.paneResizeHandler?.isActive()) {
|
|
5614
|
+
this.paneResizeHandler.move(r);
|
|
5615
|
+
return;
|
|
5616
|
+
}
|
|
5553
5617
|
if (this.alertDragHandler?.isActive()) {
|
|
5554
5618
|
this.alertDragHandler.move(r), this.onOverlayDirty?.();
|
|
5555
5619
|
return;
|
|
@@ -5558,8 +5622,8 @@ var Sn = class {
|
|
|
5558
5622
|
this.measureHandlers.move(r), this.onOverlayDirty?.();
|
|
5559
5623
|
return;
|
|
5560
5624
|
}
|
|
5561
|
-
let a = t(r);
|
|
5562
|
-
if (a === "price" ? this.element.style.cursor = "ns-resize" : a === "time" ? this.element.style.cursor = "ew-resize" : this.alertDragHandler?.isOverAlert(r) ? this.element.style.cursor = "ns-resize" : (this.element.style.cursor === "ns-resize" || this.element.style.cursor === "ew-resize") && (this.element.style.cursor = ""), this.tradingManager && i && this.tradingManager.onPointerMove(r, i)) {
|
|
5625
|
+
let a = t(r), o = this.paneResizeHandler?.cursorAt(r) ?? null;
|
|
5626
|
+
if (a === "price" ? this.element.style.cursor = "ns-resize" : a === "time" ? this.element.style.cursor = "ew-resize" : this.alertDragHandler?.isOverAlert(r) ? this.element.style.cursor = "ns-resize" : o ? this.element.style.cursor = o : (this.element.style.cursor === "ns-resize" || this.element.style.cursor === "ew-resize") && (this.element.style.cursor = ""), this.tradingManager && i && this.tradingManager.onPointerMove(r, i)) {
|
|
5563
5627
|
this.crosshairHandler?.onPointerMove(r), this.onOverlayDirty?.();
|
|
5564
5628
|
return;
|
|
5565
5629
|
}
|
|
@@ -5573,6 +5637,10 @@ var Sn = class {
|
|
|
5573
5637
|
this.axisDragHandler.end();
|
|
5574
5638
|
return;
|
|
5575
5639
|
}
|
|
5640
|
+
if (this.paneResizeHandler?.isActive()) {
|
|
5641
|
+
this.paneResizeHandler.end();
|
|
5642
|
+
return;
|
|
5643
|
+
}
|
|
5576
5644
|
if (this.alertDragHandler?.isActive()) {
|
|
5577
5645
|
this.alertDragHandler.end(), this.onOverlayDirty?.();
|
|
5578
5646
|
return;
|
|
@@ -5586,7 +5654,7 @@ var Sn = class {
|
|
|
5586
5654
|
let n = t(this.getMousePos(e));
|
|
5587
5655
|
n && this.onAxisDoubleClick && this.onAxisDoubleClick(n);
|
|
5588
5656
|
}, o = () => {
|
|
5589
|
-
this.panHandler?.onPointerUp(), this.drawingManager?.onPointerUp(), this.tradingManager?.onPointerUp(), this.alertDragHandler?.end(), this.crosshairHandler?.onPointerLeave(), this.pressForClick = !1, this.downPos = null, this.onOverlayDirty?.();
|
|
5657
|
+
this.panHandler?.onPointerUp(), this.drawingManager?.onPointerUp(), this.tradingManager?.onPointerUp(), this.alertDragHandler?.end(), this.paneResizeHandler?.end(), this.crosshairHandler?.onPointerLeave(), this.pressForClick = !1, this.downPos = null, this.onOverlayDirty?.();
|
|
5590
5658
|
}, s = (e) => {
|
|
5591
5659
|
e.preventDefault();
|
|
5592
5660
|
let t = this.getMousePos(e);
|
|
@@ -5609,6 +5677,10 @@ var Sn = class {
|
|
|
5609
5677
|
this.axisDragHandler.begin(i, r), this.touchActive = !0;
|
|
5610
5678
|
return;
|
|
5611
5679
|
}
|
|
5680
|
+
if (this.paneResizeHandler?.tryBegin(r)) {
|
|
5681
|
+
this.touchActive = !0;
|
|
5682
|
+
return;
|
|
5683
|
+
}
|
|
5612
5684
|
let a = e();
|
|
5613
5685
|
if (this.tradingManager && a && this.tradingManager.onPointerDown(r, a)) {
|
|
5614
5686
|
this.touchActive = !0, this.onOverlayDirty?.();
|
|
@@ -5629,6 +5701,10 @@ var Sn = class {
|
|
|
5629
5701
|
this.axisDragHandler.move(n), this.onOverlayDirty?.();
|
|
5630
5702
|
return;
|
|
5631
5703
|
}
|
|
5704
|
+
if (this.paneResizeHandler?.isActive()) {
|
|
5705
|
+
this.paneResizeHandler.move(n), this.onOverlayDirty?.();
|
|
5706
|
+
return;
|
|
5707
|
+
}
|
|
5632
5708
|
let r = e();
|
|
5633
5709
|
if (this.tradingManager && r && this.tradingManager.onPointerMove(n, r)) {
|
|
5634
5710
|
this.onOverlayDirty?.();
|
|
@@ -5646,7 +5722,7 @@ var Sn = class {
|
|
|
5646
5722
|
}
|
|
5647
5723
|
this.onOverlayDirty?.();
|
|
5648
5724
|
}, f = (e) => {
|
|
5649
|
-
if (this.clearLongPress(), e.touches.length === 0) this.axisDragHandler?.isActive() && this.axisDragHandler.end(), this.tradingManager?.onPointerUp(), this.panHandler?.onPointerUp(), this.crosshairHandler?.onPointerLeave(), this.touchActive = !1, this.lastTouchDist = 0;
|
|
5725
|
+
if (this.clearLongPress(), e.touches.length === 0) this.axisDragHandler?.isActive() && this.axisDragHandler.end(), this.paneResizeHandler?.end(), this.tradingManager?.onPointerUp(), this.panHandler?.onPointerUp(), this.crosshairHandler?.onPointerLeave(), this.touchActive = !1, this.lastTouchDist = 0;
|
|
5650
5726
|
else if (e.touches.length === 1) {
|
|
5651
5727
|
let t = this.getTouchPos(e.touches[0]);
|
|
5652
5728
|
this.panHandler?.onPointerDown(t);
|
|
@@ -5691,7 +5767,7 @@ var Sn = class {
|
|
|
5691
5767
|
y: (e.clientY + t.clientY) / 2 - n.top
|
|
5692
5768
|
};
|
|
5693
5769
|
}
|
|
5694
|
-
},
|
|
5770
|
+
}, Nn = class {
|
|
5695
5771
|
dragging = !1;
|
|
5696
5772
|
lastX = 0;
|
|
5697
5773
|
lastTime = 0;
|
|
@@ -5727,7 +5803,7 @@ var Sn = class {
|
|
|
5727
5803
|
stopMomentum() {
|
|
5728
5804
|
this.momentumId &&= (cancelAnimationFrame(this.momentumId), 0);
|
|
5729
5805
|
}
|
|
5730
|
-
},
|
|
5806
|
+
}, Pn = class {
|
|
5731
5807
|
callback;
|
|
5732
5808
|
sensitivity;
|
|
5733
5809
|
pendingDelta = 0;
|
|
@@ -5746,7 +5822,7 @@ var Sn = class {
|
|
|
5746
5822
|
dispose() {
|
|
5747
5823
|
this.rafId &&= (cancelAnimationFrame(this.rafId), 0);
|
|
5748
5824
|
}
|
|
5749
|
-
},
|
|
5825
|
+
}, Fn = class {
|
|
5750
5826
|
dragging = !1;
|
|
5751
5827
|
axis = null;
|
|
5752
5828
|
startPos = {
|
|
@@ -5786,7 +5862,7 @@ var Sn = class {
|
|
|
5786
5862
|
isActive() {
|
|
5787
5863
|
return this.dragging;
|
|
5788
5864
|
}
|
|
5789
|
-
},
|
|
5865
|
+
}, In = class {
|
|
5790
5866
|
draggingId = null;
|
|
5791
5867
|
constructor(e, t) {
|
|
5792
5868
|
this.alerts = e, this.viewportGetter = t;
|
|
@@ -5812,7 +5888,85 @@ var Sn = class {
|
|
|
5812
5888
|
isActive() {
|
|
5813
5889
|
return this.draggingId !== null;
|
|
5814
5890
|
}
|
|
5815
|
-
},
|
|
5891
|
+
}, Ln = class {
|
|
5892
|
+
state = null;
|
|
5893
|
+
layoutGetter = null;
|
|
5894
|
+
onResize = null;
|
|
5895
|
+
constructor(e = 4) {
|
|
5896
|
+
this.tolerance = e;
|
|
5897
|
+
}
|
|
5898
|
+
configure(e, t) {
|
|
5899
|
+
this.layoutGetter = e, this.onResize = t;
|
|
5900
|
+
}
|
|
5901
|
+
hitTest(e, t) {
|
|
5902
|
+
for (let n of t.dividers) if (Rn(e, n.rect, this.tolerance)) {
|
|
5903
|
+
let e = t.panels.find((e) => e.config.id === n.panelId);
|
|
5904
|
+
if (e) return {
|
|
5905
|
+
panelId: n.panelId,
|
|
5906
|
+
orientation: n.orientation,
|
|
5907
|
+
position: e.config.position,
|
|
5908
|
+
size: e.config.size
|
|
5909
|
+
};
|
|
5910
|
+
}
|
|
5911
|
+
return null;
|
|
5912
|
+
}
|
|
5913
|
+
cursorAt(e) {
|
|
5914
|
+
let t = this.layoutGetter?.();
|
|
5915
|
+
if (!t) return null;
|
|
5916
|
+
let n = this.hitTest(e, t);
|
|
5917
|
+
return n ? n.orientation === "horizontal" ? "ns-resize" : "ew-resize" : null;
|
|
5918
|
+
}
|
|
5919
|
+
tryBegin(e) {
|
|
5920
|
+
let t = this.layoutGetter?.();
|
|
5921
|
+
if (!t) return !1;
|
|
5922
|
+
let n = this.hitTest(e, t);
|
|
5923
|
+
return n ? (this.state = {
|
|
5924
|
+
panelId: n.panelId,
|
|
5925
|
+
position: n.position,
|
|
5926
|
+
startSize: n.size,
|
|
5927
|
+
startPos: e
|
|
5928
|
+
}, !0) : !1;
|
|
5929
|
+
}
|
|
5930
|
+
move(e) {
|
|
5931
|
+
let t = this.computeSize(e);
|
|
5932
|
+
t && this.onResize?.(t.panelId, t.size);
|
|
5933
|
+
}
|
|
5934
|
+
computeSize(e) {
|
|
5935
|
+
let t = this.state;
|
|
5936
|
+
if (!t) return null;
|
|
5937
|
+
let n = 0;
|
|
5938
|
+
switch (t.position) {
|
|
5939
|
+
case "bottom":
|
|
5940
|
+
n = t.startPos.y - e.y;
|
|
5941
|
+
break;
|
|
5942
|
+
case "top":
|
|
5943
|
+
n = e.y - t.startPos.y;
|
|
5944
|
+
break;
|
|
5945
|
+
case "left":
|
|
5946
|
+
n = e.x - t.startPos.x;
|
|
5947
|
+
break;
|
|
5948
|
+
case "right":
|
|
5949
|
+
n = t.startPos.x - e.x;
|
|
5950
|
+
break;
|
|
5951
|
+
}
|
|
5952
|
+
return {
|
|
5953
|
+
panelId: t.panelId,
|
|
5954
|
+
size: t.startSize + n
|
|
5955
|
+
};
|
|
5956
|
+
}
|
|
5957
|
+
end() {
|
|
5958
|
+
this.state = null;
|
|
5959
|
+
}
|
|
5960
|
+
isActive() {
|
|
5961
|
+
return this.state !== null;
|
|
5962
|
+
}
|
|
5963
|
+
};
|
|
5964
|
+
function Rn(e, t, n) {
|
|
5965
|
+
return e.x >= t.x - n && e.x <= t.x + t.width + n && e.y >= t.y - n && e.y <= t.y + t.height + n;
|
|
5966
|
+
}
|
|
5967
|
+
//#endregion
|
|
5968
|
+
//#region src/interaction/CrosshairHandler.ts
|
|
5969
|
+
var zn = class {
|
|
5816
5970
|
position = null;
|
|
5817
5971
|
callback = null;
|
|
5818
5972
|
data = [];
|
|
@@ -5879,7 +6033,7 @@ var Sn = class {
|
|
|
5879
6033
|
let c = A(o, t);
|
|
5880
6034
|
c = Math.max(0, Math.min(r.length - 1, c)), this.magnetMode && c >= 0 && c < r.length && (o = O(c, t));
|
|
5881
6035
|
let l = `600 ${n.font.sizeSmall}px ${n.font.family}`;
|
|
5882
|
-
if (
|
|
6036
|
+
if (Bn(e, {
|
|
5883
6037
|
text: h(j(s, t), this.pricePrecision, this.locale),
|
|
5884
6038
|
anchorX: a.x + a.width,
|
|
5885
6039
|
anchorY: s,
|
|
@@ -5888,8 +6042,8 @@ var Sn = class {
|
|
|
5888
6042
|
fg: n.background,
|
|
5889
6043
|
font: l
|
|
5890
6044
|
}), c >= 0 && c < r.length) {
|
|
5891
|
-
let t =
|
|
5892
|
-
|
|
6045
|
+
let t = Vn(r[c].time, this.tzOffsetMinutes), s = i ?? a.y + a.height;
|
|
6046
|
+
Bn(e, {
|
|
5893
6047
|
text: t,
|
|
5894
6048
|
anchorX: o,
|
|
5895
6049
|
anchorY: s,
|
|
@@ -5909,7 +6063,7 @@ var Sn = class {
|
|
|
5909
6063
|
this.callback?.(e, t);
|
|
5910
6064
|
}
|
|
5911
6065
|
};
|
|
5912
|
-
function
|
|
6066
|
+
function Bn(e, t) {
|
|
5913
6067
|
e.save(), e.font = t.font;
|
|
5914
6068
|
let n = Math.ceil(e.measureText(t.text).width) + 16;
|
|
5915
6069
|
if (t.orientation === "right") {
|
|
@@ -5921,13 +6075,13 @@ function Nn(e, t) {
|
|
|
5921
6075
|
}
|
|
5922
6076
|
e.restore();
|
|
5923
6077
|
}
|
|
5924
|
-
function
|
|
6078
|
+
function Vn(e, t) {
|
|
5925
6079
|
let { month: n, day: r, hours: i, minutes: a } = y(e > 0xe8d4a51000 ? e : e * 1e3, t);
|
|
5926
6080
|
return `${n}/${r} ${i < 10 ? "0" + i : i}:${a < 10 ? "0" + a : a}`;
|
|
5927
6081
|
}
|
|
5928
6082
|
//#endregion
|
|
5929
6083
|
//#region src/interaction/KeyboardHandler.ts
|
|
5930
|
-
var
|
|
6084
|
+
var Hn = class {
|
|
5931
6085
|
callbacks;
|
|
5932
6086
|
enabled = !0;
|
|
5933
6087
|
constructor(e) {
|
|
@@ -5953,7 +6107,7 @@ var Fn = class {
|
|
|
5953
6107
|
default: return !1;
|
|
5954
6108
|
}
|
|
5955
6109
|
}
|
|
5956
|
-
},
|
|
6110
|
+
}, Un = class {
|
|
5957
6111
|
el = null;
|
|
5958
6112
|
visible = !1;
|
|
5959
6113
|
timeEl;
|
|
@@ -5992,8 +6146,8 @@ var Fn = class {
|
|
|
5992
6146
|
this.changeEl.textContent = `${l}${a(s)} (${l}${c.toFixed(2)}%)`, this.changeEl.style.color = i;
|
|
5993
6147
|
let u = t.volume;
|
|
5994
6148
|
this.volEl.textContent = `Vol ${u >= 1e6 ? (u / 1e6).toFixed(1) + "M" : u >= 1e3 ? (u / 1e3).toFixed(1) + "K" : u.toFixed(0)}`, this.volEl.style.color = n.textSecondary;
|
|
5995
|
-
let d =
|
|
5996
|
-
this.el.style.background = d ?
|
|
6149
|
+
let d = Wn(n.background);
|
|
6150
|
+
this.el.style.background = d ? Gn(n.background, .95) : Gn(n.background, .97), this.el.style.border = `1px solid ${n.axisLine}`, this.el.style.boxShadow = d ? "0 4px 12px rgba(0,0,0,0.5)" : "0 4px 12px rgba(0,0,0,0.15)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", !this.measured && this.visible && (this.measuredWidth = this.el.offsetWidth, this.measuredHeight = this.el.offsetHeight, this.measured = !0);
|
|
5997
6151
|
let f = e.x + 16, p = e.y - 40;
|
|
5998
6152
|
f + this.measuredWidth > r.width - 80 && (f = e.x - this.measuredWidth - 16), p < 4 && (p = 4), p + this.measuredHeight > r.height && (p = r.height - this.measuredHeight - 4), this.el.style.transform = `translate(${Math.round(f)}px, ${Math.round(p)}px)`, this.el.style.left = "0", this.el.style.top = "0", this.visible ||= (this.el.style.display = "block", !0);
|
|
5999
6153
|
}
|
|
@@ -6018,7 +6172,7 @@ var Fn = class {
|
|
|
6018
6172
|
return document.createElement("span");
|
|
6019
6173
|
}
|
|
6020
6174
|
};
|
|
6021
|
-
function
|
|
6175
|
+
function Wn(e) {
|
|
6022
6176
|
if (e.startsWith("#")) {
|
|
6023
6177
|
let t = e.slice(1), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t.slice(0, 6), r = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), a = parseInt(n.slice(4, 6), 16);
|
|
6024
6178
|
return (.299 * r + .587 * i + .114 * a) / 255 < .5;
|
|
@@ -6030,7 +6184,7 @@ function Ln(e) {
|
|
|
6030
6184
|
}
|
|
6031
6185
|
return !0;
|
|
6032
6186
|
}
|
|
6033
|
-
function
|
|
6187
|
+
function Gn(e, t) {
|
|
6034
6188
|
if (e.startsWith("#")) {
|
|
6035
6189
|
let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
|
|
6036
6190
|
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
@@ -6039,7 +6193,7 @@ function Rn(e, t) {
|
|
|
6039
6193
|
}
|
|
6040
6194
|
//#endregion
|
|
6041
6195
|
//#region src/interaction/PinnedTooltip.ts
|
|
6042
|
-
var
|
|
6196
|
+
var Kn = class {
|
|
6043
6197
|
el = null;
|
|
6044
6198
|
deltaEl = null;
|
|
6045
6199
|
timeEl = null;
|
|
@@ -6069,14 +6223,14 @@ var zn = class {
|
|
|
6069
6223
|
if (!this.el || !this.timeEl || !this.ohlcEl) return;
|
|
6070
6224
|
this.pinnedBar = e, this.pinnedIndex = t;
|
|
6071
6225
|
let r = e.close >= e.open ? n.candleUp : n.candleDown, i = new Date(e.time > 0xe8d4a51000 ? e.time : e.time * 1e3);
|
|
6072
|
-
this.timeEl.textContent = `${i.getMonth() + 1}/${i.getDate()} ${
|
|
6073
|
-
<span style="opacity:.6">O </span><span style="color:${r}">${
|
|
6074
|
-
<span style="opacity:.6"> H </span><span style="color:${r}">${
|
|
6075
|
-
<span style="opacity:.6"> L </span><span style="color:${r}">${
|
|
6076
|
-
<span style="opacity:.6"> C </span><span style="color:${r}">${
|
|
6226
|
+
this.timeEl.textContent = `${i.getMonth() + 1}/${i.getDate()} ${qn(i.getHours())}:${qn(i.getMinutes())}`, this.timeEl.style.color = n.textSecondary, this.ohlcEl.innerHTML = `
|
|
6227
|
+
<span style="opacity:.6">O </span><span style="color:${r}">${V(e.open)}</span>
|
|
6228
|
+
<span style="opacity:.6"> H </span><span style="color:${r}">${V(e.high)}</span>
|
|
6229
|
+
<span style="opacity:.6"> L </span><span style="color:${r}">${V(e.low)}</span>
|
|
6230
|
+
<span style="opacity:.6"> C </span><span style="color:${r}">${V(e.close)}</span>
|
|
6077
6231
|
`;
|
|
6078
|
-
let a =
|
|
6079
|
-
this.el.style.background =
|
|
6232
|
+
let a = Jn(n.background);
|
|
6233
|
+
this.el.style.background = Yn(n.background, a ? .96 : .97), this.el.style.border = `1px solid ${r}`, this.el.style.boxShadow = a ? "0 4px 12px rgba(0,0,0,0.55)" : "0 4px 12px rgba(0,0,0,0.18)", this.el.style.color = n.text, this.el.style.backdropFilter = "blur(8px)", this.el.style.display = "block";
|
|
6080
6234
|
}
|
|
6081
6235
|
unpin() {
|
|
6082
6236
|
this.pinnedBar = null, this.pinnedIndex = -1, this.el && (this.el.style.display = "none");
|
|
@@ -6094,27 +6248,27 @@ var zn = class {
|
|
|
6094
6248
|
let c = Math.max(o.x, Math.min(o.x + o.width - 180, i + 8)), l = Math.max(o.y, Math.min(o.y + o.height - 90, a - 64));
|
|
6095
6249
|
if (this.el.style.transform = `translate(${Math.round(c)}px, ${Math.round(l)}px)`, this.el.style.left = "0", this.el.style.top = "0", this.deltaEl) if (t && n !== null && n !== this.pinnedIndex) {
|
|
6096
6250
|
let e = t.close - this.pinnedBar.close, i = this.pinnedBar.close === 0 ? 0 : e / this.pinnedBar.close * 100, a = e > 0 ? "+" : e < 0 ? "−" : "", o = n - this.pinnedIndex, s = e >= 0 ? r.candleUp : r.candleDown;
|
|
6097
|
-
this.deltaEl.style.color = s, this.deltaEl.innerHTML = `Δ ${a}${
|
|
6251
|
+
this.deltaEl.style.color = s, this.deltaEl.innerHTML = `Δ ${a}${V(Math.abs(e))} <span style="opacity:.7">(${a}${Math.abs(i).toFixed(2)}%)</span> · ${o > 0 ? "+" : ""}${o} bars`, this.deltaEl.style.display = "block";
|
|
6098
6252
|
} else this.deltaEl.style.display = "none";
|
|
6099
6253
|
}
|
|
6100
6254
|
destroy() {
|
|
6101
6255
|
this.el?.remove(), this.el = null, this.deltaEl = null, this.timeEl = null, this.ohlcEl = null, this.pinnedBar = null, this.pinnedIndex = -1;
|
|
6102
6256
|
}
|
|
6103
6257
|
};
|
|
6104
|
-
function
|
|
6258
|
+
function V(e) {
|
|
6105
6259
|
return e.toFixed(2);
|
|
6106
6260
|
}
|
|
6107
|
-
function
|
|
6261
|
+
function qn(e) {
|
|
6108
6262
|
return e < 10 ? "0" + e : "" + e;
|
|
6109
6263
|
}
|
|
6110
|
-
function
|
|
6264
|
+
function Jn(e) {
|
|
6111
6265
|
if (e.startsWith("#")) {
|
|
6112
6266
|
let t = e.slice(1), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t.slice(0, 6), r = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), a = parseInt(n.slice(4, 6), 16);
|
|
6113
6267
|
return (.299 * r + .587 * i + .114 * a) / 255 < .5;
|
|
6114
6268
|
}
|
|
6115
6269
|
return !0;
|
|
6116
6270
|
}
|
|
6117
|
-
function
|
|
6271
|
+
function Yn(e, t) {
|
|
6118
6272
|
if (e.startsWith("#")) {
|
|
6119
6273
|
let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
|
|
6120
6274
|
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
@@ -6123,7 +6277,7 @@ function Hn(e, t) {
|
|
|
6123
6277
|
}
|
|
6124
6278
|
//#endregion
|
|
6125
6279
|
//#region src/events/EventBus.ts
|
|
6126
|
-
var
|
|
6280
|
+
var Xn = class {
|
|
6127
6281
|
listeners = /* @__PURE__ */ new Map();
|
|
6128
6282
|
tauriBridge = null;
|
|
6129
6283
|
on(e, t) {
|
|
@@ -6154,7 +6308,7 @@ var Un = class {
|
|
|
6154
6308
|
destroy() {
|
|
6155
6309
|
this.listeners.clear(), this.tauriBridge = null;
|
|
6156
6310
|
}
|
|
6157
|
-
},
|
|
6311
|
+
}, H = class {
|
|
6158
6312
|
hitTestAnchor(e, t, n, r) {
|
|
6159
6313
|
for (let i = 0; i < t.anchors.length; i++) {
|
|
6160
6314
|
let a = this.anchorToPixel(t.anchors[i], n);
|
|
@@ -6209,8 +6363,8 @@ var Un = class {
|
|
|
6209
6363
|
let r = n.x - t.x, i = n.y - t.y, a = Math.hypot(r, i);
|
|
6210
6364
|
return a === 0 ? Math.hypot(e.x - t.x, e.y - t.y) : Math.abs(r * (t.y - e.y) - i * (t.x - e.x)) / a;
|
|
6211
6365
|
}
|
|
6212
|
-
},
|
|
6213
|
-
function
|
|
6366
|
+
}, Zn = 1;
|
|
6367
|
+
function U(e) {
|
|
6214
6368
|
return {
|
|
6215
6369
|
...e,
|
|
6216
6370
|
anchors: e.anchors.map((e) => ({ ...e })),
|
|
@@ -6218,7 +6372,7 @@ function G(e) {
|
|
|
6218
6372
|
meta: e.meta ? { ...e.meta } : void 0
|
|
6219
6373
|
};
|
|
6220
6374
|
}
|
|
6221
|
-
var
|
|
6375
|
+
var Qn = class {
|
|
6222
6376
|
registry = /* @__PURE__ */ new Map();
|
|
6223
6377
|
drawings = [];
|
|
6224
6378
|
state = "idle";
|
|
@@ -6386,14 +6540,14 @@ var Gn = class {
|
|
|
6386
6540
|
if (!n) return !1;
|
|
6387
6541
|
let r = this.drawings.find((e) => e.id === n);
|
|
6388
6542
|
if (!r || r.locked) return !1;
|
|
6389
|
-
let i =
|
|
6543
|
+
let i = U(r);
|
|
6390
6544
|
return r.style = {
|
|
6391
6545
|
...r.style,
|
|
6392
6546
|
...e
|
|
6393
6547
|
}, this.undoRedo?.push({
|
|
6394
6548
|
type: "drawingModify",
|
|
6395
6549
|
before: i,
|
|
6396
|
-
after:
|
|
6550
|
+
after: U(r)
|
|
6397
6551
|
}), this.requestRender?.(), !0;
|
|
6398
6552
|
}
|
|
6399
6553
|
onPointerDown(e, t) {
|
|
@@ -6416,7 +6570,7 @@ var Gn = class {
|
|
|
6416
6570
|
e && this.undoRedo?.push({
|
|
6417
6571
|
type: "drawingModify",
|
|
6418
6572
|
before: this.dragBeforeState,
|
|
6419
|
-
after:
|
|
6573
|
+
after: U(e)
|
|
6420
6574
|
});
|
|
6421
6575
|
}
|
|
6422
6576
|
return this.state = "selected", this.dragStartPoint = null, this.dragStartAnchors = [], this.dragAnchorIndex = -1, this.dragBeforeState = null, !0;
|
|
@@ -6438,7 +6592,7 @@ var Gn = class {
|
|
|
6438
6592
|
this.drawings = this.upgradeLegacyAnchors(e), this.requestRender?.();
|
|
6439
6593
|
}
|
|
6440
6594
|
addDrawing(e) {
|
|
6441
|
-
let t = e.id ?? `tc_drawing_${
|
|
6595
|
+
let t = e.id ?? `tc_drawing_${Zn++}`, n = {
|
|
6442
6596
|
id: t,
|
|
6443
6597
|
type: e.type,
|
|
6444
6598
|
anchors: e.anchors.map((e) => ({ ...e })),
|
|
@@ -6453,7 +6607,7 @@ var Gn = class {
|
|
|
6453
6607
|
return this.drawings = [...this.drawings, n], this.undoRedo?.push({
|
|
6454
6608
|
type: "drawingCreate",
|
|
6455
6609
|
before: null,
|
|
6456
|
-
after:
|
|
6610
|
+
after: U(n)
|
|
6457
6611
|
}), this.eventCallback?.("drawingCreate", {
|
|
6458
6612
|
id: t,
|
|
6459
6613
|
type: n.type
|
|
@@ -6485,7 +6639,7 @@ var Gn = class {
|
|
|
6485
6639
|
let t = this.drawings.find((t) => t.id === e);
|
|
6486
6640
|
if (!t) return null;
|
|
6487
6641
|
let n = structuredClone(t);
|
|
6488
|
-
n.id = `tc_drawing_${
|
|
6642
|
+
n.id = `tc_drawing_${Zn++}`;
|
|
6489
6643
|
let r = this.computeBarOffsetTime(3);
|
|
6490
6644
|
return n.anchors = n.anchors.map((e) => ({
|
|
6491
6645
|
...e,
|
|
@@ -6536,7 +6690,7 @@ var Gn = class {
|
|
|
6536
6690
|
if (!n) return !1;
|
|
6537
6691
|
let r = F(e.x, t), i = j(e.y, t), a = this.snapToOHLC(r, i, t);
|
|
6538
6692
|
return this.creatingDrawing ? (this.creatingDrawing.anchors.push(a), this.committedAnchors++, this.previewAnchor = null, this.committedAnchors >= n.descriptor.requiredAnchors && this.finalizeCreation(), this.requestRender?.(), !0) : (this.creatingDrawing = {
|
|
6539
|
-
id: `tc_drawing_${
|
|
6693
|
+
id: `tc_drawing_${Zn++}`,
|
|
6540
6694
|
type: this.activeTool,
|
|
6541
6695
|
anchors: [a],
|
|
6542
6696
|
style: { ...this.activeStyle },
|
|
@@ -6558,8 +6712,8 @@ var Gn = class {
|
|
|
6558
6712
|
let r = this.registry.get(n.type);
|
|
6559
6713
|
if (r) {
|
|
6560
6714
|
let i = r.hitTestAnchor(e, n, t, 8);
|
|
6561
|
-
if (i >= 0) return this.state = "resizing", this.dragAnchorIndex = i, this.dragStartPoint = e, this.dragBeforeState =
|
|
6562
|
-
if (r.hitTest(e, n, t, 8)) return this.state = "moving", this.dragStartPoint = e, this.dragStartAnchors = n.anchors.map((e) => ({ ...e })), this.dragBeforeState =
|
|
6715
|
+
if (i >= 0) return this.state = "resizing", this.dragAnchorIndex = i, this.dragStartPoint = e, this.dragBeforeState = U(n), !0;
|
|
6716
|
+
if (r.hitTest(e, n, t, 8)) return this.state = "moving", this.dragStartPoint = e, this.dragStartAnchors = n.anchors.map((e) => ({ ...e })), this.dragBeforeState = U(n), !0;
|
|
6563
6717
|
}
|
|
6564
6718
|
}
|
|
6565
6719
|
}
|
|
@@ -6587,7 +6741,7 @@ var Gn = class {
|
|
|
6587
6741
|
price: j(e.y, t)
|
|
6588
6742
|
}, this.requestRender?.(), !0);
|
|
6589
6743
|
}
|
|
6590
|
-
},
|
|
6744
|
+
}, $n = class {
|
|
6591
6745
|
constructor(e) {
|
|
6592
6746
|
this.manager = e;
|
|
6593
6747
|
}
|
|
@@ -6597,7 +6751,7 @@ var Gn = class {
|
|
|
6597
6751
|
};
|
|
6598
6752
|
//#endregion
|
|
6599
6753
|
//#region src/drawings/autoFib.ts
|
|
6600
|
-
function
|
|
6754
|
+
function er(e, t, n) {
|
|
6601
6755
|
let r = Math.max(0, t), i = Math.min(e.length - 1, n);
|
|
6602
6756
|
if (i <= r) return null;
|
|
6603
6757
|
let a = r, o = r;
|
|
@@ -6614,7 +6768,7 @@ function qn(e, t, n) {
|
|
|
6614
6768
|
}
|
|
6615
6769
|
//#endregion
|
|
6616
6770
|
//#region src/drawings/tools/TrendLine.ts
|
|
6617
|
-
var
|
|
6771
|
+
var tr = class extends H {
|
|
6618
6772
|
descriptor = {
|
|
6619
6773
|
type: "trendLine",
|
|
6620
6774
|
name: "Trend Line",
|
|
@@ -6630,7 +6784,7 @@ var Jn = class extends W {
|
|
|
6630
6784
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
6631
6785
|
return this.distanceToLine(e, i, a) <= r;
|
|
6632
6786
|
}
|
|
6633
|
-
},
|
|
6787
|
+
}, nr = class extends H {
|
|
6634
6788
|
descriptor = {
|
|
6635
6789
|
type: "horizontalLine",
|
|
6636
6790
|
name: "Horizontal Line",
|
|
@@ -6646,7 +6800,7 @@ var Jn = class extends W {
|
|
|
6646
6800
|
let i = k(t.anchors[0].price, n);
|
|
6647
6801
|
return Math.abs(e.y - i) <= r && e.x >= n.chartRect.x && e.x <= n.chartRect.x + n.chartRect.width;
|
|
6648
6802
|
}
|
|
6649
|
-
},
|
|
6803
|
+
}, rr = class extends H {
|
|
6650
6804
|
descriptor = {
|
|
6651
6805
|
type: "verticalLine",
|
|
6652
6806
|
name: "Vertical Line",
|
|
@@ -6662,7 +6816,7 @@ var Jn = class extends W {
|
|
|
6662
6816
|
let i = this.anchorToPixel(t.anchors[0], n), { chartRect: a } = n;
|
|
6663
6817
|
return Math.abs(e.x - i.x) <= r && e.y >= a.y && e.y <= a.y + a.height;
|
|
6664
6818
|
}
|
|
6665
|
-
},
|
|
6819
|
+
}, ir = class extends H {
|
|
6666
6820
|
descriptor = {
|
|
6667
6821
|
type: "ray",
|
|
6668
6822
|
name: "Ray",
|
|
@@ -6680,7 +6834,7 @@ var Jn = class extends W {
|
|
|
6680
6834
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = a.x - i.x, s = a.y - i.y;
|
|
6681
6835
|
return ((e.x - i.x) * o + (e.y - i.y) * s) / (o * o + s * s) < 0 ? !1 : this.distanceToInfiniteLine(e, i, a) <= r;
|
|
6682
6836
|
}
|
|
6683
|
-
},
|
|
6837
|
+
}, ar = class extends H {
|
|
6684
6838
|
descriptor = {
|
|
6685
6839
|
type: "extendedLine",
|
|
6686
6840
|
name: "Extended Line",
|
|
@@ -6698,7 +6852,7 @@ var Jn = class extends W {
|
|
|
6698
6852
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
6699
6853
|
return this.distanceToInfiniteLine(e, i, a) <= r;
|
|
6700
6854
|
}
|
|
6701
|
-
},
|
|
6855
|
+
}, or = class extends H {
|
|
6702
6856
|
descriptor = {
|
|
6703
6857
|
type: "parallelChannel",
|
|
6704
6858
|
name: "Parallel Channel",
|
|
@@ -6735,7 +6889,7 @@ var Jn = class extends W {
|
|
|
6735
6889
|
}
|
|
6736
6890
|
return !1;
|
|
6737
6891
|
}
|
|
6738
|
-
},
|
|
6892
|
+
}, sr = class extends H {
|
|
6739
6893
|
descriptor = {
|
|
6740
6894
|
type: "regressionChannel",
|
|
6741
6895
|
name: "Regression Channel",
|
|
@@ -6758,7 +6912,7 @@ var Jn = class extends W {
|
|
|
6758
6912
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.hypot(a.x - i.x, a.y - i.y), s = Math.max(10, Math.min(o * .2, 100));
|
|
6759
6913
|
return this.distanceToLine(e, i, a) <= r + s;
|
|
6760
6914
|
}
|
|
6761
|
-
},
|
|
6915
|
+
}, W = [
|
|
6762
6916
|
0,
|
|
6763
6917
|
.236,
|
|
6764
6918
|
.382,
|
|
@@ -6766,7 +6920,7 @@ var Jn = class extends W {
|
|
|
6766
6920
|
.618,
|
|
6767
6921
|
.786,
|
|
6768
6922
|
1
|
|
6769
|
-
],
|
|
6923
|
+
], cr = class extends H {
|
|
6770
6924
|
descriptor = {
|
|
6771
6925
|
type: "fibRetracement",
|
|
6772
6926
|
name: "Fibonacci Retracement",
|
|
@@ -6776,13 +6930,13 @@ var Jn = class extends W {
|
|
|
6776
6930
|
if (t.anchors.length < 2) return;
|
|
6777
6931
|
let { chartRect: i } = n, a = t.anchors[0].price, o = t.anchors[1].price, s = a - o;
|
|
6778
6932
|
e.font = "11px sans-serif", e.textBaseline = "middle";
|
|
6779
|
-
for (let r of
|
|
6933
|
+
for (let r of W) {
|
|
6780
6934
|
let a = o + s * (1 - r), c = k(a, n);
|
|
6781
6935
|
this.applyLineStyle(e, t.style), e.globalAlpha = r === 0 || r === 1 ? 1 : .7, e.beginPath(), e.moveTo(i.x, c), e.lineTo(i.x + i.width, c), e.stroke(), e.fillStyle = t.style.color, e.textAlign = "left", e.fillText(`${(r * 100).toFixed(1)}% (${a.toFixed(2)})`, i.x + 4, c - 2);
|
|
6782
6936
|
}
|
|
6783
6937
|
if (e.globalAlpha = 1, t.style.fillColor) {
|
|
6784
|
-
for (let r = 0; r <
|
|
6785
|
-
let a = o + s * (1 -
|
|
6938
|
+
for (let r = 0; r < W.length - 1; r++) {
|
|
6939
|
+
let a = o + s * (1 - W[r]), c = o + s * (1 - W[r + 1]), l = k(a, n), u = k(c, n);
|
|
6786
6940
|
e.fillStyle = t.style.fillColor, e.globalAlpha = .05 + r * .02, e.fillRect(i.x, Math.min(l, u), i.width, Math.abs(u - l));
|
|
6787
6941
|
}
|
|
6788
6942
|
e.globalAlpha = 1;
|
|
@@ -6794,13 +6948,13 @@ var Jn = class extends W {
|
|
|
6794
6948
|
let { chartRect: i } = n;
|
|
6795
6949
|
if (e.x < i.x - r || e.x > i.x + i.width + r) return !1;
|
|
6796
6950
|
let a = t.anchors[0].price, o = t.anchors[1].price, s = a - o;
|
|
6797
|
-
for (let t of
|
|
6951
|
+
for (let t of W) {
|
|
6798
6952
|
let i = k(o + s * (1 - t), n);
|
|
6799
6953
|
if (Math.abs(e.y - i) <= r) return !0;
|
|
6800
6954
|
}
|
|
6801
6955
|
return !1;
|
|
6802
6956
|
}
|
|
6803
|
-
},
|
|
6957
|
+
}, lr = [
|
|
6804
6958
|
0,
|
|
6805
6959
|
.618,
|
|
6806
6960
|
1,
|
|
@@ -6809,7 +6963,7 @@ var Jn = class extends W {
|
|
|
6809
6963
|
2.618,
|
|
6810
6964
|
3.618,
|
|
6811
6965
|
4.236
|
|
6812
|
-
],
|
|
6966
|
+
], ur = class extends H {
|
|
6813
6967
|
descriptor = {
|
|
6814
6968
|
type: "fibExtension",
|
|
6815
6969
|
name: "Fibonacci Extension",
|
|
@@ -6825,7 +6979,7 @@ var Jn = class extends W {
|
|
|
6825
6979
|
}
|
|
6826
6980
|
let { chartRect: i } = n, a = t.anchors[0].price, o = t.anchors[1].price, s = t.anchors[2].price, c = a - o;
|
|
6827
6981
|
e.font = "11px sans-serif", e.textBaseline = "middle", e.textAlign = "left";
|
|
6828
|
-
for (let r of
|
|
6982
|
+
for (let r of lr) {
|
|
6829
6983
|
let a = k(s + c * r, n);
|
|
6830
6984
|
this.applyLineStyle(e, t.style), e.globalAlpha = r === 0 || r === 1 ? 1 : .6, e.beginPath(), e.moveTo(i.x, a), e.lineTo(i.x + i.width, a), e.stroke(), e.fillStyle = t.style.color, e.fillText(`${(r * 100).toFixed(1)}%`, i.x + 4, a - 2);
|
|
6831
6985
|
}
|
|
@@ -6836,13 +6990,13 @@ var Jn = class extends W {
|
|
|
6836
6990
|
let { chartRect: i } = n;
|
|
6837
6991
|
if (e.x < i.x - r || e.x > i.x + i.width + r) return !1;
|
|
6838
6992
|
let a = t.anchors[0].price - t.anchors[1].price;
|
|
6839
|
-
for (let i of
|
|
6993
|
+
for (let i of lr) {
|
|
6840
6994
|
let o = k(t.anchors[2].price + a * i, n);
|
|
6841
6995
|
if (Math.abs(e.y - o) <= r) return !0;
|
|
6842
6996
|
}
|
|
6843
6997
|
return !1;
|
|
6844
6998
|
}
|
|
6845
|
-
},
|
|
6999
|
+
}, dr = class extends H {
|
|
6846
7000
|
descriptor = {
|
|
6847
7001
|
type: "rectangle",
|
|
6848
7002
|
name: "Rectangle",
|
|
@@ -6860,7 +7014,7 @@ var Jn = class extends W {
|
|
|
6860
7014
|
let u = Math.min(i.x, a.x) + r, d = Math.min(i.y, a.y) + r, f = Math.max(i.x, a.x) - r, p = Math.max(i.y, a.y) - r;
|
|
6861
7015
|
return !(e.x > u && e.x < f && e.y > d && e.y < p) || !!t.style.fillColor;
|
|
6862
7016
|
}
|
|
6863
|
-
},
|
|
7017
|
+
}, fr = class extends H {
|
|
6864
7018
|
descriptor = {
|
|
6865
7019
|
type: "ellipse",
|
|
6866
7020
|
name: "Ellipse",
|
|
@@ -6876,7 +7030,7 @@ var Jn = class extends W {
|
|
|
6876
7030
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = (i.x + a.x) / 2, s = (i.y + a.y) / 2, c = Math.max(Math.abs(a.x - i.x) / 2, 1), l = Math.max(Math.abs(a.y - i.y) / 2, 1), u = (e.x - o) / c, d = (e.y - s) / l, f = Math.sqrt(u * u + d * d), p = r / Math.max(Math.min(c, l), 4);
|
|
6877
7031
|
return t.style.fillColor ? f <= 1 + p : Math.abs(f - 1) <= p;
|
|
6878
7032
|
}
|
|
6879
|
-
},
|
|
7033
|
+
}, pr = class extends H {
|
|
6880
7034
|
descriptor = {
|
|
6881
7035
|
type: "triangle",
|
|
6882
7036
|
name: "Triangle",
|
|
@@ -6902,7 +7056,7 @@ var Jn = class extends W {
|
|
|
6902
7056
|
}
|
|
6903
7057
|
return !1;
|
|
6904
7058
|
}
|
|
6905
|
-
},
|
|
7059
|
+
}, mr = class extends H {
|
|
6906
7060
|
descriptor = {
|
|
6907
7061
|
type: "pitchfork",
|
|
6908
7062
|
name: "Andrews' Pitchfork",
|
|
@@ -6938,7 +7092,7 @@ var Jn = class extends W {
|
|
|
6938
7092
|
};
|
|
6939
7093
|
return this.distanceToInfiniteLine(e, a, u) <= r || this.distanceToInfiniteLine(e, o, d) <= r;
|
|
6940
7094
|
}
|
|
6941
|
-
},
|
|
7095
|
+
}, hr = [
|
|
6942
7096
|
"1",
|
|
6943
7097
|
"2",
|
|
6944
7098
|
"3",
|
|
@@ -6947,7 +7101,7 @@ var Jn = class extends W {
|
|
|
6947
7101
|
"A",
|
|
6948
7102
|
"B",
|
|
6949
7103
|
"C"
|
|
6950
|
-
],
|
|
7104
|
+
], gr = class extends H {
|
|
6951
7105
|
descriptor = {
|
|
6952
7106
|
type: "elliottWave",
|
|
6953
7107
|
name: "Elliott Wave",
|
|
@@ -6959,9 +7113,9 @@ var Jn = class extends W {
|
|
|
6959
7113
|
this.applyLineStyle(e, t.style), e.beginPath(), e.moveTo(i[0].x, i[0].y);
|
|
6960
7114
|
for (let t = 1; t < i.length; t++) e.lineTo(i[t].x, i[t].y);
|
|
6961
7115
|
e.stroke(), this.resetLineStyle(e), e.font = "bold 12px sans-serif", e.fillStyle = t.style.color, e.textAlign = "center";
|
|
6962
|
-
for (let t = 0; t < i.length && t <
|
|
7116
|
+
for (let t = 0; t < i.length && t < hr.length; t++) {
|
|
6963
7117
|
let n = t % 2 == 0 ? -12 : 12;
|
|
6964
|
-
e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(
|
|
7118
|
+
e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(hr[t], i[t].x, i[t].y + n);
|
|
6965
7119
|
}
|
|
6966
7120
|
r && this.renderAnchorHandles(e, t, n);
|
|
6967
7121
|
}
|
|
@@ -6971,7 +7125,7 @@ var Jn = class extends W {
|
|
|
6971
7125
|
for (let t = 0; t < i.length - 1; t++) if (this.distanceToLine(e, i[t], i[t + 1]) <= r) return !0;
|
|
6972
7126
|
return !1;
|
|
6973
7127
|
}
|
|
6974
|
-
},
|
|
7128
|
+
}, _r = class extends H {
|
|
6975
7129
|
descriptor = {
|
|
6976
7130
|
type: "priceRange",
|
|
6977
7131
|
name: "Price Range",
|
|
@@ -6989,7 +7143,7 @@ var Jn = class extends W {
|
|
|
6989
7143
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y);
|
|
6990
7144
|
return e.x >= o - r && e.x <= s + r && e.y >= c - r && e.y <= l + r;
|
|
6991
7145
|
}
|
|
6992
|
-
},
|
|
7146
|
+
}, vr = class extends H {
|
|
6993
7147
|
descriptor = {
|
|
6994
7148
|
type: "dateRange",
|
|
6995
7149
|
name: "Date Range",
|
|
@@ -7007,7 +7161,7 @@ var Jn = class extends W {
|
|
|
7007
7161
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), { chartRect: o } = n, s = Math.min(i.x, a.x), c = Math.max(i.x, a.x);
|
|
7008
7162
|
return e.x >= s - r && e.x <= c + r && e.y >= o.y && e.y <= o.y + o.height;
|
|
7009
7163
|
}
|
|
7010
|
-
},
|
|
7164
|
+
}, yr = class extends H {
|
|
7011
7165
|
descriptor = {
|
|
7012
7166
|
type: "measure",
|
|
7013
7167
|
name: "Measure",
|
|
@@ -7032,12 +7186,12 @@ var Jn = class extends W {
|
|
|
7032
7186
|
};
|
|
7033
7187
|
//#endregion
|
|
7034
7188
|
//#region src/drawings/tools/TextAnnotation.ts
|
|
7035
|
-
function
|
|
7189
|
+
function br(e, t = "Text") {
|
|
7036
7190
|
if (typeof e.style.text == "string" && e.style.text.length > 0) return e.style.text;
|
|
7037
7191
|
let n = e.meta?.text;
|
|
7038
7192
|
return typeof n == "string" && n.length > 0 ? n : t;
|
|
7039
7193
|
}
|
|
7040
|
-
var
|
|
7194
|
+
var xr = class extends H {
|
|
7041
7195
|
descriptor = {
|
|
7042
7196
|
type: "text",
|
|
7043
7197
|
name: "Text",
|
|
@@ -7045,7 +7199,7 @@ var mr = class extends W {
|
|
|
7045
7199
|
};
|
|
7046
7200
|
render(e, t, n, r) {
|
|
7047
7201
|
if (t.anchors.length < 1) return;
|
|
7048
|
-
let i = this.anchorToPixel(t.anchors[0], n), a =
|
|
7202
|
+
let i = this.anchorToPixel(t.anchors[0], n), a = br(t), o = t.style.fontSize || 14;
|
|
7049
7203
|
if (e.font = `${o}px sans-serif`, e.fillStyle = t.style.color, e.textAlign = "left", e.textBaseline = "top", r) {
|
|
7050
7204
|
let n = e.measureText(a);
|
|
7051
7205
|
e.strokeStyle = t.style.color, e.lineWidth = 1, e.setLineDash([3, 3]), e.strokeRect(i.x - 2, i.y - 2, n.width + 4, o + 4), e.setLineDash([]);
|
|
@@ -7057,7 +7211,7 @@ var mr = class extends W {
|
|
|
7057
7211
|
let i = this.anchorToPixel(t.anchors[0], n), a = t.style.fontSize || 14;
|
|
7058
7212
|
return e.x >= i.x - r && e.x <= i.x + 80 + r && e.y >= i.y - r && e.y <= i.y + a + r;
|
|
7059
7213
|
}
|
|
7060
|
-
},
|
|
7214
|
+
}, Sr = class extends H {
|
|
7061
7215
|
descriptor = {
|
|
7062
7216
|
type: "arrow",
|
|
7063
7217
|
name: "Arrow",
|
|
@@ -7075,7 +7229,7 @@ var mr = class extends W {
|
|
|
7075
7229
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
7076
7230
|
return this.distanceToLine(e, i, a) <= r;
|
|
7077
7231
|
}
|
|
7078
|
-
},
|
|
7232
|
+
}, Cr = [
|
|
7079
7233
|
{
|
|
7080
7234
|
label: "8x1",
|
|
7081
7235
|
ratio: 8
|
|
@@ -7112,7 +7266,7 @@ var mr = class extends W {
|
|
|
7112
7266
|
label: "1x8",
|
|
7113
7267
|
ratio: .125
|
|
7114
7268
|
}
|
|
7115
|
-
],
|
|
7269
|
+
], wr = class extends H {
|
|
7116
7270
|
descriptor = {
|
|
7117
7271
|
type: "gannFan",
|
|
7118
7272
|
name: "Gann Fan",
|
|
@@ -7124,7 +7278,7 @@ var mr = class extends W {
|
|
|
7124
7278
|
if (Math.abs(o) < 1) return;
|
|
7125
7279
|
let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
|
|
7126
7280
|
this.applyLineStyle(e, t.style);
|
|
7127
|
-
for (let { label: n, ratio: r } of
|
|
7281
|
+
for (let { label: n, ratio: r } of Cr) {
|
|
7128
7282
|
let a = c * r, o = d, s = i.y + a * (o - i.x);
|
|
7129
7283
|
e.globalAlpha = r === 1 ? 1 : .5, e.lineWidth = r === 1 ? t.style.lineWidth : Math.max(.5, t.style.lineWidth * .7), e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(o, s), e.stroke();
|
|
7130
7284
|
let f = o - l * 4, p = s;
|
|
@@ -7137,7 +7291,7 @@ var mr = class extends W {
|
|
|
7137
7291
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = a.x - i.x, s = a.y - i.y;
|
|
7138
7292
|
if (Math.abs(o) < 1) return !1;
|
|
7139
7293
|
let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
|
|
7140
|
-
for (let { ratio: t } of
|
|
7294
|
+
for (let { ratio: t } of Cr) {
|
|
7141
7295
|
let n = c * t, a = d, o = i.y + n * (a - i.x);
|
|
7142
7296
|
if (this.distanceToLine(e, i, {
|
|
7143
7297
|
x: a,
|
|
@@ -7146,7 +7300,7 @@ var mr = class extends W {
|
|
|
7146
7300
|
}
|
|
7147
7301
|
return !1;
|
|
7148
7302
|
}
|
|
7149
|
-
},
|
|
7303
|
+
}, Tr = [
|
|
7150
7304
|
0,
|
|
7151
7305
|
.25,
|
|
7152
7306
|
.333,
|
|
@@ -7154,7 +7308,7 @@ var mr = class extends W {
|
|
|
7154
7308
|
.667,
|
|
7155
7309
|
.75,
|
|
7156
7310
|
1
|
|
7157
|
-
],
|
|
7311
|
+
], Er = class extends H {
|
|
7158
7312
|
descriptor = {
|
|
7159
7313
|
type: "gannBox",
|
|
7160
7314
|
name: "Gann Box",
|
|
@@ -7165,18 +7319,18 @@ var mr = class extends W {
|
|
|
7165
7319
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y), u = s - o, d = l - c;
|
|
7166
7320
|
if (!(u < 2 || d < 2)) {
|
|
7167
7321
|
this.applyLineStyle(e, t.style), e.strokeRect(o, c, u, d), e.save(), e.globalAlpha = .35;
|
|
7168
|
-
for (let t of
|
|
7322
|
+
for (let t of Tr) {
|
|
7169
7323
|
if (t === 0 || t === 1) continue;
|
|
7170
7324
|
let n = c + d * t;
|
|
7171
7325
|
e.beginPath(), e.moveTo(o, n), e.lineTo(s, n), e.stroke();
|
|
7172
7326
|
}
|
|
7173
|
-
for (let t of
|
|
7327
|
+
for (let t of Tr) {
|
|
7174
7328
|
if (t === 0 || t === 1) continue;
|
|
7175
7329
|
let n = o + u * t;
|
|
7176
7330
|
e.beginPath(), e.moveTo(n, c), e.lineTo(n, l), e.stroke();
|
|
7177
7331
|
}
|
|
7178
7332
|
e.globalAlpha = .5, e.setLineDash([4, 3]), e.beginPath(), e.moveTo(o, c), e.lineTo(s, l), e.stroke(), e.beginPath(), e.moveTo(s, c), e.lineTo(o, l), e.stroke(), e.restore(), this.resetLineStyle(e), e.fillStyle = t.style.color, e.font = "8px sans-serif", e.globalAlpha = .6, e.textBaseline = "bottom", e.textAlign = "right";
|
|
7179
|
-
for (let t of
|
|
7333
|
+
for (let t of Tr) {
|
|
7180
7334
|
if (t === 0 || t === 1) continue;
|
|
7181
7335
|
let n = c + d * t;
|
|
7182
7336
|
e.fillText(`${(t * 100).toFixed(0)}%`, o - 3, n);
|
|
@@ -7201,7 +7355,7 @@ var mr = class extends W {
|
|
|
7201
7355
|
y: l
|
|
7202
7356
|
}) <= r;
|
|
7203
7357
|
}
|
|
7204
|
-
},
|
|
7358
|
+
}, Dr = class extends H {
|
|
7205
7359
|
descriptor = {
|
|
7206
7360
|
type: "anchoredVWAP",
|
|
7207
7361
|
name: "Anchored VWAP",
|
|
@@ -7273,7 +7427,7 @@ var mr = class extends W {
|
|
|
7273
7427
|
}
|
|
7274
7428
|
return !1;
|
|
7275
7429
|
}
|
|
7276
|
-
},
|
|
7430
|
+
}, Or = class extends H {
|
|
7277
7431
|
descriptor = {
|
|
7278
7432
|
type: "volumeProfileRange",
|
|
7279
7433
|
name: "Volume Profile (Range)",
|
|
@@ -7315,7 +7469,7 @@ var mr = class extends W {
|
|
|
7315
7469
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n), o = Math.min(i.x, a.x) - r, s = Math.max(i.x, a.x) + 100 + r, c = Math.min(i.y, a.y) - r, l = Math.max(i.y, a.y) + r;
|
|
7316
7470
|
return e.x >= o && e.x <= s && e.y >= c && e.y <= l;
|
|
7317
7471
|
}
|
|
7318
|
-
},
|
|
7472
|
+
}, kr = [
|
|
7319
7473
|
1,
|
|
7320
7474
|
2,
|
|
7321
7475
|
3,
|
|
@@ -7325,7 +7479,7 @@ var mr = class extends W {
|
|
|
7325
7479
|
21,
|
|
7326
7480
|
34,
|
|
7327
7481
|
55
|
|
7328
|
-
],
|
|
7482
|
+
], Ar = class extends H {
|
|
7329
7483
|
descriptor = {
|
|
7330
7484
|
type: "fibTimeZones",
|
|
7331
7485
|
name: "Fibonacci Time Zones",
|
|
@@ -7337,7 +7491,7 @@ var mr = class extends W {
|
|
|
7337
7491
|
if (a === 0) return;
|
|
7338
7492
|
let { chartRect: o } = n;
|
|
7339
7493
|
e.font = "11px sans-serif", e.textBaseline = "top", e.textAlign = "center", this.applyLineStyle(e, t.style);
|
|
7340
|
-
for (let r of
|
|
7494
|
+
for (let r of kr) {
|
|
7341
7495
|
let s = P(i.time + a * r, n);
|
|
7342
7496
|
s < o.x || s > o.x + o.width || (e.globalAlpha = r === 1 ? 1 : .55, e.beginPath(), e.moveTo(s, o.y), e.lineTo(s, o.y + o.height), e.stroke(), e.fillStyle = t.style.color, e.fillText(String(r), s, o.y + 2));
|
|
7343
7497
|
}
|
|
@@ -7349,7 +7503,7 @@ var mr = class extends W {
|
|
|
7349
7503
|
if (a === 0) return !1;
|
|
7350
7504
|
let { chartRect: o } = n;
|
|
7351
7505
|
if (e.y < o.y || e.y > o.y + o.height) return !1;
|
|
7352
|
-
for (let t of
|
|
7506
|
+
for (let t of kr) {
|
|
7353
7507
|
let o = P(i.time + a * t, n);
|
|
7354
7508
|
if (Math.abs(e.x - o) <= r) return !0;
|
|
7355
7509
|
}
|
|
@@ -7358,12 +7512,12 @@ var mr = class extends W {
|
|
|
7358
7512
|
};
|
|
7359
7513
|
//#endregion
|
|
7360
7514
|
//#region src/drawings/tools/index.ts
|
|
7361
|
-
function
|
|
7362
|
-
e.register(new
|
|
7515
|
+
function jr(e) {
|
|
7516
|
+
e.register(new tr()), e.register(new nr()), e.register(new rr()), e.register(new ir()), e.register(new ar()), e.register(new or()), e.register(new sr()), e.register(new cr()), e.register(new ur()), e.register(new dr()), e.register(new fr()), e.register(new pr()), e.register(new mr()), e.register(new gr()), e.register(new _r()), e.register(new vr()), e.register(new yr()), e.register(new xr()), e.register(new Sr()), e.register(new wr()), e.register(new Er()), e.register(new Dr()), e.register(new Or()), e.register(new Ar());
|
|
7363
7517
|
}
|
|
7364
7518
|
//#endregion
|
|
7365
7519
|
//#region src/trading/OrderRenderer.ts
|
|
7366
|
-
var
|
|
7520
|
+
var Mr = class {
|
|
7367
7521
|
render(e, t, n, r, i, a) {
|
|
7368
7522
|
let o = i.orderColors?.buy ?? "#26A69A", s = i.orderColors?.sell ?? "#EF5350", { chartRect: c } = n;
|
|
7369
7523
|
for (let i of t) {
|
|
@@ -7404,7 +7558,7 @@ var Tr = class {
|
|
|
7404
7558
|
};
|
|
7405
7559
|
//#endregion
|
|
7406
7560
|
//#region src/trading/positionFormat.ts
|
|
7407
|
-
function
|
|
7561
|
+
function Nr(e, t, n) {
|
|
7408
7562
|
let r = Math.min(Math.max(e.closedQuantity ?? 0, 0), e.quantity), i = e.quantity - r, a = e.side === "buy" ? 1 : -1, o = (t - e.entryPrice) * i * a, s = e.entryPrice === 0 ? 0 : (t - e.entryPrice) / e.entryPrice * 100 * a;
|
|
7409
7563
|
return {
|
|
7410
7564
|
side: e.side,
|
|
@@ -7418,9 +7572,9 @@ function Er(e, t, n) {
|
|
|
7418
7572
|
precision: n
|
|
7419
7573
|
};
|
|
7420
7574
|
}
|
|
7421
|
-
var
|
|
7422
|
-
function
|
|
7423
|
-
return e.replace(
|
|
7575
|
+
var Pr = /\{(side|qty|closedQty|openQty|entry|price|pnl|pnlPct|pnlSign)\}/g;
|
|
7576
|
+
function Fr(e, t) {
|
|
7577
|
+
return e.replace(Pr, (e, n) => {
|
|
7424
7578
|
switch (n) {
|
|
7425
7579
|
case "side": return t.side.toUpperCase();
|
|
7426
7580
|
case "qty": return String(t.quantity);
|
|
@@ -7435,10 +7589,10 @@ function Or(e, t) {
|
|
|
7435
7589
|
}
|
|
7436
7590
|
});
|
|
7437
7591
|
}
|
|
7438
|
-
function
|
|
7439
|
-
return typeof e == "function" ? e(t) :
|
|
7592
|
+
function Ir(e, t) {
|
|
7593
|
+
return typeof e == "function" ? e(t) : Fr(e ?? "{side} {qty} | P&L: {pnlSign}{pnl}", t);
|
|
7440
7594
|
}
|
|
7441
|
-
function
|
|
7595
|
+
function Lr(e, t, n) {
|
|
7442
7596
|
if (!t || t.length === 0) return n;
|
|
7443
7597
|
let r = [...t].sort((e, t) => e.pnl - t.pnl), i;
|
|
7444
7598
|
for (let t of r) if (e >= t.pnl) i = t.color;
|
|
@@ -7447,20 +7601,20 @@ function Ar(e, t, n) {
|
|
|
7447
7601
|
}
|
|
7448
7602
|
//#endregion
|
|
7449
7603
|
//#region src/trading/PositionRenderer.ts
|
|
7450
|
-
var
|
|
7604
|
+
var Rr = class {
|
|
7451
7605
|
render(e, t, n, r, i, a) {
|
|
7452
7606
|
let { chartRect: o } = r, s = a.positionColors?.profit ?? "#26A69A", c = a.positionColors?.loss ?? "#EF5350", l = a.positionColors?.entry ?? "#2196F3", u = a.pricePrecision ?? 2;
|
|
7453
7607
|
for (let d of t) {
|
|
7454
7608
|
let t = k(d.entryPrice, r);
|
|
7455
7609
|
if (e.strokeStyle = l, e.lineWidth = 1.5, e.setLineDash([]), e.beginPath(), e.moveTo(o.x, Math.round(t) + .5), e.lineTo(o.x + o.width, Math.round(t) + .5), e.stroke(), n !== null) {
|
|
7456
|
-
let f = k(n, r), p =
|
|
7610
|
+
let f = k(n, r), p = Nr(d, n, u), m = p.pnl, h = m >= 0 ? s : c, g = Lr(m, a.pnlThresholds, h);
|
|
7457
7611
|
e.fillStyle = g, e.globalAlpha = .08;
|
|
7458
7612
|
let _ = Math.min(t, f), v = Math.abs(f - t);
|
|
7459
7613
|
if (e.fillRect(o.x, _, o.width, v), e.globalAlpha = 1, p.closedQuantity > 0 && d.quantity > 0) {
|
|
7460
7614
|
let t = p.closedQuantity / d.quantity;
|
|
7461
7615
|
e.fillStyle = l, e.globalAlpha = .25, e.fillRect(o.x, _, Math.max(2, o.width * t * .04) + 2, v), e.globalAlpha = 1;
|
|
7462
7616
|
}
|
|
7463
|
-
let y =
|
|
7617
|
+
let y = Ir(a.positionLabel, p);
|
|
7464
7618
|
e.font = `bold 11px ${i.font.family}`;
|
|
7465
7619
|
let b = e.measureText(y).width + 12, x = o.x + 8;
|
|
7466
7620
|
e.fillStyle = g, e.globalAlpha = .9, e.fillRect(x, t - 10, b, 20), e.globalAlpha = 1, e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.textAlign = "left", e.fillText(y, x + 6, t);
|
|
@@ -7483,7 +7637,7 @@ var jr = class {
|
|
|
7483
7637
|
e.fillStyle = o, e.fillRect(c, t - 9, u - 2, 18), e.fillStyle = "#FFFFFF", e.font = `11px ${r.font.family}`, e.textAlign = "left", e.textBaseline = "middle", e.fillText(i.entryPrice.toFixed(s), c + 5, t);
|
|
7484
7638
|
}
|
|
7485
7639
|
}
|
|
7486
|
-
},
|
|
7640
|
+
}, zr = class {
|
|
7487
7641
|
render(e, t, n, r) {
|
|
7488
7642
|
if (!r.depthOverlay?.enabled) return;
|
|
7489
7643
|
let { chartRect: i } = n, a = r.depthOverlay.bidColor ?? "rgba(38,166,154,0.15)", o = r.depthOverlay.askColor ?? "rgba(239,83,80,0.15)", s = r.depthOverlay.maxWidth ?? 100, c = 0, l = [], u = 0;
|
|
@@ -7514,7 +7668,7 @@ var jr = class {
|
|
|
7514
7668
|
e.fillRect(p - o, a - f / 2, o, f);
|
|
7515
7669
|
}
|
|
7516
7670
|
}
|
|
7517
|
-
},
|
|
7671
|
+
}, Br = class {
|
|
7518
7672
|
dragState = null;
|
|
7519
7673
|
startY = 0;
|
|
7520
7674
|
dragging = !1;
|
|
@@ -7578,7 +7732,7 @@ var jr = class {
|
|
|
7578
7732
|
isActive() {
|
|
7579
7733
|
return this.dragState !== null;
|
|
7580
7734
|
}
|
|
7581
|
-
},
|
|
7735
|
+
}, Vr = class {
|
|
7582
7736
|
menuElement = null;
|
|
7583
7737
|
removeHandler = null;
|
|
7584
7738
|
onItemSelect = null;
|
|
@@ -7665,7 +7819,7 @@ var jr = class {
|
|
|
7665
7819
|
};
|
|
7666
7820
|
//#endregion
|
|
7667
7821
|
//#region src/trading/BracketTool.ts
|
|
7668
|
-
function
|
|
7822
|
+
function Hr(e, t, n = {}) {
|
|
7669
7823
|
let r = Math.max(Math.abs(t) * (n.riskFraction ?? .01), 1e-8), i = r * (n.riskReward ?? 2);
|
|
7670
7824
|
return e === "buy" ? {
|
|
7671
7825
|
side: e,
|
|
@@ -7679,11 +7833,11 @@ function Fr(e, t, n = {}) {
|
|
|
7679
7833
|
takeProfit: t - i
|
|
7680
7834
|
};
|
|
7681
7835
|
}
|
|
7682
|
-
function
|
|
7836
|
+
function Ur(e) {
|
|
7683
7837
|
let t = Math.abs(e.entry - e.stopLoss);
|
|
7684
7838
|
return t === 0 ? 0 : Math.abs(e.takeProfit - e.entry) / t;
|
|
7685
7839
|
}
|
|
7686
|
-
var
|
|
7840
|
+
var Wr = 6, Gr = class {
|
|
7687
7841
|
draft = null;
|
|
7688
7842
|
dragging = null;
|
|
7689
7843
|
defaults;
|
|
@@ -7691,7 +7845,7 @@ var Lr = 6, Rr = class {
|
|
|
7691
7845
|
this.defaults = e;
|
|
7692
7846
|
}
|
|
7693
7847
|
start(e, t) {
|
|
7694
|
-
this.draft =
|
|
7848
|
+
this.draft = Hr(e, t, this.defaults), this.dragging = null;
|
|
7695
7849
|
}
|
|
7696
7850
|
cancel() {
|
|
7697
7851
|
this.draft = null, this.dragging = null;
|
|
@@ -7708,7 +7862,7 @@ var Lr = 6, Rr = class {
|
|
|
7708
7862
|
"entry",
|
|
7709
7863
|
"sl",
|
|
7710
7864
|
"tp"
|
|
7711
|
-
], r = null, i =
|
|
7865
|
+
], r = null, i = Wr;
|
|
7712
7866
|
for (let a of n) {
|
|
7713
7867
|
let n = k(this.priceOf(a), t), o = Math.abs(n - e.y);
|
|
7714
7868
|
o <= i && (i = o, r = a);
|
|
@@ -7722,7 +7876,7 @@ var Lr = 6, Rr = class {
|
|
|
7722
7876
|
drag(e, t) {
|
|
7723
7877
|
if (!this.draft || !this.dragging) return !1;
|
|
7724
7878
|
let n = j(e.y, t);
|
|
7725
|
-
return this.draft =
|
|
7879
|
+
return this.draft = Kr(this.draft, this.dragging, n), !0;
|
|
7726
7880
|
}
|
|
7727
7881
|
endDrag() {
|
|
7728
7882
|
this.dragging = null;
|
|
@@ -7738,9 +7892,9 @@ var Lr = 6, Rr = class {
|
|
|
7738
7892
|
let i = this.draft;
|
|
7739
7893
|
if (!i) return;
|
|
7740
7894
|
let { chartRect: a } = t, o = a.x, s = a.x + a.width, c = k(i.entry, t), l = k(i.stopLoss, t), u = k(i.takeProfit, t), d = n.candleUp, f = n.candleDown;
|
|
7741
|
-
e.save(), e.globalAlpha = .12, e.fillStyle = d, e.fillRect(o, Math.min(c, u), a.width, Math.abs(u - c)), e.fillStyle = f, e.fillRect(o, Math.min(c, l), a.width, Math.abs(l - c)), e.globalAlpha = 1,
|
|
7742
|
-
let p =
|
|
7743
|
-
|
|
7895
|
+
e.save(), e.globalAlpha = .12, e.fillStyle = d, e.fillRect(o, Math.min(c, u), a.width, Math.abs(u - c)), e.fillStyle = f, e.fillRect(o, Math.min(c, l), a.width, Math.abs(l - c)), e.globalAlpha = 1, qr(e, o, s, c, n.text, [6, 3]), qr(e, o, s, u, d, []), qr(e, o, s, l, f, []);
|
|
7896
|
+
let p = Ur(i), m = i.side === "buy" ? "LONG" : "SHORT";
|
|
7897
|
+
Jr(e, o + 6, c, `${m} entry ${i.entry.toFixed(r)}`, n.text, n.background), Jr(e, o + 6, u, `TP ${i.takeProfit.toFixed(r)} · ${p.toFixed(2)}R`, d, n.background), Jr(e, o + 6, l, `SL ${i.stopLoss.toFixed(r)}`, f, n.background);
|
|
7744
7898
|
for (let [r, a] of [
|
|
7745
7899
|
[i.entry, n.text],
|
|
7746
7900
|
[i.takeProfit, d],
|
|
@@ -7752,7 +7906,7 @@ var Lr = 6, Rr = class {
|
|
|
7752
7906
|
e.restore();
|
|
7753
7907
|
}
|
|
7754
7908
|
};
|
|
7755
|
-
function
|
|
7909
|
+
function Kr(e, t, n) {
|
|
7756
7910
|
let r = e.side === "buy";
|
|
7757
7911
|
if (t === "entry") {
|
|
7758
7912
|
let t = n - e.entry;
|
|
@@ -7776,28 +7930,99 @@ function zr(e, t, n) {
|
|
|
7776
7930
|
takeProfit: i
|
|
7777
7931
|
};
|
|
7778
7932
|
}
|
|
7779
|
-
function
|
|
7933
|
+
function qr(e, t, n, r, i, a) {
|
|
7934
|
+
e.strokeStyle = i, e.lineWidth = 1, e.setLineDash(a), e.beginPath(), e.moveTo(t, Math.round(r) + .5), e.lineTo(n, Math.round(r) + .5), e.stroke(), e.setLineDash([]);
|
|
7935
|
+
}
|
|
7936
|
+
function Jr(e, t, n, r, i, a) {
|
|
7937
|
+
e.font = "600 10px system-ui, sans-serif", e.textBaseline = "middle", e.textAlign = "left";
|
|
7938
|
+
let o = e.measureText(r).width;
|
|
7939
|
+
e.globalAlpha = .85, e.fillStyle = a, e.fillRect(t - 3, n - 8, o + 6, 16), e.globalAlpha = 1, e.fillStyle = i, e.fillText(r, t, n + .5);
|
|
7940
|
+
}
|
|
7941
|
+
//#endregion
|
|
7942
|
+
//#region src/trading/OrderDraftTool.ts
|
|
7943
|
+
function Yr(e, t, n) {
|
|
7944
|
+
return n == null ? "limit" : e === "buy" ? t <= n ? "limit" : "stop" : t >= n ? "limit" : "stop";
|
|
7945
|
+
}
|
|
7946
|
+
var Xr = 6, Zr = class {
|
|
7947
|
+
draft = null;
|
|
7948
|
+
dragging = !1;
|
|
7949
|
+
start(e, t, n = 1) {
|
|
7950
|
+
this.draft = {
|
|
7951
|
+
side: e,
|
|
7952
|
+
price: t,
|
|
7953
|
+
quantity: n
|
|
7954
|
+
}, this.dragging = !1;
|
|
7955
|
+
}
|
|
7956
|
+
cancel() {
|
|
7957
|
+
this.draft = null, this.dragging = !1;
|
|
7958
|
+
}
|
|
7959
|
+
isActive() {
|
|
7960
|
+
return this.draft !== null;
|
|
7961
|
+
}
|
|
7962
|
+
isDragging() {
|
|
7963
|
+
return this.dragging;
|
|
7964
|
+
}
|
|
7965
|
+
getDraft() {
|
|
7966
|
+
return this.draft ? { ...this.draft } : null;
|
|
7967
|
+
}
|
|
7968
|
+
setPrice(e) {
|
|
7969
|
+
return this.draft ? (this.draft = {
|
|
7970
|
+
...this.draft,
|
|
7971
|
+
price: e
|
|
7972
|
+
}, !0) : !1;
|
|
7973
|
+
}
|
|
7974
|
+
toIntent(e) {
|
|
7975
|
+
return this.draft ? {
|
|
7976
|
+
side: this.draft.side,
|
|
7977
|
+
type: Yr(this.draft.side, this.draft.price, e),
|
|
7978
|
+
price: this.draft.price,
|
|
7979
|
+
quantity: this.draft.quantity
|
|
7980
|
+
} : null;
|
|
7981
|
+
}
|
|
7982
|
+
hitTest(e, t) {
|
|
7983
|
+
return this.draft ? Math.abs(k(this.draft.price, t) - e.y) <= Xr : !1;
|
|
7984
|
+
}
|
|
7985
|
+
beginDrag(e, t) {
|
|
7986
|
+
return this.hitTest(e, t) ? (this.dragging = !0, !0) : !1;
|
|
7987
|
+
}
|
|
7988
|
+
drag(e, t) {
|
|
7989
|
+
return !this.draft || !this.dragging ? !1 : this.setPrice(j(e.y, t));
|
|
7990
|
+
}
|
|
7991
|
+
endDrag() {
|
|
7992
|
+
this.dragging = !1;
|
|
7993
|
+
}
|
|
7994
|
+
render(e, t, n, r, i = 2) {
|
|
7995
|
+
let a = this.draft;
|
|
7996
|
+
if (!a) return;
|
|
7997
|
+
let { chartRect: o } = t, s = o.x, c = o.x + o.width, l = k(a.price, t), u = Yr(a.side, a.price, r), d = a.side === "buy" ? n.candleUp : n.candleDown;
|
|
7998
|
+
e.save(), Qr(e, s, c, l, d, [6, 3]);
|
|
7999
|
+
let f = a.side === "buy" ? "BUY" : "SELL";
|
|
8000
|
+
$r(e, s + 6, l, `${f} ${u.toUpperCase()} ${a.price.toFixed(i)}`, d, n.background), e.fillStyle = d, e.beginPath(), e.arc(c - 6, l, 3.5, 0, Math.PI * 2), e.fill(), e.restore();
|
|
8001
|
+
}
|
|
8002
|
+
};
|
|
8003
|
+
function Qr(e, t, n, r, i, a) {
|
|
7780
8004
|
e.strokeStyle = i, e.lineWidth = 1, e.setLineDash(a), e.beginPath(), e.moveTo(t, Math.round(r) + .5), e.lineTo(n, Math.round(r) + .5), e.stroke(), e.setLineDash([]);
|
|
7781
8005
|
}
|
|
7782
|
-
function
|
|
8006
|
+
function $r(e, t, n, r, i, a) {
|
|
7783
8007
|
e.font = "600 10px system-ui, sans-serif", e.textBaseline = "middle", e.textAlign = "left";
|
|
7784
8008
|
let o = e.measureText(r).width;
|
|
7785
8009
|
e.globalAlpha = .85, e.fillStyle = a, e.fillRect(t - 3, n - 8, o + 6, 16), e.globalAlpha = 1, e.fillStyle = i, e.fillText(r, t, n + .5);
|
|
7786
8010
|
}
|
|
7787
8011
|
//#endregion
|
|
7788
8012
|
//#region src/trading/TradingManager.ts
|
|
7789
|
-
var
|
|
8013
|
+
var ei = class {
|
|
7790
8014
|
orders = [];
|
|
7791
8015
|
positions = [];
|
|
7792
8016
|
depthData = null;
|
|
7793
8017
|
currentPrice = null;
|
|
7794
8018
|
config;
|
|
7795
|
-
orderRenderer = new
|
|
7796
|
-
positionRenderer = new
|
|
7797
|
-
depthOverlay = new
|
|
8019
|
+
orderRenderer = new Mr();
|
|
8020
|
+
positionRenderer = new Rr();
|
|
8021
|
+
depthOverlay = new zr();
|
|
7798
8022
|
dragHandler;
|
|
7799
|
-
contextMenu = new
|
|
7800
|
-
bracket = new
|
|
8023
|
+
contextMenu = new Vr();
|
|
8024
|
+
bracket = new Gr();
|
|
8025
|
+
orderDraft = new Zr();
|
|
7801
8026
|
requestRender = null;
|
|
7802
8027
|
eventCallback = null;
|
|
7803
8028
|
container = null;
|
|
@@ -7805,7 +8030,7 @@ var Hr = class {
|
|
|
7805
8030
|
this.config = {
|
|
7806
8031
|
...s,
|
|
7807
8032
|
...e
|
|
7808
|
-
}, this.dragHandler = new
|
|
8033
|
+
}, this.dragHandler = new Br(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
|
|
7809
8034
|
this.eventCallback?.("orderPlace", e);
|
|
7810
8035
|
};
|
|
7811
8036
|
}
|
|
@@ -7846,26 +8071,44 @@ var Hr = class {
|
|
|
7846
8071
|
entry: e.entry,
|
|
7847
8072
|
stopLoss: e.stopLoss,
|
|
7848
8073
|
takeProfit: e.takeProfit,
|
|
7849
|
-
riskReward:
|
|
8074
|
+
riskReward: Ur(e)
|
|
7850
8075
|
}), this.bracket.cancel(), this.requestRender?.(), !0) : !1;
|
|
7851
8076
|
}
|
|
7852
8077
|
isBracketActive() {
|
|
7853
8078
|
return this.bracket.isActive();
|
|
7854
8079
|
}
|
|
8080
|
+
startOrderDraft(e, t) {
|
|
8081
|
+
this.orderDraft.start(e, t), this.requestRender?.();
|
|
8082
|
+
}
|
|
8083
|
+
cancelOrderDraft() {
|
|
8084
|
+
this.orderDraft.isActive() && (this.orderDraft.cancel(), this.requestRender?.());
|
|
8085
|
+
}
|
|
8086
|
+
confirmOrderDraft() {
|
|
8087
|
+
let e = this.orderDraft.toIntent(this.currentPrice);
|
|
8088
|
+
return e ? (this.eventCallback?.("orderPlace", e), this.orderDraft.cancel(), this.requestRender?.(), !0) : !1;
|
|
8089
|
+
}
|
|
8090
|
+
isOrderDraftActive() {
|
|
8091
|
+
return this.orderDraft.isActive();
|
|
8092
|
+
}
|
|
7855
8093
|
onPointerDown(e, t) {
|
|
7856
|
-
return this.config.enabled ? this.bracket.isActive() && this.bracket.beginDrag(e, t) ? (this.requestRender?.(), !0) : this.dragHandler.onPointerDown(e, this.orders, this.positions, t, 8) : !1;
|
|
8094
|
+
return this.config.enabled ? this.bracket.isActive() && this.bracket.beginDrag(e, t) || this.orderDraft.isActive() && this.orderDraft.beginDrag(e, t) ? (this.requestRender?.(), !0) : this.dragHandler.onPointerDown(e, this.orders, this.positions, t, 8) : !1;
|
|
7857
8095
|
}
|
|
7858
8096
|
onPointerMove(e, t) {
|
|
7859
8097
|
if (this.bracket.isDragging()) {
|
|
7860
8098
|
let n = this.bracket.drag(e, t);
|
|
7861
8099
|
return n && this.requestRender?.(), n;
|
|
7862
8100
|
}
|
|
8101
|
+
if (this.orderDraft.isDragging()) {
|
|
8102
|
+
let n = this.orderDraft.drag(e, t);
|
|
8103
|
+
return n && this.requestRender?.(), n;
|
|
8104
|
+
}
|
|
7863
8105
|
if (!this.dragHandler.isActive()) return !1;
|
|
7864
8106
|
let n = this.dragHandler.onPointerMove(e, t);
|
|
7865
8107
|
return n && this.requestRender?.(), n;
|
|
7866
8108
|
}
|
|
7867
8109
|
onPointerUp() {
|
|
7868
8110
|
if (this.bracket.isDragging()) return this.bracket.endDrag(), this.requestRender?.(), !0;
|
|
8111
|
+
if (this.orderDraft.isDragging()) return this.orderDraft.endDrag(), this.requestRender?.(), !0;
|
|
7869
8112
|
let e = this.dragHandler.onPointerUp();
|
|
7870
8113
|
return e ? (e.sourceType === "order" ? this.eventCallback?.("orderModify", {
|
|
7871
8114
|
orderId: e.id,
|
|
@@ -7882,7 +8125,7 @@ var Hr = class {
|
|
|
7882
8125
|
return this.contextMenu.show(e, n, this.container, this.config), !0;
|
|
7883
8126
|
}
|
|
7884
8127
|
render(e, t, n) {
|
|
7885
|
-
this.config.enabled && (this.depthData && this.depthOverlay.render(e, this.depthData, t, this.config), this.positions.length > 0 && this.positionRenderer.render(e, this.positions, this.currentPrice, t, n, this.config), this.orders.length > 0 && this.orderRenderer.render(e, this.orders, t, n, this.config, this.dragHandler.getDragState()), this.bracket.isActive() && this.bracket.render(e, t, n, this.config.pricePrecision ?? 2));
|
|
8128
|
+
this.config.enabled && (this.depthData && this.depthOverlay.render(e, this.depthData, t, this.config), this.positions.length > 0 && this.positionRenderer.render(e, this.positions, this.currentPrice, t, n, this.config), this.orders.length > 0 && this.orderRenderer.render(e, this.orders, t, n, this.config, this.dragHandler.getDragState()), this.bracket.isActive() && this.bracket.render(e, t, n, this.config.pricePrecision ?? 2), this.orderDraft.isActive() && this.orderDraft.render(e, t, n, this.currentPrice, this.config.pricePrecision ?? 2));
|
|
7886
8129
|
}
|
|
7887
8130
|
renderAxisBadges(e, t, n) {
|
|
7888
8131
|
this.config.enabled && (this.positions.length > 0 && this.positionRenderer.renderAxisBadges(e, this.positions, t, n, this.config), this.orders.length > 0 && this.orderRenderer.renderAxisBadges(e, this.orders, t, n, this.config, this.dragHandler.getDragState()));
|
|
@@ -7890,7 +8133,7 @@ var Hr = class {
|
|
|
7890
8133
|
destroy() {
|
|
7891
8134
|
this.contextMenu.destroy();
|
|
7892
8135
|
}
|
|
7893
|
-
},
|
|
8136
|
+
}, ti = class {
|
|
7894
8137
|
constructor(e) {
|
|
7895
8138
|
this.manager = e;
|
|
7896
8139
|
}
|
|
@@ -7900,7 +8143,144 @@ var Hr = class {
|
|
|
7900
8143
|
renderAxisBadges(e, t, n) {
|
|
7901
8144
|
this.manager.renderAxisBadges(e, t, n);
|
|
7902
8145
|
}
|
|
7903
|
-
},
|
|
8146
|
+
}, ni = class {
|
|
8147
|
+
name = "paper";
|
|
8148
|
+
state = "disconnected";
|
|
8149
|
+
listeners = /* @__PURE__ */ new Map();
|
|
8150
|
+
orders = [];
|
|
8151
|
+
positions = [];
|
|
8152
|
+
markPrice;
|
|
8153
|
+
seq = 0;
|
|
8154
|
+
constructor(e = {}) {
|
|
8155
|
+
this.markPrice = e.markPrice ?? 0;
|
|
8156
|
+
}
|
|
8157
|
+
connect(e) {
|
|
8158
|
+
this.state = "connected", this.emit("connectionChange", this.state), this.emit("orders", this.orders), this.emit("positions", this.positions);
|
|
8159
|
+
}
|
|
8160
|
+
disconnect() {
|
|
8161
|
+
this.state = "disconnected", this.emit("connectionChange", this.state);
|
|
8162
|
+
}
|
|
8163
|
+
getConnectionState() {
|
|
8164
|
+
return this.state;
|
|
8165
|
+
}
|
|
8166
|
+
setMarkPrice(e) {
|
|
8167
|
+
this.markPrice = e, this.checkPendingOrders(), this.checkStops();
|
|
8168
|
+
}
|
|
8169
|
+
getOrders() {
|
|
8170
|
+
return [...this.orders];
|
|
8171
|
+
}
|
|
8172
|
+
getPositions() {
|
|
8173
|
+
return [...this.positions];
|
|
8174
|
+
}
|
|
8175
|
+
async placeOrder(e) {
|
|
8176
|
+
let t = {
|
|
8177
|
+
id: this.nextId("ord"),
|
|
8178
|
+
side: e.side,
|
|
8179
|
+
type: e.type,
|
|
8180
|
+
price: e.price,
|
|
8181
|
+
stopPrice: e.stopPrice,
|
|
8182
|
+
quantity: e.quantity ?? 1,
|
|
8183
|
+
label: e.type === "market" ? void 0 : ri(e.type),
|
|
8184
|
+
draggable: !0
|
|
8185
|
+
};
|
|
8186
|
+
return e.type === "market" ? this.fill(t, this.markPrice || e.price) : (this.orders = [...this.orders, t], this.emit("orders", this.orders)), t;
|
|
8187
|
+
}
|
|
8188
|
+
async modifyOrder(e) {
|
|
8189
|
+
this.orders = this.orders.map((t) => t.id === e.orderId ? {
|
|
8190
|
+
...t,
|
|
8191
|
+
price: e.newPrice
|
|
8192
|
+
} : t), this.emit("orders", this.orders);
|
|
8193
|
+
}
|
|
8194
|
+
async cancelOrder(e) {
|
|
8195
|
+
this.orders = this.orders.filter((t) => t.id !== e.orderId), this.emit("orders", this.orders);
|
|
8196
|
+
}
|
|
8197
|
+
async modifyPosition(e) {
|
|
8198
|
+
this.positions = this.positions.map((t) => t.id === e.positionId ? {
|
|
8199
|
+
...t,
|
|
8200
|
+
stopLoss: e.stopLoss ?? t.stopLoss,
|
|
8201
|
+
takeProfit: e.takeProfit ?? t.takeProfit
|
|
8202
|
+
} : t), this.emit("positions", this.positions);
|
|
8203
|
+
}
|
|
8204
|
+
async closePosition(e) {
|
|
8205
|
+
this.positions = this.positions.filter((t) => t.id !== e.positionId), this.emit("positions", this.positions);
|
|
8206
|
+
}
|
|
8207
|
+
on(e, t) {
|
|
8208
|
+
let n = this.listeners.get(e);
|
|
8209
|
+
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t);
|
|
8210
|
+
}
|
|
8211
|
+
off(e, t) {
|
|
8212
|
+
this.listeners.get(e)?.delete(t);
|
|
8213
|
+
}
|
|
8214
|
+
dispose() {
|
|
8215
|
+
this.disconnect(), this.listeners.clear(), this.orders = [], this.positions = [];
|
|
8216
|
+
}
|
|
8217
|
+
fill(e, t) {
|
|
8218
|
+
this.orders = this.orders.filter((t) => t.id !== e.id);
|
|
8219
|
+
let n = {
|
|
8220
|
+
id: this.nextId("pos"),
|
|
8221
|
+
side: e.side,
|
|
8222
|
+
entryPrice: t,
|
|
8223
|
+
quantity: e.quantity
|
|
8224
|
+
};
|
|
8225
|
+
this.positions = [...this.positions, n];
|
|
8226
|
+
let r = {
|
|
8227
|
+
orderId: e.id,
|
|
8228
|
+
side: e.side,
|
|
8229
|
+
price: t,
|
|
8230
|
+
quantity: e.quantity,
|
|
8231
|
+
time: Date.now()
|
|
8232
|
+
};
|
|
8233
|
+
this.emit("fill", r), this.emit("orders", this.orders), this.emit("positions", this.positions);
|
|
8234
|
+
}
|
|
8235
|
+
checkPendingOrders() {
|
|
8236
|
+
let e = this.orders.filter((e) => this.isTriggered(e));
|
|
8237
|
+
for (let t of e) this.fill(t, t.type === "limit" ? t.price : t.stopPrice ?? t.price);
|
|
8238
|
+
}
|
|
8239
|
+
isTriggered(e) {
|
|
8240
|
+
if (e.type === "limit") return e.side === "buy" ? this.markPrice <= e.price : this.markPrice >= e.price;
|
|
8241
|
+
if (e.type === "stop" || e.type === "stopLimit") {
|
|
8242
|
+
let t = e.stopPrice ?? e.price;
|
|
8243
|
+
return e.side === "buy" ? this.markPrice >= t : this.markPrice <= t;
|
|
8244
|
+
}
|
|
8245
|
+
return !1;
|
|
8246
|
+
}
|
|
8247
|
+
checkStops() {
|
|
8248
|
+
let e = [], t = !1;
|
|
8249
|
+
for (let n of this.positions) {
|
|
8250
|
+
let r = n.stopLoss !== void 0 && (n.side === "buy" ? this.markPrice <= n.stopLoss : this.markPrice >= n.stopLoss), i = n.takeProfit !== void 0 && (n.side === "buy" ? this.markPrice >= n.takeProfit : this.markPrice <= n.takeProfit);
|
|
8251
|
+
if (r || i) {
|
|
8252
|
+
t = !0;
|
|
8253
|
+
continue;
|
|
8254
|
+
}
|
|
8255
|
+
e.push(n);
|
|
8256
|
+
}
|
|
8257
|
+
t && (this.positions = e, this.emit("positions", this.positions));
|
|
8258
|
+
}
|
|
8259
|
+
nextId(e) {
|
|
8260
|
+
return `${e}-${++this.seq}`;
|
|
8261
|
+
}
|
|
8262
|
+
emit(e, t) {
|
|
8263
|
+
let n = this.listeners.get(e);
|
|
8264
|
+
if (n) {
|
|
8265
|
+
let r = {
|
|
8266
|
+
type: e,
|
|
8267
|
+
data: t,
|
|
8268
|
+
timestamp: Date.now()
|
|
8269
|
+
};
|
|
8270
|
+
for (let e of n) e(r);
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
};
|
|
8274
|
+
function ri(e) {
|
|
8275
|
+
switch (e) {
|
|
8276
|
+
case "stop": return "STOP";
|
|
8277
|
+
case "stopLimit": return "STOP LIMIT";
|
|
8278
|
+
default: return "LIMIT";
|
|
8279
|
+
}
|
|
8280
|
+
}
|
|
8281
|
+
//#endregion
|
|
8282
|
+
//#region src/realtime/Emitter.ts
|
|
8283
|
+
var G = class {
|
|
7904
8284
|
listeners = /* @__PURE__ */ new Map();
|
|
7905
8285
|
on(e, t) {
|
|
7906
8286
|
let n = this.listeners.get(e);
|
|
@@ -7922,7 +8302,7 @@ var Hr = class {
|
|
|
7922
8302
|
removeAllListeners() {
|
|
7923
8303
|
this.listeners.clear();
|
|
7924
8304
|
}
|
|
7925
|
-
},
|
|
8305
|
+
}, ii = class extends G {
|
|
7926
8306
|
currentBar = null;
|
|
7927
8307
|
timeframeMs;
|
|
7928
8308
|
tickRing;
|
|
@@ -7984,7 +8364,7 @@ var Hr = class {
|
|
|
7984
8364
|
alignToTimeframe(e) {
|
|
7985
8365
|
return Math.floor(e / this.timeframeMs) * this.timeframeMs;
|
|
7986
8366
|
}
|
|
7987
|
-
},
|
|
8367
|
+
}, ai = class extends G {
|
|
7988
8368
|
config;
|
|
7989
8369
|
attempt = 0;
|
|
7990
8370
|
timer = null;
|
|
@@ -8031,7 +8411,7 @@ var Hr = class {
|
|
|
8031
8411
|
let e = this.config.baseDelay, t = this.config.backoffMultiplier ** (this.attempt - 1), n = Math.min(e * t, this.config.maxDelay), r = n * .25 * (Math.random() * 2 - 1);
|
|
8032
8412
|
return Math.max(0, Math.round(n + r));
|
|
8033
8413
|
}
|
|
8034
|
-
},
|
|
8414
|
+
}, oi = class {
|
|
8035
8415
|
price = null;
|
|
8036
8416
|
previousClose = null;
|
|
8037
8417
|
visible = !0;
|
|
@@ -8062,12 +8442,12 @@ var Hr = class {
|
|
|
8062
8442
|
let f = s - 5;
|
|
8063
8443
|
e.beginPath(), e.moveTo(f, r), e.lineTo(f + 5, r - 5), e.lineTo(f + 5, r + 5), e.closePath(), e.fill(), e.fillStyle = "#FFFFFF", e.textBaseline = "middle", e.textAlign = "left", e.fillText(c, s + 5, r);
|
|
8064
8444
|
}
|
|
8065
|
-
},
|
|
8445
|
+
}, si = class extends G {
|
|
8066
8446
|
config = null;
|
|
8067
8447
|
adapter = null;
|
|
8068
8448
|
aggregator = null;
|
|
8069
8449
|
reconnector;
|
|
8070
|
-
priceLine = new
|
|
8450
|
+
priceLine = new oi();
|
|
8071
8451
|
state = "disconnected";
|
|
8072
8452
|
lastPrice = null;
|
|
8073
8453
|
previousClose = null;
|
|
@@ -8075,13 +8455,13 @@ var Hr = class {
|
|
|
8075
8455
|
heartbeatTimer = null;
|
|
8076
8456
|
lastMessageTime = 0;
|
|
8077
8457
|
constructor() {
|
|
8078
|
-
super(), this.reconnector = new
|
|
8458
|
+
super(), this.reconnector = new ai(), this.wireReconnector();
|
|
8079
8459
|
}
|
|
8080
8460
|
async connect(e) {
|
|
8081
8461
|
this.disconnect(), this.config = {
|
|
8082
8462
|
...a,
|
|
8083
8463
|
...e
|
|
8084
|
-
}, this.adapter = e.adapter, this.aggregator = new
|
|
8464
|
+
}, this.adapter = e.adapter, this.aggregator = new ii(e.timeframe), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new ai(e.reconnect ?? r), this.wireReconnector(), this.aggregator.on("bar", (e) => {
|
|
8085
8465
|
this.emit("barUpdate", e), this.updatePrice(e.close);
|
|
8086
8466
|
}), this.aggregator.on("barClose", (e) => {
|
|
8087
8467
|
this.previousClose = e.close, this.emit("barClose", e);
|
|
@@ -8191,7 +8571,7 @@ var Hr = class {
|
|
|
8191
8571
|
dispose() {
|
|
8192
8572
|
this.disconnect(), this.removeAllListeners();
|
|
8193
8573
|
}
|
|
8194
|
-
},
|
|
8574
|
+
}, ci = class extends G {
|
|
8195
8575
|
data;
|
|
8196
8576
|
speed;
|
|
8197
8577
|
index;
|
|
@@ -8278,11 +8658,11 @@ var Hr = class {
|
|
|
8278
8658
|
};
|
|
8279
8659
|
//#endregion
|
|
8280
8660
|
//#region src/realtime/adapters/binanceTypes.ts
|
|
8281
|
-
function
|
|
8661
|
+
function li(e) {
|
|
8282
8662
|
if (!Array.isArray(e) || e.length < 6) return null;
|
|
8283
8663
|
let t = e[0];
|
|
8284
8664
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
8285
|
-
let n =
|
|
8665
|
+
let n = K(e[1]), r = K(e[2]), i = K(e[3]), a = K(e[4]), o = K(e[5]);
|
|
8286
8666
|
return n === null || r === null || i === null || a === null || o === null ? null : {
|
|
8287
8667
|
time: t,
|
|
8288
8668
|
open: n,
|
|
@@ -8292,11 +8672,11 @@ function Yr(e) {
|
|
|
8292
8672
|
volume: o
|
|
8293
8673
|
};
|
|
8294
8674
|
}
|
|
8295
|
-
function
|
|
8296
|
-
if (!
|
|
8675
|
+
function ui(e) {
|
|
8676
|
+
if (!di(e)) return null;
|
|
8297
8677
|
let t = e.t;
|
|
8298
8678
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
8299
|
-
let n =
|
|
8679
|
+
let n = K(e.o), r = K(e.h), i = K(e.l), a = K(e.c), o = K(e.v);
|
|
8300
8680
|
if (n === null || r === null || i === null || a === null || o === null) return null;
|
|
8301
8681
|
let s = typeof e.x == "boolean" ? e.x : !1;
|
|
8302
8682
|
return {
|
|
@@ -8311,7 +8691,7 @@ function Xr(e) {
|
|
|
8311
8691
|
closed: s
|
|
8312
8692
|
};
|
|
8313
8693
|
}
|
|
8314
|
-
function
|
|
8694
|
+
function K(e) {
|
|
8315
8695
|
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
8316
8696
|
if (typeof e == "string") {
|
|
8317
8697
|
let t = parseFloat(e);
|
|
@@ -8319,12 +8699,12 @@ function J(e) {
|
|
|
8319
8699
|
}
|
|
8320
8700
|
return null;
|
|
8321
8701
|
}
|
|
8322
|
-
function
|
|
8702
|
+
function di(e) {
|
|
8323
8703
|
return typeof e == "object" && !!e;
|
|
8324
8704
|
}
|
|
8325
8705
|
//#endregion
|
|
8326
8706
|
//#region src/realtime/adapters/BinanceAdapter.ts
|
|
8327
|
-
var
|
|
8707
|
+
var fi = {
|
|
8328
8708
|
"1s": "1s",
|
|
8329
8709
|
"1m": "1m",
|
|
8330
8710
|
"3m": "3m",
|
|
@@ -8341,7 +8721,7 @@ var Qr = {
|
|
|
8341
8721
|
"3d": "3d",
|
|
8342
8722
|
"1w": "1w",
|
|
8343
8723
|
"1M": "1M"
|
|
8344
|
-
},
|
|
8724
|
+
}, pi = class {
|
|
8345
8725
|
name = "binance";
|
|
8346
8726
|
ws = null;
|
|
8347
8727
|
state = "disconnected";
|
|
@@ -8362,13 +8742,13 @@ var Qr = {
|
|
|
8362
8742
|
return this.state;
|
|
8363
8743
|
}
|
|
8364
8744
|
async fetchHistory(e, t, n = 500) {
|
|
8365
|
-
let r =
|
|
8745
|
+
let r = fi[t] ?? "15m", i = `${this.restBase}/klines?symbol=${e}&interval=${r}&limit=${n}`, a = await fetch(i);
|
|
8366
8746
|
if (!a.ok) throw Error(`Binance REST error: ${a.status}`);
|
|
8367
8747
|
let o = await a.json();
|
|
8368
8748
|
if (!Array.isArray(o)) return [];
|
|
8369
8749
|
let s = [];
|
|
8370
8750
|
for (let e of o) {
|
|
8371
|
-
let t =
|
|
8751
|
+
let t = li(e);
|
|
8372
8752
|
t && s.push(t);
|
|
8373
8753
|
}
|
|
8374
8754
|
return s;
|
|
@@ -8385,7 +8765,7 @@ var Qr = {
|
|
|
8385
8765
|
}
|
|
8386
8766
|
connectWs() {
|
|
8387
8767
|
if (!this.config) return;
|
|
8388
|
-
let e = `${this.config.symbol.toLowerCase()}@kline_${
|
|
8768
|
+
let e = `${this.config.symbol.toLowerCase()}@kline_${fi[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
|
|
8389
8769
|
this.setState("connecting");
|
|
8390
8770
|
try {
|
|
8391
8771
|
this.ws = new WebSocket(t);
|
|
@@ -8410,7 +8790,7 @@ var Qr = {
|
|
|
8410
8790
|
};
|
|
8411
8791
|
}
|
|
8412
8792
|
handleKline(e) {
|
|
8413
|
-
let t =
|
|
8793
|
+
let t = ui(e);
|
|
8414
8794
|
if (!t) return;
|
|
8415
8795
|
let { bar: n, closed: r } = t;
|
|
8416
8796
|
this.emitEvent("bar", {
|
|
@@ -8436,7 +8816,7 @@ var Qr = {
|
|
|
8436
8816
|
for (let e of n) e(r);
|
|
8437
8817
|
}
|
|
8438
8818
|
}
|
|
8439
|
-
},
|
|
8819
|
+
}, mi = class {
|
|
8440
8820
|
name = "mock";
|
|
8441
8821
|
state = "disconnected";
|
|
8442
8822
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -8531,7 +8911,453 @@ var Qr = {
|
|
|
8531
8911
|
for (let e of n) e(r);
|
|
8532
8912
|
}
|
|
8533
8913
|
}
|
|
8534
|
-
},
|
|
8914
|
+
}, hi = class {
|
|
8915
|
+
name;
|
|
8916
|
+
ws = null;
|
|
8917
|
+
state = "disconnected";
|
|
8918
|
+
config = null;
|
|
8919
|
+
listeners = /* @__PURE__ */ new Map();
|
|
8920
|
+
opts;
|
|
8921
|
+
constructor(e) {
|
|
8922
|
+
this.opts = e, this.name = e.name;
|
|
8923
|
+
}
|
|
8924
|
+
connect(e) {
|
|
8925
|
+
this.config = e, this.openSocket();
|
|
8926
|
+
}
|
|
8927
|
+
disconnect() {
|
|
8928
|
+
let e = this.config;
|
|
8929
|
+
if (this.ws) {
|
|
8930
|
+
if (this.opts.unsubscribeMessage && e) try {
|
|
8931
|
+
this.sendMessage(this.opts.unsubscribeMessage(e));
|
|
8932
|
+
} catch {}
|
|
8933
|
+
this.ws.onclose = null, this.ws.close(), this.ws = null;
|
|
8934
|
+
}
|
|
8935
|
+
this.setState("disconnected");
|
|
8936
|
+
}
|
|
8937
|
+
getConnectionState() {
|
|
8938
|
+
return this.state;
|
|
8939
|
+
}
|
|
8940
|
+
fetchHistory(e, t, n) {
|
|
8941
|
+
return this.opts.fetchHistory(e, t, n ?? this.opts.defaultHistoryLimit ?? 500);
|
|
8942
|
+
}
|
|
8943
|
+
on(e, t) {
|
|
8944
|
+
let n = this.listeners.get(e);
|
|
8945
|
+
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t);
|
|
8946
|
+
}
|
|
8947
|
+
off(e, t) {
|
|
8948
|
+
this.listeners.get(e)?.delete(t);
|
|
8949
|
+
}
|
|
8950
|
+
dispose() {
|
|
8951
|
+
this.disconnect(), this.listeners.clear();
|
|
8952
|
+
}
|
|
8953
|
+
openSocket() {
|
|
8954
|
+
let e = this.config;
|
|
8955
|
+
if (!e) return;
|
|
8956
|
+
let t = this.opts.wsUrl(e);
|
|
8957
|
+
this.setState("connecting");
|
|
8958
|
+
let n;
|
|
8959
|
+
try {
|
|
8960
|
+
n = this.createSocket(t);
|
|
8961
|
+
} catch {
|
|
8962
|
+
this.setState("error"), this.emitEvent("error", { message: "WebSocket creation failed" }), this.emitEvent("connectionChange", "error");
|
|
8963
|
+
return;
|
|
8964
|
+
}
|
|
8965
|
+
this.ws = n, n.onopen = () => {
|
|
8966
|
+
if (this.setState("connected"), this.emitEvent("connectionChange", "connected"), this.opts.subscribeMessage) try {
|
|
8967
|
+
this.sendMessage(this.opts.subscribeMessage(e));
|
|
8968
|
+
} catch {}
|
|
8969
|
+
}, n.onmessage = (t) => {
|
|
8970
|
+
let n = this.decode(t.data);
|
|
8971
|
+
if (n === void 0) return;
|
|
8972
|
+
let r;
|
|
8973
|
+
try {
|
|
8974
|
+
r = this.opts.parseMessage(n, e);
|
|
8975
|
+
} catch {
|
|
8976
|
+
return;
|
|
8977
|
+
}
|
|
8978
|
+
r && (r.bar && this.emitEvent("bar", {
|
|
8979
|
+
bar: r.bar,
|
|
8980
|
+
closed: r.closed ?? !1
|
|
8981
|
+
}), r.tick ? this.emitEvent("tick", r.tick) : r.bar && this.emitEvent("tick", {
|
|
8982
|
+
time: Date.now(),
|
|
8983
|
+
price: r.bar.close,
|
|
8984
|
+
volume: r.bar.volume
|
|
8985
|
+
}));
|
|
8986
|
+
}, n.onerror = () => {
|
|
8987
|
+
this.setState("error"), this.emitEvent("error", { message: "WebSocket error" });
|
|
8988
|
+
}, n.onclose = () => {
|
|
8989
|
+
this.setState("disconnected"), this.emitEvent("connectionChange", "disconnected");
|
|
8990
|
+
};
|
|
8991
|
+
}
|
|
8992
|
+
sendMessage(e) {
|
|
8993
|
+
e === void 0 || !this.ws || this.ws.send(typeof e == "string" ? e : JSON.stringify(e));
|
|
8994
|
+
}
|
|
8995
|
+
decode(e) {
|
|
8996
|
+
if (this.opts.decode) try {
|
|
8997
|
+
return this.opts.decode(e);
|
|
8998
|
+
} catch {
|
|
8999
|
+
return;
|
|
9000
|
+
}
|
|
9001
|
+
if (typeof e == "string") try {
|
|
9002
|
+
return JSON.parse(e);
|
|
9003
|
+
} catch {
|
|
9004
|
+
return;
|
|
9005
|
+
}
|
|
9006
|
+
return e;
|
|
9007
|
+
}
|
|
9008
|
+
createSocket(e) {
|
|
9009
|
+
if (this.opts.socketFactory) return this.opts.socketFactory(e);
|
|
9010
|
+
let t = globalThis.WebSocket;
|
|
9011
|
+
if (!t) throw Error("No WebSocket implementation available");
|
|
9012
|
+
return new t(e);
|
|
9013
|
+
}
|
|
9014
|
+
setState(e) {
|
|
9015
|
+
this.state = e;
|
|
9016
|
+
}
|
|
9017
|
+
emitEvent(e, t) {
|
|
9018
|
+
let n = this.listeners.get(e);
|
|
9019
|
+
if (n) {
|
|
9020
|
+
let r = {
|
|
9021
|
+
type: e,
|
|
9022
|
+
data: t,
|
|
9023
|
+
timestamp: Date.now()
|
|
9024
|
+
};
|
|
9025
|
+
for (let e of n) e(r);
|
|
9026
|
+
}
|
|
9027
|
+
}
|
|
9028
|
+
}, gi = class {
|
|
9029
|
+
name;
|
|
9030
|
+
state = "disconnected";
|
|
9031
|
+
listeners = /* @__PURE__ */ new Map();
|
|
9032
|
+
config = null;
|
|
9033
|
+
timer = null;
|
|
9034
|
+
lastBarTime = 0;
|
|
9035
|
+
opts;
|
|
9036
|
+
constructor(e) {
|
|
9037
|
+
this.opts = e, this.name = e.name;
|
|
9038
|
+
}
|
|
9039
|
+
connect(e) {
|
|
9040
|
+
this.config = e, this.lastBarTime = 0, this.state = "connected", this.emitEvent("connectionChange", "connected"), this.startPolling();
|
|
9041
|
+
}
|
|
9042
|
+
disconnect() {
|
|
9043
|
+
this.stopPolling(), this.state = "disconnected", this.emitEvent("connectionChange", "disconnected");
|
|
9044
|
+
}
|
|
9045
|
+
getConnectionState() {
|
|
9046
|
+
return this.state;
|
|
9047
|
+
}
|
|
9048
|
+
fetchHistory(e, t, n) {
|
|
9049
|
+
return this.opts.fetchBars(e, t, n ?? this.opts.defaultHistoryLimit ?? 500);
|
|
9050
|
+
}
|
|
9051
|
+
on(e, t) {
|
|
9052
|
+
let n = this.listeners.get(e);
|
|
9053
|
+
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t);
|
|
9054
|
+
}
|
|
9055
|
+
off(e, t) {
|
|
9056
|
+
this.listeners.get(e)?.delete(t);
|
|
9057
|
+
}
|
|
9058
|
+
dispose() {
|
|
9059
|
+
this.disconnect(), this.listeners.clear();
|
|
9060
|
+
}
|
|
9061
|
+
async poll() {
|
|
9062
|
+
let e = this.config;
|
|
9063
|
+
if (!e || this.state !== "connected") return;
|
|
9064
|
+
let t;
|
|
9065
|
+
try {
|
|
9066
|
+
t = await this.opts.fetchBars(e.symbol, e.timeframe, this.opts.pollLimit ?? 2);
|
|
9067
|
+
} catch (e) {
|
|
9068
|
+
this.emitEvent("error", {
|
|
9069
|
+
message: "Poll failed",
|
|
9070
|
+
cause: e
|
|
9071
|
+
});
|
|
9072
|
+
return;
|
|
9073
|
+
}
|
|
9074
|
+
if (t.length === 0) return;
|
|
9075
|
+
let n = t[t.length - 1];
|
|
9076
|
+
if (this.lastBarTime > 0 && n.time > this.lastBarTime) {
|
|
9077
|
+
let e = t.find((e) => e.time === this.lastBarTime);
|
|
9078
|
+
e && this.emitEvent("bar", {
|
|
9079
|
+
bar: e,
|
|
9080
|
+
closed: !0
|
|
9081
|
+
});
|
|
9082
|
+
}
|
|
9083
|
+
this.emitEvent("bar", {
|
|
9084
|
+
bar: n,
|
|
9085
|
+
closed: !1
|
|
9086
|
+
}), this.emitEvent("tick", {
|
|
9087
|
+
time: Date.now(),
|
|
9088
|
+
price: n.close,
|
|
9089
|
+
volume: n.volume
|
|
9090
|
+
}), this.lastBarTime = n.time;
|
|
9091
|
+
}
|
|
9092
|
+
startPolling() {
|
|
9093
|
+
this.stopPolling(), this.poll();
|
|
9094
|
+
let e = this.opts.setInterval ?? ((e, t) => setInterval(e, t));
|
|
9095
|
+
this.timer = e(() => {
|
|
9096
|
+
this.poll();
|
|
9097
|
+
}, this.opts.intervalMs ?? 5e3);
|
|
9098
|
+
}
|
|
9099
|
+
stopPolling() {
|
|
9100
|
+
this.timer !== null && ((this.opts.clearInterval ?? ((e) => clearInterval(e)))(this.timer), this.timer = null);
|
|
9101
|
+
}
|
|
9102
|
+
emitEvent(e, t) {
|
|
9103
|
+
let n = this.listeners.get(e);
|
|
9104
|
+
if (n) {
|
|
9105
|
+
let r = {
|
|
9106
|
+
type: e,
|
|
9107
|
+
data: t,
|
|
9108
|
+
timestamp: Date.now()
|
|
9109
|
+
};
|
|
9110
|
+
for (let e of n) e(r);
|
|
9111
|
+
}
|
|
9112
|
+
}
|
|
9113
|
+
};
|
|
9114
|
+
//#endregion
|
|
9115
|
+
//#region src/realtime/adapters/parseUtils.ts
|
|
9116
|
+
function q(e) {
|
|
9117
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
9118
|
+
if (typeof e == "string") {
|
|
9119
|
+
let t = parseFloat(e);
|
|
9120
|
+
return Number.isFinite(t) ? t : null;
|
|
9121
|
+
}
|
|
9122
|
+
return null;
|
|
9123
|
+
}
|
|
9124
|
+
function J(e) {
|
|
9125
|
+
return typeof e == "object" && !!e;
|
|
9126
|
+
}
|
|
9127
|
+
//#endregion
|
|
9128
|
+
//#region src/realtime/adapters/CoinbaseAdapter.ts
|
|
9129
|
+
var _i = {
|
|
9130
|
+
"1m": 60,
|
|
9131
|
+
"5m": 300,
|
|
9132
|
+
"15m": 900,
|
|
9133
|
+
"1h": 3600,
|
|
9134
|
+
"6h": 21600,
|
|
9135
|
+
"1d": 86400
|
|
9136
|
+
};
|
|
9137
|
+
function vi(e) {
|
|
9138
|
+
return _i[e] ?? 3600;
|
|
9139
|
+
}
|
|
9140
|
+
var yi = class extends gi {
|
|
9141
|
+
constructor(e = {}) {
|
|
9142
|
+
let t = e.restBase ?? "https://api.exchange.coinbase.com";
|
|
9143
|
+
super({
|
|
9144
|
+
name: "coinbase",
|
|
9145
|
+
intervalMs: e.intervalMs ?? 5e3,
|
|
9146
|
+
pollLimit: 2,
|
|
9147
|
+
fetchBars: (e, n) => bi(t, e, n)
|
|
9148
|
+
});
|
|
9149
|
+
}
|
|
9150
|
+
};
|
|
9151
|
+
async function bi(e, t, n) {
|
|
9152
|
+
let r = `${e}/products/${t}/candles?granularity=${vi(n)}`, i = await fetch(r);
|
|
9153
|
+
if (!i.ok) throw Error(`Coinbase REST error: ${i.status}`);
|
|
9154
|
+
return xi(await i.json());
|
|
9155
|
+
}
|
|
9156
|
+
function xi(e) {
|
|
9157
|
+
if (!Array.isArray(e)) return [];
|
|
9158
|
+
let t = [];
|
|
9159
|
+
for (let n of e) {
|
|
9160
|
+
let e = Si(n);
|
|
9161
|
+
e && t.push(e);
|
|
9162
|
+
}
|
|
9163
|
+
return t.sort((e, t) => e.time - t.time), t;
|
|
9164
|
+
}
|
|
9165
|
+
function Si(e) {
|
|
9166
|
+
if (!Array.isArray(e) || e.length < 6) return null;
|
|
9167
|
+
let t = q(e[0]), n = q(e[1]), r = q(e[2]), i = q(e[3]), a = q(e[4]), o = q(e[5]);
|
|
9168
|
+
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
9169
|
+
time: t * 1e3,
|
|
9170
|
+
open: i,
|
|
9171
|
+
high: r,
|
|
9172
|
+
low: n,
|
|
9173
|
+
close: a,
|
|
9174
|
+
volume: o
|
|
9175
|
+
};
|
|
9176
|
+
}
|
|
9177
|
+
//#endregion
|
|
9178
|
+
//#region src/realtime/adapters/BybitAdapter.ts
|
|
9179
|
+
var Ci = {
|
|
9180
|
+
"1m": "1",
|
|
9181
|
+
"3m": "3",
|
|
9182
|
+
"5m": "5",
|
|
9183
|
+
"15m": "15",
|
|
9184
|
+
"30m": "30",
|
|
9185
|
+
"1h": "60",
|
|
9186
|
+
"2h": "120",
|
|
9187
|
+
"4h": "240",
|
|
9188
|
+
"6h": "360",
|
|
9189
|
+
"12h": "720",
|
|
9190
|
+
"1d": "D",
|
|
9191
|
+
"1w": "W",
|
|
9192
|
+
"1M": "M"
|
|
9193
|
+
};
|
|
9194
|
+
function wi(e) {
|
|
9195
|
+
return Ci[e] ?? "1";
|
|
9196
|
+
}
|
|
9197
|
+
var Ti = class extends hi {
|
|
9198
|
+
constructor(e = {}) {
|
|
9199
|
+
let t = e.restBase ?? "https://api.bybit.com", n = e.wsBase ?? "wss://stream.bybit.com/v5/public/spot", r = e.category ?? "spot";
|
|
9200
|
+
super({
|
|
9201
|
+
name: "bybit",
|
|
9202
|
+
wsUrl: () => n,
|
|
9203
|
+
subscribeMessage: (e) => ({
|
|
9204
|
+
op: "subscribe",
|
|
9205
|
+
args: [`kline.${wi(e.timeframe)}.${e.symbol}`]
|
|
9206
|
+
}),
|
|
9207
|
+
unsubscribeMessage: (e) => ({
|
|
9208
|
+
op: "unsubscribe",
|
|
9209
|
+
args: [`kline.${wi(e.timeframe)}.${e.symbol}`]
|
|
9210
|
+
}),
|
|
9211
|
+
parseMessage: Ei,
|
|
9212
|
+
fetchHistory: (e, n, i) => Di(t, r, e, n, i)
|
|
9213
|
+
});
|
|
9214
|
+
}
|
|
9215
|
+
};
|
|
9216
|
+
function Ei(e) {
|
|
9217
|
+
if (!J(e) || typeof e.topic != "string" || !e.topic.startsWith("kline.")) return null;
|
|
9218
|
+
let t = e.data;
|
|
9219
|
+
if (!Array.isArray(t) || t.length === 0) return null;
|
|
9220
|
+
let n = t[t.length - 1];
|
|
9221
|
+
if (!J(n)) return null;
|
|
9222
|
+
let r = q(n.start), i = q(n.open), a = q(n.high), o = q(n.low), s = q(n.close), c = q(n.volume);
|
|
9223
|
+
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
9224
|
+
let l = typeof n.confirm == "boolean" ? n.confirm : !1;
|
|
9225
|
+
return {
|
|
9226
|
+
bar: {
|
|
9227
|
+
time: r,
|
|
9228
|
+
open: i,
|
|
9229
|
+
high: a,
|
|
9230
|
+
low: o,
|
|
9231
|
+
close: s,
|
|
9232
|
+
volume: c
|
|
9233
|
+
},
|
|
9234
|
+
closed: l
|
|
9235
|
+
};
|
|
9236
|
+
}
|
|
9237
|
+
async function Di(e, t, n, r, i) {
|
|
9238
|
+
let a = `${e}/v5/market/kline?category=${t}&symbol=${n}&interval=${wi(r)}&limit=${Math.min(Math.max(i, 1), 1e3)}`, o = await fetch(a);
|
|
9239
|
+
if (!o.ok) throw Error(`Bybit REST error: ${o.status}`);
|
|
9240
|
+
return Oi(await o.json());
|
|
9241
|
+
}
|
|
9242
|
+
function Oi(e) {
|
|
9243
|
+
if (!J(e) || !J(e.result)) return [];
|
|
9244
|
+
let t = e.result.list;
|
|
9245
|
+
if (!Array.isArray(t)) return [];
|
|
9246
|
+
let n = [];
|
|
9247
|
+
for (let e of t) {
|
|
9248
|
+
let t = ki(e);
|
|
9249
|
+
t && n.push(t);
|
|
9250
|
+
}
|
|
9251
|
+
return n.sort((e, t) => e.time - t.time), n;
|
|
9252
|
+
}
|
|
9253
|
+
function ki(e) {
|
|
9254
|
+
if (!Array.isArray(e) || e.length < 6) return null;
|
|
9255
|
+
let t = q(e[0]), n = q(e[1]), r = q(e[2]), i = q(e[3]), a = q(e[4]), o = q(e[5]);
|
|
9256
|
+
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
9257
|
+
time: t,
|
|
9258
|
+
open: n,
|
|
9259
|
+
high: r,
|
|
9260
|
+
low: i,
|
|
9261
|
+
close: a,
|
|
9262
|
+
volume: o
|
|
9263
|
+
};
|
|
9264
|
+
}
|
|
9265
|
+
//#endregion
|
|
9266
|
+
//#region src/realtime/adapters/KrakenAdapter.ts
|
|
9267
|
+
var Ai = {
|
|
9268
|
+
"1m": 1,
|
|
9269
|
+
"5m": 5,
|
|
9270
|
+
"15m": 15,
|
|
9271
|
+
"30m": 30,
|
|
9272
|
+
"1h": 60,
|
|
9273
|
+
"4h": 240,
|
|
9274
|
+
"1d": 1440,
|
|
9275
|
+
"1w": 10080
|
|
9276
|
+
};
|
|
9277
|
+
function ji(e) {
|
|
9278
|
+
return Ai[e] ?? 1;
|
|
9279
|
+
}
|
|
9280
|
+
var Mi = class extends hi {
|
|
9281
|
+
constructor(e = {}) {
|
|
9282
|
+
let t = e.restBase ?? "https://api.kraken.com", n = e.wsBase ?? "wss://ws.kraken.com/v2";
|
|
9283
|
+
super({
|
|
9284
|
+
name: "kraken",
|
|
9285
|
+
wsUrl: () => n,
|
|
9286
|
+
subscribeMessage: (e) => ({
|
|
9287
|
+
method: "subscribe",
|
|
9288
|
+
params: {
|
|
9289
|
+
channel: "ohlc",
|
|
9290
|
+
symbol: [e.symbol],
|
|
9291
|
+
interval: ji(e.timeframe)
|
|
9292
|
+
}
|
|
9293
|
+
}),
|
|
9294
|
+
unsubscribeMessage: (e) => ({
|
|
9295
|
+
method: "unsubscribe",
|
|
9296
|
+
params: {
|
|
9297
|
+
channel: "ohlc",
|
|
9298
|
+
symbol: [e.symbol],
|
|
9299
|
+
interval: ji(e.timeframe)
|
|
9300
|
+
}
|
|
9301
|
+
}),
|
|
9302
|
+
parseMessage: Ni,
|
|
9303
|
+
fetchHistory: (e, n) => Pi(t, e, n)
|
|
9304
|
+
});
|
|
9305
|
+
}
|
|
9306
|
+
};
|
|
9307
|
+
function Ni(e) {
|
|
9308
|
+
if (!J(e) || e.channel !== "ohlc") return null;
|
|
9309
|
+
let t = e.data;
|
|
9310
|
+
if (!Array.isArray(t) || t.length === 0) return null;
|
|
9311
|
+
let n = t[t.length - 1];
|
|
9312
|
+
if (!J(n)) return null;
|
|
9313
|
+
let r = q(n.open), i = q(n.high), a = q(n.low), o = q(n.close), s = q(n.volume), c = typeof n.interval_begin == "string" ? Date.parse(n.interval_begin) : NaN;
|
|
9314
|
+
return r === null || i === null || a === null || o === null || s === null || !Number.isFinite(c) ? null : {
|
|
9315
|
+
bar: {
|
|
9316
|
+
time: c,
|
|
9317
|
+
open: r,
|
|
9318
|
+
high: i,
|
|
9319
|
+
low: a,
|
|
9320
|
+
close: o,
|
|
9321
|
+
volume: s
|
|
9322
|
+
},
|
|
9323
|
+
closed: !1
|
|
9324
|
+
};
|
|
9325
|
+
}
|
|
9326
|
+
async function Pi(e, t, n) {
|
|
9327
|
+
let r = ji(n), i = t.replace("/", ""), a = `${e}/0/public/OHLC?pair=${encodeURIComponent(i)}&interval=${r}`, o = await fetch(a);
|
|
9328
|
+
if (!o.ok) throw Error(`Kraken REST error: ${o.status}`);
|
|
9329
|
+
return Fi(await o.json());
|
|
9330
|
+
}
|
|
9331
|
+
function Fi(e) {
|
|
9332
|
+
if (!J(e) || !J(e.result)) return [];
|
|
9333
|
+
let t = null;
|
|
9334
|
+
for (let [n, r] of Object.entries(e.result)) if (n !== "last" && Array.isArray(r)) {
|
|
9335
|
+
t = r;
|
|
9336
|
+
break;
|
|
9337
|
+
}
|
|
9338
|
+
if (!Array.isArray(t)) return [];
|
|
9339
|
+
let n = [];
|
|
9340
|
+
for (let e of t) {
|
|
9341
|
+
let t = Ii(e);
|
|
9342
|
+
t && n.push(t);
|
|
9343
|
+
}
|
|
9344
|
+
return n.sort((e, t) => e.time - t.time), n;
|
|
9345
|
+
}
|
|
9346
|
+
function Ii(e) {
|
|
9347
|
+
if (!Array.isArray(e) || e.length < 7) return null;
|
|
9348
|
+
let t = q(e[0]), n = q(e[1]), r = q(e[2]), i = q(e[3]), a = q(e[4]), o = q(e[6]);
|
|
9349
|
+
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
9350
|
+
time: t * 1e3,
|
|
9351
|
+
open: n,
|
|
9352
|
+
high: r,
|
|
9353
|
+
low: i,
|
|
9354
|
+
close: a,
|
|
9355
|
+
volume: o
|
|
9356
|
+
};
|
|
9357
|
+
}
|
|
9358
|
+
//#endregion
|
|
9359
|
+
//#region src/ui/ChartLegend.ts
|
|
9360
|
+
var Li = {
|
|
8535
9361
|
visible: !0,
|
|
8536
9362
|
showSymbol: !0,
|
|
8537
9363
|
showOHLC: !0,
|
|
@@ -8539,8 +9365,8 @@ var Qr = {
|
|
|
8539
9365
|
showVolume: !0,
|
|
8540
9366
|
position: "top-left",
|
|
8541
9367
|
fontSize: 12
|
|
8542
|
-
},
|
|
8543
|
-
config = { ...
|
|
9368
|
+
}, Ri = class {
|
|
9369
|
+
config = { ...Li };
|
|
8544
9370
|
symbol = "";
|
|
8545
9371
|
timeframe = "";
|
|
8546
9372
|
hoverBar = null;
|
|
@@ -8631,7 +9457,7 @@ var Qr = {
|
|
|
8631
9457
|
}
|
|
8632
9458
|
}
|
|
8633
9459
|
}
|
|
8634
|
-
},
|
|
9460
|
+
}, zi = class {
|
|
8635
9461
|
static toDataURL(e, t) {
|
|
8636
9462
|
let n = e.querySelectorAll("canvas");
|
|
8637
9463
|
if (n.length === 0) return "";
|
|
@@ -8653,7 +9479,7 @@ var Qr = {
|
|
|
8653
9479
|
let i = document.createElement("a");
|
|
8654
9480
|
i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
8655
9481
|
}
|
|
8656
|
-
},
|
|
9482
|
+
}, Bi = class {
|
|
8657
9483
|
config = null;
|
|
8658
9484
|
setConfig(e) {
|
|
8659
9485
|
this.config = e;
|
|
@@ -8663,7 +9489,7 @@ var Qr = {
|
|
|
8663
9489
|
let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = this.config.color ?? n.textSecondary;
|
|
8664
9490
|
e.save(), e.globalAlpha = .07, e.font = `bold ${i}px ${n.font.family}`, e.fillStyle = a, e.textAlign = "center", e.textBaseline = "middle", e.fillText(this.config.text, r.x + r.width / 2, r.y + r.height / 2), e.restore();
|
|
8665
9491
|
}
|
|
8666
|
-
},
|
|
9492
|
+
}, Vi = class {
|
|
8667
9493
|
visible = !0;
|
|
8668
9494
|
timeframeMs = 0;
|
|
8669
9495
|
setVisible(e) {
|
|
@@ -8686,7 +9512,7 @@ var Qr = {
|
|
|
8686
9512
|
let t = Math.ceil(e / 1e3), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
|
|
8687
9513
|
return n > 0 ? `${n}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}` : `${r}:${String(i).padStart(2, "0")}`;
|
|
8688
9514
|
}
|
|
8689
|
-
},
|
|
9515
|
+
}, Hi = class {
|
|
8690
9516
|
config = { visible: !1 };
|
|
8691
9517
|
cachedBreaksTyped = [];
|
|
8692
9518
|
lastDataLength = 0;
|
|
@@ -8733,21 +9559,21 @@ var Qr = {
|
|
|
8733
9559
|
render(e, t, n, r) {
|
|
8734
9560
|
if (!this.config.visible || r.length < 2) return;
|
|
8735
9561
|
let i = this.computeBreaksTyped(r);
|
|
8736
|
-
if (i.length === 0 ||
|
|
9562
|
+
if (i.length === 0 || Ki(r) >= 1380 * 60 * 1e3) return;
|
|
8737
9563
|
let { chartRect: a } = t, o = this.config.color ?? n.axisLine, s = this.config.lineWidth ?? 1, c = this.config.lineStyle ?? "dashed";
|
|
8738
9564
|
e.save(), c === "dashed" ? e.setLineDash([6, 4]) : c === "dotted" && e.setLineDash([2, 3]), e.font = `600 11px ${n.font.family}`, e.textBaseline = "top", e.textAlign = "left";
|
|
8739
9565
|
for (let r of i) {
|
|
8740
9566
|
let i = O(r.idx, t) - (t.barWidth + t.barSpacing) / 2;
|
|
8741
9567
|
if (i < a.x - 1 || i > a.x + a.width + 1) continue;
|
|
8742
9568
|
let c = Math.round(i) + .5, l = .25, u = s, d = null;
|
|
8743
|
-
r.kind === "day" ? l = .22 : r.kind === "week" ? (l = .34, d =
|
|
9569
|
+
r.kind === "day" ? l = .22 : r.kind === "week" ? (l = .34, d = Wi(r.date)) : r.kind === "month" ? (l = .5, u = s + .5, d = Gi(r.date)) : (l = .7, u = s + 1, d = String(r.date.getFullYear())), e.globalAlpha = l, e.strokeStyle = o, e.lineWidth = u, e.beginPath(), e.moveTo(c, a.y), e.lineTo(c, a.y + a.height), e.stroke(), d && (e.globalAlpha = Math.min(1, l + .35), e.fillStyle = n.textSecondary, e.fillText(d, c + 4, a.y + 4));
|
|
8744
9570
|
}
|
|
8745
9571
|
e.restore();
|
|
8746
9572
|
}
|
|
8747
9573
|
invalidateCache() {
|
|
8748
9574
|
this.lastDataLength = 0, this.cachedBreaksTyped = [];
|
|
8749
9575
|
}
|
|
8750
|
-
},
|
|
9576
|
+
}, Ui = [
|
|
8751
9577
|
"Jan",
|
|
8752
9578
|
"Feb",
|
|
8753
9579
|
"Mar",
|
|
@@ -8761,13 +9587,13 @@ var Qr = {
|
|
|
8761
9587
|
"Nov",
|
|
8762
9588
|
"Dec"
|
|
8763
9589
|
];
|
|
8764
|
-
function
|
|
8765
|
-
return `${
|
|
9590
|
+
function Wi(e) {
|
|
9591
|
+
return `${Ui[e.getMonth()]} ${e.getDate()}`;
|
|
8766
9592
|
}
|
|
8767
|
-
function
|
|
8768
|
-
return `${
|
|
9593
|
+
function Gi(e) {
|
|
9594
|
+
return `${Ui[e.getMonth()]} ${String(e.getFullYear()).slice(-2)}`;
|
|
8769
9595
|
}
|
|
8770
|
-
function
|
|
9596
|
+
function Ki(e) {
|
|
8771
9597
|
if (e.length < 2) return 0;
|
|
8772
9598
|
let t = Math.min(50, e.length - 1), n = [];
|
|
8773
9599
|
for (let r = 1; r <= t; r++) {
|
|
@@ -8778,24 +9604,24 @@ function ui(e) {
|
|
|
8778
9604
|
}
|
|
8779
9605
|
//#endregion
|
|
8780
9606
|
//#region src/ui/sessionHours.ts
|
|
8781
|
-
var
|
|
8782
|
-
function
|
|
8783
|
-
let n = ((e + t * 6e4) %
|
|
9607
|
+
var qi = 864e5;
|
|
9608
|
+
function Ji(e, t) {
|
|
9609
|
+
let n = ((e + t * 6e4) % qi + qi) % qi;
|
|
8784
9610
|
return Math.floor(n / 6e4);
|
|
8785
9611
|
}
|
|
8786
|
-
function
|
|
8787
|
-
let n =
|
|
9612
|
+
function Yi(e, t) {
|
|
9613
|
+
let n = Ji(e, t.tzOffsetMinutes), { startMinute: r, endMinute: i } = t;
|
|
8788
9614
|
return r === i ? !0 : r < i ? n >= r && n < i : n >= r || n < i;
|
|
8789
9615
|
}
|
|
8790
9616
|
//#endregion
|
|
8791
9617
|
//#region src/ui/SessionShading.ts
|
|
8792
|
-
var
|
|
9618
|
+
var Xi = {
|
|
8793
9619
|
startMinute: 570,
|
|
8794
9620
|
endMinute: 960,
|
|
8795
9621
|
tzOffsetMinutes: -300
|
|
8796
|
-
},
|
|
9622
|
+
}, Zi = class {
|
|
8797
9623
|
visible = !1;
|
|
8798
|
-
config = { ...
|
|
9624
|
+
config = { ...Xi };
|
|
8799
9625
|
setVisible(e) {
|
|
8800
9626
|
this.visible = e;
|
|
8801
9627
|
}
|
|
@@ -8822,12 +9648,12 @@ var mi = {
|
|
|
8822
9648
|
e.fillRect(a, i.y, o - a, i.height);
|
|
8823
9649
|
};
|
|
8824
9650
|
for (let e = s; e <= c; e++) {
|
|
8825
|
-
let n = !
|
|
9651
|
+
let n = !Yi(t[e].time, this.config);
|
|
8826
9652
|
n && d === -1 ? d = e : !n && d !== -1 && (f(d, e - 1), d = -1);
|
|
8827
9653
|
}
|
|
8828
9654
|
d !== -1 && f(d, c), e.restore();
|
|
8829
9655
|
}
|
|
8830
|
-
},
|
|
9656
|
+
}, Qi = 1, $i = class extends G {
|
|
8831
9657
|
alerts = [];
|
|
8832
9658
|
lastValues = /* @__PURE__ */ new Map();
|
|
8833
9659
|
requestRender = null;
|
|
@@ -8839,7 +9665,7 @@ var mi = {
|
|
|
8839
9665
|
this.pricePrecision = e;
|
|
8840
9666
|
}
|
|
8841
9667
|
addAlert(e, t = "crossing", n, r = !1, i = "price", a) {
|
|
8842
|
-
let o = `tc_alert_${
|
|
9668
|
+
let o = `tc_alert_${Qi++}`, s = {
|
|
8843
9669
|
id: o,
|
|
8844
9670
|
price: e,
|
|
8845
9671
|
condition: t,
|
|
@@ -8948,7 +9774,7 @@ var mi = {
|
|
|
8948
9774
|
e.fillText(s, r.x + r.width - 4, a - 2);
|
|
8949
9775
|
}
|
|
8950
9776
|
}
|
|
8951
|
-
},
|
|
9777
|
+
}, ea = class extends G {
|
|
8952
9778
|
data = [];
|
|
8953
9779
|
currentIndex = 0;
|
|
8954
9780
|
timer = null;
|
|
@@ -9017,13 +9843,13 @@ function X(e) {
|
|
|
9017
9843
|
function Z(e) {
|
|
9018
9844
|
return Array.isArray(e) ? e : [];
|
|
9019
9845
|
}
|
|
9020
|
-
function
|
|
9846
|
+
function ta(e, t) {
|
|
9021
9847
|
return typeof e == "string" ? e : t;
|
|
9022
9848
|
}
|
|
9023
|
-
function
|
|
9849
|
+
function na(e, t) {
|
|
9024
9850
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
9025
9851
|
}
|
|
9026
|
-
function
|
|
9852
|
+
function ra(e) {
|
|
9027
9853
|
if (!X(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || !X(e.style)) return null;
|
|
9028
9854
|
let t = [];
|
|
9029
9855
|
for (let n of e.anchors) {
|
|
@@ -9044,14 +9870,14 @@ function xi(e) {
|
|
|
9044
9870
|
meta: X(e.meta) ? e.meta : void 0
|
|
9045
9871
|
};
|
|
9046
9872
|
}
|
|
9047
|
-
function
|
|
9873
|
+
function ia(e) {
|
|
9048
9874
|
return !X(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
|
|
9049
9875
|
}
|
|
9050
|
-
function
|
|
9876
|
+
function aa(e) {
|
|
9051
9877
|
return !X(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
|
|
9052
9878
|
}
|
|
9053
|
-
function
|
|
9054
|
-
if (!X(e)) return
|
|
9879
|
+
function oa(e) {
|
|
9880
|
+
if (!X(e)) return sa();
|
|
9055
9881
|
typeof e.version == "number" && e.version !== Y && console.warn(`Chart state version mismatch: ${e.version} vs ${Y}`);
|
|
9056
9882
|
let t = X(e.viewport) ? e.viewport : {}, n = [];
|
|
9057
9883
|
for (let t of Z(e.indicators)) X(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || X(t.params) && n.push({
|
|
@@ -9062,31 +9888,31 @@ function wi(e) {
|
|
|
9062
9888
|
}));
|
|
9063
9889
|
let r = [];
|
|
9064
9890
|
for (let t of Z(e.drawings)) {
|
|
9065
|
-
let e =
|
|
9891
|
+
let e = ra(t);
|
|
9066
9892
|
e && r.push(e);
|
|
9067
9893
|
}
|
|
9068
9894
|
let i = [];
|
|
9069
9895
|
for (let t of Z(e.orders)) {
|
|
9070
|
-
let e =
|
|
9896
|
+
let e = ia(t);
|
|
9071
9897
|
e && i.push(e);
|
|
9072
9898
|
}
|
|
9073
9899
|
let a = [];
|
|
9074
9900
|
for (let t of Z(e.positions)) {
|
|
9075
|
-
let e =
|
|
9901
|
+
let e = aa(t);
|
|
9076
9902
|
e && a.push(e);
|
|
9077
9903
|
}
|
|
9078
9904
|
let o = [];
|
|
9079
9905
|
for (let t of Z(e.alerts)) X(t) && typeof t.id == "string" && o.push(t);
|
|
9080
9906
|
return {
|
|
9081
9907
|
version: typeof e.version == "number" ? e.version : Y,
|
|
9082
|
-
timestamp:
|
|
9908
|
+
timestamp: na(e.timestamp, Date.now()),
|
|
9083
9909
|
symbol: typeof e.symbol == "string" ? e.symbol : void 0,
|
|
9084
9910
|
timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
|
|
9085
|
-
chartType:
|
|
9911
|
+
chartType: ta(e.chartType, "candlestick"),
|
|
9086
9912
|
viewport: {
|
|
9087
|
-
barWidth:
|
|
9088
|
-
barSpacing:
|
|
9089
|
-
offset:
|
|
9913
|
+
barWidth: na(t.barWidth, 8),
|
|
9914
|
+
barSpacing: na(t.barSpacing, 2),
|
|
9915
|
+
offset: na(t.offset, 0)
|
|
9090
9916
|
},
|
|
9091
9917
|
theme: typeof e.theme == "string" ? e.theme : void 0,
|
|
9092
9918
|
locale: typeof e.locale == "string" ? e.locale : void 0,
|
|
@@ -9097,7 +9923,7 @@ function wi(e) {
|
|
|
9097
9923
|
alerts: o
|
|
9098
9924
|
};
|
|
9099
9925
|
}
|
|
9100
|
-
function
|
|
9926
|
+
function sa() {
|
|
9101
9927
|
return {
|
|
9102
9928
|
version: Y,
|
|
9103
9929
|
timestamp: Date.now(),
|
|
@@ -9114,7 +9940,7 @@ function Ti() {
|
|
|
9114
9940
|
alerts: []
|
|
9115
9941
|
};
|
|
9116
9942
|
}
|
|
9117
|
-
var
|
|
9943
|
+
var ca = class {
|
|
9118
9944
|
static capture(e, t) {
|
|
9119
9945
|
return {
|
|
9120
9946
|
version: Y,
|
|
@@ -9139,7 +9965,7 @@ var Ei = class {
|
|
|
9139
9965
|
return JSON.stringify(e);
|
|
9140
9966
|
}
|
|
9141
9967
|
static deserialize(e) {
|
|
9142
|
-
return
|
|
9968
|
+
return oa(JSON.parse(e));
|
|
9143
9969
|
}
|
|
9144
9970
|
static saveToStorage(e, t) {
|
|
9145
9971
|
localStorage.setItem(e, this.serialize(t));
|
|
@@ -9166,7 +9992,7 @@ var Ei = class {
|
|
|
9166
9992
|
}, n.click();
|
|
9167
9993
|
});
|
|
9168
9994
|
}
|
|
9169
|
-
},
|
|
9995
|
+
}, la = class {
|
|
9170
9996
|
undoStack = [];
|
|
9171
9997
|
redoStack = [];
|
|
9172
9998
|
maxHistory = 50;
|
|
@@ -9202,7 +10028,7 @@ var Ei = class {
|
|
|
9202
10028
|
redoCount: this.redoStack.length
|
|
9203
10029
|
};
|
|
9204
10030
|
}
|
|
9205
|
-
},
|
|
10031
|
+
}, ua = class {
|
|
9206
10032
|
static toCSV(e) {
|
|
9207
10033
|
return ["Time,Open,High,Low,Close,Volume", ...e.map((e) => `${new Date(e.time).toISOString()},${e.open},${e.high},${e.low},${e.close},${e.volume}`)].join("\n");
|
|
9208
10034
|
}
|
|
@@ -9220,7 +10046,7 @@ var Ei = class {
|
|
|
9220
10046
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
9221
10047
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
9222
10048
|
}
|
|
9223
|
-
},
|
|
10049
|
+
}, da = 1, fa = class extends G {
|
|
9224
10050
|
markers = [];
|
|
9225
10051
|
style = { ...i };
|
|
9226
10052
|
requestRender = null;
|
|
@@ -9241,7 +10067,7 @@ var Ei = class {
|
|
|
9241
10067
|
return { ...this.style };
|
|
9242
10068
|
}
|
|
9243
10069
|
addMarker(e) {
|
|
9244
|
-
let t = e.id ?? `tc_signal_${
|
|
10070
|
+
let t = e.id ?? `tc_signal_${da++}`, n = {
|
|
9245
10071
|
...e,
|
|
9246
10072
|
id: t
|
|
9247
10073
|
};
|
|
@@ -9295,7 +10121,7 @@ var Ei = class {
|
|
|
9295
10121
|
renderArrow(e, t, n, r, i, a) {
|
|
9296
10122
|
e.fillStyle = a, e.beginPath(), r === "long" ? (e.moveTo(t, n - i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n + i * .4), e.lineTo(t + i * .2, n + i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : r === "short" ? (e.moveTo(t, n + i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n - i * .4), e.lineTo(t + i * .2, n - i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : e.arc(t, n, i * .4, 0, Math.PI * 2), e.closePath(), e.fill();
|
|
9297
10123
|
}
|
|
9298
|
-
},
|
|
10124
|
+
}, pa = 1, ma = class extends G {
|
|
9299
10125
|
zones = [];
|
|
9300
10126
|
style = { ...o };
|
|
9301
10127
|
requestRender = null;
|
|
@@ -9320,7 +10146,7 @@ var Ei = class {
|
|
|
9320
10146
|
return { ...this.style };
|
|
9321
10147
|
}
|
|
9322
10148
|
addZone(e) {
|
|
9323
|
-
let t = e.id ?? `tc_zone_${
|
|
10149
|
+
let t = e.id ?? `tc_zone_${pa++}`, n = {
|
|
9324
10150
|
...e,
|
|
9325
10151
|
id: t
|
|
9326
10152
|
};
|
|
@@ -9371,7 +10197,7 @@ var Ei = class {
|
|
|
9371
10197
|
}
|
|
9372
10198
|
a.showLabel && t.label && (e.font = `9px ${i.font.family}`, e.fillStyle = b, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, f + 4, m + 3), e.globalAlpha = 1);
|
|
9373
10199
|
}
|
|
9374
|
-
},
|
|
10200
|
+
}, ha = class {
|
|
9375
10201
|
active = !1;
|
|
9376
10202
|
startBar = 0;
|
|
9377
10203
|
startPrice = 0;
|
|
@@ -9384,33 +10210,33 @@ var Ei = class {
|
|
|
9384
10210
|
}
|
|
9385
10211
|
begin(e, t, n) {
|
|
9386
10212
|
let r = Math.round(A(e.x, t)), i = j(e.y, t);
|
|
9387
|
-
this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime =
|
|
10213
|
+
this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = ga(r, n), this.endTime = this.startTime, this.active = !0;
|
|
9388
10214
|
}
|
|
9389
10215
|
update(e, t, n) {
|
|
9390
10216
|
if (!this.active) return;
|
|
9391
10217
|
let r = Math.round(A(e.x, t));
|
|
9392
|
-
this.endBar = r, this.endPrice = j(e.y, t), this.endTime =
|
|
10218
|
+
this.endBar = r, this.endPrice = j(e.y, t), this.endTime = ga(r, n);
|
|
9393
10219
|
}
|
|
9394
10220
|
end() {
|
|
9395
10221
|
this.active = !1;
|
|
9396
10222
|
}
|
|
9397
10223
|
render(e, t, n) {
|
|
9398
10224
|
if (!this.active) return;
|
|
9399
|
-
let r = O(this.startBar, t), i = O(this.endBar, t), a = k(this.startPrice, t), o = k(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m =
|
|
9400
|
-
e.save(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(),
|
|
9401
|
-
let h = Math.abs(this.endBar - this.startBar), g = this.endPrice - this.startPrice, _ = this.startPrice === 0 ? 0 : g / this.startPrice * 100, v = this.startTime !== null && this.endTime !== null ?
|
|
9402
|
-
y.push(`${b}${
|
|
10225
|
+
let r = O(this.startBar, t), i = O(this.endBar, t), a = k(this.startPrice, t), o = k(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m = Sa(p, .14);
|
|
10226
|
+
e.save(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), ya(e, r, a, p), ya(e, i, o, p);
|
|
10227
|
+
let h = Math.abs(this.endBar - this.startBar), g = this.endPrice - this.startPrice, _ = this.startPrice === 0 ? 0 : g / this.startPrice * 100, v = this.startTime !== null && this.endTime !== null ? va(Math.abs(this.endTime - this.startTime)) : null, y = [], b = g > 0 ? "+" : g < 0 ? "−" : "", x = Math.abs(g);
|
|
10228
|
+
y.push(`${b}${_a(x)} (${b}${Math.abs(_).toFixed(2)}%)`), y.push(`${h} bars${v ? " · " + v : ""}`), ba(e, i, o, y, p, n), e.restore();
|
|
9403
10229
|
}
|
|
9404
10230
|
};
|
|
9405
|
-
function
|
|
10231
|
+
function ga(e, t) {
|
|
9406
10232
|
if (e < 0 || e >= t.length) return null;
|
|
9407
10233
|
let n = t[e].time;
|
|
9408
10234
|
return n > 0xe8d4a51000 ? n : n * 1e3;
|
|
9409
10235
|
}
|
|
9410
|
-
function
|
|
10236
|
+
function _a(e) {
|
|
9411
10237
|
return e >= 1e3 ? e.toFixed(2) : e >= 1 ? e.toFixed(4) : e.toPrecision(4);
|
|
9412
10238
|
}
|
|
9413
|
-
function
|
|
10239
|
+
function va(e) {
|
|
9414
10240
|
let t = e / 1e3;
|
|
9415
10241
|
if (t < 60) return `${t.toFixed(0)}s`;
|
|
9416
10242
|
let n = t / 60;
|
|
@@ -9422,10 +10248,10 @@ function Ii(e) {
|
|
|
9422
10248
|
let a = i / 30;
|
|
9423
10249
|
return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
|
|
9424
10250
|
}
|
|
9425
|
-
function
|
|
10251
|
+
function ya(e, t, n, r) {
|
|
9426
10252
|
e.fillStyle = r, e.beginPath(), e.arc(t, n, 3.5, 0, Math.PI * 2), e.fill(), e.fillStyle = "#fff", e.beginPath(), e.arc(t, n, 1.5, 0, Math.PI * 2), e.fill();
|
|
9427
10253
|
}
|
|
9428
|
-
function
|
|
10254
|
+
function ba(e, t, n, r, i, a) {
|
|
9429
10255
|
e.font = `600 11px ${a.font.family}`;
|
|
9430
10256
|
let o = 0;
|
|
9431
10257
|
for (let t of r) {
|
|
@@ -9433,13 +10259,13 @@ function Ri(e, t, n, r, i, a) {
|
|
|
9433
10259
|
n > o && (o = n);
|
|
9434
10260
|
}
|
|
9435
10261
|
let s = Math.ceil(o) + 16, c = r.length * 14 + 12, l = t + 8, u = n + 8, d = e.canvas.clientWidth || e.canvas.width;
|
|
9436
|
-
l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96,
|
|
10262
|
+
l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, xa(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, xa(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
|
|
9437
10263
|
for (let t = 0; t < r.length; t++) e.fillStyle = t === 0 ? i : a.textSecondary, e.fillText(r[t], l + 8, u + 6 + t * 14);
|
|
9438
10264
|
}
|
|
9439
|
-
function
|
|
10265
|
+
function xa(e, t, n, r, i, a) {
|
|
9440
10266
|
e.beginPath(), e.moveTo(t + a, n), e.arcTo(t + r, n, t + r, n + i, a), e.arcTo(t + r, n + i, t, n + i, a), e.arcTo(t, n + i, t, n, a), e.arcTo(t, n, t + r, n, a), e.closePath();
|
|
9441
10267
|
}
|
|
9442
|
-
function
|
|
10268
|
+
function Sa(e, t) {
|
|
9443
10269
|
if (e.startsWith("#")) {
|
|
9444
10270
|
let n = 0, r = 0, i = 0;
|
|
9445
10271
|
return e.length === 4 ? (n = parseInt(e[1] + e[1], 16), r = parseInt(e[2] + e[2], 16), i = parseInt(e[3] + e[3], 16)) : e.length >= 7 && (n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16)), `rgba(${n},${r},${i},${t})`;
|
|
@@ -9452,7 +10278,7 @@ function Bi(e, t) {
|
|
|
9452
10278
|
}
|
|
9453
10279
|
//#endregion
|
|
9454
10280
|
//#region src/animation/Animator.ts
|
|
9455
|
-
var
|
|
10281
|
+
var Ca = {
|
|
9456
10282
|
linear: (e) => e,
|
|
9457
10283
|
easeOutCubic: (e) => 1 - (1 - e) ** 3,
|
|
9458
10284
|
easeOutQuart: (e) => 1 - (1 - e) ** 4,
|
|
@@ -9460,7 +10286,7 @@ var Vi = {
|
|
|
9460
10286
|
easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
|
|
9461
10287
|
easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
|
|
9462
10288
|
spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
|
|
9463
|
-
},
|
|
10289
|
+
}, wa = class {
|
|
9464
10290
|
animations = /* @__PURE__ */ new Map();
|
|
9465
10291
|
frameId = 0;
|
|
9466
10292
|
running = !1;
|
|
@@ -9468,7 +10294,7 @@ var Vi = {
|
|
|
9468
10294
|
this.animations.set(e, {
|
|
9469
10295
|
startTime: -1,
|
|
9470
10296
|
duration: t.duration,
|
|
9471
|
-
easing: t.easing ??
|
|
10297
|
+
easing: t.easing ?? Ca.easeOutCubic,
|
|
9472
10298
|
onUpdate: t.onUpdate,
|
|
9473
10299
|
onComplete: t.onComplete
|
|
9474
10300
|
}), this.running || (this.running = !0, this.tick());
|
|
@@ -9503,10 +10329,10 @@ var Vi = {
|
|
|
9503
10329
|
};
|
|
9504
10330
|
//#endregion
|
|
9505
10331
|
//#region src/finance/BaseFinanceChart.ts
|
|
9506
|
-
function
|
|
10332
|
+
function Ta(t) {
|
|
9507
10333
|
return !t || t === "dark" ? e : t === "light" ? c : t;
|
|
9508
10334
|
}
|
|
9509
|
-
var
|
|
10335
|
+
var Ea = class {
|
|
9510
10336
|
canvas;
|
|
9511
10337
|
ctx;
|
|
9512
10338
|
container;
|
|
@@ -9517,7 +10343,7 @@ var Wi = class {
|
|
|
9517
10343
|
frameId = null;
|
|
9518
10344
|
resizeObserver;
|
|
9519
10345
|
constructor(e, t) {
|
|
9520
|
-
this.container = e, this.theme =
|
|
10346
|
+
this.container = e, this.theme = Ta(t), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.dpr = window.devicePixelRatio || 1, this.updateSize(), this.resizeObserver = new ResizeObserver(() => {
|
|
9521
10347
|
this.updateSize(), this.requestRender();
|
|
9522
10348
|
}), this.resizeObserver.observe(e);
|
|
9523
10349
|
}
|
|
@@ -9532,12 +10358,12 @@ var Wi = class {
|
|
|
9532
10358
|
}));
|
|
9533
10359
|
}
|
|
9534
10360
|
setTheme(e) {
|
|
9535
|
-
this.theme =
|
|
10361
|
+
this.theme = Ta(e), this.requestRender();
|
|
9536
10362
|
}
|
|
9537
10363
|
destroy() {
|
|
9538
10364
|
this.frameId !== null && cancelAnimationFrame(this.frameId), this.resizeObserver.disconnect(), this.canvas.remove();
|
|
9539
10365
|
}
|
|
9540
|
-
},
|
|
10366
|
+
}, Da = class {
|
|
9541
10367
|
pos = null;
|
|
9542
10368
|
canvas;
|
|
9543
10369
|
onUpdate;
|
|
@@ -9569,7 +10395,7 @@ var Wi = class {
|
|
|
9569
10395
|
};
|
|
9570
10396
|
//#endregion
|
|
9571
10397
|
//#region src/finance/SparklineRenderer.ts
|
|
9572
|
-
function
|
|
10398
|
+
function Oa(e, t, n, r, i) {
|
|
9573
10399
|
let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
|
|
9574
10400
|
if (a.length < 2 || t <= 0 || n <= 0) return;
|
|
9575
10401
|
let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
|
|
@@ -9594,8 +10420,8 @@ function Ki(e, t, n, r, i) {
|
|
|
9594
10420
|
}
|
|
9595
10421
|
//#endregion
|
|
9596
10422
|
//#region src/finance/DepthChartRenderer.ts
|
|
9597
|
-
var
|
|
9598
|
-
function
|
|
10423
|
+
var ka = 50, Aa = 60, ja = 20, Ma = .2;
|
|
10424
|
+
function Na(e) {
|
|
9599
10425
|
let t = [...e].sort((e, t) => t.price - e.price), n = [], r = 0;
|
|
9600
10426
|
for (let e of t) r += e.volume, n.push({
|
|
9601
10427
|
price: e.price,
|
|
@@ -9603,7 +10429,7 @@ function Zi(e) {
|
|
|
9603
10429
|
});
|
|
9604
10430
|
return n;
|
|
9605
10431
|
}
|
|
9606
|
-
function
|
|
10432
|
+
function Pa(e) {
|
|
9607
10433
|
let t = [...e].sort((e, t) => e.price - t.price), n = [], r = 0;
|
|
9608
10434
|
for (let e of t) r += e.volume, n.push({
|
|
9609
10435
|
price: e.price,
|
|
@@ -9611,20 +10437,20 @@ function Qi(e) {
|
|
|
9611
10437
|
});
|
|
9612
10438
|
return n;
|
|
9613
10439
|
}
|
|
9614
|
-
function
|
|
10440
|
+
function Fa(e, t) {
|
|
9615
10441
|
return {
|
|
9616
|
-
left:
|
|
9617
|
-
right: e -
|
|
9618
|
-
top:
|
|
9619
|
-
bottom: t -
|
|
9620
|
-
plotWidth: e -
|
|
9621
|
-
plotHeight: t -
|
|
10442
|
+
left: ka,
|
|
10443
|
+
right: e - Aa,
|
|
10444
|
+
top: ja,
|
|
10445
|
+
bottom: t - ja,
|
|
10446
|
+
plotWidth: e - ka - Aa,
|
|
10447
|
+
plotHeight: t - ja * 2
|
|
9622
10448
|
};
|
|
9623
10449
|
}
|
|
9624
|
-
function
|
|
10450
|
+
function Ia(e, t, n, r) {
|
|
9625
10451
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
9626
10452
|
}
|
|
9627
|
-
function
|
|
10453
|
+
function La(e, t, n, r, i, a, o, s) {
|
|
9628
10454
|
let { left: c, right: l, top: u, bottom: d, plotWidth: f, plotHeight: p } = t;
|
|
9629
10455
|
e.save(), e.strokeStyle = a.grid, e.lineWidth = .5, e.fillStyle = a.axisLabel, e.font = `${a.font.sizeSmall}px ${a.font.family}`;
|
|
9630
10456
|
let h = m(0, i, 5);
|
|
@@ -9639,7 +10465,7 @@ function ta(e, t, n, r, i, a, o, s) {
|
|
|
9639
10465
|
}
|
|
9640
10466
|
e.restore();
|
|
9641
10467
|
}
|
|
9642
|
-
function
|
|
10468
|
+
function Ra(e, t, n, r, i, a, o, s, c) {
|
|
9643
10469
|
if (t.length === 0) return;
|
|
9644
10470
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - e / a * f;
|
|
9645
10471
|
if (e.beginPath(), c === "bid") {
|
|
@@ -9672,14 +10498,14 @@ function na(e, t, n, r, i, a, o, s, c) {
|
|
|
9672
10498
|
}
|
|
9673
10499
|
e.strokeStyle = s, e.lineWidth = 1.5, e.stroke();
|
|
9674
10500
|
}
|
|
9675
|
-
function
|
|
10501
|
+
function za(e, t, n, r, i, a, o, s, c) {
|
|
9676
10502
|
let { left: l, top: u, bottom: d, plotWidth: f } = r, p = l + (t - i) / a * f;
|
|
9677
10503
|
if (e.save(), e.strokeStyle = o.textSecondary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(p, u), e.lineTo(p, d), e.stroke(), e.restore(), s) {
|
|
9678
10504
|
let t = `Spread: ${c(n)}`;
|
|
9679
10505
|
e.save(), e.font = `${o.font.sizeSmall}px ${o.font.family}`, e.fillStyle = o.textSecondary, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t, p, u - 2), e.restore();
|
|
9680
10506
|
}
|
|
9681
10507
|
}
|
|
9682
|
-
function
|
|
10508
|
+
function Ba(e, t, n, r, i, a, o, s, c, l, u) {
|
|
9683
10509
|
let { left: d, top: f, bottom: p, plotWidth: m, plotHeight: h } = i, g = t.x;
|
|
9684
10510
|
if (g < d || g > i.right) return;
|
|
9685
10511
|
let _ = a + (g - d) / m * o, v = 0, y = "";
|
|
@@ -9705,47 +10531,47 @@ function ia(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
9705
10531
|
for (let t = 0; t < b.length; t++) e.fillText(b[t], C + 8, w + 6 + t * (c.font.sizeSmall + 4));
|
|
9706
10532
|
e.restore();
|
|
9707
10533
|
}
|
|
9708
|
-
function
|
|
10534
|
+
function Va(e) {
|
|
9709
10535
|
return e.toFixed(2);
|
|
9710
10536
|
}
|
|
9711
|
-
function
|
|
10537
|
+
function Ha(e) {
|
|
9712
10538
|
return e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(0);
|
|
9713
10539
|
}
|
|
9714
|
-
function
|
|
10540
|
+
function Ua(e, t, n, r, i, a) {
|
|
9715
10541
|
let { data: o } = r;
|
|
9716
10542
|
if (o.bids.length === 0 && o.asks.length === 0 || t <= 0 || n <= 0) return;
|
|
9717
|
-
let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ??
|
|
9718
|
-
|
|
10543
|
+
let s = r.bidColor ?? i.candleUp, c = r.askColor ?? i.candleDown, l = r.bidFillColor ?? s + "40", u = r.askFillColor ?? c + "40", d = r.midPriceLine !== !1, f = r.spreadLabel !== !1, p = r.priceFormat ?? Va, m = r.volumeFormat ?? Ha, h = Na(o.bids), g = Pa(o.asks), _ = h.length > 0 ? h[0].price : 0, v = g.length > 0 ? g[0].price : 0, y = h.length > 0 && g.length > 0 ? (_ + v) / 2 : _ || v, b = g.length > 0 && h.length > 0 ? v - _ : 0, x = h.length > 0 ? h[h.length - 1].price : y, S = g.length > 0 ? g[g.length - 1].price : y, C = Math.max(y - x, S - y) * (1 + Ma), w = y - C, T = y + C, E = T - w, D = h.length > 0 ? h[h.length - 1].cumulativeVolume : 0, O = g.length > 0 ? g[g.length - 1].cumulativeVolume : 0, k = Math.max(D, O) || 1, A = Fa(t, n);
|
|
10544
|
+
Ia(e, t, n, i.background), La(e, A, w, T, k, i, p, m), Ra(e, h, A, w, E, k, l, s, "bid"), Ra(e, g, A, w, E, k, u, c, "ask"), d && za(e, y, b, A, w, E, i, f, p), a && Ba(e, a, h, g, A, w, E, k, i, p, m);
|
|
9719
10545
|
}
|
|
9720
10546
|
//#endregion
|
|
9721
10547
|
//#region src/finance/EquityCurveRenderer.ts
|
|
9722
|
-
var
|
|
9723
|
-
function
|
|
10548
|
+
var Wa = 70, Ga = 30, Ka = 20, qa = 20, Ja = .05;
|
|
10549
|
+
function Ya(e, t) {
|
|
9724
10550
|
return {
|
|
9725
|
-
left:
|
|
9726
|
-
right: e -
|
|
9727
|
-
top:
|
|
9728
|
-
bottom: t -
|
|
9729
|
-
plotWidth: e -
|
|
9730
|
-
plotHeight: t -
|
|
10551
|
+
left: Wa,
|
|
10552
|
+
right: e - Ka,
|
|
10553
|
+
top: qa,
|
|
10554
|
+
bottom: t - Ga,
|
|
10555
|
+
plotWidth: e - Wa - Ka,
|
|
10556
|
+
plotHeight: t - qa - Ga
|
|
9731
10557
|
};
|
|
9732
10558
|
}
|
|
9733
|
-
function
|
|
10559
|
+
function Xa(e, t) {
|
|
9734
10560
|
let n = Infinity, r = -Infinity;
|
|
9735
10561
|
for (let t of e) t.value < n && (n = t.value), t.value > r && (r = t.value);
|
|
9736
10562
|
if (t) for (let e of t) e.value < n && (n = e.value), e.value > r && (r = e.value);
|
|
9737
|
-
let i = (r - n) *
|
|
10563
|
+
let i = (r - n) * Ja;
|
|
9738
10564
|
return {
|
|
9739
10565
|
valMin: n - i,
|
|
9740
10566
|
valMax: r + i
|
|
9741
10567
|
};
|
|
9742
10568
|
}
|
|
9743
|
-
function
|
|
10569
|
+
function Za(e) {
|
|
9744
10570
|
let t = [], n = -Infinity;
|
|
9745
10571
|
for (let r of e) r.value > n && (n = r.value), t.push(n);
|
|
9746
10572
|
return t;
|
|
9747
10573
|
}
|
|
9748
|
-
function
|
|
10574
|
+
function Qa(e) {
|
|
9749
10575
|
let t = 864e5;
|
|
9750
10576
|
if (365.25 * t, e < 7 * t) {
|
|
9751
10577
|
let e = new Intl.DateTimeFormat(void 0, {
|
|
@@ -9767,13 +10593,13 @@ function ga(e) {
|
|
|
9767
10593
|
});
|
|
9768
10594
|
return (e) => n.format(new Date(e));
|
|
9769
10595
|
}
|
|
9770
|
-
function
|
|
10596
|
+
function $a(e) {
|
|
9771
10597
|
return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
|
|
9772
10598
|
}
|
|
9773
|
-
function
|
|
10599
|
+
function eo(e, t, n, r) {
|
|
9774
10600
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
9775
10601
|
}
|
|
9776
|
-
function
|
|
10602
|
+
function to(e, t, n, r, i, a, o, s, c) {
|
|
9777
10603
|
let { left: l, right: u, top: d, bottom: f, plotWidth: p, plotHeight: h } = t;
|
|
9778
10604
|
e.save(), e.strokeStyle = o.grid, e.lineWidth = .5, e.fillStyle = o.axisLabel, e.font = `${o.font.sizeSmall}px ${o.font.family}`;
|
|
9779
10605
|
let g = m(n, r, 6), _ = Math.ceil(n / g) * g;
|
|
@@ -9788,21 +10614,21 @@ function ya(e, t, n, r, i, a, o, s, c) {
|
|
|
9788
10614
|
}
|
|
9789
10615
|
e.restore();
|
|
9790
10616
|
}
|
|
9791
|
-
function
|
|
10617
|
+
function no(e, t, n, r, i, a, o, s, c) {
|
|
9792
10618
|
if (t.length < 2) return;
|
|
9793
10619
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - (e - a) / o * f;
|
|
9794
10620
|
e.save(), e.beginPath(), e.moveTo(p(t[0].time), m(t[0].value));
|
|
9795
10621
|
for (let n = 1; n < t.length; n++) e.lineTo(p(t[n].time), m(t[n].value));
|
|
9796
10622
|
e.strokeStyle = s, e.lineWidth = c, e.lineJoin = "round", e.stroke(), e.restore();
|
|
9797
10623
|
}
|
|
9798
|
-
function
|
|
10624
|
+
function ro(e, t, n, r, i, a, o, s) {
|
|
9799
10625
|
if (t.length < 2) return;
|
|
9800
10626
|
let { left: c, bottom: l, plotWidth: u, plotHeight: d } = n, f = (e) => c + (e - r) / i * u, p = (e) => l - (e - a) / o * d, m = e.createLinearGradient(0, n.top, 0, l);
|
|
9801
10627
|
m.addColorStop(0, s + "40"), m.addColorStop(1, "transparent"), e.save(), e.beginPath(), e.moveTo(f(t[0].time), p(t[0].value));
|
|
9802
10628
|
for (let n = 1; n < t.length; n++) e.lineTo(f(t[n].time), p(t[n].value));
|
|
9803
10629
|
e.lineTo(f(t[t.length - 1].time), l), e.lineTo(f(t[0].time), l), e.closePath(), e.fillStyle = m, e.fill(), e.restore();
|
|
9804
10630
|
}
|
|
9805
|
-
function
|
|
10631
|
+
function io(e, t, n, r, i, a, o, s, c) {
|
|
9806
10632
|
if (t.length < 2) return;
|
|
9807
10633
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = r, p = (e) => l + (e - i) / a * d, m = (e) => u - (e - o) / s * f;
|
|
9808
10634
|
e.save(), e.fillStyle = c, e.beginPath(), e.moveTo(p(t[0].time), m(n[0]));
|
|
@@ -9810,12 +10636,12 @@ function Sa(e, t, n, r, i, a, o, s, c) {
|
|
|
9810
10636
|
for (let n = t.length - 1; n >= 0; n--) e.lineTo(p(t[n].time), m(t[n].value));
|
|
9811
10637
|
e.closePath(), e.fill(), e.restore();
|
|
9812
10638
|
}
|
|
9813
|
-
function
|
|
10639
|
+
function ao(e, t, n, r, i, a, o, s, c, l) {
|
|
9814
10640
|
if (t.length === 0) return;
|
|
9815
10641
|
let { left: u, bottom: d, plotWidth: f, plotHeight: p } = n, m = t[t.length - 1], h = u + (m.time - r) / i * f, g = d - (m.value - a) / o * p;
|
|
9816
10642
|
e.save(), e.font = `${l.font.sizeSmall}px ${l.font.family}`, e.fillStyle = c, e.textAlign = "left", e.textBaseline = "middle", e.fillText(s, h + 4, g), e.restore();
|
|
9817
10643
|
}
|
|
9818
|
-
function
|
|
10644
|
+
function oo(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
9819
10645
|
let { left: f, top: p, bottom: m, plotWidth: h, plotHeight: g } = i, _ = t.x;
|
|
9820
10646
|
if (_ < f || _ > i.right) return;
|
|
9821
10647
|
e.save(), e.strokeStyle = l.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(_, p), e.lineTo(_, m), e.stroke(), e.restore();
|
|
@@ -9833,15 +10659,15 @@ function wa(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
9833
10659
|
for (let t = 0; t < S.length; t++) e.fillText(S[t], D + 8, O + 6 + t * (l.font.sizeSmall + 4));
|
|
9834
10660
|
e.restore();
|
|
9835
10661
|
}
|
|
9836
|
-
function
|
|
10662
|
+
function so(e, t, n, r, i, a) {
|
|
9837
10663
|
let { data: o } = r;
|
|
9838
10664
|
if (o.length < 2 || t <= 0 || n <= 0) return;
|
|
9839
|
-
let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ??
|
|
9840
|
-
|
|
10665
|
+
let s = r.lineColor ?? i.lineColor, c = r.lineWidth ?? 1.5, l = r.drawdown === !0, u = r.drawdownColor ?? i.candleDown + "30", d = r.fillArea === !0, f = r.benchmark, p = r.benchmarkColor ?? i.textSecondary, m = r.benchmarkLabel ?? "Benchmark", h = r.valueFormat ?? $a, { valMin: g, valMax: _ } = Xa(o, f), v = _ - g || 1, y = o[0].time, b = o[o.length - 1].time, x = b - y || 1, S = r.timeFormat ?? Qa(x), C = Ya(t, n);
|
|
10666
|
+
eo(e, t, n, i.background), to(e, C, g, _, y, b, i, h, S), l && io(e, o, Za(o), C, y, x, g, v, u), d && ro(e, o, C, y, x, g, v, s), no(e, o, C, y, x, g, v, s, c), f && f.length >= 2 && (no(e, f, C, y, x, g, v, p, 1), ao(e, f, C, y, x, g, v, m, p, i)), a && oo(e, a, o, f, C, y, x, g, v, i, S, h);
|
|
9841
10667
|
}
|
|
9842
10668
|
//#endregion
|
|
9843
10669
|
//#region src/finance/HeatmapLayout.ts
|
|
9844
|
-
function
|
|
10670
|
+
function co(e, t, n) {
|
|
9845
10671
|
if (e.length === 0) return [];
|
|
9846
10672
|
let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
|
|
9847
10673
|
for (let a = 0; a < r; a++) {
|
|
@@ -9858,7 +10684,7 @@ function Ea(e, t, n) {
|
|
|
9858
10684
|
}
|
|
9859
10685
|
return c;
|
|
9860
10686
|
}
|
|
9861
|
-
function
|
|
10687
|
+
function lo(e, t) {
|
|
9862
10688
|
let n = e.reduce((e, t) => e + t, 0);
|
|
9863
10689
|
if (n === 0 || t === 0) return Infinity;
|
|
9864
10690
|
let r = 0;
|
|
@@ -9868,7 +10694,7 @@ function Da(e, t) {
|
|
|
9868
10694
|
}
|
|
9869
10695
|
return r;
|
|
9870
10696
|
}
|
|
9871
|
-
function
|
|
10697
|
+
function uo(e, t, n, r, i, a) {
|
|
9872
10698
|
let o = r ? n.height : n.width, s = e.reduce((e, t) => e + t, 0), c = o > 0 ? s / o : 0, l = 0;
|
|
9873
10699
|
for (let o = 0; o < e.length; o++) {
|
|
9874
10700
|
let s = c > 0 ? e[o] / c : 0, u;
|
|
@@ -9888,19 +10714,19 @@ function Oa(e, t, n, r, i, a) {
|
|
|
9888
10714
|
}), l += s;
|
|
9889
10715
|
}
|
|
9890
10716
|
}
|
|
9891
|
-
function
|
|
10717
|
+
function fo(e, t, n, r, i) {
|
|
9892
10718
|
if (e.length === 0) return;
|
|
9893
10719
|
let a = n.width >= n.height, o = a ? n.height : n.width;
|
|
9894
10720
|
if (e.length === 1) {
|
|
9895
|
-
|
|
10721
|
+
uo(e, t, n, a, r, i);
|
|
9896
10722
|
return;
|
|
9897
10723
|
}
|
|
9898
10724
|
let s = [], c = [], l = 0;
|
|
9899
10725
|
for (; l < e.length;) {
|
|
9900
10726
|
let u = [...s, e[l]];
|
|
9901
|
-
if (s.length === 0 ||
|
|
10727
|
+
if (s.length === 0 || lo(u, o) <= lo(s, o)) s.push(e[l]), c.push(t[l]), l++;
|
|
9902
10728
|
else {
|
|
9903
|
-
|
|
10729
|
+
uo(s, c, n, a, r, i);
|
|
9904
10730
|
let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
|
|
9905
10731
|
n = a ? {
|
|
9906
10732
|
x: n.x + d,
|
|
@@ -9912,28 +10738,28 @@ function ka(e, t, n, r, i) {
|
|
|
9912
10738
|
y: n.y + d,
|
|
9913
10739
|
width: n.width,
|
|
9914
10740
|
height: n.height - d
|
|
9915
|
-
},
|
|
10741
|
+
}, fo(e.slice(l), t.slice(l), n, r, i);
|
|
9916
10742
|
return;
|
|
9917
10743
|
}
|
|
9918
10744
|
}
|
|
9919
|
-
s.length > 0 &&
|
|
10745
|
+
s.length > 0 && uo(s, c, n, a, r, i);
|
|
9920
10746
|
}
|
|
9921
|
-
function
|
|
10747
|
+
function po(e, t, n) {
|
|
9922
10748
|
if (e.length === 0) return [];
|
|
9923
10749
|
let r = [...e].sort((e, t) => t.weight - e.weight), i = r.reduce((e, t) => e + Math.max(0, t.weight), 0);
|
|
9924
10750
|
if (i === 0) return [];
|
|
9925
10751
|
let a = t.width * t.height, o = r.map((e) => Math.max(0, e.weight) / i * a), s = r.map((e) => e.id), c = [];
|
|
9926
|
-
return
|
|
10752
|
+
return fo(o, s, { ...t }, n, c), c;
|
|
9927
10753
|
}
|
|
9928
10754
|
//#endregion
|
|
9929
10755
|
//#region src/finance/HeatmapRenderer.ts
|
|
9930
|
-
function
|
|
10756
|
+
function mo(e) {
|
|
9931
10757
|
return (e >= 0 ? "+" : "") + e.toFixed(2) + "%";
|
|
9932
10758
|
}
|
|
9933
|
-
function
|
|
10759
|
+
function ho(e) {
|
|
9934
10760
|
return e.label;
|
|
9935
10761
|
}
|
|
9936
|
-
function
|
|
10762
|
+
function go(e, t) {
|
|
9937
10763
|
let n = t.min ?? -5, r = t.max ?? 5;
|
|
9938
10764
|
if (e <= n) return t.negative;
|
|
9939
10765
|
if (e >= r) return t.positive;
|
|
@@ -9944,11 +10770,11 @@ function Na(e, t) {
|
|
|
9944
10770
|
let i = e / r;
|
|
9945
10771
|
return _(t.zero, t.positive, i);
|
|
9946
10772
|
}
|
|
9947
|
-
function
|
|
10773
|
+
function _o(e, t, n, r, i, a) {
|
|
9948
10774
|
let o = Math.min(a, r / 2, i / 2);
|
|
9949
10775
|
e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.arcTo(t + r, n, t + r, n + o, o), e.lineTo(t + r, n + i - o), e.arcTo(t + r, n + i, t + r - o, n + i, o), e.lineTo(t + o, n + i), e.arcTo(t, n + i, t, n + i - o, o), e.lineTo(t, n + o), e.arcTo(t, n, t + o, n, o), e.closePath();
|
|
9950
10776
|
}
|
|
9951
|
-
function
|
|
10777
|
+
function vo(e, t, n, r, i, a, o, s, c, l, u) {
|
|
9952
10778
|
if (i < 40 || a < 30) return;
|
|
9953
10779
|
let d = n + i / 2, f = r + a / 2;
|
|
9954
10780
|
if (e.save(), e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 2, e.fillStyle = "#FFFFFF", e.textAlign = "center", s) {
|
|
@@ -9961,22 +10787,22 @@ function Fa(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
9961
10787
|
}
|
|
9962
10788
|
e.restore();
|
|
9963
10789
|
}
|
|
9964
|
-
function
|
|
10790
|
+
function yo(e, t, n, r, i, a, o, s) {
|
|
9965
10791
|
let c = [o(t), s(t.value)];
|
|
9966
10792
|
if (t.meta) for (let [e, n] of Object.entries(t.meta)) c.push(e + ": " + String(n));
|
|
9967
10793
|
e.save(), e.font = a.font.sizeSmall + "px " + a.font.family;
|
|
9968
10794
|
let l = Math.max(...c.map((t) => e.measureText(t).width)) + 16, u = a.font.sizeSmall + 4, d = c.length * u + 12, f = n.x + 14, p = n.y - d / 2;
|
|
9969
|
-
f + l > r && (f = n.x - l - 14), p < 0 && (p = 0), p + d > i && (p = i - d), e.fillStyle = a.axisLabelBackground, e.globalAlpha = .92,
|
|
10795
|
+
f + l > r && (f = n.x - l - 14), p < 0 && (p = 0), p + d > i && (p = i - d), e.fillStyle = a.axisLabelBackground, e.globalAlpha = .92, _o(e, f, p, l, d, 4), e.fill(), e.globalAlpha = 1, e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
|
|
9970
10796
|
for (let t = 0; t < c.length; t++) e.fillText(c[t], f + 8, p + 6 + t * u);
|
|
9971
10797
|
e.restore();
|
|
9972
10798
|
}
|
|
9973
|
-
function
|
|
10799
|
+
function bo(e, t, n, r, i, a, o, s) {
|
|
9974
10800
|
if (r.length === 0 || i.length === 0 || t <= 0 || n <= 0) return null;
|
|
9975
10801
|
let c = a.colorScale ?? {
|
|
9976
10802
|
negative: "#EF5350",
|
|
9977
10803
|
zero: "#424242",
|
|
9978
10804
|
positive: "#26A69A"
|
|
9979
|
-
}, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ??
|
|
10805
|
+
}, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ?? mo, p = a.labelFormat ?? ho, m = /* @__PURE__ */ new Map();
|
|
9980
10806
|
for (let e of r) m.set(e.id, e);
|
|
9981
10807
|
let h = null, g = null;
|
|
9982
10808
|
if (s) for (let e of i) {
|
|
@@ -9997,37 +10823,37 @@ function La(e, t, n, r, i, a, o, s) {
|
|
|
9997
10823
|
if (!n) continue;
|
|
9998
10824
|
let { x: r, y: i, width: a, height: s } = t.rect;
|
|
9999
10825
|
if (a <= 0 || s <= 0) continue;
|
|
10000
|
-
let g =
|
|
10001
|
-
|
|
10826
|
+
let g = go(n.value, c);
|
|
10827
|
+
_o(e, r, i, a, s, l), e.fillStyle = g, e.fill(), vo(e, n, r, i, a, s, o, u, d, p, f), t.id === h && (_o(e, r, i, a, s, l), e.strokeStyle = "#FFFFFF", e.lineWidth = 1.5, e.stroke());
|
|
10002
10828
|
}
|
|
10003
|
-
return g && s &&
|
|
10829
|
+
return g && s && yo(e, g.cell, s, t, n, o, p, f), g;
|
|
10004
10830
|
}
|
|
10005
10831
|
//#endregion
|
|
10006
10832
|
//#region src/finance/WaterfallRenderer.ts
|
|
10007
|
-
var
|
|
10008
|
-
function
|
|
10833
|
+
var xo = 60, So = 12, Co = 24, wo = 40, To = .7, Eo = 1;
|
|
10834
|
+
function Do(e) {
|
|
10009
10835
|
return e.type ? e.type : e.value > 0 ? "positive" : e.value < 0 ? "negative" : "subtotal";
|
|
10010
10836
|
}
|
|
10011
|
-
function
|
|
10837
|
+
function Oo(e) {
|
|
10012
10838
|
let t = Math.abs(e);
|
|
10013
10839
|
return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
|
|
10014
10840
|
}
|
|
10015
|
-
function
|
|
10841
|
+
function ko(e, t) {
|
|
10016
10842
|
return {
|
|
10017
|
-
left:
|
|
10018
|
-
right: e -
|
|
10019
|
-
top:
|
|
10020
|
-
bottom: t -
|
|
10021
|
-
plotWidth: e -
|
|
10022
|
-
plotHeight: t -
|
|
10843
|
+
left: xo,
|
|
10844
|
+
right: e - So,
|
|
10845
|
+
top: Co,
|
|
10846
|
+
bottom: t - wo,
|
|
10847
|
+
plotWidth: e - xo - So,
|
|
10848
|
+
plotHeight: t - Co - wo
|
|
10023
10849
|
};
|
|
10024
10850
|
}
|
|
10025
|
-
function
|
|
10851
|
+
function Ao(e, t, n, r, i) {
|
|
10026
10852
|
let a = Array(e.length), o = Array(e.length), s = t.plotWidth / e.length, c = s * n, l = (s - c) / 2, { left: u, bottom: d, plotHeight: f } = t, p = 0;
|
|
10027
10853
|
for (let t = 0; t < e.length; t++) {
|
|
10028
|
-
let n = e[t], m =
|
|
10854
|
+
let n = e[t], m = Do(n), h, g;
|
|
10029
10855
|
m === "total" || m === "subtotal" ? (h = 0, g = n.value, p = n.value) : (h = p, g = p + n.value, p = g);
|
|
10030
|
-
let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y),
|
|
10856
|
+
let _ = Math.min(h, g), v = Math.max(h, g), y = d - (_ - r) / i * f, b = d - (v - r) / i * f, x = Math.min(y, b), S = Math.max(Math.abs(b - y), Eo), C = u + t * s, w = C + l;
|
|
10031
10857
|
a[t] = {
|
|
10032
10858
|
label: n.label,
|
|
10033
10859
|
value: n.value,
|
|
@@ -10047,14 +10873,14 @@ function qa(e, t, n, r, i) {
|
|
|
10047
10873
|
cumulatives: o
|
|
10048
10874
|
};
|
|
10049
10875
|
}
|
|
10050
|
-
function
|
|
10876
|
+
function jo(e) {
|
|
10051
10877
|
if (e.length === 0) return {
|
|
10052
10878
|
valMin: 0,
|
|
10053
10879
|
valMax: 1
|
|
10054
10880
|
};
|
|
10055
10881
|
let t = 0, n = 0, r = 0;
|
|
10056
10882
|
for (let i = 0; i < e.length; i++) {
|
|
10057
|
-
let a = e[i], o =
|
|
10883
|
+
let a = e[i], o = Do(a), s, c;
|
|
10058
10884
|
o === "total" || o === "subtotal" ? (s = 0, c = a.value, r = a.value) : (s = r, c = r + a.value, r = c), s < t && (t = s), c < t && (t = c), s > n && (n = s), c > n && (n = c);
|
|
10059
10885
|
}
|
|
10060
10886
|
let i = (n - t || 1) * .1;
|
|
@@ -10063,10 +10889,10 @@ function Ja(e) {
|
|
|
10063
10889
|
valMax: n + i
|
|
10064
10890
|
};
|
|
10065
10891
|
}
|
|
10066
|
-
function
|
|
10892
|
+
function Mo(e, t, n, r) {
|
|
10067
10893
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
10068
10894
|
}
|
|
10069
|
-
function
|
|
10895
|
+
function No(e, t, n, r, i, a) {
|
|
10070
10896
|
let { left: o, right: s, top: c, bottom: l, plotHeight: u } = t, d = r - n || 1;
|
|
10071
10897
|
e.strokeStyle = i.grid, e.lineWidth = .5, e.fillStyle = i.axisLabel, e.font = `${i.font.sizeSmall}px ${i.font.family}`, e.textAlign = "right", e.textBaseline = "middle";
|
|
10072
10898
|
let f = m(n, r, 5), p = Math.ceil(n / f) * f;
|
|
@@ -10085,7 +10911,7 @@ function Xa(e, t, n, r, i, a) {
|
|
|
10085
10911
|
e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(o, t), e.lineTo(s, t), e.stroke();
|
|
10086
10912
|
}
|
|
10087
10913
|
}
|
|
10088
|
-
function
|
|
10914
|
+
function Po(e, t, n) {
|
|
10089
10915
|
let r = [
|
|
10090
10916
|
"positive",
|
|
10091
10917
|
"negative",
|
|
@@ -10104,7 +10930,7 @@ function Za(e, t, n) {
|
|
|
10104
10930
|
s && (e.fillStyle = o, e.fill());
|
|
10105
10931
|
}
|
|
10106
10932
|
}
|
|
10107
|
-
function
|
|
10933
|
+
function Fo(e, t, n, r, i, a, o) {
|
|
10108
10934
|
if (o === "none" || t.length < 2) return;
|
|
10109
10935
|
let { bottom: s, plotHeight: c } = n;
|
|
10110
10936
|
e.strokeStyle = a, e.lineWidth = 1, o === "dashed" ? e.setLineDash([4, 4]) : e.setLineDash([]), e.beginPath();
|
|
@@ -10114,7 +10940,7 @@ function Qa(e, t, n, r, i, a, o) {
|
|
|
10114
10940
|
}
|
|
10115
10941
|
e.stroke(), e.setLineDash([]);
|
|
10116
10942
|
}
|
|
10117
|
-
function
|
|
10943
|
+
function Io(e, t, n, r, i, a) {
|
|
10118
10944
|
e.fillStyle = r.text, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center";
|
|
10119
10945
|
for (let r = 0; r < t.length; r++) {
|
|
10120
10946
|
let o = t[r], s;
|
|
@@ -10123,7 +10949,7 @@ function $a(e, t, n, r, i, a) {
|
|
|
10123
10949
|
o.end < o.start ? (e.textBaseline = "top", e.fillText(s, c, o.rectY + o.rectH + 4)) : (e.textBaseline = "bottom", e.fillText(s, c, o.rectY - 4));
|
|
10124
10950
|
}
|
|
10125
10951
|
}
|
|
10126
|
-
function
|
|
10952
|
+
function Lo(e, t, n, r, i) {
|
|
10127
10953
|
e.fillStyle = r.axisLabel, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "top";
|
|
10128
10954
|
let a = n.bottom + 6, o = t.length > 0 ? t[0].slotW - 4 : 0, s = !1;
|
|
10129
10955
|
for (let n = 0; n < t.length; n++) if (e.measureText(i(t[n].label)).width > o) {
|
|
@@ -10144,7 +10970,7 @@ function eo(e, t, n, r, i) {
|
|
|
10144
10970
|
}
|
|
10145
10971
|
e.setTransform(1, 0, 0, 1, 0, 0), e.restore();
|
|
10146
10972
|
}
|
|
10147
|
-
function
|
|
10973
|
+
function Ro(e, t, n) {
|
|
10148
10974
|
if (t < n.left || t > n.right) return null;
|
|
10149
10975
|
for (let n = 0; n < e.length; n++) {
|
|
10150
10976
|
let r = e[n];
|
|
@@ -10152,7 +10978,7 @@ function to(e, t, n) {
|
|
|
10152
10978
|
}
|
|
10153
10979
|
return null;
|
|
10154
10980
|
}
|
|
10155
|
-
function
|
|
10981
|
+
function zo(e, t, n, r, i, a, o, s) {
|
|
10156
10982
|
let c = t[r], l = n[r], u = Math.round(c.slotX + c.slotW / 2) + .5;
|
|
10157
10983
|
e.strokeStyle = o.crosshair, e.lineWidth = .5, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(u, a.top), e.lineTo(u, a.bottom), e.stroke(), e.setLineDash([]);
|
|
10158
10984
|
let d = [
|
|
@@ -10171,31 +10997,31 @@ function no(e, t, n, r, i, a, o, s) {
|
|
|
10171
10997
|
let _ = o.font.sizeSmall + 4;
|
|
10172
10998
|
for (let t = 0; t < d.length; t++) e.fillText(d[t], h + 8, g + 6 + t * _);
|
|
10173
10999
|
}
|
|
10174
|
-
function
|
|
11000
|
+
function Bo(e, t, n, r, i, a) {
|
|
10175
11001
|
let { data: o } = r;
|
|
10176
11002
|
if (!o || o.length === 0 || t <= 0 || n <= 0) return { hitBar: null };
|
|
10177
|
-
let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ??
|
|
10178
|
-
|
|
11003
|
+
let s = r.positiveColor ?? i.candleUp, c = r.negativeColor ?? i.candleDown, l = r.totalColor ?? i.lineColor, u = r.subtotalColor ?? i.textSecondary, d = r.connectorColor ?? i.textSecondary, f = r.connectorStyle ?? "dashed", p = r.barWidth ?? To, m = r.showValues !== !1, h = r.showDelta !== !1, g = r.valueFormat ?? Oo, _ = r.labelFormat ?? ((e) => e), { valMin: v, valMax: y } = jo(o), b = y - v || 1, x = ko(t, n), { bars: S, cumulatives: C } = Ao(o, x, p, v, b);
|
|
11004
|
+
Mo(e, t, n, i.background), No(e, x, v, y, i, g), Fo(e, S, x, v, b, d, f), Po(e, S, {
|
|
10179
11005
|
positive: s,
|
|
10180
11006
|
negative: c,
|
|
10181
11007
|
total: l,
|
|
10182
11008
|
subtotal: u
|
|
10183
|
-
}), m &&
|
|
10184
|
-
let w = a ?
|
|
10185
|
-
return a && w !== null &&
|
|
11009
|
+
}), m && Io(e, S, C, i, g, h), Lo(e, S, x, i, _);
|
|
11010
|
+
let w = a ? Ro(S, a.x, x) : null;
|
|
11011
|
+
return a && w !== null && zo(e, S, C, w, a, x, i, g), { hitBar: w };
|
|
10186
11012
|
}
|
|
10187
11013
|
//#endregion
|
|
10188
11014
|
//#region src/finance/GaugeRenderer.ts
|
|
10189
|
-
var
|
|
10190
|
-
function
|
|
11015
|
+
var Vo = Math.PI / 180, Ho = 135, Uo = 405, Wo = .25;
|
|
11016
|
+
function Go(e) {
|
|
10191
11017
|
let t = Math.abs(e);
|
|
10192
11018
|
return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
|
|
10193
11019
|
}
|
|
10194
11020
|
function Q(e, t, n) {
|
|
10195
11021
|
return e < t ? t : e > n ? n : e;
|
|
10196
11022
|
}
|
|
10197
|
-
function
|
|
10198
|
-
let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ??
|
|
11023
|
+
function Ko(e, t, n) {
|
|
11024
|
+
let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ?? Ho) * Vo, s = (n.endAngle ?? Uo) * Vo, c = n.thickness ?? Wo, l = e / 2, u = t / 2 + t * .05, d = Math.max(10, Math.min(e, t) / 2 - 24);
|
|
10199
11025
|
return {
|
|
10200
11026
|
cx: l,
|
|
10201
11027
|
cy: u,
|
|
@@ -10213,38 +11039,38 @@ function $(e, t) {
|
|
|
10213
11039
|
let n = Q((e - t.min) / t.range, 0, 1);
|
|
10214
11040
|
return t.startAngle + t.angleRange * n;
|
|
10215
11041
|
}
|
|
10216
|
-
function
|
|
11042
|
+
function qo(e, t, n, r) {
|
|
10217
11043
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
10218
11044
|
}
|
|
10219
|
-
function
|
|
11045
|
+
function Jo(e, t, n) {
|
|
10220
11046
|
e.beginPath(), e.arc(t.cx, t.cy, t.radius, t.startAngle, t.endAngle, !1), e.arc(t.cx, t.cy, t.innerRadius, t.endAngle, t.startAngle, !0), e.closePath(), e.fillStyle = n, e.fill();
|
|
10221
11047
|
}
|
|
10222
|
-
function
|
|
11048
|
+
function Yo(e, t, n) {
|
|
10223
11049
|
let r = Q(n.from, t.min, t.max), i = Q(n.to, t.min, t.max);
|
|
10224
11050
|
if (i <= r) return;
|
|
10225
11051
|
let a = $(r, t), o = $(i, t);
|
|
10226
11052
|
e.beginPath(), e.arc(t.cx, t.cy, t.radius, a, o, !1), e.arc(t.cx, t.cy, t.innerRadius, o, a, !0), e.closePath(), e.fillStyle = n.color, e.fill();
|
|
10227
11053
|
}
|
|
10228
|
-
function
|
|
11054
|
+
function Xo(e, t, n, r, i) {
|
|
10229
11055
|
let a = $(n, t);
|
|
10230
11056
|
a <= t.startAngle || (e.globalAlpha = i, e.beginPath(), e.arc(t.cx, t.cy, t.radius, t.startAngle, a, !1), e.arc(t.cx, t.cy, t.innerRadius, a, t.startAngle, !0), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1);
|
|
10231
11057
|
}
|
|
10232
|
-
function
|
|
11058
|
+
function Zo(e, t, n, r) {
|
|
10233
11059
|
let i = $(n, t), a = Math.cos(i), o = Math.sin(i), s = t.radius - 2, c = t.innerRadius * .25, l = -o, u = a, d = t.cx + a * s, f = t.cy + o * s, p = t.cx + l * 4 - a * c, m = t.cy + u * 4 - o * c, h = t.cx - l * 4 - a * c, g = t.cy - u * 4 - o * c;
|
|
10234
11060
|
e.beginPath(), e.moveTo(d, f), e.lineTo(p, m), e.lineTo(h, g), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.innerRadius * .12), 0, Math.PI * 2), e.fill();
|
|
10235
11061
|
}
|
|
10236
|
-
function
|
|
11062
|
+
function Qo(e, t, n, r, i) {
|
|
10237
11063
|
let a = Math.round(t.innerRadius * .55), o = Math.round(i.font.sizeMedium);
|
|
10238
11064
|
e.fillStyle = i.text, e.textAlign = "center", e.textBaseline = "middle", e.font = `600 ${a}px ${i.font.family}`;
|
|
10239
11065
|
let s = !!r, c = s ? t.cy - o * .6 : t.cy - a * .1;
|
|
10240
11066
|
e.fillText(n, t.cx, c), s && (e.fillStyle = i.textSecondary, e.font = `${o}px ${i.font.family}`, e.fillText(r, t.cx, t.cy + a * .55));
|
|
10241
11067
|
}
|
|
10242
|
-
function
|
|
11068
|
+
function $o(e, t, n, r) {
|
|
10243
11069
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`;
|
|
10244
11070
|
let i = t.radius + 10, a = Math.cos(t.startAngle), o = Math.sin(t.startAngle), s = Math.cos(t.endAngle), c = Math.sin(t.endAngle), l = t.cx + a * i, u = t.cy + o * i, d = t.cx + s * i, f = t.cy + c * i;
|
|
10245
11071
|
e.textBaseline = "middle", e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(n(t.min), l, u), e.textAlign = s < -.2 ? "right" : s > .2 ? "left" : "center", e.fillText(n(t.max), d, f);
|
|
10246
11072
|
}
|
|
10247
|
-
function
|
|
11073
|
+
function es(e, t, n, r) {
|
|
10248
11074
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "middle";
|
|
10249
11075
|
let i = (t.radius + t.innerRadius) / 2;
|
|
10250
11076
|
for (let r = 0; r < n.length; r++) {
|
|
@@ -10254,15 +11080,15 @@ function vo(e, t, n, r) {
|
|
|
10254
11080
|
e.fillText(a.label, s, c);
|
|
10255
11081
|
}
|
|
10256
11082
|
}
|
|
10257
|
-
function
|
|
11083
|
+
function ts(e, t, n, r, i, a) {
|
|
10258
11084
|
if (t <= 0 || n <= 0) return;
|
|
10259
|
-
let o =
|
|
10260
|
-
|
|
11085
|
+
let o = Ko(t, n, r), s = r.trackColor ?? i.grid, c = r.needleColor ?? i.text, l = r.showValue !== !1, u = r.showZoneLabels === !0, d = r.valueFormat ?? Go, f = Q(a, o.min, o.max);
|
|
11086
|
+
qo(e, t, n, i.background), Jo(e, o, s);
|
|
10261
11087
|
let p = r.zones;
|
|
10262
|
-
if (p && p.length > 0) for (let t = 0; t < p.length; t++)
|
|
10263
|
-
|
|
11088
|
+
if (p && p.length > 0) for (let t = 0; t < p.length; t++) Yo(e, o, p[t]);
|
|
11089
|
+
Xo(e, o, f, c, .12), Zo(e, o, f, c), l && Qo(e, o, d(f), r.label, i), $o(e, o, d, i), u && p && p.length > 0 && es(e, o, p, i);
|
|
10264
11090
|
}
|
|
10265
11091
|
//#endregion
|
|
10266
|
-
export {
|
|
11092
|
+
export { Et as ADXIndicator, Tt as ATRIndicator, hn as AcceleratorOscillatorIndicator, Cn as AccumulationDistributionIndicator, In as AlertDragHandler, $i as AlertManager, vt as AlligatorIndicator, lt as AnchoredVWAPIndicator, Dr as AnchoredVWAPTool, wa as Animator, ce as AreaRenderer, jt as AroonIndicator, Sr as ArrowTool, bt as AwesomeOscillatorIndicator, Fn as AxisDragHandler, Qt as BalanceOfPowerIndicator, Vi as BarCountdown, le as BarRenderer, Ea as BaseFinanceChart, de as BaselineRenderer, pi as BinanceAdapter, et as BollingerBandsIndicator, Gr as BracketTool, Ti as BybitAdapter, kt as CCIIndicator, Pt as CMFIndicator, re as CandlestickRenderer, w as CanvasLayer, xt as ChaikinOscillatorIndicator, cn as ChaikinVolatilityIndicator, en as ChandeMomentumIndicator, _t as ChandelierExitIndicator, Ri as ChartLegend, ca as ChartStateManager, Lt as ChoppinessIndexIndicator, yi as CoinbaseAdapter, He as CompareRenderer, Vt as ConnorsRSIIndicator, Ut as CoppockIndicator, zn as CrosshairHandler, Un as CrosshairTooltip, oi as CurrentPriceLine, Li as DEFAULT_LEGEND_CONFIG, Xi as DEFAULT_SESSION_HOURS, D as DPRManager, ua as DataExporter, vr as DateRangeTool, ze as DepthHeatmapBuffer, Be as DepthHeatmapRenderer, zr as DepthOverlay, Zt as DetrendedPriceOscillatorIndicator, vn as DisparityIndexIndicator, ot as DonchianChannelIndicator, H as DrawingBase, Qn as DrawingManager, $n as DrawingRenderer, $e as EMAIndicator, nn as EaseOfMovementIndicator, Ca as Easing, Kt as ElderRayIndicator, gr as ElliottWaveTool, fr as EllipseTool, G as Emitter, ge as EquivolumeRenderer, Xn as EventBus, ar as ExtendedLineTool, ur as FibExtensionTool, cr as FibRetracementTool, Ar as FibTimeZonesTool, Da as FinanceCrosshair, Xt as FisherTransformIndicator, Bt as ForceIndexIndicator, Er as GannBoxTool, wr as GannFanTool, On as GridRenderer, ve as HLCAreaRenderer, ue as HollowCandleRenderer, nr as HorizontalLineTool, ft as HullMAIndicator, nt as IchimokuIndicator, I as IndicatorBase, Ze as IndicatorEngine, Dn as IndicatorWorkerHost, Mn as InteractionManager, Wt as KSTIndicator, pe as KagiRenderer, at as KeltnerChannelIndicator, Hn as KeyboardHandler, Yt as KlingerIndicator, Mi as KrakenAdapter, T as LayerManager, se as LineRenderer, be as LineWithMarkersRenderer, dt as LinearRegressionChannelIndicator, Ct as MACDIndicator, At as MFIIndicator, ht as MTFMovingAverageIndicator, Oe as MarketProfileRenderer, $t as MassIndexIndicator, ha as MeasureOverlay, yr as MeasureTool, mi as MockAdapter, Dt as OBVIndicator, Zr as OrderDraftTool, Mr as OrderRenderer, Nn as PanHandler, Ln as PaneResizeHandler, ni as PaperExecutionAdapter, rt as ParabolicSARIndicator, or as ParallelChannelTool, pn as PercentagePriceOscillatorIndicator, Ne as PeriodLevelsRenderer, Kn as PinnedTooltip, mr as PitchforkTool, Le as PivotMarkersRenderer, ct as PivotPointsIndicator, me as PointAndFigureRenderer, gi as PollingAdapter, Rr as PositionRenderer, bn as PrettyGoodOscillatorIndicator, kn as PriceAxis, _r as PriceRangeTool, sn as PriceVolumeTrendIndicator, yn as QstickIndicator, Mt as ROCIndicator, St as RSIIndicator, ir as RayTool, ai as ReconnectManager, dr as RectangleTool, sr as RegressionChannelTool, _n as RelativeMomentumIndexIndicator, ln as RelativeVigorIndicator, ee as RenderEngine, E as RenderLoop, fe as RenkoRenderer, ci as ReplayController, ea as ReplayManager, Qe as SMAIndicator, qt as SchaffTrendCycleIndicator, zi as Screenshot, Hi as SessionBreaks, Zi as SessionShading, gt as SessionVWAPIndicator, fa as SignalMarkerManager, xn as StdDevIndicator, ye as StepLineRenderer, wt as StochasticIndicator, un as StochasticRSIIndicator, si as StreamManager, it as SupertrendIndicator, tn as TRIXIndicator, Nt as TSIIndicator, xr as TextAnnotationTool, ii as TickAggregator, jn as TimeAxis, ma as TradeZoneManager, Vr as TradingContextMenu, Br as TradingDragHandler, ei as TradingManager, ti as TradingRenderer, tr as TrendLineTool, pr as TriangleTool, Rt as UltimateOscillatorIndicator, la as UndoRedoManager, wn as VROCIndicator, tt as VWAPIndicator, rr as VerticalLineTool, te as Viewport, he as VolumeCandleRenderer, Ft as VolumeDeltaIndicator, Sn as VolumeProfileIndicator, Or as VolumeProfileRangeTool, Se as VolumeProfileRenderer, xe as VolumeRenderer, It as VortexIndicator, Bi as Watermark, hi as WebSocketAdapter, an as WilliamsADIndicator, Ot as WilliamsRIndicator, ut as ZigZagIndicator, Pn as ZoomHandler, Ee as assignSessionLetters, O as barIndexToX, Ur as bracketRiskReward, Fe as classifyPivots, Hr as computeBracketDefaults, we as computeMarketProfile, Me as computePeriodLevels, De as computeSessionProfiles, er as findDominantSwing, Ie as findPivots, R as getIntParam, L as getNumberParam, ne as getVisibleData, Yr as inferOrderType, Yi as isRegularSession, En as isWorkerResponse, po as layoutSquarifiedTreemap, co as layoutUniformGrid, ie as lttbDownsample, oe as lttbVisibleIndices, Ji as minuteOfDay, k as priceToY, jr as registerBuiltInDrawingTools, Tn as registerBuiltInIndicators, Ua as renderDepthChart, so as renderEquityCurve, ts as renderGauge, bo as renderHeatmap, Oa as renderSparkline, Bo as renderWaterfall, N as resolveBarIndex, P as timeToX, M as timestampToBarIndex, Ue as toHeikinAshi, qe as toKagi, Ke as toLineBreak, Je as toPointAndFigure, Ye as toRangeBars, We as toRenko, Te as tpoLetter, A as xToBarIndex, F as xToTime, j as yToPrice };
|
|
10267
11093
|
|
|
10268
11094
|
//# sourceMappingURL=index.js.map
|