@363045841yyt/klinechart 0.2.11 → 0.2.12
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/components/IndicatorSelector.vue.d.ts +1 -1
- package/dist/core/chart.d.ts +6 -0
- package/dist/core/controller/interaction.d.ts +3 -0
- package/dist/core/renderers/Indicator/ene.d.ts +20 -0
- package/dist/core/renderers/Indicator/expma.d.ts +19 -0
- package/dist/core/renderers/Indicator/index.d.ts +3 -2
- package/dist/core/renderers/Indicator/mainIndicatorLegend.d.ts +10 -0
- package/dist/core/scale/priceScale.d.ts +21 -0
- package/dist/core/theme/colors.d.ts +22 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +757 -456
- package/dist/klinechart.css +1 -1
- package/dist/semantic/controller.d.ts +2 -0
- package/dist/semantic/types.d.ts +18 -0
- package/package.json +1 -1
- package/dist/core/renderers/Indicator/bollLegend.d.ts +0 -16
- package/dist/core/renderers/Indicator/maLegend.d.ts +0 -9
package/dist/index.js
CHANGED
|
@@ -6635,6 +6635,12 @@ var Vi = (typeof document < "u" ? document.createElement("canvas") : null)?.getC
|
|
|
6635
6635
|
case "BOLL":
|
|
6636
6636
|
this.applyBOLLIndicator(t);
|
|
6637
6637
|
break;
|
|
6638
|
+
case "EXPMA":
|
|
6639
|
+
this.applyEXPMAIndicator(t);
|
|
6640
|
+
break;
|
|
6641
|
+
case "ENE":
|
|
6642
|
+
this.applyENEIndicator(t);
|
|
6643
|
+
break;
|
|
6638
6644
|
}
|
|
6639
6645
|
}
|
|
6640
6646
|
if (this.chart.clearSubPanes(), t) for (let e of t) this.applySubIndicator(e);
|
|
@@ -6655,7 +6661,21 @@ var Vi = (typeof document < "u" ? document.createElement("canvas") : null)?.getC
|
|
|
6655
6661
|
period: e.params?.period || 20,
|
|
6656
6662
|
multiplier: e.params?.multiplier || 2
|
|
6657
6663
|
};
|
|
6658
|
-
this.chart.updateRendererConfig("boll", t)
|
|
6664
|
+
this.chart.updateRendererConfig("boll", t);
|
|
6665
|
+
}
|
|
6666
|
+
applyEXPMAIndicator(e) {
|
|
6667
|
+
let t = {
|
|
6668
|
+
fastPeriod: e.params?.fastPeriod || 12,
|
|
6669
|
+
slowPeriod: e.params?.slowPeriod || 50
|
|
6670
|
+
};
|
|
6671
|
+
this.chart.updateRendererConfig("expma", t);
|
|
6672
|
+
}
|
|
6673
|
+
applyENEIndicator(e) {
|
|
6674
|
+
let t = {
|
|
6675
|
+
period: e.params?.period || 10,
|
|
6676
|
+
deviation: e.params?.deviation || 11
|
|
6677
|
+
};
|
|
6678
|
+
this.chart.updateRendererConfig("ene", t);
|
|
6659
6679
|
}
|
|
6660
6680
|
applySubIndicator(e) {
|
|
6661
6681
|
if (!e.enabled) return;
|
|
@@ -7358,57 +7378,65 @@ var Da = {
|
|
|
7358
7378
|
KST: "rgba(69, 112, 249, 1)",
|
|
7359
7379
|
SIGNAL: "rgba(255, 152, 0, 1)"
|
|
7360
7380
|
}, Ba = {
|
|
7381
|
+
FAST: "#FFD700",
|
|
7382
|
+
SLOW: "rgba(69, 112, 249, 1)"
|
|
7383
|
+
}, Va = {
|
|
7384
|
+
UPPER: "rgba(214, 10, 34, 1)",
|
|
7385
|
+
MIDDLE: "rgba(69, 112, 249, 1)",
|
|
7386
|
+
LOWER: "rgba(3, 123, 102, 1)",
|
|
7387
|
+
BAND_FILL: "rgba(69, 112, 249, 0.08)"
|
|
7388
|
+
}, Ha = {
|
|
7361
7389
|
LINE: "rgba(0, 0, 0, 0.28)",
|
|
7362
7390
|
LABEL_BG: "rgb(0, 0, 0)",
|
|
7363
7391
|
LABEL_TEXT: "rgba(255, 255, 255, 0.92)"
|
|
7364
|
-
},
|
|
7365
|
-
function
|
|
7366
|
-
return e > 0 ?
|
|
7392
|
+
}, Ua = X.UP, Wa = X.DOWN, Ga = X.NEUTRAL;
|
|
7393
|
+
function Ka(e) {
|
|
7394
|
+
return e > 0 ? Ua : e < 0 ? Wa : Ga;
|
|
7367
7395
|
}
|
|
7368
|
-
function
|
|
7396
|
+
function qa(e, t = 2) {
|
|
7369
7397
|
let n = Math.abs(e);
|
|
7370
7398
|
return n >= 1e8 ? `${(e / 1e8).toFixed(t)}亿` : n >= 1e4 ? `${(e / 1e4).toFixed(t)}万` : `${Math.round(e)}`;
|
|
7371
7399
|
}
|
|
7372
|
-
function
|
|
7400
|
+
function Ja(e, t = 2) {
|
|
7373
7401
|
return `${e > 0 ? "+" : ""}${e.toFixed(t)}`;
|
|
7374
7402
|
}
|
|
7375
|
-
function
|
|
7403
|
+
function Ya(e, t = 2) {
|
|
7376
7404
|
return `${e.toFixed(t)}%`;
|
|
7377
7405
|
}
|
|
7378
|
-
function
|
|
7406
|
+
function Xa(e, t = 2) {
|
|
7379
7407
|
return `${e > 0 ? "+" : ""}${e.toFixed(t)}%`;
|
|
7380
7408
|
}
|
|
7381
|
-
function
|
|
7409
|
+
function Za(e, t) {
|
|
7382
7410
|
let n = t?.close ?? e.open;
|
|
7383
|
-
return
|
|
7411
|
+
return Ka(e.open - n);
|
|
7384
7412
|
}
|
|
7385
|
-
function
|
|
7386
|
-
return
|
|
7413
|
+
function Qa(e) {
|
|
7414
|
+
return Ka(e.close - e.open);
|
|
7387
7415
|
}
|
|
7388
|
-
function
|
|
7389
|
-
return typeof e.changePercent == "number" ?
|
|
7416
|
+
function $a(e) {
|
|
7417
|
+
return typeof e.changePercent == "number" ? Ka(e.changePercent) : typeof e.changeAmount == "number" ? Ka(e.changeAmount) : Ga;
|
|
7390
7418
|
}
|
|
7391
7419
|
//#endregion
|
|
7392
7420
|
//#region src/components/KLineTooltip.vue?vue&type=script&setup=true&lang.ts
|
|
7393
|
-
var
|
|
7421
|
+
var eo = { class: "kline-tooltip__title" }, to = { key: 0 }, no = { class: "kline-tooltip__grid" }, ro = { class: "row" }, io = { class: "row" }, ao = { class: "row" }, oo = { class: "row" }, so = {
|
|
7394
7422
|
key: 0,
|
|
7395
7423
|
class: "row"
|
|
7396
|
-
},
|
|
7424
|
+
}, co = {
|
|
7397
7425
|
key: 1,
|
|
7398
7426
|
class: "row"
|
|
7399
|
-
},
|
|
7427
|
+
}, lo = {
|
|
7400
7428
|
key: 2,
|
|
7401
7429
|
class: "row"
|
|
7402
|
-
},
|
|
7430
|
+
}, uo = {
|
|
7403
7431
|
key: 3,
|
|
7404
7432
|
class: "row"
|
|
7405
|
-
},
|
|
7433
|
+
}, fo = {
|
|
7406
7434
|
key: 4,
|
|
7407
7435
|
class: "row"
|
|
7408
|
-
},
|
|
7436
|
+
}, po = {
|
|
7409
7437
|
key: 5,
|
|
7410
7438
|
class: "row"
|
|
7411
|
-
},
|
|
7439
|
+
}, mo = /* @__PURE__ */ u({
|
|
7412
7440
|
__name: "KLineTooltip",
|
|
7413
7441
|
props: {
|
|
7414
7442
|
k: {},
|
|
@@ -7424,15 +7452,15 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7424
7452
|
}
|
|
7425
7453
|
let i = r(() => {
|
|
7426
7454
|
let e = t.k;
|
|
7427
|
-
if (!e) return
|
|
7455
|
+
if (!e) return Ga;
|
|
7428
7456
|
let n = t.index;
|
|
7429
|
-
return
|
|
7457
|
+
return Za(e, typeof n == "number" && n > 0 ? t.data[n - 1] : void 0);
|
|
7430
7458
|
}), c = r(() => {
|
|
7431
7459
|
let e = t.k;
|
|
7432
|
-
return e ?
|
|
7460
|
+
return e ? Qa(e) : Ga;
|
|
7433
7461
|
}), l = r(() => {
|
|
7434
7462
|
let e = t.k;
|
|
7435
|
-
return e ?
|
|
7463
|
+
return e ? $a(e) : Ga;
|
|
7436
7464
|
});
|
|
7437
7465
|
return (t, r) => e.k ? (g(), o("div", {
|
|
7438
7466
|
key: 0,
|
|
@@ -7442,29 +7470,29 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7442
7470
|
left: `${e.pos.x}px`,
|
|
7443
7471
|
top: `${e.pos.y}px`
|
|
7444
7472
|
})
|
|
7445
|
-
}, [s("div",
|
|
7446
|
-
s("div",
|
|
7447
|
-
s("div",
|
|
7448
|
-
s("div",
|
|
7449
|
-
s("div",
|
|
7450
|
-
typeof e.k.volume == "number" ? (g(), o("div",
|
|
7451
|
-
typeof e.k.turnover == "number" ? (g(), o("div",
|
|
7452
|
-
typeof e.k.amplitude == "number" ? (g(), o("div",
|
|
7453
|
-
typeof e.k.changePercent == "number" ? (g(), o("div",
|
|
7454
|
-
typeof e.k.changeAmount == "number" ? (g(), o("div",
|
|
7455
|
-
typeof e.k.turnoverRate == "number" ? (g(), o("div",
|
|
7473
|
+
}, [s("div", eo, [e.k.stockCode ? (g(), o("span", to, b(e.k.stockCode), 1)) : a("", !0), s("span", null, b(x(wa)(e.k.timestamp)), 1)]), s("div", no, [
|
|
7474
|
+
s("div", ro, [r[0] ||= s("span", null, "开", -1), s("span", { style: p({ color: i.value }) }, b(e.k.open.toFixed(2)), 5)]),
|
|
7475
|
+
s("div", io, [r[1] ||= s("span", null, "高", -1), s("span", null, b(e.k.high.toFixed(2)), 1)]),
|
|
7476
|
+
s("div", ao, [r[2] ||= s("span", null, "低", -1), s("span", null, b(e.k.low.toFixed(2)), 1)]),
|
|
7477
|
+
s("div", oo, [r[3] ||= s("span", null, "收", -1), s("span", { style: p({ color: c.value }) }, b(e.k.close.toFixed(2)), 5)]),
|
|
7478
|
+
typeof e.k.volume == "number" ? (g(), o("div", so, [r[4] ||= s("span", null, "成交量", -1), s("span", null, b(x(qa)(e.k.volume)), 1)])) : a("", !0),
|
|
7479
|
+
typeof e.k.turnover == "number" ? (g(), o("div", co, [r[5] ||= s("span", null, "成交额", -1), s("span", null, b(x(qa)(e.k.turnover)), 1)])) : a("", !0),
|
|
7480
|
+
typeof e.k.amplitude == "number" ? (g(), o("div", lo, [r[6] ||= s("span", null, "振幅", -1), s("span", null, b(e.k.amplitude) + "%", 1)])) : a("", !0),
|
|
7481
|
+
typeof e.k.changePercent == "number" ? (g(), o("div", uo, [r[7] ||= s("span", null, "涨跌幅", -1), s("span", { style: p({ color: l.value }) }, b(x(Xa)(e.k.changePercent)), 5)])) : a("", !0),
|
|
7482
|
+
typeof e.k.changeAmount == "number" ? (g(), o("div", fo, [r[8] ||= s("span", null, "涨跌额", -1), s("span", { style: p({ color: l.value }) }, b(x(Ja)(e.k.changeAmount)), 5)])) : a("", !0),
|
|
7483
|
+
typeof e.k.turnoverRate == "number" ? (g(), o("div", po, [r[9] ||= s("span", null, "换手率", -1), s("span", null, b(x(Ya)(e.k.turnoverRate)), 1)])) : a("", !0)
|
|
7456
7484
|
])], 4)) : a("", !0);
|
|
7457
7485
|
}
|
|
7458
|
-
}),
|
|
7486
|
+
}), ho = (e, t) => {
|
|
7459
7487
|
let n = e.__vccOpts || e;
|
|
7460
7488
|
for (let [e, r] of t) n[e] = r;
|
|
7461
7489
|
return n;
|
|
7462
|
-
},
|
|
7490
|
+
}, go = /* @__PURE__ */ ho(mo, [["__scopeId", "data-v-95daa55c"]]), _o = {
|
|
7463
7491
|
RISE_WITH_VOLUME: "量价齐升",
|
|
7464
7492
|
RISE_WITHOUT_VOLUME: "量缩价升",
|
|
7465
7493
|
FALL_WITH_VOLUME: "量价齐缩",
|
|
7466
7494
|
FALL_WITHOUT_VOLUME: "量升价缩"
|
|
7467
|
-
},
|
|
7495
|
+
}, vo = class {
|
|
7468
7496
|
markers = /* @__PURE__ */ new Map();
|
|
7469
7497
|
hoveredMarkerId = null;
|
|
7470
7498
|
lastHoveredId = null;
|
|
@@ -7526,10 +7554,10 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7526
7554
|
}
|
|
7527
7555
|
return null;
|
|
7528
7556
|
}
|
|
7529
|
-
},
|
|
7557
|
+
}, yo = { class: "marker-tooltip__title" }, bo = {
|
|
7530
7558
|
key: 0,
|
|
7531
7559
|
class: "marker-tooltip__content"
|
|
7532
|
-
},
|
|
7560
|
+
}, xo = /* @__PURE__ */ ho(/* @__PURE__ */ u({
|
|
7533
7561
|
__name: "MarkerTooltip",
|
|
7534
7562
|
props: {
|
|
7535
7563
|
marker: {},
|
|
@@ -7543,7 +7571,7 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7543
7571
|
return e.label?.text || e.shape;
|
|
7544
7572
|
}
|
|
7545
7573
|
let e = n.marker;
|
|
7546
|
-
return
|
|
7574
|
+
return _o[e.markerType] || e.markerType;
|
|
7547
7575
|
}), l = r(() => {
|
|
7548
7576
|
if (!n.marker) return {};
|
|
7549
7577
|
if (i.value) {
|
|
@@ -7565,27 +7593,27 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7565
7593
|
left: `${t.pos.x + 12}px`,
|
|
7566
7594
|
top: `${t.pos.y + 12}px`
|
|
7567
7595
|
})
|
|
7568
|
-
}, [s("div",
|
|
7596
|
+
}, [s("div", yo, b(c.value), 1), u.value ? (g(), o("div", bo, [(g(!0), o(e, null, v(l.value, (e, t) => (g(), o("div", {
|
|
7569
7597
|
key: t,
|
|
7570
7598
|
class: "row"
|
|
7571
7599
|
}, [s("span", null, b(t), 1), s("span", null, b(d(e)), 1)]))), 128))])) : a("", !0)], 4)) : a("", !0);
|
|
7572
7600
|
}
|
|
7573
|
-
}), [["__scopeId", "data-v-dd43da4f"]]),
|
|
7601
|
+
}), [["__scopeId", "data-v-dd43da4f"]]), So = { class: "params-header" }, Co = { class: "header-left" }, wo = { class: "params-title" }, To = { class: "header-right" }, Eo = {
|
|
7574
7602
|
key: 0,
|
|
7575
7603
|
class: "indicator-description"
|
|
7576
|
-
},
|
|
7604
|
+
}, Do = { class: "params-body" }, Oo = { class: "param-header" }, ko = { class: "param-label" }, Ao = { class: "param-label-text" }, jo = {
|
|
7577
7605
|
key: 0,
|
|
7578
7606
|
class: "param-range"
|
|
7579
|
-
},
|
|
7607
|
+
}, Mo = { class: "input-wrapper" }, No = ["disabled", "onClick"], Po = [
|
|
7580
7608
|
"value",
|
|
7581
7609
|
"min",
|
|
7582
7610
|
"max",
|
|
7583
7611
|
"step",
|
|
7584
7612
|
"onInput"
|
|
7585
|
-
],
|
|
7613
|
+
], Fo = ["disabled", "onClick"], Io = {
|
|
7586
7614
|
key: 0,
|
|
7587
7615
|
class: "param-description"
|
|
7588
|
-
},
|
|
7616
|
+
}, Lo = { class: "params-footer" }, Ro = { class: "footer-right" }, zo = /* @__PURE__ */ ho(/* @__PURE__ */ u({
|
|
7589
7617
|
__name: "IndicatorParams",
|
|
7590
7618
|
props: {
|
|
7591
7619
|
visible: { type: Boolean },
|
|
@@ -7633,7 +7661,7 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7633
7661
|
class: "indicator-params",
|
|
7634
7662
|
onClick: d[3] ||= w(() => {}, ["stop"])
|
|
7635
7663
|
}, [
|
|
7636
|
-
s("div",
|
|
7664
|
+
s("div", So, [s("div", Co, [s("span", wo, b(r.indicatorName), 1), d[5] ||= s("span", { class: "params-subtitle" }, "参数设置", -1)]), s("div", To, [s("button", {
|
|
7637
7665
|
class: f(["toggle-desc-btn", { active: h.value }]),
|
|
7638
7666
|
onClick: d[0] ||= (e) => h.value = !h.value,
|
|
7639
7667
|
title: "显示/隐藏说明"
|
|
@@ -7650,18 +7678,18 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7650
7678
|
"stroke-width": "2"
|
|
7651
7679
|
}, [s("path", { d: "M18 6L6 18M6 6l12 12" })], -1)]])])]),
|
|
7652
7680
|
l(n, { name: "slide" }, {
|
|
7653
|
-
default: C(() => [h.value && r.indicatorDescription ? (g(), o("div",
|
|
7681
|
+
default: C(() => [h.value && r.indicatorDescription ? (g(), o("div", Eo, [s("p", null, b(r.indicatorDescription), 1)])) : a("", !0)]),
|
|
7654
7682
|
_: 1
|
|
7655
7683
|
}),
|
|
7656
|
-
s("div",
|
|
7684
|
+
s("div", Do, [(g(!0), o(e, null, v(r.params, (e) => (g(), o("div", {
|
|
7657
7685
|
key: e.key,
|
|
7658
7686
|
class: f(["param-item", { "has-desc": h.value && e.description }])
|
|
7659
|
-
}, [s("div",
|
|
7687
|
+
}, [s("div", Oo, [s("label", ko, [s("span", Ao, b(e.label), 1), e.min !== void 0 || e.max !== void 0 ? (g(), o("span", jo, b(e.min ?? "-∞") + " ~ " + b(e.max ?? "+∞"), 1)) : a("", !0)]), s("div", Mo, [
|
|
7660
7688
|
s("button", {
|
|
7661
7689
|
class: "stepper-btn",
|
|
7662
7690
|
disabled: e.min !== void 0 && (m.value[e.key] ?? 0) <= e.min,
|
|
7663
7691
|
onClick: (t) => x(e, -1)
|
|
7664
|
-
}, " − ", 8,
|
|
7692
|
+
}, " − ", 8, No),
|
|
7665
7693
|
e.type === "number" ? (g(), o("input", {
|
|
7666
7694
|
key: 0,
|
|
7667
7695
|
type: "number",
|
|
@@ -7671,17 +7699,17 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7671
7699
|
max: e.max,
|
|
7672
7700
|
step: e.step || 1,
|
|
7673
7701
|
onInput: (t) => y(e.key, t)
|
|
7674
|
-
}, null, 40,
|
|
7702
|
+
}, null, 40, Po)) : a("", !0),
|
|
7675
7703
|
s("button", {
|
|
7676
7704
|
class: "stepper-btn",
|
|
7677
7705
|
disabled: e.max !== void 0 && (m.value[e.key] ?? 0) >= e.max,
|
|
7678
7706
|
onClick: (t) => x(e, 1)
|
|
7679
|
-
}, " + ", 8,
|
|
7707
|
+
}, " + ", 8, Fo)
|
|
7680
7708
|
])]), l(n, { name: "slide" }, {
|
|
7681
|
-
default: C(() => [h.value && e.description ? (g(), o("div",
|
|
7709
|
+
default: C(() => [h.value && e.description ? (g(), o("div", Io, b(e.description), 1)) : a("", !0)]),
|
|
7682
7710
|
_: 2
|
|
7683
7711
|
}, 1024)], 2))), 128))]),
|
|
7684
|
-
s("div",
|
|
7712
|
+
s("div", Lo, [s("button", {
|
|
7685
7713
|
class: "params-btn reset",
|
|
7686
7714
|
onClick: T
|
|
7687
7715
|
}, [...d[8] ||= [s("svg", {
|
|
@@ -7689,7 +7717,7 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7689
7717
|
fill: "none",
|
|
7690
7718
|
stroke: "currentColor",
|
|
7691
7719
|
"stroke-width": "2"
|
|
7692
|
-
}, [s("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), s("path", { d: "M3 3v5h5" })], -1), c(" 重置 ", -1)]]), s("div",
|
|
7720
|
+
}, [s("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), s("path", { d: "M3 3v5h5" })], -1), c(" 重置 ", -1)]]), s("div", Ro, [s("button", {
|
|
7693
7721
|
class: "params-btn cancel",
|
|
7694
7722
|
onClick: d[2] ||= (e) => u.$emit("close")
|
|
7695
7723
|
}, "取消"), s("button", {
|
|
@@ -7707,28 +7735,28 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7707
7735
|
_: 1
|
|
7708
7736
|
})]));
|
|
7709
7737
|
}
|
|
7710
|
-
}), [["__scopeId", "data-v-730f2212"]]),
|
|
7738
|
+
}), [["__scopeId", "data-v-730f2212"]]), Bo = { class: "indicator-selector" }, Vo = { class: "indicator-scroll-container" }, Ho = { class: "indicator-list" }, Uo = ["onMouseenter"], Wo = { class: "btn-content" }, Go = {
|
|
7711
7739
|
key: 0,
|
|
7712
7740
|
class: "param-hint"
|
|
7713
|
-
},
|
|
7741
|
+
}, Ko = {
|
|
7714
7742
|
key: 0,
|
|
7715
7743
|
class: "hover-overlay"
|
|
7716
|
-
},
|
|
7744
|
+
}, qo = ["onClick"], Jo = {
|
|
7717
7745
|
key: 1,
|
|
7718
7746
|
class: "divider"
|
|
7719
|
-
},
|
|
7747
|
+
}, Yo = ["onClick"], Xo = { class: "indicator-item" }, Zo = { class: "menu-section" }, Qo = { class: "menu-items" }, $o = ["disabled", "onClick"], es = {
|
|
7720
7748
|
key: 0,
|
|
7721
7749
|
class: "param-hint"
|
|
7722
|
-
},
|
|
7750
|
+
}, ts = {
|
|
7723
7751
|
key: 1,
|
|
7724
7752
|
class: "active-tag"
|
|
7725
|
-
},
|
|
7753
|
+
}, ns = { class: "menu-section" }, rs = { class: "menu-items" }, is = ["disabled", "onClick"], as = {
|
|
7726
7754
|
key: 0,
|
|
7727
7755
|
class: "param-hint"
|
|
7728
|
-
},
|
|
7756
|
+
}, os = {
|
|
7729
7757
|
key: 1,
|
|
7730
7758
|
class: "active-tag"
|
|
7731
|
-
},
|
|
7759
|
+
}, ss = /* @__PURE__ */ ho(/* @__PURE__ */ u({
|
|
7732
7760
|
__name: "IndicatorSelector",
|
|
7733
7761
|
props: {
|
|
7734
7762
|
activeIndicators: {},
|
|
@@ -7769,6 +7797,58 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
7769
7797
|
description: "标准差倍数,决定轨道宽度,通常为 2"
|
|
7770
7798
|
}]
|
|
7771
7799
|
},
|
|
7800
|
+
{
|
|
7801
|
+
id: "EXPMA",
|
|
7802
|
+
label: "EXPMA",
|
|
7803
|
+
name: "指数平滑移动平均线",
|
|
7804
|
+
pane: "main",
|
|
7805
|
+
description: "EXPMA 对近期价格给予更高权重,比普通 MA 更敏感。快线上穿慢线为金叉看涨,下穿为死叉看跌。",
|
|
7806
|
+
params: [{
|
|
7807
|
+
key: "fastPeriod",
|
|
7808
|
+
label: "快线",
|
|
7809
|
+
type: "number",
|
|
7810
|
+
min: 2,
|
|
7811
|
+
max: 100,
|
|
7812
|
+
step: 1,
|
|
7813
|
+
default: 12,
|
|
7814
|
+
description: "快线周期,对价格变化更敏感"
|
|
7815
|
+
}, {
|
|
7816
|
+
key: "slowPeriod",
|
|
7817
|
+
label: "慢线",
|
|
7818
|
+
type: "number",
|
|
7819
|
+
min: 2,
|
|
7820
|
+
max: 200,
|
|
7821
|
+
step: 1,
|
|
7822
|
+
default: 50,
|
|
7823
|
+
description: "慢线周期,用于判断趋势方向"
|
|
7824
|
+
}]
|
|
7825
|
+
},
|
|
7826
|
+
{
|
|
7827
|
+
id: "ENE",
|
|
7828
|
+
label: "ENE",
|
|
7829
|
+
name: "轨道线",
|
|
7830
|
+
pane: "main",
|
|
7831
|
+
description: "ENE 轨道线由三条轨道组成,价格突破上轨可能超买,突破下轨可能超卖,适合判断震荡行情的买卖点。",
|
|
7832
|
+
params: [{
|
|
7833
|
+
key: "period",
|
|
7834
|
+
label: "周期",
|
|
7835
|
+
type: "number",
|
|
7836
|
+
min: 2,
|
|
7837
|
+
max: 100,
|
|
7838
|
+
step: 1,
|
|
7839
|
+
default: 10,
|
|
7840
|
+
description: "计算中轨的周期数"
|
|
7841
|
+
}, {
|
|
7842
|
+
key: "deviation",
|
|
7843
|
+
label: "偏离率",
|
|
7844
|
+
type: "number",
|
|
7845
|
+
min: 1,
|
|
7846
|
+
max: 30,
|
|
7847
|
+
step: .5,
|
|
7848
|
+
default: 11,
|
|
7849
|
+
description: "轨道偏离率百分比,决定轨道宽度"
|
|
7850
|
+
}]
|
|
7851
|
+
},
|
|
7772
7852
|
{
|
|
7773
7853
|
id: "MACD",
|
|
7774
7854
|
label: "MACD",
|
|
@@ -8023,10 +8103,9 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8023
8103
|
if (!t?.params) return {};
|
|
8024
8104
|
let n = {};
|
|
8025
8105
|
for (let e of t.params) n[e.key] = e.default ?? e.min ?? 1;
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
};
|
|
8106
|
+
let r = E.indicatorParams?.[e] || {}, i = { ...n };
|
|
8107
|
+
for (let [e, t] of Object.entries(r)) typeof t == "number" && (i[e] = t);
|
|
8108
|
+
return i;
|
|
8030
8109
|
}
|
|
8031
8110
|
function I(e) {
|
|
8032
8111
|
let t = ae(e.id);
|
|
@@ -8056,8 +8135,8 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8056
8135
|
document.addEventListener("click", se), window.addEventListener("resize", ce);
|
|
8057
8136
|
}), h(() => {
|
|
8058
8137
|
document.removeEventListener("click", se), window.removeEventListener("resize", ce);
|
|
8059
|
-
}), (r, u) => (g(), o("div",
|
|
8060
|
-
s("div",
|
|
8138
|
+
}), (r, u) => (g(), o("div", Bo, [
|
|
8139
|
+
s("div", Vo, [s("div", Ho, [(g(!0), o(e, null, v(te.value, (e) => (g(), o("div", {
|
|
8061
8140
|
key: e.id,
|
|
8062
8141
|
class: "indicator-item"
|
|
8063
8142
|
}, [s("div", {
|
|
@@ -8067,8 +8146,8 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8067
8146
|
}, [s("button", { class: f(["indicator-btn", {
|
|
8068
8147
|
active: !0,
|
|
8069
8148
|
hovering: M.value === e.id
|
|
8070
|
-
}]) }, [s("span",
|
|
8071
|
-
default: C(() => [M.value === e.id ? (g(), o("div",
|
|
8149
|
+
}]) }, [s("span", Wo, [c(b(e.label) + " ", 1), e.params ? (g(), o("span", Go, " (" + b(I(e)) + ") ", 1)) : a("", !0)]), l(n, { name: "fade" }, {
|
|
8150
|
+
default: C(() => [M.value === e.id ? (g(), o("div", Ko, [
|
|
8072
8151
|
e.params ? (g(), o("button", {
|
|
8073
8152
|
key: 0,
|
|
8074
8153
|
class: "action-btn settings-btn",
|
|
@@ -8079,8 +8158,8 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8079
8158
|
width: "14",
|
|
8080
8159
|
height: "14",
|
|
8081
8160
|
fill: "currentColor"
|
|
8082
|
-
}, [s("path", { d: "M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" })], -1)]], 8,
|
|
8083
|
-
e.params ? (g(), o("span",
|
|
8161
|
+
}, [s("path", { d: "M19.14 12.94c.04-.31.06-.63.06-.94 0-.31-.02-.63-.06-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z" })], -1)]], 8, qo)) : a("", !0),
|
|
8162
|
+
e.params ? (g(), o("span", Jo)) : a("", !0),
|
|
8084
8163
|
s("button", {
|
|
8085
8164
|
class: "action-btn remove-btn",
|
|
8086
8165
|
onClick: w((t) => re(e.id), ["stop"]),
|
|
@@ -8090,10 +8169,10 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8090
8169
|
width: "14",
|
|
8091
8170
|
height: "14",
|
|
8092
8171
|
fill: "currentColor"
|
|
8093
|
-
}, [s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })], -1)]], 8,
|
|
8172
|
+
}, [s("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })], -1)]], 8, Yo)
|
|
8094
8173
|
])) : a("", !0)]),
|
|
8095
8174
|
_: 2
|
|
8096
|
-
}, 1024)], 2)], 40,
|
|
8175
|
+
}, 1024)], 2)], 40, Uo)]))), 128)), s("div", Xo, [s("button", {
|
|
8097
8176
|
ref_key: "addBtnRef",
|
|
8098
8177
|
ref: O,
|
|
8099
8178
|
class: "add-btn",
|
|
@@ -8112,38 +8191,38 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8112
8191
|
ref_key: "addMenuRef",
|
|
8113
8192
|
ref: k,
|
|
8114
8193
|
style: p(ee.value)
|
|
8115
|
-
}, [s("div",
|
|
8194
|
+
}, [s("div", Zo, [u[6] ||= s("div", { class: "menu-title" }, "主图指标", -1), s("div", Qo, [(g(!0), o(e, null, v(x(S), (e) => (g(), o("button", {
|
|
8116
8195
|
key: e.id,
|
|
8117
8196
|
class: f(["menu-item", { disabled: F(e.id) }]),
|
|
8118
8197
|
disabled: F(e.id),
|
|
8119
8198
|
onClick: (t) => ne(e.id)
|
|
8120
8199
|
}, [
|
|
8121
8200
|
c(b(e.label) + " ", 1),
|
|
8122
|
-
e.params ? (g(), o("span",
|
|
8123
|
-
F(e.id) ? (g(), o("span",
|
|
8201
|
+
e.params ? (g(), o("span", es, " (" + b(e.name) + ") ", 1)) : a("", !0),
|
|
8202
|
+
F(e.id) ? (g(), o("span", ts, [...u[5] ||= [s("svg", {
|
|
8124
8203
|
viewBox: "0 0 24 24",
|
|
8125
8204
|
width: "14",
|
|
8126
8205
|
height: "14",
|
|
8127
8206
|
fill: "currentColor"
|
|
8128
8207
|
}, [s("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })], -1)]])) : a("", !0)
|
|
8129
|
-
], 10,
|
|
8208
|
+
], 10, $o))), 128))])]), s("div", ns, [u[8] ||= s("div", { class: "menu-title" }, "副图指标", -1), s("div", rs, [(g(!0), o(e, null, v(x(T), (e) => (g(), o("button", {
|
|
8130
8209
|
key: e.id,
|
|
8131
8210
|
class: f(["menu-item", { disabled: F(e.id) }]),
|
|
8132
8211
|
disabled: F(e.id),
|
|
8133
8212
|
onClick: (t) => ne(e.id)
|
|
8134
8213
|
}, [
|
|
8135
8214
|
c(b(e.label) + " ", 1),
|
|
8136
|
-
e.params ? (g(), o("span",
|
|
8137
|
-
F(e.id) ? (g(), o("span",
|
|
8215
|
+
e.params ? (g(), o("span", as, " (" + b(e.name) + ") ", 1)) : a("", !0),
|
|
8216
|
+
F(e.id) ? (g(), o("span", os, [...u[7] ||= [s("svg", {
|
|
8138
8217
|
viewBox: "0 0 24 24",
|
|
8139
8218
|
width: "14",
|
|
8140
8219
|
height: "14",
|
|
8141
8220
|
fill: "currentColor"
|
|
8142
8221
|
}, [s("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" })], -1)]])) : a("", !0)
|
|
8143
|
-
], 10,
|
|
8222
|
+
], 10, is))), 128))])])], 4)) : a("", !0)]),
|
|
8144
8223
|
_: 1
|
|
8145
8224
|
})])),
|
|
8146
|
-
P.value ? (g(), i(
|
|
8225
|
+
P.value ? (g(), i(zo, {
|
|
8147
8226
|
key: 0,
|
|
8148
8227
|
visible: A.value,
|
|
8149
8228
|
"indicator-id": P.value.id,
|
|
@@ -8163,15 +8242,15 @@ var Qa = { class: "kline-tooltip__title" }, $a = { key: 0 }, eo = { class: "klin
|
|
|
8163
8242
|
])) : a("", !0)
|
|
8164
8243
|
]));
|
|
8165
8244
|
}
|
|
8166
|
-
}), [["__scopeId", "data-v-
|
|
8245
|
+
}), [["__scopeId", "data-v-aad3b750"]]);
|
|
8167
8246
|
//#endregion
|
|
8168
8247
|
//#region src/core/utils/klineConfig.ts
|
|
8169
|
-
function
|
|
8248
|
+
function cs(e, t) {
|
|
8170
8249
|
let n = Math.round(e * t);
|
|
8171
8250
|
return n % 2 == 0 && (n += 1), Math.max(1, n);
|
|
8172
8251
|
}
|
|
8173
|
-
function
|
|
8174
|
-
let r =
|
|
8252
|
+
function ls(e, t, n) {
|
|
8253
|
+
let r = cs(e, n), i = Math.round(t * n), a = r + i, o = i;
|
|
8175
8254
|
return {
|
|
8176
8255
|
kWidthPx: r,
|
|
8177
8256
|
kGapPx: i,
|
|
@@ -8185,14 +8264,14 @@ function ss(e, t, n) {
|
|
|
8185
8264
|
}
|
|
8186
8265
|
//#endregion
|
|
8187
8266
|
//#region src/core/viewport/viewport.ts
|
|
8188
|
-
function
|
|
8189
|
-
let { unitPx: o, startXPx: s } =
|
|
8267
|
+
function us(e, t, n, r, i, a = 1) {
|
|
8268
|
+
let { unitPx: o, startXPx: s } = ls(n, r, a), c = e * a, l = t * a;
|
|
8190
8269
|
return {
|
|
8191
8270
|
start: Math.max(0, Math.floor((c - s) / o) - 1),
|
|
8192
8271
|
end: Math.min(i, Math.ceil((c + l - s) / o) + 1)
|
|
8193
8272
|
};
|
|
8194
8273
|
}
|
|
8195
|
-
function
|
|
8274
|
+
function ds(e, t, n) {
|
|
8196
8275
|
let r = -Infinity, i = Infinity;
|
|
8197
8276
|
for (let a = t; a < n && a < e.length; a++) {
|
|
8198
8277
|
let t = e[a];
|
|
@@ -8208,7 +8287,7 @@ function ls(e, t, n) {
|
|
|
8208
8287
|
}
|
|
8209
8288
|
//#endregion
|
|
8210
8289
|
//#region src/core/scale/priceScale.ts
|
|
8211
|
-
var
|
|
8290
|
+
var fs = class {
|
|
8212
8291
|
range = {
|
|
8213
8292
|
maxPrice: 100,
|
|
8214
8293
|
minPrice: 0
|
|
@@ -8216,6 +8295,7 @@ var us = class {
|
|
|
8216
8295
|
height = 1;
|
|
8217
8296
|
paddingTop = 0;
|
|
8218
8297
|
paddingBottom = 0;
|
|
8298
|
+
priceOffset = 0;
|
|
8219
8299
|
setRange(e) {
|
|
8220
8300
|
this.range = e;
|
|
8221
8301
|
}
|
|
@@ -8234,15 +8314,27 @@ var us = class {
|
|
|
8234
8314
|
getPaddingBottom() {
|
|
8235
8315
|
return this.paddingBottom;
|
|
8236
8316
|
}
|
|
8317
|
+
setPriceOffset(e) {
|
|
8318
|
+
this.priceOffset = e;
|
|
8319
|
+
}
|
|
8320
|
+
getPriceOffset() {
|
|
8321
|
+
return this.priceOffset;
|
|
8322
|
+
}
|
|
8323
|
+
resetPriceOffset() {
|
|
8324
|
+
this.priceOffset = 0;
|
|
8325
|
+
}
|
|
8237
8326
|
priceToY(e) {
|
|
8238
|
-
let { maxPrice: t, minPrice: n } = this.range, r = t - n || 1,
|
|
8239
|
-
return this.paddingTop +
|
|
8327
|
+
let { maxPrice: t, minPrice: n } = this.range, r = e - this.priceOffset, i = t - n || 1, a = (r - n) / i, o = Math.max(1, this.height - this.paddingTop - this.paddingBottom);
|
|
8328
|
+
return this.paddingTop + o * (1 - a);
|
|
8240
8329
|
}
|
|
8241
8330
|
yToPrice(e) {
|
|
8242
8331
|
let { maxPrice: t, minPrice: n } = this.range, r = t - n || 1, i = Math.max(1, this.height - this.paddingTop - this.paddingBottom);
|
|
8243
|
-
return n + (1 - (e - this.paddingTop) / i) * r;
|
|
8332
|
+
return n + (1 - (e - this.paddingTop) / i) * r + this.priceOffset;
|
|
8244
8333
|
}
|
|
8245
|
-
|
|
8334
|
+
deltaYToPriceOffset(e) {
|
|
8335
|
+
return e * ((this.range.maxPrice - this.range.minPrice || 1) / Math.max(1, this.height - this.paddingTop - this.paddingBottom));
|
|
8336
|
+
}
|
|
8337
|
+
}, ps = class {
|
|
8246
8338
|
id;
|
|
8247
8339
|
top = 0;
|
|
8248
8340
|
height = 0;
|
|
@@ -8250,7 +8342,7 @@ var us = class {
|
|
|
8250
8342
|
maxPrice: 100,
|
|
8251
8343
|
minPrice: 0
|
|
8252
8344
|
};
|
|
8253
|
-
yAxis = new
|
|
8345
|
+
yAxis = new fs();
|
|
8254
8346
|
renderers = [];
|
|
8255
8347
|
constructor(e) {
|
|
8256
8348
|
this.id = e;
|
|
@@ -8265,13 +8357,15 @@ var us = class {
|
|
|
8265
8357
|
this.renderers.push(e);
|
|
8266
8358
|
}
|
|
8267
8359
|
updateRange(e, t) {
|
|
8268
|
-
this.priceRange =
|
|
8360
|
+
this.priceRange = ds(e, t.start, t.end), this.yAxis.setRange(this.priceRange);
|
|
8269
8361
|
}
|
|
8270
|
-
},
|
|
8362
|
+
}, ms = class {
|
|
8271
8363
|
chart;
|
|
8272
8364
|
isDragging = !1;
|
|
8273
8365
|
dragStartX = 0;
|
|
8274
8366
|
scrollStartX = 0;
|
|
8367
|
+
dragStartY = 0;
|
|
8368
|
+
activePaneIdOnDrag = null;
|
|
8275
8369
|
isTouchSession = !1;
|
|
8276
8370
|
crosshairPos = null;
|
|
8277
8371
|
crosshairIndex = null;
|
|
@@ -8312,7 +8406,11 @@ var us = class {
|
|
|
8312
8406
|
this.clickedMarkerId = c.id, this.clickedMarkerData = c, this.onMarkerClickCallback && this.onMarkerClickCallback(c);
|
|
8313
8407
|
return;
|
|
8314
8408
|
}
|
|
8315
|
-
|
|
8409
|
+
let l = this.chart.getPaneRenderers().find((e) => {
|
|
8410
|
+
let t = e.getPane();
|
|
8411
|
+
return i >= t.top && i <= t.top + t.height;
|
|
8412
|
+
})?.getPane() || null;
|
|
8413
|
+
this.isDragging = !0, this.updateHoverFromPoint(e.clientX, e.clientY), this.dragStartX = e.clientX, this.dragStartY = e.clientY, this.scrollStartX = t.scrollLeft, this.activePaneIdOnDrag = l?.id || null, this.chart.scheduleDraw();
|
|
8316
8414
|
}
|
|
8317
8415
|
setTooltipSize(e) {
|
|
8318
8416
|
this.tooltipSize = e;
|
|
@@ -8330,7 +8428,11 @@ var us = class {
|
|
|
8330
8428
|
this.clickedMarkerId = c.id, this.onMarkerClickCallback && this.onMarkerClickCallback(c);
|
|
8331
8429
|
return;
|
|
8332
8430
|
}
|
|
8333
|
-
|
|
8431
|
+
let l = this.chart.getPaneRenderers().find((e) => {
|
|
8432
|
+
let t = e.getPane();
|
|
8433
|
+
return i >= t.top && i <= t.top + t.height;
|
|
8434
|
+
})?.getPane() || null;
|
|
8435
|
+
this.isDragging = !0, this.dragStartX = e.clientX, this.dragStartY = e.clientY, this.scrollStartX = t.scrollLeft, this.activePaneIdOnDrag = l?.id || null, this.updateHoverFromPoint(e.clientX, e.clientY), this.chart.scheduleDraw(), e.preventDefault();
|
|
8334
8436
|
}
|
|
8335
8437
|
onMouseMove(e) {
|
|
8336
8438
|
if (this.isTouchSession) return;
|
|
@@ -8338,6 +8440,8 @@ var us = class {
|
|
|
8338
8440
|
if (this.isDragging) {
|
|
8339
8441
|
let n = this.dragStartX - e.clientX;
|
|
8340
8442
|
t.scrollLeft = this.scrollStartX + n;
|
|
8443
|
+
let r = e.clientY - this.dragStartY;
|
|
8444
|
+
r !== 0 && this.activePaneIdOnDrag && (this.chart.translatePrice(this.activePaneIdOnDrag, r), this.dragStartY = e.clientY);
|
|
8341
8445
|
return;
|
|
8342
8446
|
}
|
|
8343
8447
|
this.updateHover(e), this.chart.scheduleDraw();
|
|
@@ -8358,6 +8462,8 @@ var us = class {
|
|
|
8358
8462
|
if (this.isDragging) {
|
|
8359
8463
|
let n = this.dragStartX - e.clientX;
|
|
8360
8464
|
t.scrollLeft = this.scrollStartX + n;
|
|
8465
|
+
let r = e.clientY - this.dragStartY;
|
|
8466
|
+
r !== 0 && this.activePaneIdOnDrag && (this.chart.translatePrice(this.activePaneIdOnDrag, r), this.dragStartY = e.clientY);
|
|
8361
8467
|
return;
|
|
8362
8468
|
}
|
|
8363
8469
|
this.updateHoverFromPoint(e.clientX, e.clientY), this.chart.scheduleDraw();
|
|
@@ -8446,9 +8552,9 @@ var us = class {
|
|
|
8446
8552
|
};
|
|
8447
8553
|
}
|
|
8448
8554
|
reset() {
|
|
8449
|
-
this.isDragging = !1, this.dragStartX = 0, this.scrollStartX = 0, this.isTouchSession = !1, this.crosshairPos = null, this.crosshairIndex = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId = null, this.clickedMarkerId = null, this.hoveredMarkerData = null, this.clickedMarkerData = null, this.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
|
|
8555
|
+
this.isDragging = !1, this.dragStartX = 0, this.dragStartY = 0, this.scrollStartX = 0, this.activePaneIdOnDrag = null, this.isTouchSession = !1, this.crosshairPos = null, this.crosshairIndex = null, this.hoveredIndex = null, this.activePaneId = null, this.hoveredMarkerId = null, this.clickedMarkerId = null, this.hoveredMarkerData = null, this.clickedMarkerData = null, this.kLinePositions = null, this.visibleRange = null, this.kWidthPx = null;
|
|
8450
8556
|
}
|
|
8451
|
-
},
|
|
8557
|
+
}, hs = class {
|
|
8452
8558
|
dom;
|
|
8453
8559
|
pane;
|
|
8454
8560
|
opt;
|
|
@@ -8474,7 +8580,7 @@ var us = class {
|
|
|
8474
8580
|
};
|
|
8475
8581
|
//#endregion
|
|
8476
8582
|
//#region src/core/renderers/subVolume.ts
|
|
8477
|
-
function
|
|
8583
|
+
function gs(e = {}) {
|
|
8478
8584
|
let { paneId: t = "sub" } = e;
|
|
8479
8585
|
return {
|
|
8480
8586
|
name: `volume_${t}`,
|
|
@@ -8493,30 +8599,24 @@ function ms(e = {}) {
|
|
|
8493
8599
|
if (!r) continue;
|
|
8494
8600
|
let i = r.volume;
|
|
8495
8601
|
if (!i) continue;
|
|
8496
|
-
let a =
|
|
8497
|
-
d &&
|
|
8602
|
+
let a = vs(r), d = c[e - u];
|
|
8603
|
+
d && _s(t, d, a, i, f, o, s, n.height);
|
|
8498
8604
|
}
|
|
8499
8605
|
t.restore();
|
|
8500
8606
|
}
|
|
8501
8607
|
};
|
|
8502
8608
|
}
|
|
8503
|
-
function
|
|
8504
|
-
let c =
|
|
8609
|
+
function _s(e, t, n, r, i, a, o, s) {
|
|
8610
|
+
let c = ys(r, i, s), l = a;
|
|
8505
8611
|
e.fillStyle = n, e.fillRect(t, c, l, s - c);
|
|
8506
8612
|
}
|
|
8507
|
-
function
|
|
8613
|
+
function vs(e) {
|
|
8508
8614
|
return e.close > e.open ? X.UP : e.close < e.open ? X.DOWN : X.NEUTRAL;
|
|
8509
8615
|
}
|
|
8510
|
-
function
|
|
8616
|
+
function ys(e, t, n) {
|
|
8511
8617
|
return n - n / t * e;
|
|
8512
8618
|
}
|
|
8513
8619
|
//#endregion
|
|
8514
|
-
//#region src/utils/priceToY.ts
|
|
8515
|
-
function vs(e, t, n, r, i, a) {
|
|
8516
|
-
let o = t - n || 1, s = (e - n) / o;
|
|
8517
|
-
return i + Math.max(1, r - i - a) * (1 - s);
|
|
8518
|
-
}
|
|
8519
|
-
//#endregion
|
|
8520
8620
|
//#region src/core/draw/pixelAlign.ts
|
|
8521
8621
|
function Z(e, t) {
|
|
8522
8622
|
return Math.round(e * t) / t;
|
|
@@ -8524,7 +8624,7 @@ function Z(e, t) {
|
|
|
8524
8624
|
function Q(e, t) {
|
|
8525
8625
|
return (Math.floor(e * t) + .5) / t;
|
|
8526
8626
|
}
|
|
8527
|
-
function
|
|
8627
|
+
function bs(e, t, n, r) {
|
|
8528
8628
|
if (t === n) return null;
|
|
8529
8629
|
let i = Math.min(t, n), a = Math.max(t, n), o = Math.round(e * r), s = Math.round(i * r), c = Math.round(a * r);
|
|
8530
8630
|
return {
|
|
@@ -8534,7 +8634,7 @@ function ys(e, t, n, r) {
|
|
|
8534
8634
|
height: Math.max(1, c - s) / r
|
|
8535
8635
|
};
|
|
8536
8636
|
}
|
|
8537
|
-
function
|
|
8637
|
+
function xs(e, t, n, r) {
|
|
8538
8638
|
if (e === t) return null;
|
|
8539
8639
|
let i = Math.min(e, t), a = Math.max(e, t), o = Math.round(i * r), s = Math.round(a * r), c = Math.round(n * r);
|
|
8540
8640
|
return {
|
|
@@ -8544,7 +8644,7 @@ function bs(e, t, n, r) {
|
|
|
8544
8644
|
height: 1 / r
|
|
8545
8645
|
};
|
|
8546
8646
|
}
|
|
8547
|
-
function
|
|
8647
|
+
function Ss(e, t, n, r, i) {
|
|
8548
8648
|
let a = e + n, o = n, s = Math.round(t * i), c = Math.round((t + r) * i), l = Math.max(1, c - s), u = e + (n - 1) / 2, d = u, f = o % 2 == 1;
|
|
8549
8649
|
return {
|
|
8550
8650
|
bodyRect: {
|
|
@@ -8567,7 +8667,7 @@ function xs(e, t, n, r, i) {
|
|
|
8567
8667
|
}
|
|
8568
8668
|
//#endregion
|
|
8569
8669
|
//#region src/core/renderers/Indicator/ma.ts
|
|
8570
|
-
function
|
|
8670
|
+
function Cs(e, t) {
|
|
8571
8671
|
let n = Array(e.length);
|
|
8572
8672
|
if (e.length < t) return n;
|
|
8573
8673
|
let r = 0;
|
|
@@ -8583,7 +8683,7 @@ function Ss(e, t) {
|
|
|
8583
8683
|
}
|
|
8584
8684
|
return n;
|
|
8585
8685
|
}
|
|
8586
|
-
function
|
|
8686
|
+
function ws(e = {}) {
|
|
8587
8687
|
let t = {
|
|
8588
8688
|
ma5: !0,
|
|
8589
8689
|
ma10: !0,
|
|
@@ -8595,24 +8695,21 @@ function Cs(e = {}) {
|
|
|
8595
8695
|
function i(e, t) {
|
|
8596
8696
|
let i = n.get(t);
|
|
8597
8697
|
if (i && r === e) return i.values;
|
|
8598
|
-
let a =
|
|
8698
|
+
let a = Cs(e, t);
|
|
8599
8699
|
return n.set(t, {
|
|
8600
8700
|
period: t,
|
|
8601
8701
|
values: a
|
|
8602
8702
|
}), r = e, a;
|
|
8603
8703
|
}
|
|
8604
8704
|
function a(e, t, n, r) {
|
|
8605
|
-
let { pane: i, range: a, kWidth: o,
|
|
8606
|
-
if (!d) return;
|
|
8607
|
-
let h = d.maxPrice, g = d.minPrice;
|
|
8608
|
-
if (!Number.isFinite(h) || !Number.isFinite(g)) return;
|
|
8705
|
+
let { pane: i, range: a, kWidth: o, dpr: s, kLinePositions: c } = n;
|
|
8609
8706
|
e.strokeStyle = r, e.lineWidth = 1, e.lineJoin = "round", e.lineCap = "round", e.beginPath();
|
|
8610
|
-
let
|
|
8707
|
+
let l = !0;
|
|
8611
8708
|
for (let n = a.start; n < a.end && n < t.length; n++) {
|
|
8612
8709
|
let r = t[n];
|
|
8613
8710
|
if (r === void 0) continue;
|
|
8614
|
-
let
|
|
8615
|
-
|
|
8711
|
+
let u = c[n - a.start] + o / 2, d = i.yAxis.priceToY(r), f = Q(u, s), p = Q(d, s);
|
|
8712
|
+
l ? (e.moveTo(f, p), l = !1) : e.lineTo(f, p);
|
|
8616
8713
|
}
|
|
8617
8714
|
e.stroke();
|
|
8618
8715
|
}
|
|
@@ -8639,82 +8736,8 @@ function Cs(e = {}) {
|
|
|
8639
8736
|
};
|
|
8640
8737
|
}
|
|
8641
8738
|
//#endregion
|
|
8642
|
-
//#region src/utils/kline/ma.ts
|
|
8643
|
-
function ws(e, t, n) {
|
|
8644
|
-
if (t < n - 1) return;
|
|
8645
|
-
let r = 0;
|
|
8646
|
-
for (let i = 0; i < n; i++) {
|
|
8647
|
-
let n = e[t - i];
|
|
8648
|
-
if (!n) return;
|
|
8649
|
-
r += n.close;
|
|
8650
|
-
}
|
|
8651
|
-
return r / n;
|
|
8652
|
-
}
|
|
8653
|
-
//#endregion
|
|
8654
|
-
//#region src/core/renderers/Indicator/maLegend.ts
|
|
8655
|
-
function Ts(e) {
|
|
8656
|
-
let t = {
|
|
8657
|
-
ma5: !0,
|
|
8658
|
-
ma10: !0,
|
|
8659
|
-
ma20: !0,
|
|
8660
|
-
ma30: !0,
|
|
8661
|
-
ma60: !0,
|
|
8662
|
-
...e.showMA
|
|
8663
|
-
};
|
|
8664
|
-
return {
|
|
8665
|
-
name: "maLegend",
|
|
8666
|
-
version: "1.0.0",
|
|
8667
|
-
description: "MA均线图例渲染器",
|
|
8668
|
-
debugName: "MA图例",
|
|
8669
|
-
paneId: "main",
|
|
8670
|
-
priority: Y.FOREGROUND,
|
|
8671
|
-
draw(n) {
|
|
8672
|
-
let { ctx: r, data: i, range: a } = n, o = i;
|
|
8673
|
-
if (!o.length) return;
|
|
8674
|
-
let s = (12 + e.yPaddingPx) / 2;
|
|
8675
|
-
r.save(), r.font = "12px Arial", r.textAlign = "left";
|
|
8676
|
-
let c = Math.min(a.end - 1, o.length - 1), l = [];
|
|
8677
|
-
if (t.ma5 && l.push({
|
|
8678
|
-
label: "MA5",
|
|
8679
|
-
color: ja.MA5,
|
|
8680
|
-
value: ws(o, c, 5)
|
|
8681
|
-
}), t.ma10 && l.push({
|
|
8682
|
-
label: "MA10",
|
|
8683
|
-
color: ja.MA10,
|
|
8684
|
-
value: ws(o, c, 10)
|
|
8685
|
-
}), t.ma20 && l.push({
|
|
8686
|
-
label: "MA20",
|
|
8687
|
-
color: ja.MA20,
|
|
8688
|
-
value: ws(o, c, 20)
|
|
8689
|
-
}), t.ma30 && l.push({
|
|
8690
|
-
label: "MA30",
|
|
8691
|
-
color: ja.MA30,
|
|
8692
|
-
value: ws(o, c, 30)
|
|
8693
|
-
}), t.ma60 && l.push({
|
|
8694
|
-
label: "MA60",
|
|
8695
|
-
color: ja.MA60,
|
|
8696
|
-
value: ws(o, c, 60)
|
|
8697
|
-
}), l.length > 0) {
|
|
8698
|
-
let e = 12, t = s;
|
|
8699
|
-
r.fillStyle = X.NEUTRAL, r.fillText("均线", e, t), e += r.measureText("均线").width + 10;
|
|
8700
|
-
for (let n of l) {
|
|
8701
|
-
let i = typeof n.value == "number" ? ` ${n.value.toFixed(2)}` : "", a = `${n.label}${i}`;
|
|
8702
|
-
r.fillStyle = n.color, r.fillText(a, e, t), e += r.measureText(a).width + 10;
|
|
8703
|
-
}
|
|
8704
|
-
}
|
|
8705
|
-
r.restore();
|
|
8706
|
-
},
|
|
8707
|
-
getConfig() {
|
|
8708
|
-
return { ...t };
|
|
8709
|
-
},
|
|
8710
|
-
setConfig(e) {
|
|
8711
|
-
Object.assign(t, e);
|
|
8712
|
-
}
|
|
8713
|
-
};
|
|
8714
|
-
}
|
|
8715
|
-
//#endregion
|
|
8716
8739
|
//#region src/core/renderers/Indicator/boll.ts
|
|
8717
|
-
function
|
|
8740
|
+
function Ts(e, t, n) {
|
|
8718
8741
|
let r = Array(e.length);
|
|
8719
8742
|
if (e.length < t) return r;
|
|
8720
8743
|
let i = 0, a = [];
|
|
@@ -8747,7 +8770,7 @@ function Es(e, t, n) {
|
|
|
8747
8770
|
}
|
|
8748
8771
|
return r;
|
|
8749
8772
|
}
|
|
8750
|
-
function
|
|
8773
|
+
function Es(e = {}) {
|
|
8751
8774
|
let t = {
|
|
8752
8775
|
period: 20,
|
|
8753
8776
|
multiplier: 2,
|
|
@@ -8758,7 +8781,7 @@ function Ds(e = {}) {
|
|
|
8758
8781
|
...e
|
|
8759
8782
|
}, n = null, r = 0, i = 0, a = [];
|
|
8760
8783
|
function o(e) {
|
|
8761
|
-
return (n !== e || r !== t.period || i !== t.multiplier) && (a =
|
|
8784
|
+
return (n !== e || r !== t.period || i !== t.multiplier) && (a = Ts(e, t.period, t.multiplier), n = e, r = t.period, i = t.multiplier), a;
|
|
8762
8785
|
}
|
|
8763
8786
|
return {
|
|
8764
8787
|
name: "boll",
|
|
@@ -8768,50 +8791,41 @@ function Ds(e = {}) {
|
|
|
8768
8791
|
paneId: "main",
|
|
8769
8792
|
priority: Y.INDICATOR,
|
|
8770
8793
|
draw(e) {
|
|
8771
|
-
let { ctx: n, pane: r, data: i, range: a, scrollLeft: s, kWidth: c,
|
|
8772
|
-
if (
|
|
8773
|
-
let
|
|
8774
|
-
kWidth: c,
|
|
8775
|
-
kGap: l,
|
|
8776
|
-
yPaddingPx: 0
|
|
8777
|
-
}, h = r.priceRange, g = r.height, _ = m.yPaddingPx ?? 0, v = Math.max(0, Math.min(_, Math.floor(g / 2) - 1)), y = v, b = v, x = h?.maxPrice ?? -Infinity, S = h?.minPrice ?? Infinity;
|
|
8778
|
-
if (!h) for (let e = a.start; e < a.end && e < f.length; e++) {
|
|
8779
|
-
let t = f[e];
|
|
8780
|
-
t && (t.high > x && (x = t.high), t.low < S && (S = t.low));
|
|
8781
|
-
}
|
|
8782
|
-
if (!Number.isFinite(x) || !Number.isFinite(S)) return;
|
|
8794
|
+
let { ctx: n, pane: r, data: i, range: a, scrollLeft: s, kWidth: c, dpr: l, kLinePositions: u } = e, d = i;
|
|
8795
|
+
if (d.length < t.period) return;
|
|
8796
|
+
let f = o(d);
|
|
8783
8797
|
n.save(), n.translate(-s, 0);
|
|
8784
|
-
let
|
|
8798
|
+
let p = Math.max(a.start, t.period - 1), m = Math.min(a.end, d.length);
|
|
8785
8799
|
if (t.showBand) {
|
|
8786
8800
|
n.fillStyle = Ma.BAND_FILL, n.beginPath();
|
|
8787
8801
|
let e = !0;
|
|
8788
|
-
for (let t =
|
|
8789
|
-
let
|
|
8790
|
-
if (!
|
|
8791
|
-
let
|
|
8792
|
-
e ? (n.moveTo(
|
|
8802
|
+
for (let t = p; t < m; t++) {
|
|
8803
|
+
let i = f[t];
|
|
8804
|
+
if (!i) continue;
|
|
8805
|
+
let o = u[t - a.start] + c / 2, s = r.yAxis.priceToY(i.upper), d = Q(o, l), p = Q(s, l);
|
|
8806
|
+
e ? (n.moveTo(d, p), e = !1) : n.lineTo(d, p);
|
|
8793
8807
|
}
|
|
8794
|
-
for (let e =
|
|
8795
|
-
let t =
|
|
8808
|
+
for (let e = m - 1; e >= p; e--) {
|
|
8809
|
+
let t = f[e];
|
|
8796
8810
|
if (!t) continue;
|
|
8797
|
-
let
|
|
8798
|
-
n.lineTo(
|
|
8811
|
+
let i = u[e - a.start] + c / 2, o = r.yAxis.priceToY(t.lower), s = Q(i, l), d = Q(o, l);
|
|
8812
|
+
n.lineTo(s, d);
|
|
8799
8813
|
}
|
|
8800
8814
|
n.closePath(), n.fill();
|
|
8801
8815
|
}
|
|
8802
8816
|
n.lineWidth = 1, n.lineJoin = "round", n.lineCap = "round";
|
|
8803
|
-
let
|
|
8817
|
+
let h = (e, t) => {
|
|
8804
8818
|
n.strokeStyle = t, n.beginPath();
|
|
8805
|
-
let
|
|
8806
|
-
for (let t =
|
|
8807
|
-
let
|
|
8808
|
-
if (!
|
|
8809
|
-
let
|
|
8810
|
-
|
|
8819
|
+
let i = !0;
|
|
8820
|
+
for (let t = p; t < m; t++) {
|
|
8821
|
+
let o = f[t];
|
|
8822
|
+
if (!o) continue;
|
|
8823
|
+
let s = u[t - a.start] + c / 2, d = r.yAxis.priceToY(o[e]), p = Q(s, l), m = Q(d, l);
|
|
8824
|
+
i ? (n.moveTo(p, m), i = !1) : n.lineTo(p, m);
|
|
8811
8825
|
}
|
|
8812
8826
|
n.stroke();
|
|
8813
8827
|
};
|
|
8814
|
-
t.showUpper &&
|
|
8828
|
+
t.showUpper && h("upper", Ma.UPPER), t.showMiddle && h("middle", Ma.MIDDLE), t.showLower && h("lower", Ma.LOWER), n.restore();
|
|
8815
8829
|
},
|
|
8816
8830
|
onDataUpdate() {
|
|
8817
8831
|
n = null;
|
|
@@ -8824,7 +8838,7 @@ function Ds(e = {}) {
|
|
|
8824
8838
|
}
|
|
8825
8839
|
};
|
|
8826
8840
|
}
|
|
8827
|
-
function
|
|
8841
|
+
function Ds(e, t, n = 20, r = 2) {
|
|
8828
8842
|
if (t < n - 1 || t >= e.length) return null;
|
|
8829
8843
|
let i = 0;
|
|
8830
8844
|
for (let r = 0; r < n; r++) {
|
|
@@ -8846,41 +8860,316 @@ function Os(e, t, n = 20, r = 2) {
|
|
|
8846
8860
|
};
|
|
8847
8861
|
}
|
|
8848
8862
|
//#endregion
|
|
8849
|
-
//#region src/core/renderers/Indicator/
|
|
8850
|
-
function
|
|
8863
|
+
//#region src/core/renderers/Indicator/expma.ts
|
|
8864
|
+
function Os(e, t, n) {
|
|
8865
|
+
let r = Array(e.length);
|
|
8866
|
+
if (e.length === 0) return r;
|
|
8867
|
+
let i = 2 / (t + 1), a = 2 / (n + 1), o = e[0].close, s = o, c = o;
|
|
8868
|
+
r[0] = {
|
|
8869
|
+
fast: s,
|
|
8870
|
+
slow: c
|
|
8871
|
+
};
|
|
8872
|
+
for (let t = 1; t < e.length; t++) {
|
|
8873
|
+
let n = e[t].close;
|
|
8874
|
+
s = n * i + s * (1 - i), c = n * a + c * (1 - a), r[t] = {
|
|
8875
|
+
fast: s,
|
|
8876
|
+
slow: c
|
|
8877
|
+
};
|
|
8878
|
+
}
|
|
8879
|
+
return r;
|
|
8880
|
+
}
|
|
8881
|
+
function ks(e, t, n = 12, r = 50) {
|
|
8882
|
+
if (t < 0 || t >= e.length) return null;
|
|
8883
|
+
let i = 2 / (n + 1), a = 2 / (r + 1), o = e[0].close, s = o, c = o;
|
|
8884
|
+
for (let n = 1; n <= t; n++) {
|
|
8885
|
+
let t = e[n].close;
|
|
8886
|
+
s = t * i + s * (1 - i), c = t * a + c * (1 - a);
|
|
8887
|
+
}
|
|
8888
|
+
return {
|
|
8889
|
+
fast: s,
|
|
8890
|
+
slow: c
|
|
8891
|
+
};
|
|
8892
|
+
}
|
|
8893
|
+
function As(e = {}) {
|
|
8851
8894
|
let t = {
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8895
|
+
fastPeriod: 12,
|
|
8896
|
+
slowPeriod: 50,
|
|
8897
|
+
...e
|
|
8898
|
+
}, n = null, r = 0, i = 0, a = [];
|
|
8899
|
+
function o(e) {
|
|
8900
|
+
return (n !== e || r !== t.fastPeriod || i !== t.slowPeriod) && (a = Os(e, t.fastPeriod, t.slowPeriod), n = e, r = t.fastPeriod, i = t.slowPeriod), a;
|
|
8901
|
+
}
|
|
8902
|
+
return {
|
|
8903
|
+
name: "expma",
|
|
8904
|
+
version: "1.0.0",
|
|
8905
|
+
description: "EXPMA 指数平滑移动平均线渲染器",
|
|
8906
|
+
debugName: "EXPMA",
|
|
8907
|
+
paneId: "main",
|
|
8908
|
+
priority: Y.INDICATOR,
|
|
8909
|
+
draw(e) {
|
|
8910
|
+
let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: s, dpr: c, kLinePositions: l } = e, u = r;
|
|
8911
|
+
if (u.length < 2) return;
|
|
8912
|
+
let d = o(u);
|
|
8913
|
+
t.save(), t.translate(-a, 0);
|
|
8914
|
+
let f = i.start, p = Math.min(i.end, u.length), m = (e, r) => {
|
|
8915
|
+
t.strokeStyle = r, t.lineWidth = 1, t.lineJoin = "round", t.lineCap = "round", t.beginPath();
|
|
8916
|
+
let a = !0;
|
|
8917
|
+
for (let r = f; r < p; r++) {
|
|
8918
|
+
let o = d[r];
|
|
8919
|
+
if (!o) continue;
|
|
8920
|
+
let u = l[r - i.start] + s / 2, f = n.yAxis.priceToY(o[e]), p = Q(u, c), m = Q(f, c);
|
|
8921
|
+
a ? (t.moveTo(p, m), a = !1) : t.lineTo(p, m);
|
|
8922
|
+
}
|
|
8923
|
+
t.stroke();
|
|
8924
|
+
};
|
|
8925
|
+
m("fast", "#FFD700"), m("slow", "rgba(69, 112, 249, 1)"), t.restore();
|
|
8926
|
+
},
|
|
8927
|
+
onDataUpdate() {
|
|
8928
|
+
n = null;
|
|
8929
|
+
},
|
|
8930
|
+
getConfig() {
|
|
8931
|
+
return { ...t };
|
|
8932
|
+
},
|
|
8933
|
+
setConfig(e) {
|
|
8934
|
+
"fastPeriod" in e && e.fastPeriod !== t.fastPeriod && (n = null), "slowPeriod" in e && e.slowPeriod !== t.slowPeriod && (n = null), Object.assign(t, e);
|
|
8935
|
+
}
|
|
8856
8936
|
};
|
|
8937
|
+
}
|
|
8938
|
+
//#endregion
|
|
8939
|
+
//#region src/core/renderers/Indicator/ene.ts
|
|
8940
|
+
function js(e, t, n) {
|
|
8941
|
+
let r = Array(e.length);
|
|
8942
|
+
if (e.length < t) return r;
|
|
8943
|
+
let i = 0;
|
|
8944
|
+
for (let n = 0; n < t; n++) {
|
|
8945
|
+
let t = e[n];
|
|
8946
|
+
if (!t) return r;
|
|
8947
|
+
i += t.close;
|
|
8948
|
+
}
|
|
8949
|
+
let a = i / t, o = n / 100;
|
|
8950
|
+
r[t - 1] = {
|
|
8951
|
+
upper: a * (1 + o),
|
|
8952
|
+
middle: a,
|
|
8953
|
+
lower: a * (1 - o)
|
|
8954
|
+
};
|
|
8955
|
+
for (let a = t; a < e.length; a++) {
|
|
8956
|
+
let o = e[a - t], s = e[a];
|
|
8957
|
+
if (!o || !s) continue;
|
|
8958
|
+
i = i - o.close + s.close;
|
|
8959
|
+
let c = i / t, l = n / 100;
|
|
8960
|
+
r[a] = {
|
|
8961
|
+
upper: c * (1 + l),
|
|
8962
|
+
middle: c,
|
|
8963
|
+
lower: c * (1 - l)
|
|
8964
|
+
};
|
|
8965
|
+
}
|
|
8966
|
+
return r;
|
|
8967
|
+
}
|
|
8968
|
+
function Ms(e, t, n = 10, r = 11) {
|
|
8969
|
+
if (t < n - 1 || t >= e.length) return null;
|
|
8970
|
+
let i = 0;
|
|
8971
|
+
for (let r = 0; r < n; r++) {
|
|
8972
|
+
let n = e[t - r];
|
|
8973
|
+
if (!n) return null;
|
|
8974
|
+
i += n.close;
|
|
8975
|
+
}
|
|
8976
|
+
let a = i / n, o = r / 100;
|
|
8857
8977
|
return {
|
|
8858
|
-
|
|
8978
|
+
upper: a * (1 + o),
|
|
8979
|
+
middle: a,
|
|
8980
|
+
lower: a * (1 - o)
|
|
8981
|
+
};
|
|
8982
|
+
}
|
|
8983
|
+
function Ns(e = {}) {
|
|
8984
|
+
let t = {
|
|
8985
|
+
period: 10,
|
|
8986
|
+
deviation: 11,
|
|
8987
|
+
...e
|
|
8988
|
+
}, n = null, r = 0, i = 0, a = [];
|
|
8989
|
+
function o(e) {
|
|
8990
|
+
return (n !== e || r !== t.period || i !== t.deviation) && (a = js(e, t.period, t.deviation), n = e, r = t.period, i = t.deviation), a;
|
|
8991
|
+
}
|
|
8992
|
+
return {
|
|
8993
|
+
name: "ene",
|
|
8859
8994
|
version: "1.0.0",
|
|
8860
|
-
description: "
|
|
8861
|
-
debugName: "
|
|
8995
|
+
description: "ENE 轨道线渲染器",
|
|
8996
|
+
debugName: "ENE轨道线",
|
|
8862
8997
|
paneId: "main",
|
|
8863
|
-
priority: Y.
|
|
8864
|
-
draw(
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8998
|
+
priority: Y.INDICATOR,
|
|
8999
|
+
draw(e) {
|
|
9000
|
+
let { ctx: n, pane: r, data: i, range: a, scrollLeft: s, kWidth: c, dpr: l, kLinePositions: u } = e, d = i;
|
|
9001
|
+
if (d.length < t.period) return;
|
|
9002
|
+
let f = o(d);
|
|
9003
|
+
n.save(), n.translate(-s, 0);
|
|
9004
|
+
let p = Math.max(a.start, t.period - 1), m = Math.min(a.end, d.length);
|
|
9005
|
+
n.fillStyle = "rgba(69, 112, 249, 0.08)", n.beginPath();
|
|
9006
|
+
let h = !0;
|
|
9007
|
+
for (let e = p; e < m; e++) {
|
|
9008
|
+
let t = f[e];
|
|
9009
|
+
if (!t) continue;
|
|
9010
|
+
let i = u[e - a.start] + c / 2, o = r.yAxis.priceToY(t.upper), s = Q(i, l), d = Q(o, l);
|
|
9011
|
+
h ? (n.moveTo(s, d), h = !1) : n.lineTo(s, d);
|
|
9012
|
+
}
|
|
9013
|
+
for (let e = m - 1; e >= p; e--) {
|
|
9014
|
+
let t = f[e];
|
|
9015
|
+
if (!t) continue;
|
|
9016
|
+
let i = u[e - a.start] + c / 2, o = r.yAxis.priceToY(t.lower), s = Q(i, l), d = Q(o, l);
|
|
9017
|
+
n.lineTo(s, d);
|
|
9018
|
+
}
|
|
9019
|
+
n.closePath(), n.fill(), n.lineWidth = 1, n.lineJoin = "round", n.lineCap = "round";
|
|
9020
|
+
let g = (e, t) => {
|
|
9021
|
+
n.strokeStyle = t, n.beginPath();
|
|
9022
|
+
let i = !0;
|
|
9023
|
+
for (let t = p; t < m; t++) {
|
|
9024
|
+
let o = f[t];
|
|
9025
|
+
if (!o) continue;
|
|
9026
|
+
let s = u[t - a.start] + c / 2, d = r.yAxis.priceToY(o[e]), p = Q(s, l), m = Q(d, l);
|
|
9027
|
+
i ? (n.moveTo(p, m), i = !1) : n.lineTo(p, m);
|
|
9028
|
+
}
|
|
9029
|
+
n.stroke();
|
|
9030
|
+
};
|
|
9031
|
+
g("upper", "rgba(214, 10, 34, 1)"), g("middle", "rgba(69, 112, 249, 1)"), g("lower", "rgba(3, 123, 102, 1)"), n.restore();
|
|
9032
|
+
},
|
|
9033
|
+
onDataUpdate() {
|
|
9034
|
+
n = null;
|
|
8872
9035
|
},
|
|
8873
9036
|
getConfig() {
|
|
8874
9037
|
return { ...t };
|
|
8875
9038
|
},
|
|
8876
9039
|
setConfig(e) {
|
|
8877
|
-
Object.assign(t, e);
|
|
9040
|
+
"period" in e && e.period !== t.period && (n = null), "deviation" in e && e.deviation !== t.deviation && (n = null), Object.assign(t, e);
|
|
9041
|
+
}
|
|
9042
|
+
};
|
|
9043
|
+
}
|
|
9044
|
+
//#endregion
|
|
9045
|
+
//#region src/utils/kline/ma.ts
|
|
9046
|
+
function Ps(e, t, n) {
|
|
9047
|
+
if (t < n - 1) return;
|
|
9048
|
+
let r = 0;
|
|
9049
|
+
for (let i = 0; i < n; i++) {
|
|
9050
|
+
let n = e[t - i];
|
|
9051
|
+
if (!n) return;
|
|
9052
|
+
r += n.close;
|
|
9053
|
+
}
|
|
9054
|
+
return r / n;
|
|
9055
|
+
}
|
|
9056
|
+
//#endregion
|
|
9057
|
+
//#region src/core/renderers/Indicator/mainIndicatorLegend.ts
|
|
9058
|
+
function Fs(e) {
|
|
9059
|
+
let t = {
|
|
9060
|
+
yPaddingPx: e.yPaddingPx,
|
|
9061
|
+
indicators: {
|
|
9062
|
+
MA: {
|
|
9063
|
+
enabled: !0,
|
|
9064
|
+
params: {}
|
|
9065
|
+
},
|
|
9066
|
+
BOLL: {
|
|
9067
|
+
enabled: !1,
|
|
9068
|
+
params: {
|
|
9069
|
+
period: 20,
|
|
9070
|
+
multiplier: 2
|
|
9071
|
+
}
|
|
9072
|
+
},
|
|
9073
|
+
EXPMA: {
|
|
9074
|
+
enabled: !1,
|
|
9075
|
+
params: {
|
|
9076
|
+
fastPeriod: 12,
|
|
9077
|
+
slowPeriod: 50
|
|
9078
|
+
}
|
|
9079
|
+
},
|
|
9080
|
+
ENE: {
|
|
9081
|
+
enabled: !1,
|
|
9082
|
+
params: {
|
|
9083
|
+
period: 10,
|
|
9084
|
+
deviation: 11
|
|
9085
|
+
}
|
|
9086
|
+
}
|
|
9087
|
+
}
|
|
9088
|
+
};
|
|
9089
|
+
return {
|
|
9090
|
+
name: "mainIndicatorLegend",
|
|
9091
|
+
version: "1.0.0",
|
|
9092
|
+
description: "主图指标图例渲染器(统一管理 MA、BOLL 等)",
|
|
9093
|
+
debugName: "主图指标图例",
|
|
9094
|
+
paneId: "main",
|
|
9095
|
+
priority: Y.FOREGROUND,
|
|
9096
|
+
enabled: !0,
|
|
9097
|
+
draw(e) {
|
|
9098
|
+
let { ctx: n, data: r, range: i } = e, a = r;
|
|
9099
|
+
if (!a.length) return;
|
|
9100
|
+
n.save(), n.font = "12px Arial", n.textAlign = "left";
|
|
9101
|
+
let o = Math.min(i.end - 1, a.length - 1), s = [], c = t.indicators.MA;
|
|
9102
|
+
c?.enabled && s.push({ draw: (e) => {
|
|
9103
|
+
let r = [], i = c.params.periods;
|
|
9104
|
+
if (i && Array.isArray(i) ? i.forEach((e) => {
|
|
9105
|
+
let t = `MA${e}`;
|
|
9106
|
+
r.push({
|
|
9107
|
+
label: `MA${e}`,
|
|
9108
|
+
color: ja[t] || ja.MA5,
|
|
9109
|
+
value: Ps(a, o, e)
|
|
9110
|
+
});
|
|
9111
|
+
}) : r.push({
|
|
9112
|
+
label: "MA5",
|
|
9113
|
+
color: ja.MA5,
|
|
9114
|
+
value: Ps(a, o, 5)
|
|
9115
|
+
}, {
|
|
9116
|
+
label: "MA10",
|
|
9117
|
+
color: ja.MA10,
|
|
9118
|
+
value: Ps(a, o, 10)
|
|
9119
|
+
}, {
|
|
9120
|
+
label: "MA20",
|
|
9121
|
+
color: ja.MA20,
|
|
9122
|
+
value: Ps(a, o, 20)
|
|
9123
|
+
}, {
|
|
9124
|
+
label: "MA30",
|
|
9125
|
+
color: ja.MA30,
|
|
9126
|
+
value: Ps(a, o, 30)
|
|
9127
|
+
}, {
|
|
9128
|
+
label: "MA60",
|
|
9129
|
+
color: ja.MA60,
|
|
9130
|
+
value: Ps(a, o, 60)
|
|
9131
|
+
}), r.length > 0) {
|
|
9132
|
+
let i = 12, a = t.yPaddingPx / 2 + 12 + e * 18;
|
|
9133
|
+
n.fillStyle = X.NEUTRAL, n.fillText("均线", i, a), i += n.measureText("均线").width + 10;
|
|
9134
|
+
for (let e of r) {
|
|
9135
|
+
let t = typeof e.value == "number" ? ` ${e.value.toFixed(2)}` : "", r = `${e.label}${t}`;
|
|
9136
|
+
n.fillStyle = e.color, n.fillText(r, i, a), i += n.measureText(r).width + 10;
|
|
9137
|
+
}
|
|
9138
|
+
}
|
|
9139
|
+
} });
|
|
9140
|
+
let l = t.indicators.BOLL;
|
|
9141
|
+
l?.enabled && s.push({ draw: (e) => {
|
|
9142
|
+
let r = l.params.period ?? 20, i = l.params.multiplier ?? 2, s = Ds(a, o, r, i), c = 12, u = t.yPaddingPx / 2 + 12 + e * 18;
|
|
9143
|
+
n.fillStyle = X.NEUTRAL, n.fillText(`BOLL(${r},${i})`, c, u), c += n.measureText(`BOLL(${r},${i})`).width + 10, s && (n.fillStyle = Ma.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, u), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Ma.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, u), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Ma.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, u));
|
|
9144
|
+
} });
|
|
9145
|
+
let u = t.indicators.EXPMA;
|
|
9146
|
+
u?.enabled && s.push({ draw: (e) => {
|
|
9147
|
+
let r = u.params.fastPeriod ?? 12, i = u.params.slowPeriod ?? 50, s = ks(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
|
|
9148
|
+
n.fillStyle = X.NEUTRAL, n.fillText(`EXPMA(${r},${i})`, c, l), c += n.measureText(`EXPMA(${r},${i})`).width + 10, s && (n.fillStyle = Ba.FAST, n.fillText(`快:${s.fast.toFixed(2)}`, c, l), c += n.measureText(`快:${s.fast.toFixed(2)}`).width + 10, n.fillStyle = Ba.SLOW, n.fillText(`慢:${s.slow.toFixed(2)}`, c, l));
|
|
9149
|
+
} });
|
|
9150
|
+
let d = t.indicators.ENE;
|
|
9151
|
+
d?.enabled && s.push({ draw: (e) => {
|
|
9152
|
+
let r = d.params.period ?? 10, i = d.params.deviation ?? 11, s = Ms(a, o, r, i), c = 12, l = t.yPaddingPx / 2 + 12 + e * 18;
|
|
9153
|
+
n.fillStyle = X.NEUTRAL, n.fillText(`ENE(${r},${i})`, c, l), c += n.measureText(`ENE(${r},${i})`).width + 10, s && (n.fillStyle = Va.UPPER, n.fillText(`上轨:${s.upper.toFixed(2)}`, c, l), c += n.measureText(`上轨:${s.upper.toFixed(2)}`).width + 10, n.fillStyle = Va.MIDDLE, n.fillText(`中轨:${s.middle.toFixed(2)}`, c, l), c += n.measureText(`中轨:${s.middle.toFixed(2)}`).width + 10, n.fillStyle = Va.LOWER, n.fillText(`下轨:${s.lower.toFixed(2)}`, c, l));
|
|
9154
|
+
} }), s.forEach((e, t) => e.draw(t)), n.restore();
|
|
9155
|
+
},
|
|
9156
|
+
getConfig() {
|
|
9157
|
+
return {
|
|
9158
|
+
yPaddingPx: t.yPaddingPx,
|
|
9159
|
+
indicators: { ...t.indicators }
|
|
9160
|
+
};
|
|
9161
|
+
},
|
|
9162
|
+
setConfig(e) {
|
|
9163
|
+
if (typeof e.yPaddingPx == "number" && (t.yPaddingPx = e.yPaddingPx), e.indicators && typeof e.indicators == "object") for (let [n, r] of Object.entries(e.indicators)) t.indicators[n] || (t.indicators[n] = {
|
|
9164
|
+
enabled: !1,
|
|
9165
|
+
params: {}
|
|
9166
|
+
}), r.enabled !== void 0 && (t.indicators[n].enabled = r.enabled), r.params && (t.indicators[n].params = r.params);
|
|
8878
9167
|
}
|
|
8879
9168
|
};
|
|
8880
9169
|
}
|
|
8881
9170
|
//#endregion
|
|
8882
9171
|
//#region src/core/renderers/Indicator/macd.ts
|
|
8883
|
-
function
|
|
9172
|
+
function Is(e, t) {
|
|
8884
9173
|
let n = Array(e.length), r = 2 / (t + 1);
|
|
8885
9174
|
if (e.length === 0) return n;
|
|
8886
9175
|
n[0] = e[0].close;
|
|
@@ -8890,7 +9179,7 @@ function As(e, t) {
|
|
|
8890
9179
|
}
|
|
8891
9180
|
return n;
|
|
8892
9181
|
}
|
|
8893
|
-
function
|
|
9182
|
+
function Ls(e, t) {
|
|
8894
9183
|
let n = Array(e.length), r = 2 / (t + 1), i = e.findIndex((e) => e !== void 0);
|
|
8895
9184
|
if (i === -1) return n;
|
|
8896
9185
|
n[i] = e[i];
|
|
@@ -8900,15 +9189,15 @@ function js(e, t) {
|
|
|
8900
9189
|
}
|
|
8901
9190
|
return n;
|
|
8902
9191
|
}
|
|
8903
|
-
function
|
|
9192
|
+
function Rs(e, t, n, r) {
|
|
8904
9193
|
let i = Array(e.length);
|
|
8905
9194
|
if (e.length < n) return i;
|
|
8906
|
-
let a =
|
|
9195
|
+
let a = Is(e, t), o = Is(e, n), s = Array(e.length);
|
|
8907
9196
|
for (let t = 0; t < e.length; t++) {
|
|
8908
9197
|
let e = a[t], n = o[t];
|
|
8909
9198
|
e !== void 0 && n !== void 0 && (s[t] = e - n);
|
|
8910
9199
|
}
|
|
8911
|
-
let c =
|
|
9200
|
+
let c = Ls(s, r);
|
|
8912
9201
|
for (let t = 0; t < e.length; t++) {
|
|
8913
9202
|
let e = s[t], n = c[t];
|
|
8914
9203
|
e !== void 0 && n !== void 0 && (i[t] = {
|
|
@@ -8919,7 +9208,7 @@ function Ms(e, t, n, r) {
|
|
|
8919
9208
|
}
|
|
8920
9209
|
return i;
|
|
8921
9210
|
}
|
|
8922
|
-
function
|
|
9211
|
+
function zs(e = {}) {
|
|
8923
9212
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
8924
9213
|
fastPeriod: 12,
|
|
8925
9214
|
slowPeriod: 26,
|
|
@@ -8930,7 +9219,7 @@ function Ns(e = {}) {
|
|
|
8930
9219
|
...n
|
|
8931
9220
|
}, i = null, a = 0, o = 0, s = 0, c = [];
|
|
8932
9221
|
function l(e) {
|
|
8933
|
-
return (i !== e || a !== r.fastPeriod || o !== r.slowPeriod || s !== r.signalPeriod) && (c =
|
|
9222
|
+
return (i !== e || a !== r.fastPeriod || o !== r.slowPeriod || s !== r.signalPeriod) && (c = Rs(e, r.fastPeriod, r.slowPeriod, r.signalPeriod), i = e, a = r.fastPeriod, o = r.slowPeriod, s = r.signalPeriod), c;
|
|
8934
9223
|
}
|
|
8935
9224
|
return {
|
|
8936
9225
|
name: `macd_${t}`,
|
|
@@ -9003,11 +9292,11 @@ function Ns(e = {}) {
|
|
|
9003
9292
|
}
|
|
9004
9293
|
};
|
|
9005
9294
|
}
|
|
9006
|
-
function
|
|
9007
|
-
return t < r || t >= e.length ? null :
|
|
9295
|
+
function Bs(e, t, n = 12, r = 26, i = 9) {
|
|
9296
|
+
return t < r || t >= e.length ? null : Rs(e, n, r, i)[t] ?? null;
|
|
9008
9297
|
}
|
|
9009
|
-
function
|
|
9010
|
-
let a =
|
|
9298
|
+
function Vs(e, t, n = 12, r = 26, i = 9) {
|
|
9299
|
+
let a = Bs(e, t, n, r, i);
|
|
9011
9300
|
return a ? {
|
|
9012
9301
|
name: "MACD",
|
|
9013
9302
|
params: [
|
|
@@ -9036,7 +9325,7 @@ function Fs(e, t, n = 12, r = 26, i = 9) {
|
|
|
9036
9325
|
}
|
|
9037
9326
|
//#endregion
|
|
9038
9327
|
//#region src/core/renderers/Indicator/rsi.ts
|
|
9039
|
-
function
|
|
9328
|
+
function Hs(e, t) {
|
|
9040
9329
|
let n = Array(e.length);
|
|
9041
9330
|
if (e.length < t + 1) return n;
|
|
9042
9331
|
let r = [];
|
|
@@ -9058,7 +9347,7 @@ function Is(e, t) {
|
|
|
9058
9347
|
}
|
|
9059
9348
|
return n;
|
|
9060
9349
|
}
|
|
9061
|
-
function
|
|
9350
|
+
function Us(e = {}) {
|
|
9062
9351
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9063
9352
|
period1: 6,
|
|
9064
9353
|
period2: 12,
|
|
@@ -9069,7 +9358,7 @@ function Ls(e = {}) {
|
|
|
9069
9358
|
...n
|
|
9070
9359
|
}, i = null, a = 0, o = 0, s = 0, c = [], l = [], u = [];
|
|
9071
9360
|
function d(e) {
|
|
9072
|
-
return (i !== e || a !== r.period1 || o !== r.period2 || s !== r.period3) && (c =
|
|
9361
|
+
return (i !== e || a !== r.period1 || o !== r.period2 || s !== r.period3) && (c = Hs(e, r.period1), l = Hs(e, r.period2), u = Hs(e, r.period3), i = e, a = r.period1, o = r.period2, s = r.period3), {
|
|
9073
9362
|
rsi1: c,
|
|
9074
9363
|
rsi2: l,
|
|
9075
9364
|
rsi3: u
|
|
@@ -9115,9 +9404,9 @@ function Ls(e = {}) {
|
|
|
9115
9404
|
}
|
|
9116
9405
|
};
|
|
9117
9406
|
}
|
|
9118
|
-
function
|
|
9407
|
+
function Ws(e, t, n = 6, r = 12, i = 24) {
|
|
9119
9408
|
if (t < n + 1 || t >= e.length) return null;
|
|
9120
|
-
let a =
|
|
9409
|
+
let a = Hs(e, n)[t], o = Hs(e, r)[t], s = Hs(e, i)[t], c = [];
|
|
9121
9410
|
return a !== void 0 && c.push({
|
|
9122
9411
|
label: `RSI${n}`,
|
|
9123
9412
|
value: a,
|
|
@@ -9142,7 +9431,7 @@ function Rs(e, t, n = 6, r = 12, i = 24) {
|
|
|
9142
9431
|
}
|
|
9143
9432
|
//#endregion
|
|
9144
9433
|
//#region src/core/renderers/Indicator/cci.ts
|
|
9145
|
-
function
|
|
9434
|
+
function Gs(e, t) {
|
|
9146
9435
|
let n = Array(e.length);
|
|
9147
9436
|
if (e.length < t) return n;
|
|
9148
9437
|
let r = e.map((e) => (e.high + e.low + e.close) / 3);
|
|
@@ -9156,14 +9445,14 @@ function zs(e, t) {
|
|
|
9156
9445
|
}
|
|
9157
9446
|
return n;
|
|
9158
9447
|
}
|
|
9159
|
-
function
|
|
9448
|
+
function Ks(e = {}) {
|
|
9160
9449
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9161
9450
|
period: 14,
|
|
9162
9451
|
showCCI: !0,
|
|
9163
9452
|
...n
|
|
9164
9453
|
}, i = null, a = 0, o = [];
|
|
9165
9454
|
function s(e) {
|
|
9166
|
-
return (i !== e || a !== r.period) && (o =
|
|
9455
|
+
return (i !== e || a !== r.period) && (o = Gs(e, r.period), i = e, a = r.period), o;
|
|
9167
9456
|
}
|
|
9168
9457
|
return {
|
|
9169
9458
|
name: `cci_${t}`,
|
|
@@ -9213,12 +9502,12 @@ function Bs(e = {}) {
|
|
|
9213
9502
|
}
|
|
9214
9503
|
};
|
|
9215
9504
|
}
|
|
9216
|
-
function
|
|
9217
|
-
return
|
|
9505
|
+
function qs(e, t, n) {
|
|
9506
|
+
return Gs(e, n)[t];
|
|
9218
9507
|
}
|
|
9219
|
-
function
|
|
9508
|
+
function Js(e, t, n = 14) {
|
|
9220
9509
|
if (t < n || t >= e.length) return null;
|
|
9221
|
-
let r =
|
|
9510
|
+
let r = qs(e, t, n);
|
|
9222
9511
|
return r === void 0 ? null : {
|
|
9223
9512
|
name: "CCI",
|
|
9224
9513
|
params: [n],
|
|
@@ -9231,7 +9520,7 @@ function Hs(e, t, n = 14) {
|
|
|
9231
9520
|
}
|
|
9232
9521
|
//#endregion
|
|
9233
9522
|
//#region src/core/renderers/Indicator/stoch.ts
|
|
9234
|
-
function
|
|
9523
|
+
function Ys(e, t, n) {
|
|
9235
9524
|
let r = Array(e.length);
|
|
9236
9525
|
if (e.length < t) return r;
|
|
9237
9526
|
let i = Array(e.length);
|
|
@@ -9259,7 +9548,7 @@ function Us(e, t, n) {
|
|
|
9259
9548
|
}
|
|
9260
9549
|
return r;
|
|
9261
9550
|
}
|
|
9262
|
-
function
|
|
9551
|
+
function Xs(e = {}) {
|
|
9263
9552
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9264
9553
|
n: 9,
|
|
9265
9554
|
m: 3,
|
|
@@ -9268,7 +9557,7 @@ function Ws(e = {}) {
|
|
|
9268
9557
|
...n
|
|
9269
9558
|
}, i = null, a = 0, o = 0, s = [];
|
|
9270
9559
|
function c(e) {
|
|
9271
|
-
return (i !== e || a !== r.n || o !== r.m) && (s =
|
|
9560
|
+
return (i !== e || a !== r.n || o !== r.m) && (s = Ys(e, r.n, r.m), i = e, a = r.n, o = r.m), s;
|
|
9272
9561
|
}
|
|
9273
9562
|
return {
|
|
9274
9563
|
name: `stoch_${t}`,
|
|
@@ -9324,12 +9613,12 @@ function Ws(e = {}) {
|
|
|
9324
9613
|
}
|
|
9325
9614
|
};
|
|
9326
9615
|
}
|
|
9327
|
-
function
|
|
9328
|
-
return
|
|
9616
|
+
function Zs(e, t, n, r) {
|
|
9617
|
+
return Ys(e, n, r)[t];
|
|
9329
9618
|
}
|
|
9330
|
-
function
|
|
9619
|
+
function Qs(e, t, n = 9, r = 3) {
|
|
9331
9620
|
if (t < n + r - 1 || t >= e.length) return null;
|
|
9332
|
-
let i =
|
|
9621
|
+
let i = Zs(e, t, n, r);
|
|
9333
9622
|
return i ? {
|
|
9334
9623
|
name: "STOCH",
|
|
9335
9624
|
params: [n, r],
|
|
@@ -9346,7 +9635,7 @@ function Ks(e, t, n = 9, r = 3) {
|
|
|
9346
9635
|
}
|
|
9347
9636
|
//#endregion
|
|
9348
9637
|
//#region src/core/renderers/Indicator/mom.ts
|
|
9349
|
-
function
|
|
9638
|
+
function $s(e, t) {
|
|
9350
9639
|
let n = Array(e.length);
|
|
9351
9640
|
if (e.length < t + 1) return n;
|
|
9352
9641
|
for (let r = t; r < e.length; r++) {
|
|
@@ -9355,14 +9644,14 @@ function qs(e, t) {
|
|
|
9355
9644
|
}
|
|
9356
9645
|
return n;
|
|
9357
9646
|
}
|
|
9358
|
-
function
|
|
9647
|
+
function ec(e = {}) {
|
|
9359
9648
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9360
9649
|
period: 10,
|
|
9361
9650
|
showMOM: !0,
|
|
9362
9651
|
...n
|
|
9363
9652
|
}, i = null, a = 0, o = [];
|
|
9364
9653
|
function s(e) {
|
|
9365
|
-
return (i !== e || a !== r.period) && (o =
|
|
9654
|
+
return (i !== e || a !== r.period) && (o = $s(e, r.period), i = e, a = r.period), o;
|
|
9366
9655
|
}
|
|
9367
9656
|
return {
|
|
9368
9657
|
name: `mom_${t}`,
|
|
@@ -9413,12 +9702,12 @@ function Js(e = {}) {
|
|
|
9413
9702
|
}
|
|
9414
9703
|
};
|
|
9415
9704
|
}
|
|
9416
|
-
function
|
|
9417
|
-
return
|
|
9705
|
+
function tc(e, t, n) {
|
|
9706
|
+
return $s(e, n)[t];
|
|
9418
9707
|
}
|
|
9419
|
-
function
|
|
9708
|
+
function nc(e, t, n = 10) {
|
|
9420
9709
|
if (t < n || t >= e.length) return null;
|
|
9421
|
-
let r =
|
|
9710
|
+
let r = tc(e, t, n);
|
|
9422
9711
|
return r === void 0 ? null : {
|
|
9423
9712
|
name: "MOM",
|
|
9424
9713
|
params: [n],
|
|
@@ -9431,7 +9720,7 @@ function Xs(e, t, n = 10) {
|
|
|
9431
9720
|
}
|
|
9432
9721
|
//#endregion
|
|
9433
9722
|
//#region src/core/renderers/Indicator/wmsr.ts
|
|
9434
|
-
function
|
|
9723
|
+
function rc(e, t) {
|
|
9435
9724
|
let n = Array(e.length);
|
|
9436
9725
|
if (e.length < t) return n;
|
|
9437
9726
|
for (let r = t - 1; r < e.length; r++) {
|
|
@@ -9445,14 +9734,14 @@ function Zs(e, t) {
|
|
|
9445
9734
|
}
|
|
9446
9735
|
return n;
|
|
9447
9736
|
}
|
|
9448
|
-
function
|
|
9737
|
+
function ic(e = {}) {
|
|
9449
9738
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9450
9739
|
period: 14,
|
|
9451
9740
|
showWMSR: !0,
|
|
9452
9741
|
...n
|
|
9453
9742
|
}, i = null, a = 0, o = [];
|
|
9454
9743
|
function s(e) {
|
|
9455
|
-
return (i !== e || a !== r.period) && (o =
|
|
9744
|
+
return (i !== e || a !== r.period) && (o = rc(e, r.period), i = e, a = r.period), o;
|
|
9456
9745
|
}
|
|
9457
9746
|
return {
|
|
9458
9747
|
name: `wmsr_${t}`,
|
|
@@ -9495,12 +9784,12 @@ function Qs(e = {}) {
|
|
|
9495
9784
|
}
|
|
9496
9785
|
};
|
|
9497
9786
|
}
|
|
9498
|
-
function
|
|
9499
|
-
return
|
|
9787
|
+
function ac(e, t, n) {
|
|
9788
|
+
return rc(e, n)[t];
|
|
9500
9789
|
}
|
|
9501
|
-
function
|
|
9790
|
+
function oc(e, t, n = 14) {
|
|
9502
9791
|
if (t < n || t >= e.length) return null;
|
|
9503
|
-
let r =
|
|
9792
|
+
let r = ac(e, t, n);
|
|
9504
9793
|
return r === void 0 ? null : {
|
|
9505
9794
|
name: "WMSR",
|
|
9506
9795
|
params: [n],
|
|
@@ -9513,7 +9802,7 @@ function ec(e, t, n = 14) {
|
|
|
9513
9802
|
}
|
|
9514
9803
|
//#endregion
|
|
9515
9804
|
//#region src/core/renderers/Indicator/kst.ts
|
|
9516
|
-
function
|
|
9805
|
+
function sc(e, t) {
|
|
9517
9806
|
let n = Array(e.length);
|
|
9518
9807
|
if (e.length < t + 1) return n;
|
|
9519
9808
|
for (let r = t; r < e.length; r++) {
|
|
@@ -9522,7 +9811,7 @@ function tc(e, t) {
|
|
|
9522
9811
|
}
|
|
9523
9812
|
return n;
|
|
9524
9813
|
}
|
|
9525
|
-
function
|
|
9814
|
+
function cc(e, t) {
|
|
9526
9815
|
let n = Array(e.length), r = 0, i = 0;
|
|
9527
9816
|
for (let a = 0; a < e.length; a++) {
|
|
9528
9817
|
let o = e[a];
|
|
@@ -9536,13 +9825,13 @@ function nc(e, t) {
|
|
|
9536
9825
|
}
|
|
9537
9826
|
return n;
|
|
9538
9827
|
}
|
|
9539
|
-
function
|
|
9540
|
-
let o = Array(e.length), s =
|
|
9828
|
+
function lc(e, t, n, r, i, a) {
|
|
9829
|
+
let o = Array(e.length), s = sc(e, t), c = sc(e, n), l = sc(e, r), u = sc(e, i), d = cc(s, 10), f = cc(c, 10), p = cc(l, 10), m = cc(u, 15), h = Array(e.length);
|
|
9541
9830
|
for (let t = 0; t < e.length; t++) {
|
|
9542
9831
|
let e = d[t], n = f[t], r = p[t], i = m[t];
|
|
9543
9832
|
e !== void 0 && n !== void 0 && r !== void 0 && i !== void 0 && (h[t] = e * 1 + n * 2 + r * 3 + i * 4);
|
|
9544
9833
|
}
|
|
9545
|
-
let g =
|
|
9834
|
+
let g = cc(h, a);
|
|
9546
9835
|
for (let t = 0; t < e.length; t++) {
|
|
9547
9836
|
let e = h[t], n = g[t];
|
|
9548
9837
|
e !== void 0 && n !== void 0 && (o[t] = {
|
|
@@ -9552,7 +9841,7 @@ function rc(e, t, n, r, i, a) {
|
|
|
9552
9841
|
}
|
|
9553
9842
|
return o;
|
|
9554
9843
|
}
|
|
9555
|
-
function
|
|
9844
|
+
function uc(e = {}) {
|
|
9556
9845
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9557
9846
|
roc1: 10,
|
|
9558
9847
|
roc2: 15,
|
|
@@ -9565,7 +9854,7 @@ function ic(e = {}) {
|
|
|
9565
9854
|
}, i = null, a = "", o = [];
|
|
9566
9855
|
function s(e) {
|
|
9567
9856
|
let t = `${r.roc1}-${r.roc2}-${r.roc3}-${r.roc4}-${r.signalPeriod}`;
|
|
9568
|
-
return (i !== e || a !== t) && (o =
|
|
9857
|
+
return (i !== e || a !== t) && (o = lc(e, r.roc1, r.roc2, r.roc3, r.roc4, r.signalPeriod), i = e, a = t), o;
|
|
9569
9858
|
}
|
|
9570
9859
|
return {
|
|
9571
9860
|
name: `kst_${t}`,
|
|
@@ -9629,12 +9918,12 @@ function ic(e = {}) {
|
|
|
9629
9918
|
}
|
|
9630
9919
|
};
|
|
9631
9920
|
}
|
|
9632
|
-
function
|
|
9633
|
-
return
|
|
9921
|
+
function dc(e, t, n, r, i, a, o) {
|
|
9922
|
+
return lc(e, n, r, i, a, o)[t];
|
|
9634
9923
|
}
|
|
9635
|
-
function
|
|
9924
|
+
function fc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
|
|
9636
9925
|
if (t < a + 15 + o || t >= e.length) return null;
|
|
9637
|
-
let s =
|
|
9926
|
+
let s = dc(e, t, n, r, i, a, o);
|
|
9638
9927
|
return s ? {
|
|
9639
9928
|
name: "KST",
|
|
9640
9929
|
params: [
|
|
@@ -9657,7 +9946,7 @@ function oc(e, t, n = 10, r = 15, i = 20, a = 30, o = 9) {
|
|
|
9657
9946
|
}
|
|
9658
9947
|
//#endregion
|
|
9659
9948
|
//#region src/core/renderers/Indicator/fastk.ts
|
|
9660
|
-
function
|
|
9949
|
+
function pc(e, t) {
|
|
9661
9950
|
let n = Array(e.length);
|
|
9662
9951
|
if (e.length < t) return n;
|
|
9663
9952
|
for (let r = t - 1; r < e.length; r++) {
|
|
@@ -9671,14 +9960,14 @@ function sc(e, t) {
|
|
|
9671
9960
|
}
|
|
9672
9961
|
return n;
|
|
9673
9962
|
}
|
|
9674
|
-
function
|
|
9963
|
+
function mc(e = {}) {
|
|
9675
9964
|
let { paneId: t = "sub", config: n = {} } = e, r = {
|
|
9676
9965
|
period: 9,
|
|
9677
9966
|
showFASTK: !0,
|
|
9678
9967
|
...n
|
|
9679
9968
|
}, i = null, a = 0, o = [];
|
|
9680
9969
|
function s(e) {
|
|
9681
|
-
return (i !== e || a !== r.period) && (o =
|
|
9970
|
+
return (i !== e || a !== r.period) && (o = pc(e, r.period), i = e, a = r.period), o;
|
|
9682
9971
|
}
|
|
9683
9972
|
return {
|
|
9684
9973
|
name: `fastk_${t}`,
|
|
@@ -9721,12 +10010,12 @@ function cc(e = {}) {
|
|
|
9721
10010
|
}
|
|
9722
10011
|
};
|
|
9723
10012
|
}
|
|
9724
|
-
function
|
|
9725
|
-
return
|
|
10013
|
+
function hc(e, t, n) {
|
|
10014
|
+
return pc(e, n)[t];
|
|
9726
10015
|
}
|
|
9727
|
-
function
|
|
10016
|
+
function gc(e, t, n = 9) {
|
|
9728
10017
|
if (t < n || t >= e.length) return null;
|
|
9729
|
-
let r =
|
|
10018
|
+
let r = hc(e, t, n);
|
|
9730
10019
|
return r === void 0 ? null : {
|
|
9731
10020
|
name: "FASTK",
|
|
9732
10021
|
params: [n],
|
|
@@ -9739,24 +10028,24 @@ function uc(e, t, n = 9) {
|
|
|
9739
10028
|
}
|
|
9740
10029
|
//#endregion
|
|
9741
10030
|
//#region src/core/renderers/Indicator/index.ts
|
|
9742
|
-
function
|
|
10031
|
+
function _c(e) {
|
|
9743
10032
|
let { indicatorId: t, paneId: n } = e;
|
|
9744
10033
|
switch (t) {
|
|
9745
|
-
case "VOLUME": return
|
|
9746
|
-
case "MACD": return
|
|
9747
|
-
case "RSI": return
|
|
9748
|
-
case "CCI": return
|
|
9749
|
-
case "STOCH": return
|
|
9750
|
-
case "MOM": return
|
|
9751
|
-
case "WMSR": return
|
|
9752
|
-
case "KST": return
|
|
9753
|
-
case "FASTK": return
|
|
10034
|
+
case "VOLUME": return gs({ paneId: n });
|
|
10035
|
+
case "MACD": return zs({ paneId: n });
|
|
10036
|
+
case "RSI": return Us({ paneId: n });
|
|
10037
|
+
case "CCI": return Ks({ paneId: n });
|
|
10038
|
+
case "STOCH": return Xs({ paneId: n });
|
|
10039
|
+
case "MOM": return ec({ paneId: n });
|
|
10040
|
+
case "WMSR": return ic({ paneId: n });
|
|
10041
|
+
case "KST": return uc({ paneId: n });
|
|
10042
|
+
case "FASTK": return mc({ paneId: n });
|
|
9754
10043
|
default: throw Error(`Unknown indicator: ${t}`);
|
|
9755
10044
|
}
|
|
9756
10045
|
}
|
|
9757
10046
|
//#endregion
|
|
9758
10047
|
//#region src/core/chart.ts
|
|
9759
|
-
var
|
|
10048
|
+
var vc = class e {
|
|
9760
10049
|
dom;
|
|
9761
10050
|
opt;
|
|
9762
10051
|
data = [];
|
|
@@ -9768,7 +10057,7 @@ var fc = class e {
|
|
|
9768
10057
|
pluginHost;
|
|
9769
10058
|
rendererPluginManager;
|
|
9770
10059
|
constructor(e, t) {
|
|
9771
|
-
this.dom = e, this.opt = t, this.interaction = new
|
|
10060
|
+
this.dom = e, this.opt = t, this.interaction = new ms(this), this.markerManager = new vo(), this.pluginHost = da(), this.rendererPluginManager = new pa(), this.rendererPluginManager.setPluginHost(this.pluginHost), this.rendererPluginManager.setInvalidateCallback(() => this.scheduleDraw()), this.initPanes();
|
|
9772
10061
|
}
|
|
9773
10062
|
get plugin() {
|
|
9774
10063
|
return this.pluginHost;
|
|
@@ -9802,10 +10091,10 @@ var fc = class e {
|
|
|
9802
10091
|
console.log("[Chart] draw aborted: no data");
|
|
9803
10092
|
return;
|
|
9804
10093
|
}
|
|
9805
|
-
let { start: t, end: n } =
|
|
10094
|
+
let { start: t, end: n } = us(e.scrollLeft, e.plotWidth, this.opt.kWidth, this.opt.kGap, this.data.length, e.dpr), r = {
|
|
9806
10095
|
start: t,
|
|
9807
10096
|
end: n
|
|
9808
|
-
}, i = this.calcKLinePositions(r), { kWidthPx: a } =
|
|
10097
|
+
}, i = this.calcKLinePositions(r), { kWidthPx: a } = ls(this.opt.kWidth, this.opt.kGap, e.dpr);
|
|
9809
10098
|
this.interaction.setKLinePositions(i, r, a);
|
|
9810
10099
|
for (let t of this.paneRenderers) {
|
|
9811
10100
|
let n = t.getPane(), a = t.getDom().plotCanvas.getContext("2d"), o = t.getDom().yAxisCanvas.getContext("2d");
|
|
@@ -9920,7 +10209,7 @@ var fc = class e {
|
|
|
9920
10209
|
calcKLinePositions(e) {
|
|
9921
10210
|
let { start: t, end: n } = e, r = n - t;
|
|
9922
10211
|
if (r <= 0) return [];
|
|
9923
|
-
let i = this.viewport?.dpr || window.devicePixelRatio || 1, { unitPx: a, startXPx: o } =
|
|
10212
|
+
let i = this.viewport?.dpr || window.devicePixelRatio || 1, { unitPx: a, startXPx: o } = ls(this.opt.kWidth, this.opt.kGap, i), s = Array(r);
|
|
9924
10213
|
for (let e = 0; e < r; e++) s[e] = (o + (t + e) * a) / i;
|
|
9925
10214
|
return s;
|
|
9926
10215
|
}
|
|
@@ -9938,9 +10227,9 @@ var fc = class e {
|
|
|
9938
10227
|
console.warn(`Pane "${e}" already exists`);
|
|
9939
10228
|
return;
|
|
9940
10229
|
}
|
|
9941
|
-
let t = new
|
|
10230
|
+
let t = new ps(e), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e === "main";
|
|
9942
10231
|
n.id = `${e}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0";
|
|
9943
|
-
let a = new
|
|
10232
|
+
let a = new hs({
|
|
9944
10233
|
plotCanvas: n,
|
|
9945
10234
|
yAxisCanvas: r
|
|
9946
10235
|
}, t, {
|
|
@@ -9971,7 +10260,7 @@ var fc = class e {
|
|
|
9971
10260
|
return n && this.updateRendererConfig(e, n), !0;
|
|
9972
10261
|
}
|
|
9973
10262
|
this.addPane(r);
|
|
9974
|
-
let i =
|
|
10263
|
+
let i = _c({
|
|
9975
10264
|
indicatorId: t,
|
|
9976
10265
|
paneId: r
|
|
9977
10266
|
});
|
|
@@ -9993,6 +10282,12 @@ var fc = class e {
|
|
|
9993
10282
|
getSubPaneIndicators() {
|
|
9994
10283
|
return this.paneRenderers.map((e) => e.getPane().id).filter((t) => t.startsWith(e.SUB_PANE_PREFIX)).map((t) => t.slice(e.SUB_PANE_PREFIX.length));
|
|
9995
10284
|
}
|
|
10285
|
+
translatePrice(e, t) {
|
|
10286
|
+
let n = this.paneRenderers.find((t) => t.getPane().id === e);
|
|
10287
|
+
if (!n) return;
|
|
10288
|
+
let r = n.getPane(), i = r.yAxis.deltaYToPriceOffset(t), a = r.yAxis.getPriceOffset();
|
|
10289
|
+
r.yAxis.setPriceOffset(a + i), this.scheduleDraw();
|
|
10290
|
+
}
|
|
9996
10291
|
updateData(e) {
|
|
9997
10292
|
console.log("[Chart] updateData called, data length:", e?.length), this.data = e ?? [];
|
|
9998
10293
|
let t = this.dom.container;
|
|
@@ -10009,7 +10304,7 @@ var fc = class e {
|
|
|
10009
10304
|
return this.data;
|
|
10010
10305
|
}
|
|
10011
10306
|
getContentWidth() {
|
|
10012
|
-
let e = this.data?.length ?? 0, t = this.viewport?.dpr || window.devicePixelRatio || 1, { startXPx: n, unitPx: r } =
|
|
10307
|
+
let e = this.data?.length ?? 0, t = this.viewport?.dpr || window.devicePixelRatio || 1, { startXPx: n, unitPx: r } = ls(this.opt.kWidth, this.opt.kGap, t);
|
|
10013
10308
|
return (n + e * r) / t + (this.opt.rightAxisWidth + (this.opt.priceLabelWidth || 60));
|
|
10014
10309
|
}
|
|
10015
10310
|
resize() {
|
|
@@ -10026,8 +10321,8 @@ var fc = class e {
|
|
|
10026
10321
|
}
|
|
10027
10322
|
initPanes() {
|
|
10028
10323
|
this.paneRenderers = this.opt.panes.map((e) => {
|
|
10029
|
-
let t = new
|
|
10030
|
-
return n.id = `${e.id}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e.id}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0", new
|
|
10324
|
+
let t = new ps(e.id), n = document.createElement("canvas"), r = document.createElement("canvas"), i = e.id === "main";
|
|
10325
|
+
return n.id = `${e.id}-plot`, n.className = i ? "plot-canvas main" : "plot-canvas sub", n.style.position = "absolute", n.style.left = "0", n.style.top = "0", r.id = `${e.id}-yAxis`, r.className = "right-axis", r.style.position = "absolute", r.style.right = "0", new hs({
|
|
10031
10326
|
plotCanvas: n,
|
|
10032
10327
|
yAxisCanvas: r
|
|
10033
10328
|
}, t, {
|
|
@@ -10076,18 +10371,18 @@ var fc = class e {
|
|
|
10076
10371
|
};
|
|
10077
10372
|
//#endregion
|
|
10078
10373
|
//#region src/types/kLine.ts
|
|
10079
|
-
function
|
|
10374
|
+
function yc(e) {
|
|
10080
10375
|
return e.open > e.close ? "down" : e.open < e.close ? "up" : "flat";
|
|
10081
10376
|
}
|
|
10082
10377
|
//#endregion
|
|
10083
10378
|
//#region src/types/volumePrice.ts
|
|
10084
10379
|
var $ = /* @__PURE__ */ function(e) {
|
|
10085
10380
|
return e.RISE_WITH_VOLUME = "rise_with_volume", e.RISE_WITHOUT_VOLUME = "rise_without_volume", e.FALL_WITH_VOLUME = "fall_with_volume", e.FALL_WITHOUT_VOLUME = "fall_without_volume", e.OTHERS = "others", e;
|
|
10086
|
-
}({}),
|
|
10381
|
+
}({}), bc = {
|
|
10087
10382
|
volumeAmplifyThreshold: 1.5,
|
|
10088
10383
|
volumeShrinkThreshold: .8,
|
|
10089
10384
|
avgPeriod: 20
|
|
10090
|
-
},
|
|
10385
|
+
}, xc = class {
|
|
10091
10386
|
prefixSum = [];
|
|
10092
10387
|
dataLength = 0;
|
|
10093
10388
|
build(e) {
|
|
@@ -10112,8 +10407,8 @@ var $ = /* @__PURE__ */ function(e) {
|
|
|
10112
10407
|
return this.dataLength;
|
|
10113
10408
|
}
|
|
10114
10409
|
};
|
|
10115
|
-
function
|
|
10116
|
-
let i = new
|
|
10410
|
+
function Sc(e, t, n, r = bc) {
|
|
10411
|
+
let i = new xc();
|
|
10117
10412
|
i.build(e);
|
|
10118
10413
|
let a = [], { volumeAmplifyThreshold: o, volumeShrinkThreshold: s, avgPeriod: c } = r;
|
|
10119
10414
|
for (let r = t; r < n && r < e.length; r++) {
|
|
@@ -10134,7 +10429,7 @@ function gc(e, t, n, r = mc) {
|
|
|
10134
10429
|
}
|
|
10135
10430
|
//#endregion
|
|
10136
10431
|
//#region src/core/renderers/candle.ts
|
|
10137
|
-
function
|
|
10432
|
+
function Cc() {
|
|
10138
10433
|
return {
|
|
10139
10434
|
name: "candle",
|
|
10140
10435
|
version: "1.0.0",
|
|
@@ -10145,36 +10440,36 @@ function _c() {
|
|
|
10145
10440
|
draw(e) {
|
|
10146
10441
|
let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, kGap: s, dpr: c, kLinePositions: l, markerManager: u } = e, d = r;
|
|
10147
10442
|
if (!d.length) return;
|
|
10148
|
-
let { kWidthPx: f } =
|
|
10443
|
+
let { kWidthPx: f } = ls(o, s, c);
|
|
10149
10444
|
t.save(), t.translate(-a, 0);
|
|
10150
|
-
let p = l || [], m =
|
|
10445
|
+
let p = l || [], m = Sc(d, i.start, i.end, bc);
|
|
10151
10446
|
for (let e = i.start; e < i.end && e < d.length; e++) {
|
|
10152
10447
|
let r = d[e];
|
|
10153
10448
|
if (!r) continue;
|
|
10154
10449
|
let a = n.yAxis.priceToY(r.open), s = n.yAxis.priceToY(r.close), l = n.yAxis.priceToY(r.high), h = n.yAxis.priceToY(r.low), g = Math.min(a, s), _ = Math.max(Math.abs(a - s), 1), v = p[e - i.start];
|
|
10155
10450
|
if (!v) continue;
|
|
10156
|
-
let y =
|
|
10157
|
-
t.fillStyle =
|
|
10451
|
+
let y = Ss(Math.round(v * c), g, f, _, c);
|
|
10452
|
+
t.fillStyle = yc(r) === "up" ? X.UP : X.DOWN, t.fillRect(y.bodyRect.x, y.bodyRect.y, y.bodyRect.width, y.bodyRect.height);
|
|
10158
10453
|
let b = y.wickRect.width, x = y.wickRect.x, S = y.bodyRect.y, C = y.bodyRect.y + y.bodyRect.height, w = Math.max(r.open, r.close), T = Math.min(r.open, r.close);
|
|
10159
10454
|
if (r.high > w) {
|
|
10160
|
-
let e =
|
|
10455
|
+
let e = bs(x, l, S, c);
|
|
10161
10456
|
e && t.fillRect(e.x, e.y, b, e.height);
|
|
10162
10457
|
}
|
|
10163
10458
|
if (r.low < T) {
|
|
10164
|
-
let e =
|
|
10459
|
+
let e = bs(x, C, h, c);
|
|
10165
10460
|
e && t.fillRect(e.x, e.y, b, e.height);
|
|
10166
10461
|
}
|
|
10167
10462
|
let E = m[e - i.start];
|
|
10168
10463
|
if (E !== $.OTHERS && u) {
|
|
10169
10464
|
let n = E === $.RISE_WITH_VOLUME || E === $.RISE_WITHOUT_VOLUME ? l - 15 : h + 15;
|
|
10170
|
-
|
|
10465
|
+
wc(t, y.bodyRect.x + y.bodyRect.width / 2, n, E, e, o, 4, u);
|
|
10171
10466
|
}
|
|
10172
10467
|
}
|
|
10173
10468
|
t.restore();
|
|
10174
10469
|
}
|
|
10175
10470
|
};
|
|
10176
10471
|
}
|
|
10177
|
-
function
|
|
10472
|
+
function wc(e, t, n, r, i, a, o = 4, s) {
|
|
10178
10473
|
let c = Math.min(a, 20), l = c * Math.sqrt(3) / 2, u, d;
|
|
10179
10474
|
switch (r) {
|
|
10180
10475
|
case $.RISE_WITH_VOLUME:
|
|
@@ -10238,12 +10533,12 @@ function vc(e, t, n, r, i, a, o = 4, s) {
|
|
|
10238
10533
|
}
|
|
10239
10534
|
//#endregion
|
|
10240
10535
|
//#region src/core/utils/tickCount.ts
|
|
10241
|
-
function
|
|
10536
|
+
function Tc(e, t) {
|
|
10242
10537
|
return t ? Math.max(4, Math.min(8, Math.round(e / 80))) : 2;
|
|
10243
10538
|
}
|
|
10244
10539
|
//#endregion
|
|
10245
10540
|
//#region src/core/renderers/gridLines.ts
|
|
10246
|
-
function
|
|
10541
|
+
function Ec() {
|
|
10247
10542
|
return {
|
|
10248
10543
|
name: "gridLines",
|
|
10249
10544
|
version: "1.0.0",
|
|
@@ -10254,11 +10549,11 @@ function bc() {
|
|
|
10254
10549
|
draw(e) {
|
|
10255
10550
|
let { ctx: t, pane: n, data: r, range: i, scrollLeft: a, kWidth: o, dpr: s, kLinePositions: c } = e, l = r;
|
|
10256
10551
|
if (!l.length) return;
|
|
10257
|
-
let u =
|
|
10552
|
+
let u = Tc(n.height, n.id === "main");
|
|
10258
10553
|
t.save(), t.fillStyle = Aa.HORIZONTAL, t.translate(-a, 0);
|
|
10259
10554
|
let d = t.canvas.width / s, f = a, p = a + d, m = n.yAxis.getPaddingTop(), h = n.yAxis.getPaddingBottom(), g = m, _ = Math.max(m, n.height - h), v = Math.max(0, _ - g);
|
|
10260
10555
|
for (let e = 0; e < u; e++) {
|
|
10261
|
-
let n = u <= 1 ? 0 : e / (u - 1), r =
|
|
10556
|
+
let n = u <= 1 ? 0 : e / (u - 1), r = xs(f, p, Math.round(g + n * v), s);
|
|
10262
10557
|
r && t.fillRect(r.x, r.y, r.width, r.height);
|
|
10263
10558
|
}
|
|
10264
10559
|
let y = Ea(l);
|
|
@@ -10266,7 +10561,7 @@ function bc() {
|
|
|
10266
10561
|
if (e < i.start || e >= i.end || e >= l.length) continue;
|
|
10267
10562
|
let r = e - i.start;
|
|
10268
10563
|
if (r < 0 || r >= c.length) continue;
|
|
10269
|
-
let a =
|
|
10564
|
+
let a = bs(c[r] + o / 2, 0, n.height, s);
|
|
10270
10565
|
a && t.fillRect(a.x, a.y, a.width, a.height);
|
|
10271
10566
|
}
|
|
10272
10567
|
t.restore();
|
|
@@ -10275,7 +10570,7 @@ function bc() {
|
|
|
10275
10570
|
}
|
|
10276
10571
|
//#endregion
|
|
10277
10572
|
//#region src/core/renderers/lastPrice.ts
|
|
10278
|
-
function
|
|
10573
|
+
function Dc() {
|
|
10279
10574
|
return {
|
|
10280
10575
|
name: "lastPriceLine",
|
|
10281
10576
|
version: "1.0.0",
|
|
@@ -10296,7 +10591,7 @@ function xc() {
|
|
|
10296
10591
|
}
|
|
10297
10592
|
//#endregion
|
|
10298
10593
|
//#region src/core/renderers/extremaMarkers.ts
|
|
10299
|
-
function
|
|
10594
|
+
function Oc() {
|
|
10300
10595
|
return {
|
|
10301
10596
|
name: "extremaMarkers",
|
|
10302
10597
|
version: "1.0.0",
|
|
@@ -10319,28 +10614,34 @@ function Sc() {
|
|
|
10319
10614
|
let t = e - i.start;
|
|
10320
10615
|
return t < 0 || t >= l.length ? 0 : l[t] + o / 2;
|
|
10321
10616
|
};
|
|
10322
|
-
t.save(), t.translate(-a, 0),
|
|
10617
|
+
t.save(), t.translate(-a, 0), kc(t, _(h), n.yAxis.priceToY(p), p, s, c, a), kc(t, _(g), n.yAxis.priceToY(m), m, s, c, a), t.restore();
|
|
10323
10618
|
}
|
|
10324
10619
|
};
|
|
10325
10620
|
}
|
|
10326
|
-
function
|
|
10621
|
+
function kc(e, t, n, r, i, a, o) {
|
|
10327
10622
|
let s = r.toFixed(2);
|
|
10328
10623
|
e.font = "12px Arial";
|
|
10329
10624
|
let c = e.measureText(s).width, l = t - o + 30 + 4 + c > a, u = t, d = l ? t - 30 : t + 30;
|
|
10330
10625
|
u > d && ([u, d] = [d, u]);
|
|
10331
|
-
let f =
|
|
10626
|
+
let f = xs(u, d, n, i);
|
|
10332
10627
|
f && (e.fillStyle = Da.WEAK, e.fillRect(f.x, f.y, f.width, f.height));
|
|
10333
10628
|
let p = Z(d, i), m = Z(n, i);
|
|
10334
10629
|
e.fillStyle = Da.WEAK, e.beginPath(), e.arc(p, m, 2, 0, Math.PI * 2), e.fill(), e.font = "12px Arial", e.textBaseline = "middle", e.fillStyle = X.NEUTRAL, l ? (e.textAlign = "right", e.fillText(s, Z(t - 30 - 4, i), Z(n, i))) : (e.textAlign = "left", e.fillText(s, Z(t + 30 + 4, i), Z(n, i)));
|
|
10335
10630
|
}
|
|
10336
10631
|
//#endregion
|
|
10632
|
+
//#region src/utils/priceToY.ts
|
|
10633
|
+
function Ac(e, t, n, r, i, a) {
|
|
10634
|
+
let o = t - n || 1, s = (e - n) / o;
|
|
10635
|
+
return i + Math.max(1, r - i - a) * (1 - s);
|
|
10636
|
+
}
|
|
10637
|
+
//#endregion
|
|
10337
10638
|
//#region src/utils/kLineDraw/axis.ts
|
|
10338
|
-
function
|
|
10639
|
+
function jc(e, t) {
|
|
10339
10640
|
let { x: n, y: r, width: i, height: a, priceRange: o, yPaddingPx: s = 0, dpr: c, ticks: l = 10, bgColor: u = Oa.TRANSPARENT, textColor: d = Da.SECONDARY, lineColor: f = ka.DARK, fontSize: p = 16, paddingX: m = 12, drawLeftBorder: h = !0, drawTickLines: g = !0 } = t, _ = Math.max(0, Math.min(s, Math.floor(a / 2) - 1)), { maxPrice: v, minPrice: y } = o, b = v - y, x = b === 0 ? 0 : b / (Math.max(2, l) - 1);
|
|
10340
10641
|
e.fillStyle = u, e.fillRect(n, r, i, a), h && (e.strokeStyle = f, e.lineWidth = 1, e.beginPath(), e.moveTo(Q(n, c), r), e.lineTo(Q(n, c), r + a), e.stroke()), e.font = `${p}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
|
|
10341
10642
|
let S = n + m;
|
|
10342
10643
|
for (let t = 0; t < Math.max(2, l); t++) {
|
|
10343
|
-
let i = b === 0 ? v : v - x * t, o = Math.round(
|
|
10644
|
+
let i = b === 0 ? v : v - x * t, o = Math.round(Ac(i, v, y, a, _, _) + r);
|
|
10344
10645
|
if (g) {
|
|
10345
10646
|
e.strokeStyle = f, e.beginPath();
|
|
10346
10647
|
let t = Q(o, c);
|
|
@@ -10349,13 +10650,13 @@ function wc(e, t) {
|
|
|
10349
10650
|
e.fillStyle = d, e.fillText(i.toFixed(2), Z(S, c), Z(o, c));
|
|
10350
10651
|
}
|
|
10351
10652
|
}
|
|
10352
|
-
function
|
|
10653
|
+
function Mc(e, t) {
|
|
10353
10654
|
let { x: n, y: r, width: i, height: a, crosshairX: o, timestamp: s, dpr: c, bgColor: l = Oa.WHITE, textColor: u = Da.PRIMARY, fontSize: d = 16, paddingX: f = 8, paddingY: p = 4 } = t, m = Ta(s);
|
|
10354
10655
|
e.save(), e.font = `${d}px -apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif`, e.textBaseline = "middle", e.textAlign = "center";
|
|
10355
10656
|
let h = Math.round(e.measureText(m).width), g = Math.min(i, h + f * 2), _ = Math.min(a, d + p * 2), v = Math.min(Math.max(o, n + g / 2), n + i - g / 2), y = r + a / 2, b = v - g / 2;
|
|
10356
10657
|
y - _ / 2, e.fillStyle = l, e.fillRect(Z(b, c), 0, Z(g, c), Z(_, c)), e.fillStyle = u, e.fillText(m, Z(v, c), Z(y, c)), e.restore();
|
|
10357
10658
|
}
|
|
10358
|
-
function
|
|
10659
|
+
function Nc(e, t) {
|
|
10359
10660
|
let { x: n, y: r, width: i, height: a, data: o, scrollLeft: s, kWidth: c, kGap: l, startIndex: u, endIndex: d, dpr: f, bgColor: p = Oa.TRANSPARENT, textColor: m = Da.SECONDARY, lineColor: h = ka.DARK, fontSize: g = 16, paddingX: _ = 8, drawTopBorder: v = !0, drawBottomBorder: y = !0 } = t, b = Math.round(c * f), x = b % 2 == 0 ? b + 1 : b, S = Math.round(l * f), C = x + S, w = S, T = C / f, E = w / f, D = x / f;
|
|
10360
10661
|
e.fillStyle = p, e.fillRect(n, r, i, a), v && (e.strokeStyle = h, e.lineWidth = 1, e.beginPath(), e.moveTo(n, Q(r, f)), e.lineTo(n + i, Q(r, f)), e.stroke()), y && (e.strokeStyle = h, e.lineWidth = 1, e.beginPath(), e.moveTo(n, Q(r + a, f)), e.lineTo(n + i, Q(r + a, f)), e.stroke()), e.textAlign = "center", e.textBaseline = "middle";
|
|
10361
10662
|
let O = r + a / 2, k = Ea(o).filter((e) => e >= u && e < d);
|
|
@@ -10371,7 +10672,7 @@ function Ec(e, t) {
|
|
|
10371
10672
|
}
|
|
10372
10673
|
//#endregion
|
|
10373
10674
|
//#region src/core/renderers/yAxis.ts
|
|
10374
|
-
function
|
|
10675
|
+
function Pc(e) {
|
|
10375
10676
|
return {
|
|
10376
10677
|
name: "yAxis",
|
|
10377
10678
|
version: "1.0.0",
|
|
@@ -10380,8 +10681,8 @@ function Dc(e) {
|
|
|
10380
10681
|
paneId: oa,
|
|
10381
10682
|
priority: Y.SYSTEM_YAXIS,
|
|
10382
10683
|
draw(t) {
|
|
10383
|
-
let { ctx: n, pane: r, dpr: i, yAxisCtx: a } = t, o = a || n, s =
|
|
10384
|
-
|
|
10684
|
+
let { ctx: n, pane: r, dpr: i, yAxisCtx: a } = t, o = a || n, s = Tc(r.height, r.id === "main");
|
|
10685
|
+
jc(o, {
|
|
10385
10686
|
x: 0,
|
|
10386
10687
|
y: r.top,
|
|
10387
10688
|
width: e.axisWidth,
|
|
@@ -10398,19 +10699,19 @@ function Dc(e) {
|
|
|
10398
10699
|
}
|
|
10399
10700
|
//#endregion
|
|
10400
10701
|
//#region src/core/renderers/timeAxis.ts
|
|
10401
|
-
var
|
|
10402
|
-
function
|
|
10702
|
+
var Fc = Symbol("time-axis");
|
|
10703
|
+
function Ic(e) {
|
|
10403
10704
|
return {
|
|
10404
10705
|
name: "timeAxis",
|
|
10405
10706
|
version: "1.0.0",
|
|
10406
10707
|
description: "时间轴渲染器",
|
|
10407
10708
|
debugName: "时间轴",
|
|
10408
|
-
paneId:
|
|
10709
|
+
paneId: Fc,
|
|
10409
10710
|
priority: Y.SYSTEM_XAXIS,
|
|
10410
10711
|
isSystem: !0,
|
|
10411
10712
|
draw(t) {
|
|
10412
10713
|
let { ctx: n, data: r, range: i, scrollLeft: a, kWidth: o, kGap: s, dpr: c, paneWidth: l } = t, u = r, d = n, f = l, p = e.height;
|
|
10413
|
-
d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p),
|
|
10714
|
+
d.setTransform(1, 0, 0, 1, 0, 0), d.scale(c, c), d.clearRect(0, 0, f, p), Nc(d, {
|
|
10414
10715
|
x: 0,
|
|
10415
10716
|
y: 0,
|
|
10416
10717
|
width: f,
|
|
@@ -10428,7 +10729,7 @@ function kc(e) {
|
|
|
10428
10729
|
let m = e.getCrosshair?.();
|
|
10429
10730
|
if (m && typeof m.index == "number") {
|
|
10430
10731
|
let e = u[m.index];
|
|
10431
|
-
e &&
|
|
10732
|
+
e && Mc(d, {
|
|
10432
10733
|
x: 0,
|
|
10433
10734
|
y: 0,
|
|
10434
10735
|
width: f,
|
|
@@ -10443,7 +10744,7 @@ function kc(e) {
|
|
|
10443
10744
|
}
|
|
10444
10745
|
//#endregion
|
|
10445
10746
|
//#region src/core/renderers/crosshair.ts
|
|
10446
|
-
function
|
|
10747
|
+
function Lc(e) {
|
|
10447
10748
|
return {
|
|
10448
10749
|
name: "crosshair",
|
|
10449
10750
|
version: "1.0.0",
|
|
@@ -10455,10 +10756,10 @@ function Ac(e) {
|
|
|
10455
10756
|
let { ctx: n, pane: r, dpr: i, paneWidth: a } = t, o = e.getCrosshairState();
|
|
10456
10757
|
if (o.isDragging || !o.pos) return;
|
|
10457
10758
|
let { x: s, y: c } = o.pos, l = r.id === o.activePaneId, u = l ? c - r.top : -1;
|
|
10458
|
-
n.save(), n.beginPath(), n.rect(0, 0, a, r.height), n.clip(), n.fillStyle =
|
|
10459
|
-
let d =
|
|
10759
|
+
n.save(), n.beginPath(), n.rect(0, 0, a, r.height), n.clip(), n.fillStyle = Ha.LINE;
|
|
10760
|
+
let d = bs(s, 0, r.height, i);
|
|
10460
10761
|
if (d && n.fillRect(d.x, d.y, d.width, d.height), l && u >= 0) {
|
|
10461
|
-
let e =
|
|
10762
|
+
let e = xs(0, a, Math.min(u, r.height - 1 / i), i);
|
|
10462
10763
|
e && n.fillRect(e.x, e.y, e.width, e.height);
|
|
10463
10764
|
}
|
|
10464
10765
|
n.restore();
|
|
@@ -10467,7 +10768,7 @@ function Ac(e) {
|
|
|
10467
10768
|
}
|
|
10468
10769
|
//#endregion
|
|
10469
10770
|
//#region src/core/renderers/paneTitle.ts
|
|
10470
|
-
function
|
|
10771
|
+
function Rc(e) {
|
|
10471
10772
|
let t = { ...e };
|
|
10472
10773
|
return {
|
|
10473
10774
|
name: `paneTitle_${e.paneId}`,
|
|
@@ -10508,7 +10809,7 @@ function jc(e) {
|
|
|
10508
10809
|
}
|
|
10509
10810
|
//#endregion
|
|
10510
10811
|
//#region src/components/KLineChart.vue?vue&type=script&setup=true&lang.ts
|
|
10511
|
-
var
|
|
10812
|
+
var zc = { class: "chart-wrapper" }, Bc = 4, Vc = /* @__PURE__ */ ho(/* @__PURE__ */ u({
|
|
10512
10813
|
__name: "KLineChart",
|
|
10513
10814
|
props: {
|
|
10514
10815
|
semanticConfig: {},
|
|
@@ -10592,7 +10893,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10592
10893
|
function ue() {
|
|
10593
10894
|
C.value?.interaction.onScroll(), I();
|
|
10594
10895
|
}
|
|
10595
|
-
let R = _([
|
|
10896
|
+
let R = _([]), de = _({}), z = _([]), B = [
|
|
10596
10897
|
"VOLUME",
|
|
10597
10898
|
"MACD",
|
|
10598
10899
|
"RSI",
|
|
@@ -10649,14 +10950,14 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10649
10950
|
}
|
|
10650
10951
|
}
|
|
10651
10952
|
function pe(e = "VOLUME", t) {
|
|
10652
|
-
if (z.value.length >=
|
|
10953
|
+
if (z.value.length >= Bc) return !1;
|
|
10653
10954
|
let n = `sub_${e}`;
|
|
10654
10955
|
if (z.value.some((e) => e.id === n)) return !0;
|
|
10655
10956
|
if (!C.value?.createSubPane(e, t ?? fe(e))) return !1;
|
|
10656
|
-
let r =
|
|
10957
|
+
let r = Rc({
|
|
10657
10958
|
paneId: n,
|
|
10658
10959
|
title: e,
|
|
10659
|
-
getTitleInfo: () =>
|
|
10960
|
+
getTitleInfo: () => ye(n)
|
|
10660
10961
|
});
|
|
10661
10962
|
return C.value?.useRenderer(r), z.value.push({
|
|
10662
10963
|
id: n,
|
|
@@ -10677,13 +10978,38 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10677
10978
|
C.value?.clearSubPanes(), z.value = [], R.value = R.value.filter((e) => !B.includes(e));
|
|
10678
10979
|
}
|
|
10679
10980
|
function ge() {
|
|
10981
|
+
let e = n.semanticConfig.indicators?.main;
|
|
10982
|
+
if (e) for (let t of e) t.enabled && (R.value.includes(t.type) || R.value.push(t.type), t.params && (de.value[t.type] = t.params));
|
|
10983
|
+
}
|
|
10984
|
+
S(R, (e) => {
|
|
10985
|
+
let t = C.value;
|
|
10986
|
+
t && (t.updateRendererConfig("mainIndicatorLegend", { indicators: {
|
|
10987
|
+
MA: {
|
|
10988
|
+
enabled: e.includes("MA"),
|
|
10989
|
+
params: de.value.MA || {}
|
|
10990
|
+
},
|
|
10991
|
+
BOLL: {
|
|
10992
|
+
enabled: e.includes("BOLL"),
|
|
10993
|
+
params: de.value.BOLL || {}
|
|
10994
|
+
},
|
|
10995
|
+
EXPMA: {
|
|
10996
|
+
enabled: e.includes("EXPMA"),
|
|
10997
|
+
params: de.value.EXPMA || {}
|
|
10998
|
+
},
|
|
10999
|
+
ENE: {
|
|
11000
|
+
enabled: e.includes("ENE"),
|
|
11001
|
+
params: de.value.ENE || {}
|
|
11002
|
+
}
|
|
11003
|
+
} }), t.setRendererEnabled("ma", e.includes("MA")), t.setRendererEnabled("boll", e.includes("BOLL")), t.setRendererEnabled("expma", e.includes("EXPMA")), t.setRendererEnabled("ene", e.includes("ENE")), E());
|
|
11004
|
+
}, { deep: !0 });
|
|
11005
|
+
function _e() {
|
|
10680
11006
|
let e = C.value?.getSubPaneIndicators() ?? [];
|
|
10681
11007
|
z.value = [];
|
|
10682
11008
|
for (let t of e) {
|
|
10683
|
-
let e = `sub_${t}`, n =
|
|
11009
|
+
let e = `sub_${t}`, n = Rc({
|
|
10684
11010
|
paneId: e,
|
|
10685
11011
|
title: t,
|
|
10686
|
-
getTitleInfo: () =>
|
|
11012
|
+
getTitleInfo: () => ye(e)
|
|
10687
11013
|
});
|
|
10688
11014
|
C.value?.useRenderer(n), z.value.push({
|
|
10689
11015
|
id: e,
|
|
@@ -10694,15 +11020,15 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10694
11020
|
}), R.value.includes(t) || R.value.push(t);
|
|
10695
11021
|
}
|
|
10696
11022
|
}
|
|
10697
|
-
function
|
|
11023
|
+
function ve(e, t) {
|
|
10698
11024
|
let n = z.value.find((t) => t.id === e);
|
|
10699
11025
|
if (!n) return;
|
|
10700
11026
|
let r = n.indicatorId;
|
|
10701
11027
|
C.value?.removeRenderer(n.paneTitleRendererName), C.value?.removeSubPane(r), C.value?.createSubPane(t, fe(t));
|
|
10702
|
-
let i = `sub_${t}`, a =
|
|
11028
|
+
let i = `sub_${t}`, a = Rc({
|
|
10703
11029
|
paneId: i,
|
|
10704
11030
|
title: t,
|
|
10705
|
-
getTitleInfo: () =>
|
|
11031
|
+
getTitleInfo: () => ye(i)
|
|
10706
11032
|
});
|
|
10707
11033
|
C.value?.useRenderer(a);
|
|
10708
11034
|
let o = z.value.findIndex((t) => t.id === e);
|
|
@@ -10714,7 +11040,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10714
11040
|
params: fe(t)
|
|
10715
11041
|
}), R.value = R.value.filter((e) => e !== r), R.value.includes(t) || R.value.push(t);
|
|
10716
11042
|
}
|
|
10717
|
-
function
|
|
11043
|
+
function ye(e) {
|
|
10718
11044
|
let t = z.value.find((t) => t.id === e);
|
|
10719
11045
|
if (!t) return null;
|
|
10720
11046
|
let n = C.value?.getData();
|
|
@@ -10728,72 +11054,56 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10728
11054
|
let i = N.value;
|
|
10729
11055
|
if (i === null) return null;
|
|
10730
11056
|
switch (t.indicatorId) {
|
|
10731
|
-
case "MACD": return
|
|
10732
|
-
case "RSI": return
|
|
10733
|
-
case "CCI": return
|
|
10734
|
-
case "STOCH": return
|
|
10735
|
-
case "MOM": return
|
|
10736
|
-
case "WMSR": return
|
|
10737
|
-
case "KST": return
|
|
10738
|
-
case "FASTK": return
|
|
11057
|
+
case "MACD": return Vs(n, i, r.fastPeriod ?? 12, r.slowPeriod ?? 26, r.signalPeriod ?? 9);
|
|
11058
|
+
case "RSI": return Ws(n, i, r.period1 ?? 6, r.period2 ?? 12, r.period3 ?? 24);
|
|
11059
|
+
case "CCI": return Js(n, i, r.period ?? 14);
|
|
11060
|
+
case "STOCH": return Qs(n, i, r.n ?? 9, r.m ?? 3);
|
|
11061
|
+
case "MOM": return nc(n, i, r.period ?? 10);
|
|
11062
|
+
case "WMSR": return oc(n, i, r.period ?? 14);
|
|
11063
|
+
case "KST": return fc(n, i, r.roc1 ?? 10, r.roc2 ?? 15, r.roc3 ?? 20, r.roc4 ?? 30, r.signalPeriod ?? 9);
|
|
11064
|
+
case "FASTK": return gc(n, i, r.period ?? 9);
|
|
10739
11065
|
default: return null;
|
|
10740
11066
|
}
|
|
10741
11067
|
}
|
|
10742
|
-
function
|
|
10743
|
-
if (e === "MA") {
|
|
10744
|
-
t ?
|
|
10745
|
-
ma5: !0,
|
|
10746
|
-
ma10: !0,
|
|
10747
|
-
ma20: !0,
|
|
10748
|
-
ma30: !0,
|
|
10749
|
-
ma60: !0
|
|
10750
|
-
}), C.value?.setRendererEnabled("maLegend", !0)) : (R.value = R.value.filter((t) => t !== e), C.value?.updateRendererConfig("ma", {
|
|
10751
|
-
ma5: !1,
|
|
10752
|
-
ma10: !1,
|
|
10753
|
-
ma20: !1,
|
|
10754
|
-
ma30: !1,
|
|
10755
|
-
ma60: !1
|
|
10756
|
-
}), C.value?.setRendererEnabled("maLegend", !1)), E();
|
|
10757
|
-
return;
|
|
10758
|
-
}
|
|
10759
|
-
if (e === "BOLL") {
|
|
10760
|
-
t ? R.value.includes(e) || R.value.push(e) : R.value = R.value.filter((t) => t !== e), C.value?.setRendererEnabled("boll", t), C.value?.setRendererEnabled("bollLegend", t), E();
|
|
11068
|
+
function be(e, t) {
|
|
11069
|
+
if (e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
|
|
11070
|
+
t ? R.value.includes(e) || R.value.push(e) : R.value = R.value.filter((t) => t !== e);
|
|
10761
11071
|
return;
|
|
10762
11072
|
}
|
|
10763
11073
|
if (B.includes(e)) {
|
|
10764
11074
|
if (t) {
|
|
10765
|
-
if (z.value.find((t) => t.indicatorId === e)) return;
|
|
11075
|
+
if (R.value.includes(e) || R.value.push(e), z.value.find((t) => t.indicatorId === e)) return;
|
|
10766
11076
|
if (!pe(e)) {
|
|
10767
11077
|
let t = z.value[z.value.length - 1];
|
|
10768
|
-
t &&
|
|
11078
|
+
t && ve(t.id, e);
|
|
10769
11079
|
}
|
|
10770
|
-
} else z.value.filter((t) => t.indicatorId === e).forEach((e) => me(e.id));
|
|
11080
|
+
} else R.value = R.value.filter((t) => t !== e), z.value.filter((t) => t.indicatorId === e).forEach((e) => me(e.id));
|
|
10771
11081
|
E();
|
|
10772
11082
|
}
|
|
10773
11083
|
}
|
|
10774
|
-
function
|
|
10775
|
-
if (de.value[e] = t, e === "BOLL") {
|
|
10776
|
-
C.value?.updateRendererConfig("boll", t), C.value?.updateRendererConfig("
|
|
11084
|
+
function xe(e, t) {
|
|
11085
|
+
if (de.value[e] = t, e === "MA" || e === "BOLL" || e === "EXPMA" || e === "ENE") {
|
|
11086
|
+
e === "BOLL" && C.value?.updateRendererConfig("boll", t), e === "EXPMA" && C.value?.updateRendererConfig("expma", t), e === "ENE" && C.value?.updateRendererConfig("ene", t), E();
|
|
10777
11087
|
return;
|
|
10778
11088
|
}
|
|
10779
11089
|
B.includes(e) && z.value.filter((t) => t.indicatorId === e).forEach((e) => {
|
|
10780
11090
|
e.params = { ...t }, C.value?.updateRendererConfig(e.rendererName, t);
|
|
10781
11091
|
}), E();
|
|
10782
11092
|
}
|
|
10783
|
-
let
|
|
10784
|
-
let e = T.value, t = window.devicePixelRatio || 1, { startXPx: r, unitPx: i } =
|
|
11093
|
+
let Se = r(() => {
|
|
11094
|
+
let e = T.value, t = window.devicePixelRatio || 1, { startXPx: r, unitPx: i } = ls(b.value, x.value, t);
|
|
10785
11095
|
return (r + e * i) / t + (n.rightAxisWidth + n.priceLabelWidth);
|
|
10786
11096
|
});
|
|
10787
|
-
function
|
|
11097
|
+
function Ce() {
|
|
10788
11098
|
let e = v.value;
|
|
10789
11099
|
e && (e.scrollLeft = e.scrollWidth, E());
|
|
10790
11100
|
}
|
|
10791
11101
|
return t({
|
|
10792
11102
|
scheduleRender: E,
|
|
10793
|
-
scrollToRight:
|
|
11103
|
+
scrollToRight: Ce,
|
|
10794
11104
|
addSubPane: pe,
|
|
10795
11105
|
removeSubPane: me,
|
|
10796
|
-
switchSubIndicator:
|
|
11106
|
+
switchSubIndicator: ve,
|
|
10797
11107
|
clearAllSubPanes: he,
|
|
10798
11108
|
get plugin() {
|
|
10799
11109
|
return C.value?.plugin;
|
|
@@ -10805,7 +11115,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10805
11115
|
C.value?.interaction.onWheel(e), I();
|
|
10806
11116
|
};
|
|
10807
11117
|
e.addEventListener("wheel", i, { passive: !1 });
|
|
10808
|
-
let a = new
|
|
11118
|
+
let a = new vc({
|
|
10809
11119
|
container: e,
|
|
10810
11120
|
canvasLayer: t,
|
|
10811
11121
|
xAxisCanvas: r
|
|
@@ -10830,29 +11140,20 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10830
11140
|
if (!r) return;
|
|
10831
11141
|
let i = Math.max(0, r.scrollWidth - r.clientWidth);
|
|
10832
11142
|
r.scrollLeft = Math.min(Math.max(0, n), i), a.applyZoom(e, t);
|
|
10833
|
-
}), a.useRenderer(
|
|
11143
|
+
}), a.useRenderer(Ec()), a.useRenderer(Oc()), a.useRenderer(ws({
|
|
10834
11144
|
ma5: !0,
|
|
10835
11145
|
ma10: !0,
|
|
10836
11146
|
ma20: !0,
|
|
10837
11147
|
ma30: !0,
|
|
10838
11148
|
ma60: !0
|
|
10839
|
-
})), a.useRenderer(
|
|
11149
|
+
})), a.useRenderer(Es()), a.setRendererEnabled("boll", !1), a.useRenderer(As()), a.setRendererEnabled("expma", !1), a.useRenderer(Ns()), a.setRendererEnabled("ene", !1), a.useRenderer(Cc()), a.useRenderer(Dc()), a.useRenderer(va()), a.useRenderer(Pc({
|
|
10840
11150
|
axisWidth: n.rightAxisWidth,
|
|
10841
11151
|
yPaddingPx: n.yPaddingPx
|
|
10842
|
-
})), a.useRenderer(
|
|
10843
|
-
yPaddingPx: n.yPaddingPx,
|
|
10844
|
-
showMA: {
|
|
10845
|
-
ma5: !0,
|
|
10846
|
-
ma10: !0,
|
|
10847
|
-
ma20: !0,
|
|
10848
|
-
ma30: !0,
|
|
10849
|
-
ma60: !0
|
|
10850
|
-
}
|
|
10851
|
-
})), a.useRenderer(ks({ yPaddingPx: n.yPaddingPx })), a.setRendererEnabled("bollLegend", !1), a.useRenderer(Ac({ getCrosshairState: () => ({
|
|
11152
|
+
})), a.useRenderer(Fs({ yPaddingPx: n.yPaddingPx })), a.useRenderer(Lc({ getCrosshairState: () => ({
|
|
10852
11153
|
pos: a.interaction.crosshairPos,
|
|
10853
11154
|
activePaneId: a.interaction.activePaneId,
|
|
10854
11155
|
isDragging: a.interaction.isDraggingState()
|
|
10855
|
-
}) })), a.useRenderer(
|
|
11156
|
+
}) })), a.useRenderer(Ic({
|
|
10856
11157
|
height: n.bottomAxisHeight,
|
|
10857
11158
|
getCrosshair: () => {
|
|
10858
11159
|
let e = a.interaction.crosshairPos, t = a.interaction.hoveredIndex;
|
|
@@ -10864,7 +11165,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10864
11165
|
})), C.value = a, a.resize(), w.value = new Ui(a), w.value.on("config:error", (e) => {
|
|
10865
11166
|
console.error("Semantic config error:", e);
|
|
10866
11167
|
}), w.value.on("config:ready", () => {
|
|
10867
|
-
T.value = a.getData()?.length ?? 0, ie(), ge(), d(() =>
|
|
11168
|
+
T.value = a.getData()?.length ?? 0, ie(), ge(), _e(), d(() => Ce());
|
|
10868
11169
|
}), w.value.applyConfig(n.semanticConfig).then((e) => {
|
|
10869
11170
|
e && !e.success && console.error("Semantic config apply failed:", e.errors);
|
|
10870
11171
|
}), a.interaction.setOnMarkerHover((e) => {
|
|
@@ -10899,7 +11200,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10899
11200
|
let t = await w.value?.applyConfig(e);
|
|
10900
11201
|
t && !t.success && console.error("Semantic config apply failed:", t.errors);
|
|
10901
11202
|
}
|
|
10902
|
-
}, { deep: !0 }), (e, t) => (g(), o("div",
|
|
11203
|
+
}, { deep: !0 }), (e, t) => (g(), o("div", zc, [s("div", {
|
|
10903
11204
|
class: f(["chart-container", { "is-dragging": j.value }]),
|
|
10904
11205
|
ref_key: "containerRef",
|
|
10905
11206
|
ref: v,
|
|
@@ -10910,7 +11211,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10910
11211
|
onPointerleave: le
|
|
10911
11212
|
}, [s("div", {
|
|
10912
11213
|
class: "scroll-content",
|
|
10913
|
-
style: p({ width:
|
|
11214
|
+
style: p({ width: Se.value + "px" })
|
|
10914
11215
|
}, [s("div", {
|
|
10915
11216
|
class: "canvas-layer",
|
|
10916
11217
|
ref_key: "canvasLayerRef",
|
|
@@ -10928,7 +11229,7 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10928
11229
|
width: n.rightAxisWidth + n.priceLabelWidth + "px"
|
|
10929
11230
|
})
|
|
10930
11231
|
}, null, 4),
|
|
10931
|
-
P.value ? (g(), i(
|
|
11232
|
+
P.value ? (g(), i(go, {
|
|
10932
11233
|
key: 0,
|
|
10933
11234
|
k: P.value,
|
|
10934
11235
|
index: F.value,
|
|
@@ -10941,20 +11242,20 @@ var Mc = { class: "chart-wrapper" }, Nc = 4, Pc = /* @__PURE__ */ po(/* @__PURE_
|
|
|
10941
11242
|
"data",
|
|
10942
11243
|
"pos"
|
|
10943
11244
|
])) : a("", !0),
|
|
10944
|
-
O.value || k.value ? (g(), i(
|
|
11245
|
+
O.value || k.value ? (g(), i(xo, {
|
|
10945
11246
|
key: 1,
|
|
10946
11247
|
marker: O.value || k.value,
|
|
10947
11248
|
pos: A.value
|
|
10948
11249
|
}, null, 8, ["marker", "pos"])) : a("", !0)
|
|
10949
|
-
], 512)], 4)], 34), l(
|
|
11250
|
+
], 512)], 4)], 34), l(ss, {
|
|
10950
11251
|
"active-indicators": R.value,
|
|
10951
11252
|
"indicator-params": de.value,
|
|
10952
|
-
onToggle:
|
|
10953
|
-
onUpdateParams:
|
|
11253
|
+
onToggle: be,
|
|
11254
|
+
onUpdateParams: xe
|
|
10954
11255
|
}, null, 8, ["active-indicators", "indicator-params"])]));
|
|
10955
11256
|
}
|
|
10956
|
-
}), [["__scopeId", "data-v-
|
|
10957
|
-
e.component("KLineChart",
|
|
11257
|
+
}), [["__scopeId", "data-v-f07a030f"]]), Hc = { install(e) {
|
|
11258
|
+
e.component("KLineChart", Vc);
|
|
10958
11259
|
} };
|
|
10959
11260
|
//#endregion
|
|
10960
|
-
export { la as ConfigManager, F as EventBus, oa as GLOBAL_PANE_ID, ca as HookSystem,
|
|
11261
|
+
export { la as ConfigManager, F as EventBus, oa as GLOBAL_PANE_ID, ca as HookSystem, Vc as KLineChart, Hc as KMapPlugin, ua as PluginHostImpl, sa as PluginRegistry, ia as PluginState, Y as RENDERER_PRIORITY, pa as RendererPluginManager, da as createPluginHost, aa as wrapPaneInfo };
|