@tradecanvas/core 0.14.0 → 1.0.1
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 +1379 -548
- 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/dist/viewport/Viewport.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();
|
|
@@ -434,7 +434,12 @@ var ee = class {
|
|
|
434
434
|
clampOffset() {
|
|
435
435
|
if (this.state.chartRect.width <= 0) return;
|
|
436
436
|
let e = this.state.barWidth + this.state.barSpacing, t = this.dataLength * e, n = this.rightMarginBars * e, r = t - this.state.chartRect.width + n, i, a;
|
|
437
|
-
r > 0
|
|
437
|
+
if (r > 0) i = -(this.state.chartRect.width * .5), a = r;
|
|
438
|
+
else {
|
|
439
|
+
let e = this.state.chartRect.width * .5;
|
|
440
|
+
i = r - e, a = r + e;
|
|
441
|
+
}
|
|
442
|
+
this.state.offset = f(this.state.offset, i, a);
|
|
438
443
|
}
|
|
439
444
|
updateVisibleRange() {
|
|
440
445
|
let e = this.state.barWidth + this.state.barSpacing;
|
|
@@ -466,7 +471,53 @@ var re = class {
|
|
|
466
471
|
}
|
|
467
472
|
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
473
|
}
|
|
469
|
-
}
|
|
474
|
+
};
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/charts/downsample.ts
|
|
477
|
+
function ie(e, t, n) {
|
|
478
|
+
if (t >= e) {
|
|
479
|
+
let t = Array(Math.max(0, e));
|
|
480
|
+
for (let n = 0; n < e; n++) t[n] = n;
|
|
481
|
+
return t;
|
|
482
|
+
}
|
|
483
|
+
if (t <= 2) return e >= 2 ? [0, e - 1] : e === 1 ? [0] : [];
|
|
484
|
+
let r = [0], i = (e - 2) / (t - 2), a = 0;
|
|
485
|
+
for (let o = 0; o < t - 2; o++) {
|
|
486
|
+
let t = Math.floor((o + 1) * i) + 1, s = Math.floor((o + 2) * i) + 1;
|
|
487
|
+
s > e && (s = e);
|
|
488
|
+
let c = 0, l = 0, u = 0;
|
|
489
|
+
for (let e = t; e < s; e++) c += e, l += n(e), u++;
|
|
490
|
+
if (u > 0) c /= u, l /= u;
|
|
491
|
+
else {
|
|
492
|
+
let r = Math.min(t, e - 1);
|
|
493
|
+
c = r, l = n(r);
|
|
494
|
+
}
|
|
495
|
+
let d = Math.floor(o * i) + 1, f = Math.floor((o + 1) * i) + 1, p = n(a), m = -1, h = d;
|
|
496
|
+
for (let e = d; e < f; e++) {
|
|
497
|
+
let t = Math.abs((a - c) * (n(e) - p) - (a - e) * (l - p));
|
|
498
|
+
t > m && (m = t, h = e);
|
|
499
|
+
}
|
|
500
|
+
r.push(h), a = h;
|
|
501
|
+
}
|
|
502
|
+
return r.push(e - 1), r;
|
|
503
|
+
}
|
|
504
|
+
var ae = 64;
|
|
505
|
+
function oe(e, t, n, r, i) {
|
|
506
|
+
let a = Math.max(0, e), o = Math.min(t, n - 1);
|
|
507
|
+
if (o < a) return [];
|
|
508
|
+
let s = o - a + 1, c = Math.max(ae, Math.ceil(r * 2));
|
|
509
|
+
if (s <= c) {
|
|
510
|
+
let e = Array(s);
|
|
511
|
+
for (let t = 0; t < s; t++) e[t] = a + t;
|
|
512
|
+
return e;
|
|
513
|
+
}
|
|
514
|
+
let l = ie(s, c, (e) => i(a + e));
|
|
515
|
+
for (let e = 0; e < l.length; e++) l[e] += a;
|
|
516
|
+
return l;
|
|
517
|
+
}
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/charts/LineRenderer.ts
|
|
520
|
+
var se = class {
|
|
470
521
|
render(e, t, n, r) {
|
|
471
522
|
let { from: i, to: a } = n.visibleRange;
|
|
472
523
|
if (i > a || t.length === 0) return;
|
|
@@ -474,28 +525,36 @@ var re = class {
|
|
|
474
525
|
if (u === 0) return;
|
|
475
526
|
let d = n.chartRect.y, f = n.chartRect.height / u;
|
|
476
527
|
e.beginPath(), e.strokeStyle = r.lineColor, e.lineWidth = 2, e.lineJoin = "round";
|
|
477
|
-
let p = !1;
|
|
478
|
-
for (let n
|
|
528
|
+
let p = oe(i, a, t.length, n.chartRect.width, (e) => t[e].close), m = !1;
|
|
529
|
+
for (let n of p) {
|
|
479
530
|
let r = n * o + s, i = d + (l - t[n].close) * f;
|
|
480
|
-
|
|
531
|
+
m ? e.lineTo(r, i) : (e.moveTo(r, i), m = !0);
|
|
481
532
|
}
|
|
482
533
|
e.stroke();
|
|
483
534
|
}
|
|
484
|
-
},
|
|
535
|
+
}, ce = class {
|
|
485
536
|
render(e, t, n, r) {
|
|
486
537
|
let { from: i, to: a } = n.visibleRange;
|
|
487
538
|
if (i > a || t.length === 0) return;
|
|
488
539
|
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
540
|
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 =
|
|
541
|
+
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);
|
|
542
|
+
if (h.length === 0) return;
|
|
543
|
+
let g = h[0], _ = g * o + s, v = d + (l - t[g].close) * p, y = e.createLinearGradient(0, d, 0, m);
|
|
544
|
+
y.addColorStop(0, r.areaTopColor), y.addColorStop(1, r.areaBottomColor), e.beginPath(), e.moveTo(_, m), e.lineTo(_, v);
|
|
545
|
+
let b = _;
|
|
546
|
+
for (let n = 1; n < h.length; n++) {
|
|
547
|
+
let r = h[n];
|
|
548
|
+
b = r * o + s, e.lineTo(b, d + (l - t[r].close) * p);
|
|
549
|
+
}
|
|
550
|
+
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);
|
|
551
|
+
for (let n = 1; n < h.length; n++) {
|
|
552
|
+
let r = h[n];
|
|
553
|
+
e.lineTo(r * o + s, d + (l - t[r].close) * p);
|
|
554
|
+
}
|
|
496
555
|
e.stroke();
|
|
497
556
|
}
|
|
498
|
-
},
|
|
557
|
+
}, le = class {
|
|
499
558
|
render(e, t, n, r) {
|
|
500
559
|
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
560
|
if (f === 0) return;
|
|
@@ -506,7 +565,7 @@ var re = class {
|
|
|
506
565
|
}
|
|
507
566
|
e.lineWidth = 1, e.strokeStyle = r.candleUp, e.stroke(_), e.strokeStyle = r.candleDown, e.stroke(v);
|
|
508
567
|
}
|
|
509
|
-
},
|
|
568
|
+
}, ue = class {
|
|
510
569
|
render(e, t, n, r) {
|
|
511
570
|
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
571
|
if (f === 0) return;
|
|
@@ -525,7 +584,7 @@ var re = class {
|
|
|
525
584
|
e.strokeStyle = r.candleDown;
|
|
526
585
|
for (let t of b) e.strokeRect(t.x, t.y, t.w, t.h);
|
|
527
586
|
}
|
|
528
|
-
},
|
|
587
|
+
}, de = class {
|
|
529
588
|
baselinePrice = null;
|
|
530
589
|
setBaseline(e) {
|
|
531
590
|
this.baselinePrice = e;
|
|
@@ -566,7 +625,7 @@ var re = class {
|
|
|
566
625
|
for (let a = t; a <= n && a < e.length; a++) r += e[a].close, i++;
|
|
567
626
|
return i > 0 ? r / i : 0;
|
|
568
627
|
}
|
|
569
|
-
},
|
|
628
|
+
}, fe = class {
|
|
570
629
|
render(e, t, n, r) {
|
|
571
630
|
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
631
|
if (f === 0) return;
|
|
@@ -577,7 +636,7 @@ var re = class {
|
|
|
577
636
|
}
|
|
578
637
|
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
638
|
}
|
|
580
|
-
},
|
|
639
|
+
}, pe = class {
|
|
581
640
|
render(e, t, n, r) {
|
|
582
641
|
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
642
|
if (f === 0) return;
|
|
@@ -591,7 +650,7 @@ var re = class {
|
|
|
591
650
|
}
|
|
592
651
|
e.strokeStyle = r.candleUp, e.lineWidth = 3, e.stroke(_), e.strokeStyle = r.candleDown, e.lineWidth = 1, e.stroke(v);
|
|
593
652
|
}
|
|
594
|
-
},
|
|
653
|
+
}, me = class {
|
|
595
654
|
boxSize = 1;
|
|
596
655
|
setBoxSize(e) {
|
|
597
656
|
this.boxSize = e;
|
|
@@ -609,7 +668,7 @@ var re = class {
|
|
|
609
668
|
}
|
|
610
669
|
e.lineWidth = 1.5, e.strokeStyle = r.candleUp, e.stroke(y), e.strokeStyle = r.candleDown, e.stroke(b);
|
|
611
670
|
}
|
|
612
|
-
},
|
|
671
|
+
}, he = class {
|
|
613
672
|
render(e, t, n, r) {
|
|
614
673
|
let { from: i, to: a } = n.visibleRange, { min: o, max: s } = n.priceRange, c = s - o;
|
|
615
674
|
if (c === 0 || i > a || t.length === 0) return;
|
|
@@ -625,7 +684,7 @@ var re = class {
|
|
|
625
684
|
}
|
|
626
685
|
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
686
|
}
|
|
628
|
-
},
|
|
687
|
+
}, ge = class {
|
|
629
688
|
render(e, t, n, r) {
|
|
630
689
|
let { from: i, to: a } = n.visibleRange, { min: o, max: s } = n.priceRange, c = s - o;
|
|
631
690
|
if (c === 0 || i > a || t.length === 0) return;
|
|
@@ -637,10 +696,10 @@ var re = class {
|
|
|
637
696
|
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
697
|
d.rect(i - l, a, c, u), f.rect(i - l, a, c, u);
|
|
639
698
|
}
|
|
640
|
-
e.fillStyle =
|
|
699
|
+
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
700
|
}
|
|
642
701
|
};
|
|
643
|
-
function
|
|
702
|
+
function _e(e, t) {
|
|
644
703
|
if (e.startsWith("#")) {
|
|
645
704
|
let n = Math.round(Math.max(0, Math.min(1, t)) * 255).toString(16).padStart(2, "0");
|
|
646
705
|
if (e.length === 7) return `${e}${n}`;
|
|
@@ -650,7 +709,7 @@ function me(e, t) {
|
|
|
650
709
|
}
|
|
651
710
|
//#endregion
|
|
652
711
|
//#region src/charts/HLCAreaRenderer.ts
|
|
653
|
-
var
|
|
712
|
+
var ve = class {
|
|
654
713
|
render(e, t, n, r) {
|
|
655
714
|
let { from: i, to: a } = n.visibleRange;
|
|
656
715
|
if (i > a || t.length === 0) return;
|
|
@@ -679,7 +738,7 @@ var he = class {
|
|
|
679
738
|
}
|
|
680
739
|
e.stroke();
|
|
681
740
|
}
|
|
682
|
-
},
|
|
741
|
+
}, ye = class {
|
|
683
742
|
render(e, t, n, r) {
|
|
684
743
|
let { from: i, to: a } = n.visibleRange;
|
|
685
744
|
if (i > a || t.length === 0) return;
|
|
@@ -694,7 +753,7 @@ var he = class {
|
|
|
694
753
|
}
|
|
695
754
|
e.stroke();
|
|
696
755
|
}
|
|
697
|
-
},
|
|
756
|
+
}, be = class {
|
|
698
757
|
render(e, t, n, r) {
|
|
699
758
|
let { from: i, to: a } = n.visibleRange;
|
|
700
759
|
if (i > a || t.length === 0) return;
|
|
@@ -715,7 +774,7 @@ var he = class {
|
|
|
715
774
|
for (let { x: e, y: t } of h) _.moveTo(e + g, t), _.arc(e, t, g, 0, Math.PI * 2);
|
|
716
775
|
e.fillStyle = r.lineColor, e.fill(_), e.strokeStyle = r.background, e.lineWidth = 1, e.stroke(_);
|
|
717
776
|
}
|
|
718
|
-
},
|
|
777
|
+
}, xe = class {
|
|
719
778
|
visible = !0;
|
|
720
779
|
heightRatio = .2;
|
|
721
780
|
setVisible(e) {
|
|
@@ -736,7 +795,7 @@ var he = class {
|
|
|
736
795
|
}
|
|
737
796
|
e.globalAlpha = .35, e.fillStyle = r.candleUp, e.fill(h), e.fillStyle = r.candleDown, e.fill(g), e.globalAlpha = 1;
|
|
738
797
|
}
|
|
739
|
-
},
|
|
798
|
+
}, Se = class {
|
|
740
799
|
visible = !1;
|
|
741
800
|
buckets = 48;
|
|
742
801
|
widthRatio = .18;
|
|
@@ -789,17 +848,17 @@ var he = class {
|
|
|
789
848
|
};
|
|
790
849
|
//#endregion
|
|
791
850
|
//#region src/charts/marketProfile.ts
|
|
792
|
-
function
|
|
851
|
+
function Ce(e, t) {
|
|
793
852
|
return e < 0 ? 0 : e > t ? t : e;
|
|
794
853
|
}
|
|
795
|
-
function
|
|
854
|
+
function we(e, t, n, r = {}) {
|
|
796
855
|
let i = Math.max(4, Math.min(500, Math.floor(r.buckets ?? 48))), a = n - t;
|
|
797
856
|
if (a <= 0 || e.length === 0) return null;
|
|
798
857
|
let o = a / i, s = new Float64Array(i);
|
|
799
858
|
for (let r of e) {
|
|
800
859
|
let e = Math.min(r.low, r.high), a = Math.max(r.low, r.high);
|
|
801
860
|
if (a < t || e > n) continue;
|
|
802
|
-
let c =
|
|
861
|
+
let c = Ce(Math.floor((e - t) / o), i - 1), l = Ce(Math.floor((a - t) / o), i - 1);
|
|
803
862
|
for (let e = c; e <= l; e++) s[e] += 1;
|
|
804
863
|
}
|
|
805
864
|
let c = 0, l = 0, u = 0;
|
|
@@ -829,11 +888,11 @@ function xe(e, t, n, r = {}) {
|
|
|
829
888
|
valueAreaHigh: t + (p + 1) * o
|
|
830
889
|
};
|
|
831
890
|
}
|
|
832
|
-
function
|
|
891
|
+
function Te(e) {
|
|
833
892
|
let t = (e % 52 + 52) % 52;
|
|
834
893
|
return t < 26 ? String.fromCharCode(65 + t) : String.fromCharCode(97 + t - 26);
|
|
835
894
|
}
|
|
836
|
-
function
|
|
895
|
+
function Ee(e, t, n, r = 48) {
|
|
837
896
|
let i = Math.max(4, Math.min(500, Math.floor(r))), a = n - t, o = Array.from({ length: i }, () => []);
|
|
838
897
|
if (a <= 0) return o;
|
|
839
898
|
let s = a / i;
|
|
@@ -844,10 +903,10 @@ function Ce(e, t, n, r = 48) {
|
|
|
844
903
|
for (let e = l; e <= u; e++) o[e].push(r);
|
|
845
904
|
}), o;
|
|
846
905
|
}
|
|
847
|
-
function
|
|
906
|
+
function De(e, t, n, r = {}) {
|
|
848
907
|
if (e.length === 0 || n - t <= 0) return [];
|
|
849
908
|
let i = [], a = 0, o = b(e[0].time, "1d"), s = (a, o, s) => {
|
|
850
|
-
let c =
|
|
909
|
+
let c = we(e.slice(a, o + 1), t, n, r);
|
|
851
910
|
c && i.push({
|
|
852
911
|
startIndex: a,
|
|
853
912
|
endIndex: o,
|
|
@@ -863,7 +922,7 @@ function we(e, t, n, r = {}) {
|
|
|
863
922
|
}
|
|
864
923
|
//#endregion
|
|
865
924
|
//#region src/charts/MarketProfileRenderer.ts
|
|
866
|
-
var
|
|
925
|
+
var Oe = class {
|
|
867
926
|
visible = !1;
|
|
868
927
|
buckets = 48;
|
|
869
928
|
widthRatio = .18;
|
|
@@ -919,7 +978,7 @@ var Te = class {
|
|
|
919
978
|
this.lastStats = null, this.renderSplit(e, u, c, n, r);
|
|
920
979
|
return;
|
|
921
980
|
}
|
|
922
|
-
let d =
|
|
981
|
+
let d = we(u, s.min, s.max, {
|
|
923
982
|
buckets: this.buckets,
|
|
924
983
|
valueAreaPct: this.valueAreaPct
|
|
925
984
|
});
|
|
@@ -955,7 +1014,7 @@ var Te = class {
|
|
|
955
1014
|
this.showStats && this.drawStats(e, o.x + 6, o.y + 6, f, d.valueAreaHigh, d.valueAreaLow, r), e.restore();
|
|
956
1015
|
}
|
|
957
1016
|
renderSplit(e, t, n, r, i) {
|
|
958
|
-
let { chartRect: a, priceRange: o } = r, s =
|
|
1017
|
+
let { chartRect: a, priceRange: o } = r, s = De(t, o.min, o.max, {
|
|
959
1018
|
buckets: this.buckets,
|
|
960
1019
|
valueAreaPct: this.valueAreaPct
|
|
961
1020
|
});
|
|
@@ -963,7 +1022,7 @@ var Te = class {
|
|
|
963
1022
|
let c = o.max - o.min, l = (e) => a.y + a.height * (1 - (e - o.min) / c), u = r.barWidth / 2;
|
|
964
1023
|
e.save();
|
|
965
1024
|
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 = _ ?
|
|
1025
|
+
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
1026
|
if (_ && v) {
|
|
968
1027
|
e.font = `${Math.min(11, Math.floor(f))}px ui-monospace, monospace`, e.textBaseline = "middle", e.textAlign = "left";
|
|
969
1028
|
let t = Math.max(1, Math.floor(h / 6));
|
|
@@ -973,7 +1032,7 @@ var Te = class {
|
|
|
973
1032
|
let o = a.y + a.height - (n + .5) * f, c = s.buckets[n].mid >= s.valueAreaLow && s.buckets[n].mid <= s.valueAreaHigh;
|
|
974
1033
|
e.globalAlpha = c ? .95 : .6, e.fillStyle = c ? i.candleUp : i.textSecondary;
|
|
975
1034
|
let l = Math.min(r.length, t);
|
|
976
|
-
for (let t = 0; t < l; t++) e.fillText(
|
|
1035
|
+
for (let t = 0; t < l; t++) e.fillText(Te(r[t]), p + t * 6, o);
|
|
977
1036
|
}
|
|
978
1037
|
} else for (let t = 0; t < d; t++) {
|
|
979
1038
|
let n = s.buckets[t];
|
|
@@ -989,7 +1048,7 @@ var Te = class {
|
|
|
989
1048
|
e.restore();
|
|
990
1049
|
}
|
|
991
1050
|
drawStats(e, t, n, r, i, a, o) {
|
|
992
|
-
let s =
|
|
1051
|
+
let s = ke(r), c = [
|
|
993
1052
|
[
|
|
994
1053
|
"POC",
|
|
995
1054
|
r.toFixed(s),
|
|
@@ -1010,22 +1069,22 @@ var Te = class {
|
|
|
1010
1069
|
let l = 0;
|
|
1011
1070
|
for (let [, t] of c) l = Math.max(l, e.measureText(t).width);
|
|
1012
1071
|
let u = 38 + l, d = 6 + c.length * 14;
|
|
1013
|
-
e.fillStyle = o.background, e.globalAlpha = .82,
|
|
1072
|
+
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
1073
|
let c = n + 6 / 2 + 14 / 2 + s * 14;
|
|
1015
1074
|
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
1075
|
}), e.textAlign = "left";
|
|
1017
1076
|
}
|
|
1018
1077
|
};
|
|
1019
|
-
function
|
|
1078
|
+
function ke(e) {
|
|
1020
1079
|
let t = Math.abs(e);
|
|
1021
1080
|
return t >= 1e3 ? 2 : t >= 1 ? 4 : 6;
|
|
1022
1081
|
}
|
|
1023
|
-
function
|
|
1082
|
+
function Ae(e, t, n, r, i, a) {
|
|
1024
1083
|
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
1084
|
}
|
|
1026
1085
|
//#endregion
|
|
1027
1086
|
//#region src/charts/periodLevels.ts
|
|
1028
|
-
function
|
|
1087
|
+
function je(e, t) {
|
|
1029
1088
|
let n = t === "day" ? "1d" : "1w", r = [];
|
|
1030
1089
|
for (let t of e) {
|
|
1031
1090
|
let e = b(t.time, n), i = r[r.length - 1];
|
|
@@ -1039,8 +1098,8 @@ function Oe(e, t) {
|
|
|
1039
1098
|
}
|
|
1040
1099
|
return r;
|
|
1041
1100
|
}
|
|
1042
|
-
function
|
|
1043
|
-
let n =
|
|
1101
|
+
function Me(e, t = "day") {
|
|
1102
|
+
let n = je(e, t);
|
|
1044
1103
|
if (n.length < 2) return [];
|
|
1045
1104
|
let r = n[n.length - 2], i = n[n.length - 1], a = t === "day" ? "D" : "W";
|
|
1046
1105
|
return [
|
|
@@ -1068,7 +1127,7 @@ function ke(e, t = "day") {
|
|
|
1068
1127
|
}
|
|
1069
1128
|
//#endregion
|
|
1070
1129
|
//#region src/charts/PeriodLevelsRenderer.ts
|
|
1071
|
-
var
|
|
1130
|
+
var Ne = class {
|
|
1072
1131
|
visible = !1;
|
|
1073
1132
|
period = "day";
|
|
1074
1133
|
setVisible(e) {
|
|
@@ -1085,14 +1144,14 @@ var Ae = class {
|
|
|
1085
1144
|
}
|
|
1086
1145
|
render(e, t, n, r) {
|
|
1087
1146
|
if (!this.visible || t.length === 0) return;
|
|
1088
|
-
let i =
|
|
1147
|
+
let i = Me(t, this.period);
|
|
1089
1148
|
if (i.length === 0) return;
|
|
1090
1149
|
let { chartRect: a } = n, o = a.y, s = a.y + a.height;
|
|
1091
1150
|
e.save(), e.font = `600 10px ${r.font.family}`, e.textBaseline = "middle";
|
|
1092
1151
|
for (let t of i) {
|
|
1093
1152
|
let i = k(t.price, n);
|
|
1094
1153
|
if (i < o || i > s) continue;
|
|
1095
|
-
let c =
|
|
1154
|
+
let c = Pe(t, r);
|
|
1096
1155
|
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
1156
|
let l = t.label, u = e.measureText(l).width, d = a.x + a.width - u - 10;
|
|
1098
1157
|
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 +1159,12 @@ var Ae = class {
|
|
|
1100
1159
|
e.restore();
|
|
1101
1160
|
}
|
|
1102
1161
|
};
|
|
1103
|
-
function
|
|
1162
|
+
function Pe(e, t) {
|
|
1104
1163
|
return e.id.endsWith("h") ? t.candleUp : e.id.endsWith("l") ? t.candleDown : t.textSecondary;
|
|
1105
1164
|
}
|
|
1106
1165
|
//#endregion
|
|
1107
1166
|
//#region src/charts/pivots.ts
|
|
1108
|
-
function
|
|
1167
|
+
function Fe(e) {
|
|
1109
1168
|
let t, n;
|
|
1110
1169
|
return e.map((e) => {
|
|
1111
1170
|
let r;
|
|
@@ -1115,7 +1174,7 @@ function Me(e) {
|
|
|
1115
1174
|
};
|
|
1116
1175
|
});
|
|
1117
1176
|
}
|
|
1118
|
-
function
|
|
1177
|
+
function Ie(e, t = 5, n = 5) {
|
|
1119
1178
|
let r = Math.max(1, Math.floor(t)), i = Math.max(1, Math.floor(n)), a = [];
|
|
1120
1179
|
for (let t = r; t < e.length - i; t++) {
|
|
1121
1180
|
let n = e[t].high, o = e[t].low, s = !0, c = !0;
|
|
@@ -1134,7 +1193,7 @@ function Ne(e, t = 5, n = 5) {
|
|
|
1134
1193
|
}
|
|
1135
1194
|
//#endregion
|
|
1136
1195
|
//#region src/charts/PivotMarkersRenderer.ts
|
|
1137
|
-
var
|
|
1196
|
+
var Le = class {
|
|
1138
1197
|
visible = !1;
|
|
1139
1198
|
left = 5;
|
|
1140
1199
|
right = 5;
|
|
@@ -1157,27 +1216,27 @@ var Pe = class {
|
|
|
1157
1216
|
}
|
|
1158
1217
|
render(e, t, n, r) {
|
|
1159
1218
|
if (!this.visible || t.length === 0) return;
|
|
1160
|
-
let i =
|
|
1219
|
+
let i = Ie(t, this.left, this.right);
|
|
1161
1220
|
if (i.length === 0) return;
|
|
1162
|
-
let a = this.structureLabels ?
|
|
1221
|
+
let a = this.structureLabels ? Fe(i) : i, { from: o, to: s } = n.visibleRange;
|
|
1163
1222
|
e.save(), e.font = `10px ${r.font.family}`, e.textAlign = "center";
|
|
1164
1223
|
for (let t of a) {
|
|
1165
1224
|
if (t.index < o - 1 || t.index > s + 1) continue;
|
|
1166
1225
|
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
1226
|
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 ?
|
|
1227
|
+
let d = this.structureLabels && "label" in t ? String(t.label) : this.showLabels ? Re(t.price) : null;
|
|
1169
1228
|
d && (e.textBaseline = c ? "bottom" : "top", e.fillText(d, i, c ? u - 5 - 1 : u + 5 + 1));
|
|
1170
1229
|
}
|
|
1171
1230
|
e.restore();
|
|
1172
1231
|
}
|
|
1173
1232
|
};
|
|
1174
|
-
function
|
|
1233
|
+
function Re(e) {
|
|
1175
1234
|
let t = Math.abs(e);
|
|
1176
1235
|
return t >= 1e3 || t >= 1 ? e.toFixed(2) : e.toPrecision(4);
|
|
1177
1236
|
}
|
|
1178
1237
|
//#endregion
|
|
1179
1238
|
//#region src/charts/DepthHeatmapBuffer.ts
|
|
1180
|
-
var
|
|
1239
|
+
var ze = class {
|
|
1181
1240
|
buffer = [];
|
|
1182
1241
|
constructor(e = 240) {
|
|
1183
1242
|
this.capacity = e, this.capacity = Math.max(1, Math.floor(e));
|
|
@@ -1210,8 +1269,8 @@ var Ie = class {
|
|
|
1210
1269
|
get size() {
|
|
1211
1270
|
return this.buffer.length;
|
|
1212
1271
|
}
|
|
1213
|
-
},
|
|
1214
|
-
buffer = new
|
|
1272
|
+
}, Be = class {
|
|
1273
|
+
buffer = new ze(240);
|
|
1215
1274
|
visible = !1;
|
|
1216
1275
|
opacity = .7;
|
|
1217
1276
|
setVisible(e) {
|
|
@@ -1250,7 +1309,7 @@ var Ie = class {
|
|
|
1250
1309
|
}
|
|
1251
1310
|
drawSide(e, t, n, r, i, a, o, s, c) {
|
|
1252
1311
|
if (t.length === 0) return;
|
|
1253
|
-
let l =
|
|
1312
|
+
let l = Ve(t, a);
|
|
1254
1313
|
e.fillStyle = n;
|
|
1255
1314
|
for (let n of t) {
|
|
1256
1315
|
let t = k(n.price, a);
|
|
@@ -1259,7 +1318,7 @@ var Ie = class {
|
|
|
1259
1318
|
e.globalAlpha = 1;
|
|
1260
1319
|
}
|
|
1261
1320
|
};
|
|
1262
|
-
function
|
|
1321
|
+
function Ve(e, t) {
|
|
1263
1322
|
if (e.length < 2) return 3;
|
|
1264
1323
|
let n = e.map((e) => e.price).sort((e, t) => e - t), r = [];
|
|
1265
1324
|
for (let e = 1; e < n.length; e++) {
|
|
@@ -1273,7 +1332,7 @@ function Re(e, t) {
|
|
|
1273
1332
|
}
|
|
1274
1333
|
//#endregion
|
|
1275
1334
|
//#region src/charts/CompareRenderer.ts
|
|
1276
|
-
var
|
|
1335
|
+
var He = class {
|
|
1277
1336
|
symbols = /* @__PURE__ */ new Map();
|
|
1278
1337
|
mode = "percent";
|
|
1279
1338
|
setMode(e) {
|
|
@@ -1328,7 +1387,7 @@ var ze = class {
|
|
|
1328
1387
|
};
|
|
1329
1388
|
//#endregion
|
|
1330
1389
|
//#region src/charts/transforms/heikinAshi.ts
|
|
1331
|
-
function
|
|
1390
|
+
function Ue(e) {
|
|
1332
1391
|
if (e.length === 0) return [];
|
|
1333
1392
|
let t = [], n = e[0].open, r = (e[0].open + e[0].high + e[0].low + e[0].close) / 4;
|
|
1334
1393
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -1346,10 +1405,10 @@ function Be(e) {
|
|
|
1346
1405
|
}
|
|
1347
1406
|
//#endregion
|
|
1348
1407
|
//#region src/charts/transforms/renko.ts
|
|
1349
|
-
function
|
|
1408
|
+
function We(e, t) {
|
|
1350
1409
|
if (e.length === 0) return [];
|
|
1351
1410
|
let n = t.brickSize;
|
|
1352
|
-
t.useATR && e.length > (t.atrPeriod ?? 14) && (n =
|
|
1411
|
+
t.useATR && e.length > (t.atrPeriod ?? 14) && (n = Ge(e, t.atrPeriod ?? 14)), n <= 0 && (n = 1);
|
|
1353
1412
|
let r = [], i = Math.round(e[0].close / n) * n, a = e[0].time;
|
|
1354
1413
|
for (let t = 1; t < e.length; t++) {
|
|
1355
1414
|
let o = e[t].close - i, s = Math.floor(Math.abs(o) / n);
|
|
@@ -1370,7 +1429,7 @@ function Ve(e, t) {
|
|
|
1370
1429
|
}
|
|
1371
1430
|
return r;
|
|
1372
1431
|
}
|
|
1373
|
-
function
|
|
1432
|
+
function Ge(e, t) {
|
|
1374
1433
|
let n = 0;
|
|
1375
1434
|
for (let r = 1; r <= Math.min(t, e.length - 1); r++) {
|
|
1376
1435
|
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 +1439,7 @@ function He(e, t) {
|
|
|
1380
1439
|
}
|
|
1381
1440
|
//#endregion
|
|
1382
1441
|
//#region src/charts/transforms/lineBreak.ts
|
|
1383
|
-
function
|
|
1442
|
+
function Ke(e, t = 3) {
|
|
1384
1443
|
if (e.length === 0) return [];
|
|
1385
1444
|
let n = [], r = 0;
|
|
1386
1445
|
n.push({
|
|
@@ -1421,7 +1480,7 @@ function Ue(e, t = 3) {
|
|
|
1421
1480
|
}
|
|
1422
1481
|
//#endregion
|
|
1423
1482
|
//#region src/charts/transforms/kagi.ts
|
|
1424
|
-
function
|
|
1483
|
+
function qe(e, t = 4) {
|
|
1425
1484
|
if (e.length < 2) return e.slice();
|
|
1426
1485
|
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
1486
|
for (let c = 1; c < e.length; c++) {
|
|
@@ -1460,7 +1519,7 @@ function We(e, t = 4) {
|
|
|
1460
1519
|
}
|
|
1461
1520
|
//#endregion
|
|
1462
1521
|
//#region src/charts/transforms/pointAndFigure.ts
|
|
1463
|
-
function
|
|
1522
|
+
function Je(e, t, n = 3) {
|
|
1464
1523
|
if (e.length === 0 || t <= 0) return [];
|
|
1465
1524
|
let r = [], i = 0, a = 0, o = 0, s = 0, c = Math.round(e[0].close / t) * t;
|
|
1466
1525
|
a = c, o = c, i = 1;
|
|
@@ -1493,7 +1552,7 @@ function Ge(e, t, n = 3) {
|
|
|
1493
1552
|
}
|
|
1494
1553
|
//#endregion
|
|
1495
1554
|
//#region src/charts/transforms/rangeBars.ts
|
|
1496
|
-
function
|
|
1555
|
+
function Ye(e, t) {
|
|
1497
1556
|
if (e.length === 0 || t.rangeSize <= 0) return [];
|
|
1498
1557
|
let n = [], r = e[0].time, i = e[0].open, a = i, o = i, s = 0, c = (e, c) => {
|
|
1499
1558
|
for (e > a && (a = e), e < o && (o = e), s += c; a - o >= t.rangeSize;) {
|
|
@@ -1559,7 +1618,7 @@ var I = class {
|
|
|
1559
1618
|
}
|
|
1560
1619
|
return i;
|
|
1561
1620
|
}
|
|
1562
|
-
},
|
|
1621
|
+
}, Xe = 1, Ze = class {
|
|
1563
1622
|
registry = /* @__PURE__ */ new Map();
|
|
1564
1623
|
instances = /* @__PURE__ */ new Map();
|
|
1565
1624
|
register(e) {
|
|
@@ -1571,7 +1630,7 @@ var I = class {
|
|
|
1571
1630
|
addIndicator(e, t = {}, n) {
|
|
1572
1631
|
let r = this.registry.get(e);
|
|
1573
1632
|
if (!r) throw Error(`Unknown indicator: ${e}`);
|
|
1574
|
-
let i = `tc_${e}_${
|
|
1633
|
+
let i = `tc_${e}_${Xe++}`, a = {
|
|
1575
1634
|
id: e,
|
|
1576
1635
|
instanceId: i,
|
|
1577
1636
|
params: {
|
|
@@ -1689,7 +1748,7 @@ function R(e, t, n, r = 1) {
|
|
|
1689
1748
|
}
|
|
1690
1749
|
//#endregion
|
|
1691
1750
|
//#region src/indicators/overlay/SMA.ts
|
|
1692
|
-
var
|
|
1751
|
+
var Qe = class extends I {
|
|
1693
1752
|
descriptor = {
|
|
1694
1753
|
id: "sma",
|
|
1695
1754
|
name: "Simple Moving Average",
|
|
@@ -1721,7 +1780,7 @@ var Ye = class extends I {
|
|
|
1721
1780
|
}
|
|
1722
1781
|
e.stroke();
|
|
1723
1782
|
}
|
|
1724
|
-
},
|
|
1783
|
+
}, $e = class extends I {
|
|
1725
1784
|
descriptor = {
|
|
1726
1785
|
id: "ema",
|
|
1727
1786
|
name: "Exponential Moving Average",
|
|
@@ -1758,7 +1817,7 @@ var Ye = class extends I {
|
|
|
1758
1817
|
}
|
|
1759
1818
|
e.stroke();
|
|
1760
1819
|
}
|
|
1761
|
-
},
|
|
1820
|
+
}, et = class extends I {
|
|
1762
1821
|
descriptor = {
|
|
1763
1822
|
id: "bb",
|
|
1764
1823
|
name: "Bollinger Bands",
|
|
@@ -1813,7 +1872,7 @@ var Ye = class extends I {
|
|
|
1813
1872
|
e.stroke();
|
|
1814
1873
|
}
|
|
1815
1874
|
}
|
|
1816
|
-
},
|
|
1875
|
+
}, tt = class extends I {
|
|
1817
1876
|
descriptor = {
|
|
1818
1877
|
id: "vwap",
|
|
1819
1878
|
name: "Volume Weighted Average Price",
|
|
@@ -1848,7 +1907,7 @@ var Ye = class extends I {
|
|
|
1848
1907
|
}
|
|
1849
1908
|
e.stroke();
|
|
1850
1909
|
}
|
|
1851
|
-
},
|
|
1910
|
+
}, nt = class extends I {
|
|
1852
1911
|
descriptor = {
|
|
1853
1912
|
id: "ichimoku",
|
|
1854
1913
|
name: "Ichimoku Cloud",
|
|
@@ -1908,7 +1967,7 @@ var Ye = class extends I {
|
|
|
1908
1967
|
};
|
|
1909
1968
|
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
1969
|
}
|
|
1911
|
-
},
|
|
1970
|
+
}, rt = class extends I {
|
|
1912
1971
|
descriptor = {
|
|
1913
1972
|
id: "psar",
|
|
1914
1973
|
name: "Parabolic SAR",
|
|
@@ -1954,7 +2013,7 @@ var Ye = class extends I {
|
|
|
1954
2013
|
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
2014
|
}
|
|
1956
2015
|
}
|
|
1957
|
-
},
|
|
2016
|
+
}, it = class extends I {
|
|
1958
2017
|
descriptor = {
|
|
1959
2018
|
id: "supertrend",
|
|
1960
2019
|
name: "Supertrend",
|
|
@@ -2002,7 +2061,7 @@ var Ye = class extends I {
|
|
|
2002
2061
|
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
2062
|
}
|
|
2004
2063
|
}
|
|
2005
|
-
},
|
|
2064
|
+
}, at = class extends I {
|
|
2006
2065
|
descriptor = {
|
|
2007
2066
|
id: "keltner",
|
|
2008
2067
|
name: "Keltner Channel",
|
|
@@ -2059,7 +2118,7 @@ var Ye = class extends I {
|
|
|
2059
2118
|
}
|
|
2060
2119
|
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
2120
|
}
|
|
2062
|
-
},
|
|
2121
|
+
}, ot = class extends I {
|
|
2063
2122
|
descriptor = {
|
|
2064
2123
|
id: "donchian",
|
|
2065
2124
|
name: "Donchian Channel",
|
|
@@ -2104,7 +2163,7 @@ var Ye = class extends I {
|
|
|
2104
2163
|
}
|
|
2105
2164
|
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
2165
|
}
|
|
2107
|
-
},
|
|
2166
|
+
}, st = [
|
|
2108
2167
|
"s3",
|
|
2109
2168
|
"s2",
|
|
2110
2169
|
"s1",
|
|
@@ -2112,7 +2171,7 @@ var Ye = class extends I {
|
|
|
2112
2171
|
"r1",
|
|
2113
2172
|
"r2",
|
|
2114
2173
|
"r3"
|
|
2115
|
-
],
|
|
2174
|
+
], ct = class extends I {
|
|
2116
2175
|
descriptor = {
|
|
2117
2176
|
id: "pivots",
|
|
2118
2177
|
name: "Pivot Points (Classic)",
|
|
@@ -2148,7 +2207,7 @@ var Ye = class extends I {
|
|
|
2148
2207
|
let i = t.series;
|
|
2149
2208
|
if (!i) return;
|
|
2150
2209
|
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
|
|
2210
|
+
for (let t of st) {
|
|
2152
2211
|
e.beginPath(), e.strokeStyle = d(t), e.lineWidth = t === "pp" ? u : Math.max(1, u - 1), t !== "pp" && e.setLineDash([4, 3]);
|
|
2153
2212
|
let r = !1;
|
|
2154
2213
|
for (let s = a; s <= o && s < i.length; s++) {
|
|
@@ -2160,7 +2219,7 @@ var Ye = class extends I {
|
|
|
2160
2219
|
e.stroke(), e.setLineDash([]);
|
|
2161
2220
|
}
|
|
2162
2221
|
}
|
|
2163
|
-
},
|
|
2222
|
+
}, lt = class extends I {
|
|
2164
2223
|
descriptor = {
|
|
2165
2224
|
id: "avwap",
|
|
2166
2225
|
name: "Anchored VWAP",
|
|
@@ -2200,7 +2259,7 @@ var Ye = class extends I {
|
|
|
2200
2259
|
}
|
|
2201
2260
|
e.stroke();
|
|
2202
2261
|
}
|
|
2203
|
-
},
|
|
2262
|
+
}, ut = class extends I {
|
|
2204
2263
|
descriptor = {
|
|
2205
2264
|
id: "zigzag",
|
|
2206
2265
|
name: "ZigZag",
|
|
@@ -2265,7 +2324,7 @@ var Ye = class extends I {
|
|
|
2265
2324
|
e.stroke();
|
|
2266
2325
|
}
|
|
2267
2326
|
}
|
|
2268
|
-
},
|
|
2327
|
+
}, dt = class extends I {
|
|
2269
2328
|
descriptor = {
|
|
2270
2329
|
id: "lrc",
|
|
2271
2330
|
name: "Linear Regression Channel",
|
|
@@ -2328,7 +2387,7 @@ var Ye = class extends I {
|
|
|
2328
2387
|
}
|
|
2329
2388
|
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
2389
|
}
|
|
2331
|
-
},
|
|
2390
|
+
}, ft = class extends I {
|
|
2332
2391
|
descriptor = {
|
|
2333
2392
|
id: "hma",
|
|
2334
2393
|
name: "Hull Moving Average",
|
|
@@ -2341,7 +2400,7 @@ var Ye = class extends I {
|
|
|
2341
2400
|
values: r,
|
|
2342
2401
|
series: i
|
|
2343
2402
|
};
|
|
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 =
|
|
2403
|
+
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
2404
|
for (let t = 0; t < e.length; t++) {
|
|
2346
2405
|
if (u[t] === null) continue;
|
|
2347
2406
|
let n = { value: u[t] };
|
|
@@ -2367,7 +2426,7 @@ var Ye = class extends I {
|
|
|
2367
2426
|
e.stroke();
|
|
2368
2427
|
}
|
|
2369
2428
|
};
|
|
2370
|
-
function
|
|
2429
|
+
function pt(e, t) {
|
|
2371
2430
|
let n = Array(e.length).fill(null);
|
|
2372
2431
|
if (e.length < t) return n;
|
|
2373
2432
|
let r = t * (t + 1) / 2;
|
|
@@ -2378,7 +2437,7 @@ function ut(e, t) {
|
|
|
2378
2437
|
}
|
|
2379
2438
|
return n;
|
|
2380
2439
|
}
|
|
2381
|
-
function
|
|
2440
|
+
function mt(e, t) {
|
|
2382
2441
|
let n = Array(e.length).fill(null), r = t * (t + 1) / 2;
|
|
2383
2442
|
for (let i = t - 1; i < e.length; i++) {
|
|
2384
2443
|
let a = 0, o = !0;
|
|
@@ -2396,7 +2455,7 @@ function dt(e, t) {
|
|
|
2396
2455
|
}
|
|
2397
2456
|
//#endregion
|
|
2398
2457
|
//#region src/indicators/overlay/MTFMovingAverage.ts
|
|
2399
|
-
var
|
|
2458
|
+
var ht = class extends I {
|
|
2400
2459
|
descriptor = {
|
|
2401
2460
|
id: "mtfma",
|
|
2402
2461
|
name: "MTF Moving Average",
|
|
@@ -2444,7 +2503,7 @@ var ft = class extends I {
|
|
|
2444
2503
|
}
|
|
2445
2504
|
e.stroke();
|
|
2446
2505
|
}
|
|
2447
|
-
},
|
|
2506
|
+
}, gt = class extends I {
|
|
2448
2507
|
descriptor = {
|
|
2449
2508
|
id: "svwap",
|
|
2450
2509
|
name: "Session VWAP",
|
|
@@ -2501,7 +2560,7 @@ var ft = class extends I {
|
|
|
2501
2560
|
}
|
|
2502
2561
|
e.stroke();
|
|
2503
2562
|
}
|
|
2504
|
-
},
|
|
2563
|
+
}, _t = class extends I {
|
|
2505
2564
|
descriptor = {
|
|
2506
2565
|
id: "chandelier",
|
|
2507
2566
|
name: "Chandelier Exit",
|
|
@@ -2559,7 +2618,7 @@ var ft = class extends I {
|
|
|
2559
2618
|
};
|
|
2560
2619
|
s("long", r.colors[0] ?? "#26A69A"), s("short", r.colors[1] ?? "#EF5350");
|
|
2561
2620
|
}
|
|
2562
|
-
},
|
|
2621
|
+
}, vt = class extends I {
|
|
2563
2622
|
descriptor = {
|
|
2564
2623
|
id: "alligator",
|
|
2565
2624
|
name: "Alligator",
|
|
@@ -2579,7 +2638,7 @@ var ft = class extends I {
|
|
|
2579
2638
|
values: c,
|
|
2580
2639
|
series: u
|
|
2581
2640
|
};
|
|
2582
|
-
let d = e.map((e) => (e.high + e.low) / 2), f =
|
|
2641
|
+
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
2642
|
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
2643
|
for (let t = 0; t < l; t++) {
|
|
2585
2644
|
if (h[t] === void 0 && g[t] === void 0 && _[t] === void 0) continue;
|
|
@@ -2611,7 +2670,7 @@ var ft = class extends I {
|
|
|
2611
2670
|
s("jaw", r.colors[0] ?? "#2962FF"), s("teeth", r.colors[1] ?? "#EF5350"), s("lips", r.colors[2] ?? "#26A69A");
|
|
2612
2671
|
}
|
|
2613
2672
|
};
|
|
2614
|
-
function
|
|
2673
|
+
function yt(e, t) {
|
|
2615
2674
|
let n = e.length, r = Array(n).fill(void 0);
|
|
2616
2675
|
if (n < t) return r;
|
|
2617
2676
|
let i = 0;
|
|
@@ -2623,7 +2682,7 @@ function gt(e, t) {
|
|
|
2623
2682
|
}
|
|
2624
2683
|
//#endregion
|
|
2625
2684
|
//#region src/indicators/panel/AwesomeOscillator.ts
|
|
2626
|
-
var
|
|
2685
|
+
var bt = class extends I {
|
|
2627
2686
|
descriptor = {
|
|
2628
2687
|
id: "ao",
|
|
2629
2688
|
name: "Awesome Oscillator",
|
|
@@ -2671,7 +2730,7 @@ var _t = class extends I {
|
|
|
2671
2730
|
e.fillStyle = r.up ? m : h, e.fillRect(a - p, s, n.barWidth, c);
|
|
2672
2731
|
}
|
|
2673
2732
|
}
|
|
2674
|
-
},
|
|
2733
|
+
}, xt = class extends I {
|
|
2675
2734
|
descriptor = {
|
|
2676
2735
|
id: "chaikinOsc",
|
|
2677
2736
|
name: "Chaikin Oscillator",
|
|
@@ -2720,7 +2779,7 @@ var _t = class extends I {
|
|
|
2720
2779
|
e.fillStyle = r.value >= 0 ? m : h, e.fillRect(a - p, s, n.barWidth, c);
|
|
2721
2780
|
}
|
|
2722
2781
|
}
|
|
2723
|
-
},
|
|
2782
|
+
}, St = class extends I {
|
|
2724
2783
|
descriptor = {
|
|
2725
2784
|
id: "rsi",
|
|
2726
2785
|
name: "Relative Strength Index",
|
|
@@ -2771,7 +2830,7 @@ var _t = class extends I {
|
|
|
2771
2830
|
}
|
|
2772
2831
|
e.stroke();
|
|
2773
2832
|
}
|
|
2774
|
-
},
|
|
2833
|
+
}, Ct = class extends I {
|
|
2775
2834
|
descriptor = {
|
|
2776
2835
|
id: "macd",
|
|
2777
2836
|
name: "MACD",
|
|
@@ -2838,7 +2897,7 @@ var _t = class extends I {
|
|
|
2838
2897
|
}
|
|
2839
2898
|
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
2899
|
}
|
|
2841
|
-
},
|
|
2900
|
+
}, wt = class extends I {
|
|
2842
2901
|
descriptor = {
|
|
2843
2902
|
id: "stochastic",
|
|
2844
2903
|
name: "Stochastic Oscillator",
|
|
@@ -2913,7 +2972,7 @@ var _t = class extends I {
|
|
|
2913
2972
|
};
|
|
2914
2973
|
l("k", r.colors[0]), l("d", r.colors[1] ?? "#FF9800");
|
|
2915
2974
|
}
|
|
2916
|
-
},
|
|
2975
|
+
}, Tt = class extends I {
|
|
2917
2976
|
descriptor = {
|
|
2918
2977
|
id: "atr",
|
|
2919
2978
|
name: "Average True Range",
|
|
@@ -2967,7 +3026,7 @@ var _t = class extends I {
|
|
|
2967
3026
|
}
|
|
2968
3027
|
e.stroke();
|
|
2969
3028
|
}
|
|
2970
|
-
},
|
|
3029
|
+
}, Et = class extends I {
|
|
2971
3030
|
descriptor = {
|
|
2972
3031
|
id: "adx",
|
|
2973
3032
|
name: "Average Directional Index",
|
|
@@ -3040,7 +3099,7 @@ var _t = class extends I {
|
|
|
3040
3099
|
};
|
|
3041
3100
|
l("adx", r.colors[0]), l("plusDI", r.colors[1] ?? "#26A69A"), l("minusDI", r.colors[2] ?? "#EF5350");
|
|
3042
3101
|
}
|
|
3043
|
-
},
|
|
3102
|
+
}, Dt = class extends I {
|
|
3044
3103
|
descriptor = {
|
|
3045
3104
|
id: "obv",
|
|
3046
3105
|
name: "On Balance Volume",
|
|
@@ -3086,7 +3145,7 @@ var _t = class extends I {
|
|
|
3086
3145
|
}
|
|
3087
3146
|
e.stroke();
|
|
3088
3147
|
}
|
|
3089
|
-
},
|
|
3148
|
+
}, Ot = class extends I {
|
|
3090
3149
|
descriptor = {
|
|
3091
3150
|
id: "williamsR",
|
|
3092
3151
|
name: "Williams %R",
|
|
@@ -3126,7 +3185,7 @@ var _t = class extends I {
|
|
|
3126
3185
|
}
|
|
3127
3186
|
e.stroke();
|
|
3128
3187
|
}
|
|
3129
|
-
},
|
|
3188
|
+
}, kt = class extends I {
|
|
3130
3189
|
descriptor = {
|
|
3131
3190
|
id: "cci",
|
|
3132
3191
|
name: "Commodity Channel Index",
|
|
@@ -3181,7 +3240,7 @@ var _t = class extends I {
|
|
|
3181
3240
|
}
|
|
3182
3241
|
e.stroke();
|
|
3183
3242
|
}
|
|
3184
|
-
},
|
|
3243
|
+
}, At = class extends I {
|
|
3185
3244
|
descriptor = {
|
|
3186
3245
|
id: "mfi",
|
|
3187
3246
|
name: "Money Flow Index",
|
|
@@ -3226,7 +3285,7 @@ var _t = class extends I {
|
|
|
3226
3285
|
}
|
|
3227
3286
|
e.stroke();
|
|
3228
3287
|
}
|
|
3229
|
-
},
|
|
3288
|
+
}, jt = class extends I {
|
|
3230
3289
|
descriptor = {
|
|
3231
3290
|
id: "aroon",
|
|
3232
3291
|
name: "Aroon",
|
|
@@ -3268,7 +3327,7 @@ var _t = class extends I {
|
|
|
3268
3327
|
};
|
|
3269
3328
|
l("up", r.colors[0]), l("down", r.colors[1] ?? "#EF5350");
|
|
3270
3329
|
}
|
|
3271
|
-
},
|
|
3330
|
+
}, Mt = class extends I {
|
|
3272
3331
|
descriptor = {
|
|
3273
3332
|
id: "roc",
|
|
3274
3333
|
name: "Rate of Change",
|
|
@@ -3312,7 +3371,7 @@ var _t = class extends I {
|
|
|
3312
3371
|
}
|
|
3313
3372
|
e.stroke();
|
|
3314
3373
|
}
|
|
3315
|
-
},
|
|
3374
|
+
}, Nt = class extends I {
|
|
3316
3375
|
descriptor = {
|
|
3317
3376
|
id: "tsi",
|
|
3318
3377
|
name: "True Strength Index",
|
|
@@ -3381,7 +3440,7 @@ var _t = class extends I {
|
|
|
3381
3440
|
};
|
|
3382
3441
|
h("tsi", r.colors[0]), h("signal", r.colors[1] ?? "#FF9800");
|
|
3383
3442
|
}
|
|
3384
|
-
},
|
|
3443
|
+
}, Pt = class extends I {
|
|
3385
3444
|
descriptor = {
|
|
3386
3445
|
id: "cmf",
|
|
3387
3446
|
name: "Chaikin Money Flow",
|
|
@@ -3426,7 +3485,7 @@ var _t = class extends I {
|
|
|
3426
3485
|
}
|
|
3427
3486
|
}
|
|
3428
3487
|
}
|
|
3429
|
-
},
|
|
3488
|
+
}, Ft = class extends I {
|
|
3430
3489
|
descriptor = {
|
|
3431
3490
|
id: "voldelta",
|
|
3432
3491
|
name: "Volume Delta",
|
|
@@ -3466,7 +3525,7 @@ var _t = class extends I {
|
|
|
3466
3525
|
e.fillStyle = r.up ? f : p, e.fillRect(a - d, s, n.barWidth, c);
|
|
3467
3526
|
}
|
|
3468
3527
|
}
|
|
3469
|
-
},
|
|
3528
|
+
}, It = class extends I {
|
|
3470
3529
|
descriptor = {
|
|
3471
3530
|
id: "vortex",
|
|
3472
3531
|
name: "Vortex Indicator",
|
|
@@ -3531,7 +3590,7 @@ var _t = class extends I {
|
|
|
3531
3590
|
};
|
|
3532
3591
|
p("viPlus", r.colors[0] ?? "#26A69A"), p("viMinus", r.colors[1] ?? "#EF5350");
|
|
3533
3592
|
}
|
|
3534
|
-
},
|
|
3593
|
+
}, Lt = class extends I {
|
|
3535
3594
|
descriptor = {
|
|
3536
3595
|
id: "chop",
|
|
3537
3596
|
name: "Choppiness Index",
|
|
@@ -3583,7 +3642,7 @@ var _t = class extends I {
|
|
|
3583
3642
|
}
|
|
3584
3643
|
e.stroke();
|
|
3585
3644
|
}
|
|
3586
|
-
},
|
|
3645
|
+
}, Rt = class extends I {
|
|
3587
3646
|
descriptor = {
|
|
3588
3647
|
id: "uo",
|
|
3589
3648
|
name: "Ultimate Oscillator",
|
|
@@ -3611,7 +3670,7 @@ var _t = class extends I {
|
|
|
3611
3670
|
return r;
|
|
3612
3671
|
};
|
|
3613
3672
|
for (let t = i; t < e.length; t++) {
|
|
3614
|
-
let u =
|
|
3673
|
+
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
3674
|
a.set(e[t].time, p), o[t] = p;
|
|
3616
3675
|
}
|
|
3617
3676
|
return {
|
|
@@ -3639,12 +3698,12 @@ var _t = class extends I {
|
|
|
3639
3698
|
e.stroke();
|
|
3640
3699
|
}
|
|
3641
3700
|
};
|
|
3642
|
-
function
|
|
3701
|
+
function zt(e, t) {
|
|
3643
3702
|
return t === 0 ? 0 : e / t;
|
|
3644
3703
|
}
|
|
3645
3704
|
//#endregion
|
|
3646
3705
|
//#region src/indicators/panel/ForceIndex.ts
|
|
3647
|
-
var
|
|
3706
|
+
var Bt = class extends I {
|
|
3648
3707
|
descriptor = {
|
|
3649
3708
|
id: "fi",
|
|
3650
3709
|
name: "Force Index",
|
|
@@ -3690,7 +3749,7 @@ var Lt = class extends I {
|
|
|
3690
3749
|
}
|
|
3691
3750
|
e.stroke();
|
|
3692
3751
|
}
|
|
3693
|
-
},
|
|
3752
|
+
}, Vt = class extends I {
|
|
3694
3753
|
descriptor = {
|
|
3695
3754
|
id: "crsi",
|
|
3696
3755
|
name: "Connors RSI",
|
|
@@ -3707,9 +3766,9 @@ var Lt = class extends I {
|
|
|
3707
3766
|
values: a,
|
|
3708
3767
|
series: o
|
|
3709
3768
|
};
|
|
3710
|
-
let c = e.map((e) => e.close), l =
|
|
3769
|
+
let c = e.map((e) => e.close), l = Ht(c, n), u = Array(s).fill(0);
|
|
3711
3770
|
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 =
|
|
3771
|
+
let d = Ht(u, r), f = Array(s).fill(0);
|
|
3713
3772
|
for (let e = 1; e < s; e++) f[e] = c[e - 1] === 0 ? 0 : (c[e] - c[e - 1]) / c[e - 1] * 100;
|
|
3714
3773
|
for (let t = 0; t < s; t++) {
|
|
3715
3774
|
if (t < i + 1) continue;
|
|
@@ -3745,7 +3804,7 @@ var Lt = class extends I {
|
|
|
3745
3804
|
e.stroke();
|
|
3746
3805
|
}
|
|
3747
3806
|
};
|
|
3748
|
-
function
|
|
3807
|
+
function Ht(e, t) {
|
|
3749
3808
|
let n = e.length, r = Array(n).fill(void 0);
|
|
3750
3809
|
if (n <= t) return r;
|
|
3751
3810
|
let i = 0, a = 0;
|
|
@@ -3762,7 +3821,7 @@ function zt(e, t) {
|
|
|
3762
3821
|
}
|
|
3763
3822
|
//#endregion
|
|
3764
3823
|
//#region src/indicators/panel/Coppock.ts
|
|
3765
|
-
var
|
|
3824
|
+
var Ut = class extends I {
|
|
3766
3825
|
descriptor = {
|
|
3767
3826
|
id: "coppock",
|
|
3768
3827
|
name: "Coppock Curve",
|
|
@@ -3821,7 +3880,7 @@ var Bt = class extends I {
|
|
|
3821
3880
|
}
|
|
3822
3881
|
e.stroke();
|
|
3823
3882
|
}
|
|
3824
|
-
},
|
|
3883
|
+
}, Wt = class extends I {
|
|
3825
3884
|
descriptor = {
|
|
3826
3885
|
id: "kst",
|
|
3827
3886
|
name: "Know Sure Thing",
|
|
@@ -3844,9 +3903,9 @@ var Bt = class extends I {
|
|
|
3844
3903
|
values: d,
|
|
3845
3904
|
series: f
|
|
3846
3905
|
};
|
|
3847
|
-
let m = e.map((e) => e.close), h =
|
|
3906
|
+
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
3907
|
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 =
|
|
3908
|
+
let b = z(y, u);
|
|
3850
3909
|
for (let t = 0; t < p; t++) {
|
|
3851
3910
|
if (y[t] === void 0) continue;
|
|
3852
3911
|
let n = { value: y[t] };
|
|
@@ -3888,12 +3947,12 @@ var Bt = class extends I {
|
|
|
3888
3947
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
3889
3948
|
}
|
|
3890
3949
|
};
|
|
3891
|
-
function
|
|
3950
|
+
function Gt(e, t) {
|
|
3892
3951
|
let n = Array(e.length).fill(void 0);
|
|
3893
3952
|
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
3953
|
return n;
|
|
3895
3954
|
}
|
|
3896
|
-
function
|
|
3955
|
+
function z(e, t) {
|
|
3897
3956
|
let n = Array(e.length).fill(void 0);
|
|
3898
3957
|
for (let r = t - 1; r < e.length; r++) {
|
|
3899
3958
|
let i = 0, a = !0;
|
|
@@ -3911,7 +3970,7 @@ function B(e, t) {
|
|
|
3911
3970
|
}
|
|
3912
3971
|
//#endregion
|
|
3913
3972
|
//#region src/indicators/panel/ElderRay.ts
|
|
3914
|
-
var
|
|
3973
|
+
var Kt = class extends I {
|
|
3915
3974
|
descriptor = {
|
|
3916
3975
|
id: "elderray",
|
|
3917
3976
|
name: "Elder Ray",
|
|
@@ -3967,7 +4026,7 @@ var Ht = class extends I {
|
|
|
3967
4026
|
}
|
|
3968
4027
|
e.globalAlpha = 1;
|
|
3969
4028
|
}
|
|
3970
|
-
},
|
|
4029
|
+
}, qt = class extends I {
|
|
3971
4030
|
descriptor = {
|
|
3972
4031
|
id: "stc",
|
|
3973
4032
|
name: "Schaff Trend Cycle",
|
|
@@ -3986,7 +4045,7 @@ var Ht = class extends I {
|
|
|
3986
4045
|
};
|
|
3987
4046
|
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
4047
|
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 =
|
|
4048
|
+
let m = Jt(Jt(p, i), i);
|
|
3990
4049
|
for (let t = 0; t < s; t++) {
|
|
3991
4050
|
let n = m[t];
|
|
3992
4051
|
if (n === void 0) continue;
|
|
@@ -4018,7 +4077,7 @@ var Ht = class extends I {
|
|
|
4018
4077
|
e.stroke();
|
|
4019
4078
|
}
|
|
4020
4079
|
};
|
|
4021
|
-
function
|
|
4080
|
+
function Jt(e, t) {
|
|
4022
4081
|
let n = e.length, r = Array(n).fill(void 0), i;
|
|
4023
4082
|
for (let a = 0; a < n; a++) {
|
|
4024
4083
|
if (a < t - 1) continue;
|
|
@@ -4039,7 +4098,7 @@ function Wt(e, t) {
|
|
|
4039
4098
|
}
|
|
4040
4099
|
//#endregion
|
|
4041
4100
|
//#region src/indicators/panel/Klinger.ts
|
|
4042
|
-
var
|
|
4101
|
+
var Yt = class extends I {
|
|
4043
4102
|
descriptor = {
|
|
4044
4103
|
id: "kvo",
|
|
4045
4104
|
name: "Klinger Oscillator",
|
|
@@ -4106,7 +4165,7 @@ var Gt = class extends I {
|
|
|
4106
4165
|
};
|
|
4107
4166
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
4108
4167
|
}
|
|
4109
|
-
},
|
|
4168
|
+
}, Xt = class extends I {
|
|
4110
4169
|
descriptor = {
|
|
4111
4170
|
id: "fisher",
|
|
4112
4171
|
name: "Fisher Transform",
|
|
@@ -4167,7 +4226,7 @@ var Gt = class extends I {
|
|
|
4167
4226
|
};
|
|
4168
4227
|
d("value", r.colors[0] ?? "#2962FF"), d("trigger", r.colors[1] ?? "#FF9800");
|
|
4169
4228
|
}
|
|
4170
|
-
},
|
|
4229
|
+
}, Zt = class extends I {
|
|
4171
4230
|
descriptor = {
|
|
4172
4231
|
id: "dpo",
|
|
4173
4232
|
name: "Detrended Price Oscillator",
|
|
@@ -4209,7 +4268,7 @@ var Gt = class extends I {
|
|
|
4209
4268
|
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
4269
|
}
|
|
4211
4270
|
}
|
|
4212
|
-
},
|
|
4271
|
+
}, Qt = class extends I {
|
|
4213
4272
|
descriptor = {
|
|
4214
4273
|
id: "bop",
|
|
4215
4274
|
name: "Balance of Power",
|
|
@@ -4251,7 +4310,7 @@ var Gt = class extends I {
|
|
|
4251
4310
|
}
|
|
4252
4311
|
e.stroke();
|
|
4253
4312
|
}
|
|
4254
|
-
},
|
|
4313
|
+
}, $t = class extends I {
|
|
4255
4314
|
descriptor = {
|
|
4256
4315
|
id: "massindex",
|
|
4257
4316
|
name: "Mass Index",
|
|
@@ -4308,7 +4367,7 @@ var Gt = class extends I {
|
|
|
4308
4367
|
}
|
|
4309
4368
|
e.stroke();
|
|
4310
4369
|
}
|
|
4311
|
-
},
|
|
4370
|
+
}, en = class extends I {
|
|
4312
4371
|
descriptor = {
|
|
4313
4372
|
id: "cmo",
|
|
4314
4373
|
name: "Chande Momentum",
|
|
@@ -4359,7 +4418,7 @@ var Gt = class extends I {
|
|
|
4359
4418
|
}
|
|
4360
4419
|
e.stroke();
|
|
4361
4420
|
}
|
|
4362
|
-
},
|
|
4421
|
+
}, tn = class extends I {
|
|
4363
4422
|
descriptor = {
|
|
4364
4423
|
id: "trix",
|
|
4365
4424
|
name: "TRIX",
|
|
@@ -4375,9 +4434,9 @@ var Gt = class extends I {
|
|
|
4375
4434
|
values: i,
|
|
4376
4435
|
series: a
|
|
4377
4436
|
};
|
|
4378
|
-
let s =
|
|
4437
|
+
let s = B(B(B(e.map((e) => e.close), n), n), n), c = Array(o).fill(0);
|
|
4379
4438
|
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 =
|
|
4439
|
+
let l = B(c, r), u = 3 * n;
|
|
4381
4440
|
for (let t = u; t < o; t++) {
|
|
4382
4441
|
let n = {
|
|
4383
4442
|
value: c[t],
|
|
@@ -4421,7 +4480,7 @@ var Gt = class extends I {
|
|
|
4421
4480
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
4422
4481
|
}
|
|
4423
4482
|
};
|
|
4424
|
-
function
|
|
4483
|
+
function B(e, t) {
|
|
4425
4484
|
let n = 2 / (t + 1), r = Array(e.length).fill(0), i = e[0] ?? 0;
|
|
4426
4485
|
r[0] = i;
|
|
4427
4486
|
for (let t = 1; t < e.length; t++) i = e[t] * n + i * (1 - n), r[t] = i;
|
|
@@ -4429,7 +4488,7 @@ function V(e, t) {
|
|
|
4429
4488
|
}
|
|
4430
4489
|
//#endregion
|
|
4431
4490
|
//#region src/indicators/panel/EaseOfMovement.ts
|
|
4432
|
-
var
|
|
4491
|
+
var nn = class extends I {
|
|
4433
4492
|
descriptor = {
|
|
4434
4493
|
id: "emv",
|
|
4435
4494
|
name: "Ease of Movement",
|
|
@@ -4458,10 +4517,10 @@ var Qt = class extends I {
|
|
|
4458
4517
|
};
|
|
4459
4518
|
}
|
|
4460
4519
|
render(e, t, n, r) {
|
|
4461
|
-
|
|
4520
|
+
rn(e, t, n, r);
|
|
4462
4521
|
}
|
|
4463
4522
|
};
|
|
4464
|
-
function
|
|
4523
|
+
function rn(e, t, n, r) {
|
|
4465
4524
|
let i = t.series;
|
|
4466
4525
|
if (!i) return;
|
|
4467
4526
|
let { chartRect: a } = n, { from: o, to: s } = n.visibleRange, c = 0;
|
|
@@ -4483,7 +4542,7 @@ function H(e, t, n, r) {
|
|
|
4483
4542
|
}
|
|
4484
4543
|
//#endregion
|
|
4485
4544
|
//#region src/indicators/panel/WilliamsAD.ts
|
|
4486
|
-
var
|
|
4545
|
+
var an = class extends I {
|
|
4487
4546
|
descriptor = {
|
|
4488
4547
|
id: "wad",
|
|
4489
4548
|
name: "Williams A/D",
|
|
@@ -4510,10 +4569,10 @@ var $t = class extends I {
|
|
|
4510
4569
|
};
|
|
4511
4570
|
}
|
|
4512
4571
|
render(e, t, n, r) {
|
|
4513
|
-
|
|
4572
|
+
on(e, t, n, r, O);
|
|
4514
4573
|
}
|
|
4515
4574
|
};
|
|
4516
|
-
function
|
|
4575
|
+
function on(e, t, n, r, i) {
|
|
4517
4576
|
let a = t.series;
|
|
4518
4577
|
if (!a) return;
|
|
4519
4578
|
let { chartRect: o } = n, { from: s, to: c } = n.visibleRange, l = Infinity, u = -Infinity;
|
|
@@ -4535,7 +4594,7 @@ function en(e, t, n, r, i) {
|
|
|
4535
4594
|
}
|
|
4536
4595
|
//#endregion
|
|
4537
4596
|
//#region src/indicators/panel/PriceVolumeTrend.ts
|
|
4538
|
-
var
|
|
4597
|
+
var sn = class extends I {
|
|
4539
4598
|
descriptor = {
|
|
4540
4599
|
id: "pvt",
|
|
4541
4600
|
name: "Price Volume Trend",
|
|
@@ -4562,9 +4621,9 @@ var tn = class extends I {
|
|
|
4562
4621
|
};
|
|
4563
4622
|
}
|
|
4564
4623
|
render(e, t, n, r) {
|
|
4565
|
-
|
|
4624
|
+
on(e, t, n, r, O);
|
|
4566
4625
|
}
|
|
4567
|
-
},
|
|
4626
|
+
}, cn = class extends I {
|
|
4568
4627
|
descriptor = {
|
|
4569
4628
|
id: "chaikinvol",
|
|
4570
4629
|
name: "Chaikin Volatility",
|
|
@@ -4593,9 +4652,9 @@ var tn = class extends I {
|
|
|
4593
4652
|
};
|
|
4594
4653
|
}
|
|
4595
4654
|
render(e, t, n, r) {
|
|
4596
|
-
|
|
4655
|
+
rn(e, t, n, r);
|
|
4597
4656
|
}
|
|
4598
|
-
},
|
|
4657
|
+
}, ln = class extends I {
|
|
4599
4658
|
descriptor = {
|
|
4600
4659
|
id: "rvi",
|
|
4601
4660
|
name: "Relative Vigor Index",
|
|
@@ -4658,7 +4717,7 @@ var tn = class extends I {
|
|
|
4658
4717
|
};
|
|
4659
4718
|
d("value", r.colors[0] ?? "#2962FF"), d("signal", r.colors[1] ?? "#FF9800");
|
|
4660
4719
|
}
|
|
4661
|
-
},
|
|
4720
|
+
}, un = class extends I {
|
|
4662
4721
|
descriptor = {
|
|
4663
4722
|
id: "stochrsi",
|
|
4664
4723
|
name: "Stochastic RSI",
|
|
@@ -4676,7 +4735,7 @@ var tn = class extends I {
|
|
|
4676
4735
|
values: o,
|
|
4677
4736
|
series: s
|
|
4678
4737
|
};
|
|
4679
|
-
let l =
|
|
4738
|
+
let l = dn(e.map((e) => e.close), n), u = Array(c).fill(void 0);
|
|
4680
4739
|
for (let e = 0; e < c; e++) {
|
|
4681
4740
|
if (l[e] === void 0) continue;
|
|
4682
4741
|
let t = Infinity, n = -Infinity, i = !0;
|
|
@@ -4689,7 +4748,7 @@ var tn = class extends I {
|
|
|
4689
4748
|
}
|
|
4690
4749
|
i && (u[e] = n - t > 0 ? (l[e] - t) / (n - t) * 100 : 0);
|
|
4691
4750
|
}
|
|
4692
|
-
let d =
|
|
4751
|
+
let d = fn(u, i), f = fn(d, a);
|
|
4693
4752
|
for (let t = 0; t < c; t++) {
|
|
4694
4753
|
if (d[t] === void 0) continue;
|
|
4695
4754
|
let n = { k: d[t] };
|
|
@@ -4727,7 +4786,7 @@ var tn = class extends I {
|
|
|
4727
4786
|
l("k", r.colors[0] ?? "#2962FF"), l("d", r.colors[1] ?? "#FF9800");
|
|
4728
4787
|
}
|
|
4729
4788
|
};
|
|
4730
|
-
function
|
|
4789
|
+
function dn(e, t) {
|
|
4731
4790
|
let n = e.length, r = Array(n).fill(void 0);
|
|
4732
4791
|
if (n <= t) return r;
|
|
4733
4792
|
let i = 0, a = 0;
|
|
@@ -4742,7 +4801,7 @@ function on(e, t) {
|
|
|
4742
4801
|
}
|
|
4743
4802
|
return r;
|
|
4744
4803
|
}
|
|
4745
|
-
function
|
|
4804
|
+
function fn(e, t) {
|
|
4746
4805
|
let n = Array(e.length).fill(void 0);
|
|
4747
4806
|
for (let r = t - 1; r < e.length; r++) {
|
|
4748
4807
|
let i = 0, a = !0;
|
|
@@ -4759,7 +4818,7 @@ function sn(e, t) {
|
|
|
4759
4818
|
}
|
|
4760
4819
|
//#endregion
|
|
4761
4820
|
//#region src/indicators/panel/PercentagePriceOscillator.ts
|
|
4762
|
-
var
|
|
4821
|
+
var pn = class extends I {
|
|
4763
4822
|
descriptor = {
|
|
4764
4823
|
id: "ppo",
|
|
4765
4824
|
name: "Percentage Price Oscillator",
|
|
@@ -4776,9 +4835,9 @@ var cn = class extends I {
|
|
|
4776
4835
|
values: a,
|
|
4777
4836
|
series: o
|
|
4778
4837
|
};
|
|
4779
|
-
let c = e.map((e) => e.close), l =
|
|
4838
|
+
let c = e.map((e) => e.close), l = mn(c, n), u = mn(c, r), d = Array(s).fill(void 0);
|
|
4780
4839
|
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 =
|
|
4840
|
+
let f = mn(d, i);
|
|
4782
4841
|
for (let t = 0; t < s; t++) {
|
|
4783
4842
|
if (d[t] === void 0) continue;
|
|
4784
4843
|
let n = { value: d[t] };
|
|
@@ -4832,7 +4891,7 @@ var cn = class extends I {
|
|
|
4832
4891
|
f("value", r.colors[0] ?? "#2962FF"), f("signal", r.colors[1] ?? "#FF9800");
|
|
4833
4892
|
}
|
|
4834
4893
|
};
|
|
4835
|
-
function
|
|
4894
|
+
function mn(e, t) {
|
|
4836
4895
|
let n = e.length, r = Array(n).fill(void 0), i = 2 / (t + 1), a, o = 0, s = 0;
|
|
4837
4896
|
for (let c = 0; c < n; c++) {
|
|
4838
4897
|
let n = e[c];
|
|
@@ -4842,7 +4901,7 @@ function ln(e, t) {
|
|
|
4842
4901
|
}
|
|
4843
4902
|
//#endregion
|
|
4844
4903
|
//#region src/indicators/panel/AcceleratorOscillator.ts
|
|
4845
|
-
var
|
|
4904
|
+
var hn = class extends I {
|
|
4846
4905
|
descriptor = {
|
|
4847
4906
|
id: "ac",
|
|
4848
4907
|
name: "Accelerator Oscillator",
|
|
@@ -4856,7 +4915,7 @@ var un = class extends I {
|
|
|
4856
4915
|
series: n
|
|
4857
4916
|
};
|
|
4858
4917
|
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] =
|
|
4918
|
+
for (let e = 33; e < r; e++) a[e] = gn(i, e, 5) - gn(i, e, 34);
|
|
4860
4919
|
for (let i = 37; i < r; i++) {
|
|
4861
4920
|
let r = 0;
|
|
4862
4921
|
for (let e = i - 4; e <= i; e++) r += a[e];
|
|
@@ -4893,14 +4952,14 @@ var un = class extends I {
|
|
|
4893
4952
|
}
|
|
4894
4953
|
}
|
|
4895
4954
|
};
|
|
4896
|
-
function
|
|
4955
|
+
function gn(e, t, n) {
|
|
4897
4956
|
let r = 0;
|
|
4898
4957
|
for (let i = t - n + 1; i <= t; i++) r += e[i];
|
|
4899
4958
|
return r / n;
|
|
4900
4959
|
}
|
|
4901
4960
|
//#endregion
|
|
4902
4961
|
//#region src/indicators/panel/RelativeMomentumIndex.ts
|
|
4903
|
-
var
|
|
4962
|
+
var _n = class extends I {
|
|
4904
4963
|
descriptor = {
|
|
4905
4964
|
id: "rmi",
|
|
4906
4965
|
name: "Relative Momentum Index",
|
|
@@ -4957,7 +5016,7 @@ var fn = class extends I {
|
|
|
4957
5016
|
}
|
|
4958
5017
|
e.stroke();
|
|
4959
5018
|
}
|
|
4960
|
-
},
|
|
5019
|
+
}, vn = class extends I {
|
|
4961
5020
|
descriptor = {
|
|
4962
5021
|
id: "disparity",
|
|
4963
5022
|
name: "Disparity Index",
|
|
@@ -4981,9 +5040,9 @@ var fn = class extends I {
|
|
|
4981
5040
|
};
|
|
4982
5041
|
}
|
|
4983
5042
|
render(e, t, n, r) {
|
|
4984
|
-
|
|
5043
|
+
rn(e, t, n, r);
|
|
4985
5044
|
}
|
|
4986
|
-
},
|
|
5045
|
+
}, yn = class extends I {
|
|
4987
5046
|
descriptor = {
|
|
4988
5047
|
id: "qstick",
|
|
4989
5048
|
name: "Qstick",
|
|
@@ -5010,9 +5069,9 @@ var fn = class extends I {
|
|
|
5010
5069
|
};
|
|
5011
5070
|
}
|
|
5012
5071
|
render(e, t, n, r) {
|
|
5013
|
-
|
|
5072
|
+
rn(e, t, n, r);
|
|
5014
5073
|
}
|
|
5015
|
-
},
|
|
5074
|
+
}, bn = class extends I {
|
|
5016
5075
|
descriptor = {
|
|
5017
5076
|
id: "pgo",
|
|
5018
5077
|
name: "Pretty Good Oscillator",
|
|
@@ -5079,7 +5138,7 @@ var fn = class extends I {
|
|
|
5079
5138
|
}
|
|
5080
5139
|
e.stroke();
|
|
5081
5140
|
}
|
|
5082
|
-
},
|
|
5141
|
+
}, xn = class extends I {
|
|
5083
5142
|
descriptor = {
|
|
5084
5143
|
id: "stddev",
|
|
5085
5144
|
name: "Standard Deviation",
|
|
@@ -5125,7 +5184,7 @@ var fn = class extends I {
|
|
|
5125
5184
|
}
|
|
5126
5185
|
e.stroke();
|
|
5127
5186
|
}
|
|
5128
|
-
},
|
|
5187
|
+
}, Sn = class extends I {
|
|
5129
5188
|
descriptor = {
|
|
5130
5189
|
id: "volumeProfile",
|
|
5131
5190
|
name: "Volume Profile",
|
|
@@ -5175,7 +5234,7 @@ var fn = class extends I {
|
|
|
5175
5234
|
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
5235
|
}
|
|
5177
5236
|
}
|
|
5178
|
-
},
|
|
5237
|
+
}, Cn = class extends I {
|
|
5179
5238
|
descriptor = {
|
|
5180
5239
|
id: "ad",
|
|
5181
5240
|
name: "Accumulation/Distribution",
|
|
@@ -5221,7 +5280,7 @@ var fn = class extends I {
|
|
|
5221
5280
|
}
|
|
5222
5281
|
e.stroke();
|
|
5223
5282
|
}
|
|
5224
|
-
},
|
|
5283
|
+
}, wn = class extends I {
|
|
5225
5284
|
descriptor = {
|
|
5226
5285
|
id: "vroc",
|
|
5227
5286
|
name: "Volume Rate of Change",
|
|
@@ -5263,19 +5322,19 @@ var fn = class extends I {
|
|
|
5263
5322
|
};
|
|
5264
5323
|
//#endregion
|
|
5265
5324
|
//#region src/indicators/registry.ts
|
|
5266
|
-
function
|
|
5267
|
-
e.register(new
|
|
5325
|
+
function Tn(e) {
|
|
5326
|
+
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
5327
|
}
|
|
5269
5328
|
//#endregion
|
|
5270
5329
|
//#region src/indicators/worker/messages.ts
|
|
5271
|
-
function
|
|
5330
|
+
function En(e) {
|
|
5272
5331
|
if (typeof e != "object" || !e) return !1;
|
|
5273
5332
|
let t = e;
|
|
5274
5333
|
return typeof t.requestId == "number" ? t.type === "result" || t.type === "pong" || t.type === "error" : !1;
|
|
5275
5334
|
}
|
|
5276
5335
|
//#endregion
|
|
5277
5336
|
//#region src/indicators/worker/IndicatorWorkerHost.ts
|
|
5278
|
-
var
|
|
5337
|
+
var Dn = class {
|
|
5279
5338
|
worker;
|
|
5280
5339
|
fallbackPlugins;
|
|
5281
5340
|
timeoutMs;
|
|
@@ -5340,7 +5399,7 @@ var Sn = class {
|
|
|
5340
5399
|
handleMessage(e) {
|
|
5341
5400
|
let t = e.data;
|
|
5342
5401
|
if (t !== void 0) {
|
|
5343
|
-
if (!
|
|
5402
|
+
if (!En(t)) return;
|
|
5344
5403
|
this.dispatchResponse(t);
|
|
5345
5404
|
return;
|
|
5346
5405
|
}
|
|
@@ -5361,7 +5420,7 @@ var Sn = class {
|
|
|
5361
5420
|
t.resolve(e.output);
|
|
5362
5421
|
}
|
|
5363
5422
|
}
|
|
5364
|
-
},
|
|
5423
|
+
}, On = class {
|
|
5365
5424
|
visible = !0;
|
|
5366
5425
|
setVisible(e) {
|
|
5367
5426
|
this.visible = e;
|
|
@@ -5390,7 +5449,7 @@ var Sn = class {
|
|
|
5390
5449
|
}
|
|
5391
5450
|
e.stroke();
|
|
5392
5451
|
}
|
|
5393
|
-
},
|
|
5452
|
+
}, kn = class {
|
|
5394
5453
|
locale = "en-US";
|
|
5395
5454
|
setLocale(e) {
|
|
5396
5455
|
this.locale = e;
|
|
@@ -5413,7 +5472,7 @@ var Sn = class {
|
|
|
5413
5472
|
e.stroke(), e.globalAlpha = 1, e.fillStyle = n.axisLabel;
|
|
5414
5473
|
for (let { y: t, text: n } of h) e.fillText(n, a + 8, t);
|
|
5415
5474
|
}
|
|
5416
|
-
},
|
|
5475
|
+
}, An = (e) => e < 10 ? "0" + e : "" + e, jn = class {
|
|
5417
5476
|
tzOffsetMinutes = null;
|
|
5418
5477
|
setTimezoneOffset(e) {
|
|
5419
5478
|
this.tzOffsetMinutes = e;
|
|
@@ -5427,12 +5486,12 @@ var Sn = class {
|
|
|
5427
5486
|
for (let t = l; t <= u && t < r.length; t++) {
|
|
5428
5487
|
if (t % c !== 0) continue;
|
|
5429
5488
|
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 = `${
|
|
5489
|
+
a === f ? m = `${An(u)}:${An(p)}` : (m = `${l}/${a}`, f = a), e.fillText(m, n, o + 7);
|
|
5431
5490
|
}
|
|
5432
5491
|
let p = a.x + a.width - 4, m = o + 7;
|
|
5433
5492
|
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
5493
|
}
|
|
5435
|
-
},
|
|
5494
|
+
}, Mn = class {
|
|
5436
5495
|
panHandler = null;
|
|
5437
5496
|
zoomHandler = null;
|
|
5438
5497
|
crosshairHandler = null;
|
|
@@ -5451,6 +5510,7 @@ var Sn = class {
|
|
|
5451
5510
|
pressForClick = !1;
|
|
5452
5511
|
drawingManager = null;
|
|
5453
5512
|
tradingManager = null;
|
|
5513
|
+
paneResizeHandler = null;
|
|
5454
5514
|
viewportGetter = null;
|
|
5455
5515
|
onOverlayDirty = null;
|
|
5456
5516
|
boundHandlers = [];
|
|
@@ -5510,6 +5570,9 @@ var Sn = class {
|
|
|
5510
5570
|
setTradingManager(e, t) {
|
|
5511
5571
|
this.tradingManager = e, this.viewportGetter = t;
|
|
5512
5572
|
}
|
|
5573
|
+
setPaneResizeHandler(e) {
|
|
5574
|
+
this.paneResizeHandler = e;
|
|
5575
|
+
}
|
|
5513
5576
|
attach() {
|
|
5514
5577
|
let e = () => this.viewportGetter?.() ?? null, t = (e) => {
|
|
5515
5578
|
let t = this.axisViewportGetter?.();
|
|
@@ -5525,20 +5588,22 @@ var Sn = class {
|
|
|
5525
5588
|
this.axisDragHandler.begin(a, r);
|
|
5526
5589
|
return;
|
|
5527
5590
|
}
|
|
5528
|
-
if (
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
}
|
|
5532
|
-
if (n.altKey && this.onAltClick) {
|
|
5533
|
-
this.onAltClick(r);
|
|
5534
|
-
return;
|
|
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?.();
|
|
5591
|
+
if (!this.paneResizeHandler?.tryBegin(r)) {
|
|
5592
|
+
if (n.shiftKey && this.measureHandlers) {
|
|
5593
|
+
this.measuring = !0, this.measureHandlers.begin(r), this.onOverlayDirty?.();
|
|
5539
5594
|
return;
|
|
5540
5595
|
}
|
|
5541
|
-
|
|
5596
|
+
if (n.altKey && this.onAltClick) {
|
|
5597
|
+
this.onAltClick(r);
|
|
5598
|
+
return;
|
|
5599
|
+
}
|
|
5600
|
+
if (!(this.tradingManager && i && this.tradingManager.onPointerDown(r, i)) && !(this.drawingManager && i && this.drawingManager.onPointerDown(r, i))) {
|
|
5601
|
+
if (this.alertDragHandler?.tryBegin(r)) {
|
|
5602
|
+
this.onOverlayDirty?.();
|
|
5603
|
+
return;
|
|
5604
|
+
}
|
|
5605
|
+
this.pressForClick = !0, this.panHandler?.onPointerDown(r);
|
|
5606
|
+
}
|
|
5542
5607
|
}
|
|
5543
5608
|
}, r = (n) => {
|
|
5544
5609
|
let r = this.getMousePos(n), i = e();
|
|
@@ -5550,6 +5615,10 @@ var Sn = class {
|
|
|
5550
5615
|
this.axisDragHandler.move(r);
|
|
5551
5616
|
return;
|
|
5552
5617
|
}
|
|
5618
|
+
if (this.paneResizeHandler?.isActive()) {
|
|
5619
|
+
this.paneResizeHandler.move(r);
|
|
5620
|
+
return;
|
|
5621
|
+
}
|
|
5553
5622
|
if (this.alertDragHandler?.isActive()) {
|
|
5554
5623
|
this.alertDragHandler.move(r), this.onOverlayDirty?.();
|
|
5555
5624
|
return;
|
|
@@ -5558,8 +5627,8 @@ var Sn = class {
|
|
|
5558
5627
|
this.measureHandlers.move(r), this.onOverlayDirty?.();
|
|
5559
5628
|
return;
|
|
5560
5629
|
}
|
|
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)) {
|
|
5630
|
+
let a = t(r), o = this.paneResizeHandler?.cursorAt(r) ?? null;
|
|
5631
|
+
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
5632
|
this.crosshairHandler?.onPointerMove(r), this.onOverlayDirty?.();
|
|
5564
5633
|
return;
|
|
5565
5634
|
}
|
|
@@ -5573,6 +5642,10 @@ var Sn = class {
|
|
|
5573
5642
|
this.axisDragHandler.end();
|
|
5574
5643
|
return;
|
|
5575
5644
|
}
|
|
5645
|
+
if (this.paneResizeHandler?.isActive()) {
|
|
5646
|
+
this.paneResizeHandler.end();
|
|
5647
|
+
return;
|
|
5648
|
+
}
|
|
5576
5649
|
if (this.alertDragHandler?.isActive()) {
|
|
5577
5650
|
this.alertDragHandler.end(), this.onOverlayDirty?.();
|
|
5578
5651
|
return;
|
|
@@ -5586,7 +5659,7 @@ var Sn = class {
|
|
|
5586
5659
|
let n = t(this.getMousePos(e));
|
|
5587
5660
|
n && this.onAxisDoubleClick && this.onAxisDoubleClick(n);
|
|
5588
5661
|
}, 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?.();
|
|
5662
|
+
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
5663
|
}, s = (e) => {
|
|
5591
5664
|
e.preventDefault();
|
|
5592
5665
|
let t = this.getMousePos(e);
|
|
@@ -5609,6 +5682,10 @@ var Sn = class {
|
|
|
5609
5682
|
this.axisDragHandler.begin(i, r), this.touchActive = !0;
|
|
5610
5683
|
return;
|
|
5611
5684
|
}
|
|
5685
|
+
if (this.paneResizeHandler?.tryBegin(r)) {
|
|
5686
|
+
this.touchActive = !0;
|
|
5687
|
+
return;
|
|
5688
|
+
}
|
|
5612
5689
|
let a = e();
|
|
5613
5690
|
if (this.tradingManager && a && this.tradingManager.onPointerDown(r, a)) {
|
|
5614
5691
|
this.touchActive = !0, this.onOverlayDirty?.();
|
|
@@ -5629,6 +5706,10 @@ var Sn = class {
|
|
|
5629
5706
|
this.axisDragHandler.move(n), this.onOverlayDirty?.();
|
|
5630
5707
|
return;
|
|
5631
5708
|
}
|
|
5709
|
+
if (this.paneResizeHandler?.isActive()) {
|
|
5710
|
+
this.paneResizeHandler.move(n), this.onOverlayDirty?.();
|
|
5711
|
+
return;
|
|
5712
|
+
}
|
|
5632
5713
|
let r = e();
|
|
5633
5714
|
if (this.tradingManager && r && this.tradingManager.onPointerMove(n, r)) {
|
|
5634
5715
|
this.onOverlayDirty?.();
|
|
@@ -5646,7 +5727,7 @@ var Sn = class {
|
|
|
5646
5727
|
}
|
|
5647
5728
|
this.onOverlayDirty?.();
|
|
5648
5729
|
}, 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;
|
|
5730
|
+
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
5731
|
else if (e.touches.length === 1) {
|
|
5651
5732
|
let t = this.getTouchPos(e.touches[0]);
|
|
5652
5733
|
this.panHandler?.onPointerDown(t);
|
|
@@ -5691,7 +5772,7 @@ var Sn = class {
|
|
|
5691
5772
|
y: (e.clientY + t.clientY) / 2 - n.top
|
|
5692
5773
|
};
|
|
5693
5774
|
}
|
|
5694
|
-
},
|
|
5775
|
+
}, Nn = class {
|
|
5695
5776
|
dragging = !1;
|
|
5696
5777
|
lastX = 0;
|
|
5697
5778
|
lastTime = 0;
|
|
@@ -5727,7 +5808,7 @@ var Sn = class {
|
|
|
5727
5808
|
stopMomentum() {
|
|
5728
5809
|
this.momentumId &&= (cancelAnimationFrame(this.momentumId), 0);
|
|
5729
5810
|
}
|
|
5730
|
-
},
|
|
5811
|
+
}, Pn = class {
|
|
5731
5812
|
callback;
|
|
5732
5813
|
sensitivity;
|
|
5733
5814
|
pendingDelta = 0;
|
|
@@ -5746,7 +5827,7 @@ var Sn = class {
|
|
|
5746
5827
|
dispose() {
|
|
5747
5828
|
this.rafId &&= (cancelAnimationFrame(this.rafId), 0);
|
|
5748
5829
|
}
|
|
5749
|
-
},
|
|
5830
|
+
}, Fn = class {
|
|
5750
5831
|
dragging = !1;
|
|
5751
5832
|
axis = null;
|
|
5752
5833
|
startPos = {
|
|
@@ -5786,7 +5867,7 @@ var Sn = class {
|
|
|
5786
5867
|
isActive() {
|
|
5787
5868
|
return this.dragging;
|
|
5788
5869
|
}
|
|
5789
|
-
},
|
|
5870
|
+
}, In = class {
|
|
5790
5871
|
draggingId = null;
|
|
5791
5872
|
constructor(e, t) {
|
|
5792
5873
|
this.alerts = e, this.viewportGetter = t;
|
|
@@ -5812,7 +5893,85 @@ var Sn = class {
|
|
|
5812
5893
|
isActive() {
|
|
5813
5894
|
return this.draggingId !== null;
|
|
5814
5895
|
}
|
|
5815
|
-
},
|
|
5896
|
+
}, Ln = class {
|
|
5897
|
+
state = null;
|
|
5898
|
+
layoutGetter = null;
|
|
5899
|
+
onResize = null;
|
|
5900
|
+
constructor(e = 4) {
|
|
5901
|
+
this.tolerance = e;
|
|
5902
|
+
}
|
|
5903
|
+
configure(e, t) {
|
|
5904
|
+
this.layoutGetter = e, this.onResize = t;
|
|
5905
|
+
}
|
|
5906
|
+
hitTest(e, t) {
|
|
5907
|
+
for (let n of t.dividers) if (Rn(e, n.rect, this.tolerance)) {
|
|
5908
|
+
let e = t.panels.find((e) => e.config.id === n.panelId);
|
|
5909
|
+
if (e) return {
|
|
5910
|
+
panelId: n.panelId,
|
|
5911
|
+
orientation: n.orientation,
|
|
5912
|
+
position: e.config.position,
|
|
5913
|
+
size: e.config.size
|
|
5914
|
+
};
|
|
5915
|
+
}
|
|
5916
|
+
return null;
|
|
5917
|
+
}
|
|
5918
|
+
cursorAt(e) {
|
|
5919
|
+
let t = this.layoutGetter?.();
|
|
5920
|
+
if (!t) return null;
|
|
5921
|
+
let n = this.hitTest(e, t);
|
|
5922
|
+
return n ? n.orientation === "horizontal" ? "ns-resize" : "ew-resize" : null;
|
|
5923
|
+
}
|
|
5924
|
+
tryBegin(e) {
|
|
5925
|
+
let t = this.layoutGetter?.();
|
|
5926
|
+
if (!t) return !1;
|
|
5927
|
+
let n = this.hitTest(e, t);
|
|
5928
|
+
return n ? (this.state = {
|
|
5929
|
+
panelId: n.panelId,
|
|
5930
|
+
position: n.position,
|
|
5931
|
+
startSize: n.size,
|
|
5932
|
+
startPos: e
|
|
5933
|
+
}, !0) : !1;
|
|
5934
|
+
}
|
|
5935
|
+
move(e) {
|
|
5936
|
+
let t = this.computeSize(e);
|
|
5937
|
+
t && this.onResize?.(t.panelId, t.size);
|
|
5938
|
+
}
|
|
5939
|
+
computeSize(e) {
|
|
5940
|
+
let t = this.state;
|
|
5941
|
+
if (!t) return null;
|
|
5942
|
+
let n = 0;
|
|
5943
|
+
switch (t.position) {
|
|
5944
|
+
case "bottom":
|
|
5945
|
+
n = t.startPos.y - e.y;
|
|
5946
|
+
break;
|
|
5947
|
+
case "top":
|
|
5948
|
+
n = e.y - t.startPos.y;
|
|
5949
|
+
break;
|
|
5950
|
+
case "left":
|
|
5951
|
+
n = e.x - t.startPos.x;
|
|
5952
|
+
break;
|
|
5953
|
+
case "right":
|
|
5954
|
+
n = t.startPos.x - e.x;
|
|
5955
|
+
break;
|
|
5956
|
+
}
|
|
5957
|
+
return {
|
|
5958
|
+
panelId: t.panelId,
|
|
5959
|
+
size: t.startSize + n
|
|
5960
|
+
};
|
|
5961
|
+
}
|
|
5962
|
+
end() {
|
|
5963
|
+
this.state = null;
|
|
5964
|
+
}
|
|
5965
|
+
isActive() {
|
|
5966
|
+
return this.state !== null;
|
|
5967
|
+
}
|
|
5968
|
+
};
|
|
5969
|
+
function Rn(e, t, n) {
|
|
5970
|
+
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;
|
|
5971
|
+
}
|
|
5972
|
+
//#endregion
|
|
5973
|
+
//#region src/interaction/CrosshairHandler.ts
|
|
5974
|
+
var zn = class {
|
|
5816
5975
|
position = null;
|
|
5817
5976
|
callback = null;
|
|
5818
5977
|
data = [];
|
|
@@ -5879,7 +6038,7 @@ var Sn = class {
|
|
|
5879
6038
|
let c = A(o, t);
|
|
5880
6039
|
c = Math.max(0, Math.min(r.length - 1, c)), this.magnetMode && c >= 0 && c < r.length && (o = O(c, t));
|
|
5881
6040
|
let l = `600 ${n.font.sizeSmall}px ${n.font.family}`;
|
|
5882
|
-
if (
|
|
6041
|
+
if (Bn(e, {
|
|
5883
6042
|
text: h(j(s, t), this.pricePrecision, this.locale),
|
|
5884
6043
|
anchorX: a.x + a.width,
|
|
5885
6044
|
anchorY: s,
|
|
@@ -5888,8 +6047,8 @@ var Sn = class {
|
|
|
5888
6047
|
fg: n.background,
|
|
5889
6048
|
font: l
|
|
5890
6049
|
}), c >= 0 && c < r.length) {
|
|
5891
|
-
let t =
|
|
5892
|
-
|
|
6050
|
+
let t = Vn(r[c].time, this.tzOffsetMinutes), s = i ?? a.y + a.height;
|
|
6051
|
+
Bn(e, {
|
|
5893
6052
|
text: t,
|
|
5894
6053
|
anchorX: o,
|
|
5895
6054
|
anchorY: s,
|
|
@@ -5909,7 +6068,7 @@ var Sn = class {
|
|
|
5909
6068
|
this.callback?.(e, t);
|
|
5910
6069
|
}
|
|
5911
6070
|
};
|
|
5912
|
-
function
|
|
6071
|
+
function Bn(e, t) {
|
|
5913
6072
|
e.save(), e.font = t.font;
|
|
5914
6073
|
let n = Math.ceil(e.measureText(t.text).width) + 16;
|
|
5915
6074
|
if (t.orientation === "right") {
|
|
@@ -5921,13 +6080,13 @@ function Nn(e, t) {
|
|
|
5921
6080
|
}
|
|
5922
6081
|
e.restore();
|
|
5923
6082
|
}
|
|
5924
|
-
function
|
|
6083
|
+
function Vn(e, t) {
|
|
5925
6084
|
let { month: n, day: r, hours: i, minutes: a } = y(e > 0xe8d4a51000 ? e : e * 1e3, t);
|
|
5926
6085
|
return `${n}/${r} ${i < 10 ? "0" + i : i}:${a < 10 ? "0" + a : a}`;
|
|
5927
6086
|
}
|
|
5928
6087
|
//#endregion
|
|
5929
6088
|
//#region src/interaction/KeyboardHandler.ts
|
|
5930
|
-
var
|
|
6089
|
+
var Hn = class {
|
|
5931
6090
|
callbacks;
|
|
5932
6091
|
enabled = !0;
|
|
5933
6092
|
constructor(e) {
|
|
@@ -5953,7 +6112,7 @@ var Fn = class {
|
|
|
5953
6112
|
default: return !1;
|
|
5954
6113
|
}
|
|
5955
6114
|
}
|
|
5956
|
-
},
|
|
6115
|
+
}, Un = class {
|
|
5957
6116
|
el = null;
|
|
5958
6117
|
visible = !1;
|
|
5959
6118
|
timeEl;
|
|
@@ -5992,8 +6151,8 @@ var Fn = class {
|
|
|
5992
6151
|
this.changeEl.textContent = `${l}${a(s)} (${l}${c.toFixed(2)}%)`, this.changeEl.style.color = i;
|
|
5993
6152
|
let u = t.volume;
|
|
5994
6153
|
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 ?
|
|
6154
|
+
let d = Wn(n.background);
|
|
6155
|
+
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
6156
|
let f = e.x + 16, p = e.y - 40;
|
|
5998
6157
|
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
6158
|
}
|
|
@@ -6018,7 +6177,7 @@ var Fn = class {
|
|
|
6018
6177
|
return document.createElement("span");
|
|
6019
6178
|
}
|
|
6020
6179
|
};
|
|
6021
|
-
function
|
|
6180
|
+
function Wn(e) {
|
|
6022
6181
|
if (e.startsWith("#")) {
|
|
6023
6182
|
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
6183
|
return (.299 * r + .587 * i + .114 * a) / 255 < .5;
|
|
@@ -6030,7 +6189,7 @@ function Ln(e) {
|
|
|
6030
6189
|
}
|
|
6031
6190
|
return !0;
|
|
6032
6191
|
}
|
|
6033
|
-
function
|
|
6192
|
+
function Gn(e, t) {
|
|
6034
6193
|
if (e.startsWith("#")) {
|
|
6035
6194
|
let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
|
|
6036
6195
|
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
@@ -6039,7 +6198,7 @@ function Rn(e, t) {
|
|
|
6039
6198
|
}
|
|
6040
6199
|
//#endregion
|
|
6041
6200
|
//#region src/interaction/PinnedTooltip.ts
|
|
6042
|
-
var
|
|
6201
|
+
var Kn = class {
|
|
6043
6202
|
el = null;
|
|
6044
6203
|
deltaEl = null;
|
|
6045
6204
|
timeEl = null;
|
|
@@ -6069,14 +6228,14 @@ var zn = class {
|
|
|
6069
6228
|
if (!this.el || !this.timeEl || !this.ohlcEl) return;
|
|
6070
6229
|
this.pinnedBar = e, this.pinnedIndex = t;
|
|
6071
6230
|
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}">${
|
|
6231
|
+
this.timeEl.textContent = `${i.getMonth() + 1}/${i.getDate()} ${qn(i.getHours())}:${qn(i.getMinutes())}`, this.timeEl.style.color = n.textSecondary, this.ohlcEl.innerHTML = `
|
|
6232
|
+
<span style="opacity:.6">O </span><span style="color:${r}">${V(e.open)}</span>
|
|
6233
|
+
<span style="opacity:.6"> H </span><span style="color:${r}">${V(e.high)}</span>
|
|
6234
|
+
<span style="opacity:.6"> L </span><span style="color:${r}">${V(e.low)}</span>
|
|
6235
|
+
<span style="opacity:.6"> C </span><span style="color:${r}">${V(e.close)}</span>
|
|
6077
6236
|
`;
|
|
6078
|
-
let a =
|
|
6079
|
-
this.el.style.background =
|
|
6237
|
+
let a = Jn(n.background);
|
|
6238
|
+
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
6239
|
}
|
|
6081
6240
|
unpin() {
|
|
6082
6241
|
this.pinnedBar = null, this.pinnedIndex = -1, this.el && (this.el.style.display = "none");
|
|
@@ -6094,27 +6253,27 @@ var zn = class {
|
|
|
6094
6253
|
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
6254
|
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
6255
|
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}${
|
|
6256
|
+
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
6257
|
} else this.deltaEl.style.display = "none";
|
|
6099
6258
|
}
|
|
6100
6259
|
destroy() {
|
|
6101
6260
|
this.el?.remove(), this.el = null, this.deltaEl = null, this.timeEl = null, this.ohlcEl = null, this.pinnedBar = null, this.pinnedIndex = -1;
|
|
6102
6261
|
}
|
|
6103
6262
|
};
|
|
6104
|
-
function
|
|
6263
|
+
function V(e) {
|
|
6105
6264
|
return e.toFixed(2);
|
|
6106
6265
|
}
|
|
6107
|
-
function
|
|
6266
|
+
function qn(e) {
|
|
6108
6267
|
return e < 10 ? "0" + e : "" + e;
|
|
6109
6268
|
}
|
|
6110
|
-
function
|
|
6269
|
+
function Jn(e) {
|
|
6111
6270
|
if (e.startsWith("#")) {
|
|
6112
6271
|
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
6272
|
return (.299 * r + .587 * i + .114 * a) / 255 < .5;
|
|
6114
6273
|
}
|
|
6115
6274
|
return !0;
|
|
6116
6275
|
}
|
|
6117
|
-
function
|
|
6276
|
+
function Yn(e, t) {
|
|
6118
6277
|
if (e.startsWith("#")) {
|
|
6119
6278
|
let n = e.slice(1), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n.slice(0, 6);
|
|
6120
6279
|
return `rgba(${parseInt(r.slice(0, 2), 16)}, ${parseInt(r.slice(2, 4), 16)}, ${parseInt(r.slice(4, 6), 16)}, ${t})`;
|
|
@@ -6123,7 +6282,7 @@ function Hn(e, t) {
|
|
|
6123
6282
|
}
|
|
6124
6283
|
//#endregion
|
|
6125
6284
|
//#region src/events/EventBus.ts
|
|
6126
|
-
var
|
|
6285
|
+
var Xn = class {
|
|
6127
6286
|
listeners = /* @__PURE__ */ new Map();
|
|
6128
6287
|
tauriBridge = null;
|
|
6129
6288
|
on(e, t) {
|
|
@@ -6154,7 +6313,7 @@ var Un = class {
|
|
|
6154
6313
|
destroy() {
|
|
6155
6314
|
this.listeners.clear(), this.tauriBridge = null;
|
|
6156
6315
|
}
|
|
6157
|
-
},
|
|
6316
|
+
}, H = class {
|
|
6158
6317
|
hitTestAnchor(e, t, n, r) {
|
|
6159
6318
|
for (let i = 0; i < t.anchors.length; i++) {
|
|
6160
6319
|
let a = this.anchorToPixel(t.anchors[i], n);
|
|
@@ -6209,8 +6368,8 @@ var Un = class {
|
|
|
6209
6368
|
let r = n.x - t.x, i = n.y - t.y, a = Math.hypot(r, i);
|
|
6210
6369
|
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
6370
|
}
|
|
6212
|
-
},
|
|
6213
|
-
function
|
|
6371
|
+
}, Zn = 1;
|
|
6372
|
+
function U(e) {
|
|
6214
6373
|
return {
|
|
6215
6374
|
...e,
|
|
6216
6375
|
anchors: e.anchors.map((e) => ({ ...e })),
|
|
@@ -6218,7 +6377,7 @@ function G(e) {
|
|
|
6218
6377
|
meta: e.meta ? { ...e.meta } : void 0
|
|
6219
6378
|
};
|
|
6220
6379
|
}
|
|
6221
|
-
var
|
|
6380
|
+
var Qn = class {
|
|
6222
6381
|
registry = /* @__PURE__ */ new Map();
|
|
6223
6382
|
drawings = [];
|
|
6224
6383
|
state = "idle";
|
|
@@ -6386,14 +6545,14 @@ var Gn = class {
|
|
|
6386
6545
|
if (!n) return !1;
|
|
6387
6546
|
let r = this.drawings.find((e) => e.id === n);
|
|
6388
6547
|
if (!r || r.locked) return !1;
|
|
6389
|
-
let i =
|
|
6548
|
+
let i = U(r);
|
|
6390
6549
|
return r.style = {
|
|
6391
6550
|
...r.style,
|
|
6392
6551
|
...e
|
|
6393
6552
|
}, this.undoRedo?.push({
|
|
6394
6553
|
type: "drawingModify",
|
|
6395
6554
|
before: i,
|
|
6396
|
-
after:
|
|
6555
|
+
after: U(r)
|
|
6397
6556
|
}), this.requestRender?.(), !0;
|
|
6398
6557
|
}
|
|
6399
6558
|
onPointerDown(e, t) {
|
|
@@ -6416,7 +6575,7 @@ var Gn = class {
|
|
|
6416
6575
|
e && this.undoRedo?.push({
|
|
6417
6576
|
type: "drawingModify",
|
|
6418
6577
|
before: this.dragBeforeState,
|
|
6419
|
-
after:
|
|
6578
|
+
after: U(e)
|
|
6420
6579
|
});
|
|
6421
6580
|
}
|
|
6422
6581
|
return this.state = "selected", this.dragStartPoint = null, this.dragStartAnchors = [], this.dragAnchorIndex = -1, this.dragBeforeState = null, !0;
|
|
@@ -6438,7 +6597,7 @@ var Gn = class {
|
|
|
6438
6597
|
this.drawings = this.upgradeLegacyAnchors(e), this.requestRender?.();
|
|
6439
6598
|
}
|
|
6440
6599
|
addDrawing(e) {
|
|
6441
|
-
let t = e.id ?? `tc_drawing_${
|
|
6600
|
+
let t = e.id ?? `tc_drawing_${Zn++}`, n = {
|
|
6442
6601
|
id: t,
|
|
6443
6602
|
type: e.type,
|
|
6444
6603
|
anchors: e.anchors.map((e) => ({ ...e })),
|
|
@@ -6453,7 +6612,7 @@ var Gn = class {
|
|
|
6453
6612
|
return this.drawings = [...this.drawings, n], this.undoRedo?.push({
|
|
6454
6613
|
type: "drawingCreate",
|
|
6455
6614
|
before: null,
|
|
6456
|
-
after:
|
|
6615
|
+
after: U(n)
|
|
6457
6616
|
}), this.eventCallback?.("drawingCreate", {
|
|
6458
6617
|
id: t,
|
|
6459
6618
|
type: n.type
|
|
@@ -6485,7 +6644,7 @@ var Gn = class {
|
|
|
6485
6644
|
let t = this.drawings.find((t) => t.id === e);
|
|
6486
6645
|
if (!t) return null;
|
|
6487
6646
|
let n = structuredClone(t);
|
|
6488
|
-
n.id = `tc_drawing_${
|
|
6647
|
+
n.id = `tc_drawing_${Zn++}`;
|
|
6489
6648
|
let r = this.computeBarOffsetTime(3);
|
|
6490
6649
|
return n.anchors = n.anchors.map((e) => ({
|
|
6491
6650
|
...e,
|
|
@@ -6536,7 +6695,7 @@ var Gn = class {
|
|
|
6536
6695
|
if (!n) return !1;
|
|
6537
6696
|
let r = F(e.x, t), i = j(e.y, t), a = this.snapToOHLC(r, i, t);
|
|
6538
6697
|
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_${
|
|
6698
|
+
id: `tc_drawing_${Zn++}`,
|
|
6540
6699
|
type: this.activeTool,
|
|
6541
6700
|
anchors: [a],
|
|
6542
6701
|
style: { ...this.activeStyle },
|
|
@@ -6558,8 +6717,8 @@ var Gn = class {
|
|
|
6558
6717
|
let r = this.registry.get(n.type);
|
|
6559
6718
|
if (r) {
|
|
6560
6719
|
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 =
|
|
6720
|
+
if (i >= 0) return this.state = "resizing", this.dragAnchorIndex = i, this.dragStartPoint = e, this.dragBeforeState = U(n), !0;
|
|
6721
|
+
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
6722
|
}
|
|
6564
6723
|
}
|
|
6565
6724
|
}
|
|
@@ -6587,7 +6746,7 @@ var Gn = class {
|
|
|
6587
6746
|
price: j(e.y, t)
|
|
6588
6747
|
}, this.requestRender?.(), !0);
|
|
6589
6748
|
}
|
|
6590
|
-
},
|
|
6749
|
+
}, $n = class {
|
|
6591
6750
|
constructor(e) {
|
|
6592
6751
|
this.manager = e;
|
|
6593
6752
|
}
|
|
@@ -6597,7 +6756,7 @@ var Gn = class {
|
|
|
6597
6756
|
};
|
|
6598
6757
|
//#endregion
|
|
6599
6758
|
//#region src/drawings/autoFib.ts
|
|
6600
|
-
function
|
|
6759
|
+
function er(e, t, n) {
|
|
6601
6760
|
let r = Math.max(0, t), i = Math.min(e.length - 1, n);
|
|
6602
6761
|
if (i <= r) return null;
|
|
6603
6762
|
let a = r, o = r;
|
|
@@ -6614,7 +6773,7 @@ function qn(e, t, n) {
|
|
|
6614
6773
|
}
|
|
6615
6774
|
//#endregion
|
|
6616
6775
|
//#region src/drawings/tools/TrendLine.ts
|
|
6617
|
-
var
|
|
6776
|
+
var tr = class extends H {
|
|
6618
6777
|
descriptor = {
|
|
6619
6778
|
type: "trendLine",
|
|
6620
6779
|
name: "Trend Line",
|
|
@@ -6630,7 +6789,7 @@ var Jn = class extends W {
|
|
|
6630
6789
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
6631
6790
|
return this.distanceToLine(e, i, a) <= r;
|
|
6632
6791
|
}
|
|
6633
|
-
},
|
|
6792
|
+
}, nr = class extends H {
|
|
6634
6793
|
descriptor = {
|
|
6635
6794
|
type: "horizontalLine",
|
|
6636
6795
|
name: "Horizontal Line",
|
|
@@ -6646,7 +6805,7 @@ var Jn = class extends W {
|
|
|
6646
6805
|
let i = k(t.anchors[0].price, n);
|
|
6647
6806
|
return Math.abs(e.y - i) <= r && e.x >= n.chartRect.x && e.x <= n.chartRect.x + n.chartRect.width;
|
|
6648
6807
|
}
|
|
6649
|
-
},
|
|
6808
|
+
}, rr = class extends H {
|
|
6650
6809
|
descriptor = {
|
|
6651
6810
|
type: "verticalLine",
|
|
6652
6811
|
name: "Vertical Line",
|
|
@@ -6662,7 +6821,7 @@ var Jn = class extends W {
|
|
|
6662
6821
|
let i = this.anchorToPixel(t.anchors[0], n), { chartRect: a } = n;
|
|
6663
6822
|
return Math.abs(e.x - i.x) <= r && e.y >= a.y && e.y <= a.y + a.height;
|
|
6664
6823
|
}
|
|
6665
|
-
},
|
|
6824
|
+
}, ir = class extends H {
|
|
6666
6825
|
descriptor = {
|
|
6667
6826
|
type: "ray",
|
|
6668
6827
|
name: "Ray",
|
|
@@ -6680,7 +6839,7 @@ var Jn = class extends W {
|
|
|
6680
6839
|
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
6840
|
return ((e.x - i.x) * o + (e.y - i.y) * s) / (o * o + s * s) < 0 ? !1 : this.distanceToInfiniteLine(e, i, a) <= r;
|
|
6682
6841
|
}
|
|
6683
|
-
},
|
|
6842
|
+
}, ar = class extends H {
|
|
6684
6843
|
descriptor = {
|
|
6685
6844
|
type: "extendedLine",
|
|
6686
6845
|
name: "Extended Line",
|
|
@@ -6698,7 +6857,7 @@ var Jn = class extends W {
|
|
|
6698
6857
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
6699
6858
|
return this.distanceToInfiniteLine(e, i, a) <= r;
|
|
6700
6859
|
}
|
|
6701
|
-
},
|
|
6860
|
+
}, or = class extends H {
|
|
6702
6861
|
descriptor = {
|
|
6703
6862
|
type: "parallelChannel",
|
|
6704
6863
|
name: "Parallel Channel",
|
|
@@ -6735,7 +6894,7 @@ var Jn = class extends W {
|
|
|
6735
6894
|
}
|
|
6736
6895
|
return !1;
|
|
6737
6896
|
}
|
|
6738
|
-
},
|
|
6897
|
+
}, sr = class extends H {
|
|
6739
6898
|
descriptor = {
|
|
6740
6899
|
type: "regressionChannel",
|
|
6741
6900
|
name: "Regression Channel",
|
|
@@ -6758,7 +6917,7 @@ var Jn = class extends W {
|
|
|
6758
6917
|
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
6918
|
return this.distanceToLine(e, i, a) <= r + s;
|
|
6760
6919
|
}
|
|
6761
|
-
},
|
|
6920
|
+
}, W = [
|
|
6762
6921
|
0,
|
|
6763
6922
|
.236,
|
|
6764
6923
|
.382,
|
|
@@ -6766,7 +6925,7 @@ var Jn = class extends W {
|
|
|
6766
6925
|
.618,
|
|
6767
6926
|
.786,
|
|
6768
6927
|
1
|
|
6769
|
-
],
|
|
6928
|
+
], cr = class extends H {
|
|
6770
6929
|
descriptor = {
|
|
6771
6930
|
type: "fibRetracement",
|
|
6772
6931
|
name: "Fibonacci Retracement",
|
|
@@ -6776,13 +6935,13 @@ var Jn = class extends W {
|
|
|
6776
6935
|
if (t.anchors.length < 2) return;
|
|
6777
6936
|
let { chartRect: i } = n, a = t.anchors[0].price, o = t.anchors[1].price, s = a - o;
|
|
6778
6937
|
e.font = "11px sans-serif", e.textBaseline = "middle";
|
|
6779
|
-
for (let r of
|
|
6938
|
+
for (let r of W) {
|
|
6780
6939
|
let a = o + s * (1 - r), c = k(a, n);
|
|
6781
6940
|
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
6941
|
}
|
|
6783
6942
|
if (e.globalAlpha = 1, t.style.fillColor) {
|
|
6784
|
-
for (let r = 0; r <
|
|
6785
|
-
let a = o + s * (1 -
|
|
6943
|
+
for (let r = 0; r < W.length - 1; r++) {
|
|
6944
|
+
let a = o + s * (1 - W[r]), c = o + s * (1 - W[r + 1]), l = k(a, n), u = k(c, n);
|
|
6786
6945
|
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
6946
|
}
|
|
6788
6947
|
e.globalAlpha = 1;
|
|
@@ -6794,13 +6953,13 @@ var Jn = class extends W {
|
|
|
6794
6953
|
let { chartRect: i } = n;
|
|
6795
6954
|
if (e.x < i.x - r || e.x > i.x + i.width + r) return !1;
|
|
6796
6955
|
let a = t.anchors[0].price, o = t.anchors[1].price, s = a - o;
|
|
6797
|
-
for (let t of
|
|
6956
|
+
for (let t of W) {
|
|
6798
6957
|
let i = k(o + s * (1 - t), n);
|
|
6799
6958
|
if (Math.abs(e.y - i) <= r) return !0;
|
|
6800
6959
|
}
|
|
6801
6960
|
return !1;
|
|
6802
6961
|
}
|
|
6803
|
-
},
|
|
6962
|
+
}, lr = [
|
|
6804
6963
|
0,
|
|
6805
6964
|
.618,
|
|
6806
6965
|
1,
|
|
@@ -6809,7 +6968,7 @@ var Jn = class extends W {
|
|
|
6809
6968
|
2.618,
|
|
6810
6969
|
3.618,
|
|
6811
6970
|
4.236
|
|
6812
|
-
],
|
|
6971
|
+
], ur = class extends H {
|
|
6813
6972
|
descriptor = {
|
|
6814
6973
|
type: "fibExtension",
|
|
6815
6974
|
name: "Fibonacci Extension",
|
|
@@ -6825,7 +6984,7 @@ var Jn = class extends W {
|
|
|
6825
6984
|
}
|
|
6826
6985
|
let { chartRect: i } = n, a = t.anchors[0].price, o = t.anchors[1].price, s = t.anchors[2].price, c = a - o;
|
|
6827
6986
|
e.font = "11px sans-serif", e.textBaseline = "middle", e.textAlign = "left";
|
|
6828
|
-
for (let r of
|
|
6987
|
+
for (let r of lr) {
|
|
6829
6988
|
let a = k(s + c * r, n);
|
|
6830
6989
|
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
6990
|
}
|
|
@@ -6836,13 +6995,13 @@ var Jn = class extends W {
|
|
|
6836
6995
|
let { chartRect: i } = n;
|
|
6837
6996
|
if (e.x < i.x - r || e.x > i.x + i.width + r) return !1;
|
|
6838
6997
|
let a = t.anchors[0].price - t.anchors[1].price;
|
|
6839
|
-
for (let i of
|
|
6998
|
+
for (let i of lr) {
|
|
6840
6999
|
let o = k(t.anchors[2].price + a * i, n);
|
|
6841
7000
|
if (Math.abs(e.y - o) <= r) return !0;
|
|
6842
7001
|
}
|
|
6843
7002
|
return !1;
|
|
6844
7003
|
}
|
|
6845
|
-
},
|
|
7004
|
+
}, dr = class extends H {
|
|
6846
7005
|
descriptor = {
|
|
6847
7006
|
type: "rectangle",
|
|
6848
7007
|
name: "Rectangle",
|
|
@@ -6860,7 +7019,7 @@ var Jn = class extends W {
|
|
|
6860
7019
|
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
7020
|
return !(e.x > u && e.x < f && e.y > d && e.y < p) || !!t.style.fillColor;
|
|
6862
7021
|
}
|
|
6863
|
-
},
|
|
7022
|
+
}, fr = class extends H {
|
|
6864
7023
|
descriptor = {
|
|
6865
7024
|
type: "ellipse",
|
|
6866
7025
|
name: "Ellipse",
|
|
@@ -6876,7 +7035,7 @@ var Jn = class extends W {
|
|
|
6876
7035
|
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
7036
|
return t.style.fillColor ? f <= 1 + p : Math.abs(f - 1) <= p;
|
|
6878
7037
|
}
|
|
6879
|
-
},
|
|
7038
|
+
}, pr = class extends H {
|
|
6880
7039
|
descriptor = {
|
|
6881
7040
|
type: "triangle",
|
|
6882
7041
|
name: "Triangle",
|
|
@@ -6902,7 +7061,7 @@ var Jn = class extends W {
|
|
|
6902
7061
|
}
|
|
6903
7062
|
return !1;
|
|
6904
7063
|
}
|
|
6905
|
-
},
|
|
7064
|
+
}, mr = class extends H {
|
|
6906
7065
|
descriptor = {
|
|
6907
7066
|
type: "pitchfork",
|
|
6908
7067
|
name: "Andrews' Pitchfork",
|
|
@@ -6938,7 +7097,7 @@ var Jn = class extends W {
|
|
|
6938
7097
|
};
|
|
6939
7098
|
return this.distanceToInfiniteLine(e, a, u) <= r || this.distanceToInfiniteLine(e, o, d) <= r;
|
|
6940
7099
|
}
|
|
6941
|
-
},
|
|
7100
|
+
}, hr = [
|
|
6942
7101
|
"1",
|
|
6943
7102
|
"2",
|
|
6944
7103
|
"3",
|
|
@@ -6947,7 +7106,7 @@ var Jn = class extends W {
|
|
|
6947
7106
|
"A",
|
|
6948
7107
|
"B",
|
|
6949
7108
|
"C"
|
|
6950
|
-
],
|
|
7109
|
+
], gr = class extends H {
|
|
6951
7110
|
descriptor = {
|
|
6952
7111
|
type: "elliottWave",
|
|
6953
7112
|
name: "Elliott Wave",
|
|
@@ -6959,9 +7118,9 @@ var Jn = class extends W {
|
|
|
6959
7118
|
this.applyLineStyle(e, t.style), e.beginPath(), e.moveTo(i[0].x, i[0].y);
|
|
6960
7119
|
for (let t = 1; t < i.length; t++) e.lineTo(i[t].x, i[t].y);
|
|
6961
7120
|
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 <
|
|
7121
|
+
for (let t = 0; t < i.length && t < hr.length; t++) {
|
|
6963
7122
|
let n = t % 2 == 0 ? -12 : 12;
|
|
6964
|
-
e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(
|
|
7123
|
+
e.textBaseline = n < 0 ? "bottom" : "top", e.fillText(hr[t], i[t].x, i[t].y + n);
|
|
6965
7124
|
}
|
|
6966
7125
|
r && this.renderAnchorHandles(e, t, n);
|
|
6967
7126
|
}
|
|
@@ -6971,7 +7130,7 @@ var Jn = class extends W {
|
|
|
6971
7130
|
for (let t = 0; t < i.length - 1; t++) if (this.distanceToLine(e, i[t], i[t + 1]) <= r) return !0;
|
|
6972
7131
|
return !1;
|
|
6973
7132
|
}
|
|
6974
|
-
},
|
|
7133
|
+
}, _r = class extends H {
|
|
6975
7134
|
descriptor = {
|
|
6976
7135
|
type: "priceRange",
|
|
6977
7136
|
name: "Price Range",
|
|
@@ -6989,7 +7148,7 @@ var Jn = class extends W {
|
|
|
6989
7148
|
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
7149
|
return e.x >= o - r && e.x <= s + r && e.y >= c - r && e.y <= l + r;
|
|
6991
7150
|
}
|
|
6992
|
-
},
|
|
7151
|
+
}, vr = class extends H {
|
|
6993
7152
|
descriptor = {
|
|
6994
7153
|
type: "dateRange",
|
|
6995
7154
|
name: "Date Range",
|
|
@@ -7007,7 +7166,7 @@ var Jn = class extends W {
|
|
|
7007
7166
|
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
7167
|
return e.x >= s - r && e.x <= c + r && e.y >= o.y && e.y <= o.y + o.height;
|
|
7009
7168
|
}
|
|
7010
|
-
},
|
|
7169
|
+
}, yr = class extends H {
|
|
7011
7170
|
descriptor = {
|
|
7012
7171
|
type: "measure",
|
|
7013
7172
|
name: "Measure",
|
|
@@ -7032,12 +7191,12 @@ var Jn = class extends W {
|
|
|
7032
7191
|
};
|
|
7033
7192
|
//#endregion
|
|
7034
7193
|
//#region src/drawings/tools/TextAnnotation.ts
|
|
7035
|
-
function
|
|
7194
|
+
function br(e, t = "Text") {
|
|
7036
7195
|
if (typeof e.style.text == "string" && e.style.text.length > 0) return e.style.text;
|
|
7037
7196
|
let n = e.meta?.text;
|
|
7038
7197
|
return typeof n == "string" && n.length > 0 ? n : t;
|
|
7039
7198
|
}
|
|
7040
|
-
var
|
|
7199
|
+
var xr = class extends H {
|
|
7041
7200
|
descriptor = {
|
|
7042
7201
|
type: "text",
|
|
7043
7202
|
name: "Text",
|
|
@@ -7045,7 +7204,7 @@ var mr = class extends W {
|
|
|
7045
7204
|
};
|
|
7046
7205
|
render(e, t, n, r) {
|
|
7047
7206
|
if (t.anchors.length < 1) return;
|
|
7048
|
-
let i = this.anchorToPixel(t.anchors[0], n), a =
|
|
7207
|
+
let i = this.anchorToPixel(t.anchors[0], n), a = br(t), o = t.style.fontSize || 14;
|
|
7049
7208
|
if (e.font = `${o}px sans-serif`, e.fillStyle = t.style.color, e.textAlign = "left", e.textBaseline = "top", r) {
|
|
7050
7209
|
let n = e.measureText(a);
|
|
7051
7210
|
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 +7216,7 @@ var mr = class extends W {
|
|
|
7057
7216
|
let i = this.anchorToPixel(t.anchors[0], n), a = t.style.fontSize || 14;
|
|
7058
7217
|
return e.x >= i.x - r && e.x <= i.x + 80 + r && e.y >= i.y - r && e.y <= i.y + a + r;
|
|
7059
7218
|
}
|
|
7060
|
-
},
|
|
7219
|
+
}, Sr = class extends H {
|
|
7061
7220
|
descriptor = {
|
|
7062
7221
|
type: "arrow",
|
|
7063
7222
|
name: "Arrow",
|
|
@@ -7075,7 +7234,7 @@ var mr = class extends W {
|
|
|
7075
7234
|
let i = this.anchorToPixel(t.anchors[0], n), a = this.anchorToPixel(t.anchors[1], n);
|
|
7076
7235
|
return this.distanceToLine(e, i, a) <= r;
|
|
7077
7236
|
}
|
|
7078
|
-
},
|
|
7237
|
+
}, Cr = [
|
|
7079
7238
|
{
|
|
7080
7239
|
label: "8x1",
|
|
7081
7240
|
ratio: 8
|
|
@@ -7112,7 +7271,7 @@ var mr = class extends W {
|
|
|
7112
7271
|
label: "1x8",
|
|
7113
7272
|
ratio: .125
|
|
7114
7273
|
}
|
|
7115
|
-
],
|
|
7274
|
+
], wr = class extends H {
|
|
7116
7275
|
descriptor = {
|
|
7117
7276
|
type: "gannFan",
|
|
7118
7277
|
name: "Gann Fan",
|
|
@@ -7124,7 +7283,7 @@ var mr = class extends W {
|
|
|
7124
7283
|
if (Math.abs(o) < 1) return;
|
|
7125
7284
|
let c = s / o, l = o > 0 ? 1 : -1, { chartRect: u } = n, d = l > 0 ? u.x + u.width : u.x;
|
|
7126
7285
|
this.applyLineStyle(e, t.style);
|
|
7127
|
-
for (let { label: n, ratio: r } of
|
|
7286
|
+
for (let { label: n, ratio: r } of Cr) {
|
|
7128
7287
|
let a = c * r, o = d, s = i.y + a * (o - i.x);
|
|
7129
7288
|
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
7289
|
let f = o - l * 4, p = s;
|
|
@@ -7137,7 +7296,7 @@ var mr = class extends W {
|
|
|
7137
7296
|
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
7297
|
if (Math.abs(o) < 1) return !1;
|
|
7139
7298
|
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
|
|
7299
|
+
for (let { ratio: t } of Cr) {
|
|
7141
7300
|
let n = c * t, a = d, o = i.y + n * (a - i.x);
|
|
7142
7301
|
if (this.distanceToLine(e, i, {
|
|
7143
7302
|
x: a,
|
|
@@ -7146,7 +7305,7 @@ var mr = class extends W {
|
|
|
7146
7305
|
}
|
|
7147
7306
|
return !1;
|
|
7148
7307
|
}
|
|
7149
|
-
},
|
|
7308
|
+
}, Tr = [
|
|
7150
7309
|
0,
|
|
7151
7310
|
.25,
|
|
7152
7311
|
.333,
|
|
@@ -7154,7 +7313,7 @@ var mr = class extends W {
|
|
|
7154
7313
|
.667,
|
|
7155
7314
|
.75,
|
|
7156
7315
|
1
|
|
7157
|
-
],
|
|
7316
|
+
], Er = class extends H {
|
|
7158
7317
|
descriptor = {
|
|
7159
7318
|
type: "gannBox",
|
|
7160
7319
|
name: "Gann Box",
|
|
@@ -7165,18 +7324,18 @@ var mr = class extends W {
|
|
|
7165
7324
|
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
7325
|
if (!(u < 2 || d < 2)) {
|
|
7167
7326
|
this.applyLineStyle(e, t.style), e.strokeRect(o, c, u, d), e.save(), e.globalAlpha = .35;
|
|
7168
|
-
for (let t of
|
|
7327
|
+
for (let t of Tr) {
|
|
7169
7328
|
if (t === 0 || t === 1) continue;
|
|
7170
7329
|
let n = c + d * t;
|
|
7171
7330
|
e.beginPath(), e.moveTo(o, n), e.lineTo(s, n), e.stroke();
|
|
7172
7331
|
}
|
|
7173
|
-
for (let t of
|
|
7332
|
+
for (let t of Tr) {
|
|
7174
7333
|
if (t === 0 || t === 1) continue;
|
|
7175
7334
|
let n = o + u * t;
|
|
7176
7335
|
e.beginPath(), e.moveTo(n, c), e.lineTo(n, l), e.stroke();
|
|
7177
7336
|
}
|
|
7178
7337
|
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
|
|
7338
|
+
for (let t of Tr) {
|
|
7180
7339
|
if (t === 0 || t === 1) continue;
|
|
7181
7340
|
let n = c + d * t;
|
|
7182
7341
|
e.fillText(`${(t * 100).toFixed(0)}%`, o - 3, n);
|
|
@@ -7201,7 +7360,7 @@ var mr = class extends W {
|
|
|
7201
7360
|
y: l
|
|
7202
7361
|
}) <= r;
|
|
7203
7362
|
}
|
|
7204
|
-
},
|
|
7363
|
+
}, Dr = class extends H {
|
|
7205
7364
|
descriptor = {
|
|
7206
7365
|
type: "anchoredVWAP",
|
|
7207
7366
|
name: "Anchored VWAP",
|
|
@@ -7273,7 +7432,7 @@ var mr = class extends W {
|
|
|
7273
7432
|
}
|
|
7274
7433
|
return !1;
|
|
7275
7434
|
}
|
|
7276
|
-
},
|
|
7435
|
+
}, Or = class extends H {
|
|
7277
7436
|
descriptor = {
|
|
7278
7437
|
type: "volumeProfileRange",
|
|
7279
7438
|
name: "Volume Profile (Range)",
|
|
@@ -7315,7 +7474,7 @@ var mr = class extends W {
|
|
|
7315
7474
|
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
7475
|
return e.x >= o && e.x <= s && e.y >= c && e.y <= l;
|
|
7317
7476
|
}
|
|
7318
|
-
},
|
|
7477
|
+
}, kr = [
|
|
7319
7478
|
1,
|
|
7320
7479
|
2,
|
|
7321
7480
|
3,
|
|
@@ -7325,7 +7484,7 @@ var mr = class extends W {
|
|
|
7325
7484
|
21,
|
|
7326
7485
|
34,
|
|
7327
7486
|
55
|
|
7328
|
-
],
|
|
7487
|
+
], Ar = class extends H {
|
|
7329
7488
|
descriptor = {
|
|
7330
7489
|
type: "fibTimeZones",
|
|
7331
7490
|
name: "Fibonacci Time Zones",
|
|
@@ -7337,7 +7496,7 @@ var mr = class extends W {
|
|
|
7337
7496
|
if (a === 0) return;
|
|
7338
7497
|
let { chartRect: o } = n;
|
|
7339
7498
|
e.font = "11px sans-serif", e.textBaseline = "top", e.textAlign = "center", this.applyLineStyle(e, t.style);
|
|
7340
|
-
for (let r of
|
|
7499
|
+
for (let r of kr) {
|
|
7341
7500
|
let s = P(i.time + a * r, n);
|
|
7342
7501
|
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
7502
|
}
|
|
@@ -7349,7 +7508,7 @@ var mr = class extends W {
|
|
|
7349
7508
|
if (a === 0) return !1;
|
|
7350
7509
|
let { chartRect: o } = n;
|
|
7351
7510
|
if (e.y < o.y || e.y > o.y + o.height) return !1;
|
|
7352
|
-
for (let t of
|
|
7511
|
+
for (let t of kr) {
|
|
7353
7512
|
let o = P(i.time + a * t, n);
|
|
7354
7513
|
if (Math.abs(e.x - o) <= r) return !0;
|
|
7355
7514
|
}
|
|
@@ -7358,12 +7517,12 @@ var mr = class extends W {
|
|
|
7358
7517
|
};
|
|
7359
7518
|
//#endregion
|
|
7360
7519
|
//#region src/drawings/tools/index.ts
|
|
7361
|
-
function
|
|
7362
|
-
e.register(new
|
|
7520
|
+
function jr(e) {
|
|
7521
|
+
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
7522
|
}
|
|
7364
7523
|
//#endregion
|
|
7365
7524
|
//#region src/trading/OrderRenderer.ts
|
|
7366
|
-
var
|
|
7525
|
+
var Mr = class {
|
|
7367
7526
|
render(e, t, n, r, i, a) {
|
|
7368
7527
|
let o = i.orderColors?.buy ?? "#26A69A", s = i.orderColors?.sell ?? "#EF5350", { chartRect: c } = n;
|
|
7369
7528
|
for (let i of t) {
|
|
@@ -7404,7 +7563,7 @@ var Tr = class {
|
|
|
7404
7563
|
};
|
|
7405
7564
|
//#endregion
|
|
7406
7565
|
//#region src/trading/positionFormat.ts
|
|
7407
|
-
function
|
|
7566
|
+
function Nr(e, t, n) {
|
|
7408
7567
|
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
7568
|
return {
|
|
7410
7569
|
side: e.side,
|
|
@@ -7418,9 +7577,9 @@ function Er(e, t, n) {
|
|
|
7418
7577
|
precision: n
|
|
7419
7578
|
};
|
|
7420
7579
|
}
|
|
7421
|
-
var
|
|
7422
|
-
function
|
|
7423
|
-
return e.replace(
|
|
7580
|
+
var Pr = /\{(side|qty|closedQty|openQty|entry|price|pnl|pnlPct|pnlSign)\}/g;
|
|
7581
|
+
function Fr(e, t) {
|
|
7582
|
+
return e.replace(Pr, (e, n) => {
|
|
7424
7583
|
switch (n) {
|
|
7425
7584
|
case "side": return t.side.toUpperCase();
|
|
7426
7585
|
case "qty": return String(t.quantity);
|
|
@@ -7435,10 +7594,10 @@ function Or(e, t) {
|
|
|
7435
7594
|
}
|
|
7436
7595
|
});
|
|
7437
7596
|
}
|
|
7438
|
-
function
|
|
7439
|
-
return typeof e == "function" ? e(t) :
|
|
7597
|
+
function Ir(e, t) {
|
|
7598
|
+
return typeof e == "function" ? e(t) : Fr(e ?? "{side} {qty} | P&L: {pnlSign}{pnl}", t);
|
|
7440
7599
|
}
|
|
7441
|
-
function
|
|
7600
|
+
function Lr(e, t, n) {
|
|
7442
7601
|
if (!t || t.length === 0) return n;
|
|
7443
7602
|
let r = [...t].sort((e, t) => e.pnl - t.pnl), i;
|
|
7444
7603
|
for (let t of r) if (e >= t.pnl) i = t.color;
|
|
@@ -7447,20 +7606,20 @@ function Ar(e, t, n) {
|
|
|
7447
7606
|
}
|
|
7448
7607
|
//#endregion
|
|
7449
7608
|
//#region src/trading/PositionRenderer.ts
|
|
7450
|
-
var
|
|
7609
|
+
var Rr = class {
|
|
7451
7610
|
render(e, t, n, r, i, a) {
|
|
7452
7611
|
let { chartRect: o } = r, s = a.positionColors?.profit ?? "#26A69A", c = a.positionColors?.loss ?? "#EF5350", l = a.positionColors?.entry ?? "#2196F3", u = a.pricePrecision ?? 2;
|
|
7453
7612
|
for (let d of t) {
|
|
7454
7613
|
let t = k(d.entryPrice, r);
|
|
7455
7614
|
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 =
|
|
7615
|
+
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
7616
|
e.fillStyle = g, e.globalAlpha = .08;
|
|
7458
7617
|
let _ = Math.min(t, f), v = Math.abs(f - t);
|
|
7459
7618
|
if (e.fillRect(o.x, _, o.width, v), e.globalAlpha = 1, p.closedQuantity > 0 && d.quantity > 0) {
|
|
7460
7619
|
let t = p.closedQuantity / d.quantity;
|
|
7461
7620
|
e.fillStyle = l, e.globalAlpha = .25, e.fillRect(o.x, _, Math.max(2, o.width * t * .04) + 2, v), e.globalAlpha = 1;
|
|
7462
7621
|
}
|
|
7463
|
-
let y =
|
|
7622
|
+
let y = Ir(a.positionLabel, p);
|
|
7464
7623
|
e.font = `bold 11px ${i.font.family}`;
|
|
7465
7624
|
let b = e.measureText(y).width + 12, x = o.x + 8;
|
|
7466
7625
|
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 +7642,7 @@ var jr = class {
|
|
|
7483
7642
|
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
7643
|
}
|
|
7485
7644
|
}
|
|
7486
|
-
},
|
|
7645
|
+
}, zr = class {
|
|
7487
7646
|
render(e, t, n, r) {
|
|
7488
7647
|
if (!r.depthOverlay?.enabled) return;
|
|
7489
7648
|
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 +7673,7 @@ var jr = class {
|
|
|
7514
7673
|
e.fillRect(p - o, a - f / 2, o, f);
|
|
7515
7674
|
}
|
|
7516
7675
|
}
|
|
7517
|
-
},
|
|
7676
|
+
}, Br = class {
|
|
7518
7677
|
dragState = null;
|
|
7519
7678
|
startY = 0;
|
|
7520
7679
|
dragging = !1;
|
|
@@ -7578,7 +7737,7 @@ var jr = class {
|
|
|
7578
7737
|
isActive() {
|
|
7579
7738
|
return this.dragState !== null;
|
|
7580
7739
|
}
|
|
7581
|
-
},
|
|
7740
|
+
}, Vr = class {
|
|
7582
7741
|
menuElement = null;
|
|
7583
7742
|
removeHandler = null;
|
|
7584
7743
|
onItemSelect = null;
|
|
@@ -7665,7 +7824,7 @@ var jr = class {
|
|
|
7665
7824
|
};
|
|
7666
7825
|
//#endregion
|
|
7667
7826
|
//#region src/trading/BracketTool.ts
|
|
7668
|
-
function
|
|
7827
|
+
function Hr(e, t, n = {}) {
|
|
7669
7828
|
let r = Math.max(Math.abs(t) * (n.riskFraction ?? .01), 1e-8), i = r * (n.riskReward ?? 2);
|
|
7670
7829
|
return e === "buy" ? {
|
|
7671
7830
|
side: e,
|
|
@@ -7679,11 +7838,11 @@ function Fr(e, t, n = {}) {
|
|
|
7679
7838
|
takeProfit: t - i
|
|
7680
7839
|
};
|
|
7681
7840
|
}
|
|
7682
|
-
function
|
|
7841
|
+
function Ur(e) {
|
|
7683
7842
|
let t = Math.abs(e.entry - e.stopLoss);
|
|
7684
7843
|
return t === 0 ? 0 : Math.abs(e.takeProfit - e.entry) / t;
|
|
7685
7844
|
}
|
|
7686
|
-
var
|
|
7845
|
+
var Wr = 6, Gr = class {
|
|
7687
7846
|
draft = null;
|
|
7688
7847
|
dragging = null;
|
|
7689
7848
|
defaults;
|
|
@@ -7691,7 +7850,7 @@ var Lr = 6, Rr = class {
|
|
|
7691
7850
|
this.defaults = e;
|
|
7692
7851
|
}
|
|
7693
7852
|
start(e, t) {
|
|
7694
|
-
this.draft =
|
|
7853
|
+
this.draft = Hr(e, t, this.defaults), this.dragging = null;
|
|
7695
7854
|
}
|
|
7696
7855
|
cancel() {
|
|
7697
7856
|
this.draft = null, this.dragging = null;
|
|
@@ -7708,7 +7867,7 @@ var Lr = 6, Rr = class {
|
|
|
7708
7867
|
"entry",
|
|
7709
7868
|
"sl",
|
|
7710
7869
|
"tp"
|
|
7711
|
-
], r = null, i =
|
|
7870
|
+
], r = null, i = Wr;
|
|
7712
7871
|
for (let a of n) {
|
|
7713
7872
|
let n = k(this.priceOf(a), t), o = Math.abs(n - e.y);
|
|
7714
7873
|
o <= i && (i = o, r = a);
|
|
@@ -7722,7 +7881,7 @@ var Lr = 6, Rr = class {
|
|
|
7722
7881
|
drag(e, t) {
|
|
7723
7882
|
if (!this.draft || !this.dragging) return !1;
|
|
7724
7883
|
let n = j(e.y, t);
|
|
7725
|
-
return this.draft =
|
|
7884
|
+
return this.draft = Kr(this.draft, this.dragging, n), !0;
|
|
7726
7885
|
}
|
|
7727
7886
|
endDrag() {
|
|
7728
7887
|
this.dragging = null;
|
|
@@ -7738,9 +7897,9 @@ var Lr = 6, Rr = class {
|
|
|
7738
7897
|
let i = this.draft;
|
|
7739
7898
|
if (!i) return;
|
|
7740
7899
|
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
|
-
|
|
7900
|
+
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, []);
|
|
7901
|
+
let p = Ur(i), m = i.side === "buy" ? "LONG" : "SHORT";
|
|
7902
|
+
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
7903
|
for (let [r, a] of [
|
|
7745
7904
|
[i.entry, n.text],
|
|
7746
7905
|
[i.takeProfit, d],
|
|
@@ -7752,7 +7911,7 @@ var Lr = 6, Rr = class {
|
|
|
7752
7911
|
e.restore();
|
|
7753
7912
|
}
|
|
7754
7913
|
};
|
|
7755
|
-
function
|
|
7914
|
+
function Kr(e, t, n) {
|
|
7756
7915
|
let r = e.side === "buy";
|
|
7757
7916
|
if (t === "entry") {
|
|
7758
7917
|
let t = n - e.entry;
|
|
@@ -7776,28 +7935,99 @@ function zr(e, t, n) {
|
|
|
7776
7935
|
takeProfit: i
|
|
7777
7936
|
};
|
|
7778
7937
|
}
|
|
7779
|
-
function
|
|
7938
|
+
function qr(e, t, n, r, i, a) {
|
|
7780
7939
|
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
7940
|
}
|
|
7782
|
-
function
|
|
7941
|
+
function Jr(e, t, n, r, i, a) {
|
|
7942
|
+
e.font = "600 10px system-ui, sans-serif", e.textBaseline = "middle", e.textAlign = "left";
|
|
7943
|
+
let o = e.measureText(r).width;
|
|
7944
|
+
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);
|
|
7945
|
+
}
|
|
7946
|
+
//#endregion
|
|
7947
|
+
//#region src/trading/OrderDraftTool.ts
|
|
7948
|
+
function Yr(e, t, n) {
|
|
7949
|
+
return n == null ? "limit" : e === "buy" ? t <= n ? "limit" : "stop" : t >= n ? "limit" : "stop";
|
|
7950
|
+
}
|
|
7951
|
+
var Xr = 6, Zr = class {
|
|
7952
|
+
draft = null;
|
|
7953
|
+
dragging = !1;
|
|
7954
|
+
start(e, t, n = 1) {
|
|
7955
|
+
this.draft = {
|
|
7956
|
+
side: e,
|
|
7957
|
+
price: t,
|
|
7958
|
+
quantity: n
|
|
7959
|
+
}, this.dragging = !1;
|
|
7960
|
+
}
|
|
7961
|
+
cancel() {
|
|
7962
|
+
this.draft = null, this.dragging = !1;
|
|
7963
|
+
}
|
|
7964
|
+
isActive() {
|
|
7965
|
+
return this.draft !== null;
|
|
7966
|
+
}
|
|
7967
|
+
isDragging() {
|
|
7968
|
+
return this.dragging;
|
|
7969
|
+
}
|
|
7970
|
+
getDraft() {
|
|
7971
|
+
return this.draft ? { ...this.draft } : null;
|
|
7972
|
+
}
|
|
7973
|
+
setPrice(e) {
|
|
7974
|
+
return this.draft ? (this.draft = {
|
|
7975
|
+
...this.draft,
|
|
7976
|
+
price: e
|
|
7977
|
+
}, !0) : !1;
|
|
7978
|
+
}
|
|
7979
|
+
toIntent(e) {
|
|
7980
|
+
return this.draft ? {
|
|
7981
|
+
side: this.draft.side,
|
|
7982
|
+
type: Yr(this.draft.side, this.draft.price, e),
|
|
7983
|
+
price: this.draft.price,
|
|
7984
|
+
quantity: this.draft.quantity
|
|
7985
|
+
} : null;
|
|
7986
|
+
}
|
|
7987
|
+
hitTest(e, t) {
|
|
7988
|
+
return this.draft ? Math.abs(k(this.draft.price, t) - e.y) <= Xr : !1;
|
|
7989
|
+
}
|
|
7990
|
+
beginDrag(e, t) {
|
|
7991
|
+
return this.hitTest(e, t) ? (this.dragging = !0, !0) : !1;
|
|
7992
|
+
}
|
|
7993
|
+
drag(e, t) {
|
|
7994
|
+
return !this.draft || !this.dragging ? !1 : this.setPrice(j(e.y, t));
|
|
7995
|
+
}
|
|
7996
|
+
endDrag() {
|
|
7997
|
+
this.dragging = !1;
|
|
7998
|
+
}
|
|
7999
|
+
render(e, t, n, r, i = 2) {
|
|
8000
|
+
let a = this.draft;
|
|
8001
|
+
if (!a) return;
|
|
8002
|
+
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;
|
|
8003
|
+
e.save(), Qr(e, s, c, l, d, [6, 3]);
|
|
8004
|
+
let f = a.side === "buy" ? "BUY" : "SELL";
|
|
8005
|
+
$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();
|
|
8006
|
+
}
|
|
8007
|
+
};
|
|
8008
|
+
function Qr(e, t, n, r, i, a) {
|
|
8009
|
+
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([]);
|
|
8010
|
+
}
|
|
8011
|
+
function $r(e, t, n, r, i, a) {
|
|
7783
8012
|
e.font = "600 10px system-ui, sans-serif", e.textBaseline = "middle", e.textAlign = "left";
|
|
7784
8013
|
let o = e.measureText(r).width;
|
|
7785
8014
|
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
8015
|
}
|
|
7787
8016
|
//#endregion
|
|
7788
8017
|
//#region src/trading/TradingManager.ts
|
|
7789
|
-
var
|
|
8018
|
+
var ei = class {
|
|
7790
8019
|
orders = [];
|
|
7791
8020
|
positions = [];
|
|
7792
8021
|
depthData = null;
|
|
7793
8022
|
currentPrice = null;
|
|
7794
8023
|
config;
|
|
7795
|
-
orderRenderer = new
|
|
7796
|
-
positionRenderer = new
|
|
7797
|
-
depthOverlay = new
|
|
8024
|
+
orderRenderer = new Mr();
|
|
8025
|
+
positionRenderer = new Rr();
|
|
8026
|
+
depthOverlay = new zr();
|
|
7798
8027
|
dragHandler;
|
|
7799
|
-
contextMenu = new
|
|
7800
|
-
bracket = new
|
|
8028
|
+
contextMenu = new Vr();
|
|
8029
|
+
bracket = new Gr();
|
|
8030
|
+
orderDraft = new Zr();
|
|
7801
8031
|
requestRender = null;
|
|
7802
8032
|
eventCallback = null;
|
|
7803
8033
|
container = null;
|
|
@@ -7805,7 +8035,7 @@ var Hr = class {
|
|
|
7805
8035
|
this.config = {
|
|
7806
8036
|
...s,
|
|
7807
8037
|
...e
|
|
7808
|
-
}, this.dragHandler = new
|
|
8038
|
+
}, this.dragHandler = new Br(this.config.dragThreshold), this.contextMenu.onItemSelect = (e) => {
|
|
7809
8039
|
this.eventCallback?.("orderPlace", e);
|
|
7810
8040
|
};
|
|
7811
8041
|
}
|
|
@@ -7846,26 +8076,44 @@ var Hr = class {
|
|
|
7846
8076
|
entry: e.entry,
|
|
7847
8077
|
stopLoss: e.stopLoss,
|
|
7848
8078
|
takeProfit: e.takeProfit,
|
|
7849
|
-
riskReward:
|
|
8079
|
+
riskReward: Ur(e)
|
|
7850
8080
|
}), this.bracket.cancel(), this.requestRender?.(), !0) : !1;
|
|
7851
8081
|
}
|
|
7852
8082
|
isBracketActive() {
|
|
7853
8083
|
return this.bracket.isActive();
|
|
7854
8084
|
}
|
|
8085
|
+
startOrderDraft(e, t) {
|
|
8086
|
+
this.orderDraft.start(e, t), this.requestRender?.();
|
|
8087
|
+
}
|
|
8088
|
+
cancelOrderDraft() {
|
|
8089
|
+
this.orderDraft.isActive() && (this.orderDraft.cancel(), this.requestRender?.());
|
|
8090
|
+
}
|
|
8091
|
+
confirmOrderDraft() {
|
|
8092
|
+
let e = this.orderDraft.toIntent(this.currentPrice);
|
|
8093
|
+
return e ? (this.eventCallback?.("orderPlace", e), this.orderDraft.cancel(), this.requestRender?.(), !0) : !1;
|
|
8094
|
+
}
|
|
8095
|
+
isOrderDraftActive() {
|
|
8096
|
+
return this.orderDraft.isActive();
|
|
8097
|
+
}
|
|
7855
8098
|
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;
|
|
8099
|
+
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
8100
|
}
|
|
7858
8101
|
onPointerMove(e, t) {
|
|
7859
8102
|
if (this.bracket.isDragging()) {
|
|
7860
8103
|
let n = this.bracket.drag(e, t);
|
|
7861
8104
|
return n && this.requestRender?.(), n;
|
|
7862
8105
|
}
|
|
8106
|
+
if (this.orderDraft.isDragging()) {
|
|
8107
|
+
let n = this.orderDraft.drag(e, t);
|
|
8108
|
+
return n && this.requestRender?.(), n;
|
|
8109
|
+
}
|
|
7863
8110
|
if (!this.dragHandler.isActive()) return !1;
|
|
7864
8111
|
let n = this.dragHandler.onPointerMove(e, t);
|
|
7865
8112
|
return n && this.requestRender?.(), n;
|
|
7866
8113
|
}
|
|
7867
8114
|
onPointerUp() {
|
|
7868
8115
|
if (this.bracket.isDragging()) return this.bracket.endDrag(), this.requestRender?.(), !0;
|
|
8116
|
+
if (this.orderDraft.isDragging()) return this.orderDraft.endDrag(), this.requestRender?.(), !0;
|
|
7869
8117
|
let e = this.dragHandler.onPointerUp();
|
|
7870
8118
|
return e ? (e.sourceType === "order" ? this.eventCallback?.("orderModify", {
|
|
7871
8119
|
orderId: e.id,
|
|
@@ -7882,7 +8130,7 @@ var Hr = class {
|
|
|
7882
8130
|
return this.contextMenu.show(e, n, this.container, this.config), !0;
|
|
7883
8131
|
}
|
|
7884
8132
|
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));
|
|
8133
|
+
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
8134
|
}
|
|
7887
8135
|
renderAxisBadges(e, t, n) {
|
|
7888
8136
|
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 +8138,7 @@ var Hr = class {
|
|
|
7890
8138
|
destroy() {
|
|
7891
8139
|
this.contextMenu.destroy();
|
|
7892
8140
|
}
|
|
7893
|
-
},
|
|
8141
|
+
}, ti = class {
|
|
7894
8142
|
constructor(e) {
|
|
7895
8143
|
this.manager = e;
|
|
7896
8144
|
}
|
|
@@ -7900,7 +8148,144 @@ var Hr = class {
|
|
|
7900
8148
|
renderAxisBadges(e, t, n) {
|
|
7901
8149
|
this.manager.renderAxisBadges(e, t, n);
|
|
7902
8150
|
}
|
|
7903
|
-
},
|
|
8151
|
+
}, ni = class {
|
|
8152
|
+
name = "paper";
|
|
8153
|
+
state = "disconnected";
|
|
8154
|
+
listeners = /* @__PURE__ */ new Map();
|
|
8155
|
+
orders = [];
|
|
8156
|
+
positions = [];
|
|
8157
|
+
markPrice;
|
|
8158
|
+
seq = 0;
|
|
8159
|
+
constructor(e = {}) {
|
|
8160
|
+
this.markPrice = e.markPrice ?? 0;
|
|
8161
|
+
}
|
|
8162
|
+
connect(e) {
|
|
8163
|
+
this.state = "connected", this.emit("connectionChange", this.state), this.emit("orders", this.orders), this.emit("positions", this.positions);
|
|
8164
|
+
}
|
|
8165
|
+
disconnect() {
|
|
8166
|
+
this.state = "disconnected", this.emit("connectionChange", this.state);
|
|
8167
|
+
}
|
|
8168
|
+
getConnectionState() {
|
|
8169
|
+
return this.state;
|
|
8170
|
+
}
|
|
8171
|
+
setMarkPrice(e) {
|
|
8172
|
+
this.markPrice = e, this.checkPendingOrders(), this.checkStops();
|
|
8173
|
+
}
|
|
8174
|
+
getOrders() {
|
|
8175
|
+
return [...this.orders];
|
|
8176
|
+
}
|
|
8177
|
+
getPositions() {
|
|
8178
|
+
return [...this.positions];
|
|
8179
|
+
}
|
|
8180
|
+
async placeOrder(e) {
|
|
8181
|
+
let t = {
|
|
8182
|
+
id: this.nextId("ord"),
|
|
8183
|
+
side: e.side,
|
|
8184
|
+
type: e.type,
|
|
8185
|
+
price: e.price,
|
|
8186
|
+
stopPrice: e.stopPrice,
|
|
8187
|
+
quantity: e.quantity ?? 1,
|
|
8188
|
+
label: e.type === "market" ? void 0 : ri(e.type),
|
|
8189
|
+
draggable: !0
|
|
8190
|
+
};
|
|
8191
|
+
return e.type === "market" ? this.fill(t, this.markPrice || e.price) : (this.orders = [...this.orders, t], this.emit("orders", this.orders)), t;
|
|
8192
|
+
}
|
|
8193
|
+
async modifyOrder(e) {
|
|
8194
|
+
this.orders = this.orders.map((t) => t.id === e.orderId ? {
|
|
8195
|
+
...t,
|
|
8196
|
+
price: e.newPrice
|
|
8197
|
+
} : t), this.emit("orders", this.orders);
|
|
8198
|
+
}
|
|
8199
|
+
async cancelOrder(e) {
|
|
8200
|
+
this.orders = this.orders.filter((t) => t.id !== e.orderId), this.emit("orders", this.orders);
|
|
8201
|
+
}
|
|
8202
|
+
async modifyPosition(e) {
|
|
8203
|
+
this.positions = this.positions.map((t) => t.id === e.positionId ? {
|
|
8204
|
+
...t,
|
|
8205
|
+
stopLoss: e.stopLoss ?? t.stopLoss,
|
|
8206
|
+
takeProfit: e.takeProfit ?? t.takeProfit
|
|
8207
|
+
} : t), this.emit("positions", this.positions);
|
|
8208
|
+
}
|
|
8209
|
+
async closePosition(e) {
|
|
8210
|
+
this.positions = this.positions.filter((t) => t.id !== e.positionId), this.emit("positions", this.positions);
|
|
8211
|
+
}
|
|
8212
|
+
on(e, t) {
|
|
8213
|
+
let n = this.listeners.get(e);
|
|
8214
|
+
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t);
|
|
8215
|
+
}
|
|
8216
|
+
off(e, t) {
|
|
8217
|
+
this.listeners.get(e)?.delete(t);
|
|
8218
|
+
}
|
|
8219
|
+
dispose() {
|
|
8220
|
+
this.disconnect(), this.listeners.clear(), this.orders = [], this.positions = [];
|
|
8221
|
+
}
|
|
8222
|
+
fill(e, t) {
|
|
8223
|
+
this.orders = this.orders.filter((t) => t.id !== e.id);
|
|
8224
|
+
let n = {
|
|
8225
|
+
id: this.nextId("pos"),
|
|
8226
|
+
side: e.side,
|
|
8227
|
+
entryPrice: t,
|
|
8228
|
+
quantity: e.quantity
|
|
8229
|
+
};
|
|
8230
|
+
this.positions = [...this.positions, n];
|
|
8231
|
+
let r = {
|
|
8232
|
+
orderId: e.id,
|
|
8233
|
+
side: e.side,
|
|
8234
|
+
price: t,
|
|
8235
|
+
quantity: e.quantity,
|
|
8236
|
+
time: Date.now()
|
|
8237
|
+
};
|
|
8238
|
+
this.emit("fill", r), this.emit("orders", this.orders), this.emit("positions", this.positions);
|
|
8239
|
+
}
|
|
8240
|
+
checkPendingOrders() {
|
|
8241
|
+
let e = this.orders.filter((e) => this.isTriggered(e));
|
|
8242
|
+
for (let t of e) this.fill(t, t.type === "limit" ? t.price : t.stopPrice ?? t.price);
|
|
8243
|
+
}
|
|
8244
|
+
isTriggered(e) {
|
|
8245
|
+
if (e.type === "limit") return e.side === "buy" ? this.markPrice <= e.price : this.markPrice >= e.price;
|
|
8246
|
+
if (e.type === "stop" || e.type === "stopLimit") {
|
|
8247
|
+
let t = e.stopPrice ?? e.price;
|
|
8248
|
+
return e.side === "buy" ? this.markPrice >= t : this.markPrice <= t;
|
|
8249
|
+
}
|
|
8250
|
+
return !1;
|
|
8251
|
+
}
|
|
8252
|
+
checkStops() {
|
|
8253
|
+
let e = [], t = !1;
|
|
8254
|
+
for (let n of this.positions) {
|
|
8255
|
+
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);
|
|
8256
|
+
if (r || i) {
|
|
8257
|
+
t = !0;
|
|
8258
|
+
continue;
|
|
8259
|
+
}
|
|
8260
|
+
e.push(n);
|
|
8261
|
+
}
|
|
8262
|
+
t && (this.positions = e, this.emit("positions", this.positions));
|
|
8263
|
+
}
|
|
8264
|
+
nextId(e) {
|
|
8265
|
+
return `${e}-${++this.seq}`;
|
|
8266
|
+
}
|
|
8267
|
+
emit(e, t) {
|
|
8268
|
+
let n = this.listeners.get(e);
|
|
8269
|
+
if (n) {
|
|
8270
|
+
let r = {
|
|
8271
|
+
type: e,
|
|
8272
|
+
data: t,
|
|
8273
|
+
timestamp: Date.now()
|
|
8274
|
+
};
|
|
8275
|
+
for (let e of n) e(r);
|
|
8276
|
+
}
|
|
8277
|
+
}
|
|
8278
|
+
};
|
|
8279
|
+
function ri(e) {
|
|
8280
|
+
switch (e) {
|
|
8281
|
+
case "stop": return "STOP";
|
|
8282
|
+
case "stopLimit": return "STOP LIMIT";
|
|
8283
|
+
default: return "LIMIT";
|
|
8284
|
+
}
|
|
8285
|
+
}
|
|
8286
|
+
//#endregion
|
|
8287
|
+
//#region src/realtime/Emitter.ts
|
|
8288
|
+
var G = class {
|
|
7904
8289
|
listeners = /* @__PURE__ */ new Map();
|
|
7905
8290
|
on(e, t) {
|
|
7906
8291
|
let n = this.listeners.get(e);
|
|
@@ -7922,7 +8307,7 @@ var Hr = class {
|
|
|
7922
8307
|
removeAllListeners() {
|
|
7923
8308
|
this.listeners.clear();
|
|
7924
8309
|
}
|
|
7925
|
-
},
|
|
8310
|
+
}, ii = class extends G {
|
|
7926
8311
|
currentBar = null;
|
|
7927
8312
|
timeframeMs;
|
|
7928
8313
|
tickRing;
|
|
@@ -7984,7 +8369,7 @@ var Hr = class {
|
|
|
7984
8369
|
alignToTimeframe(e) {
|
|
7985
8370
|
return Math.floor(e / this.timeframeMs) * this.timeframeMs;
|
|
7986
8371
|
}
|
|
7987
|
-
},
|
|
8372
|
+
}, ai = class extends G {
|
|
7988
8373
|
config;
|
|
7989
8374
|
attempt = 0;
|
|
7990
8375
|
timer = null;
|
|
@@ -8031,7 +8416,7 @@ var Hr = class {
|
|
|
8031
8416
|
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
8417
|
return Math.max(0, Math.round(n + r));
|
|
8033
8418
|
}
|
|
8034
|
-
},
|
|
8419
|
+
}, oi = class {
|
|
8035
8420
|
price = null;
|
|
8036
8421
|
previousClose = null;
|
|
8037
8422
|
visible = !0;
|
|
@@ -8062,12 +8447,12 @@ var Hr = class {
|
|
|
8062
8447
|
let f = s - 5;
|
|
8063
8448
|
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
8449
|
}
|
|
8065
|
-
},
|
|
8450
|
+
}, si = class extends G {
|
|
8066
8451
|
config = null;
|
|
8067
8452
|
adapter = null;
|
|
8068
8453
|
aggregator = null;
|
|
8069
8454
|
reconnector;
|
|
8070
|
-
priceLine = new
|
|
8455
|
+
priceLine = new oi();
|
|
8071
8456
|
state = "disconnected";
|
|
8072
8457
|
lastPrice = null;
|
|
8073
8458
|
previousClose = null;
|
|
@@ -8075,13 +8460,13 @@ var Hr = class {
|
|
|
8075
8460
|
heartbeatTimer = null;
|
|
8076
8461
|
lastMessageTime = 0;
|
|
8077
8462
|
constructor() {
|
|
8078
|
-
super(), this.reconnector = new
|
|
8463
|
+
super(), this.reconnector = new ai(), this.wireReconnector();
|
|
8079
8464
|
}
|
|
8080
8465
|
async connect(e) {
|
|
8081
8466
|
this.disconnect(), this.config = {
|
|
8082
8467
|
...a,
|
|
8083
8468
|
...e
|
|
8084
|
-
}, this.adapter = e.adapter, this.aggregator = new
|
|
8469
|
+
}, 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
8470
|
this.emit("barUpdate", e), this.updatePrice(e.close);
|
|
8086
8471
|
}), this.aggregator.on("barClose", (e) => {
|
|
8087
8472
|
this.previousClose = e.close, this.emit("barClose", e);
|
|
@@ -8191,7 +8576,7 @@ var Hr = class {
|
|
|
8191
8576
|
dispose() {
|
|
8192
8577
|
this.disconnect(), this.removeAllListeners();
|
|
8193
8578
|
}
|
|
8194
|
-
},
|
|
8579
|
+
}, ci = class extends G {
|
|
8195
8580
|
data;
|
|
8196
8581
|
speed;
|
|
8197
8582
|
index;
|
|
@@ -8278,11 +8663,11 @@ var Hr = class {
|
|
|
8278
8663
|
};
|
|
8279
8664
|
//#endregion
|
|
8280
8665
|
//#region src/realtime/adapters/binanceTypes.ts
|
|
8281
|
-
function
|
|
8666
|
+
function li(e) {
|
|
8282
8667
|
if (!Array.isArray(e) || e.length < 6) return null;
|
|
8283
8668
|
let t = e[0];
|
|
8284
8669
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
8285
|
-
let n =
|
|
8670
|
+
let n = K(e[1]), r = K(e[2]), i = K(e[3]), a = K(e[4]), o = K(e[5]);
|
|
8286
8671
|
return n === null || r === null || i === null || a === null || o === null ? null : {
|
|
8287
8672
|
time: t,
|
|
8288
8673
|
open: n,
|
|
@@ -8292,11 +8677,11 @@ function Yr(e) {
|
|
|
8292
8677
|
volume: o
|
|
8293
8678
|
};
|
|
8294
8679
|
}
|
|
8295
|
-
function
|
|
8296
|
-
if (!
|
|
8680
|
+
function ui(e) {
|
|
8681
|
+
if (!di(e)) return null;
|
|
8297
8682
|
let t = e.t;
|
|
8298
8683
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
8299
|
-
let n =
|
|
8684
|
+
let n = K(e.o), r = K(e.h), i = K(e.l), a = K(e.c), o = K(e.v);
|
|
8300
8685
|
if (n === null || r === null || i === null || a === null || o === null) return null;
|
|
8301
8686
|
let s = typeof e.x == "boolean" ? e.x : !1;
|
|
8302
8687
|
return {
|
|
@@ -8311,7 +8696,7 @@ function Xr(e) {
|
|
|
8311
8696
|
closed: s
|
|
8312
8697
|
};
|
|
8313
8698
|
}
|
|
8314
|
-
function
|
|
8699
|
+
function K(e) {
|
|
8315
8700
|
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
8316
8701
|
if (typeof e == "string") {
|
|
8317
8702
|
let t = parseFloat(e);
|
|
@@ -8319,12 +8704,12 @@ function J(e) {
|
|
|
8319
8704
|
}
|
|
8320
8705
|
return null;
|
|
8321
8706
|
}
|
|
8322
|
-
function
|
|
8707
|
+
function di(e) {
|
|
8323
8708
|
return typeof e == "object" && !!e;
|
|
8324
8709
|
}
|
|
8325
8710
|
//#endregion
|
|
8326
8711
|
//#region src/realtime/adapters/BinanceAdapter.ts
|
|
8327
|
-
var
|
|
8712
|
+
var fi = {
|
|
8328
8713
|
"1s": "1s",
|
|
8329
8714
|
"1m": "1m",
|
|
8330
8715
|
"3m": "3m",
|
|
@@ -8341,7 +8726,7 @@ var Qr = {
|
|
|
8341
8726
|
"3d": "3d",
|
|
8342
8727
|
"1w": "1w",
|
|
8343
8728
|
"1M": "1M"
|
|
8344
|
-
},
|
|
8729
|
+
}, pi = class {
|
|
8345
8730
|
name = "binance";
|
|
8346
8731
|
ws = null;
|
|
8347
8732
|
state = "disconnected";
|
|
@@ -8362,13 +8747,13 @@ var Qr = {
|
|
|
8362
8747
|
return this.state;
|
|
8363
8748
|
}
|
|
8364
8749
|
async fetchHistory(e, t, n = 500) {
|
|
8365
|
-
let r =
|
|
8750
|
+
let r = fi[t] ?? "15m", i = `${this.restBase}/klines?symbol=${e}&interval=${r}&limit=${n}`, a = await fetch(i);
|
|
8366
8751
|
if (!a.ok) throw Error(`Binance REST error: ${a.status}`);
|
|
8367
8752
|
let o = await a.json();
|
|
8368
8753
|
if (!Array.isArray(o)) return [];
|
|
8369
8754
|
let s = [];
|
|
8370
8755
|
for (let e of o) {
|
|
8371
|
-
let t =
|
|
8756
|
+
let t = li(e);
|
|
8372
8757
|
t && s.push(t);
|
|
8373
8758
|
}
|
|
8374
8759
|
return s;
|
|
@@ -8385,7 +8770,7 @@ var Qr = {
|
|
|
8385
8770
|
}
|
|
8386
8771
|
connectWs() {
|
|
8387
8772
|
if (!this.config) return;
|
|
8388
|
-
let e = `${this.config.symbol.toLowerCase()}@kline_${
|
|
8773
|
+
let e = `${this.config.symbol.toLowerCase()}@kline_${fi[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
|
|
8389
8774
|
this.setState("connecting");
|
|
8390
8775
|
try {
|
|
8391
8776
|
this.ws = new WebSocket(t);
|
|
@@ -8410,7 +8795,7 @@ var Qr = {
|
|
|
8410
8795
|
};
|
|
8411
8796
|
}
|
|
8412
8797
|
handleKline(e) {
|
|
8413
|
-
let t =
|
|
8798
|
+
let t = ui(e);
|
|
8414
8799
|
if (!t) return;
|
|
8415
8800
|
let { bar: n, closed: r } = t;
|
|
8416
8801
|
this.emitEvent("bar", {
|
|
@@ -8436,7 +8821,7 @@ var Qr = {
|
|
|
8436
8821
|
for (let e of n) e(r);
|
|
8437
8822
|
}
|
|
8438
8823
|
}
|
|
8439
|
-
},
|
|
8824
|
+
}, mi = class {
|
|
8440
8825
|
name = "mock";
|
|
8441
8826
|
state = "disconnected";
|
|
8442
8827
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -8531,7 +8916,453 @@ var Qr = {
|
|
|
8531
8916
|
for (let e of n) e(r);
|
|
8532
8917
|
}
|
|
8533
8918
|
}
|
|
8534
|
-
},
|
|
8919
|
+
}, hi = class {
|
|
8920
|
+
name;
|
|
8921
|
+
ws = null;
|
|
8922
|
+
state = "disconnected";
|
|
8923
|
+
config = null;
|
|
8924
|
+
listeners = /* @__PURE__ */ new Map();
|
|
8925
|
+
opts;
|
|
8926
|
+
constructor(e) {
|
|
8927
|
+
this.opts = e, this.name = e.name;
|
|
8928
|
+
}
|
|
8929
|
+
connect(e) {
|
|
8930
|
+
this.config = e, this.openSocket();
|
|
8931
|
+
}
|
|
8932
|
+
disconnect() {
|
|
8933
|
+
let e = this.config;
|
|
8934
|
+
if (this.ws) {
|
|
8935
|
+
if (this.opts.unsubscribeMessage && e) try {
|
|
8936
|
+
this.sendMessage(this.opts.unsubscribeMessage(e));
|
|
8937
|
+
} catch {}
|
|
8938
|
+
this.ws.onclose = null, this.ws.close(), this.ws = null;
|
|
8939
|
+
}
|
|
8940
|
+
this.setState("disconnected");
|
|
8941
|
+
}
|
|
8942
|
+
getConnectionState() {
|
|
8943
|
+
return this.state;
|
|
8944
|
+
}
|
|
8945
|
+
fetchHistory(e, t, n) {
|
|
8946
|
+
return this.opts.fetchHistory(e, t, n ?? this.opts.defaultHistoryLimit ?? 500);
|
|
8947
|
+
}
|
|
8948
|
+
on(e, t) {
|
|
8949
|
+
let n = this.listeners.get(e);
|
|
8950
|
+
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t);
|
|
8951
|
+
}
|
|
8952
|
+
off(e, t) {
|
|
8953
|
+
this.listeners.get(e)?.delete(t);
|
|
8954
|
+
}
|
|
8955
|
+
dispose() {
|
|
8956
|
+
this.disconnect(), this.listeners.clear();
|
|
8957
|
+
}
|
|
8958
|
+
openSocket() {
|
|
8959
|
+
let e = this.config;
|
|
8960
|
+
if (!e) return;
|
|
8961
|
+
let t = this.opts.wsUrl(e);
|
|
8962
|
+
this.setState("connecting");
|
|
8963
|
+
let n;
|
|
8964
|
+
try {
|
|
8965
|
+
n = this.createSocket(t);
|
|
8966
|
+
} catch {
|
|
8967
|
+
this.setState("error"), this.emitEvent("error", { message: "WebSocket creation failed" }), this.emitEvent("connectionChange", "error");
|
|
8968
|
+
return;
|
|
8969
|
+
}
|
|
8970
|
+
this.ws = n, n.onopen = () => {
|
|
8971
|
+
if (this.setState("connected"), this.emitEvent("connectionChange", "connected"), this.opts.subscribeMessage) try {
|
|
8972
|
+
this.sendMessage(this.opts.subscribeMessage(e));
|
|
8973
|
+
} catch {}
|
|
8974
|
+
}, n.onmessage = (t) => {
|
|
8975
|
+
let n = this.decode(t.data);
|
|
8976
|
+
if (n === void 0) return;
|
|
8977
|
+
let r;
|
|
8978
|
+
try {
|
|
8979
|
+
r = this.opts.parseMessage(n, e);
|
|
8980
|
+
} catch {
|
|
8981
|
+
return;
|
|
8982
|
+
}
|
|
8983
|
+
r && (r.bar && this.emitEvent("bar", {
|
|
8984
|
+
bar: r.bar,
|
|
8985
|
+
closed: r.closed ?? !1
|
|
8986
|
+
}), r.tick ? this.emitEvent("tick", r.tick) : r.bar && this.emitEvent("tick", {
|
|
8987
|
+
time: Date.now(),
|
|
8988
|
+
price: r.bar.close,
|
|
8989
|
+
volume: r.bar.volume
|
|
8990
|
+
}));
|
|
8991
|
+
}, n.onerror = () => {
|
|
8992
|
+
this.setState("error"), this.emitEvent("error", { message: "WebSocket error" });
|
|
8993
|
+
}, n.onclose = () => {
|
|
8994
|
+
this.setState("disconnected"), this.emitEvent("connectionChange", "disconnected");
|
|
8995
|
+
};
|
|
8996
|
+
}
|
|
8997
|
+
sendMessage(e) {
|
|
8998
|
+
e === void 0 || !this.ws || this.ws.send(typeof e == "string" ? e : JSON.stringify(e));
|
|
8999
|
+
}
|
|
9000
|
+
decode(e) {
|
|
9001
|
+
if (this.opts.decode) try {
|
|
9002
|
+
return this.opts.decode(e);
|
|
9003
|
+
} catch {
|
|
9004
|
+
return;
|
|
9005
|
+
}
|
|
9006
|
+
if (typeof e == "string") try {
|
|
9007
|
+
return JSON.parse(e);
|
|
9008
|
+
} catch {
|
|
9009
|
+
return;
|
|
9010
|
+
}
|
|
9011
|
+
return e;
|
|
9012
|
+
}
|
|
9013
|
+
createSocket(e) {
|
|
9014
|
+
if (this.opts.socketFactory) return this.opts.socketFactory(e);
|
|
9015
|
+
let t = globalThis.WebSocket;
|
|
9016
|
+
if (!t) throw Error("No WebSocket implementation available");
|
|
9017
|
+
return new t(e);
|
|
9018
|
+
}
|
|
9019
|
+
setState(e) {
|
|
9020
|
+
this.state = e;
|
|
9021
|
+
}
|
|
9022
|
+
emitEvent(e, t) {
|
|
9023
|
+
let n = this.listeners.get(e);
|
|
9024
|
+
if (n) {
|
|
9025
|
+
let r = {
|
|
9026
|
+
type: e,
|
|
9027
|
+
data: t,
|
|
9028
|
+
timestamp: Date.now()
|
|
9029
|
+
};
|
|
9030
|
+
for (let e of n) e(r);
|
|
9031
|
+
}
|
|
9032
|
+
}
|
|
9033
|
+
}, gi = class {
|
|
9034
|
+
name;
|
|
9035
|
+
state = "disconnected";
|
|
9036
|
+
listeners = /* @__PURE__ */ new Map();
|
|
9037
|
+
config = null;
|
|
9038
|
+
timer = null;
|
|
9039
|
+
lastBarTime = 0;
|
|
9040
|
+
opts;
|
|
9041
|
+
constructor(e) {
|
|
9042
|
+
this.opts = e, this.name = e.name;
|
|
9043
|
+
}
|
|
9044
|
+
connect(e) {
|
|
9045
|
+
this.config = e, this.lastBarTime = 0, this.state = "connected", this.emitEvent("connectionChange", "connected"), this.startPolling();
|
|
9046
|
+
}
|
|
9047
|
+
disconnect() {
|
|
9048
|
+
this.stopPolling(), this.state = "disconnected", this.emitEvent("connectionChange", "disconnected");
|
|
9049
|
+
}
|
|
9050
|
+
getConnectionState() {
|
|
9051
|
+
return this.state;
|
|
9052
|
+
}
|
|
9053
|
+
fetchHistory(e, t, n) {
|
|
9054
|
+
return this.opts.fetchBars(e, t, n ?? this.opts.defaultHistoryLimit ?? 500);
|
|
9055
|
+
}
|
|
9056
|
+
on(e, t) {
|
|
9057
|
+
let n = this.listeners.get(e);
|
|
9058
|
+
n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), n.add(t);
|
|
9059
|
+
}
|
|
9060
|
+
off(e, t) {
|
|
9061
|
+
this.listeners.get(e)?.delete(t);
|
|
9062
|
+
}
|
|
9063
|
+
dispose() {
|
|
9064
|
+
this.disconnect(), this.listeners.clear();
|
|
9065
|
+
}
|
|
9066
|
+
async poll() {
|
|
9067
|
+
let e = this.config;
|
|
9068
|
+
if (!e || this.state !== "connected") return;
|
|
9069
|
+
let t;
|
|
9070
|
+
try {
|
|
9071
|
+
t = await this.opts.fetchBars(e.symbol, e.timeframe, this.opts.pollLimit ?? 2);
|
|
9072
|
+
} catch (e) {
|
|
9073
|
+
this.emitEvent("error", {
|
|
9074
|
+
message: "Poll failed",
|
|
9075
|
+
cause: e
|
|
9076
|
+
});
|
|
9077
|
+
return;
|
|
9078
|
+
}
|
|
9079
|
+
if (t.length === 0) return;
|
|
9080
|
+
let n = t[t.length - 1];
|
|
9081
|
+
if (this.lastBarTime > 0 && n.time > this.lastBarTime) {
|
|
9082
|
+
let e = t.find((e) => e.time === this.lastBarTime);
|
|
9083
|
+
e && this.emitEvent("bar", {
|
|
9084
|
+
bar: e,
|
|
9085
|
+
closed: !0
|
|
9086
|
+
});
|
|
9087
|
+
}
|
|
9088
|
+
this.emitEvent("bar", {
|
|
9089
|
+
bar: n,
|
|
9090
|
+
closed: !1
|
|
9091
|
+
}), this.emitEvent("tick", {
|
|
9092
|
+
time: Date.now(),
|
|
9093
|
+
price: n.close,
|
|
9094
|
+
volume: n.volume
|
|
9095
|
+
}), this.lastBarTime = n.time;
|
|
9096
|
+
}
|
|
9097
|
+
startPolling() {
|
|
9098
|
+
this.stopPolling(), this.poll();
|
|
9099
|
+
let e = this.opts.setInterval ?? ((e, t) => setInterval(e, t));
|
|
9100
|
+
this.timer = e(() => {
|
|
9101
|
+
this.poll();
|
|
9102
|
+
}, this.opts.intervalMs ?? 5e3);
|
|
9103
|
+
}
|
|
9104
|
+
stopPolling() {
|
|
9105
|
+
this.timer !== null && ((this.opts.clearInterval ?? ((e) => clearInterval(e)))(this.timer), this.timer = null);
|
|
9106
|
+
}
|
|
9107
|
+
emitEvent(e, t) {
|
|
9108
|
+
let n = this.listeners.get(e);
|
|
9109
|
+
if (n) {
|
|
9110
|
+
let r = {
|
|
9111
|
+
type: e,
|
|
9112
|
+
data: t,
|
|
9113
|
+
timestamp: Date.now()
|
|
9114
|
+
};
|
|
9115
|
+
for (let e of n) e(r);
|
|
9116
|
+
}
|
|
9117
|
+
}
|
|
9118
|
+
};
|
|
9119
|
+
//#endregion
|
|
9120
|
+
//#region src/realtime/adapters/parseUtils.ts
|
|
9121
|
+
function q(e) {
|
|
9122
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
9123
|
+
if (typeof e == "string") {
|
|
9124
|
+
let t = parseFloat(e);
|
|
9125
|
+
return Number.isFinite(t) ? t : null;
|
|
9126
|
+
}
|
|
9127
|
+
return null;
|
|
9128
|
+
}
|
|
9129
|
+
function J(e) {
|
|
9130
|
+
return typeof e == "object" && !!e;
|
|
9131
|
+
}
|
|
9132
|
+
//#endregion
|
|
9133
|
+
//#region src/realtime/adapters/CoinbaseAdapter.ts
|
|
9134
|
+
var _i = {
|
|
9135
|
+
"1m": 60,
|
|
9136
|
+
"5m": 300,
|
|
9137
|
+
"15m": 900,
|
|
9138
|
+
"1h": 3600,
|
|
9139
|
+
"6h": 21600,
|
|
9140
|
+
"1d": 86400
|
|
9141
|
+
};
|
|
9142
|
+
function vi(e) {
|
|
9143
|
+
return _i[e] ?? 3600;
|
|
9144
|
+
}
|
|
9145
|
+
var yi = class extends gi {
|
|
9146
|
+
constructor(e = {}) {
|
|
9147
|
+
let t = e.restBase ?? "https://api.exchange.coinbase.com";
|
|
9148
|
+
super({
|
|
9149
|
+
name: "coinbase",
|
|
9150
|
+
intervalMs: e.intervalMs ?? 5e3,
|
|
9151
|
+
pollLimit: 2,
|
|
9152
|
+
fetchBars: (e, n) => bi(t, e, n)
|
|
9153
|
+
});
|
|
9154
|
+
}
|
|
9155
|
+
};
|
|
9156
|
+
async function bi(e, t, n) {
|
|
9157
|
+
let r = `${e}/products/${t}/candles?granularity=${vi(n)}`, i = await fetch(r);
|
|
9158
|
+
if (!i.ok) throw Error(`Coinbase REST error: ${i.status}`);
|
|
9159
|
+
return xi(await i.json());
|
|
9160
|
+
}
|
|
9161
|
+
function xi(e) {
|
|
9162
|
+
if (!Array.isArray(e)) return [];
|
|
9163
|
+
let t = [];
|
|
9164
|
+
for (let n of e) {
|
|
9165
|
+
let e = Si(n);
|
|
9166
|
+
e && t.push(e);
|
|
9167
|
+
}
|
|
9168
|
+
return t.sort((e, t) => e.time - t.time), t;
|
|
9169
|
+
}
|
|
9170
|
+
function Si(e) {
|
|
9171
|
+
if (!Array.isArray(e) || e.length < 6) return null;
|
|
9172
|
+
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]);
|
|
9173
|
+
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
9174
|
+
time: t * 1e3,
|
|
9175
|
+
open: i,
|
|
9176
|
+
high: r,
|
|
9177
|
+
low: n,
|
|
9178
|
+
close: a,
|
|
9179
|
+
volume: o
|
|
9180
|
+
};
|
|
9181
|
+
}
|
|
9182
|
+
//#endregion
|
|
9183
|
+
//#region src/realtime/adapters/BybitAdapter.ts
|
|
9184
|
+
var Ci = {
|
|
9185
|
+
"1m": "1",
|
|
9186
|
+
"3m": "3",
|
|
9187
|
+
"5m": "5",
|
|
9188
|
+
"15m": "15",
|
|
9189
|
+
"30m": "30",
|
|
9190
|
+
"1h": "60",
|
|
9191
|
+
"2h": "120",
|
|
9192
|
+
"4h": "240",
|
|
9193
|
+
"6h": "360",
|
|
9194
|
+
"12h": "720",
|
|
9195
|
+
"1d": "D",
|
|
9196
|
+
"1w": "W",
|
|
9197
|
+
"1M": "M"
|
|
9198
|
+
};
|
|
9199
|
+
function wi(e) {
|
|
9200
|
+
return Ci[e] ?? "1";
|
|
9201
|
+
}
|
|
9202
|
+
var Ti = class extends hi {
|
|
9203
|
+
constructor(e = {}) {
|
|
9204
|
+
let t = e.restBase ?? "https://api.bybit.com", n = e.wsBase ?? "wss://stream.bybit.com/v5/public/spot", r = e.category ?? "spot";
|
|
9205
|
+
super({
|
|
9206
|
+
name: "bybit",
|
|
9207
|
+
wsUrl: () => n,
|
|
9208
|
+
subscribeMessage: (e) => ({
|
|
9209
|
+
op: "subscribe",
|
|
9210
|
+
args: [`kline.${wi(e.timeframe)}.${e.symbol}`]
|
|
9211
|
+
}),
|
|
9212
|
+
unsubscribeMessage: (e) => ({
|
|
9213
|
+
op: "unsubscribe",
|
|
9214
|
+
args: [`kline.${wi(e.timeframe)}.${e.symbol}`]
|
|
9215
|
+
}),
|
|
9216
|
+
parseMessage: Ei,
|
|
9217
|
+
fetchHistory: (e, n, i) => Di(t, r, e, n, i)
|
|
9218
|
+
});
|
|
9219
|
+
}
|
|
9220
|
+
};
|
|
9221
|
+
function Ei(e) {
|
|
9222
|
+
if (!J(e) || typeof e.topic != "string" || !e.topic.startsWith("kline.")) return null;
|
|
9223
|
+
let t = e.data;
|
|
9224
|
+
if (!Array.isArray(t) || t.length === 0) return null;
|
|
9225
|
+
let n = t[t.length - 1];
|
|
9226
|
+
if (!J(n)) return null;
|
|
9227
|
+
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);
|
|
9228
|
+
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
9229
|
+
let l = typeof n.confirm == "boolean" ? n.confirm : !1;
|
|
9230
|
+
return {
|
|
9231
|
+
bar: {
|
|
9232
|
+
time: r,
|
|
9233
|
+
open: i,
|
|
9234
|
+
high: a,
|
|
9235
|
+
low: o,
|
|
9236
|
+
close: s,
|
|
9237
|
+
volume: c
|
|
9238
|
+
},
|
|
9239
|
+
closed: l
|
|
9240
|
+
};
|
|
9241
|
+
}
|
|
9242
|
+
async function Di(e, t, n, r, i) {
|
|
9243
|
+
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);
|
|
9244
|
+
if (!o.ok) throw Error(`Bybit REST error: ${o.status}`);
|
|
9245
|
+
return Oi(await o.json());
|
|
9246
|
+
}
|
|
9247
|
+
function Oi(e) {
|
|
9248
|
+
if (!J(e) || !J(e.result)) return [];
|
|
9249
|
+
let t = e.result.list;
|
|
9250
|
+
if (!Array.isArray(t)) return [];
|
|
9251
|
+
let n = [];
|
|
9252
|
+
for (let e of t) {
|
|
9253
|
+
let t = ki(e);
|
|
9254
|
+
t && n.push(t);
|
|
9255
|
+
}
|
|
9256
|
+
return n.sort((e, t) => e.time - t.time), n;
|
|
9257
|
+
}
|
|
9258
|
+
function ki(e) {
|
|
9259
|
+
if (!Array.isArray(e) || e.length < 6) return null;
|
|
9260
|
+
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]);
|
|
9261
|
+
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
9262
|
+
time: t,
|
|
9263
|
+
open: n,
|
|
9264
|
+
high: r,
|
|
9265
|
+
low: i,
|
|
9266
|
+
close: a,
|
|
9267
|
+
volume: o
|
|
9268
|
+
};
|
|
9269
|
+
}
|
|
9270
|
+
//#endregion
|
|
9271
|
+
//#region src/realtime/adapters/KrakenAdapter.ts
|
|
9272
|
+
var Ai = {
|
|
9273
|
+
"1m": 1,
|
|
9274
|
+
"5m": 5,
|
|
9275
|
+
"15m": 15,
|
|
9276
|
+
"30m": 30,
|
|
9277
|
+
"1h": 60,
|
|
9278
|
+
"4h": 240,
|
|
9279
|
+
"1d": 1440,
|
|
9280
|
+
"1w": 10080
|
|
9281
|
+
};
|
|
9282
|
+
function ji(e) {
|
|
9283
|
+
return Ai[e] ?? 1;
|
|
9284
|
+
}
|
|
9285
|
+
var Mi = class extends hi {
|
|
9286
|
+
constructor(e = {}) {
|
|
9287
|
+
let t = e.restBase ?? "https://api.kraken.com", n = e.wsBase ?? "wss://ws.kraken.com/v2";
|
|
9288
|
+
super({
|
|
9289
|
+
name: "kraken",
|
|
9290
|
+
wsUrl: () => n,
|
|
9291
|
+
subscribeMessage: (e) => ({
|
|
9292
|
+
method: "subscribe",
|
|
9293
|
+
params: {
|
|
9294
|
+
channel: "ohlc",
|
|
9295
|
+
symbol: [e.symbol],
|
|
9296
|
+
interval: ji(e.timeframe)
|
|
9297
|
+
}
|
|
9298
|
+
}),
|
|
9299
|
+
unsubscribeMessage: (e) => ({
|
|
9300
|
+
method: "unsubscribe",
|
|
9301
|
+
params: {
|
|
9302
|
+
channel: "ohlc",
|
|
9303
|
+
symbol: [e.symbol],
|
|
9304
|
+
interval: ji(e.timeframe)
|
|
9305
|
+
}
|
|
9306
|
+
}),
|
|
9307
|
+
parseMessage: Ni,
|
|
9308
|
+
fetchHistory: (e, n) => Pi(t, e, n)
|
|
9309
|
+
});
|
|
9310
|
+
}
|
|
9311
|
+
};
|
|
9312
|
+
function Ni(e) {
|
|
9313
|
+
if (!J(e) || e.channel !== "ohlc") return null;
|
|
9314
|
+
let t = e.data;
|
|
9315
|
+
if (!Array.isArray(t) || t.length === 0) return null;
|
|
9316
|
+
let n = t[t.length - 1];
|
|
9317
|
+
if (!J(n)) return null;
|
|
9318
|
+
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;
|
|
9319
|
+
return r === null || i === null || a === null || o === null || s === null || !Number.isFinite(c) ? null : {
|
|
9320
|
+
bar: {
|
|
9321
|
+
time: c,
|
|
9322
|
+
open: r,
|
|
9323
|
+
high: i,
|
|
9324
|
+
low: a,
|
|
9325
|
+
close: o,
|
|
9326
|
+
volume: s
|
|
9327
|
+
},
|
|
9328
|
+
closed: !1
|
|
9329
|
+
};
|
|
9330
|
+
}
|
|
9331
|
+
async function Pi(e, t, n) {
|
|
9332
|
+
let r = ji(n), i = t.replace("/", ""), a = `${e}/0/public/OHLC?pair=${encodeURIComponent(i)}&interval=${r}`, o = await fetch(a);
|
|
9333
|
+
if (!o.ok) throw Error(`Kraken REST error: ${o.status}`);
|
|
9334
|
+
return Fi(await o.json());
|
|
9335
|
+
}
|
|
9336
|
+
function Fi(e) {
|
|
9337
|
+
if (!J(e) || !J(e.result)) return [];
|
|
9338
|
+
let t = null;
|
|
9339
|
+
for (let [n, r] of Object.entries(e.result)) if (n !== "last" && Array.isArray(r)) {
|
|
9340
|
+
t = r;
|
|
9341
|
+
break;
|
|
9342
|
+
}
|
|
9343
|
+
if (!Array.isArray(t)) return [];
|
|
9344
|
+
let n = [];
|
|
9345
|
+
for (let e of t) {
|
|
9346
|
+
let t = Ii(e);
|
|
9347
|
+
t && n.push(t);
|
|
9348
|
+
}
|
|
9349
|
+
return n.sort((e, t) => e.time - t.time), n;
|
|
9350
|
+
}
|
|
9351
|
+
function Ii(e) {
|
|
9352
|
+
if (!Array.isArray(e) || e.length < 7) return null;
|
|
9353
|
+
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]);
|
|
9354
|
+
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
9355
|
+
time: t * 1e3,
|
|
9356
|
+
open: n,
|
|
9357
|
+
high: r,
|
|
9358
|
+
low: i,
|
|
9359
|
+
close: a,
|
|
9360
|
+
volume: o
|
|
9361
|
+
};
|
|
9362
|
+
}
|
|
9363
|
+
//#endregion
|
|
9364
|
+
//#region src/ui/ChartLegend.ts
|
|
9365
|
+
var Li = {
|
|
8535
9366
|
visible: !0,
|
|
8536
9367
|
showSymbol: !0,
|
|
8537
9368
|
showOHLC: !0,
|
|
@@ -8539,8 +9370,8 @@ var Qr = {
|
|
|
8539
9370
|
showVolume: !0,
|
|
8540
9371
|
position: "top-left",
|
|
8541
9372
|
fontSize: 12
|
|
8542
|
-
},
|
|
8543
|
-
config = { ...
|
|
9373
|
+
}, Ri = class {
|
|
9374
|
+
config = { ...Li };
|
|
8544
9375
|
symbol = "";
|
|
8545
9376
|
timeframe = "";
|
|
8546
9377
|
hoverBar = null;
|
|
@@ -8631,7 +9462,7 @@ var Qr = {
|
|
|
8631
9462
|
}
|
|
8632
9463
|
}
|
|
8633
9464
|
}
|
|
8634
|
-
},
|
|
9465
|
+
}, zi = class {
|
|
8635
9466
|
static toDataURL(e, t) {
|
|
8636
9467
|
let n = e.querySelectorAll("canvas");
|
|
8637
9468
|
if (n.length === 0) return "";
|
|
@@ -8653,7 +9484,7 @@ var Qr = {
|
|
|
8653
9484
|
let i = document.createElement("a");
|
|
8654
9485
|
i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i);
|
|
8655
9486
|
}
|
|
8656
|
-
},
|
|
9487
|
+
}, Bi = class {
|
|
8657
9488
|
config = null;
|
|
8658
9489
|
setConfig(e) {
|
|
8659
9490
|
this.config = e;
|
|
@@ -8663,7 +9494,7 @@ var Qr = {
|
|
|
8663
9494
|
let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = this.config.color ?? n.textSecondary;
|
|
8664
9495
|
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
9496
|
}
|
|
8666
|
-
},
|
|
9497
|
+
}, Vi = class {
|
|
8667
9498
|
visible = !0;
|
|
8668
9499
|
timeframeMs = 0;
|
|
8669
9500
|
setVisible(e) {
|
|
@@ -8686,7 +9517,7 @@ var Qr = {
|
|
|
8686
9517
|
let t = Math.ceil(e / 1e3), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60;
|
|
8687
9518
|
return n > 0 ? `${n}:${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}` : `${r}:${String(i).padStart(2, "0")}`;
|
|
8688
9519
|
}
|
|
8689
|
-
},
|
|
9520
|
+
}, Hi = class {
|
|
8690
9521
|
config = { visible: !1 };
|
|
8691
9522
|
cachedBreaksTyped = [];
|
|
8692
9523
|
lastDataLength = 0;
|
|
@@ -8733,21 +9564,21 @@ var Qr = {
|
|
|
8733
9564
|
render(e, t, n, r) {
|
|
8734
9565
|
if (!this.config.visible || r.length < 2) return;
|
|
8735
9566
|
let i = this.computeBreaksTyped(r);
|
|
8736
|
-
if (i.length === 0 ||
|
|
9567
|
+
if (i.length === 0 || Ki(r) >= 1380 * 60 * 1e3) return;
|
|
8737
9568
|
let { chartRect: a } = t, o = this.config.color ?? n.axisLine, s = this.config.lineWidth ?? 1, c = this.config.lineStyle ?? "dashed";
|
|
8738
9569
|
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
9570
|
for (let r of i) {
|
|
8740
9571
|
let i = O(r.idx, t) - (t.barWidth + t.barSpacing) / 2;
|
|
8741
9572
|
if (i < a.x - 1 || i > a.x + a.width + 1) continue;
|
|
8742
9573
|
let c = Math.round(i) + .5, l = .25, u = s, d = null;
|
|
8743
|
-
r.kind === "day" ? l = .22 : r.kind === "week" ? (l = .34, d =
|
|
9574
|
+
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
9575
|
}
|
|
8745
9576
|
e.restore();
|
|
8746
9577
|
}
|
|
8747
9578
|
invalidateCache() {
|
|
8748
9579
|
this.lastDataLength = 0, this.cachedBreaksTyped = [];
|
|
8749
9580
|
}
|
|
8750
|
-
},
|
|
9581
|
+
}, Ui = [
|
|
8751
9582
|
"Jan",
|
|
8752
9583
|
"Feb",
|
|
8753
9584
|
"Mar",
|
|
@@ -8761,13 +9592,13 @@ var Qr = {
|
|
|
8761
9592
|
"Nov",
|
|
8762
9593
|
"Dec"
|
|
8763
9594
|
];
|
|
8764
|
-
function
|
|
8765
|
-
return `${
|
|
9595
|
+
function Wi(e) {
|
|
9596
|
+
return `${Ui[e.getMonth()]} ${e.getDate()}`;
|
|
8766
9597
|
}
|
|
8767
|
-
function
|
|
8768
|
-
return `${
|
|
9598
|
+
function Gi(e) {
|
|
9599
|
+
return `${Ui[e.getMonth()]} ${String(e.getFullYear()).slice(-2)}`;
|
|
8769
9600
|
}
|
|
8770
|
-
function
|
|
9601
|
+
function Ki(e) {
|
|
8771
9602
|
if (e.length < 2) return 0;
|
|
8772
9603
|
let t = Math.min(50, e.length - 1), n = [];
|
|
8773
9604
|
for (let r = 1; r <= t; r++) {
|
|
@@ -8778,24 +9609,24 @@ function ui(e) {
|
|
|
8778
9609
|
}
|
|
8779
9610
|
//#endregion
|
|
8780
9611
|
//#region src/ui/sessionHours.ts
|
|
8781
|
-
var
|
|
8782
|
-
function
|
|
8783
|
-
let n = ((e + t * 6e4) %
|
|
9612
|
+
var qi = 864e5;
|
|
9613
|
+
function Ji(e, t) {
|
|
9614
|
+
let n = ((e + t * 6e4) % qi + qi) % qi;
|
|
8784
9615
|
return Math.floor(n / 6e4);
|
|
8785
9616
|
}
|
|
8786
|
-
function
|
|
8787
|
-
let n =
|
|
9617
|
+
function Yi(e, t) {
|
|
9618
|
+
let n = Ji(e, t.tzOffsetMinutes), { startMinute: r, endMinute: i } = t;
|
|
8788
9619
|
return r === i ? !0 : r < i ? n >= r && n < i : n >= r || n < i;
|
|
8789
9620
|
}
|
|
8790
9621
|
//#endregion
|
|
8791
9622
|
//#region src/ui/SessionShading.ts
|
|
8792
|
-
var
|
|
9623
|
+
var Xi = {
|
|
8793
9624
|
startMinute: 570,
|
|
8794
9625
|
endMinute: 960,
|
|
8795
9626
|
tzOffsetMinutes: -300
|
|
8796
|
-
},
|
|
9627
|
+
}, Zi = class {
|
|
8797
9628
|
visible = !1;
|
|
8798
|
-
config = { ...
|
|
9629
|
+
config = { ...Xi };
|
|
8799
9630
|
setVisible(e) {
|
|
8800
9631
|
this.visible = e;
|
|
8801
9632
|
}
|
|
@@ -8822,12 +9653,12 @@ var mi = {
|
|
|
8822
9653
|
e.fillRect(a, i.y, o - a, i.height);
|
|
8823
9654
|
};
|
|
8824
9655
|
for (let e = s; e <= c; e++) {
|
|
8825
|
-
let n = !
|
|
9656
|
+
let n = !Yi(t[e].time, this.config);
|
|
8826
9657
|
n && d === -1 ? d = e : !n && d !== -1 && (f(d, e - 1), d = -1);
|
|
8827
9658
|
}
|
|
8828
9659
|
d !== -1 && f(d, c), e.restore();
|
|
8829
9660
|
}
|
|
8830
|
-
},
|
|
9661
|
+
}, Qi = 1, $i = class extends G {
|
|
8831
9662
|
alerts = [];
|
|
8832
9663
|
lastValues = /* @__PURE__ */ new Map();
|
|
8833
9664
|
requestRender = null;
|
|
@@ -8839,7 +9670,7 @@ var mi = {
|
|
|
8839
9670
|
this.pricePrecision = e;
|
|
8840
9671
|
}
|
|
8841
9672
|
addAlert(e, t = "crossing", n, r = !1, i = "price", a) {
|
|
8842
|
-
let o = `tc_alert_${
|
|
9673
|
+
let o = `tc_alert_${Qi++}`, s = {
|
|
8843
9674
|
id: o,
|
|
8844
9675
|
price: e,
|
|
8845
9676
|
condition: t,
|
|
@@ -8948,7 +9779,7 @@ var mi = {
|
|
|
8948
9779
|
e.fillText(s, r.x + r.width - 4, a - 2);
|
|
8949
9780
|
}
|
|
8950
9781
|
}
|
|
8951
|
-
},
|
|
9782
|
+
}, ea = class extends G {
|
|
8952
9783
|
data = [];
|
|
8953
9784
|
currentIndex = 0;
|
|
8954
9785
|
timer = null;
|
|
@@ -9017,13 +9848,13 @@ function X(e) {
|
|
|
9017
9848
|
function Z(e) {
|
|
9018
9849
|
return Array.isArray(e) ? e : [];
|
|
9019
9850
|
}
|
|
9020
|
-
function
|
|
9851
|
+
function ta(e, t) {
|
|
9021
9852
|
return typeof e == "string" ? e : t;
|
|
9022
9853
|
}
|
|
9023
|
-
function
|
|
9854
|
+
function na(e, t) {
|
|
9024
9855
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
9025
9856
|
}
|
|
9026
|
-
function
|
|
9857
|
+
function ra(e) {
|
|
9027
9858
|
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
9859
|
let t = [];
|
|
9029
9860
|
for (let n of e.anchors) {
|
|
@@ -9044,14 +9875,14 @@ function xi(e) {
|
|
|
9044
9875
|
meta: X(e.meta) ? e.meta : void 0
|
|
9045
9876
|
};
|
|
9046
9877
|
}
|
|
9047
|
-
function
|
|
9878
|
+
function ia(e) {
|
|
9048
9879
|
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
9880
|
}
|
|
9050
|
-
function
|
|
9881
|
+
function aa(e) {
|
|
9051
9882
|
return !X(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
|
|
9052
9883
|
}
|
|
9053
|
-
function
|
|
9054
|
-
if (!X(e)) return
|
|
9884
|
+
function oa(e) {
|
|
9885
|
+
if (!X(e)) return sa();
|
|
9055
9886
|
typeof e.version == "number" && e.version !== Y && console.warn(`Chart state version mismatch: ${e.version} vs ${Y}`);
|
|
9056
9887
|
let t = X(e.viewport) ? e.viewport : {}, n = [];
|
|
9057
9888
|
for (let t of Z(e.indicators)) X(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || X(t.params) && n.push({
|
|
@@ -9062,31 +9893,31 @@ function wi(e) {
|
|
|
9062
9893
|
}));
|
|
9063
9894
|
let r = [];
|
|
9064
9895
|
for (let t of Z(e.drawings)) {
|
|
9065
|
-
let e =
|
|
9896
|
+
let e = ra(t);
|
|
9066
9897
|
e && r.push(e);
|
|
9067
9898
|
}
|
|
9068
9899
|
let i = [];
|
|
9069
9900
|
for (let t of Z(e.orders)) {
|
|
9070
|
-
let e =
|
|
9901
|
+
let e = ia(t);
|
|
9071
9902
|
e && i.push(e);
|
|
9072
9903
|
}
|
|
9073
9904
|
let a = [];
|
|
9074
9905
|
for (let t of Z(e.positions)) {
|
|
9075
|
-
let e =
|
|
9906
|
+
let e = aa(t);
|
|
9076
9907
|
e && a.push(e);
|
|
9077
9908
|
}
|
|
9078
9909
|
let o = [];
|
|
9079
9910
|
for (let t of Z(e.alerts)) X(t) && typeof t.id == "string" && o.push(t);
|
|
9080
9911
|
return {
|
|
9081
9912
|
version: typeof e.version == "number" ? e.version : Y,
|
|
9082
|
-
timestamp:
|
|
9913
|
+
timestamp: na(e.timestamp, Date.now()),
|
|
9083
9914
|
symbol: typeof e.symbol == "string" ? e.symbol : void 0,
|
|
9084
9915
|
timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
|
|
9085
|
-
chartType:
|
|
9916
|
+
chartType: ta(e.chartType, "candlestick"),
|
|
9086
9917
|
viewport: {
|
|
9087
|
-
barWidth:
|
|
9088
|
-
barSpacing:
|
|
9089
|
-
offset:
|
|
9918
|
+
barWidth: na(t.barWidth, 8),
|
|
9919
|
+
barSpacing: na(t.barSpacing, 2),
|
|
9920
|
+
offset: na(t.offset, 0)
|
|
9090
9921
|
},
|
|
9091
9922
|
theme: typeof e.theme == "string" ? e.theme : void 0,
|
|
9092
9923
|
locale: typeof e.locale == "string" ? e.locale : void 0,
|
|
@@ -9097,7 +9928,7 @@ function wi(e) {
|
|
|
9097
9928
|
alerts: o
|
|
9098
9929
|
};
|
|
9099
9930
|
}
|
|
9100
|
-
function
|
|
9931
|
+
function sa() {
|
|
9101
9932
|
return {
|
|
9102
9933
|
version: Y,
|
|
9103
9934
|
timestamp: Date.now(),
|
|
@@ -9114,7 +9945,7 @@ function Ti() {
|
|
|
9114
9945
|
alerts: []
|
|
9115
9946
|
};
|
|
9116
9947
|
}
|
|
9117
|
-
var
|
|
9948
|
+
var ca = class {
|
|
9118
9949
|
static capture(e, t) {
|
|
9119
9950
|
return {
|
|
9120
9951
|
version: Y,
|
|
@@ -9139,7 +9970,7 @@ var Ei = class {
|
|
|
9139
9970
|
return JSON.stringify(e);
|
|
9140
9971
|
}
|
|
9141
9972
|
static deserialize(e) {
|
|
9142
|
-
return
|
|
9973
|
+
return oa(JSON.parse(e));
|
|
9143
9974
|
}
|
|
9144
9975
|
static saveToStorage(e, t) {
|
|
9145
9976
|
localStorage.setItem(e, this.serialize(t));
|
|
@@ -9166,7 +9997,7 @@ var Ei = class {
|
|
|
9166
9997
|
}, n.click();
|
|
9167
9998
|
});
|
|
9168
9999
|
}
|
|
9169
|
-
},
|
|
10000
|
+
}, la = class {
|
|
9170
10001
|
undoStack = [];
|
|
9171
10002
|
redoStack = [];
|
|
9172
10003
|
maxHistory = 50;
|
|
@@ -9202,7 +10033,7 @@ var Ei = class {
|
|
|
9202
10033
|
redoCount: this.redoStack.length
|
|
9203
10034
|
};
|
|
9204
10035
|
}
|
|
9205
|
-
},
|
|
10036
|
+
}, ua = class {
|
|
9206
10037
|
static toCSV(e) {
|
|
9207
10038
|
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
10039
|
}
|
|
@@ -9220,7 +10051,7 @@ var Ei = class {
|
|
|
9220
10051
|
let r = new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
9221
10052
|
a.href = i, a.download = t, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
9222
10053
|
}
|
|
9223
|
-
},
|
|
10054
|
+
}, da = 1, fa = class extends G {
|
|
9224
10055
|
markers = [];
|
|
9225
10056
|
style = { ...i };
|
|
9226
10057
|
requestRender = null;
|
|
@@ -9241,7 +10072,7 @@ var Ei = class {
|
|
|
9241
10072
|
return { ...this.style };
|
|
9242
10073
|
}
|
|
9243
10074
|
addMarker(e) {
|
|
9244
|
-
let t = e.id ?? `tc_signal_${
|
|
10075
|
+
let t = e.id ?? `tc_signal_${da++}`, n = {
|
|
9245
10076
|
...e,
|
|
9246
10077
|
id: t
|
|
9247
10078
|
};
|
|
@@ -9295,7 +10126,7 @@ var Ei = class {
|
|
|
9295
10126
|
renderArrow(e, t, n, r, i, a) {
|
|
9296
10127
|
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
10128
|
}
|
|
9298
|
-
},
|
|
10129
|
+
}, pa = 1, ma = class extends G {
|
|
9299
10130
|
zones = [];
|
|
9300
10131
|
style = { ...o };
|
|
9301
10132
|
requestRender = null;
|
|
@@ -9320,7 +10151,7 @@ var Ei = class {
|
|
|
9320
10151
|
return { ...this.style };
|
|
9321
10152
|
}
|
|
9322
10153
|
addZone(e) {
|
|
9323
|
-
let t = e.id ?? `tc_zone_${
|
|
10154
|
+
let t = e.id ?? `tc_zone_${pa++}`, n = {
|
|
9324
10155
|
...e,
|
|
9325
10156
|
id: t
|
|
9326
10157
|
};
|
|
@@ -9371,7 +10202,7 @@ var Ei = class {
|
|
|
9371
10202
|
}
|
|
9372
10203
|
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
10204
|
}
|
|
9374
|
-
},
|
|
10205
|
+
}, ha = class {
|
|
9375
10206
|
active = !1;
|
|
9376
10207
|
startBar = 0;
|
|
9377
10208
|
startPrice = 0;
|
|
@@ -9384,33 +10215,33 @@ var Ei = class {
|
|
|
9384
10215
|
}
|
|
9385
10216
|
begin(e, t, n) {
|
|
9386
10217
|
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 =
|
|
10218
|
+
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
10219
|
}
|
|
9389
10220
|
update(e, t, n) {
|
|
9390
10221
|
if (!this.active) return;
|
|
9391
10222
|
let r = Math.round(A(e.x, t));
|
|
9392
|
-
this.endBar = r, this.endPrice = j(e.y, t), this.endTime =
|
|
10223
|
+
this.endBar = r, this.endPrice = j(e.y, t), this.endTime = ga(r, n);
|
|
9393
10224
|
}
|
|
9394
10225
|
end() {
|
|
9395
10226
|
this.active = !1;
|
|
9396
10227
|
}
|
|
9397
10228
|
render(e, t, n) {
|
|
9398
10229
|
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}${
|
|
10230
|
+
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);
|
|
10231
|
+
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);
|
|
10232
|
+
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);
|
|
10233
|
+
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
10234
|
}
|
|
9404
10235
|
};
|
|
9405
|
-
function
|
|
10236
|
+
function ga(e, t) {
|
|
9406
10237
|
if (e < 0 || e >= t.length) return null;
|
|
9407
10238
|
let n = t[e].time;
|
|
9408
10239
|
return n > 0xe8d4a51000 ? n : n * 1e3;
|
|
9409
10240
|
}
|
|
9410
|
-
function
|
|
10241
|
+
function _a(e) {
|
|
9411
10242
|
return e >= 1e3 ? e.toFixed(2) : e >= 1 ? e.toFixed(4) : e.toPrecision(4);
|
|
9412
10243
|
}
|
|
9413
|
-
function
|
|
10244
|
+
function va(e) {
|
|
9414
10245
|
let t = e / 1e3;
|
|
9415
10246
|
if (t < 60) return `${t.toFixed(0)}s`;
|
|
9416
10247
|
let n = t / 60;
|
|
@@ -9422,10 +10253,10 @@ function Ii(e) {
|
|
|
9422
10253
|
let a = i / 30;
|
|
9423
10254
|
return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
|
|
9424
10255
|
}
|
|
9425
|
-
function
|
|
10256
|
+
function ya(e, t, n, r) {
|
|
9426
10257
|
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
10258
|
}
|
|
9428
|
-
function
|
|
10259
|
+
function ba(e, t, n, r, i, a) {
|
|
9429
10260
|
e.font = `600 11px ${a.font.family}`;
|
|
9430
10261
|
let o = 0;
|
|
9431
10262
|
for (let t of r) {
|
|
@@ -9433,13 +10264,13 @@ function Ri(e, t, n, r, i, a) {
|
|
|
9433
10264
|
n > o && (o = n);
|
|
9434
10265
|
}
|
|
9435
10266
|
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,
|
|
10267
|
+
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
10268
|
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
10269
|
}
|
|
9439
|
-
function
|
|
10270
|
+
function xa(e, t, n, r, i, a) {
|
|
9440
10271
|
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
10272
|
}
|
|
9442
|
-
function
|
|
10273
|
+
function Sa(e, t) {
|
|
9443
10274
|
if (e.startsWith("#")) {
|
|
9444
10275
|
let n = 0, r = 0, i = 0;
|
|
9445
10276
|
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 +10283,7 @@ function Bi(e, t) {
|
|
|
9452
10283
|
}
|
|
9453
10284
|
//#endregion
|
|
9454
10285
|
//#region src/animation/Animator.ts
|
|
9455
|
-
var
|
|
10286
|
+
var Ca = {
|
|
9456
10287
|
linear: (e) => e,
|
|
9457
10288
|
easeOutCubic: (e) => 1 - (1 - e) ** 3,
|
|
9458
10289
|
easeOutQuart: (e) => 1 - (1 - e) ** 4,
|
|
@@ -9460,7 +10291,7 @@ var Vi = {
|
|
|
9460
10291
|
easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
|
|
9461
10292
|
easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
|
|
9462
10293
|
spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
|
|
9463
|
-
},
|
|
10294
|
+
}, wa = class {
|
|
9464
10295
|
animations = /* @__PURE__ */ new Map();
|
|
9465
10296
|
frameId = 0;
|
|
9466
10297
|
running = !1;
|
|
@@ -9468,7 +10299,7 @@ var Vi = {
|
|
|
9468
10299
|
this.animations.set(e, {
|
|
9469
10300
|
startTime: -1,
|
|
9470
10301
|
duration: t.duration,
|
|
9471
|
-
easing: t.easing ??
|
|
10302
|
+
easing: t.easing ?? Ca.easeOutCubic,
|
|
9472
10303
|
onUpdate: t.onUpdate,
|
|
9473
10304
|
onComplete: t.onComplete
|
|
9474
10305
|
}), this.running || (this.running = !0, this.tick());
|
|
@@ -9503,10 +10334,10 @@ var Vi = {
|
|
|
9503
10334
|
};
|
|
9504
10335
|
//#endregion
|
|
9505
10336
|
//#region src/finance/BaseFinanceChart.ts
|
|
9506
|
-
function
|
|
10337
|
+
function Ta(t) {
|
|
9507
10338
|
return !t || t === "dark" ? e : t === "light" ? c : t;
|
|
9508
10339
|
}
|
|
9509
|
-
var
|
|
10340
|
+
var Ea = class {
|
|
9510
10341
|
canvas;
|
|
9511
10342
|
ctx;
|
|
9512
10343
|
container;
|
|
@@ -9517,7 +10348,7 @@ var Wi = class {
|
|
|
9517
10348
|
frameId = null;
|
|
9518
10349
|
resizeObserver;
|
|
9519
10350
|
constructor(e, t) {
|
|
9520
|
-
this.container = e, this.theme =
|
|
10351
|
+
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
10352
|
this.updateSize(), this.requestRender();
|
|
9522
10353
|
}), this.resizeObserver.observe(e);
|
|
9523
10354
|
}
|
|
@@ -9532,12 +10363,12 @@ var Wi = class {
|
|
|
9532
10363
|
}));
|
|
9533
10364
|
}
|
|
9534
10365
|
setTheme(e) {
|
|
9535
|
-
this.theme =
|
|
10366
|
+
this.theme = Ta(e), this.requestRender();
|
|
9536
10367
|
}
|
|
9537
10368
|
destroy() {
|
|
9538
10369
|
this.frameId !== null && cancelAnimationFrame(this.frameId), this.resizeObserver.disconnect(), this.canvas.remove();
|
|
9539
10370
|
}
|
|
9540
|
-
},
|
|
10371
|
+
}, Da = class {
|
|
9541
10372
|
pos = null;
|
|
9542
10373
|
canvas;
|
|
9543
10374
|
onUpdate;
|
|
@@ -9569,7 +10400,7 @@ var Wi = class {
|
|
|
9569
10400
|
};
|
|
9570
10401
|
//#endregion
|
|
9571
10402
|
//#region src/finance/SparklineRenderer.ts
|
|
9572
|
-
function
|
|
10403
|
+
function Oa(e, t, n, r, i) {
|
|
9573
10404
|
let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
|
|
9574
10405
|
if (a.length < 2 || t <= 0 || n <= 0) return;
|
|
9575
10406
|
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 +10425,8 @@ function Ki(e, t, n, r, i) {
|
|
|
9594
10425
|
}
|
|
9595
10426
|
//#endregion
|
|
9596
10427
|
//#region src/finance/DepthChartRenderer.ts
|
|
9597
|
-
var
|
|
9598
|
-
function
|
|
10428
|
+
var ka = 50, Aa = 60, ja = 20, Ma = .2;
|
|
10429
|
+
function Na(e) {
|
|
9599
10430
|
let t = [...e].sort((e, t) => t.price - e.price), n = [], r = 0;
|
|
9600
10431
|
for (let e of t) r += e.volume, n.push({
|
|
9601
10432
|
price: e.price,
|
|
@@ -9603,7 +10434,7 @@ function Zi(e) {
|
|
|
9603
10434
|
});
|
|
9604
10435
|
return n;
|
|
9605
10436
|
}
|
|
9606
|
-
function
|
|
10437
|
+
function Pa(e) {
|
|
9607
10438
|
let t = [...e].sort((e, t) => e.price - t.price), n = [], r = 0;
|
|
9608
10439
|
for (let e of t) r += e.volume, n.push({
|
|
9609
10440
|
price: e.price,
|
|
@@ -9611,20 +10442,20 @@ function Qi(e) {
|
|
|
9611
10442
|
});
|
|
9612
10443
|
return n;
|
|
9613
10444
|
}
|
|
9614
|
-
function
|
|
10445
|
+
function Fa(e, t) {
|
|
9615
10446
|
return {
|
|
9616
|
-
left:
|
|
9617
|
-
right: e -
|
|
9618
|
-
top:
|
|
9619
|
-
bottom: t -
|
|
9620
|
-
plotWidth: e -
|
|
9621
|
-
plotHeight: t -
|
|
10447
|
+
left: ka,
|
|
10448
|
+
right: e - Aa,
|
|
10449
|
+
top: ja,
|
|
10450
|
+
bottom: t - ja,
|
|
10451
|
+
plotWidth: e - ka - Aa,
|
|
10452
|
+
plotHeight: t - ja * 2
|
|
9622
10453
|
};
|
|
9623
10454
|
}
|
|
9624
|
-
function
|
|
10455
|
+
function Ia(e, t, n, r) {
|
|
9625
10456
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
9626
10457
|
}
|
|
9627
|
-
function
|
|
10458
|
+
function La(e, t, n, r, i, a, o, s) {
|
|
9628
10459
|
let { left: c, right: l, top: u, bottom: d, plotWidth: f, plotHeight: p } = t;
|
|
9629
10460
|
e.save(), e.strokeStyle = a.grid, e.lineWidth = .5, e.fillStyle = a.axisLabel, e.font = `${a.font.sizeSmall}px ${a.font.family}`;
|
|
9630
10461
|
let h = m(0, i, 5);
|
|
@@ -9639,7 +10470,7 @@ function ta(e, t, n, r, i, a, o, s) {
|
|
|
9639
10470
|
}
|
|
9640
10471
|
e.restore();
|
|
9641
10472
|
}
|
|
9642
|
-
function
|
|
10473
|
+
function Ra(e, t, n, r, i, a, o, s, c) {
|
|
9643
10474
|
if (t.length === 0) return;
|
|
9644
10475
|
let { left: l, bottom: u, plotWidth: d, plotHeight: f } = n, p = (e) => l + (e - r) / i * d, m = (e) => u - e / a * f;
|
|
9645
10476
|
if (e.beginPath(), c === "bid") {
|
|
@@ -9672,14 +10503,14 @@ function na(e, t, n, r, i, a, o, s, c) {
|
|
|
9672
10503
|
}
|
|
9673
10504
|
e.strokeStyle = s, e.lineWidth = 1.5, e.stroke();
|
|
9674
10505
|
}
|
|
9675
|
-
function
|
|
10506
|
+
function za(e, t, n, r, i, a, o, s, c) {
|
|
9676
10507
|
let { left: l, top: u, bottom: d, plotWidth: f } = r, p = l + (t - i) / a * f;
|
|
9677
10508
|
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
10509
|
let t = `Spread: ${c(n)}`;
|
|
9679
10510
|
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
10511
|
}
|
|
9681
10512
|
}
|
|
9682
|
-
function
|
|
10513
|
+
function Ba(e, t, n, r, i, a, o, s, c, l, u) {
|
|
9683
10514
|
let { left: d, top: f, bottom: p, plotWidth: m, plotHeight: h } = i, g = t.x;
|
|
9684
10515
|
if (g < d || g > i.right) return;
|
|
9685
10516
|
let _ = a + (g - d) / m * o, v = 0, y = "";
|
|
@@ -9705,47 +10536,47 @@ function ia(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
9705
10536
|
for (let t = 0; t < b.length; t++) e.fillText(b[t], C + 8, w + 6 + t * (c.font.sizeSmall + 4));
|
|
9706
10537
|
e.restore();
|
|
9707
10538
|
}
|
|
9708
|
-
function
|
|
10539
|
+
function Va(e) {
|
|
9709
10540
|
return e.toFixed(2);
|
|
9710
10541
|
}
|
|
9711
|
-
function
|
|
10542
|
+
function Ha(e) {
|
|
9712
10543
|
return e >= 1e6 ? (e / 1e6).toFixed(2) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(0);
|
|
9713
10544
|
}
|
|
9714
|
-
function
|
|
10545
|
+
function Ua(e, t, n, r, i, a) {
|
|
9715
10546
|
let { data: o } = r;
|
|
9716
10547
|
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
|
-
|
|
10548
|
+
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);
|
|
10549
|
+
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
10550
|
}
|
|
9720
10551
|
//#endregion
|
|
9721
10552
|
//#region src/finance/EquityCurveRenderer.ts
|
|
9722
|
-
var
|
|
9723
|
-
function
|
|
10553
|
+
var Wa = 70, Ga = 30, Ka = 20, qa = 20, Ja = .05;
|
|
10554
|
+
function Ya(e, t) {
|
|
9724
10555
|
return {
|
|
9725
|
-
left:
|
|
9726
|
-
right: e -
|
|
9727
|
-
top:
|
|
9728
|
-
bottom: t -
|
|
9729
|
-
plotWidth: e -
|
|
9730
|
-
plotHeight: t -
|
|
10556
|
+
left: Wa,
|
|
10557
|
+
right: e - Ka,
|
|
10558
|
+
top: qa,
|
|
10559
|
+
bottom: t - Ga,
|
|
10560
|
+
plotWidth: e - Wa - Ka,
|
|
10561
|
+
plotHeight: t - qa - Ga
|
|
9731
10562
|
};
|
|
9732
10563
|
}
|
|
9733
|
-
function
|
|
10564
|
+
function Xa(e, t) {
|
|
9734
10565
|
let n = Infinity, r = -Infinity;
|
|
9735
10566
|
for (let t of e) t.value < n && (n = t.value), t.value > r && (r = t.value);
|
|
9736
10567
|
if (t) for (let e of t) e.value < n && (n = e.value), e.value > r && (r = e.value);
|
|
9737
|
-
let i = (r - n) *
|
|
10568
|
+
let i = (r - n) * Ja;
|
|
9738
10569
|
return {
|
|
9739
10570
|
valMin: n - i,
|
|
9740
10571
|
valMax: r + i
|
|
9741
10572
|
};
|
|
9742
10573
|
}
|
|
9743
|
-
function
|
|
10574
|
+
function Za(e) {
|
|
9744
10575
|
let t = [], n = -Infinity;
|
|
9745
10576
|
for (let r of e) r.value > n && (n = r.value), t.push(n);
|
|
9746
10577
|
return t;
|
|
9747
10578
|
}
|
|
9748
|
-
function
|
|
10579
|
+
function Qa(e) {
|
|
9749
10580
|
let t = 864e5;
|
|
9750
10581
|
if (365.25 * t, e < 7 * t) {
|
|
9751
10582
|
let e = new Intl.DateTimeFormat(void 0, {
|
|
@@ -9767,13 +10598,13 @@ function ga(e) {
|
|
|
9767
10598
|
});
|
|
9768
10599
|
return (e) => n.format(new Date(e));
|
|
9769
10600
|
}
|
|
9770
|
-
function
|
|
10601
|
+
function $a(e) {
|
|
9771
10602
|
return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(2) + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
|
|
9772
10603
|
}
|
|
9773
|
-
function
|
|
10604
|
+
function eo(e, t, n, r) {
|
|
9774
10605
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
9775
10606
|
}
|
|
9776
|
-
function
|
|
10607
|
+
function to(e, t, n, r, i, a, o, s, c) {
|
|
9777
10608
|
let { left: l, right: u, top: d, bottom: f, plotWidth: p, plotHeight: h } = t;
|
|
9778
10609
|
e.save(), e.strokeStyle = o.grid, e.lineWidth = .5, e.fillStyle = o.axisLabel, e.font = `${o.font.sizeSmall}px ${o.font.family}`;
|
|
9779
10610
|
let g = m(n, r, 6), _ = Math.ceil(n / g) * g;
|
|
@@ -9788,21 +10619,21 @@ function ya(e, t, n, r, i, a, o, s, c) {
|
|
|
9788
10619
|
}
|
|
9789
10620
|
e.restore();
|
|
9790
10621
|
}
|
|
9791
|
-
function
|
|
10622
|
+
function no(e, t, n, r, i, a, o, s, c) {
|
|
9792
10623
|
if (t.length < 2) return;
|
|
9793
10624
|
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
10625
|
e.save(), e.beginPath(), e.moveTo(p(t[0].time), m(t[0].value));
|
|
9795
10626
|
for (let n = 1; n < t.length; n++) e.lineTo(p(t[n].time), m(t[n].value));
|
|
9796
10627
|
e.strokeStyle = s, e.lineWidth = c, e.lineJoin = "round", e.stroke(), e.restore();
|
|
9797
10628
|
}
|
|
9798
|
-
function
|
|
10629
|
+
function ro(e, t, n, r, i, a, o, s) {
|
|
9799
10630
|
if (t.length < 2) return;
|
|
9800
10631
|
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
10632
|
m.addColorStop(0, s + "40"), m.addColorStop(1, "transparent"), e.save(), e.beginPath(), e.moveTo(f(t[0].time), p(t[0].value));
|
|
9802
10633
|
for (let n = 1; n < t.length; n++) e.lineTo(f(t[n].time), p(t[n].value));
|
|
9803
10634
|
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
10635
|
}
|
|
9805
|
-
function
|
|
10636
|
+
function io(e, t, n, r, i, a, o, s, c) {
|
|
9806
10637
|
if (t.length < 2) return;
|
|
9807
10638
|
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
10639
|
e.save(), e.fillStyle = c, e.beginPath(), e.moveTo(p(t[0].time), m(n[0]));
|
|
@@ -9810,12 +10641,12 @@ function Sa(e, t, n, r, i, a, o, s, c) {
|
|
|
9810
10641
|
for (let n = t.length - 1; n >= 0; n--) e.lineTo(p(t[n].time), m(t[n].value));
|
|
9811
10642
|
e.closePath(), e.fill(), e.restore();
|
|
9812
10643
|
}
|
|
9813
|
-
function
|
|
10644
|
+
function ao(e, t, n, r, i, a, o, s, c, l) {
|
|
9814
10645
|
if (t.length === 0) return;
|
|
9815
10646
|
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
10647
|
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
10648
|
}
|
|
9818
|
-
function
|
|
10649
|
+
function oo(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
9819
10650
|
let { left: f, top: p, bottom: m, plotWidth: h, plotHeight: g } = i, _ = t.x;
|
|
9820
10651
|
if (_ < f || _ > i.right) return;
|
|
9821
10652
|
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 +10664,15 @@ function wa(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
9833
10664
|
for (let t = 0; t < S.length; t++) e.fillText(S[t], D + 8, O + 6 + t * (l.font.sizeSmall + 4));
|
|
9834
10665
|
e.restore();
|
|
9835
10666
|
}
|
|
9836
|
-
function
|
|
10667
|
+
function so(e, t, n, r, i, a) {
|
|
9837
10668
|
let { data: o } = r;
|
|
9838
10669
|
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
|
-
|
|
10670
|
+
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);
|
|
10671
|
+
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
10672
|
}
|
|
9842
10673
|
//#endregion
|
|
9843
10674
|
//#region src/finance/HeatmapLayout.ts
|
|
9844
|
-
function
|
|
10675
|
+
function co(e, t, n) {
|
|
9845
10676
|
if (e.length === 0) return [];
|
|
9846
10677
|
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
10678
|
for (let a = 0; a < r; a++) {
|
|
@@ -9858,7 +10689,7 @@ function Ea(e, t, n) {
|
|
|
9858
10689
|
}
|
|
9859
10690
|
return c;
|
|
9860
10691
|
}
|
|
9861
|
-
function
|
|
10692
|
+
function lo(e, t) {
|
|
9862
10693
|
let n = e.reduce((e, t) => e + t, 0);
|
|
9863
10694
|
if (n === 0 || t === 0) return Infinity;
|
|
9864
10695
|
let r = 0;
|
|
@@ -9868,7 +10699,7 @@ function Da(e, t) {
|
|
|
9868
10699
|
}
|
|
9869
10700
|
return r;
|
|
9870
10701
|
}
|
|
9871
|
-
function
|
|
10702
|
+
function uo(e, t, n, r, i, a) {
|
|
9872
10703
|
let o = r ? n.height : n.width, s = e.reduce((e, t) => e + t, 0), c = o > 0 ? s / o : 0, l = 0;
|
|
9873
10704
|
for (let o = 0; o < e.length; o++) {
|
|
9874
10705
|
let s = c > 0 ? e[o] / c : 0, u;
|
|
@@ -9888,19 +10719,19 @@ function Oa(e, t, n, r, i, a) {
|
|
|
9888
10719
|
}), l += s;
|
|
9889
10720
|
}
|
|
9890
10721
|
}
|
|
9891
|
-
function
|
|
10722
|
+
function fo(e, t, n, r, i) {
|
|
9892
10723
|
if (e.length === 0) return;
|
|
9893
10724
|
let a = n.width >= n.height, o = a ? n.height : n.width;
|
|
9894
10725
|
if (e.length === 1) {
|
|
9895
|
-
|
|
10726
|
+
uo(e, t, n, a, r, i);
|
|
9896
10727
|
return;
|
|
9897
10728
|
}
|
|
9898
10729
|
let s = [], c = [], l = 0;
|
|
9899
10730
|
for (; l < e.length;) {
|
|
9900
10731
|
let u = [...s, e[l]];
|
|
9901
|
-
if (s.length === 0 ||
|
|
10732
|
+
if (s.length === 0 || lo(u, o) <= lo(s, o)) s.push(e[l]), c.push(t[l]), l++;
|
|
9902
10733
|
else {
|
|
9903
|
-
|
|
10734
|
+
uo(s, c, n, a, r, i);
|
|
9904
10735
|
let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
|
|
9905
10736
|
n = a ? {
|
|
9906
10737
|
x: n.x + d,
|
|
@@ -9912,28 +10743,28 @@ function ka(e, t, n, r, i) {
|
|
|
9912
10743
|
y: n.y + d,
|
|
9913
10744
|
width: n.width,
|
|
9914
10745
|
height: n.height - d
|
|
9915
|
-
},
|
|
10746
|
+
}, fo(e.slice(l), t.slice(l), n, r, i);
|
|
9916
10747
|
return;
|
|
9917
10748
|
}
|
|
9918
10749
|
}
|
|
9919
|
-
s.length > 0 &&
|
|
10750
|
+
s.length > 0 && uo(s, c, n, a, r, i);
|
|
9920
10751
|
}
|
|
9921
|
-
function
|
|
10752
|
+
function po(e, t, n) {
|
|
9922
10753
|
if (e.length === 0) return [];
|
|
9923
10754
|
let r = [...e].sort((e, t) => t.weight - e.weight), i = r.reduce((e, t) => e + Math.max(0, t.weight), 0);
|
|
9924
10755
|
if (i === 0) return [];
|
|
9925
10756
|
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
|
|
10757
|
+
return fo(o, s, { ...t }, n, c), c;
|
|
9927
10758
|
}
|
|
9928
10759
|
//#endregion
|
|
9929
10760
|
//#region src/finance/HeatmapRenderer.ts
|
|
9930
|
-
function
|
|
10761
|
+
function mo(e) {
|
|
9931
10762
|
return (e >= 0 ? "+" : "") + e.toFixed(2) + "%";
|
|
9932
10763
|
}
|
|
9933
|
-
function
|
|
10764
|
+
function ho(e) {
|
|
9934
10765
|
return e.label;
|
|
9935
10766
|
}
|
|
9936
|
-
function
|
|
10767
|
+
function go(e, t) {
|
|
9937
10768
|
let n = t.min ?? -5, r = t.max ?? 5;
|
|
9938
10769
|
if (e <= n) return t.negative;
|
|
9939
10770
|
if (e >= r) return t.positive;
|
|
@@ -9944,11 +10775,11 @@ function Na(e, t) {
|
|
|
9944
10775
|
let i = e / r;
|
|
9945
10776
|
return _(t.zero, t.positive, i);
|
|
9946
10777
|
}
|
|
9947
|
-
function
|
|
10778
|
+
function _o(e, t, n, r, i, a) {
|
|
9948
10779
|
let o = Math.min(a, r / 2, i / 2);
|
|
9949
10780
|
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
10781
|
}
|
|
9951
|
-
function
|
|
10782
|
+
function vo(e, t, n, r, i, a, o, s, c, l, u) {
|
|
9952
10783
|
if (i < 40 || a < 30) return;
|
|
9953
10784
|
let d = n + i / 2, f = r + a / 2;
|
|
9954
10785
|
if (e.save(), e.shadowColor = "rgba(0,0,0,0.6)", e.shadowBlur = 2, e.fillStyle = "#FFFFFF", e.textAlign = "center", s) {
|
|
@@ -9961,22 +10792,22 @@ function Fa(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
9961
10792
|
}
|
|
9962
10793
|
e.restore();
|
|
9963
10794
|
}
|
|
9964
|
-
function
|
|
10795
|
+
function yo(e, t, n, r, i, a, o, s) {
|
|
9965
10796
|
let c = [o(t), s(t.value)];
|
|
9966
10797
|
if (t.meta) for (let [e, n] of Object.entries(t.meta)) c.push(e + ": " + String(n));
|
|
9967
10798
|
e.save(), e.font = a.font.sizeSmall + "px " + a.font.family;
|
|
9968
10799
|
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,
|
|
10800
|
+
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
10801
|
for (let t = 0; t < c.length; t++) e.fillText(c[t], f + 8, p + 6 + t * u);
|
|
9971
10802
|
e.restore();
|
|
9972
10803
|
}
|
|
9973
|
-
function
|
|
10804
|
+
function bo(e, t, n, r, i, a, o, s) {
|
|
9974
10805
|
if (r.length === 0 || i.length === 0 || t <= 0 || n <= 0) return null;
|
|
9975
10806
|
let c = a.colorScale ?? {
|
|
9976
10807
|
negative: "#EF5350",
|
|
9977
10808
|
zero: "#424242",
|
|
9978
10809
|
positive: "#26A69A"
|
|
9979
|
-
}, l = a.cellRadius ?? 4, u = a.showLabels !== !1, d = a.showValues !== !1, f = a.valueFormat ??
|
|
10810
|
+
}, 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
10811
|
for (let e of r) m.set(e.id, e);
|
|
9981
10812
|
let h = null, g = null;
|
|
9982
10813
|
if (s) for (let e of i) {
|
|
@@ -9997,37 +10828,37 @@ function La(e, t, n, r, i, a, o, s) {
|
|
|
9997
10828
|
if (!n) continue;
|
|
9998
10829
|
let { x: r, y: i, width: a, height: s } = t.rect;
|
|
9999
10830
|
if (a <= 0 || s <= 0) continue;
|
|
10000
|
-
let g =
|
|
10001
|
-
|
|
10831
|
+
let g = go(n.value, c);
|
|
10832
|
+
_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
10833
|
}
|
|
10003
|
-
return g && s &&
|
|
10834
|
+
return g && s && yo(e, g.cell, s, t, n, o, p, f), g;
|
|
10004
10835
|
}
|
|
10005
10836
|
//#endregion
|
|
10006
10837
|
//#region src/finance/WaterfallRenderer.ts
|
|
10007
|
-
var
|
|
10008
|
-
function
|
|
10838
|
+
var xo = 60, So = 12, Co = 24, wo = 40, To = .7, Eo = 1;
|
|
10839
|
+
function Do(e) {
|
|
10009
10840
|
return e.type ? e.type : e.value > 0 ? "positive" : e.value < 0 ? "negative" : "subtotal";
|
|
10010
10841
|
}
|
|
10011
|
-
function
|
|
10842
|
+
function Oo(e) {
|
|
10012
10843
|
let t = Math.abs(e);
|
|
10013
10844
|
return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(2);
|
|
10014
10845
|
}
|
|
10015
|
-
function
|
|
10846
|
+
function ko(e, t) {
|
|
10016
10847
|
return {
|
|
10017
|
-
left:
|
|
10018
|
-
right: e -
|
|
10019
|
-
top:
|
|
10020
|
-
bottom: t -
|
|
10021
|
-
plotWidth: e -
|
|
10022
|
-
plotHeight: t -
|
|
10848
|
+
left: xo,
|
|
10849
|
+
right: e - So,
|
|
10850
|
+
top: Co,
|
|
10851
|
+
bottom: t - wo,
|
|
10852
|
+
plotWidth: e - xo - So,
|
|
10853
|
+
plotHeight: t - Co - wo
|
|
10023
10854
|
};
|
|
10024
10855
|
}
|
|
10025
|
-
function
|
|
10856
|
+
function Ao(e, t, n, r, i) {
|
|
10026
10857
|
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
10858
|
for (let t = 0; t < e.length; t++) {
|
|
10028
|
-
let n = e[t], m =
|
|
10859
|
+
let n = e[t], m = Do(n), h, g;
|
|
10029
10860
|
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),
|
|
10861
|
+
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
10862
|
a[t] = {
|
|
10032
10863
|
label: n.label,
|
|
10033
10864
|
value: n.value,
|
|
@@ -10047,14 +10878,14 @@ function qa(e, t, n, r, i) {
|
|
|
10047
10878
|
cumulatives: o
|
|
10048
10879
|
};
|
|
10049
10880
|
}
|
|
10050
|
-
function
|
|
10881
|
+
function jo(e) {
|
|
10051
10882
|
if (e.length === 0) return {
|
|
10052
10883
|
valMin: 0,
|
|
10053
10884
|
valMax: 1
|
|
10054
10885
|
};
|
|
10055
10886
|
let t = 0, n = 0, r = 0;
|
|
10056
10887
|
for (let i = 0; i < e.length; i++) {
|
|
10057
|
-
let a = e[i], o =
|
|
10888
|
+
let a = e[i], o = Do(a), s, c;
|
|
10058
10889
|
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
10890
|
}
|
|
10060
10891
|
let i = (n - t || 1) * .1;
|
|
@@ -10063,10 +10894,10 @@ function Ja(e) {
|
|
|
10063
10894
|
valMax: n + i
|
|
10064
10895
|
};
|
|
10065
10896
|
}
|
|
10066
|
-
function
|
|
10897
|
+
function Mo(e, t, n, r) {
|
|
10067
10898
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
10068
10899
|
}
|
|
10069
|
-
function
|
|
10900
|
+
function No(e, t, n, r, i, a) {
|
|
10070
10901
|
let { left: o, right: s, top: c, bottom: l, plotHeight: u } = t, d = r - n || 1;
|
|
10071
10902
|
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
10903
|
let f = m(n, r, 5), p = Math.ceil(n / f) * f;
|
|
@@ -10085,7 +10916,7 @@ function Xa(e, t, n, r, i, a) {
|
|
|
10085
10916
|
e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath(), e.moveTo(o, t), e.lineTo(s, t), e.stroke();
|
|
10086
10917
|
}
|
|
10087
10918
|
}
|
|
10088
|
-
function
|
|
10919
|
+
function Po(e, t, n) {
|
|
10089
10920
|
let r = [
|
|
10090
10921
|
"positive",
|
|
10091
10922
|
"negative",
|
|
@@ -10104,7 +10935,7 @@ function Za(e, t, n) {
|
|
|
10104
10935
|
s && (e.fillStyle = o, e.fill());
|
|
10105
10936
|
}
|
|
10106
10937
|
}
|
|
10107
|
-
function
|
|
10938
|
+
function Fo(e, t, n, r, i, a, o) {
|
|
10108
10939
|
if (o === "none" || t.length < 2) return;
|
|
10109
10940
|
let { bottom: s, plotHeight: c } = n;
|
|
10110
10941
|
e.strokeStyle = a, e.lineWidth = 1, o === "dashed" ? e.setLineDash([4, 4]) : e.setLineDash([]), e.beginPath();
|
|
@@ -10114,7 +10945,7 @@ function Qa(e, t, n, r, i, a, o) {
|
|
|
10114
10945
|
}
|
|
10115
10946
|
e.stroke(), e.setLineDash([]);
|
|
10116
10947
|
}
|
|
10117
|
-
function
|
|
10948
|
+
function Io(e, t, n, r, i, a) {
|
|
10118
10949
|
e.fillStyle = r.text, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center";
|
|
10119
10950
|
for (let r = 0; r < t.length; r++) {
|
|
10120
10951
|
let o = t[r], s;
|
|
@@ -10123,7 +10954,7 @@ function $a(e, t, n, r, i, a) {
|
|
|
10123
10954
|
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
10955
|
}
|
|
10125
10956
|
}
|
|
10126
|
-
function
|
|
10957
|
+
function Lo(e, t, n, r, i) {
|
|
10127
10958
|
e.fillStyle = r.axisLabel, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "top";
|
|
10128
10959
|
let a = n.bottom + 6, o = t.length > 0 ? t[0].slotW - 4 : 0, s = !1;
|
|
10129
10960
|
for (let n = 0; n < t.length; n++) if (e.measureText(i(t[n].label)).width > o) {
|
|
@@ -10144,7 +10975,7 @@ function eo(e, t, n, r, i) {
|
|
|
10144
10975
|
}
|
|
10145
10976
|
e.setTransform(1, 0, 0, 1, 0, 0), e.restore();
|
|
10146
10977
|
}
|
|
10147
|
-
function
|
|
10978
|
+
function Ro(e, t, n) {
|
|
10148
10979
|
if (t < n.left || t > n.right) return null;
|
|
10149
10980
|
for (let n = 0; n < e.length; n++) {
|
|
10150
10981
|
let r = e[n];
|
|
@@ -10152,7 +10983,7 @@ function to(e, t, n) {
|
|
|
10152
10983
|
}
|
|
10153
10984
|
return null;
|
|
10154
10985
|
}
|
|
10155
|
-
function
|
|
10986
|
+
function zo(e, t, n, r, i, a, o, s) {
|
|
10156
10987
|
let c = t[r], l = n[r], u = Math.round(c.slotX + c.slotW / 2) + .5;
|
|
10157
10988
|
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
10989
|
let d = [
|
|
@@ -10171,31 +11002,31 @@ function no(e, t, n, r, i, a, o, s) {
|
|
|
10171
11002
|
let _ = o.font.sizeSmall + 4;
|
|
10172
11003
|
for (let t = 0; t < d.length; t++) e.fillText(d[t], h + 8, g + 6 + t * _);
|
|
10173
11004
|
}
|
|
10174
|
-
function
|
|
11005
|
+
function Bo(e, t, n, r, i, a) {
|
|
10175
11006
|
let { data: o } = r;
|
|
10176
11007
|
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
|
-
|
|
11008
|
+
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);
|
|
11009
|
+
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
11010
|
positive: s,
|
|
10180
11011
|
negative: c,
|
|
10181
11012
|
total: l,
|
|
10182
11013
|
subtotal: u
|
|
10183
|
-
}), m &&
|
|
10184
|
-
let w = a ?
|
|
10185
|
-
return a && w !== null &&
|
|
11014
|
+
}), m && Io(e, S, C, i, g, h), Lo(e, S, x, i, _);
|
|
11015
|
+
let w = a ? Ro(S, a.x, x) : null;
|
|
11016
|
+
return a && w !== null && zo(e, S, C, w, a, x, i, g), { hitBar: w };
|
|
10186
11017
|
}
|
|
10187
11018
|
//#endregion
|
|
10188
11019
|
//#region src/finance/GaugeRenderer.ts
|
|
10189
|
-
var
|
|
10190
|
-
function
|
|
11020
|
+
var Vo = Math.PI / 180, Ho = 135, Uo = 405, Wo = .25;
|
|
11021
|
+
function Go(e) {
|
|
10191
11022
|
let t = Math.abs(e);
|
|
10192
11023
|
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
11024
|
}
|
|
10194
11025
|
function Q(e, t, n) {
|
|
10195
11026
|
return e < t ? t : e > n ? n : e;
|
|
10196
11027
|
}
|
|
10197
|
-
function
|
|
10198
|
-
let r = n.min ?? 0, i = n.max ?? 100, a = i - r || 1, o = (n.startAngle ??
|
|
11028
|
+
function Ko(e, t, n) {
|
|
11029
|
+
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
11030
|
return {
|
|
10200
11031
|
cx: l,
|
|
10201
11032
|
cy: u,
|
|
@@ -10213,38 +11044,38 @@ function $(e, t) {
|
|
|
10213
11044
|
let n = Q((e - t.min) / t.range, 0, 1);
|
|
10214
11045
|
return t.startAngle + t.angleRange * n;
|
|
10215
11046
|
}
|
|
10216
|
-
function
|
|
11047
|
+
function qo(e, t, n, r) {
|
|
10217
11048
|
e.fillStyle = r, e.fillRect(0, 0, t, n);
|
|
10218
11049
|
}
|
|
10219
|
-
function
|
|
11050
|
+
function Jo(e, t, n) {
|
|
10220
11051
|
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
11052
|
}
|
|
10222
|
-
function
|
|
11053
|
+
function Yo(e, t, n) {
|
|
10223
11054
|
let r = Q(n.from, t.min, t.max), i = Q(n.to, t.min, t.max);
|
|
10224
11055
|
if (i <= r) return;
|
|
10225
11056
|
let a = $(r, t), o = $(i, t);
|
|
10226
11057
|
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
11058
|
}
|
|
10228
|
-
function
|
|
11059
|
+
function Xo(e, t, n, r, i) {
|
|
10229
11060
|
let a = $(n, t);
|
|
10230
11061
|
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
11062
|
}
|
|
10232
|
-
function
|
|
11063
|
+
function Zo(e, t, n, r) {
|
|
10233
11064
|
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
11065
|
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
11066
|
}
|
|
10236
|
-
function
|
|
11067
|
+
function Qo(e, t, n, r, i) {
|
|
10237
11068
|
let a = Math.round(t.innerRadius * .55), o = Math.round(i.font.sizeMedium);
|
|
10238
11069
|
e.fillStyle = i.text, e.textAlign = "center", e.textBaseline = "middle", e.font = `600 ${a}px ${i.font.family}`;
|
|
10239
11070
|
let s = !!r, c = s ? t.cy - o * .6 : t.cy - a * .1;
|
|
10240
11071
|
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
11072
|
}
|
|
10242
|
-
function
|
|
11073
|
+
function $o(e, t, n, r) {
|
|
10243
11074
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`;
|
|
10244
11075
|
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
11076
|
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
11077
|
}
|
|
10247
|
-
function
|
|
11078
|
+
function es(e, t, n, r) {
|
|
10248
11079
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textAlign = "center", e.textBaseline = "middle";
|
|
10249
11080
|
let i = (t.radius + t.innerRadius) / 2;
|
|
10250
11081
|
for (let r = 0; r < n.length; r++) {
|
|
@@ -10254,15 +11085,15 @@ function vo(e, t, n, r) {
|
|
|
10254
11085
|
e.fillText(a.label, s, c);
|
|
10255
11086
|
}
|
|
10256
11087
|
}
|
|
10257
|
-
function
|
|
11088
|
+
function ts(e, t, n, r, i, a) {
|
|
10258
11089
|
if (t <= 0 || n <= 0) return;
|
|
10259
|
-
let o =
|
|
10260
|
-
|
|
11090
|
+
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);
|
|
11091
|
+
qo(e, t, n, i.background), Jo(e, o, s);
|
|
10261
11092
|
let p = r.zones;
|
|
10262
|
-
if (p && p.length > 0) for (let t = 0; t < p.length; t++)
|
|
10263
|
-
|
|
11093
|
+
if (p && p.length > 0) for (let t = 0; t < p.length; t++) Yo(e, o, p[t]);
|
|
11094
|
+
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
11095
|
}
|
|
10265
11096
|
//#endregion
|
|
10266
|
-
export {
|
|
11097
|
+
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
11098
|
|
|
10268
11099
|
//# sourceMappingURL=index.js.map
|