@tradecanvas/core 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +819 -791
- package/dist/index.js.map +1 -1
- package/dist/trading/DepthOverlay.d.ts +3 -2
- package/dist/trading/DepthOverlay.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -22692,66 +22692,94 @@ var Nw = 1e3, Pw = class {
|
|
|
22692
22692
|
return this.manager.axisTagYs(e, t);
|
|
22693
22693
|
}
|
|
22694
22694
|
}, Iw = "rgba(31, 168, 116,0.15)", Lw = "rgba(232, 80, 91,0.15)", Rw = "#1fa874", zw = "#e8505b", Bw = 100;
|
|
22695
|
-
function Vw(e
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22695
|
+
function Vw(e) {
|
|
22696
|
+
return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : null;
|
|
22697
|
+
}
|
|
22698
|
+
function Hw(e, t, n) {
|
|
22699
|
+
let r = /* @__PURE__ */ new Map();
|
|
22700
|
+
for (let i of e) {
|
|
22701
|
+
let e = Number((i.price / t).toPrecision(12)), a = n ? Math.ceil(e - .5) : Math.floor(e + .5);
|
|
22702
|
+
r.set(a, (r.get(a) ?? 0) + i.volume);
|
|
22703
|
+
}
|
|
22704
|
+
return [...r].map(([e, n]) => ({
|
|
22705
|
+
price: e * t,
|
|
22706
|
+
volume: n
|
|
22707
|
+
}));
|
|
22708
|
+
}
|
|
22709
|
+
function Uw(e, t = "cumulative", n) {
|
|
22710
|
+
let r = Vw(n), i = (e, n) => {
|
|
22711
|
+
let i = e.filter((e) => Number.isFinite(e.price) && Number.isFinite(e.volume) && e.volume > 0), a = r === null ? i : Hw(i, r, n);
|
|
22712
|
+
a.sort((e, t) => n ? t.price - e.price : e.price - t.price);
|
|
22713
|
+
let o = 0;
|
|
22714
|
+
return a.map((e) => (o += e.volume, {
|
|
22701
22715
|
price: e.price,
|
|
22702
|
-
value: t === "cumulative" ?
|
|
22716
|
+
value: t === "cumulative" ? o : e.volume
|
|
22703
22717
|
}));
|
|
22704
|
-
},
|
|
22705
|
-
for (let e of
|
|
22706
|
-
for (let e of
|
|
22718
|
+
}, a = i(e.bids, !0), o = i(e.asks, !1), s = 0;
|
|
22719
|
+
for (let e of a) s = Math.max(s, e.value);
|
|
22720
|
+
for (let e of o) s = Math.max(s, e.value);
|
|
22707
22721
|
return {
|
|
22708
|
-
bids:
|
|
22709
|
-
asks:
|
|
22710
|
-
max:
|
|
22722
|
+
bids: a,
|
|
22723
|
+
asks: o,
|
|
22724
|
+
max: s
|
|
22711
22725
|
};
|
|
22712
22726
|
}
|
|
22713
|
-
function
|
|
22727
|
+
function Ww(e, t) {
|
|
22714
22728
|
if (e.length < 2) return Infinity;
|
|
22715
22729
|
let n = Math.abs(x(e[0].price, t) - x(e[1].price, t));
|
|
22716
22730
|
return n > 0 ? n : Infinity;
|
|
22717
22731
|
}
|
|
22718
|
-
var
|
|
22732
|
+
var Gw = class {
|
|
22719
22733
|
cache = null;
|
|
22720
22734
|
invalidate() {
|
|
22721
22735
|
this.cache = null;
|
|
22722
22736
|
}
|
|
22723
22737
|
render(e, t, n, r) {
|
|
22724
22738
|
if (!r.enabled) return;
|
|
22725
|
-
let i = r.mode === "level" ? "level" : "cumulative";
|
|
22726
|
-
(!this.cache || this.cache.depth !== t || this.cache.mode !== i) && (this.cache = {
|
|
22739
|
+
let i = r.mode === "level" ? "level" : "cumulative", a = Vw(r.rowSize);
|
|
22740
|
+
(!this.cache || this.cache.depth !== t || this.cache.mode !== i || this.cache.rowSize !== a) && (this.cache = {
|
|
22727
22741
|
depth: t,
|
|
22728
22742
|
mode: i,
|
|
22729
|
-
|
|
22743
|
+
rowSize: a,
|
|
22744
|
+
bars: Uw(t, i, a ?? void 0)
|
|
22730
22745
|
});
|
|
22731
|
-
let { bids:
|
|
22732
|
-
if (
|
|
22733
|
-
let { chartRect:
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
}
|
|
22741
|
-
|
|
22742
|
-
|
|
22746
|
+
let { bids: o, asks: s, max: c } = this.cache.bars;
|
|
22747
|
+
if (c === 0) return;
|
|
22748
|
+
let { chartRect: l } = n, u = Math.min(Math.max(r.maxWidth ?? Bw, 0), l.width), d = l.x + l.width, f = Math.min(Ww(o, n), Ww(s, n)), p = Number.isFinite(f) ? f : 4, m = Math.max(1, i === "level" ? p - 1 : p), h = l.y, g = l.y + l.height, _ = (e) => {
|
|
22749
|
+
if (a === null) {
|
|
22750
|
+
let t = x(e, n);
|
|
22751
|
+
return t < h || t > g ? null : {
|
|
22752
|
+
y: t - m / 2,
|
|
22753
|
+
h: m
|
|
22754
|
+
};
|
|
22755
|
+
}
|
|
22756
|
+
let t = x(e + a / 2, n), r = x(e - a / 2, n), o = Math.min(t, r), s = Math.abs(r - t);
|
|
22757
|
+
return !Number.isFinite(o) || !Number.isFinite(s) || o + s < h || o > g ? null : {
|
|
22758
|
+
y: o,
|
|
22759
|
+
h: Math.max(1, i === "level" && s > 2 ? s - 1 : s)
|
|
22760
|
+
};
|
|
22761
|
+
}, v = (t, n) => {
|
|
22762
|
+
e.fillStyle = n;
|
|
22763
|
+
for (let { price: n, value: r } of t) {
|
|
22764
|
+
let t = _(n);
|
|
22765
|
+
if (!t) continue;
|
|
22766
|
+
let i = r / c * u;
|
|
22767
|
+
e.fillRect(d - i, t.y, i, t.h);
|
|
22768
|
+
}
|
|
22769
|
+
};
|
|
22770
|
+
if (v(o, r.bidColor ?? Iw), v(s, r.askColor ?? Lw), r.markBest) {
|
|
22743
22771
|
let t = (t, r) => {
|
|
22744
22772
|
if (!t) return;
|
|
22745
22773
|
let i = x(t.price, n);
|
|
22746
|
-
i <
|
|
22774
|
+
i < l.y || i > l.y + l.height || (e.fillStyle = r, e.fillRect(d - u, i - .5, u, 1));
|
|
22747
22775
|
};
|
|
22748
|
-
t(
|
|
22776
|
+
t(o[0], r.bestBidColor ?? Rw), t(s[0], r.bestAskColor ?? zw);
|
|
22749
22777
|
}
|
|
22750
22778
|
}
|
|
22751
|
-
},
|
|
22779
|
+
}, Kw = class {
|
|
22752
22780
|
data = null;
|
|
22753
22781
|
config = {};
|
|
22754
|
-
overlay = new
|
|
22782
|
+
overlay = new Gw();
|
|
22755
22783
|
setData(e) {
|
|
22756
22784
|
this.data = e, this.overlay.invalidate();
|
|
22757
22785
|
}
|
|
@@ -22780,7 +22808,7 @@ var Uw = class {
|
|
|
22780
22808
|
};
|
|
22781
22809
|
//#endregion
|
|
22782
22810
|
//#region src/trading/PaperExecutionAdapter.ts
|
|
22783
|
-
function
|
|
22811
|
+
function qw(e, t) {
|
|
22784
22812
|
let n = e.trailingStop;
|
|
22785
22813
|
if (n === void 0 || !(n > 0) || !Number.isFinite(t) || !(t > 0)) return e;
|
|
22786
22814
|
let r = e.side === "buy", i = r ? t - n : t + n, a = e.stopLoss;
|
|
@@ -22789,7 +22817,7 @@ function Gw(e, t) {
|
|
|
22789
22817
|
stopLoss: i
|
|
22790
22818
|
};
|
|
22791
22819
|
}
|
|
22792
|
-
var
|
|
22820
|
+
var Jw = class {
|
|
22793
22821
|
name = "paper";
|
|
22794
22822
|
state = "disconnected";
|
|
22795
22823
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -22830,7 +22858,7 @@ var Kw = class {
|
|
|
22830
22858
|
price: e.price,
|
|
22831
22859
|
stopPrice: e.stopPrice,
|
|
22832
22860
|
quantity: e.quantity ?? 1,
|
|
22833
|
-
label: e.type === "market" ? void 0 :
|
|
22861
|
+
label: e.type === "market" ? void 0 : Xw(e.type),
|
|
22834
22862
|
draggable: !0,
|
|
22835
22863
|
stopLoss: e.stopLoss,
|
|
22836
22864
|
takeProfit: e.takeProfit,
|
|
@@ -22856,7 +22884,7 @@ var Kw = class {
|
|
|
22856
22884
|
stopLoss: t(e.stopLoss, n.stopLoss),
|
|
22857
22885
|
takeProfit: t(e.takeProfit, n.takeProfit)
|
|
22858
22886
|
};
|
|
22859
|
-
return e.trailingStop === null ? delete r.trailingStop : e.trailingStop !== void 0 && Number.isFinite(e.trailingStop) && e.trailingStop > 0 && (r.trailingStop = e.trailingStop), e.stopLoss === null && delete r.trailingStop, typeof e.stopLoss == "number" ? r :
|
|
22887
|
+
return e.trailingStop === null ? delete r.trailingStop : e.trailingStop !== void 0 && Number.isFinite(e.trailingStop) && e.trailingStop > 0 && (r.trailingStop = e.trailingStop), e.stopLoss === null && delete r.trailingStop, typeof e.stopLoss == "number" ? r : qw(r, this.markPrice);
|
|
22860
22888
|
}), this.emit("positions", this.positions);
|
|
22861
22889
|
}
|
|
22862
22890
|
async closePosition(e) {
|
|
@@ -22870,7 +22898,7 @@ var Kw = class {
|
|
|
22870
22898
|
this.close(t, n, "reverse");
|
|
22871
22899
|
let r = t.quantity - (t.closedQuantity ?? 0), i = {
|
|
22872
22900
|
id: this.nextId("ord"),
|
|
22873
|
-
side:
|
|
22901
|
+
side: Yw(t.side),
|
|
22874
22902
|
type: "market",
|
|
22875
22903
|
price: n,
|
|
22876
22904
|
quantity: r
|
|
@@ -22914,7 +22942,7 @@ var Kw = class {
|
|
|
22914
22942
|
let r = e.quantity - (e.closedQuantity ?? 0), i = e.side === "buy" ? 1 : -1;
|
|
22915
22943
|
this.emit("fill", {
|
|
22916
22944
|
orderId: this.nextId("ord"),
|
|
22917
|
-
side:
|
|
22945
|
+
side: Yw(e.side),
|
|
22918
22946
|
price: t,
|
|
22919
22947
|
quantity: r,
|
|
22920
22948
|
time: this.fillTime(),
|
|
@@ -22938,7 +22966,7 @@ var Kw = class {
|
|
|
22938
22966
|
trailStops() {
|
|
22939
22967
|
let e = !1;
|
|
22940
22968
|
return this.positions = this.positions.map((t) => {
|
|
22941
|
-
let n =
|
|
22969
|
+
let n = qw(t, this.markPrice);
|
|
22942
22970
|
return n !== t && (e = !0), n;
|
|
22943
22971
|
}), e;
|
|
22944
22972
|
}
|
|
@@ -22965,10 +22993,10 @@ var Kw = class {
|
|
|
22965
22993
|
}
|
|
22966
22994
|
}
|
|
22967
22995
|
};
|
|
22968
|
-
function
|
|
22996
|
+
function Yw(e) {
|
|
22969
22997
|
return e === "buy" ? "sell" : "buy";
|
|
22970
22998
|
}
|
|
22971
|
-
function
|
|
22999
|
+
function Xw(e) {
|
|
22972
23000
|
switch (e) {
|
|
22973
23001
|
case "stop": return "STOP";
|
|
22974
23002
|
case "stopLimit": return "STOP LIMIT";
|
|
@@ -22977,7 +23005,7 @@ function Jw(e) {
|
|
|
22977
23005
|
}
|
|
22978
23006
|
//#endregion
|
|
22979
23007
|
//#region src/realtime/Emitter.ts
|
|
22980
|
-
var
|
|
23008
|
+
var Zw = class {
|
|
22981
23009
|
listeners = /* @__PURE__ */ new Map();
|
|
22982
23010
|
on(e, t) {
|
|
22983
23011
|
let n = this.listeners.get(e);
|
|
@@ -22999,12 +23027,12 @@ var Yw = class {
|
|
|
22999
23027
|
removeAllListeners() {
|
|
23000
23028
|
this.listeners.clear();
|
|
23001
23029
|
}
|
|
23002
|
-
},
|
|
23030
|
+
}, Qw = 6e4, $w = (e) => [
|
|
23003
23031
|
e.open,
|
|
23004
23032
|
e.high,
|
|
23005
23033
|
e.low,
|
|
23006
23034
|
e.close
|
|
23007
|
-
].every(Number.isFinite),
|
|
23035
|
+
].every(Number.isFinite), eT = class extends Zw {
|
|
23008
23036
|
currentBar = null;
|
|
23009
23037
|
newest = -Infinity;
|
|
23010
23038
|
builtFromTrades = !1;
|
|
@@ -23028,7 +23056,7 @@ var Yw = class {
|
|
|
23028
23056
|
this.builtOffTheBuckets() && (this.currentBar = null, this.newest = -Infinity, this.lastTradeAt = null), Number.isFinite(e) && (this.newest = Math.max(this.newest, M(e)));
|
|
23029
23057
|
}
|
|
23030
23058
|
resume(e) {
|
|
23031
|
-
if (
|
|
23059
|
+
if (!$w(e)) return;
|
|
23032
23060
|
let t = M(e.time);
|
|
23033
23061
|
t < this.newest || (this.newest = t, this.currentBar = {
|
|
23034
23062
|
time: t,
|
|
@@ -23103,7 +23131,7 @@ var Yw = class {
|
|
|
23103
23131
|
return n !== null && M(n.time) === this.newest ? n.time : this.newest;
|
|
23104
23132
|
}
|
|
23105
23133
|
instantOf(e) {
|
|
23106
|
-
return !this.dateStamps || !this.dateFrame ? e : e - Ze(this.bucket.timeZone ?? 0, e) *
|
|
23134
|
+
return !this.dateStamps || !this.dateFrame ? e : e - Ze(this.bucket.timeZone ?? 0, e) * Qw;
|
|
23107
23135
|
}
|
|
23108
23136
|
builtOffTheBuckets() {
|
|
23109
23137
|
let e = this.currentBar;
|
|
@@ -23115,9 +23143,9 @@ var Yw = class {
|
|
|
23115
23143
|
alignToTimeframe(e) {
|
|
23116
23144
|
if (!(this.timeframeMs > 0)) return e;
|
|
23117
23145
|
let t = Tt(e, this.timeframe, this.bucket);
|
|
23118
|
-
return !this.dateStamps || !this.dateFrame ? t : t + Ze(this.bucket.timeZone ?? 0, t) *
|
|
23146
|
+
return !this.dateStamps || !this.dateFrame ? t : t + Ze(this.bucket.timeZone ?? 0, t) * Qw;
|
|
23119
23147
|
}
|
|
23120
|
-
},
|
|
23148
|
+
}, tT = class extends Zw {
|
|
23121
23149
|
config;
|
|
23122
23150
|
attempt = 0;
|
|
23123
23151
|
timer = null;
|
|
@@ -23164,7 +23192,7 @@ var Yw = class {
|
|
|
23164
23192
|
let e = this.config.baseDelay, t = this.config.backoffMultiplier ** (this.attempt - 1), n = Math.min(e * t, this.config.maxDelay), r = n * .25 * (Math.random() * 2 - 1);
|
|
23165
23193
|
return Math.max(0, Math.round(n + r));
|
|
23166
23194
|
}
|
|
23167
|
-
},
|
|
23195
|
+
}, nT = 20, rT = class {
|
|
23168
23196
|
price = null;
|
|
23169
23197
|
previousClose = null;
|
|
23170
23198
|
visible = !0;
|
|
@@ -23218,46 +23246,46 @@ var Yw = class {
|
|
|
23218
23246
|
let { y: i, color: a } = r, { chartRect: o } = t, s = o.x + o.width + 1, c = this.pricePrecision ?? je(t.priceRange.min, t.priceRange.max), l = t.formatPrice ? t.formatPrice(this.price) : j(this.price, c, this.locale);
|
|
23219
23247
|
e.font = `bold 11px ${n.font.family}`;
|
|
23220
23248
|
let u = (t.priceAxisWidth ?? Te) - 2;
|
|
23221
|
-
e.fillStyle = a, ln(e, s, i -
|
|
23249
|
+
e.fillStyle = a, ln(e, s, i - nT / 2, u, nT, n), this.tag = {
|
|
23222
23250
|
x: s,
|
|
23223
|
-
y: i -
|
|
23251
|
+
y: i - nT / 2,
|
|
23224
23252
|
width: u,
|
|
23225
|
-
height:
|
|
23253
|
+
height: nT,
|
|
23226
23254
|
color: a
|
|
23227
23255
|
}, e.fillStyle = pn(a), e.textBaseline = "middle", e.textAlign = "left", e.fillText(l, s + 7, i);
|
|
23228
23256
|
}
|
|
23229
|
-
},
|
|
23257
|
+
}, iT = 1e3, aT = 10, oT = 1440, sT = 5e3, cT = 2, lT = 864e5, uT = 6e4, dT = [
|
|
23230
23258
|
"tick",
|
|
23231
23259
|
"barClose",
|
|
23232
23260
|
"snapshot",
|
|
23233
23261
|
"connectionChange",
|
|
23234
23262
|
"error",
|
|
23235
23263
|
"symbolInfo"
|
|
23236
|
-
],
|
|
23237
|
-
function
|
|
23238
|
-
if (e instanceof
|
|
23239
|
-
let t =
|
|
23240
|
-
return t || (t = new
|
|
23264
|
+
], fT = /* @__PURE__ */ new WeakMap();
|
|
23265
|
+
function pT(e) {
|
|
23266
|
+
if (e instanceof yT || !e.supportedTimeframes?.length) return e;
|
|
23267
|
+
let t = fT.get(e);
|
|
23268
|
+
return t || (t = new yT(e, e.supportedTimeframes), fT.set(e, t)), t;
|
|
23241
23269
|
}
|
|
23242
|
-
function
|
|
23270
|
+
function mT(e, t, n) {
|
|
23243
23271
|
if (t.includes(e)) return e;
|
|
23244
23272
|
let r = tt(e, t, { timeZone: n });
|
|
23245
23273
|
return r && Math.ceil(Ot(e) / Ot(r)) <= 1440 ? r : null;
|
|
23246
23274
|
}
|
|
23247
|
-
function
|
|
23275
|
+
function hT(e, t) {
|
|
23248
23276
|
if (St(t) !== null) return typeof e.fetchTrades == "function" && typeof e.subscribeTrades == "function";
|
|
23249
23277
|
let n = e.supportedTimeframes;
|
|
23250
|
-
return !n?.length ||
|
|
23278
|
+
return !n?.length || mT(t, n) !== null;
|
|
23251
23279
|
}
|
|
23252
|
-
function
|
|
23253
|
-
let r = et(t), i = n !== void 0 && Dt(t) && e %
|
|
23280
|
+
function gT(e, t, n) {
|
|
23281
|
+
let r = et(t), i = n !== void 0 && Dt(t) && e % lT !== 0, a = i ? e + Ze(n, e) * uT : e, o;
|
|
23254
23282
|
if (r?.unit === "M") {
|
|
23255
23283
|
let e = new Date(a);
|
|
23256
23284
|
o = Date.UTC(e.getUTCFullYear(), e.getUTCMonth() + r.count, 1);
|
|
23257
23285
|
} else o = a + Ot(t);
|
|
23258
23286
|
return i ? jt(o, n) : o;
|
|
23259
23287
|
}
|
|
23260
|
-
function
|
|
23288
|
+
function _T(e, t) {
|
|
23261
23289
|
let n = t[0], r = {
|
|
23262
23290
|
time: e,
|
|
23263
23291
|
open: n.open,
|
|
@@ -23272,10 +23300,10 @@ function hT(e, t) {
|
|
|
23272
23300
|
}
|
|
23273
23301
|
return r;
|
|
23274
23302
|
}
|
|
23275
|
-
function
|
|
23276
|
-
return
|
|
23303
|
+
function vT(e, t) {
|
|
23304
|
+
return _T(e, [...t.values()].sort((e, t) => e.time - t.time));
|
|
23277
23305
|
}
|
|
23278
|
-
var
|
|
23306
|
+
var yT = class {
|
|
23279
23307
|
name;
|
|
23280
23308
|
fetchHistoryBefore;
|
|
23281
23309
|
searchSymbols;
|
|
@@ -23297,10 +23325,10 @@ var _T = class {
|
|
|
23297
23325
|
unanswered = /* @__PURE__ */ new Map();
|
|
23298
23326
|
constructor(e, t) {
|
|
23299
23327
|
this.inner = e, this.baseTimeframes = t, this.name = e.name, e.fetchHistoryBefore && (this.fetchHistoryBefore = (e, t, n, r) => this.historyBefore(e, t, n, r)), e.searchSymbols && (this.searchSymbols = e.searchSymbols.bind(e)), e.resolveSymbol && (this.resolveSymbol = (e) => this.resolveShared(e)), e.subscribeQuotes && (this.subscribeQuotes = e.subscribeQuotes.bind(e)), e.fetchNews && (this.fetchNews = e.fetchNews.bind(e)), e.fetchTrades && (this.fetchTrades = e.fetchTrades.bind(e)), e.subscribeTrades && (this.subscribeTrades = e.subscribeTrades.bind(e)), this.listen("bar", (e) => this.onBar(e));
|
|
23300
|
-
for (let e of
|
|
23328
|
+
for (let e of dT) this.listen(e, (t) => this.emit(e, t.data));
|
|
23301
23329
|
}
|
|
23302
23330
|
baseFor(e) {
|
|
23303
|
-
let t =
|
|
23331
|
+
let t = mT(e, this.baseTimeframes);
|
|
23304
23332
|
if (!t) throw RangeError(`${this.name} cannot serve the ${e} timeframe`);
|
|
23305
23333
|
return t;
|
|
23306
23334
|
}
|
|
@@ -23324,7 +23352,7 @@ var _T = class {
|
|
|
23324
23352
|
async fetchHistory(e, t, n = 500) {
|
|
23325
23353
|
if (this.baseFor(t) === t) return this.inner.fetchHistory(e, t, n);
|
|
23326
23354
|
let r = this.generation, { plan: i, bars: a } = await this.baseBarsWithZone(e, t, async (i) => {
|
|
23327
|
-
let a = this.baseBarsFor(t, i, n), o = await this.inner.fetchHistory(e, i, Math.min(a,
|
|
23355
|
+
let a = this.baseBarsFor(t, i, n), o = await this.inner.fetchHistory(e, i, Math.min(a, iT));
|
|
23328
23356
|
return this.extendBack(e, i, o, a, r);
|
|
23329
23357
|
});
|
|
23330
23358
|
return this.rememberTail(e, t, a, i), this.toTarget(a, t, n, i);
|
|
@@ -23342,7 +23370,7 @@ var _T = class {
|
|
|
23342
23370
|
this.unsubscribe.length = 0, this.listeners.clear(), this.inner.dispose();
|
|
23343
23371
|
}
|
|
23344
23372
|
bucketFor(e, t) {
|
|
23345
|
-
let n =
|
|
23373
|
+
let n = mT(t, this.baseTimeframes);
|
|
23346
23374
|
return n === null || n === t ? null : { ...this.planFor(t, this.keptZone(e)).bucket };
|
|
23347
23375
|
}
|
|
23348
23376
|
waitsForZone(e) {
|
|
@@ -23360,7 +23388,7 @@ var _T = class {
|
|
|
23360
23388
|
async zoneFor(e) {
|
|
23361
23389
|
if (this.zones.has(e)) return this.keptZone(e);
|
|
23362
23390
|
let t, n = new Promise((e) => {
|
|
23363
|
-
t = setTimeout(() => e(),
|
|
23391
|
+
t = setTimeout(() => e(), sT);
|
|
23364
23392
|
});
|
|
23365
23393
|
try {
|
|
23366
23394
|
await Promise.race([this.resolveShared(e), n]);
|
|
@@ -23389,7 +23417,7 @@ var _T = class {
|
|
|
23389
23417
|
}) : this.zones.has(e) || this.zones.set(e, r);
|
|
23390
23418
|
}
|
|
23391
23419
|
planFor(e, t) {
|
|
23392
|
-
let n = this.baseFor(e), r = t !== void 0 && n !== e && Et(e) ?
|
|
23420
|
+
let n = this.baseFor(e), r = t !== void 0 && n !== e && Et(e) ? mT(e, this.baseTimeframes, t) : null, i = r ?? n, a = r ? t : void 0;
|
|
23393
23421
|
return {
|
|
23394
23422
|
base: i,
|
|
23395
23423
|
zone: a,
|
|
@@ -23403,7 +23431,7 @@ var _T = class {
|
|
|
23403
23431
|
let i = this.inner.fetchHistoryBefore.bind(this.inner);
|
|
23404
23432
|
if (this.baseFor(t) === t) return i(e, t, n, r);
|
|
23405
23433
|
let a = this.generation, { plan: o, bars: s } = await this.baseBarsWithZone(e, t, async (o) => {
|
|
23406
|
-
let s = this.baseBarsFor(t, o, r), c = await i(e, o, n, Math.min(s,
|
|
23434
|
+
let s = this.baseBarsFor(t, o, r), c = await i(e, o, n, Math.min(s, iT));
|
|
23407
23435
|
return this.extendBack(e, o, c.filter((e) => e.time < n), s, a, 1);
|
|
23408
23436
|
});
|
|
23409
23437
|
return this.toTarget(s, t, r, o);
|
|
@@ -23430,7 +23458,7 @@ var _T = class {
|
|
|
23430
23458
|
async extendBack(e, t, n, r, i, a = 1) {
|
|
23431
23459
|
let o = this.inner.fetchHistoryBefore?.bind(this.inner), s = n, c = a;
|
|
23432
23460
|
for (; o && s.length > 0 && s.length < r && c < 10 && i === this.generation;) {
|
|
23433
|
-
let n = s[0].time, i = await o(e, t, n, Math.min(r - s.length,
|
|
23461
|
+
let n = s[0].time, i = await o(e, t, n, Math.min(r - s.length, iT));
|
|
23434
23462
|
c++;
|
|
23435
23463
|
let a = i.filter((e) => e.time < n);
|
|
23436
23464
|
if (a.length === 0) break;
|
|
@@ -23483,19 +23511,19 @@ var _T = class {
|
|
|
23483
23511
|
this.bucket = i, this.parts.set(n.time, n);
|
|
23484
23512
|
let a = this.composed();
|
|
23485
23513
|
if (!a) return;
|
|
23486
|
-
let o = Tt(
|
|
23514
|
+
let o = Tt(gT(n.time, t.base, t.zone), t.target, t.bucket), s = r && o !== i;
|
|
23487
23515
|
this.emit("bar", {
|
|
23488
23516
|
bar: a,
|
|
23489
23517
|
closed: s
|
|
23490
23518
|
}), s && (this.keepClosed(), this.resetBucket(), this.bucket = o);
|
|
23491
23519
|
}
|
|
23492
23520
|
composed() {
|
|
23493
|
-
return this.bucket === null || this.parts.size === 0 ? null :
|
|
23521
|
+
return this.bucket === null || this.parts.size === 0 ? null : vT(this.bucket, this.parts);
|
|
23494
23522
|
}
|
|
23495
23523
|
correctClosed(e, t) {
|
|
23496
23524
|
let n = this.closedBuckets.get(e);
|
|
23497
23525
|
n && (n.set(t.time, t), this.emit("bar", {
|
|
23498
|
-
bar:
|
|
23526
|
+
bar: vT(e, n),
|
|
23499
23527
|
closed: !0
|
|
23500
23528
|
}));
|
|
23501
23529
|
}
|
|
@@ -23525,7 +23553,7 @@ var _T = class {
|
|
|
23525
23553
|
};
|
|
23526
23554
|
for (let e of n) e(r);
|
|
23527
23555
|
}
|
|
23528
|
-
},
|
|
23556
|
+
}, bT = 1e3, xT = 15e3, ST = [
|
|
23529
23557
|
"tick",
|
|
23530
23558
|
"bar",
|
|
23531
23559
|
"barClose",
|
|
@@ -23533,7 +23561,7 @@ var _T = class {
|
|
|
23533
23561
|
"connectionChange",
|
|
23534
23562
|
"error",
|
|
23535
23563
|
"symbolInfo"
|
|
23536
|
-
],
|
|
23564
|
+
], CT = class {
|
|
23537
23565
|
bar = null;
|
|
23538
23566
|
count = 0;
|
|
23539
23567
|
lastTime = -Infinity;
|
|
@@ -23574,7 +23602,7 @@ var _T = class {
|
|
|
23574
23602
|
build(e) {
|
|
23575
23603
|
return this.bar = null, this.count = 0, this.lastTime = -Infinity, this.push(e).map((e) => e.bar);
|
|
23576
23604
|
}
|
|
23577
|
-
},
|
|
23605
|
+
}, wT = class {
|
|
23578
23606
|
name;
|
|
23579
23607
|
supportedTimeframes;
|
|
23580
23608
|
searchSymbols;
|
|
@@ -23591,14 +23619,14 @@ var _T = class {
|
|
|
23591
23619
|
state = "disconnected";
|
|
23592
23620
|
constructor(e) {
|
|
23593
23621
|
this.inner = e, this.name = e.name, this.supportedTimeframes = e.supportedTimeframes, e.searchSymbols && (this.searchSymbols = e.searchSymbols.bind(e)), e.resolveSymbol && (this.resolveSymbol = e.resolveSymbol.bind(e)), e.subscribeQuotes && (this.subscribeQuotes = e.subscribeQuotes.bind(e)), e.fetchNews && (this.fetchNews = e.fetchNews.bind(e)), this.fetchTrades = e.fetchTrades.bind(e), this.subscribeTrades = e.subscribeTrades.bind(e);
|
|
23594
|
-
for (let t of
|
|
23622
|
+
for (let t of ST) e.on(t, (e) => {
|
|
23595
23623
|
this.tickMode || this.emit(t, e.data);
|
|
23596
23624
|
});
|
|
23597
23625
|
}
|
|
23598
23626
|
async fetchHistory(e, t, n) {
|
|
23599
23627
|
let r = St(t);
|
|
23600
23628
|
if (r === null) return this.inner.fetchHistory(e, t, n);
|
|
23601
|
-
let i = (await this.inner.fetchTrades(e,
|
|
23629
|
+
let i = (await this.inner.fetchTrades(e, bT)).filter(OT).sort((e, t) => e.time - t.time), a = new CT(r), o = a.build(i);
|
|
23602
23630
|
return this.tick = {
|
|
23603
23631
|
symbol: e,
|
|
23604
23632
|
builder: a,
|
|
@@ -23618,11 +23646,11 @@ var _T = class {
|
|
|
23618
23646
|
this.tickMode = !0;
|
|
23619
23647
|
let n = this.tick?.symbol === e.symbol ? this.tick : {
|
|
23620
23648
|
symbol: e.symbol,
|
|
23621
|
-
builder: new
|
|
23649
|
+
builder: new CT(t),
|
|
23622
23650
|
after: -Infinity
|
|
23623
23651
|
};
|
|
23624
23652
|
this.tick = n, this.stopTrades = this.inner.subscribeTrades(e.symbol, (e) => {
|
|
23625
|
-
let t = e.filter((e) =>
|
|
23653
|
+
let t = e.filter((e) => OT(e) && e.time >= n.after);
|
|
23626
23654
|
for (let { bar: e, closed: r } of n.builder.push(t)) this.emit("bar", {
|
|
23627
23655
|
bar: e,
|
|
23628
23656
|
closed: r
|
|
@@ -23631,7 +23659,7 @@ var _T = class {
|
|
|
23631
23659
|
price: e.close,
|
|
23632
23660
|
volume: e.volume
|
|
23633
23661
|
});
|
|
23634
|
-
}), this.state = "connected", this.emit("connectionChange", "connected"), this.keepAlive = setInterval(() => this.emit("connectionChange", "connected"),
|
|
23662
|
+
}), this.state = "connected", this.emit("connectionChange", "connected"), this.keepAlive = setInterval(() => this.emit("connectionChange", "connected"), xT);
|
|
23635
23663
|
}
|
|
23636
23664
|
disconnect() {
|
|
23637
23665
|
this.tickMode ? (this.stopTrades?.(), this.stopTrades = null, this.keepAlive && clearInterval(this.keepAlive), this.keepAlive = null, this.state = "disconnected") : this.inner.disconnect();
|
|
@@ -23659,41 +23687,41 @@ var _T = class {
|
|
|
23659
23687
|
};
|
|
23660
23688
|
for (let e of n) e(r);
|
|
23661
23689
|
}
|
|
23662
|
-
},
|
|
23663
|
-
function
|
|
23664
|
-
if (e instanceof
|
|
23665
|
-
let t =
|
|
23666
|
-
return t || (t = new
|
|
23690
|
+
}, TT = /* @__PURE__ */ new WeakMap();
|
|
23691
|
+
function ET(e) {
|
|
23692
|
+
if (e instanceof wT || !DT(e)) return e;
|
|
23693
|
+
let t = TT.get(e);
|
|
23694
|
+
return t || (t = new wT(e), TT.set(e, t)), t;
|
|
23667
23695
|
}
|
|
23668
|
-
function
|
|
23696
|
+
function DT(e) {
|
|
23669
23697
|
return typeof e.fetchTrades == "function" && typeof e.subscribeTrades == "function";
|
|
23670
23698
|
}
|
|
23671
|
-
function
|
|
23699
|
+
function OT(e) {
|
|
23672
23700
|
return Number.isFinite(e?.time) && Number.isFinite(e?.price) && Number.isFinite(e?.volume);
|
|
23673
23701
|
}
|
|
23674
23702
|
//#endregion
|
|
23675
23703
|
//#region src/realtime/feeds/feedAdapter.ts
|
|
23676
|
-
var
|
|
23677
|
-
function kT(e) {
|
|
23678
|
-
return OT.has(e);
|
|
23679
|
-
}
|
|
23680
|
-
var AT = (e, t) => `${e}\u0000${t}`;
|
|
23704
|
+
var kT = Symbol("tradecanvas.sourceAdapter"), AT = /* @__PURE__ */ new WeakSet();
|
|
23681
23705
|
function jT(e) {
|
|
23706
|
+
return AT.has(e);
|
|
23707
|
+
}
|
|
23708
|
+
var MT = (e, t) => `${e}\u0000${t}`;
|
|
23709
|
+
function NT(e) {
|
|
23682
23710
|
return typeof e.getBars == "function" && typeof e.subscribeBars == "function";
|
|
23683
23711
|
}
|
|
23684
|
-
function
|
|
23712
|
+
function PT(e) {
|
|
23685
23713
|
if (e.adapter && e.feed) throw TypeError("A stream takes an adapter or a feed, not both");
|
|
23686
23714
|
if (e.adapter) return e.adapter;
|
|
23687
|
-
if (e.feed) return
|
|
23715
|
+
if (e.feed) return LT(e.feed);
|
|
23688
23716
|
throw TypeError("A stream needs an adapter or a feed");
|
|
23689
23717
|
}
|
|
23690
|
-
function
|
|
23718
|
+
function FT(e, t, n) {
|
|
23691
23719
|
for (let r of n) {
|
|
23692
23720
|
let n = t[r];
|
|
23693
23721
|
typeof n == "function" && (e[r] = n.bind(t));
|
|
23694
23722
|
}
|
|
23695
23723
|
}
|
|
23696
|
-
var
|
|
23724
|
+
var IT = [
|
|
23697
23725
|
"resolveSymbol",
|
|
23698
23726
|
"searchSymbols",
|
|
23699
23727
|
"subscribeQuotes",
|
|
@@ -23701,13 +23729,13 @@ var PT = [
|
|
|
23701
23729
|
"fetchTrades",
|
|
23702
23730
|
"subscribeTrades"
|
|
23703
23731
|
];
|
|
23704
|
-
function
|
|
23705
|
-
let t = e[
|
|
23732
|
+
function LT(e) {
|
|
23733
|
+
let t = e[kT];
|
|
23706
23734
|
if (t) return t;
|
|
23707
|
-
let n = new
|
|
23708
|
-
return
|
|
23735
|
+
let n = new RT(e);
|
|
23736
|
+
return AT.add(n), n;
|
|
23709
23737
|
}
|
|
23710
|
-
var
|
|
23738
|
+
var RT = class {
|
|
23711
23739
|
name;
|
|
23712
23740
|
supportedTimeframes;
|
|
23713
23741
|
fetchHistoryBefore;
|
|
@@ -23723,7 +23751,7 @@ var IT = class {
|
|
|
23723
23751
|
countBack: r,
|
|
23724
23752
|
before: n,
|
|
23725
23753
|
signal: this.signalFor(e, t)
|
|
23726
|
-
})),
|
|
23754
|
+
})), FT(this, e, IT);
|
|
23727
23755
|
}
|
|
23728
23756
|
fetchHistory(e, t, n = 500) {
|
|
23729
23757
|
return this.feed.getBars({
|
|
@@ -23734,7 +23762,7 @@ var IT = class {
|
|
|
23734
23762
|
});
|
|
23735
23763
|
}
|
|
23736
23764
|
fetchStreamHistory(e, t) {
|
|
23737
|
-
return this.streamed =
|
|
23765
|
+
return this.streamed = MT(e.symbol, e.timeframe), this.fetchHistory(e.symbol, e.timeframe, t);
|
|
23738
23766
|
}
|
|
23739
23767
|
connect(e) {
|
|
23740
23768
|
this.subscribe({
|
|
@@ -23743,7 +23771,7 @@ var IT = class {
|
|
|
23743
23771
|
});
|
|
23744
23772
|
}
|
|
23745
23773
|
subscribe(e, t) {
|
|
23746
|
-
this.stopSubscription(), this.streamed =
|
|
23774
|
+
this.stopSubscription(), this.streamed = MT(e.symbol, e.timeframe);
|
|
23747
23775
|
let n = !0, r = !1, i = null;
|
|
23748
23776
|
this.unsubscribe = () => {
|
|
23749
23777
|
n = !1, i?.();
|
|
@@ -23793,7 +23821,7 @@ var IT = class {
|
|
|
23793
23821
|
this.disconnect(), this.listeners.clear();
|
|
23794
23822
|
}
|
|
23795
23823
|
signalFor(e, t) {
|
|
23796
|
-
let n =
|
|
23824
|
+
let n = MT(e, t), r = this.requests.get(n);
|
|
23797
23825
|
return r || (r = new AbortController(), this.requests.set(n, r)), r.signal;
|
|
23798
23826
|
}
|
|
23799
23827
|
stopSubscription() {
|
|
@@ -23812,18 +23840,18 @@ var IT = class {
|
|
|
23812
23840
|
for (let t of [...this.listeners.get(e) ?? []]) t(n);
|
|
23813
23841
|
}
|
|
23814
23842
|
};
|
|
23815
|
-
function
|
|
23843
|
+
function zT(e) {
|
|
23816
23844
|
let t = {
|
|
23817
23845
|
name: e.name,
|
|
23818
23846
|
...e.supportedTimeframes ? { supportedTimeframes: e.supportedTimeframes } : {},
|
|
23819
23847
|
pagesBack: typeof e.fetchHistoryBefore == "function",
|
|
23820
23848
|
getBars: async ({ symbol: t, timeframe: n, countBack: r, before: i }) => i === void 0 ? e.fetchHistory(t, n, r) : e.fetchHistoryBefore ? e.fetchHistoryBefore(t, n, i, r) : [],
|
|
23821
|
-
subscribeBars: (t, n) =>
|
|
23822
|
-
[
|
|
23849
|
+
subscribeBars: (t, n) => BT(e, t, n),
|
|
23850
|
+
[kT]: e
|
|
23823
23851
|
};
|
|
23824
|
-
return
|
|
23852
|
+
return FT(t, e, IT), t;
|
|
23825
23853
|
}
|
|
23826
|
-
function
|
|
23854
|
+
function BT(e, t, n) {
|
|
23827
23855
|
let r = [
|
|
23828
23856
|
["bar", (e) => {
|
|
23829
23857
|
let { bar: t, closed: r } = e.data;
|
|
@@ -23843,11 +23871,11 @@ function RT(e, t, n) {
|
|
|
23843
23871
|
e.disconnect();
|
|
23844
23872
|
};
|
|
23845
23873
|
}
|
|
23846
|
-
function
|
|
23847
|
-
let t =
|
|
23848
|
-
return a instanceof
|
|
23874
|
+
function VT(e) {
|
|
23875
|
+
let t = PT(e), n = !jT(t), r = pT(t), i = r instanceof yT ? r : null, a = ET(r);
|
|
23876
|
+
return a instanceof RT ? new HT(a, i, n) : new UT(a, i, n);
|
|
23849
23877
|
}
|
|
23850
|
-
var
|
|
23878
|
+
var HT = class {
|
|
23851
23879
|
subscriber = null;
|
|
23852
23880
|
constructor(e, t, n) {
|
|
23853
23881
|
this.adapter = e, this.resampler = t, this.watchSilence = n;
|
|
@@ -23867,7 +23895,7 @@ var BT = class {
|
|
|
23867
23895
|
release() {
|
|
23868
23896
|
this.subscriber = null;
|
|
23869
23897
|
}
|
|
23870
|
-
},
|
|
23898
|
+
}, UT = class {
|
|
23871
23899
|
unlisten = [];
|
|
23872
23900
|
constructor(e, t, n) {
|
|
23873
23901
|
this.adapter = e, this.resampler = t, this.watchSilence = n;
|
|
@@ -23900,8 +23928,8 @@ var BT = class {
|
|
|
23900
23928
|
hear(e, t) {
|
|
23901
23929
|
this.adapter.on(e, t), this.unlisten.push(() => this.adapter.off(e, t));
|
|
23902
23930
|
}
|
|
23903
|
-
},
|
|
23904
|
-
function
|
|
23931
|
+
}, WT = 2e4, GT = 6e4, KT = 3e4, qT = 500, JT = 864e5;
|
|
23932
|
+
function YT(e, t) {
|
|
23905
23933
|
if (!t) return e;
|
|
23906
23934
|
let { time: n, open: r, high: i, low: a, close: o, volume: s } = t;
|
|
23907
23935
|
return [...e, {
|
|
@@ -23913,15 +23941,15 @@ function qT(e, t) {
|
|
|
23913
23941
|
volume: s
|
|
23914
23942
|
}];
|
|
23915
23943
|
}
|
|
23916
|
-
function
|
|
23944
|
+
function XT(e, t, n) {
|
|
23917
23945
|
return Tt(e, t, { timeZone: n }) === e && Tt(e, t) !== e;
|
|
23918
23946
|
}
|
|
23919
|
-
var
|
|
23947
|
+
var ZT = class extends Zw {
|
|
23920
23948
|
config = null;
|
|
23921
23949
|
source = null;
|
|
23922
23950
|
aggregator = null;
|
|
23923
23951
|
reconnector;
|
|
23924
|
-
priceLine = new
|
|
23952
|
+
priceLine = new rT();
|
|
23925
23953
|
state = "disconnected";
|
|
23926
23954
|
lastPrice = null;
|
|
23927
23955
|
previousClose = null;
|
|
@@ -23933,15 +23961,15 @@ var YT = class extends Yw {
|
|
|
23933
23961
|
timeZone = null;
|
|
23934
23962
|
historyEnd = null;
|
|
23935
23963
|
constructor() {
|
|
23936
|
-
super(), this.reconnector = new
|
|
23964
|
+
super(), this.reconnector = new tT(), this.wireReconnector();
|
|
23937
23965
|
}
|
|
23938
23966
|
async connect(e) {
|
|
23939
23967
|
this.disconnect();
|
|
23940
|
-
let t =
|
|
23968
|
+
let t = VT(e);
|
|
23941
23969
|
t.resampler?.renewZone(e.symbol), this.config = {
|
|
23942
23970
|
...fe,
|
|
23943
23971
|
...e
|
|
23944
|
-
}, this.source = t, this.aggregator = new
|
|
23972
|
+
}, this.source = t, this.aggregator = new eT(e.timeframe), this.historyEnd = null, this.applyTickZone(), this.reconnector.removeAllListeners(), this.reconnector.stop(), this.reconnector = new tT(e.reconnect ?? ue), this.wireReconnector(), this.aggregator.on("bar", (e) => {
|
|
23945
23973
|
this.emit("barUpdate", e), this.updatePrice(e.close);
|
|
23946
23974
|
}), this.aggregator.on("barClose", (e) => {
|
|
23947
23975
|
this.setPreviousClose(e), this.emit("barClose", e);
|
|
@@ -23975,7 +24003,7 @@ var YT = class extends Yw {
|
|
|
23975
24003
|
applyTickZone() {
|
|
23976
24004
|
let e = this.config;
|
|
23977
24005
|
if (!this.aggregator || !e) return;
|
|
23978
|
-
let t = this.historyEnd, n = t !== null && t %
|
|
24006
|
+
let t = this.historyEnd, n = t !== null && t % JT === 0, r = this.source?.resampler?.bucketFor(e.symbol, e.timeframe);
|
|
23979
24007
|
if (r) {
|
|
23980
24008
|
let e = r.dates === !0 && n;
|
|
23981
24009
|
this.aggregator.setTimeZone(r.timeZone ?? (e ? this.timeZone : null), e);
|
|
@@ -23985,7 +24013,7 @@ var YT = class extends Yw {
|
|
|
23985
24013
|
}
|
|
23986
24014
|
tickZone(e, t) {
|
|
23987
24015
|
let n = this.timeZone;
|
|
23988
|
-
return n === null || Dt(e) || t !== null &&
|
|
24016
|
+
return n === null || Dt(e) || t !== null && XT(t, e, n) ? n : null;
|
|
23989
24017
|
}
|
|
23990
24018
|
async doConnect() {
|
|
23991
24019
|
if (!this.config || !this.source) return;
|
|
@@ -23995,12 +24023,12 @@ var YT = class extends Yw {
|
|
|
23995
24023
|
};
|
|
23996
24024
|
this.setState("connecting");
|
|
23997
24025
|
try {
|
|
23998
|
-
let n = await this.source.getBars(t, this.config.historyLimit ??
|
|
24026
|
+
let n = await this.source.getBars(t, this.config.historyLimit ?? qT);
|
|
23999
24027
|
if (e !== this.connectSeq || !this.source) return;
|
|
24000
24028
|
let r = n.length > 0 ? n[n.length - 1] : null;
|
|
24001
24029
|
this.historyEnd = r ? M(r.time) : null, this.applyTickZone(), this.seedAggregator(r);
|
|
24002
24030
|
let i = this.formingAfter(r);
|
|
24003
|
-
r && !i && (this.setPreviousClose(r), this.updatePrice(r.close)), this.emit("snapshot",
|
|
24031
|
+
r && !i && (this.setPreviousClose(r), this.updatePrice(r.close)), this.emit("snapshot", YT(n, i)), this.source.subscribeBars(t), this.startHeartbeat();
|
|
24004
24032
|
} catch (t) {
|
|
24005
24033
|
if (e !== this.connectSeq) return;
|
|
24006
24034
|
let n = t instanceof Error ? t.message : String(t);
|
|
@@ -24071,15 +24099,15 @@ var YT = class extends Yw {
|
|
|
24071
24099
|
}));
|
|
24072
24100
|
}
|
|
24073
24101
|
wake(e) {
|
|
24074
|
-
!this.source || !this.config || this.state === "connecting" || this.state === "disconnected" || this.state === "connected" && e === "visible" && (!this.source.watchSilence || Date.now() - this.lastMessageTime <=
|
|
24102
|
+
!this.source || !this.config || this.state === "connecting" || this.state === "disconnected" || this.state === "connected" && e === "visible" && (!this.source.watchSilence || Date.now() - this.lastMessageTime <= WT) || (this.reconnector.stop(), this.source.unsubscribe(), this.reconnector.start(), this.doConnect());
|
|
24075
24103
|
}
|
|
24076
24104
|
startHeartbeat() {
|
|
24077
24105
|
this.stopHeartbeat(), this.heartbeatTimer = setInterval(() => {
|
|
24078
|
-
this.source?.watchSilence === !0 && Date.now() - this.lastMessageTime >
|
|
24106
|
+
this.source?.watchSilence === !0 && Date.now() - this.lastMessageTime > GT && this.state === "connected" && (this.emit("error", {
|
|
24079
24107
|
message: "Heartbeat timeout",
|
|
24080
24108
|
code: "HEARTBEAT_TIMEOUT"
|
|
24081
24109
|
}), this.source?.unsubscribe(), this.reconnector.schedule(() => this.doConnect()));
|
|
24082
|
-
},
|
|
24110
|
+
}, KT);
|
|
24083
24111
|
}
|
|
24084
24112
|
stopHeartbeat() {
|
|
24085
24113
|
this.heartbeatTimer &&= (clearInterval(this.heartbeatTimer), null);
|
|
@@ -24087,7 +24115,7 @@ var YT = class extends Yw {
|
|
|
24087
24115
|
dispose() {
|
|
24088
24116
|
this.disconnect(), this.removeAllListeners();
|
|
24089
24117
|
}
|
|
24090
|
-
},
|
|
24118
|
+
}, QT = class extends Zw {
|
|
24091
24119
|
data;
|
|
24092
24120
|
speed;
|
|
24093
24121
|
index;
|
|
@@ -24174,11 +24202,11 @@ var YT = class extends Yw {
|
|
|
24174
24202
|
};
|
|
24175
24203
|
//#endregion
|
|
24176
24204
|
//#region src/realtime/adapters/binanceTypes.ts
|
|
24177
|
-
function
|
|
24205
|
+
function $T(e) {
|
|
24178
24206
|
if (!Array.isArray(e) || e.length < 6) return null;
|
|
24179
24207
|
let t = e[0];
|
|
24180
24208
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
24181
|
-
let n =
|
|
24209
|
+
let n = tE(e[1]), r = tE(e[2]), i = tE(e[3]), a = tE(e[4]), o = tE(e[5]);
|
|
24182
24210
|
return n === null || r === null || i === null || a === null || o === null ? null : {
|
|
24183
24211
|
time: t,
|
|
24184
24212
|
open: n,
|
|
@@ -24188,11 +24216,11 @@ function ZT(e) {
|
|
|
24188
24216
|
volume: o
|
|
24189
24217
|
};
|
|
24190
24218
|
}
|
|
24191
|
-
function
|
|
24192
|
-
if (!
|
|
24219
|
+
function eE(e) {
|
|
24220
|
+
if (!nE(e)) return null;
|
|
24193
24221
|
let t = e.t;
|
|
24194
24222
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
24195
|
-
let n =
|
|
24223
|
+
let n = tE(e.o), r = tE(e.h), i = tE(e.l), a = tE(e.c), o = tE(e.v);
|
|
24196
24224
|
if (n === null || r === null || i === null || a === null || o === null) return null;
|
|
24197
24225
|
let s = typeof e.x == "boolean" ? e.x : !1;
|
|
24198
24226
|
return {
|
|
@@ -24207,7 +24235,7 @@ function QT(e) {
|
|
|
24207
24235
|
closed: s
|
|
24208
24236
|
};
|
|
24209
24237
|
}
|
|
24210
|
-
function
|
|
24238
|
+
function tE(e) {
|
|
24211
24239
|
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
24212
24240
|
if (typeof e == "string") {
|
|
24213
24241
|
let t = parseFloat(e);
|
|
@@ -24215,14 +24243,14 @@ function $T(e) {
|
|
|
24215
24243
|
}
|
|
24216
24244
|
return null;
|
|
24217
24245
|
}
|
|
24218
|
-
function
|
|
24246
|
+
function nE(e) {
|
|
24219
24247
|
return typeof e == "object" && !!e;
|
|
24220
24248
|
}
|
|
24221
24249
|
function Q(e) {
|
|
24222
24250
|
let t = typeof e == "string" ? Number(e) : e;
|
|
24223
24251
|
return typeof t == "number" && Number.isFinite(t) ? t : void 0;
|
|
24224
24252
|
}
|
|
24225
|
-
function
|
|
24253
|
+
function rE(e) {
|
|
24226
24254
|
let t = e && typeof e == "object" && "data" in e ? e.data : e;
|
|
24227
24255
|
if (!t || typeof t != "object") return null;
|
|
24228
24256
|
let n = t;
|
|
@@ -24236,7 +24264,7 @@ function tE(e) {
|
|
|
24236
24264
|
time: Q(n.E)
|
|
24237
24265
|
}) : null;
|
|
24238
24266
|
}
|
|
24239
|
-
function
|
|
24267
|
+
function iE(e) {
|
|
24240
24268
|
if (!e || typeof e != "object") return null;
|
|
24241
24269
|
let t = e;
|
|
24242
24270
|
return lt({
|
|
@@ -24254,7 +24282,7 @@ function nE(e) {
|
|
|
24254
24282
|
time: Q(t.closeTime)
|
|
24255
24283
|
});
|
|
24256
24284
|
}
|
|
24257
|
-
function
|
|
24285
|
+
function aE(e) {
|
|
24258
24286
|
if (!e || typeof e != "object") return null;
|
|
24259
24287
|
let t = e, n = Q(t.T), r = Q(t.p), i = Q(t.q);
|
|
24260
24288
|
return n !== void 0 && r !== void 0 && i !== void 0 ? {
|
|
@@ -24265,25 +24293,25 @@ function rE(e) {
|
|
|
24265
24293
|
}
|
|
24266
24294
|
//#endregion
|
|
24267
24295
|
//#region src/realtime/adapters/servedHistory.ts
|
|
24268
|
-
var
|
|
24296
|
+
var oE = 64, sE = (e, t) => `${e}|${t}`, cE = class {
|
|
24269
24297
|
last = /* @__PURE__ */ new Map();
|
|
24270
24298
|
serve(e, t, n) {
|
|
24271
24299
|
if (!Array.isArray(n) || n.length === 0) return;
|
|
24272
24300
|
let r = n[n.length - 1], i = Number(r?.time);
|
|
24273
24301
|
if (!Number.isFinite(i)) return;
|
|
24274
|
-
let a =
|
|
24302
|
+
let a = sE(e, t);
|
|
24275
24303
|
this.last.delete(a), this.last.set(a, {
|
|
24276
24304
|
time: i,
|
|
24277
24305
|
close: Number(r?.close ?? NaN)
|
|
24278
|
-
}), this.last.size >
|
|
24306
|
+
}), this.last.size > oE && this.last.delete(this.last.keys().next().value);
|
|
24279
24307
|
}
|
|
24280
24308
|
lastBar(e, t) {
|
|
24281
|
-
return this.last.get(
|
|
24309
|
+
return this.last.get(sE(e, t));
|
|
24282
24310
|
}
|
|
24283
|
-
},
|
|
24311
|
+
}, lE = class {
|
|
24284
24312
|
newest = -Infinity;
|
|
24285
24313
|
servedClose = null;
|
|
24286
|
-
served = new
|
|
24314
|
+
served = new cE();
|
|
24287
24315
|
serve(e, t, n) {
|
|
24288
24316
|
this.served.serve(e, t, n);
|
|
24289
24317
|
}
|
|
@@ -24295,7 +24323,7 @@ var iE = 64, aE = (e, t) => `${e}|${t}`, oE = class {
|
|
|
24295
24323
|
let n = M(e.time);
|
|
24296
24324
|
return Number.isFinite(n) ? n < this.newest || n === this.newest && t && e.close === this.servedClose ? !1 : (this.servedClose = null, this.newest = n, !0) : !0;
|
|
24297
24325
|
}
|
|
24298
|
-
},
|
|
24326
|
+
}, uE = {
|
|
24299
24327
|
"1s": "1s",
|
|
24300
24328
|
"1m": "1m",
|
|
24301
24329
|
"3m": "3m",
|
|
@@ -24312,7 +24340,7 @@ var iE = 64, aE = (e, t) => `${e}|${t}`, oE = class {
|
|
|
24312
24340
|
"3d": "3d",
|
|
24313
24341
|
"1w": "1w",
|
|
24314
24342
|
"1M": "1M"
|
|
24315
|
-
},
|
|
24343
|
+
}, dE = 1e3, fE = 200, pE = [
|
|
24316
24344
|
"USDT",
|
|
24317
24345
|
"USDC",
|
|
24318
24346
|
"FDUSD",
|
|
@@ -24324,11 +24352,11 @@ var iE = 64, aE = (e, t) => `${e}|${t}`, oE = class {
|
|
|
24324
24352
|
"BRL",
|
|
24325
24353
|
"JPY"
|
|
24326
24354
|
];
|
|
24327
|
-
function
|
|
24328
|
-
let t = e.currency ?
|
|
24355
|
+
function mE(e) {
|
|
24356
|
+
let t = e.currency ? pE.indexOf(e.currency) : -1;
|
|
24329
24357
|
return t < 0 ? 0 : 40 - t * 3;
|
|
24330
24358
|
}
|
|
24331
|
-
function
|
|
24359
|
+
function hE(e) {
|
|
24332
24360
|
if (typeof e.symbol != "string" || e.status !== "TRADING") return null;
|
|
24333
24361
|
let t = typeof e.baseAsset == "string" ? e.baseAsset : "", n = typeof e.quoteAsset == "string" ? e.quoteAsset : "", r = Array.isArray(e.filters) ? e.filters.find((e) => typeof e == "object" && !!e && e.filterType === "PRICE_FILTER" && typeof e.tickSize == "string") : void 0, i = {
|
|
24334
24362
|
symbol: e.symbol,
|
|
@@ -24338,19 +24366,19 @@ function pE(e) {
|
|
|
24338
24366
|
};
|
|
24339
24367
|
return r && (i.pricePrecision = bt(r.tickSize), i.minTick = Number(r.tickSize)), i.timeZone = "UTC", n && (i.currency = n), i;
|
|
24340
24368
|
}
|
|
24341
|
-
function
|
|
24369
|
+
function gE(e) {
|
|
24342
24370
|
let t = e?.symbols;
|
|
24343
24371
|
if (!Array.isArray(t)) return [];
|
|
24344
24372
|
let n = [];
|
|
24345
24373
|
for (let e of t) {
|
|
24346
|
-
let t =
|
|
24374
|
+
let t = hE(e);
|
|
24347
24375
|
t && n.push(t);
|
|
24348
24376
|
}
|
|
24349
24377
|
return n;
|
|
24350
24378
|
}
|
|
24351
|
-
var
|
|
24379
|
+
var _E = class {
|
|
24352
24380
|
name = "binance";
|
|
24353
|
-
supportedTimeframes = Object.keys(
|
|
24381
|
+
supportedTimeframes = Object.keys(uE);
|
|
24354
24382
|
ws = null;
|
|
24355
24383
|
state = "disconnected";
|
|
24356
24384
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -24358,7 +24386,7 @@ var hE = class {
|
|
|
24358
24386
|
restBase;
|
|
24359
24387
|
wsBase;
|
|
24360
24388
|
symbolList = null;
|
|
24361
|
-
newestBar = new
|
|
24389
|
+
newestBar = new lE();
|
|
24362
24390
|
constructor(e) {
|
|
24363
24391
|
this.restBase = e?.restBase ?? "https://api.binance.com/api/v3", this.wsBase = e?.wsBase ?? "wss://stream.binance.com:9443/ws";
|
|
24364
24392
|
}
|
|
@@ -24380,7 +24408,7 @@ var hE = class {
|
|
|
24380
24408
|
return this.newestBar.serve(e, t, r), r;
|
|
24381
24409
|
}
|
|
24382
24410
|
async searchSymbols(e, t) {
|
|
24383
|
-
return rt(await this.loadSymbols(), e, t?.limit ?? 50,
|
|
24411
|
+
return rt(await this.loadSymbols(), e, t?.limit ?? 50, mE);
|
|
24384
24412
|
}
|
|
24385
24413
|
async resolveSymbol(e) {
|
|
24386
24414
|
if (this.symbolList) {
|
|
@@ -24388,19 +24416,19 @@ var hE = class {
|
|
|
24388
24416
|
if (t) return t;
|
|
24389
24417
|
}
|
|
24390
24418
|
let t = await fetch(`${this.restBase}/exchangeInfo?symbol=${encodeURIComponent(e)}`);
|
|
24391
|
-
return t.ok ?
|
|
24419
|
+
return t.ok ? gE(await t.json())[0] ?? null : null;
|
|
24392
24420
|
}
|
|
24393
24421
|
loadSymbols() {
|
|
24394
24422
|
return this.symbolList || (this.symbolList = (async () => {
|
|
24395
24423
|
let e = await fetch(`${this.restBase}/exchangeInfo`);
|
|
24396
24424
|
if (!e.ok) throw Error(`Binance REST error: ${e.status}`);
|
|
24397
|
-
return
|
|
24425
|
+
return gE(await e.json());
|
|
24398
24426
|
})(), this.symbolList.catch(() => {
|
|
24399
24427
|
this.symbolList = null;
|
|
24400
24428
|
})), this.symbolList;
|
|
24401
24429
|
}
|
|
24402
24430
|
subscribeQuotes(e, t) {
|
|
24403
|
-
let n = [...new Set(e.map((e) => e.trim().toUpperCase()))].filter((e) => /^[A-Z0-9]{2,30}$/.test(e)).slice(0,
|
|
24431
|
+
let n = [...new Set(e.map((e) => e.trim().toUpperCase()))].filter((e) => /^[A-Z0-9]{2,30}$/.test(e)).slice(0, fE);
|
|
24404
24432
|
if (n.length === 0) return () => {};
|
|
24405
24433
|
let r = !1, i = null, a = null, o = 0, s = /* @__PURE__ */ new Set(), c = new AbortController();
|
|
24406
24434
|
(async () => {
|
|
@@ -24412,7 +24440,7 @@ var hE = class {
|
|
|
24412
24440
|
return Array.isArray(r) ? r.filter((e) => i.has(e?.symbol)) : [];
|
|
24413
24441
|
})().then((e) => {
|
|
24414
24442
|
if (r || !Array.isArray(e)) return;
|
|
24415
|
-
let n = e.map(
|
|
24443
|
+
let n = e.map(iE).filter((e) => e !== null && !s.has(e.symbol));
|
|
24416
24444
|
n.length > 0 && t(n);
|
|
24417
24445
|
}).catch(() => {});
|
|
24418
24446
|
let l = this.wsBase.replace(/\/ws\/?$/, ""), u = () => {
|
|
@@ -24432,7 +24460,7 @@ var hE = class {
|
|
|
24432
24460
|
} catch {
|
|
24433
24461
|
return;
|
|
24434
24462
|
}
|
|
24435
|
-
let i =
|
|
24463
|
+
let i = rE(n);
|
|
24436
24464
|
!i || r || (s.add(i.symbol), t([i]));
|
|
24437
24465
|
}, i.onclose = () => {
|
|
24438
24466
|
i = null, d();
|
|
@@ -24449,7 +24477,7 @@ var hE = class {
|
|
|
24449
24477
|
let n = Math.max(1, Math.min(1e3, Math.floor(t))), r = await fetch(`${this.restBase}/aggTrades?symbol=${encodeURIComponent(e.toUpperCase())}&limit=${n}`);
|
|
24450
24478
|
if (!r.ok) throw Error(`Binance aggTrades ${r.status}`);
|
|
24451
24479
|
let i = await r.json();
|
|
24452
|
-
return Array.isArray(i) ? i.map(
|
|
24480
|
+
return Array.isArray(i) ? i.map(aE).filter((e) => e !== null) : [];
|
|
24453
24481
|
}
|
|
24454
24482
|
subscribeTrades(e, t) {
|
|
24455
24483
|
let n = `${e.trim().toLowerCase()}@aggTrade`;
|
|
@@ -24471,7 +24499,7 @@ var hE = class {
|
|
|
24471
24499
|
} catch {
|
|
24472
24500
|
return;
|
|
24473
24501
|
}
|
|
24474
|
-
let i =
|
|
24502
|
+
let i = aE(n);
|
|
24475
24503
|
i && !r && t([i]);
|
|
24476
24504
|
}, i.onclose = () => {
|
|
24477
24505
|
i = null, c();
|
|
@@ -24485,16 +24513,16 @@ var hE = class {
|
|
|
24485
24513
|
};
|
|
24486
24514
|
}
|
|
24487
24515
|
fetchHistoryBefore(e, t, n, r = 500) {
|
|
24488
|
-
return this.fetchKlines(e, t, Math.min(r,
|
|
24516
|
+
return this.fetchKlines(e, t, Math.min(r, dE), `&endTime=${Math.floor(n) - 1}`);
|
|
24489
24517
|
}
|
|
24490
24518
|
async fetchKlines(e, t, n, r) {
|
|
24491
|
-
let i =
|
|
24519
|
+
let i = uE[t] ?? "15m", a = `${this.restBase}/klines?symbol=${e}&interval=${i}&limit=${n}${r}`, o = await fetch(a);
|
|
24492
24520
|
if (!o.ok) throw Error(`Binance REST error: ${o.status}`);
|
|
24493
24521
|
let s = await o.json();
|
|
24494
24522
|
if (!Array.isArray(s)) return [];
|
|
24495
24523
|
let c = [];
|
|
24496
24524
|
for (let e of s) {
|
|
24497
|
-
let t =
|
|
24525
|
+
let t = $T(e);
|
|
24498
24526
|
t && c.push(t);
|
|
24499
24527
|
}
|
|
24500
24528
|
return c;
|
|
@@ -24511,7 +24539,7 @@ var hE = class {
|
|
|
24511
24539
|
}
|
|
24512
24540
|
connectWs() {
|
|
24513
24541
|
if (!this.config) return;
|
|
24514
|
-
let e = `${this.config.symbol.toLowerCase()}@kline_${
|
|
24542
|
+
let e = `${this.config.symbol.toLowerCase()}@kline_${uE[this.config.timeframe] ?? "15m"}`, t = `${this.wsBase}/${e}`;
|
|
24515
24543
|
this.setState("connecting");
|
|
24516
24544
|
try {
|
|
24517
24545
|
this.ws = new WebSocket(t);
|
|
@@ -24536,7 +24564,7 @@ var hE = class {
|
|
|
24536
24564
|
};
|
|
24537
24565
|
}
|
|
24538
24566
|
handleKline(e) {
|
|
24539
|
-
let t =
|
|
24567
|
+
let t = eE(e);
|
|
24540
24568
|
if (!t) return;
|
|
24541
24569
|
let { bar: n, closed: r } = t, i = this.newestBar.admit(n, r);
|
|
24542
24570
|
this.emitEvent("bar", {
|
|
@@ -24562,7 +24590,7 @@ var hE = class {
|
|
|
24562
24590
|
for (let e of n) e(r);
|
|
24563
24591
|
}
|
|
24564
24592
|
}
|
|
24565
|
-
},
|
|
24593
|
+
}, vE = class {
|
|
24566
24594
|
name = "mock";
|
|
24567
24595
|
state = "disconnected";
|
|
24568
24596
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -24593,7 +24621,7 @@ var hE = class {
|
|
|
24593
24621
|
}
|
|
24594
24622
|
subscribeQuotes(e, t) {
|
|
24595
24623
|
let n = [...new Set(e)].map((e) => {
|
|
24596
|
-
let t = this.options.basePrice * (.5 +
|
|
24624
|
+
let t = this.options.basePrice * (.5 + yE(e) % 1e3 / 1e3);
|
|
24597
24625
|
return {
|
|
24598
24626
|
symbol: e,
|
|
24599
24627
|
open: t,
|
|
@@ -24623,7 +24651,7 @@ var hE = class {
|
|
|
24623
24651
|
return () => clearInterval(a);
|
|
24624
24652
|
}
|
|
24625
24653
|
async fetchTrades(e, t = 1e3) {
|
|
24626
|
-
let n = Math.max(1, Math.min(1e3, Math.floor(t))), r = Date.now(), i = this.options.volatility / 1e3, a = this.options.basePrice * (.5 +
|
|
24654
|
+
let n = Math.max(1, Math.min(1e3, Math.floor(t))), r = Date.now(), i = this.options.volatility / 1e3, a = this.options.basePrice * (.5 + yE(e) % 1e3 / 1e3), o = [];
|
|
24627
24655
|
for (let e = n - 1; e >= 0; e--) a = Math.max(a * .5, a * (1 + (Math.random() - .5) * i)), o.push({
|
|
24628
24656
|
time: r - e * 1e3,
|
|
24629
24657
|
price: a,
|
|
@@ -24632,7 +24660,7 @@ var hE = class {
|
|
|
24632
24660
|
return o;
|
|
24633
24661
|
}
|
|
24634
24662
|
subscribeTrades(e, t) {
|
|
24635
|
-
let n = this.options.volatility / 1e3, r = this.options.basePrice * (.5 +
|
|
24663
|
+
let n = this.options.volatility / 1e3, r = this.options.basePrice * (.5 + yE(e) % 1e3 / 1e3), i = setInterval(() => {
|
|
24636
24664
|
let e = [];
|
|
24637
24665
|
for (let t = 0; t < 3; t++) r = Math.max(r * .5, r * (1 + (Math.random() - .5) * n)), e.push({
|
|
24638
24666
|
time: Date.now(),
|
|
@@ -24751,14 +24779,14 @@ var hE = class {
|
|
|
24751
24779
|
}
|
|
24752
24780
|
}
|
|
24753
24781
|
};
|
|
24754
|
-
function
|
|
24782
|
+
function yE(e) {
|
|
24755
24783
|
let t = 0;
|
|
24756
24784
|
for (let n = 0; n < e.length; n++) t = t * 31 + e.charCodeAt(n) >>> 0;
|
|
24757
24785
|
return t;
|
|
24758
24786
|
}
|
|
24759
24787
|
//#endregion
|
|
24760
24788
|
//#region src/realtime/adapters/WebSocketAdapter.ts
|
|
24761
|
-
var
|
|
24789
|
+
var bE = class {
|
|
24762
24790
|
name;
|
|
24763
24791
|
supportedTimeframes;
|
|
24764
24792
|
ws = null;
|
|
@@ -24766,7 +24794,7 @@ var vE = class {
|
|
|
24766
24794
|
config = null;
|
|
24767
24795
|
listeners = /* @__PURE__ */ new Map();
|
|
24768
24796
|
opts;
|
|
24769
|
-
newestBar = new
|
|
24797
|
+
newestBar = new lE();
|
|
24770
24798
|
fetchHistoryBefore;
|
|
24771
24799
|
searchSymbols;
|
|
24772
24800
|
resolveSymbol;
|
|
@@ -24883,7 +24911,7 @@ var vE = class {
|
|
|
24883
24911
|
for (let e of n) e(r);
|
|
24884
24912
|
}
|
|
24885
24913
|
}
|
|
24886
|
-
},
|
|
24914
|
+
}, xE = class {
|
|
24887
24915
|
name;
|
|
24888
24916
|
supportedTimeframes;
|
|
24889
24917
|
state = "disconnected";
|
|
@@ -24891,7 +24919,7 @@ var vE = class {
|
|
|
24891
24919
|
config = null;
|
|
24892
24920
|
timer = null;
|
|
24893
24921
|
lastBarTime = 0;
|
|
24894
|
-
served = new
|
|
24922
|
+
served = new cE();
|
|
24895
24923
|
opts;
|
|
24896
24924
|
fetchHistoryBefore;
|
|
24897
24925
|
searchSymbols;
|
|
@@ -24989,12 +25017,12 @@ function $(e) {
|
|
|
24989
25017
|
}
|
|
24990
25018
|
return null;
|
|
24991
25019
|
}
|
|
24992
|
-
function
|
|
25020
|
+
function SE(e) {
|
|
24993
25021
|
return typeof e == "object" && !!e;
|
|
24994
25022
|
}
|
|
24995
25023
|
//#endregion
|
|
24996
25024
|
//#region src/realtime/adapters/CoinbaseAdapter.ts
|
|
24997
|
-
var
|
|
25025
|
+
var CE = {
|
|
24998
25026
|
"1m": 60,
|
|
24999
25027
|
"5m": 300,
|
|
25000
25028
|
"15m": 900,
|
|
@@ -25002,36 +25030,36 @@ var xE = {
|
|
|
25002
25030
|
"6h": 21600,
|
|
25003
25031
|
"1d": 86400
|
|
25004
25032
|
};
|
|
25005
|
-
function
|
|
25006
|
-
return
|
|
25033
|
+
function wE(e) {
|
|
25034
|
+
return CE[e] ?? 3600;
|
|
25007
25035
|
}
|
|
25008
|
-
var
|
|
25036
|
+
var TE = class extends xE {
|
|
25009
25037
|
constructor(e = {}) {
|
|
25010
25038
|
let t = e.restBase ?? "https://api.exchange.coinbase.com";
|
|
25011
25039
|
super({
|
|
25012
25040
|
name: "coinbase",
|
|
25013
|
-
supportedTimeframes: Object.keys(
|
|
25041
|
+
supportedTimeframes: Object.keys(CE),
|
|
25014
25042
|
intervalMs: e.intervalMs ?? 5e3,
|
|
25015
25043
|
pollLimit: 2,
|
|
25016
|
-
fetchBars: (e, n) =>
|
|
25044
|
+
fetchBars: (e, n) => EE(t, e, n)
|
|
25017
25045
|
});
|
|
25018
25046
|
}
|
|
25019
25047
|
};
|
|
25020
|
-
async function
|
|
25021
|
-
let r = `${e}/products/${t}/candles?granularity=${
|
|
25048
|
+
async function EE(e, t, n) {
|
|
25049
|
+
let r = `${e}/products/${t}/candles?granularity=${wE(n)}`, i = await fetch(r);
|
|
25022
25050
|
if (!i.ok) throw Error(`Coinbase REST error: ${i.status}`);
|
|
25023
|
-
return
|
|
25051
|
+
return DE(await i.json());
|
|
25024
25052
|
}
|
|
25025
|
-
function
|
|
25053
|
+
function DE(e) {
|
|
25026
25054
|
if (!Array.isArray(e)) return [];
|
|
25027
25055
|
let t = [];
|
|
25028
25056
|
for (let n of e) {
|
|
25029
|
-
let e =
|
|
25057
|
+
let e = OE(n);
|
|
25030
25058
|
e && t.push(e);
|
|
25031
25059
|
}
|
|
25032
25060
|
return t.sort((e, t) => e.time - t.time), t;
|
|
25033
25061
|
}
|
|
25034
|
-
function
|
|
25062
|
+
function OE(e) {
|
|
25035
25063
|
if (!Array.isArray(e) || e.length < 6) return null;
|
|
25036
25064
|
let t = $(e[0]), n = $(e[1]), r = $(e[2]), i = $(e[3]), a = $(e[4]), o = $(e[5]);
|
|
25037
25065
|
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
@@ -25045,7 +25073,7 @@ function EE(e) {
|
|
|
25045
25073
|
}
|
|
25046
25074
|
//#endregion
|
|
25047
25075
|
//#region src/realtime/adapters/BybitAdapter.ts
|
|
25048
|
-
var
|
|
25076
|
+
var kE = {
|
|
25049
25077
|
"1m": "1",
|
|
25050
25078
|
"3m": "3",
|
|
25051
25079
|
"5m": "5",
|
|
@@ -25060,10 +25088,10 @@ var DE = {
|
|
|
25060
25088
|
"1w": "W",
|
|
25061
25089
|
"1M": "M"
|
|
25062
25090
|
};
|
|
25063
|
-
function
|
|
25064
|
-
return
|
|
25091
|
+
function AE(e) {
|
|
25092
|
+
return kE[e] ?? "1";
|
|
25065
25093
|
}
|
|
25066
|
-
var
|
|
25094
|
+
var jE = class extends bE {
|
|
25067
25095
|
constructor(e = {}) {
|
|
25068
25096
|
let t = e.restBase ?? "https://api.bybit.com", n = e.wsBase ?? "wss://stream.bybit.com/v5/public/spot", r = e.category ?? "spot";
|
|
25069
25097
|
super({
|
|
@@ -25071,25 +25099,25 @@ var kE = class extends vE {
|
|
|
25071
25099
|
wsUrl: () => n,
|
|
25072
25100
|
subscribeMessage: (e) => ({
|
|
25073
25101
|
op: "subscribe",
|
|
25074
|
-
args: [`kline.${
|
|
25102
|
+
args: [`kline.${AE(e.timeframe)}.${e.symbol}`]
|
|
25075
25103
|
}),
|
|
25076
25104
|
unsubscribeMessage: (e) => ({
|
|
25077
25105
|
op: "unsubscribe",
|
|
25078
|
-
args: [`kline.${
|
|
25106
|
+
args: [`kline.${AE(e.timeframe)}.${e.symbol}`]
|
|
25079
25107
|
}),
|
|
25080
|
-
supportedTimeframes: Object.keys(
|
|
25081
|
-
parseMessage:
|
|
25082
|
-
fetchHistory: (e, n, i) =>
|
|
25083
|
-
fetchHistoryBefore: (e, n, i, a) =>
|
|
25108
|
+
supportedTimeframes: Object.keys(kE),
|
|
25109
|
+
parseMessage: ME,
|
|
25110
|
+
fetchHistory: (e, n, i) => NE(t, r, e, n, i),
|
|
25111
|
+
fetchHistoryBefore: (e, n, i, a) => NE(t, r, e, n, a, Math.floor(i) - 1)
|
|
25084
25112
|
});
|
|
25085
25113
|
}
|
|
25086
25114
|
};
|
|
25087
|
-
function
|
|
25088
|
-
if (!
|
|
25115
|
+
function ME(e) {
|
|
25116
|
+
if (!SE(e) || typeof e.topic != "string" || !e.topic.startsWith("kline.")) return null;
|
|
25089
25117
|
let t = e.data;
|
|
25090
25118
|
if (!Array.isArray(t) || t.length === 0) return null;
|
|
25091
25119
|
let n = t[t.length - 1];
|
|
25092
|
-
if (!
|
|
25120
|
+
if (!SE(n)) return null;
|
|
25093
25121
|
let r = $(n.start), i = $(n.open), a = $(n.high), o = $(n.low), s = $(n.close), c = $(n.volume);
|
|
25094
25122
|
if (r === null || i === null || a === null || o === null || s === null || c === null) return null;
|
|
25095
25123
|
let l = typeof n.confirm == "boolean" ? n.confirm : !1;
|
|
@@ -25105,23 +25133,23 @@ function AE(e) {
|
|
|
25105
25133
|
closed: l
|
|
25106
25134
|
};
|
|
25107
25135
|
}
|
|
25108
|
-
async function
|
|
25109
|
-
let o = `${e}/v5/market/kline?category=${t}&symbol=${n}&interval=${
|
|
25136
|
+
async function NE(e, t, n, r, i, a) {
|
|
25137
|
+
let o = `${e}/v5/market/kline?category=${t}&symbol=${n}&interval=${AE(r)}&limit=${Math.min(Math.max(i, 1), 1e3)}${a === void 0 ? "" : `&end=${a}`}`, s = await fetch(o);
|
|
25110
25138
|
if (!s.ok) throw Error(`Bybit REST error: ${s.status}`);
|
|
25111
|
-
return
|
|
25139
|
+
return PE(await s.json());
|
|
25112
25140
|
}
|
|
25113
|
-
function
|
|
25114
|
-
if (!
|
|
25141
|
+
function PE(e) {
|
|
25142
|
+
if (!SE(e) || !SE(e.result)) return [];
|
|
25115
25143
|
let t = e.result.list;
|
|
25116
25144
|
if (!Array.isArray(t)) return [];
|
|
25117
25145
|
let n = [];
|
|
25118
25146
|
for (let e of t) {
|
|
25119
|
-
let t =
|
|
25147
|
+
let t = FE(e);
|
|
25120
25148
|
t && n.push(t);
|
|
25121
25149
|
}
|
|
25122
25150
|
return n.sort((e, t) => e.time - t.time), n;
|
|
25123
25151
|
}
|
|
25124
|
-
function
|
|
25152
|
+
function FE(e) {
|
|
25125
25153
|
if (!Array.isArray(e) || e.length < 6) return null;
|
|
25126
25154
|
let t = $(e[0]), n = $(e[1]), r = $(e[2]), i = $(e[3]), a = $(e[4]), o = $(e[5]);
|
|
25127
25155
|
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
@@ -25135,7 +25163,7 @@ function NE(e) {
|
|
|
25135
25163
|
}
|
|
25136
25164
|
//#endregion
|
|
25137
25165
|
//#region src/realtime/adapters/KrakenAdapter.ts
|
|
25138
|
-
var
|
|
25166
|
+
var IE = {
|
|
25139
25167
|
"1m": 1,
|
|
25140
25168
|
"5m": 5,
|
|
25141
25169
|
"15m": 15,
|
|
@@ -25145,10 +25173,10 @@ var PE = {
|
|
|
25145
25173
|
"1d": 1440,
|
|
25146
25174
|
"1w": 10080
|
|
25147
25175
|
};
|
|
25148
|
-
function
|
|
25149
|
-
return
|
|
25176
|
+
function LE(e) {
|
|
25177
|
+
return IE[e] ?? 1;
|
|
25150
25178
|
}
|
|
25151
|
-
var
|
|
25179
|
+
var RE = class extends bE {
|
|
25152
25180
|
constructor(e = {}) {
|
|
25153
25181
|
let t = e.restBase ?? "https://api.kraken.com", n = e.wsBase ?? "wss://ws.kraken.com/v2";
|
|
25154
25182
|
super({
|
|
@@ -25159,7 +25187,7 @@ var IE = class extends vE {
|
|
|
25159
25187
|
params: {
|
|
25160
25188
|
channel: "ohlc",
|
|
25161
25189
|
symbol: [e.symbol],
|
|
25162
|
-
interval:
|
|
25190
|
+
interval: LE(e.timeframe)
|
|
25163
25191
|
}
|
|
25164
25192
|
}),
|
|
25165
25193
|
unsubscribeMessage: (e) => ({
|
|
@@ -25167,21 +25195,21 @@ var IE = class extends vE {
|
|
|
25167
25195
|
params: {
|
|
25168
25196
|
channel: "ohlc",
|
|
25169
25197
|
symbol: [e.symbol],
|
|
25170
|
-
interval:
|
|
25198
|
+
interval: LE(e.timeframe)
|
|
25171
25199
|
}
|
|
25172
25200
|
}),
|
|
25173
|
-
supportedTimeframes: Object.keys(
|
|
25174
|
-
parseMessage:
|
|
25175
|
-
fetchHistory: (e, n) =>
|
|
25201
|
+
supportedTimeframes: Object.keys(IE),
|
|
25202
|
+
parseMessage: zE,
|
|
25203
|
+
fetchHistory: (e, n) => BE(t, e, n)
|
|
25176
25204
|
});
|
|
25177
25205
|
}
|
|
25178
25206
|
};
|
|
25179
|
-
function
|
|
25180
|
-
if (!
|
|
25207
|
+
function zE(e) {
|
|
25208
|
+
if (!SE(e) || e.channel !== "ohlc") return null;
|
|
25181
25209
|
let t = e.data;
|
|
25182
25210
|
if (!Array.isArray(t) || t.length === 0) return null;
|
|
25183
25211
|
let n = t[t.length - 1];
|
|
25184
|
-
if (!
|
|
25212
|
+
if (!SE(n)) return null;
|
|
25185
25213
|
let r = $(n.open), i = $(n.high), a = $(n.low), o = $(n.close), s = $(n.volume), c = typeof n.interval_begin == "string" ? Date.parse(n.interval_begin) : NaN;
|
|
25186
25214
|
return r === null || i === null || a === null || o === null || s === null || !Number.isFinite(c) ? null : {
|
|
25187
25215
|
bar: {
|
|
@@ -25195,13 +25223,13 @@ function LE(e) {
|
|
|
25195
25223
|
closed: !1
|
|
25196
25224
|
};
|
|
25197
25225
|
}
|
|
25198
|
-
async function
|
|
25199
|
-
let r =
|
|
25226
|
+
async function BE(e, t, n) {
|
|
25227
|
+
let r = LE(n), i = t.replace("/", ""), a = `${e}/0/public/OHLC?pair=${encodeURIComponent(i)}&interval=${r}`, o = await fetch(a);
|
|
25200
25228
|
if (!o.ok) throw Error(`Kraken REST error: ${o.status}`);
|
|
25201
|
-
return
|
|
25229
|
+
return VE(await o.json());
|
|
25202
25230
|
}
|
|
25203
|
-
function
|
|
25204
|
-
if (!
|
|
25231
|
+
function VE(e) {
|
|
25232
|
+
if (!SE(e) || !SE(e.result)) return [];
|
|
25205
25233
|
let t = null;
|
|
25206
25234
|
for (let [n, r] of Object.entries(e.result)) if (n !== "last" && Array.isArray(r)) {
|
|
25207
25235
|
t = r;
|
|
@@ -25210,12 +25238,12 @@ function zE(e) {
|
|
|
25210
25238
|
if (!Array.isArray(t)) return [];
|
|
25211
25239
|
let n = [];
|
|
25212
25240
|
for (let e of t) {
|
|
25213
|
-
let t =
|
|
25241
|
+
let t = HE(e);
|
|
25214
25242
|
t && n.push(t);
|
|
25215
25243
|
}
|
|
25216
25244
|
return n.sort((e, t) => e.time - t.time), n;
|
|
25217
25245
|
}
|
|
25218
|
-
function
|
|
25246
|
+
function HE(e) {
|
|
25219
25247
|
if (!Array.isArray(e) || e.length < 7) return null;
|
|
25220
25248
|
let t = $(e[0]), n = $(e[1]), r = $(e[2]), i = $(e[3]), a = $(e[4]), o = $(e[6]);
|
|
25221
25249
|
return t === null || n === null || r === null || i === null || a === null || o === null ? null : {
|
|
@@ -25229,7 +25257,7 @@ function BE(e) {
|
|
|
25229
25257
|
}
|
|
25230
25258
|
//#endregion
|
|
25231
25259
|
//#region src/realtime/adapters/UpbitAdapter.ts
|
|
25232
|
-
var
|
|
25260
|
+
var UE = 200, WE = {
|
|
25233
25261
|
"1m": "minutes/1",
|
|
25234
25262
|
"3m": "minutes/3",
|
|
25235
25263
|
"5m": "minutes/5",
|
|
@@ -25240,7 +25268,7 @@ var VE = 200, HE = {
|
|
|
25240
25268
|
"1d": "days",
|
|
25241
25269
|
"1w": "weeks",
|
|
25242
25270
|
"1M": "months"
|
|
25243
|
-
},
|
|
25271
|
+
}, GE = {
|
|
25244
25272
|
"1m": "candle.1m",
|
|
25245
25273
|
"3m": "candle.3m",
|
|
25246
25274
|
"5m": "candle.5m",
|
|
@@ -25250,57 +25278,57 @@ var VE = 200, HE = {
|
|
|
25250
25278
|
"4h": "candle.240m",
|
|
25251
25279
|
"1d": "ticker"
|
|
25252
25280
|
};
|
|
25253
|
-
function
|
|
25254
|
-
return
|
|
25281
|
+
function KE(e) {
|
|
25282
|
+
return WE[e] ?? null;
|
|
25255
25283
|
}
|
|
25256
|
-
function
|
|
25257
|
-
return
|
|
25284
|
+
function qE(e) {
|
|
25285
|
+
return GE[e] ?? null;
|
|
25258
25286
|
}
|
|
25259
|
-
var
|
|
25287
|
+
var JE = class extends bE {
|
|
25260
25288
|
constructor(e = {}) {
|
|
25261
25289
|
let t = e.restBase ?? "https://api.upbit.com", n = e.wsUrl ?? "wss://api.upbit.com/websocket/v1";
|
|
25262
25290
|
super({
|
|
25263
25291
|
name: "upbit",
|
|
25264
25292
|
wsUrl: () => n,
|
|
25265
|
-
socketFactory: e.socketFactory ??
|
|
25266
|
-
decode:
|
|
25293
|
+
socketFactory: e.socketFactory ?? YE,
|
|
25294
|
+
decode: ZE,
|
|
25267
25295
|
subscribeMessage: (e) => [
|
|
25268
25296
|
{ ticket: "tradecanvas" },
|
|
25269
25297
|
{
|
|
25270
|
-
type:
|
|
25298
|
+
type: qE(e.timeframe) ?? "candle.1m",
|
|
25271
25299
|
codes: [e.symbol]
|
|
25272
25300
|
},
|
|
25273
25301
|
{ format: "DEFAULT" }
|
|
25274
25302
|
],
|
|
25275
|
-
supportedTimeframes: Object.keys(
|
|
25276
|
-
parseMessage:
|
|
25277
|
-
fetchHistory: (e, n, r) =>
|
|
25278
|
-
fetchHistoryBefore: (e, n, r, i) =>
|
|
25303
|
+
supportedTimeframes: Object.keys(GE),
|
|
25304
|
+
parseMessage: QE,
|
|
25305
|
+
fetchHistory: (e, n, r) => tD(t, e, n, r),
|
|
25306
|
+
fetchHistoryBefore: (e, n, r, i) => tD(t, e, n, i, r)
|
|
25279
25307
|
});
|
|
25280
25308
|
}
|
|
25281
25309
|
};
|
|
25282
|
-
function
|
|
25310
|
+
function YE(e) {
|
|
25283
25311
|
let t = globalThis.WebSocket;
|
|
25284
25312
|
if (!t) throw Error("No WebSocket implementation available");
|
|
25285
25313
|
let n = new t(e);
|
|
25286
25314
|
return n.binaryType = "arraybuffer", n;
|
|
25287
25315
|
}
|
|
25288
|
-
var
|
|
25289
|
-
function
|
|
25316
|
+
var XE = null;
|
|
25317
|
+
function ZE(e) {
|
|
25290
25318
|
if (typeof e == "string") return JSON.parse(e);
|
|
25291
|
-
if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) return JSON.parse((
|
|
25319
|
+
if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) return JSON.parse((XE ??= new TextDecoder()).decode(e));
|
|
25292
25320
|
}
|
|
25293
|
-
function
|
|
25294
|
-
if (!
|
|
25321
|
+
function QE(e) {
|
|
25322
|
+
if (!SE(e) || typeof e.type != "string") return null;
|
|
25295
25323
|
if (e.type.startsWith("candle.")) {
|
|
25296
|
-
let t =
|
|
25324
|
+
let t = eD(e, e.candle_date_time_utc, e.candle_acc_trade_volume);
|
|
25297
25325
|
return t ? {
|
|
25298
25326
|
bar: t,
|
|
25299
25327
|
closed: !1
|
|
25300
25328
|
} : null;
|
|
25301
25329
|
}
|
|
25302
25330
|
if (e.type === "ticker" && typeof e.trade_date == "string" && /^\d{8}$/.test(e.trade_date)) {
|
|
25303
|
-
let t = e.trade_date, n =
|
|
25331
|
+
let t = e.trade_date, n = eD(e, `${t.slice(0, 4)}-${t.slice(4, 6)}-${t.slice(6, 8)}T00:00:00`, e.acc_trade_volume);
|
|
25304
25332
|
return n ? {
|
|
25305
25333
|
bar: n,
|
|
25306
25334
|
closed: !1
|
|
@@ -25308,16 +25336,16 @@ function XE(e) {
|
|
|
25308
25336
|
}
|
|
25309
25337
|
return null;
|
|
25310
25338
|
}
|
|
25311
|
-
function
|
|
25339
|
+
function $E(e) {
|
|
25312
25340
|
if (!Array.isArray(e)) return [];
|
|
25313
25341
|
let t = [];
|
|
25314
25342
|
for (let n of e) {
|
|
25315
|
-
let e =
|
|
25343
|
+
let e = SE(n) ? eD(n, n.candle_date_time_utc, n.candle_acc_trade_volume) : null;
|
|
25316
25344
|
e && t.push(e);
|
|
25317
25345
|
}
|
|
25318
25346
|
return t.sort((e, t) => e.time - t.time), t;
|
|
25319
25347
|
}
|
|
25320
|
-
function
|
|
25348
|
+
function eD(e, t, n) {
|
|
25321
25349
|
let r = typeof t == "string" ? Date.parse(`${t}Z`) : NaN, i = $(e.opening_price), a = $(e.high_price), o = $(e.low_price), s = $(e.trade_price), c = $(n);
|
|
25322
25350
|
return !Number.isFinite(r) || i === null || a === null || o === null || s === null || c === null ? null : {
|
|
25323
25351
|
time: r,
|
|
@@ -25328,8 +25356,8 @@ function QE(e, t, n) {
|
|
|
25328
25356
|
volume: c
|
|
25329
25357
|
};
|
|
25330
25358
|
}
|
|
25331
|
-
async function
|
|
25332
|
-
let a =
|
|
25359
|
+
async function tD(e, t, n, r, i) {
|
|
25360
|
+
let a = KE(n);
|
|
25333
25361
|
if (!a) throw Error(`Upbit has no ${n} candles`);
|
|
25334
25362
|
let o = new URLSearchParams({
|
|
25335
25363
|
market: t,
|
|
@@ -25338,11 +25366,11 @@ async function $E(e, t, n, r, i) {
|
|
|
25338
25366
|
i !== void 0 && o.set("to", new Date(i).toISOString().replace(/\.\d{3}Z$/, "Z"));
|
|
25339
25367
|
let s = await fetch(`${e}/v1/candles/${a}?${o}`);
|
|
25340
25368
|
if (!s.ok) throw Error(`Upbit REST error: ${s.status}`);
|
|
25341
|
-
return
|
|
25369
|
+
return $E(await s.json());
|
|
25342
25370
|
}
|
|
25343
25371
|
//#endregion
|
|
25344
25372
|
//#region src/realtime/feeds/ManualFeed.ts
|
|
25345
|
-
var
|
|
25373
|
+
var nD = (e, t) => `${e}\u0000${t}`, rD = class {
|
|
25346
25374
|
name;
|
|
25347
25375
|
series = /* @__PURE__ */ new Map();
|
|
25348
25376
|
subscribers = /* @__PURE__ */ new Map();
|
|
@@ -25351,10 +25379,10 @@ var eD = (e, t) => `${e}\u0000${t}`, tD = class {
|
|
|
25351
25379
|
}
|
|
25352
25380
|
setBars(e, t, n) {
|
|
25353
25381
|
let r = n.map((e) => ({ ...e })).sort((e, t) => e.time - t.time);
|
|
25354
|
-
this.series.set(
|
|
25382
|
+
this.series.set(nD(e, t), r);
|
|
25355
25383
|
}
|
|
25356
25384
|
pushBar(e, t, n, r = !1) {
|
|
25357
|
-
let i =
|
|
25385
|
+
let i = nD(e, t), a = this.series.get(i) ?? [], o = a[a.length - 1], s = { ...n }, c = r;
|
|
25358
25386
|
if (!o || s.time > o.time) this.series.set(i, [...a, s]);
|
|
25359
25387
|
else {
|
|
25360
25388
|
let n = a.findIndex((e) => e.time === s.time);
|
|
@@ -25364,17 +25392,17 @@ var eD = (e, t) => `${e}\u0000${t}`, tD = class {
|
|
|
25364
25392
|
for (let e of [...this.subscribers.get(i) ?? []]) e.bar({ ...s }, c);
|
|
25365
25393
|
}
|
|
25366
25394
|
async getBars(e) {
|
|
25367
|
-
let t = this.series.get(
|
|
25395
|
+
let t = this.series.get(nD(e.symbol, e.timeframe)) ?? [], { before: n } = e, r = n === void 0 ? t.length : iD(t, n);
|
|
25368
25396
|
return t.slice(Math.max(0, r - e.countBack), r).map((e) => ({ ...e }));
|
|
25369
25397
|
}
|
|
25370
25398
|
subscribeBars(e, t) {
|
|
25371
|
-
let n =
|
|
25399
|
+
let n = nD(e.symbol, e.timeframe), r = this.subscribers.get(n);
|
|
25372
25400
|
return r || (r = /* @__PURE__ */ new Set(), this.subscribers.set(n, r)), r.add(t), () => {
|
|
25373
25401
|
r.delete(t), r.size === 0 && this.subscribers.delete(n);
|
|
25374
25402
|
};
|
|
25375
25403
|
}
|
|
25376
25404
|
};
|
|
25377
|
-
function
|
|
25405
|
+
function iD(e, t) {
|
|
25378
25406
|
let n = 0, r = e.length;
|
|
25379
25407
|
for (; n < r;) {
|
|
25380
25408
|
let i = n + r >> 1;
|
|
@@ -25384,7 +25412,7 @@ function nD(e, t) {
|
|
|
25384
25412
|
}
|
|
25385
25413
|
//#endregion
|
|
25386
25414
|
//#region src/ui/ChartLegend.ts
|
|
25387
|
-
var
|
|
25415
|
+
var aD = {
|
|
25388
25416
|
visible: !0,
|
|
25389
25417
|
showSymbol: !0,
|
|
25390
25418
|
showOHLC: !0,
|
|
@@ -25394,8 +25422,8 @@ var rD = {
|
|
|
25394
25422
|
fontSize: 12,
|
|
25395
25423
|
fontFamily: null,
|
|
25396
25424
|
ground: !0
|
|
25397
|
-
},
|
|
25398
|
-
config = { ...
|
|
25425
|
+
}, oD = class {
|
|
25426
|
+
config = { ...aD };
|
|
25399
25427
|
symbol = "";
|
|
25400
25428
|
timeframe = "";
|
|
25401
25429
|
hoverBar = null;
|
|
@@ -25406,9 +25434,9 @@ var rD = {
|
|
|
25406
25434
|
drawnHeight = null;
|
|
25407
25435
|
drawnWidth = 0;
|
|
25408
25436
|
locale = "en-US";
|
|
25409
|
-
inset =
|
|
25410
|
-
top =
|
|
25411
|
-
lineGap =
|
|
25437
|
+
inset = cD;
|
|
25438
|
+
top = sD;
|
|
25439
|
+
lineGap = lD;
|
|
25412
25440
|
pricePrecision = null;
|
|
25413
25441
|
reportedHeight = null;
|
|
25414
25442
|
resizeListener = null;
|
|
@@ -25522,7 +25550,7 @@ var rD = {
|
|
|
25522
25550
|
return f.map((t) => ({
|
|
25523
25551
|
...t,
|
|
25524
25552
|
labelWidth: t.label ? e.measureText(t.label + " ").width : 0,
|
|
25525
|
-
width:
|
|
25553
|
+
width: mD(e, t.value),
|
|
25526
25554
|
font: c
|
|
25527
25555
|
}));
|
|
25528
25556
|
}
|
|
@@ -25550,7 +25578,7 @@ var rD = {
|
|
|
25550
25578
|
if (this.config.showOHLC && h.push(...this.priceCells(e, t, n, i, a, s, c, l)), h.length > 0) {
|
|
25551
25579
|
e.font = `${s}px ${c}`;
|
|
25552
25580
|
let t = e.measureText(" ").width;
|
|
25553
|
-
for (let r of
|
|
25581
|
+
for (let r of pD(h, t, o.width - 2 * this.inset)) {
|
|
25554
25582
|
let i = r.reduce((e, n) => e + n.labelWidth + n.width + t, -t);
|
|
25555
25583
|
m = Math.max(m, i);
|
|
25556
25584
|
let a = d ? f : f - i;
|
|
@@ -25572,7 +25600,7 @@ var rD = {
|
|
|
25572
25600
|
return {
|
|
25573
25601
|
entry: n,
|
|
25574
25602
|
color: t.color,
|
|
25575
|
-
width:
|
|
25603
|
+
width: mD(e, n)
|
|
25576
25604
|
};
|
|
25577
25605
|
}), i = r.reduce((e, n) => e + n.width + t, -t), a = d ? f : f - i;
|
|
25578
25606
|
this.drawGround(e, n, a, p, i, s), e.textAlign = "left";
|
|
@@ -25580,10 +25608,10 @@ var rD = {
|
|
|
25580
25608
|
}
|
|
25581
25609
|
}
|
|
25582
25610
|
drawGround(e, t, n, r, i, a) {
|
|
25583
|
-
!this.config.ground || i <= 0 || (e.save(), e.globalAlpha =
|
|
25611
|
+
!this.config.ground || i <= 0 || (e.save(), e.globalAlpha = uD, e.fillStyle = t.background, e.fillRect(n - dD, r - fD, i + 2 * dD, a + this.lineGap), e.restore());
|
|
25584
25612
|
}
|
|
25585
|
-
}, { legendTop:
|
|
25586
|
-
function
|
|
25613
|
+
}, { legendTop: sD, legendInset: cD, legendLineGap: lD } = re[ce], uD = .72, dD = 3, fD = 1;
|
|
25614
|
+
function pD(e, t, n) {
|
|
25587
25615
|
let r = [], i = [], a = 0;
|
|
25588
25616
|
for (let o of e) {
|
|
25589
25617
|
let e = o.labelWidth + o.width;
|
|
@@ -25591,13 +25619,13 @@ function dD(e, t, n) {
|
|
|
25591
25619
|
}
|
|
25592
25620
|
return i.length > 0 && r.push(i), r;
|
|
25593
25621
|
}
|
|
25594
|
-
function
|
|
25622
|
+
function mD(e, t) {
|
|
25595
25623
|
let n = t.replace(/\d/g, "0");
|
|
25596
25624
|
return Math.max(e.measureText(t).width, e.measureText(n.replace(/[-−]/g, "+")).width, e.measureText(n.replace(/\+/g, "-")).width);
|
|
25597
25625
|
}
|
|
25598
25626
|
//#endregion
|
|
25599
25627
|
//#region src/ui/Screenshot.ts
|
|
25600
|
-
var
|
|
25628
|
+
var hD = class {
|
|
25601
25629
|
static toDataURL(e, t) {
|
|
25602
25630
|
return this.compose(e, t)?.toDataURL("image/png") ?? "";
|
|
25603
25631
|
}
|
|
@@ -25622,7 +25650,7 @@ var pD = class {
|
|
|
25622
25650
|
for (let e of c) s.drawImage(e, 0, 0);
|
|
25623
25651
|
return o;
|
|
25624
25652
|
}
|
|
25625
|
-
},
|
|
25653
|
+
}, gD = class {
|
|
25626
25654
|
config = null;
|
|
25627
25655
|
setConfig(e) {
|
|
25628
25656
|
this.config = e;
|
|
@@ -25635,12 +25663,12 @@ var pD = class {
|
|
|
25635
25663
|
let { chartRect: r } = t, i = this.config.fontSize ?? 48, a = n.style?.watermark.color ?? this.config.color ?? n.textSecondary;
|
|
25636
25664
|
e.save(), e.globalAlpha = .07, e.font = `bold ${i}px ${n.font.family}`, e.fillStyle = a, e.textAlign = "center", e.textBaseline = "middle", e.fillText(this.config.text, r.x + r.width / 2, r.y + r.height / 2), e.restore();
|
|
25637
25665
|
}
|
|
25638
|
-
},
|
|
25666
|
+
}, _D = {
|
|
25639
25667
|
solid: null,
|
|
25640
25668
|
dashed: [6, 4],
|
|
25641
25669
|
dotted: [2, 3]
|
|
25642
|
-
},
|
|
25643
|
-
function
|
|
25670
|
+
}, vD = 6;
|
|
25671
|
+
function yD(e, t) {
|
|
25644
25672
|
let n = [...e].sort((e, t) => t.rank - e.rank || e.px - t.px), r = [], i = [];
|
|
25645
25673
|
for (let e of n) {
|
|
25646
25674
|
let n = 0, a = r.length;
|
|
@@ -25652,7 +25680,7 @@ function _D(e, t) {
|
|
|
25652
25680
|
}
|
|
25653
25681
|
return i.sort((e, t) => e.px - t.px);
|
|
25654
25682
|
}
|
|
25655
|
-
var
|
|
25683
|
+
var bD = class {
|
|
25656
25684
|
config = { visible: !1 };
|
|
25657
25685
|
cachedBreaksTyped = [];
|
|
25658
25686
|
cachedMedianStep = 0;
|
|
@@ -25697,7 +25725,7 @@ var vD = class {
|
|
|
25697
25725
|
}
|
|
25698
25726
|
o = n;
|
|
25699
25727
|
}
|
|
25700
|
-
return this.lastDataLength = e.length, this.firstTime = e[0].time, this.lastTime = e[e.length - 1].time, this.cachedBreaksTyped = r, n || (this.cachedMedianStep =
|
|
25728
|
+
return this.lastDataLength = e.length, this.firstTime = e[0].time, this.lastTime = e[e.length - 1].time, this.cachedBreaksTyped = r, n || (this.cachedMedianStep = xD(e)), this.cacheValid = !0, r;
|
|
25701
25729
|
}
|
|
25702
25730
|
render(e, t, n, r) {
|
|
25703
25731
|
this.renderLines(e, t, n, r);
|
|
@@ -25705,7 +25733,7 @@ var vD = class {
|
|
|
25705
25733
|
renderLines(e, t, n, r) {
|
|
25706
25734
|
let i = this.lineMarks(t, r, n);
|
|
25707
25735
|
if (i.length === 0) return;
|
|
25708
|
-
let { chartRect: a } = t, o = this.look(n), s =
|
|
25736
|
+
let { chartRect: a } = t, o = this.look(n), s = _D[o.style];
|
|
25709
25737
|
e.save(), s && e.setLineDash(s), e.strokeStyle = o.color;
|
|
25710
25738
|
for (let t of i) e.globalAlpha = t.alpha, e.lineWidth = t.width, e.beginPath(), e.moveTo(t.px, a.y), e.lineTo(t.px, a.y + a.height), e.stroke();
|
|
25711
25739
|
e.restore();
|
|
@@ -25713,7 +25741,7 @@ var vD = class {
|
|
|
25713
25741
|
lineRects(e, t, n) {
|
|
25714
25742
|
let r = this.lineMarks(e, n, t);
|
|
25715
25743
|
if (r.length === 0) return [];
|
|
25716
|
-
let { color: i, style: a } = this.look(t), o =
|
|
25744
|
+
let { color: i, style: a } = this.look(t), o = _D[a] ?? void 0, { y: s, height: c } = e.chartRect;
|
|
25717
25745
|
return r.map((e) => ({
|
|
25718
25746
|
x: e.px - e.width / 2,
|
|
25719
25747
|
y: s,
|
|
@@ -25733,7 +25761,7 @@ var vD = class {
|
|
|
25733
25761
|
};
|
|
25734
25762
|
}
|
|
25735
25763
|
lineMarks(e, t, n) {
|
|
25736
|
-
return
|
|
25764
|
+
return yD(this.marks(e, t, n), vD);
|
|
25737
25765
|
}
|
|
25738
25766
|
marks(e, t, n) {
|
|
25739
25767
|
if (!this.config.visible || t.length < 2) return [];
|
|
@@ -25757,7 +25785,7 @@ var vD = class {
|
|
|
25757
25785
|
this.lastDataLength = 0, this.cachedBreaksTyped = [], this.cachedMedianStep = 0, this.cacheValid = !1;
|
|
25758
25786
|
}
|
|
25759
25787
|
};
|
|
25760
|
-
function
|
|
25788
|
+
function xD(e) {
|
|
25761
25789
|
if (e.length < 2) return 0;
|
|
25762
25790
|
let t = Math.min(50, e.length - 1), n = A(e), r = [];
|
|
25763
25791
|
for (let i = 1; i <= t; i++) r.push((e[i].time - e[i - 1].time) * n);
|
|
@@ -25765,35 +25793,35 @@ function yD(e) {
|
|
|
25765
25793
|
}
|
|
25766
25794
|
//#endregion
|
|
25767
25795
|
//#region src/ui/sessionHours.ts
|
|
25768
|
-
var
|
|
25769
|
-
function
|
|
25796
|
+
var SD = 864e5;
|
|
25797
|
+
function CD(e, t) {
|
|
25770
25798
|
let n = {
|
|
25771
25799
|
...e,
|
|
25772
25800
|
...t
|
|
25773
25801
|
};
|
|
25774
25802
|
return t.tzOffsetMinutes !== void 0 && t.timeZone === void 0 && delete n.timeZone, n.windows ? n.windows = n.windows.map((e) => ({ ...e })) : delete n.windows, n;
|
|
25775
25803
|
}
|
|
25776
|
-
function
|
|
25777
|
-
let n = ((e + t * 6e4) %
|
|
25804
|
+
function wD(e, t) {
|
|
25805
|
+
let n = ((e + t * 6e4) % SD + SD) % SD;
|
|
25778
25806
|
return Math.floor(n / 6e4);
|
|
25779
25807
|
}
|
|
25780
|
-
function
|
|
25808
|
+
function TD(e, t, n) {
|
|
25781
25809
|
return t === n ? !0 : t < n ? e >= t && e < n : e >= t || e < n;
|
|
25782
25810
|
}
|
|
25783
|
-
function
|
|
25784
|
-
let n =
|
|
25785
|
-
return t.windows && t.windows.length > 0 ? t.windows.some((e) =>
|
|
25811
|
+
function ED(e, t) {
|
|
25812
|
+
let n = wD(e, t.timeZone ? Mt(t.timeZone, e) : t.tzOffsetMinutes ?? 0);
|
|
25813
|
+
return t.windows && t.windows.length > 0 ? t.windows.some((e) => TD(n, e.startMinute, e.endMinute)) : TD(n, t.startMinute, t.endMinute);
|
|
25786
25814
|
}
|
|
25787
25815
|
//#endregion
|
|
25788
25816
|
//#region src/ui/SessionShading.ts
|
|
25789
|
-
var
|
|
25817
|
+
var DD = {
|
|
25790
25818
|
startMinute: 570,
|
|
25791
25819
|
endMinute: 960,
|
|
25792
25820
|
tzOffsetMinutes: -300,
|
|
25793
25821
|
timeZone: "America/New_York"
|
|
25794
|
-
},
|
|
25822
|
+
}, OD = class {
|
|
25795
25823
|
visible = !1;
|
|
25796
|
-
config = { ...
|
|
25824
|
+
config = { ...DD };
|
|
25797
25825
|
setVisible(e) {
|
|
25798
25826
|
this.visible = e;
|
|
25799
25827
|
}
|
|
@@ -25801,10 +25829,10 @@ var TD = {
|
|
|
25801
25829
|
return this.visible;
|
|
25802
25830
|
}
|
|
25803
25831
|
setConfig(e) {
|
|
25804
|
-
this.config =
|
|
25832
|
+
this.config = CD(this.config, e);
|
|
25805
25833
|
}
|
|
25806
25834
|
replaceConfig(e) {
|
|
25807
|
-
this.config =
|
|
25835
|
+
this.config = CD(e, {});
|
|
25808
25836
|
}
|
|
25809
25837
|
getConfig() {
|
|
25810
25838
|
return {
|
|
@@ -25836,12 +25864,12 @@ var TD = {
|
|
|
25836
25864
|
});
|
|
25837
25865
|
};
|
|
25838
25866
|
for (let t = o; t <= s; t++) {
|
|
25839
|
-
let n = !
|
|
25867
|
+
let n = !ED(e[t].time, this.config);
|
|
25840
25868
|
n && d === -1 ? d = t : !n && d !== -1 && (f(d, t - 1), d = -1);
|
|
25841
25869
|
}
|
|
25842
25870
|
return d !== -1 && f(d, s), u;
|
|
25843
25871
|
}
|
|
25844
|
-
},
|
|
25872
|
+
}, kD = [2, 3], AD = 16, jD = class {
|
|
25845
25873
|
highLow = !1;
|
|
25846
25874
|
quote = null;
|
|
25847
25875
|
quoteShown = !0;
|
|
@@ -25888,10 +25916,10 @@ var TD = {
|
|
|
25888
25916
|
}
|
|
25889
25917
|
render(e, t, n, r) {
|
|
25890
25918
|
let { chartRect: i } = t;
|
|
25891
|
-
e.save(), e.setLineDash(
|
|
25919
|
+
e.save(), e.setLineDash(kD), e.lineWidth = 1;
|
|
25892
25920
|
for (let a of this.levels(r, t)) {
|
|
25893
25921
|
let r = Math.round(x(a.price, t)) + .5;
|
|
25894
|
-
r < i.y || r > i.y + i.height || (e.strokeStyle =
|
|
25922
|
+
r < i.y || r > i.y + i.height || (e.strokeStyle = MD(a.kind, n), e.beginPath(), ne(e, i.x, i.x + i.width, r), e.stroke());
|
|
25895
25923
|
}
|
|
25896
25924
|
e.restore();
|
|
25897
25925
|
}
|
|
@@ -25903,14 +25931,14 @@ var TD = {
|
|
|
25903
25931
|
if (r < a.y || r > a.y + a.height) continue;
|
|
25904
25932
|
let u = i?.get(l.kind) ?? r;
|
|
25905
25933
|
if (Number.isNaN(u)) continue;
|
|
25906
|
-
e.fillStyle =
|
|
25934
|
+
e.fillStyle = MD(l.kind, n), ln(e, o, u - AD / 2, s, AD, n), e.fillStyle = n.background;
|
|
25907
25935
|
let d = t.formatPrice?.(l.price) ?? this.priceText?.(l.price) ?? j(l.price, c);
|
|
25908
25936
|
e.fillText(d, o + 7, u);
|
|
25909
25937
|
}
|
|
25910
25938
|
e.restore();
|
|
25911
25939
|
}
|
|
25912
25940
|
};
|
|
25913
|
-
function
|
|
25941
|
+
function MD(e, t) {
|
|
25914
25942
|
switch (e) {
|
|
25915
25943
|
case "bid": return t.candleUp;
|
|
25916
25944
|
case "ask": return t.candleDown;
|
|
@@ -25919,11 +25947,11 @@ function AD(e, t) {
|
|
|
25919
25947
|
}
|
|
25920
25948
|
//#endregion
|
|
25921
25949
|
//#region src/features/AlertManager.ts
|
|
25922
|
-
var
|
|
25923
|
-
function
|
|
25924
|
-
return e.channel === "price" && !e.drawingId && !e.target && !
|
|
25950
|
+
var ND = 12, PD = 3, FD = 500, ID = 2, LD = ["movesUp", "movesDown"];
|
|
25951
|
+
function RD(e) {
|
|
25952
|
+
return e.channel === "price" && !e.drawingId && !e.target && !LD.includes(e.condition);
|
|
25925
25953
|
}
|
|
25926
|
-
function
|
|
25954
|
+
function zD(e, t, n, r) {
|
|
25927
25955
|
switch (r) {
|
|
25928
25956
|
case "crossingUp": return e !== void 0 && e < n && t >= n;
|
|
25929
25957
|
case "crossingDown": return e !== void 0 && e > n && t <= n;
|
|
@@ -25933,16 +25961,16 @@ function LD(e, t, n, r) {
|
|
|
25933
25961
|
default: return !1;
|
|
25934
25962
|
}
|
|
25935
25963
|
}
|
|
25936
|
-
var
|
|
25964
|
+
var BD = [
|
|
25937
25965
|
"crossing",
|
|
25938
25966
|
"crossingUp",
|
|
25939
25967
|
"crossingDown"
|
|
25940
25968
|
];
|
|
25941
|
-
function
|
|
25969
|
+
function VD(e, t, n) {
|
|
25942
25970
|
let r = e < 0 && t >= 0, i = e > 0 && t <= 0;
|
|
25943
25971
|
return n === "crossingUp" ? r : n === "crossingDown" ? i : r || i;
|
|
25944
25972
|
}
|
|
25945
|
-
var
|
|
25973
|
+
var HD = 1, UD = 2 ** 31 - 1, WD = class extends Zw {
|
|
25946
25974
|
alerts = [];
|
|
25947
25975
|
lastValues = /* @__PURE__ */ new Map();
|
|
25948
25976
|
drawingSides = /* @__PURE__ */ new Map();
|
|
@@ -25963,7 +25991,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
25963
25991
|
this.pricePrecision = e;
|
|
25964
25992
|
}
|
|
25965
25993
|
addAlert(e, t = "crossing", n, r = !1, i = "price", a, o = {}) {
|
|
25966
|
-
let s =
|
|
25994
|
+
let s = GD(t, i, o), c = `tc_alert_${HD++}`, l = {
|
|
25967
25995
|
id: c,
|
|
25968
25996
|
price: e,
|
|
25969
25997
|
condition: t,
|
|
@@ -25980,8 +26008,8 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
25980
26008
|
this.drawingLevels = e;
|
|
25981
26009
|
}
|
|
25982
26010
|
addDrawingAlert(e, t = "crossing", n, r = !1, i) {
|
|
25983
|
-
if (!
|
|
25984
|
-
let a = `tc_alert_${
|
|
26011
|
+
if (!BD.includes(t)) throw RangeError(`An alert on a drawing takes a crossing condition, not "${t}"`);
|
|
26012
|
+
let a = `tc_alert_${HD++}`, o = {
|
|
25985
26013
|
id: a,
|
|
25986
26014
|
price: this.drawingLevels?.(e)?.[0] ?? NaN,
|
|
25987
26015
|
condition: t,
|
|
@@ -26028,7 +26056,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26028
26056
|
if (e.y < r.y || e.y > r.y + r.height) return null;
|
|
26029
26057
|
let i = null, a = n;
|
|
26030
26058
|
for (let n of this.alerts) {
|
|
26031
|
-
if (!
|
|
26059
|
+
if (!RD(n)) continue;
|
|
26032
26060
|
let r = Math.abs(x(n.price, t) - e.y);
|
|
26033
26061
|
r <= a && (a = r, i = n);
|
|
26034
26062
|
}
|
|
@@ -26062,7 +26090,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26062
26090
|
this.expiryTimer && clearTimeout(this.expiryTimer), this.expiryTimer = null;
|
|
26063
26091
|
let e = Math.min(...this.alerts.filter((e) => !e.expired && e.expiresAt !== void 0 && !(e.triggered && !e.repeating)).map((e) => e.expiresAt));
|
|
26064
26092
|
if (!Number.isFinite(e)) return;
|
|
26065
|
-
let t = Math.min(Math.max(0, e - Date.now()),
|
|
26093
|
+
let t = Math.min(Math.max(0, e - Date.now()), UD);
|
|
26066
26094
|
this.expiryTimer = setTimeout(() => {
|
|
26067
26095
|
this.expiryTimer = null, this.expire(), this.expiryTimer || this.scheduleExpiry();
|
|
26068
26096
|
}, t);
|
|
@@ -26080,7 +26108,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26080
26108
|
}
|
|
26081
26109
|
t.price = n[0];
|
|
26082
26110
|
let r = n.map((t) => Math.sign(e - t)), i = this.drawingSides.get(t.id);
|
|
26083
|
-
this.drawingSides.set(t.id, r), !(!i || i.length !== r.length) && (r.some((e, n) =>
|
|
26111
|
+
this.drawingSides.set(t.id, r), !(!i || i.length !== r.length) && (r.some((e, n) => VD(i[n], e, t.condition)) ? t.triggered || (t.triggered = !0, this.emit("triggered", { ...t })) : t.repeating && (t.triggered = !1));
|
|
26084
26112
|
}
|
|
26085
26113
|
}
|
|
26086
26114
|
checkChannel(e, t) {
|
|
@@ -26106,13 +26134,13 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26106
26134
|
if (!t) continue;
|
|
26107
26135
|
o = this.closedBarMet(e, t);
|
|
26108
26136
|
} else if (e.target) o = this.targetMet(e);
|
|
26109
|
-
else if (
|
|
26137
|
+
else if (LD.includes(e.condition)) {
|
|
26110
26138
|
if (!n) continue;
|
|
26111
26139
|
o = this.moveMet(e, this.history.get(e.channel) ?? []);
|
|
26112
26140
|
} else {
|
|
26113
26141
|
let t = r.get(e.channel);
|
|
26114
26142
|
if (!n || t === void 0) continue;
|
|
26115
|
-
o =
|
|
26143
|
+
o = zD(t, this.lastValues.get(e.channel), e.price, e.condition);
|
|
26116
26144
|
}
|
|
26117
26145
|
this.settle(e, o);
|
|
26118
26146
|
}
|
|
@@ -26124,7 +26152,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26124
26152
|
let t = this.lastValues.get(e.channel), n = e.target ? this.lastValues.get(e.target) : void 0;
|
|
26125
26153
|
if (t === void 0 || n === void 0) return !1;
|
|
26126
26154
|
let r = t - n, i = this.lastDiffs.get(e.id);
|
|
26127
|
-
return this.lastDiffs.set(e.id, r), e.price = n,
|
|
26155
|
+
return this.lastDiffs.set(e.id, r), e.price = n, zD(i, r, 0, e.condition);
|
|
26128
26156
|
}
|
|
26129
26157
|
moveMet(e, t, n = t.length) {
|
|
26130
26158
|
let r = e.bars ?? 1, i = t.slice(Math.max(0, n - r), n);
|
|
@@ -26140,7 +26168,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26140
26168
|
closedBarMet(e, t) {
|
|
26141
26169
|
let n = this.history.get(e.channel) ?? [], r = n.findIndex((e) => e.time === t.time);
|
|
26142
26170
|
if (r < 0) return !1;
|
|
26143
|
-
if (
|
|
26171
|
+
if (LD.includes(e.condition)) return this.moveMet(e, n, r + 1);
|
|
26144
26172
|
let i = (e, t) => {
|
|
26145
26173
|
let r = this.history.get(e) ?? [], i = n[t]?.time;
|
|
26146
26174
|
return i === void 0 ? void 0 : r.find((e) => e.time === i)?.value;
|
|
@@ -26150,7 +26178,7 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26150
26178
|
if (t === void 0) return !1;
|
|
26151
26179
|
a -= t, o = o !== void 0 && n !== void 0 ? o - n : void 0, s = 0, e.price = t;
|
|
26152
26180
|
}
|
|
26153
|
-
return
|
|
26181
|
+
return zD(o, a, s, e.condition);
|
|
26154
26182
|
}
|
|
26155
26183
|
recordBar(e, t) {
|
|
26156
26184
|
let n = this.barTime;
|
|
@@ -26210,11 +26238,11 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26210
26238
|
if (!Array.isArray(n)) return;
|
|
26211
26239
|
for (let e of n) {
|
|
26212
26240
|
if (typeof e.drawingId == "string" && e.condition && !e.triggered) {
|
|
26213
|
-
|
|
26241
|
+
BD.includes(e.condition) && this.addDrawingAlert(e.drawingId, e.condition, e.message, e.repeating ?? !1, e.label);
|
|
26214
26242
|
continue;
|
|
26215
26243
|
}
|
|
26216
26244
|
if (!e.condition || e.triggered || e.expired) continue;
|
|
26217
|
-
let t =
|
|
26245
|
+
let t = KD(e), n = !t.target && !LD.includes(e.condition), r = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : NaN;
|
|
26218
26246
|
if (!(n && Number.isNaN(r))) try {
|
|
26219
26247
|
this.addAlert(r, e.condition, e.message, e.repeating ?? !1, e.channel ?? "price", e.label, t);
|
|
26220
26248
|
} catch {}
|
|
@@ -26224,20 +26252,20 @@ var BD = 1, VD = 2 ** 31 - 1, HD = class extends Yw {
|
|
|
26224
26252
|
render(e, t, n) {
|
|
26225
26253
|
let { chartRect: r } = t;
|
|
26226
26254
|
for (let i of this.alerts) {
|
|
26227
|
-
if (!
|
|
26255
|
+
if (!RD(i)) continue;
|
|
26228
26256
|
let a = x(i.price, t);
|
|
26229
26257
|
if (a < r.y || a > r.y + r.height) continue;
|
|
26230
26258
|
let o = i.expired ? "#8a93a3" : i.triggered ? "#f2a93b" : "#4c8dff";
|
|
26231
26259
|
e.setLineDash([2, 6]), e.strokeStyle = o, e.lineWidth = 1, e.beginPath(), ne(e, r.x, r.x + r.width, Math.round(a) + .5), e.stroke(), e.setLineDash([]), e.font = `10px ${n.font.family}`, e.fillStyle = o, e.textBaseline = "bottom", e.textAlign = "right";
|
|
26232
26260
|
let s = `${nt(i.price, t, this.pricePrecision ?? void 0)}${i.message ? ` - ${i.message}` : ""}`, c = r.x + r.width - 4;
|
|
26233
26261
|
e.fillText(s, c, a - 2);
|
|
26234
|
-
let l = c - e.measureText(s).width -
|
|
26235
|
-
l >= r.x && wC(e, Ae.bell, l, a - 2 -
|
|
26262
|
+
let l = c - e.measureText(s).width - PD - ND;
|
|
26263
|
+
l >= r.x && wC(e, Ae.bell, l, a - 2 - ND, ND, o);
|
|
26236
26264
|
}
|
|
26237
26265
|
}
|
|
26238
26266
|
};
|
|
26239
|
-
function
|
|
26240
|
-
let r = {}, i =
|
|
26267
|
+
function GD(e, t, n) {
|
|
26268
|
+
let r = {}, i = LD.includes(e);
|
|
26241
26269
|
if (n.target !== void 0) {
|
|
26242
26270
|
if (i) throw RangeError("An alert on a move takes no other line");
|
|
26243
26271
|
if (n.target === t) throw RangeError("An alert can’t compare a line with itself");
|
|
@@ -26251,20 +26279,20 @@ function UD(e, t, n) {
|
|
|
26251
26279
|
}
|
|
26252
26280
|
return n.onBarClose && (r.onBarClose = !0), n.expiresAt !== void 0 && Number.isFinite(n.expiresAt) && (r.expiresAt = n.expiresAt), r;
|
|
26253
26281
|
}
|
|
26254
|
-
function
|
|
26282
|
+
function KD(e) {
|
|
26255
26283
|
let t = {};
|
|
26256
26284
|
return typeof e.target == "string" && e.target && (t.target = e.target), typeof e.percent == "number" && Number.isFinite(e.percent) && (t.percent = e.percent), typeof e.bars == "number" && Number.isInteger(e.bars) && (t.bars = e.bars), e.onBarClose === !0 && (t.onBarClose = !0), typeof e.expiresAt == "number" && Number.isFinite(e.expiresAt) && (t.expiresAt = e.expiresAt), t;
|
|
26257
26285
|
}
|
|
26258
26286
|
//#endregion
|
|
26259
26287
|
//#region src/features/ReplayManager.ts
|
|
26260
|
-
var
|
|
26288
|
+
var qD = 16, JD = 3 * qD, YD = 1e3 / 30, XD = 1e-9, ZD = () => typeof requestAnimationFrame == "function" && !(typeof document < "u" && document.hidden), QD = {
|
|
26261
26289
|
now: () => typeof performance < "u" ? performance.now() : Date.now(),
|
|
26262
|
-
frame: (e) =>
|
|
26290
|
+
frame: (e) => ZD() ? { raf: requestAnimationFrame(e) } : { timeout: setTimeout(e, qD) },
|
|
26263
26291
|
cancel: (e) => {
|
|
26264
26292
|
let t = e;
|
|
26265
26293
|
t.raf !== void 0 && cancelAnimationFrame(t.raf), t.timeout !== void 0 && clearTimeout(t.timeout);
|
|
26266
26294
|
}
|
|
26267
|
-
},
|
|
26295
|
+
}, $D = class extends Zw {
|
|
26268
26296
|
data = [];
|
|
26269
26297
|
cursor = -1;
|
|
26270
26298
|
timer = null;
|
|
@@ -26277,7 +26305,7 @@ var GD = 16, KD = 3 * GD, qD = 1e3 / 30, JD = 1e-9, YD = () => typeof requestAni
|
|
|
26277
26305
|
};
|
|
26278
26306
|
paceMs = null;
|
|
26279
26307
|
owedMs = 0;
|
|
26280
|
-
constructor(e =
|
|
26308
|
+
constructor(e = QD) {
|
|
26281
26309
|
super(), this.clock = e;
|
|
26282
26310
|
}
|
|
26283
26311
|
load(e) {
|
|
@@ -26308,7 +26336,7 @@ var GD = 16, KD = 3 * GD, qD = 1e3 / 30, JD = 1e-9, YD = () => typeof requestAni
|
|
|
26308
26336
|
this.setState("paused");
|
|
26309
26337
|
return;
|
|
26310
26338
|
}
|
|
26311
|
-
this.setState("playing"), this.config.animate ? this.runForming(t) : t <
|
|
26339
|
+
this.setState("playing"), this.config.animate ? this.runForming(t) : t < qD || this.paceMs !== null ? this.runFrames(t) : this.timer = setInterval(() => this.advance(1), t);
|
|
26312
26340
|
}
|
|
26313
26341
|
pause() {
|
|
26314
26342
|
this.clearTimer(), this.setState("paused");
|
|
@@ -26384,7 +26412,7 @@ var GD = 16, KD = 3 * GD, qD = 1e3 / 30, JD = 1e-9, YD = () => typeof requestAni
|
|
|
26384
26412
|
return this.paceMs ?? this.config.interval / this.config.speed;
|
|
26385
26413
|
}
|
|
26386
26414
|
runForming(e) {
|
|
26387
|
-
let t = this.run, n = e >=
|
|
26415
|
+
let t = this.run, n = e >= JD, r = this.clock.now(), i = -Infinity, a = (r) => {
|
|
26388
26416
|
!n || this.isAtEnd() || t !== this.run || this.state !== "playing" || (i = r, this.emit("phase", {
|
|
26389
26417
|
index: this.cursor + 1,
|
|
26390
26418
|
fraction: Math.min(1, this.owedMs / e)
|
|
@@ -26394,9 +26422,9 @@ var GD = 16, KD = 3 * GD, qD = 1e3 / 30, JD = 1e-9, YD = () => typeof requestAni
|
|
|
26394
26422
|
this.frameHandle = null;
|
|
26395
26423
|
let n = this.clock.now();
|
|
26396
26424
|
this.owedMs += Math.min(50, Math.max(0, n - r)), r = n;
|
|
26397
|
-
let s = Math.floor((this.owedMs +
|
|
26425
|
+
let s = Math.floor((this.owedMs + XD) / e);
|
|
26398
26426
|
try {
|
|
26399
|
-
s > 0 ? (this.owedMs = Math.max(0, this.owedMs - s * e), this.advance(s), a(n)) : n - i +
|
|
26427
|
+
s > 0 ? (this.owedMs = Math.max(0, this.owedMs - s * e), this.advance(s), a(n)) : n - i + qD / 2 >= YD && a(n);
|
|
26400
26428
|
} finally {
|
|
26401
26429
|
t === this.run && this.state === "playing" && this.frameHandle === null && (this.frameHandle = this.clock.frame(o));
|
|
26402
26430
|
}
|
|
@@ -26426,24 +26454,24 @@ var GD = 16, KD = 3 * GD, qD = 1e3 / 30, JD = 1e-9, YD = () => typeof requestAni
|
|
|
26426
26454
|
setState(e) {
|
|
26427
26455
|
this.state !== e && (this.state = e, this.emit("stateChange", e));
|
|
26428
26456
|
}
|
|
26429
|
-
},
|
|
26430
|
-
function
|
|
26457
|
+
}, eO = 64, tO = 3, nO = 3;
|
|
26458
|
+
function rO(e) {
|
|
26431
26459
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
26432
26460
|
}
|
|
26433
|
-
function
|
|
26461
|
+
function iO(e) {
|
|
26434
26462
|
return Array.isArray(e) ? e : [];
|
|
26435
26463
|
}
|
|
26436
|
-
function
|
|
26464
|
+
function aO(e, t) {
|
|
26437
26465
|
return typeof e == "string" ? e : t;
|
|
26438
26466
|
}
|
|
26439
|
-
function
|
|
26467
|
+
function oO(e, t) {
|
|
26440
26468
|
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
26441
26469
|
}
|
|
26442
|
-
function
|
|
26443
|
-
if (!
|
|
26470
|
+
function sO(e) {
|
|
26471
|
+
if (!rO(e) || typeof e.id != "string" || typeof e.type != "string" || !Array.isArray(e.anchors) || e.anchors.length === 0 || e.anchors.length > cO || !rO(e.style)) return null;
|
|
26444
26472
|
let t = [];
|
|
26445
26473
|
for (let n of e.anchors) {
|
|
26446
|
-
if (!
|
|
26474
|
+
if (!rO(n) || typeof n.time != "number" || typeof n.price != "number" || !Number.isFinite(n.time) || !Number.isFinite(n.price)) return null;
|
|
26447
26475
|
t.push({
|
|
26448
26476
|
time: n.time,
|
|
26449
26477
|
price: n.price
|
|
@@ -26462,34 +26490,34 @@ function aO(e) {
|
|
|
26462
26490
|
},
|
|
26463
26491
|
visible: typeof e.visible == "boolean" ? e.visible : !0,
|
|
26464
26492
|
locked: typeof e.locked == "boolean" ? e.locked : !1,
|
|
26465
|
-
options:
|
|
26493
|
+
options: rO(e.options) ? e.options : void 0,
|
|
26466
26494
|
intervals: Hs(e.intervals) ?? void 0,
|
|
26467
|
-
group:
|
|
26495
|
+
group: fO(e.group),
|
|
26468
26496
|
...fg(e.name) === void 0 ? {} : { name: fg(e.name) },
|
|
26469
|
-
...typeof e.paneId == "string" && e.paneId.length > 0 && e.paneId.length <=
|
|
26470
|
-
meta:
|
|
26497
|
+
...typeof e.paneId == "string" && e.paneId.length > 0 && e.paneId.length <= lO ? { paneId: e.paneId } : {},
|
|
26498
|
+
meta: rO(e.meta) ? e.meta : void 0
|
|
26471
26499
|
};
|
|
26472
26500
|
}
|
|
26473
|
-
var
|
|
26474
|
-
function
|
|
26475
|
-
if (!(!
|
|
26501
|
+
var cO = 5e3, lO = 200, uO = 64, dO = 80;
|
|
26502
|
+
function fO(e) {
|
|
26503
|
+
if (!(!rO(e) || typeof e.id != "string" || typeof e.name != "string") && !(e.id === "" || e.id.length > uO)) return {
|
|
26476
26504
|
id: e.id,
|
|
26477
|
-
name: e.name.slice(0,
|
|
26505
|
+
name: e.name.slice(0, dO)
|
|
26478
26506
|
};
|
|
26479
26507
|
}
|
|
26480
|
-
function
|
|
26481
|
-
return !
|
|
26508
|
+
function pO(e) {
|
|
26509
|
+
return !rO(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.type != "string" || typeof e.price != "number" || typeof e.quantity != "number" ? null : e;
|
|
26482
26510
|
}
|
|
26483
|
-
function
|
|
26484
|
-
if (!
|
|
26485
|
-
let t = {}, n =
|
|
26511
|
+
function mO(e) {
|
|
26512
|
+
if (!rO(e)) return;
|
|
26513
|
+
let t = {}, n = iO(e.colors).filter((e) => typeof e == "string");
|
|
26486
26514
|
n.length > 0 && (t.colors = n);
|
|
26487
|
-
let r =
|
|
26515
|
+
let r = iO(e.lineWidths).filter((e) => typeof e == "number" && Number.isFinite(e) && e > 0);
|
|
26488
26516
|
r.length > 0 && (t.lineWidths = r), typeof e.opacity == "number" && Number.isFinite(e.opacity) && (t.opacity = Math.min(1, Math.max(0, e.opacity)));
|
|
26489
26517
|
let i = st(e.plots);
|
|
26490
26518
|
return i && (t.plots = i), Object.keys(t).length > 0 ? t : void 0;
|
|
26491
26519
|
}
|
|
26492
|
-
var
|
|
26520
|
+
var hO = [
|
|
26493
26521
|
"crossingUp",
|
|
26494
26522
|
"crossingDown",
|
|
26495
26523
|
"crossing",
|
|
@@ -26498,9 +26526,9 @@ var pO = [
|
|
|
26498
26526
|
"movesUp",
|
|
26499
26527
|
"movesDown"
|
|
26500
26528
|
];
|
|
26501
|
-
function
|
|
26502
|
-
if (!
|
|
26503
|
-
let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r =
|
|
26529
|
+
function gO(e) {
|
|
26530
|
+
if (!rO(e) || typeof e.id != "string") return null;
|
|
26531
|
+
let t = typeof e.drawingId == "string" ? e.drawingId : void 0, n = typeof e.price == "number" && Number.isFinite(e.price) ? e.price : null, r = hO.find((t) => t === e.condition) ?? "crossing", i = KD(e), a = i.target !== void 0 || r === "movesUp" || r === "movesDown";
|
|
26504
26532
|
return n === null && !t && !a ? null : {
|
|
26505
26533
|
id: e.id,
|
|
26506
26534
|
price: n ?? NaN,
|
|
@@ -26509,44 +26537,44 @@ function mO(e) {
|
|
|
26509
26537
|
message: typeof e.message == "string" ? e.message : void 0,
|
|
26510
26538
|
triggered: e.triggered === !0,
|
|
26511
26539
|
repeating: e.repeating === !0,
|
|
26512
|
-
channel:
|
|
26540
|
+
channel: aO(e.channel, "price"),
|
|
26513
26541
|
label: typeof e.label == "string" ? e.label : void 0,
|
|
26514
26542
|
...i,
|
|
26515
26543
|
...e.expired === !0 ? { expired: !0 } : {}
|
|
26516
26544
|
};
|
|
26517
26545
|
}
|
|
26518
|
-
function hO(e) {
|
|
26519
|
-
return !tO(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
|
|
26520
|
-
}
|
|
26521
|
-
var gO = 4e3;
|
|
26522
26546
|
function _O(e) {
|
|
26523
|
-
|
|
26547
|
+
return !rO(e) || typeof e.id != "string" || typeof e.side != "string" || typeof e.entryPrice != "number" || typeof e.quantity != "number" ? null : e;
|
|
26548
|
+
}
|
|
26549
|
+
var vO = 4e3;
|
|
26550
|
+
function yO(e) {
|
|
26551
|
+
if (!rO(e)) return;
|
|
26524
26552
|
let t = {}, n = [];
|
|
26525
26553
|
for (let [r, i] of Object.entries(e)) {
|
|
26526
26554
|
let e = at(i);
|
|
26527
26555
|
n.push(...e.rejected);
|
|
26528
26556
|
let a = Object.fromEntries(Object.entries(e.overrides).filter(([, e]) => e !== null));
|
|
26529
|
-
Object.keys(a).length > 0 && (t[r.slice(0,
|
|
26557
|
+
Object.keys(a).length > 0 && (t[r.slice(0, eO)] = a);
|
|
26530
26558
|
}
|
|
26531
26559
|
return n.length > 0 && console.warn(`Saved style overrides left out: ${[...new Set(n)].join(", ")}`), t;
|
|
26532
26560
|
}
|
|
26533
|
-
function
|
|
26534
|
-
if (!
|
|
26535
|
-
typeof e.version == "number" && e.version >
|
|
26536
|
-
let t =
|
|
26537
|
-
for (let t of
|
|
26561
|
+
function bO(e) {
|
|
26562
|
+
if (!rO(e)) return xO();
|
|
26563
|
+
typeof e.version == "number" && e.version > nO && console.warn(`Chart state from a newer version (${e.version}); loading what this version understands.`);
|
|
26564
|
+
let t = rO(e.viewport) ? e.viewport : {}, n = [];
|
|
26565
|
+
for (let t of iO(e.indicators)) rO(t) && (typeof t.id != "string" || typeof t.instanceId != "string" || rO(t.params) && n.push({
|
|
26538
26566
|
id: t.id,
|
|
26539
26567
|
instanceId: t.instanceId,
|
|
26540
26568
|
params: t.params,
|
|
26541
26569
|
position: typeof t.position == "string" ? t.position : void 0,
|
|
26542
|
-
style:
|
|
26570
|
+
style: mO(t.style),
|
|
26543
26571
|
visible: typeof t.visible == "boolean" ? t.visible : void 0,
|
|
26544
26572
|
levels: Array.isArray(t.levels) ? t.levels.filter((e) => typeof e == "number" && Number.isFinite(e)) : void 0,
|
|
26545
26573
|
pane: typeof t.pane == "string" ? t.pane : void 0,
|
|
26546
26574
|
scale: t.scale === "left" ? "left" : void 0,
|
|
26547
26575
|
intervals: Hs(t.intervals) ?? void 0,
|
|
26548
26576
|
paneStyle: ct(t.paneStyle) ?? void 0,
|
|
26549
|
-
paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize,
|
|
26577
|
+
paneSize: typeof t.paneSize == "number" && Number.isFinite(t.paneSize) && t.paneSize > 0 ? Math.min(t.paneSize, vO) : void 0,
|
|
26550
26578
|
paneOrder: typeof t.paneOrder == "number" && Number.isInteger(t.paneOrder) && t.paneOrder >= 0 ? t.paneOrder : void 0,
|
|
26551
26579
|
paneCollapsed: t.paneCollapsed === !0 ? !0 : void 0,
|
|
26552
26580
|
paneMaximized: t.paneMaximized === !0 ? !0 : void 0,
|
|
@@ -26555,37 +26583,37 @@ function vO(e) {
|
|
|
26555
26583
|
panePercent: t.panePercent === !0 ? !0 : void 0
|
|
26556
26584
|
}));
|
|
26557
26585
|
let r = [];
|
|
26558
|
-
for (let t of
|
|
26559
|
-
let e =
|
|
26586
|
+
for (let t of iO(e.drawings)) {
|
|
26587
|
+
let e = sO(t);
|
|
26560
26588
|
e && r.push(e);
|
|
26561
26589
|
}
|
|
26562
26590
|
let i = [];
|
|
26563
|
-
for (let t of
|
|
26564
|
-
let e =
|
|
26591
|
+
for (let t of iO(e.orders)) {
|
|
26592
|
+
let e = pO(t);
|
|
26565
26593
|
e && i.push(e);
|
|
26566
26594
|
}
|
|
26567
26595
|
let a = [];
|
|
26568
|
-
for (let t of
|
|
26569
|
-
let e =
|
|
26596
|
+
for (let t of iO(e.positions)) {
|
|
26597
|
+
let e = _O(t);
|
|
26570
26598
|
e && a.push(e);
|
|
26571
26599
|
}
|
|
26572
26600
|
let o = [];
|
|
26573
|
-
for (let t of
|
|
26574
|
-
let e =
|
|
26601
|
+
for (let t of iO(e.alerts)) {
|
|
26602
|
+
let e = gO(t);
|
|
26575
26603
|
e && o.push(e);
|
|
26576
26604
|
}
|
|
26577
|
-
let s =
|
|
26605
|
+
let s = yO(e.overrides);
|
|
26578
26606
|
return {
|
|
26579
26607
|
version: typeof e.version == "number" && Array.isArray(e.indicators) ? e.version : 1,
|
|
26580
|
-
timestamp:
|
|
26608
|
+
timestamp: oO(e.timestamp, Date.now()),
|
|
26581
26609
|
symbol: typeof e.symbol == "string" ? e.symbol : void 0,
|
|
26582
26610
|
timeframe: typeof e.timeframe == "string" ? e.timeframe : void 0,
|
|
26583
|
-
chartType:
|
|
26611
|
+
chartType: aO(e.chartType, "candlestick"),
|
|
26584
26612
|
...e.chartTypeOptions === void 0 ? {} : { chartTypeOptions: ot(e.chartTypeOptions) },
|
|
26585
26613
|
viewport: {
|
|
26586
|
-
barWidth:
|
|
26587
|
-
barSpacing:
|
|
26588
|
-
offset:
|
|
26614
|
+
barWidth: oO(t.barWidth, 8),
|
|
26615
|
+
barSpacing: oO(t.barSpacing, 2),
|
|
26616
|
+
offset: oO(t.offset, 0)
|
|
26589
26617
|
},
|
|
26590
26618
|
theme: typeof e.theme == "string" ? e.theme : void 0,
|
|
26591
26619
|
...s ? { overrides: s } : {},
|
|
@@ -26597,7 +26625,7 @@ function vO(e) {
|
|
|
26597
26625
|
alerts: o
|
|
26598
26626
|
};
|
|
26599
26627
|
}
|
|
26600
|
-
function
|
|
26628
|
+
function xO() {
|
|
26601
26629
|
return {
|
|
26602
26630
|
version: 1,
|
|
26603
26631
|
timestamp: Date.now(),
|
|
@@ -26614,10 +26642,10 @@ function yO() {
|
|
|
26614
26642
|
alerts: []
|
|
26615
26643
|
};
|
|
26616
26644
|
}
|
|
26617
|
-
var
|
|
26645
|
+
var SO = class {
|
|
26618
26646
|
static capture(e, t) {
|
|
26619
26647
|
return {
|
|
26620
|
-
version: e.getIndicators ?
|
|
26648
|
+
version: e.getIndicators ? nO : 1,
|
|
26621
26649
|
timestamp: Date.now(),
|
|
26622
26650
|
chartType: t?.chartType ?? "candlestick",
|
|
26623
26651
|
...t?.chartTypeOptions && Object.keys(t.chartTypeOptions).length > 0 ? { chartTypeOptions: t.chartTypeOptions } : {},
|
|
@@ -26641,7 +26669,7 @@ var bO = class {
|
|
|
26641
26669
|
return JSON.stringify(e);
|
|
26642
26670
|
}
|
|
26643
26671
|
static deserialize(e) {
|
|
26644
|
-
return
|
|
26672
|
+
return bO(JSON.parse(e));
|
|
26645
26673
|
}
|
|
26646
26674
|
static saveToStorage(e, t) {
|
|
26647
26675
|
localStorage.setItem(e, this.serialize(t));
|
|
@@ -26668,7 +26696,7 @@ var bO = class {
|
|
|
26668
26696
|
}, n.click();
|
|
26669
26697
|
});
|
|
26670
26698
|
}
|
|
26671
|
-
},
|
|
26699
|
+
}, CO = class {
|
|
26672
26700
|
undoStack = [];
|
|
26673
26701
|
redoStack = [];
|
|
26674
26702
|
maxHistory = 50;
|
|
@@ -26745,7 +26773,7 @@ var bO = class {
|
|
|
26745
26773
|
redoCount: this.redoStack.length
|
|
26746
26774
|
};
|
|
26747
26775
|
}
|
|
26748
|
-
},
|
|
26776
|
+
}, wO = [
|
|
26749
26777
|
"Time",
|
|
26750
26778
|
"Open",
|
|
26751
26779
|
"High",
|
|
@@ -26753,47 +26781,47 @@ var bO = class {
|
|
|
26753
26781
|
"Close",
|
|
26754
26782
|
"Volume"
|
|
26755
26783
|
];
|
|
26756
|
-
function
|
|
26784
|
+
function TO(e, t) {
|
|
26757
26785
|
return new Date(M(e, t)).toISOString();
|
|
26758
26786
|
}
|
|
26759
|
-
function
|
|
26787
|
+
function EO(e) {
|
|
26760
26788
|
let t = /^[=+\-@\t\r]/.test(e) && !/^-?\d/.test(e) ? `'${e}` : e;
|
|
26761
26789
|
return /[",\r\n]/.test(t) ? `"${t.replace(/"/g, "\"\"")}"` : t;
|
|
26762
26790
|
}
|
|
26763
|
-
var
|
|
26764
|
-
function
|
|
26765
|
-
return e == null || !Number.isFinite(e) ? null : Number.isInteger(e) || Math.abs(e) >=
|
|
26791
|
+
var DO = 15, OO = 0x38d7ea4c68000;
|
|
26792
|
+
function kO(e) {
|
|
26793
|
+
return e == null || !Number.isFinite(e) ? null : Number.isInteger(e) || Math.abs(e) >= OO ? e : Number(e.toPrecision(DO));
|
|
26766
26794
|
}
|
|
26767
|
-
var
|
|
26768
|
-
let t =
|
|
26795
|
+
var AO = (e) => {
|
|
26796
|
+
let t = kO(e);
|
|
26769
26797
|
return t === null ? "" : String(t);
|
|
26770
|
-
},
|
|
26798
|
+
}, jO = class {
|
|
26771
26799
|
static toCSV(e, t = []) {
|
|
26772
|
-
let n = [...
|
|
26800
|
+
let n = [...wO, ...t.map((e) => EO(e.name))].join(","), r = A(e);
|
|
26773
26801
|
return [n, ...e.map((e, n) => [
|
|
26774
|
-
|
|
26802
|
+
TO(e.time, r),
|
|
26775
26803
|
...[
|
|
26776
26804
|
e.open,
|
|
26777
26805
|
e.high,
|
|
26778
26806
|
e.low,
|
|
26779
26807
|
e.close,
|
|
26780
26808
|
e.volume
|
|
26781
|
-
].map(
|
|
26782
|
-
...t.map((e) =>
|
|
26809
|
+
].map(AO),
|
|
26810
|
+
...t.map((e) => AO(e.values[n]))
|
|
26783
26811
|
].join(","))].join("\n");
|
|
26784
26812
|
}
|
|
26785
26813
|
static toJSON(e, t = []) {
|
|
26786
26814
|
let n = A(e);
|
|
26787
26815
|
return JSON.stringify(e.map((e, r) => {
|
|
26788
26816
|
let i = {
|
|
26789
|
-
time:
|
|
26790
|
-
open:
|
|
26791
|
-
high:
|
|
26792
|
-
low:
|
|
26793
|
-
close:
|
|
26794
|
-
volume:
|
|
26817
|
+
time: TO(e.time, n),
|
|
26818
|
+
open: kO(e.open),
|
|
26819
|
+
high: kO(e.high),
|
|
26820
|
+
low: kO(e.low),
|
|
26821
|
+
close: kO(e.close),
|
|
26822
|
+
volume: kO(e.volume)
|
|
26795
26823
|
};
|
|
26796
|
-
for (let e of t) i[e.name] =
|
|
26824
|
+
for (let e of t) i[e.name] = kO(e.values[r]);
|
|
26797
26825
|
return i;
|
|
26798
26826
|
}), null, 2);
|
|
26799
26827
|
}
|
|
@@ -26804,10 +26832,10 @@ var OO = (e) => {
|
|
|
26804
26832
|
};
|
|
26805
26833
|
//#endregion
|
|
26806
26834
|
//#region src/features/replayReveal.ts
|
|
26807
|
-
function
|
|
26835
|
+
function MO(e, t, n = -Infinity) {
|
|
26808
26836
|
return t === null ? e : e.filter((e) => e.time >= n && e.time < t);
|
|
26809
26837
|
}
|
|
26810
|
-
function
|
|
26838
|
+
function NO(e, t, n = -Infinity) {
|
|
26811
26839
|
return t === null ? e : e.filter((e) => e.entryTime >= n && e.entryTime < t).map((e) => {
|
|
26812
26840
|
if (e.exitTime === void 0 || e.exitTime < t) return e;
|
|
26813
26841
|
let { exitTime: n, exitPrice: r, pnl: i, pnlPercent: a, ...o } = e;
|
|
@@ -26816,7 +26844,7 @@ function jO(e, t, n = -Infinity) {
|
|
|
26816
26844
|
}
|
|
26817
26845
|
//#endregion
|
|
26818
26846
|
//#region src/features/SignalMarkerManager.ts
|
|
26819
|
-
var
|
|
26847
|
+
var PO = 1, FO = 3, IO = class extends Zw {
|
|
26820
26848
|
markers = [];
|
|
26821
26849
|
style = { ...de };
|
|
26822
26850
|
requestRender = null;
|
|
@@ -26839,7 +26867,7 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26839
26867
|
return { ...this.style };
|
|
26840
26868
|
}
|
|
26841
26869
|
addMarker(e) {
|
|
26842
|
-
let t = e.id ?? `tc_signal_${
|
|
26870
|
+
let t = e.id ?? `tc_signal_${PO++}`, n = {
|
|
26843
26871
|
...e,
|
|
26844
26872
|
id: t
|
|
26845
26873
|
};
|
|
@@ -26861,22 +26889,22 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26861
26889
|
e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
|
|
26862
26890
|
}
|
|
26863
26891
|
shownMarkers() {
|
|
26864
|
-
return [...
|
|
26892
|
+
return [...MO(this.markers, this.revealUntil, this.revealFrom)];
|
|
26865
26893
|
}
|
|
26866
26894
|
markerAt(e, t) {
|
|
26867
26895
|
let n = this.dataGetter?.();
|
|
26868
26896
|
if (!n || n.length === 0) return null;
|
|
26869
26897
|
let { chartRect: r } = t;
|
|
26870
26898
|
if (e.x < r.x || e.x > r.x + r.width || e.y < r.y || e.y > r.y + r.height) return null;
|
|
26871
|
-
let i = this.style.arrowSize ?? 12, a =
|
|
26899
|
+
let i = this.style.arrowSize ?? 12, a = MO(this.markers, this.revealUntil, this.revealFrom);
|
|
26872
26900
|
for (let r = a.length - 1; r >= 0; r--) {
|
|
26873
26901
|
let o = a[r], c = O(s(o.time, n), t), l = x(o.price, t), u = i * Math.max(.6, Math.min(1, o.confidence)), d = o.direction === "long" ? l - u : (o.direction, l - u * .4), f = o.direction === "long" ? l + u * .4 : o.direction === "short" ? l + u : l + u * .4;
|
|
26874
|
-
if (Math.abs(e.x - c) <= u * .6 +
|
|
26902
|
+
if (Math.abs(e.x - c) <= u * .6 + FO && e.y >= d - FO && e.y <= f + FO) return o;
|
|
26875
26903
|
}
|
|
26876
26904
|
return null;
|
|
26877
26905
|
}
|
|
26878
26906
|
render(e, t, n) {
|
|
26879
|
-
let r = this.dataGetter?.(), i =
|
|
26907
|
+
let r = this.dataGetter?.(), i = MO(this.markers, this.revealUntil, this.revealFrom);
|
|
26880
26908
|
if (!r || r.length === 0 || i.length === 0) return;
|
|
26881
26909
|
let { chartRect: a } = t, o = jw(this.style, n), c = o.arrowSize ?? 12;
|
|
26882
26910
|
e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
|
|
@@ -26909,18 +26937,18 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26909
26937
|
renderArrow(e, t, n, r, i, a) {
|
|
26910
26938
|
e.fillStyle = a, e.beginPath(), r === "long" ? (e.moveTo(t, n - i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n + i * .4), e.lineTo(t + i * .2, n + i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : r === "short" ? (e.moveTo(t, n + i), e.lineTo(t - i * .6, n), e.lineTo(t - i * .2, n), e.lineTo(t - i * .2, n - i * .4), e.lineTo(t + i * .2, n - i * .4), e.lineTo(t + i * .2, n), e.lineTo(t + i * .6, n)) : e.arc(t, n, i * .4, 0, Math.PI * 2), e.closePath(), e.fill();
|
|
26911
26939
|
}
|
|
26912
|
-
},
|
|
26940
|
+
}, LO = 18, RO = 4, zO = 2, BO = 6, VO = 18 + 2 * RO, HO = 3, UO = 300, WO = 10, GO = 8, KO = 8, qO = 1.35, JO = 6, YO = {
|
|
26913
26941
|
news: "N",
|
|
26914
26942
|
earnings: "E",
|
|
26915
26943
|
dividend: "D",
|
|
26916
26944
|
split: "S",
|
|
26917
26945
|
event: "i"
|
|
26918
|
-
},
|
|
26946
|
+
}, XO = {
|
|
26919
26947
|
news: "#4c8dff",
|
|
26920
26948
|
earnings: "#f2a93b",
|
|
26921
26949
|
dividend: "#4fae8a",
|
|
26922
26950
|
split: "#a78bfa"
|
|
26923
|
-
},
|
|
26951
|
+
}, ZO = 1, QO = class {
|
|
26924
26952
|
marks = [];
|
|
26925
26953
|
requestRender = null;
|
|
26926
26954
|
dataGetter = null;
|
|
@@ -26940,7 +26968,7 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26940
26968
|
addMark(e) {
|
|
26941
26969
|
let [t] = it([{
|
|
26942
26970
|
...e,
|
|
26943
|
-
id: e.id ?? `tc_mark_${
|
|
26971
|
+
id: e.id ?? `tc_mark_${ZO++}`
|
|
26944
26972
|
}]);
|
|
26945
26973
|
if (!t) return null;
|
|
26946
26974
|
let n = this.marks.filter((e) => e.id !== t.id);
|
|
@@ -26974,7 +27002,7 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26974
27002
|
badges(e) {
|
|
26975
27003
|
let t = this.dataGetter?.();
|
|
26976
27004
|
if (!t || t.length === 0 || this.marks.length === 0) return [];
|
|
26977
|
-
let { chartRect: n } = e, r = n.y + n.height - 18 / 2 -
|
|
27005
|
+
let { chartRect: n } = e, r = n.y + n.height - 18 / 2 - RO, i = [];
|
|
26978
27006
|
for (let a of this.marks) {
|
|
26979
27007
|
if (this.revealUntil !== null && (a.time < this.revealFrom || a.time >= this.revealUntil)) continue;
|
|
26980
27008
|
let o = s(a.time, t);
|
|
@@ -26982,7 +27010,7 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26982
27010
|
let c = O(Math.floor(o), e);
|
|
26983
27011
|
if (c < n.x || c > n.x + n.width) continue;
|
|
26984
27012
|
let l = i[i.length - 1];
|
|
26985
|
-
l && c - l.x < 18 +
|
|
27013
|
+
l && c - l.x < 18 + zO ? l.marks.push(a) : i.push({
|
|
26986
27014
|
x: c,
|
|
26987
27015
|
y: r,
|
|
26988
27016
|
marks: [a]
|
|
@@ -26993,7 +27021,7 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
26993
27021
|
badgeAt(e, t) {
|
|
26994
27022
|
let { chartRect: n } = t;
|
|
26995
27023
|
if (e.x < n.x || e.x > n.x + n.width || e.y < n.y || e.y > n.y + n.height) return null;
|
|
26996
|
-
let r = 18 / 2 +
|
|
27024
|
+
let r = 18 / 2 + BO, i = null, a = Infinity;
|
|
26997
27025
|
for (let n of this.badges(t)) {
|
|
26998
27026
|
let t = Math.abs(e.x - n.x), o = Math.abs(e.y - n.y);
|
|
26999
27027
|
t > r || o > r || t >= a || (a = t, i = n);
|
|
@@ -27016,51 +27044,51 @@ var MO = 1, NO = 3, PO = class extends Yw {
|
|
|
27016
27044
|
colorOf(e, t) {
|
|
27017
27045
|
if (e.color) return e.color;
|
|
27018
27046
|
let n = e.kind ?? "event";
|
|
27019
|
-
return n === "event" ? t.textSecondary :
|
|
27047
|
+
return n === "event" ? t.textSecondary : XO[n];
|
|
27020
27048
|
}
|
|
27021
27049
|
renderBadge(e, t, n, r) {
|
|
27022
27050
|
let i = t.marks[0], a = this.colorOf(i, n);
|
|
27023
27051
|
e.fillStyle = n.background, e.beginPath(), e.arc(t.x, t.y, 9 + (r ? 3 : 1.5), 0, Math.PI * 2), e.fill(), r && (e.fillStyle = a, e.globalAlpha = .35, e.beginPath(), e.arc(t.x, t.y, 12, 0, Math.PI * 2), e.fill(), e.globalAlpha = 1), e.fillStyle = a, e.beginPath(), e.arc(t.x, t.y, 9, 0, Math.PI * 2), e.fill();
|
|
27024
|
-
let o = t.marks.length > 1 ? String(t.marks.length) : i.label ??
|
|
27052
|
+
let o = t.marks.length > 1 ? String(t.marks.length) : i.label ?? YO[i.kind ?? "event"];
|
|
27025
27053
|
e.fillStyle = pn(a), e.font = `600 ${o.length > 1 ? 10 : 11}px ${n.font.family}`, e.textAlign = "center", e.textBaseline = "middle", e.fillText(o, t.x, t.y + .5);
|
|
27026
27054
|
}
|
|
27027
27055
|
renderTooltip(e, t, n, r) {
|
|
27028
|
-
let { chartRect: i } = n, a = r.font.sizeMedium, o = r.font.sizeSmall, s = `600 ${a}px ${r.font.family}`, c = `${o}px ${r.font.family}`, l = Math.min(
|
|
27056
|
+
let { chartRect: i } = n, a = r.font.sizeMedium, o = r.font.sizeSmall, s = `600 ${a}px ${r.font.family}`, c = `${o}px ${r.font.family}`, l = Math.min(UO, i.width - 2 * RO), u = l - 2 * WO;
|
|
27029
27057
|
if (u <= 0) return;
|
|
27030
|
-
let d = [...t.marks].reverse().slice(0,
|
|
27058
|
+
let d = [...t.marks].reverse().slice(0, HO), f = t.marks.length - d.length, p = [];
|
|
27031
27059
|
d.forEach((t, n) => {
|
|
27032
27060
|
p.push({
|
|
27033
|
-
text:
|
|
27061
|
+
text: $O(e, t.title, s, u),
|
|
27034
27062
|
font: s,
|
|
27035
27063
|
color: r.text,
|
|
27036
|
-
height: a *
|
|
27037
|
-
gap: n === 0 ? 0 :
|
|
27064
|
+
height: a * qO,
|
|
27065
|
+
gap: n === 0 ? 0 : KO
|
|
27038
27066
|
}), t.text && p.push({
|
|
27039
|
-
text:
|
|
27067
|
+
text: $O(e, t.text, c, u),
|
|
27040
27068
|
font: c,
|
|
27041
27069
|
color: r.textSecondary,
|
|
27042
|
-
height: o *
|
|
27070
|
+
height: o * qO,
|
|
27043
27071
|
gap: 0
|
|
27044
27072
|
});
|
|
27045
27073
|
}), f > 0 && p.push({
|
|
27046
27074
|
text: `+${f}`,
|
|
27047
27075
|
font: c,
|
|
27048
27076
|
color: r.textSecondary,
|
|
27049
|
-
height: o *
|
|
27050
|
-
gap:
|
|
27077
|
+
height: o * qO,
|
|
27078
|
+
gap: KO
|
|
27051
27079
|
});
|
|
27052
|
-
let m = p.reduce((e, t) => e + t.gap + t.height, 0) + 2 *
|
|
27080
|
+
let m = p.reduce((e, t) => e + t.gap + t.height, 0) + 2 * WO, h = Math.max(i.x + RO, Math.min(i.x + i.width - RO - l, t.x - l / 2)), g = Math.max(i.y + RO, t.y - 18 / 2 - GO - m);
|
|
27053
27081
|
this.tooltip = {
|
|
27054
27082
|
x: h,
|
|
27055
27083
|
y: g,
|
|
27056
27084
|
width: l,
|
|
27057
27085
|
height: m
|
|
27058
|
-
}, e.fillStyle = r.axisLabelBackground, e.strokeStyle = r.axisLine, e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(Math.round(h) + .5, Math.round(g) + .5, l, m,
|
|
27059
|
-
let _ = g +
|
|
27060
|
-
for (let t of p) _ += t.gap, e.font = t.font, e.fillStyle = t.color, e.fillText(t.text, h +
|
|
27086
|
+
}, e.fillStyle = r.axisLabelBackground, e.strokeStyle = r.axisLine, e.lineWidth = 1, e.beginPath(), typeof e.roundRect == "function" ? e.roundRect(Math.round(h) + .5, Math.round(g) + .5, l, m, JO) : e.rect(Math.round(h) + .5, Math.round(g) + .5, l, m), e.fill(), e.stroke(), e.textAlign = "left", e.textBaseline = "top";
|
|
27087
|
+
let _ = g + WO;
|
|
27088
|
+
for (let t of p) _ += t.gap, e.font = t.font, e.fillStyle = t.color, e.fillText(t.text, h + WO, _), _ += t.height;
|
|
27061
27089
|
}
|
|
27062
27090
|
};
|
|
27063
|
-
function
|
|
27091
|
+
function $O(e, t, n, r) {
|
|
27064
27092
|
if (e.font = n, e.measureText(t).width <= r) return t;
|
|
27065
27093
|
let i = [...t], a = 0, o = i.length;
|
|
27066
27094
|
for (; a < o;) {
|
|
@@ -27071,7 +27099,7 @@ function ZO(e, t, n, r) {
|
|
|
27071
27099
|
}
|
|
27072
27100
|
//#endregion
|
|
27073
27101
|
//#region src/features/TradeZoneManager.ts
|
|
27074
|
-
var
|
|
27102
|
+
var ek = 12, tk = 2, nk = 1, rk = class extends Zw {
|
|
27075
27103
|
zones = [];
|
|
27076
27104
|
style = { ...pe };
|
|
27077
27105
|
requestRender = null;
|
|
@@ -27098,7 +27126,7 @@ var QO = 12, $O = 2, ek = 1, tk = class extends Yw {
|
|
|
27098
27126
|
return { ...this.style };
|
|
27099
27127
|
}
|
|
27100
27128
|
addZone(e) {
|
|
27101
|
-
let t = e.id ?? `tc_zone_${
|
|
27129
|
+
let t = e.id ?? `tc_zone_${nk++}`, n = {
|
|
27102
27130
|
...e,
|
|
27103
27131
|
id: t
|
|
27104
27132
|
};
|
|
@@ -27127,10 +27155,10 @@ var QO = 12, $O = 2, ek = 1, tk = class extends Yw {
|
|
|
27127
27155
|
e === this.revealUntil && t === this.revealFrom || (this.revealUntil = e, this.revealFrom = t, this.requestRender?.());
|
|
27128
27156
|
}
|
|
27129
27157
|
shownZones() {
|
|
27130
|
-
return [...
|
|
27158
|
+
return [...NO(this.zones, this.revealUntil, this.revealFrom)];
|
|
27131
27159
|
}
|
|
27132
27160
|
render(e, t, n) {
|
|
27133
|
-
let r = this.dataGetter?.(), i =
|
|
27161
|
+
let r = this.dataGetter?.(), i = NO(this.zones, this.revealUntil, this.revealFrom);
|
|
27134
27162
|
if (!r || r.length === 0 || i.length === 0) return;
|
|
27135
27163
|
let { chartRect: a } = t, o = Mw(this.style, n);
|
|
27136
27164
|
e.save(), e.beginPath(), e.rect(a.x, a.y, a.width, a.height), e.clip();
|
|
@@ -27143,15 +27171,15 @@ var QO = 12, $O = 2, ek = 1, tk = class extends Yw {
|
|
|
27143
27171
|
let m = x(t.entryPrice, r), h = t.exitPrice == null ? x(t.entryPrice, r) : x(t.exitPrice, r), g = Math.min(m, h), _ = Math.max(Math.max(m, h) - g, 2), v = t.exitTime == null, y = t.pnl == null ? t.direction === "long" ? (t.exitPrice ?? t.entryPrice) >= t.entryPrice : (t.exitPrice ?? t.entryPrice) <= t.entryPrice : t.pnl >= 0, b = v ? a.activeColor ?? "#4c8dff" : y ? a.profitColor ?? "#1fa874" : a.lossColor ?? "#e8505b";
|
|
27144
27172
|
e.fillStyle = b, e.globalAlpha = a.fillOpacity ?? .12, e.fillRect(f, g, p - f, _), e.globalAlpha = 1;
|
|
27145
27173
|
let S = a.borderWidth ?? 1;
|
|
27146
|
-
if (e.strokeStyle = b, e.lineWidth = S, e.setLineDash([]), e.beginPath(), e.moveTo(f, Math.round(m) + .5), e.lineTo(p, Math.round(m) + .5), e.stroke(), !v && t.exitPrice != null && (e.setLineDash([3, 3]), e.beginPath(), e.moveTo(f, Math.round(h) + .5), e.lineTo(p, Math.round(h) + .5), e.stroke(), e.setLineDash([])), wC(e, t.direction === "long" ? Ae.trendingUp : Ae.trendingDown, f + 4, m - 3 -
|
|
27147
|
-
let n = t.pnl >= 0 ? "+" : "", a = (e) => j(e,
|
|
27174
|
+
if (e.strokeStyle = b, e.lineWidth = S, e.setLineDash([]), e.beginPath(), e.moveTo(f, Math.round(m) + .5), e.lineTo(p, Math.round(m) + .5), e.stroke(), !v && t.exitPrice != null && (e.setLineDash([3, 3]), e.beginPath(), e.moveTo(f, Math.round(h) + .5), e.lineTo(p, Math.round(h) + .5), e.stroke(), e.setLineDash([])), wC(e, t.direction === "long" ? Ae.trendingUp : Ae.trendingDown, f + 4, m - 3 - ek, ek, b), e.font = `bold 10px ${i.font.family}`, e.fillStyle = b, e.textBaseline = "bottom", e.textAlign = "left", e.fillText(nt(t.entryPrice, r, this.pricePrecision ?? void 0), f + 4 + ek + 3, m - 3), a.showPnl && !v && t.pnl != null) {
|
|
27175
|
+
let n = t.pnl >= 0 ? "+" : "", a = (e) => j(e, tk, r.numberLocale ?? "en-US"), o = t.pnlPercent == null ? `${n}${a(t.pnl)}` : `${n}${a(t.pnl)} (${n}${a(t.pnlPercent)}%)`;
|
|
27148
27176
|
e.font = `bold 10px ${i.font.family}`, e.fillStyle = b, e.textBaseline = "top", e.textAlign = "right";
|
|
27149
27177
|
let s = e.measureText(o).width + 8, c = p - s - 2, l = g + 2;
|
|
27150
27178
|
e.globalAlpha = .85, e.fillStyle = i.background, ln(e, c, l, s, 14, i), e.globalAlpha = 1, e.fillStyle = b, e.fillText(o, p - 4, l + 1);
|
|
27151
27179
|
}
|
|
27152
27180
|
a.showLabel && t.label && (e.font = `9px ${i.font.family}`, e.fillStyle = b, e.globalAlpha = .8, e.textBaseline = "top", e.textAlign = "left", e.fillText(t.label, f + 4, m + 3), e.globalAlpha = 1);
|
|
27153
27181
|
}
|
|
27154
|
-
},
|
|
27182
|
+
}, ik = 2, ak = 4, ok = Ce, sk = class {
|
|
27155
27183
|
active = !1;
|
|
27156
27184
|
startBar = 0;
|
|
27157
27185
|
startPrice = 0;
|
|
@@ -27164,36 +27192,36 @@ var QO = 12, $O = 2, ek = 1, tk = class extends Yw {
|
|
|
27164
27192
|
}
|
|
27165
27193
|
begin(e, t, n) {
|
|
27166
27194
|
let r = Math.round(l(e.x, t)), i = a(e.y, t);
|
|
27167
|
-
this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime =
|
|
27195
|
+
this.startBar = r, this.startPrice = i, this.endBar = r, this.endPrice = i, this.startTime = ck(r, n), this.endTime = this.startTime, this.active = !0;
|
|
27168
27196
|
}
|
|
27169
27197
|
update(e, t, n) {
|
|
27170
27198
|
if (!this.active) return;
|
|
27171
27199
|
let r = Math.round(l(e.x, t));
|
|
27172
|
-
this.endBar = r, this.endPrice = a(e.y, t), this.endTime =
|
|
27200
|
+
this.endBar = r, this.endPrice = a(e.y, t), this.endTime = ck(r, n);
|
|
27173
27201
|
}
|
|
27174
27202
|
end() {
|
|
27175
27203
|
this.active = !1;
|
|
27176
27204
|
}
|
|
27177
27205
|
render(e, t, n) {
|
|
27178
27206
|
if (!this.active) return;
|
|
27179
|
-
let r = O(this.startBar, t), i = O(this.endBar, t), a = x(this.startPrice, t), o = x(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m =
|
|
27207
|
+
let r = O(this.startBar, t), i = O(this.endBar, t), a = x(this.startPrice, t), o = x(this.endPrice, t), s = Math.min(r, i), c = Math.max(r, i), l = Math.min(a, o), u = Math.max(a, o), d = c - s, f = u - l, p = this.endPrice >= this.startPrice ? n.candleUp : n.candleDown, m = hk(p, .14);
|
|
27180
27208
|
e.save();
|
|
27181
27209
|
let { chartRect: h } = t;
|
|
27182
|
-
e.beginPath(), e.rect(h.x, h.y, h.width, h.height), e.clip(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(),
|
|
27183
|
-
let g = Math.abs(this.endBar - this.startBar), _ = this.endPrice - this.startPrice, v = this.startPrice === 0 ? 0 : _ / this.startPrice * 100, y = this.startTime !== null && this.endTime !== null ?
|
|
27184
|
-
b.push(`${S}${
|
|
27210
|
+
e.beginPath(), e.rect(h.x, h.y, h.width, h.height), e.clip(), e.fillStyle = m, e.fillRect(s, l, d, f), e.strokeStyle = p, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(s + .5, l + .5, d, f), e.setLineDash([]), e.strokeStyle = p, e.lineWidth = 1.5, e.beginPath(), e.moveTo(r, a), e.lineTo(i, o), e.stroke(), fk(e, r, a, p), fk(e, i, o, p), e.restore();
|
|
27211
|
+
let g = Math.abs(this.endBar - this.startBar), _ = this.endPrice - this.startPrice, v = this.startPrice === 0 ? 0 : _ / this.startPrice * 100, y = this.startTime !== null && this.endTime !== null ? dk(Math.abs(this.endTime - this.startTime)) : null, b = [], S = _ > 0 ? "+" : _ < 0 ? "−" : "", C = Math.abs(_), w = j(Math.abs(v), ik, t.numberLocale ?? "en-US");
|
|
27212
|
+
b.push(`${S}${lk(C, t)} (${S}${w}%)`), b.push(`${g} bars${y ? " · " + y : ""}`), e.save(), pk(e, i, o, b, p, n), e.restore();
|
|
27185
27213
|
}
|
|
27186
27214
|
};
|
|
27187
|
-
function
|
|
27215
|
+
function ck(e, t) {
|
|
27188
27216
|
return e < 0 || e >= t.length ? null : t[e].time * A(t);
|
|
27189
27217
|
}
|
|
27190
|
-
function
|
|
27191
|
-
return nt(e, t, t.pricePrecision ??
|
|
27218
|
+
function lk(e, t) {
|
|
27219
|
+
return nt(e, t, t.pricePrecision ?? uk(e));
|
|
27192
27220
|
}
|
|
27193
|
-
function
|
|
27194
|
-
return e >= 1e3 ? 2 : e >= 1 ? 4 : e <= 0 ?
|
|
27221
|
+
function uk(e) {
|
|
27222
|
+
return e >= 1e3 ? 2 : e >= 1 ? 4 : e <= 0 ? ak - 1 : Math.min(ok, ak - 1 - Math.floor(Math.log10(e)));
|
|
27195
27223
|
}
|
|
27196
|
-
function
|
|
27224
|
+
function dk(e) {
|
|
27197
27225
|
let t = e / 1e3;
|
|
27198
27226
|
if (t < 60) return `${t.toFixed(0)}s`;
|
|
27199
27227
|
let n = t / 60;
|
|
@@ -27205,10 +27233,10 @@ function lk(e) {
|
|
|
27205
27233
|
let a = i / 30;
|
|
27206
27234
|
return a < 12 ? `${a.toFixed(1)}mo` : `${(i / 365).toFixed(1)}y`;
|
|
27207
27235
|
}
|
|
27208
|
-
function
|
|
27236
|
+
function fk(e, t, n, r) {
|
|
27209
27237
|
e.fillStyle = r, e.beginPath(), e.arc(t, n, 3.5, 0, Math.PI * 2), e.fill(), e.fillStyle = "#fff", e.beginPath(), e.arc(t, n, 1.5, 0, Math.PI * 2), e.fill();
|
|
27210
27238
|
}
|
|
27211
|
-
function
|
|
27239
|
+
function pk(e, t, n, r, i, a) {
|
|
27212
27240
|
e.font = `600 11px ${a.font.family}`;
|
|
27213
27241
|
let o = 0;
|
|
27214
27242
|
for (let t of r) {
|
|
@@ -27216,13 +27244,13 @@ function dk(e, t, n, r, i, a) {
|
|
|
27216
27244
|
n > o && (o = n);
|
|
27217
27245
|
}
|
|
27218
27246
|
let s = Math.ceil(o) + 16, c = r.length * 14 + 12, l = t + 8, u = n + 8, d = e.canvas.clientWidth || e.canvas.width;
|
|
27219
|
-
l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96,
|
|
27247
|
+
l + s > d - 4 && (l = t - s - 8), l < 4 && (l = 4), e.fillStyle = a.background, e.globalAlpha = .96, mk(e, l, u, s, c, 6), e.fill(), e.globalAlpha = 1, e.strokeStyle = i, e.lineWidth = 1, mk(e, l + .5, u + .5, s - 1, c - 1, 6), e.stroke(), e.fillStyle = a.text, e.textBaseline = "top", e.textAlign = "left";
|
|
27220
27248
|
for (let t = 0; t < r.length; t++) e.fillStyle = t === 0 ? i : a.textSecondary, e.fillText(r[t], l + 8, u + 6 + t * 14);
|
|
27221
27249
|
}
|
|
27222
|
-
function
|
|
27250
|
+
function mk(e, t, n, r, i, a) {
|
|
27223
27251
|
e.beginPath(), e.moveTo(t + a, n), e.arcTo(t + r, n, t + r, n + i, a), e.arcTo(t + r, n + i, t, n + i, a), e.arcTo(t, n + i, t, n, a), e.arcTo(t, n, t + r, n, a), e.closePath();
|
|
27224
27252
|
}
|
|
27225
|
-
function
|
|
27253
|
+
function hk(e, t) {
|
|
27226
27254
|
if (e.startsWith("#")) {
|
|
27227
27255
|
let n = 0, r = 0, i = 0;
|
|
27228
27256
|
return e.length === 4 ? (n = parseInt(e[1] + e[1], 16), r = parseInt(e[2] + e[2], 16), i = parseInt(e[3] + e[3], 16)) : e.length >= 7 && (n = parseInt(e.slice(1, 3), 16), r = parseInt(e.slice(3, 5), 16), i = parseInt(e.slice(5, 7), 16)), `rgba(${n},${r},${i},${t})`;
|
|
@@ -27235,7 +27263,7 @@ function pk(e, t) {
|
|
|
27235
27263
|
}
|
|
27236
27264
|
//#endregion
|
|
27237
27265
|
//#region src/features/SelectionBoxOverlay.ts
|
|
27238
|
-
var
|
|
27266
|
+
var gk = 6, _k = class {
|
|
27239
27267
|
start = null;
|
|
27240
27268
|
current = null;
|
|
27241
27269
|
isActive() {
|
|
@@ -27267,7 +27295,7 @@ var mk = 6, hk = class {
|
|
|
27267
27295
|
let { chartRect: r } = t, i = (e) => Math.max(r.x, Math.min(r.x + r.width, e)), a = (e) => Math.max(r.y, Math.min(r.y + r.height, e)), o = i(Math.min(this.start.x, this.current.x)), s = i(Math.max(this.start.x, this.current.x)), c = a(Math.min(this.start.y, this.current.y)), l = a(Math.max(this.start.y, this.current.y));
|
|
27268
27296
|
e.save(), e.fillStyle = n.crosshair, e.globalAlpha = .1, e.fillRect(o, c, s - o, l - c), e.globalAlpha = .8, e.strokeStyle = n.crosshair, e.lineWidth = 1, e.setLineDash([4, 3]), e.strokeRect(Math.round(o) + .5, Math.round(c) + .5, Math.round(s - o), Math.round(l - c)), e.restore();
|
|
27269
27297
|
}
|
|
27270
|
-
},
|
|
27298
|
+
}, vk = {
|
|
27271
27299
|
linear: (e) => e,
|
|
27272
27300
|
easeOutCubic: (e) => 1 - (1 - e) ** 3,
|
|
27273
27301
|
easeOutQuart: (e) => 1 - (1 - e) ** 4,
|
|
@@ -27275,7 +27303,7 @@ var mk = 6, hk = class {
|
|
|
27275
27303
|
easeOutExpo: (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e),
|
|
27276
27304
|
easeOutElastic: (e) => e === 0 || e === 1 ? e : 2 ** (-10 * e) * Math.sin((e * 10 - .75) * (2 * Math.PI / 3)) + 1,
|
|
27277
27305
|
spring: (e) => 1 - Math.E ** (-6 * e) * Math.cos(8 * e)
|
|
27278
|
-
},
|
|
27306
|
+
}, yk = class {
|
|
27279
27307
|
animations = /* @__PURE__ */ new Map();
|
|
27280
27308
|
frameId = 0;
|
|
27281
27309
|
running = !1;
|
|
@@ -27283,7 +27311,7 @@ var mk = 6, hk = class {
|
|
|
27283
27311
|
this.animations.set(e, {
|
|
27284
27312
|
startTime: -1,
|
|
27285
27313
|
duration: t.duration,
|
|
27286
|
-
easing: t.easing ??
|
|
27314
|
+
easing: t.easing ?? vk.easeOutCubic,
|
|
27287
27315
|
onUpdate: t.onUpdate,
|
|
27288
27316
|
onComplete: t.onComplete
|
|
27289
27317
|
}), this.running || (this.running = !0, this.tick());
|
|
@@ -27318,11 +27346,11 @@ var mk = 6, hk = class {
|
|
|
27318
27346
|
};
|
|
27319
27347
|
//#endregion
|
|
27320
27348
|
//#region src/finance/BaseFinanceChart.ts
|
|
27321
|
-
function
|
|
27349
|
+
function bk(e) {
|
|
27322
27350
|
return !e || e === "dark" ? ae : e === "light" ? ye : e;
|
|
27323
27351
|
}
|
|
27324
|
-
function
|
|
27325
|
-
let n =
|
|
27352
|
+
function xk(e, t) {
|
|
27353
|
+
let n = bk(e), r = Object.fromEntries(Object.entries(t ?? {}).filter(([, e]) => e !== void 0));
|
|
27326
27354
|
return {
|
|
27327
27355
|
...n,
|
|
27328
27356
|
font: {
|
|
@@ -27331,7 +27359,7 @@ function yk(e, t) {
|
|
|
27331
27359
|
}
|
|
27332
27360
|
};
|
|
27333
27361
|
}
|
|
27334
|
-
var
|
|
27362
|
+
var Sk = class {
|
|
27335
27363
|
canvas;
|
|
27336
27364
|
ctx;
|
|
27337
27365
|
container;
|
|
@@ -27344,7 +27372,7 @@ var bk = class {
|
|
|
27344
27372
|
themeGiven;
|
|
27345
27373
|
fontGiven;
|
|
27346
27374
|
constructor(e, t, n) {
|
|
27347
|
-
this.container = e, this.themeGiven = t, this.fontGiven = n, this.theme =
|
|
27375
|
+
this.container = e, this.themeGiven = t, this.fontGiven = n, this.theme = xk(t, n), this.canvas = document.createElement("canvas"), this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.display = "block", zt(this.canvas), this.canvas.setAttribute("role", "img"), e.appendChild(this.canvas), this.ctx = this.canvas.getContext("2d"), this.sizer = new Rt(e), this.updateSize(), this.sizer.onResize(() => {
|
|
27348
27376
|
this.updateSize(), this.renderNow();
|
|
27349
27377
|
});
|
|
27350
27378
|
}
|
|
@@ -27364,18 +27392,18 @@ var bk = class {
|
|
|
27364
27392
|
this.width === 0 || this.height === 0 || (this.ctx.save(), this.ctx.setTransform(this.canvas.width / this.width, 0, 0, this.canvas.height / this.height, 0, 0), this.ctx.clearRect(0, 0, this.width, this.height), this.renderChart(this.ctx, this.width, this.height, this.theme), this.ctx.restore());
|
|
27365
27393
|
}
|
|
27366
27394
|
applyBaseOptions(e) {
|
|
27367
|
-
"theme" in e && (this.themeGiven = e.theme), "font" in e && (this.fontGiven = e.font), ("theme" in e || "font" in e) && (this.theme =
|
|
27395
|
+
"theme" in e && (this.themeGiven = e.theme), "font" in e && (this.fontGiven = e.font), ("theme" in e || "font" in e) && (this.theme = xk(this.themeGiven, this.fontGiven)), e.ariaLabel !== void 0 && this.setLabel(e.ariaLabel);
|
|
27368
27396
|
}
|
|
27369
27397
|
setLabel(e) {
|
|
27370
27398
|
this.canvas.setAttribute("aria-label", e);
|
|
27371
27399
|
}
|
|
27372
27400
|
setTheme(e) {
|
|
27373
|
-
this.themeGiven = e, this.theme =
|
|
27401
|
+
this.themeGiven = e, this.theme = xk(e, this.fontGiven), this.requestRender();
|
|
27374
27402
|
}
|
|
27375
27403
|
destroy() {
|
|
27376
27404
|
this.frameId !== null && cancelAnimationFrame(this.frameId), this.sizer.destroy(), this.canvas.width = 0, this.canvas.height = 0, this.canvas.remove();
|
|
27377
27405
|
}
|
|
27378
|
-
},
|
|
27406
|
+
}, Ck = class {
|
|
27379
27407
|
pos = null;
|
|
27380
27408
|
canvas;
|
|
27381
27409
|
onUpdate;
|
|
@@ -27414,7 +27442,7 @@ var bk = class {
|
|
|
27414
27442
|
};
|
|
27415
27443
|
//#endregion
|
|
27416
27444
|
//#region src/finance/SparklineRenderer.ts
|
|
27417
|
-
function
|
|
27445
|
+
function wk(e, t, n, r, i) {
|
|
27418
27446
|
let { data: a, mode: o = "area", lineWidth: s = 1.5, showLastPoint: c = !1, showMinMax: l = !1 } = r;
|
|
27419
27447
|
if (a.length < 2 || t <= 0 || n <= 0) return;
|
|
27420
27448
|
let u = r.color ?? i.lineColor, d = r.fillColor ?? u, f = t - 4, p = n - 4, m = Infinity, h = -Infinity, g = 0, _ = 0;
|
|
@@ -27439,16 +27467,16 @@ function Sk(e, t, n, r, i) {
|
|
|
27439
27467
|
}
|
|
27440
27468
|
//#endregion
|
|
27441
27469
|
//#region src/finance/DepthChartRenderer.ts
|
|
27442
|
-
var
|
|
27443
|
-
function
|
|
27470
|
+
var Tk = .2, Ek = .01, Dk = 24, Ok = 16, kk = "Spread";
|
|
27471
|
+
function Ak(e, t) {
|
|
27444
27472
|
let n = e.filter((e) => Number.isFinite(e.price) && Number.isFinite(e.volume)).sort((e, n) => t === "bid" ? n.price - e.price : e.price - n.price), r = 0;
|
|
27445
27473
|
return n.map((e) => ({
|
|
27446
27474
|
price: e.price,
|
|
27447
27475
|
cumulativeVolume: r += e.volume
|
|
27448
27476
|
}));
|
|
27449
27477
|
}
|
|
27450
|
-
function
|
|
27451
|
-
let i =
|
|
27478
|
+
function jk(e, t, n, r) {
|
|
27479
|
+
let i = Ak(e.data.bids, "bid"), a = Ak(e.data.asks, "ask"), o = i[0]?.price, s = a[0]?.price, c = o !== void 0 && s !== void 0, l = c ? (o + s) / 2 : o ?? s ?? 0, u = i.length > 0 ? i[i.length - 1].price : l, d = a.length > 0 ? a[a.length - 1].price : l, f = (Math.max(l - u, d - l) || Math.abs(l) * Ek || 1) * (1 + Tk), p = um(0, Math.max(0, ...i.map((e) => e.cumulativeVolume), ...a.map((e) => e.cumulativeVolume)) || 1, 5), m = e.volumeFormat ?? J(p, e.locale), h = 12 + Math.max(0, ...p.ticks.map((e) => r(m(e), 11))) + 8, g = 12 + (c && e.midPriceLine !== !1 && e.spreadLabel !== !1 ? Ok : 0);
|
|
27452
27480
|
return {
|
|
27453
27481
|
plot: {
|
|
27454
27482
|
x: h,
|
|
@@ -27465,13 +27493,13 @@ function kk(e, t, n, r) {
|
|
|
27465
27493
|
spread: c ? s - o : 0
|
|
27466
27494
|
};
|
|
27467
27495
|
}
|
|
27468
|
-
function
|
|
27496
|
+
function Mk(e, t) {
|
|
27469
27497
|
return e.length === 1 ? [e[0], {
|
|
27470
27498
|
price: t,
|
|
27471
27499
|
cumulativeVolume: e[0].cumulativeVolume
|
|
27472
27500
|
}] : e;
|
|
27473
27501
|
}
|
|
27474
|
-
function
|
|
27502
|
+
function Nk(e, t, n) {
|
|
27475
27503
|
let r = null;
|
|
27476
27504
|
for (let i of e) {
|
|
27477
27505
|
if (n === "bid" ? i.price < t : i.price > t) break;
|
|
@@ -27479,14 +27507,14 @@ function jk(e, t, n) {
|
|
|
27479
27507
|
}
|
|
27480
27508
|
return r;
|
|
27481
27509
|
}
|
|
27482
|
-
function
|
|
27510
|
+
function Pk(e, t, n, r, i, a, o) {
|
|
27483
27511
|
if (t <= 0 || n <= 0) return;
|
|
27484
27512
|
e.fillStyle = i.background, e.fillRect(0, 0, t, n);
|
|
27485
27513
|
let { data: s } = r;
|
|
27486
27514
|
if (s.bids.length === 0 && s.asks.length === 0) return;
|
|
27487
|
-
let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), { plot: l, volume: u, priceMin: d, priceMax: f, bids: p, asks: m, mid: h, spread: g } =
|
|
27515
|
+
let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), { plot: l, volume: u, priceMin: d, priceMax: f, bids: p, asks: m, mid: h, spread: g } = jk(r, t, n, c), _ = l.y + l.height, v = (e) => l.x + (e - d) / (f - d) * l.width, y = (e) => q(u, e, l.y, l.height, !0), b = Fm([...p, ...m].map((e) => e.price)), x = r.priceFormat ?? vm(r.locale, b), S = r.volumeFormat ?? hm(r.locale);
|
|
27488
27516
|
Im(e, l, u, "vertical", i, r.volumeFormat ?? J(u, r.locale)), e.save(), e.font = Y(i, 11), e.fillStyle = i.axisLabel, e.strokeStyle = i.grid, e.textAlign = "center", e.textBaseline = "top";
|
|
27489
|
-
let C = c(x(f), 11) +
|
|
27517
|
+
let C = c(x(f), 11) + Dk, w = um(d, f, Math.max(2, Math.floor(l.width / C))), T = r.priceFormat ?? J(w, r.locale);
|
|
27490
27518
|
e.font = Y(i, 11);
|
|
27491
27519
|
for (let t of w.ticks) t < d || t > f || (Dm(e, v(t), l.y, v(t), _), e.fillText(T(t), Math.round(v(t)), _ + 6));
|
|
27492
27520
|
e.restore();
|
|
@@ -27497,10 +27525,10 @@ function Mk(e, t, n, r, i, a, o) {
|
|
|
27497
27525
|
};
|
|
27498
27526
|
e.fillStyle = r, e.beginPath(), e.moveTo(v(t[0].price), _), e.lineTo(v(t[0].price), y(t[0].cumulativeVolume)), i(), e.lineTo(v(t[t.length - 1].price), _), e.closePath(), e.fill(), e.strokeStyle = n, e.lineWidth = 1.5, e.lineJoin = "miter", e.beginPath(), e.moveTo(v(t[0].price), y(t[0].cumulativeVolume)), i(), e.stroke();
|
|
27499
27527
|
}, ee = r.bidColor ?? i.candleUp, te = r.askColor ?? i.candleDown;
|
|
27500
|
-
if (e.save(), e.beginPath(), e.rect(l.x, l.y, l.width, l.height), e.clip(), E(
|
|
27528
|
+
if (e.save(), e.beginPath(), e.rect(l.x, l.y, l.width, l.height), e.clip(), E(Mk(p, d), ee, r.bidFillColor ?? N(ee, .25)), E(Mk(m, f), te, r.askFillColor ?? N(te, .25)), e.restore(), h !== null && r.midPriceLine !== !1 && (e.save(), e.strokeStyle = i.textSecondary, e.setLineDash([4, 4]), Dm(e, v(h), l.y, v(h), _), e.setLineDash([]), r.spreadLabel !== !1 && (e.font = Y(i, 11), e.fillStyle = i.textSecondary, e.textAlign = "center", e.textBaseline = "middle", e.fillText(`${typeof r.spreadLabel == "string" ? r.spreadLabel : kk}: ${x(g)}`, Math.round(v(h)), 12 + Ok / 2 - 2)), e.restore()), !a || a.x < l.x || a.x > l.x + l.width) return;
|
|
27501
27529
|
let D = d + (a.x - l.x) / l.width * (f - d);
|
|
27502
27530
|
e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, a.x, l.y, a.x, _), e.restore();
|
|
27503
|
-
let O =
|
|
27531
|
+
let O = Nk(p, D, "bid"), k = Nk(m, D, "ask"), ne = [{
|
|
27504
27532
|
text: x((O ?? k)?.price ?? D),
|
|
27505
27533
|
bold: !0
|
|
27506
27534
|
}];
|
|
@@ -27519,8 +27547,8 @@ function Mk(e, t, n, r, i, a, o) {
|
|
|
27519
27547
|
}
|
|
27520
27548
|
//#endregion
|
|
27521
27549
|
//#region src/finance/EquityCurveRenderer.ts
|
|
27522
|
-
var
|
|
27523
|
-
function
|
|
27550
|
+
var Fk = .19, Ik = 864e5, Lk = 80, Rk = 3, zk = .05, Bk = "Benchmark";
|
|
27551
|
+
function Vk(e, t) {
|
|
27524
27552
|
let n = -1, r = Infinity;
|
|
27525
27553
|
for (let i = 0; i < e.length; i++) {
|
|
27526
27554
|
let a = Math.abs(e[i].time - t);
|
|
@@ -27528,17 +27556,17 @@ function zk(e, t) {
|
|
|
27528
27556
|
}
|
|
27529
27557
|
return n;
|
|
27530
27558
|
}
|
|
27531
|
-
function
|
|
27532
|
-
return _m(n, e <
|
|
27533
|
-
...t >
|
|
27559
|
+
function Hk(e, t, n) {
|
|
27560
|
+
return _m(n, e < Ik ? {
|
|
27561
|
+
...t > Ik ? {
|
|
27534
27562
|
month: "short",
|
|
27535
27563
|
day: "numeric"
|
|
27536
27564
|
} : {},
|
|
27537
27565
|
hour: "2-digit",
|
|
27538
27566
|
minute: "2-digit"
|
|
27539
|
-
} : e >= 28 *
|
|
27567
|
+
} : e >= 28 * Ik ? {
|
|
27540
27568
|
month: "short",
|
|
27541
|
-
...t >= 365 *
|
|
27569
|
+
...t >= 365 * Ik ? { year: "numeric" } : {},
|
|
27542
27570
|
timeZone: "UTC"
|
|
27543
27571
|
} : {
|
|
27544
27572
|
month: "short",
|
|
@@ -27546,28 +27574,28 @@ function Bk(e, t, n) {
|
|
|
27546
27574
|
timeZone: "UTC"
|
|
27547
27575
|
});
|
|
27548
27576
|
}
|
|
27549
|
-
function
|
|
27550
|
-
let n = e < 7 *
|
|
27577
|
+
function Uk(e, t) {
|
|
27578
|
+
let n = e < 7 * Ik;
|
|
27551
27579
|
return _m(t, {
|
|
27552
27580
|
month: "short",
|
|
27553
27581
|
day: "numeric",
|
|
27554
|
-
...e >= 365 *
|
|
27582
|
+
...e >= 365 * Ik ? { year: "numeric" } : {},
|
|
27555
27583
|
...n ? {
|
|
27556
27584
|
hour: "2-digit",
|
|
27557
27585
|
minute: "2-digit"
|
|
27558
27586
|
} : { timeZone: "UTC" }
|
|
27559
27587
|
});
|
|
27560
27588
|
}
|
|
27561
|
-
function
|
|
27589
|
+
function Wk(e) {
|
|
27562
27590
|
for (let t = 1; t < e.length; t++) if (e[t].time < e[t - 1].time) return [...e].sort((e, t) => e.time - t.time);
|
|
27563
27591
|
return e;
|
|
27564
27592
|
}
|
|
27565
|
-
function
|
|
27593
|
+
function Gk(e, t, n, r, i = "") {
|
|
27566
27594
|
let { data: a, benchmark: o } = e, s = Infinity, c = -Infinity, l = Infinity, u = -Infinity;
|
|
27567
27595
|
for (let e of a) Number.isFinite(e.value) && (s = Math.min(s, e.value), c = Math.max(c, e.value)), Number.isFinite(e.time) && (l = Math.min(l, e.time), u = Math.max(u, e.time));
|
|
27568
27596
|
for (let e of o ?? []) Number.isFinite(e.value) && (s = Math.min(s, e.value), c = Math.max(c, e.value));
|
|
27569
|
-
let d = s === c ? Math.abs(s) *
|
|
27570
|
-
label: e.benchmarkLabel ??
|
|
27597
|
+
let d = s === c ? Math.abs(s) * zk || 1 : 0, f = um(s - d, c + d, 5), p = e.valueFormat ?? J(f, e.locale), m = Math.max(0, ...f.ticks.map((e) => r(p(e), 11))), h = o && o.length >= 2 ? Cm([{
|
|
27598
|
+
label: e.benchmarkLabel ?? Bk,
|
|
27571
27599
|
color: i
|
|
27572
27600
|
}], t - 24, r) : null, g = 12 + m + 8, _ = 12 + (h ? h.height + 6 : 0);
|
|
27573
27601
|
return {
|
|
@@ -27583,8 +27611,8 @@ function Uk(e, t, n, r, i = "") {
|
|
|
27583
27611
|
legend: h
|
|
27584
27612
|
};
|
|
27585
27613
|
}
|
|
27586
|
-
function
|
|
27587
|
-
let { plot: o, timeMin: s, timeMax: c } = t, l = Pm(s, c, Math.max(1, Math.floor(o.width /
|
|
27614
|
+
function Kk(e, t, n, r, i, a) {
|
|
27615
|
+
let { plot: o, timeMin: s, timeMax: c } = t, l = Pm(s, c, Math.max(1, Math.floor(o.width / Lk))), u = i ?? Hk(l.length > 1 ? l[1] - l[0] : c - s, c - s, a);
|
|
27588
27616
|
e.save(), e.font = Y(r, 11), e.fillStyle = r.axisLabel, e.strokeStyle = r.grid, e.textAlign = "center", e.textBaseline = "top";
|
|
27589
27617
|
for (let t of l) {
|
|
27590
27618
|
let r = o.x + (t - s) / (c - s) * o.width;
|
|
@@ -27594,12 +27622,12 @@ function Wk(e, t, n, r, i, a) {
|
|
|
27594
27622
|
}
|
|
27595
27623
|
e.restore();
|
|
27596
27624
|
}
|
|
27597
|
-
function
|
|
27625
|
+
function qk(e, t, n, r, i, a, o) {
|
|
27598
27626
|
if (t <= 0 || n <= 0 || (e.fillStyle = i.background, e.fillRect(0, 0, t, n), r.data.length < 2)) return;
|
|
27599
|
-
let s =
|
|
27627
|
+
let s = Wk(r.data), c = r.benchmark && Wk(r.benchmark), l = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), u = r.lineColor ?? i.lineColor, d = r.benchmarkColor ?? i.textSecondary, f = Gk(r, t, n, l, d), { plot: p, scale: m, timeMin: h, timeMax: g, legend: _ } = f;
|
|
27600
27628
|
if (!(g >= h)) return;
|
|
27601
|
-
let v = g - h || 1, y = (e) => p.x + (e - h) / v * p.width, b = (e) => q(m, e, p.y, p.height, !0), x = p.y + p.height, S = r.timeFormat ??
|
|
27602
|
-
Im(e, p, m, "vertical", i, r.valueFormat ?? J(m, r.locale)),
|
|
27629
|
+
let v = g - h || 1, y = (e) => p.x + (e - h) / v * p.width, b = (e) => q(m, e, p.y, p.height, !0), x = p.y + p.height, S = r.timeFormat ?? Uk(v, r.locale);
|
|
27630
|
+
Im(e, p, m, "vertical", i, r.valueFormat ?? J(m, r.locale)), Kk(e, f, t, i, r.timeFormat, r.locale), _ && wm(e, _, p.x, 12, i);
|
|
27603
27631
|
let C = (t, n = (e) => t[e].value) => {
|
|
27604
27632
|
e.moveTo(y(t[0].time), b(n(0)));
|
|
27605
27633
|
for (let r = 1; r < t.length; r++) e.lineTo(y(t[r].time), b(n(r)));
|
|
@@ -27607,7 +27635,7 @@ function Gk(e, t, n, r, i, a, o) {
|
|
|
27607
27635
|
if (e.save(), e.beginPath(), e.rect(p.x, p.y, p.width, p.height), e.clip(), r.drawdown === !0) {
|
|
27608
27636
|
let t = [], n = -Infinity;
|
|
27609
27637
|
for (let e of s) t.push(n = Number.isFinite(e.value) ? Math.max(n, e.value) : n);
|
|
27610
|
-
e.fillStyle = r.drawdownColor ?? N(i.candleDown,
|
|
27638
|
+
e.fillStyle = r.drawdownColor ?? N(i.candleDown, Fk), e.beginPath(), C(s, (e) => t[e]);
|
|
27611
27639
|
for (let t = s.length - 1; t >= 0; t--) e.lineTo(y(s[t].time), b(s[t].value));
|
|
27612
27640
|
e.closePath(), e.fill();
|
|
27613
27641
|
}
|
|
@@ -27616,18 +27644,18 @@ function Gk(e, t, n, r, i, a, o) {
|
|
|
27616
27644
|
t.addColorStop(0, N(u, $p)), t.addColorStop(1, "transparent"), e.fillStyle = t, e.beginPath(), C(s), e.lineTo(y(s[s.length - 1].time), x), e.lineTo(y(s[0].time), x), e.closePath(), e.fill();
|
|
27617
27645
|
}
|
|
27618
27646
|
if (e.lineJoin = "round", c && c.length >= 2 && (e.strokeStyle = d, e.lineWidth = 1, e.beginPath(), C(c), e.stroke()), e.strokeStyle = u, e.lineWidth = r.lineWidth ?? 1.5, e.beginPath(), C(s), e.stroke(), e.restore(), !a || a.x < p.x || a.x > p.x + p.width) return;
|
|
27619
|
-
let w = s[
|
|
27647
|
+
let w = s[Vk(s, h + (a.x - p.x) / p.width * v)];
|
|
27620
27648
|
if (!w) return;
|
|
27621
|
-
e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, y(w.time), p.y, y(w.time), x), e.restore(), e.fillStyle = u, e.beginPath(), e.arc(y(w.time), b(w.value),
|
|
27649
|
+
e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, y(w.time), p.y, y(w.time), x), e.restore(), e.fillStyle = u, e.beginPath(), e.arc(y(w.time), b(w.value), Rk, 0, Math.PI * 2), e.fill();
|
|
27622
27650
|
let T = r.valueFormat ?? hm(r.locale), E = [{
|
|
27623
27651
|
text: S(w.time),
|
|
27624
27652
|
bold: !0
|
|
27625
27653
|
}, {
|
|
27626
27654
|
text: T(w.value),
|
|
27627
27655
|
color: u
|
|
27628
|
-
}], ee = c ?
|
|
27656
|
+
}], ee = c ? Vk(c, w.time) : -1;
|
|
27629
27657
|
c && ee >= 0 && E.push({
|
|
27630
|
-
text: `${r.benchmarkLabel ??
|
|
27658
|
+
text: `${r.benchmarkLabel ?? Bk}: ${T(c[ee].value)}`,
|
|
27631
27659
|
color: d
|
|
27632
27660
|
}), Tm(e, E, a, {
|
|
27633
27661
|
x: 0,
|
|
@@ -27638,7 +27666,7 @@ function Gk(e, t, n, r, i, a, o) {
|
|
|
27638
27666
|
}
|
|
27639
27667
|
//#endregion
|
|
27640
27668
|
//#region src/finance/HeatmapLayout.ts
|
|
27641
|
-
function
|
|
27669
|
+
function Jk(e, t, n) {
|
|
27642
27670
|
if (e.length === 0) return [];
|
|
27643
27671
|
let r = e.length, i = Math.ceil(Math.sqrt(r)), a = Math.ceil(r / i), o = t.width / i, s = t.height / a, c = [];
|
|
27644
27672
|
for (let a = 0; a < r; a++) {
|
|
@@ -27655,7 +27683,7 @@ function Kk(e, t, n) {
|
|
|
27655
27683
|
}
|
|
27656
27684
|
return c;
|
|
27657
27685
|
}
|
|
27658
|
-
function
|
|
27686
|
+
function Yk(e, t) {
|
|
27659
27687
|
let n = e.reduce((e, t) => e + t, 0);
|
|
27660
27688
|
if (n === 0 || t === 0) return Infinity;
|
|
27661
27689
|
let r = 0;
|
|
@@ -27665,7 +27693,7 @@ function qk(e, t) {
|
|
|
27665
27693
|
}
|
|
27666
27694
|
return r;
|
|
27667
27695
|
}
|
|
27668
|
-
function
|
|
27696
|
+
function Xk(e, t, n, r, i, a) {
|
|
27669
27697
|
let o = r ? n.height : n.width, s = e.reduce((e, t) => e + t, 0), c = o > 0 ? s / o : 0, l = 0;
|
|
27670
27698
|
for (let o = 0; o < e.length; o++) {
|
|
27671
27699
|
let s = c > 0 ? e[o] / c : 0, u;
|
|
@@ -27685,19 +27713,19 @@ function Jk(e, t, n, r, i, a) {
|
|
|
27685
27713
|
}), l += s;
|
|
27686
27714
|
}
|
|
27687
27715
|
}
|
|
27688
|
-
function
|
|
27716
|
+
function Zk(e, t, n, r, i) {
|
|
27689
27717
|
if (e.length === 0) return;
|
|
27690
27718
|
let a = n.width >= n.height, o = a ? n.height : n.width;
|
|
27691
27719
|
if (e.length === 1) {
|
|
27692
|
-
|
|
27720
|
+
Xk(e, t, n, a, r, i);
|
|
27693
27721
|
return;
|
|
27694
27722
|
}
|
|
27695
27723
|
let s = [], c = [], l = 0;
|
|
27696
27724
|
for (; l < e.length;) {
|
|
27697
27725
|
let u = [...s, e[l]];
|
|
27698
|
-
if (s.length === 0 ||
|
|
27726
|
+
if (s.length === 0 || Yk(u, o) <= Yk(s, o)) s.push(e[l]), c.push(t[l]), l++;
|
|
27699
27727
|
else {
|
|
27700
|
-
|
|
27728
|
+
Xk(s, c, n, a, r, i);
|
|
27701
27729
|
let u = s.reduce((e, t) => e + t, 0), d = o > 0 ? u / o : 0;
|
|
27702
27730
|
n = a ? {
|
|
27703
27731
|
x: n.x + d,
|
|
@@ -27709,37 +27737,37 @@ function Yk(e, t, n, r, i) {
|
|
|
27709
27737
|
y: n.y + d,
|
|
27710
27738
|
width: n.width,
|
|
27711
27739
|
height: n.height - d
|
|
27712
|
-
},
|
|
27740
|
+
}, Zk(e.slice(l), t.slice(l), n, r, i);
|
|
27713
27741
|
return;
|
|
27714
27742
|
}
|
|
27715
27743
|
}
|
|
27716
|
-
s.length > 0 &&
|
|
27744
|
+
s.length > 0 && Xk(s, c, n, a, r, i);
|
|
27717
27745
|
}
|
|
27718
|
-
function
|
|
27746
|
+
function Qk(e, t, n) {
|
|
27719
27747
|
if (e.length === 0) return [];
|
|
27720
27748
|
let r = (e) => e.weight > 0 && Number.isFinite(e.weight) ? e.weight : 0, i = [...e].sort((e, t) => r(t) - r(e)), a = i.reduce((e, t) => e + r(t), 0);
|
|
27721
27749
|
if (a === 0) return [];
|
|
27722
27750
|
let o = t.width * t.height, s = i.map((e) => r(e) / a * o), c = i.map((e) => e.id), l = [];
|
|
27723
|
-
return
|
|
27751
|
+
return Zk(s, c, { ...t }, n, l), l;
|
|
27724
27752
|
}
|
|
27725
|
-
var
|
|
27726
|
-
function
|
|
27753
|
+
var $k = 2, eA = 18;
|
|
27754
|
+
function tA(e, t, n, r = 18) {
|
|
27727
27755
|
let i = /* @__PURE__ */ new Map();
|
|
27728
27756
|
for (let t of e) {
|
|
27729
27757
|
if (!(t.weight > 0)) continue;
|
|
27730
27758
|
let e = t.group ?? "", n = i.get(e);
|
|
27731
27759
|
n ? n.push(t) : i.set(e, [t]);
|
|
27732
27760
|
}
|
|
27733
|
-
let a = [...i.keys()], o =
|
|
27761
|
+
let a = [...i.keys()], o = Qk(a.map((e, t) => ({
|
|
27734
27762
|
id: String(t),
|
|
27735
27763
|
weight: i.get(e).reduce((e, t) => e + t.weight, 0)
|
|
27736
27764
|
})), t, 0), s = [], c = [];
|
|
27737
27765
|
for (let e of o) {
|
|
27738
27766
|
let t = a[Number(e.id)], o = i.get(t), l = o.reduce((e, t) => e + t.weight, 0), u = o.reduce((e, t) => e + (Number.isFinite(t.value) ? t.value * t.weight : 0), 0), d = e.rect, f = t !== "" && d.height >= r * 2.5 && d.width >= 40 ? r : 0, p = {
|
|
27739
|
-
x: d.x +
|
|
27740
|
-
y: d.y +
|
|
27741
|
-
width: Math.max(0, d.width -
|
|
27742
|
-
height: Math.max(0, d.height -
|
|
27767
|
+
x: d.x + $k / 2,
|
|
27768
|
+
y: d.y + $k / 2 + f,
|
|
27769
|
+
width: Math.max(0, d.width - $k),
|
|
27770
|
+
height: Math.max(0, d.height - $k - f)
|
|
27743
27771
|
};
|
|
27744
27772
|
s.push({
|
|
27745
27773
|
name: t,
|
|
@@ -27747,7 +27775,7 @@ function $k(e, t, n, r = 18) {
|
|
|
27747
27775
|
header: f,
|
|
27748
27776
|
value: l > 0 ? u / l : 0,
|
|
27749
27777
|
count: o.length
|
|
27750
|
-
}), c.push(...
|
|
27778
|
+
}), c.push(...Qk(o, p, n));
|
|
27751
27779
|
}
|
|
27752
27780
|
return {
|
|
27753
27781
|
groups: s,
|
|
@@ -27756,13 +27784,13 @@ function $k(e, t, n, r = 18) {
|
|
|
27756
27784
|
}
|
|
27757
27785
|
//#endregion
|
|
27758
27786
|
//#region src/finance/HeatmapRenderer.ts
|
|
27759
|
-
function
|
|
27787
|
+
function nA(e) {
|
|
27760
27788
|
return Number.isFinite(e) ? (e >= 0 ? "+" : "") + e.toFixed(2) + "%" : "";
|
|
27761
27789
|
}
|
|
27762
|
-
function
|
|
27790
|
+
function rA(e) {
|
|
27763
27791
|
return e.label;
|
|
27764
27792
|
}
|
|
27765
|
-
function
|
|
27793
|
+
function iA(e, t) {
|
|
27766
27794
|
let n = t.min ?? -5, r = t.max ?? 5;
|
|
27767
27795
|
if (!Number.isFinite(e)) return t.zero;
|
|
27768
27796
|
if (e <= n) return t.negative;
|
|
@@ -27774,20 +27802,20 @@ function nA(e, t) {
|
|
|
27774
27802
|
let i = e / r;
|
|
27775
27803
|
return Je(t.zero, t.positive, i);
|
|
27776
27804
|
}
|
|
27777
|
-
var
|
|
27778
|
-
function
|
|
27805
|
+
var aA = "#FFFFFF", oA = "#11151b";
|
|
27806
|
+
function sA(e, t) {
|
|
27779
27807
|
let n = /^rgba\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/i.exec(e.trim());
|
|
27780
|
-
return Jm(n ? Je(t, `rgb(${n[1]},${n[2]},${n[3]})`, Number(n[4])) : Je(e, e, 0)) ===
|
|
27808
|
+
return Jm(n ? Je(t, `rgb(${n[1]},${n[2]},${n[3]})`, Number(n[4])) : Je(e, e, 0)) === oA ? oA : aA;
|
|
27781
27809
|
}
|
|
27782
|
-
function
|
|
27810
|
+
function cA(e, t, n, r, i, a) {
|
|
27783
27811
|
let o = Math.min(a, r / 2, i / 2);
|
|
27784
27812
|
e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.arcTo(t + r, n, t + r, n + o, o), e.lineTo(t + r, n + i - o), e.arcTo(t + r, n + i, t + r - o, n + i, o), e.lineTo(t + o, n + i), e.arcTo(t, n + i, t, n + i - o, o), e.lineTo(t, n + o), e.arcTo(t, n, t + o, n, o), e.closePath();
|
|
27785
27813
|
}
|
|
27786
|
-
function
|
|
27814
|
+
function lA(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
27787
27815
|
if (i < 40 || a < 30) return;
|
|
27788
27816
|
let f = n + i / 2, p = r + a / 2;
|
|
27789
27817
|
e.save();
|
|
27790
|
-
let m = d ===
|
|
27818
|
+
let m = d === aA;
|
|
27791
27819
|
if (e.shadowColor = m ? "rgba(0,0,0,0.6)" : "transparent", e.shadowBlur = m ? 2 : 0, e.fillStyle = d, e.textAlign = "center", s) {
|
|
27792
27820
|
let n = l(t), r = Math.min(o.font.sizeMedium, i / n.length * 1.5, a / 4);
|
|
27793
27821
|
e.font = "bold " + Math.max(8, r) + "px " + o.font.family, e.textBaseline = c ? "bottom" : "middle", e.fillText(n, f, c ? p - 1 : p, i - 8);
|
|
@@ -27798,7 +27826,7 @@ function sA(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
27798
27826
|
}
|
|
27799
27827
|
e.restore();
|
|
27800
27828
|
}
|
|
27801
|
-
function
|
|
27829
|
+
function uA(e, t, n, r) {
|
|
27802
27830
|
let i = [{
|
|
27803
27831
|
text: n(e),
|
|
27804
27832
|
bold: !0
|
|
@@ -27810,7 +27838,7 @@ function cA(e, t, n, r) {
|
|
|
27810
27838
|
for (let [t, n] of Object.entries(e.meta ?? {})) i.push({ text: t + ": " + String(n) });
|
|
27811
27839
|
return i;
|
|
27812
27840
|
}
|
|
27813
|
-
function
|
|
27841
|
+
function dA(e, t, n, r, i, a, o, s, c = []) {
|
|
27814
27842
|
if (t <= 0 || n <= 0 || (e.fillStyle = o.background, e.fillRect(0, 0, t, n), r.length === 0 || i.length === 0)) return null;
|
|
27815
27843
|
let l = a.colorScale, u = Wm([], o, l), d = {
|
|
27816
27844
|
negative: u.negative,
|
|
@@ -27818,7 +27846,7 @@ function lA(e, t, n, r, i, a, o, s, c = []) {
|
|
|
27818
27846
|
positive: u.positive,
|
|
27819
27847
|
min: l?.min,
|
|
27820
27848
|
max: l?.max
|
|
27821
|
-
}, f = a.cellRadius ?? 4, p = a.showLabels !== !1, m = a.showValues !== !1, h = a.valueFormat ??
|
|
27849
|
+
}, f = a.cellRadius ?? 4, p = a.showLabels !== !1, m = a.showValues !== !1, h = a.valueFormat ?? nA, g = a.labelFormat ?? rA, _ = /* @__PURE__ */ new Map();
|
|
27822
27850
|
for (let e of r) _.set(e.id, e);
|
|
27823
27851
|
let v = null, y = null;
|
|
27824
27852
|
if (s) for (let e of i) {
|
|
@@ -27838,16 +27866,16 @@ function lA(e, t, n, r, i, a, o, s, c = []) {
|
|
|
27838
27866
|
if (!n) continue;
|
|
27839
27867
|
let { x: r, y: i, width: a, height: s } = t.rect;
|
|
27840
27868
|
if (a <= 0 || s <= 0) continue;
|
|
27841
|
-
let c =
|
|
27842
|
-
|
|
27869
|
+
let c = iA(n.value, d);
|
|
27870
|
+
cA(e, r, i, a, s, f), e.fillStyle = c, e.fill(), lA(e, n, r, i, a, s, o, p, m, g, h, sA(c, o.background)), t.id === v && (cA(e, r, i, a, s, f), e.strokeStyle = o.text, e.lineWidth = 1.5, e.stroke());
|
|
27843
27871
|
}
|
|
27844
|
-
let b = s && !y ? c.find((e) => e.header > 0 &&
|
|
27845
|
-
return
|
|
27872
|
+
let b = s && !y ? c.find((e) => e.header > 0 && fA(e, s)) : void 0;
|
|
27873
|
+
return pA(e, c, o, h, b), y && s ? Tm(e, uA(y.cell, iA(y.cell.value, d), g, h), s, {
|
|
27846
27874
|
x: 0,
|
|
27847
27875
|
y: 0,
|
|
27848
27876
|
width: t,
|
|
27849
27877
|
height: n
|
|
27850
|
-
}, o) : b && s && Tm(e,
|
|
27878
|
+
}, o) : b && s && Tm(e, uA({
|
|
27851
27879
|
id: "",
|
|
27852
27880
|
label: b.name,
|
|
27853
27881
|
value: b.value
|
|
@@ -27858,11 +27886,11 @@ function lA(e, t, n, r, i, a, o, s, c = []) {
|
|
|
27858
27886
|
height: n
|
|
27859
27887
|
}, o), y;
|
|
27860
27888
|
}
|
|
27861
|
-
function
|
|
27889
|
+
function fA(e, t) {
|
|
27862
27890
|
let n = e.rect;
|
|
27863
27891
|
return t.x >= n.x && t.x <= n.x + n.width && t.y >= n.y && t.y <= n.y + e.header;
|
|
27864
27892
|
}
|
|
27865
|
-
function
|
|
27893
|
+
function pA(e, t, n, r, i) {
|
|
27866
27894
|
if (t.length === 0) return;
|
|
27867
27895
|
e.save(), e.textBaseline = "middle";
|
|
27868
27896
|
let a = n.font.sizeSmall, o = (t) => e.measureText(t).width;
|
|
@@ -27879,14 +27907,14 @@ function dA(e, t, n, r, i) {
|
|
|
27879
27907
|
}
|
|
27880
27908
|
//#endregion
|
|
27881
27909
|
//#region src/finance/WaterfallRenderer.ts
|
|
27882
|
-
var
|
|
27883
|
-
function
|
|
27910
|
+
var mA = .7, hA = 1, gA = .382, _A = Math.PI / 4, vA = 4;
|
|
27911
|
+
function yA(e) {
|
|
27884
27912
|
return e.type ? e.type : e.value < 0 ? "negative" : "positive";
|
|
27885
27913
|
}
|
|
27886
|
-
function
|
|
27914
|
+
function bA(e) {
|
|
27887
27915
|
let t = 0;
|
|
27888
27916
|
return e.map((e) => {
|
|
27889
|
-
let n =
|
|
27917
|
+
let n = yA(e), r = Number.isFinite(e.value) ? e.value : 0, i = n === "total" || n === "subtotal" ? 0 : t, a = i + r;
|
|
27890
27918
|
return t = a, {
|
|
27891
27919
|
type: n,
|
|
27892
27920
|
value: r,
|
|
@@ -27895,15 +27923,15 @@ function vA(e) {
|
|
|
27895
27923
|
};
|
|
27896
27924
|
});
|
|
27897
27925
|
}
|
|
27898
|
-
function
|
|
27899
|
-
let i = e.data ?? [], a =
|
|
27926
|
+
function xA(e, t, n, r) {
|
|
27927
|
+
let i = e.data ?? [], a = bA(i), o = 0, s = 0;
|
|
27900
27928
|
for (let { start: e, end: t } of a) o = Math.min(o, e, t), s = Math.max(s, e, t);
|
|
27901
|
-
let c = (s - o || 1) * .1, l = um(o < 0 ? o - c : 0, s > 0 ? s + c : 0, 5), u = e.valueFormat ?? J(l, e.locale), d = 12 + Math.max(0, ...l.ticks.map((e) => r(u(e), 11))) + 8, f = Math.max(1, t - d - 12), p = f / Math.max(1, i.length), m = e.labelFormat ?? ((e) => e), h = Math.max(0, ...i.map((e) => r(m(e.label), 11))), g = h > p - 4, _ = g ? Math.min(n *
|
|
27929
|
+
let c = (s - o || 1) * .1, l = um(o < 0 ? o - c : 0, s > 0 ? s + c : 0, 5), u = e.valueFormat ?? J(l, e.locale), d = 12 + Math.max(0, ...l.ticks.map((e) => r(u(e), 11))) + 8, f = Math.max(1, t - d - 12), p = f / Math.max(1, i.length), m = e.labelFormat ?? ((e) => e), h = Math.max(0, ...i.map((e) => r(m(e.label), 11))), g = h > p - 4, _ = g ? Math.min(n * gA, Math.ceil((h + 11) * Math.sin(_A)) + 6) : 20, v = {
|
|
27902
27930
|
x: d,
|
|
27903
27931
|
y: 12,
|
|
27904
27932
|
width: f,
|
|
27905
27933
|
height: Math.max(1, n - 24 - _)
|
|
27906
|
-
}, y = p * Math.min(1, Math.max(.05, e.barWidth ??
|
|
27934
|
+
}, y = p * Math.min(1, Math.max(.05, e.barWidth ?? mA)), b = (e) => q(l, e, v.y, v.height, !0);
|
|
27907
27935
|
return {
|
|
27908
27936
|
plot: v,
|
|
27909
27937
|
scale: l,
|
|
@@ -27918,7 +27946,7 @@ function yA(e, t, n, r) {
|
|
|
27918
27946
|
x: r + (p - y) / 2,
|
|
27919
27947
|
y: n,
|
|
27920
27948
|
width: y,
|
|
27921
|
-
height: Math.max(
|
|
27949
|
+
height: Math.max(hA, Math.abs(b(e.end) - b(e.start))),
|
|
27922
27950
|
slotX: r,
|
|
27923
27951
|
slotWidth: p
|
|
27924
27952
|
};
|
|
@@ -27927,11 +27955,11 @@ function yA(e, t, n, r) {
|
|
|
27927
27955
|
labelRoom: _
|
|
27928
27956
|
};
|
|
27929
27957
|
}
|
|
27930
|
-
function
|
|
27958
|
+
function SA(e, t) {
|
|
27931
27959
|
let { plot: n, bars: r } = e;
|
|
27932
27960
|
return r.length === 0 || t < n.x || t > n.x + n.width ? -1 : Math.min(r.length - 1, Math.floor((t - n.x) / r[0].slotWidth));
|
|
27933
27961
|
}
|
|
27934
|
-
function
|
|
27962
|
+
function CA(e, t, n, r) {
|
|
27935
27963
|
let { bars: i, scale: a, plot: o } = t;
|
|
27936
27964
|
if (r !== "none") {
|
|
27937
27965
|
e.save(), e.strokeStyle = n, e.setLineDash(r === "dashed" ? [4, 4] : []);
|
|
@@ -27942,21 +27970,21 @@ function xA(e, t, n, r) {
|
|
|
27942
27970
|
e.restore();
|
|
27943
27971
|
}
|
|
27944
27972
|
}
|
|
27945
|
-
function
|
|
27973
|
+
function wA(e, t, n, r, i) {
|
|
27946
27974
|
e.save(), e.font = Y(n, 10), e.fillStyle = n.textSecondary, e.textAlign = "center";
|
|
27947
27975
|
let a = [];
|
|
27948
27976
|
for (let n of t.bars) {
|
|
27949
27977
|
let t = n.type === "positive" || n.type === "negative" ? i ? `${n.value >= 0 ? "+" : ""}${r(n.value)}` : r(n.end) : r(n.value), o = e.measureText(t).width, s = n.end < n.start, c = n.x + n.width / 2, l = {
|
|
27950
27978
|
x: c - o / 2,
|
|
27951
|
-
y: s ? n.y + n.height +
|
|
27979
|
+
y: s ? n.y + n.height + vA : n.y - vA - 11,
|
|
27952
27980
|
width: o,
|
|
27953
27981
|
height: 11
|
|
27954
27982
|
};
|
|
27955
|
-
a.some((e) => l.x < e.x + e.width + 2 && e.x < l.x + l.width + 2 && l.y < e.y + e.height && e.y < l.y + l.height) || (a.push(l), e.textBaseline = s ? "top" : "bottom", e.fillText(t, Math.round(c), Math.round(s ? l.y : n.y -
|
|
27983
|
+
a.some((e) => l.x < e.x + e.width + 2 && e.x < l.x + l.width + 2 && l.y < e.y + e.height && e.y < l.y + l.height) || (a.push(l), e.textBaseline = s ? "top" : "bottom", e.fillText(t, Math.round(c), Math.round(s ? l.y : n.y - vA)));
|
|
27956
27984
|
}
|
|
27957
27985
|
e.restore();
|
|
27958
27986
|
}
|
|
27959
|
-
function
|
|
27987
|
+
function TA(e, t, n, r, i) {
|
|
27960
27988
|
let { plot: a, bars: o, turned: s, labelRoom: c } = t;
|
|
27961
27989
|
e.save(), e.font = Y(n, 11), e.fillStyle = n.axisLabel;
|
|
27962
27990
|
let l = a.y + a.height + 6;
|
|
@@ -27968,23 +27996,23 @@ function CA(e, t, n, r, i) {
|
|
|
27968
27996
|
}
|
|
27969
27997
|
e.textAlign = "right", e.textBaseline = "middle";
|
|
27970
27998
|
for (let t of o) {
|
|
27971
|
-
let n = t.slotX + t.slotWidth / 2, a = Math.min((c - 6) / Math.sin(
|
|
27972
|
-
o && (e.save(), e.translate(n, l + 2), e.rotate(-
|
|
27999
|
+
let n = t.slotX + t.slotWidth / 2, a = Math.min((c - 6) / Math.sin(_A) - 11, (n - 2) / Math.cos(_A)), o = Lm(r(t.label), a, i);
|
|
28000
|
+
o && (e.save(), e.translate(n, l + 2), e.rotate(-_A), e.fillText(o, 0, 0), e.restore());
|
|
27973
28001
|
}
|
|
27974
28002
|
e.restore();
|
|
27975
28003
|
}
|
|
27976
|
-
function
|
|
28004
|
+
function EA(e, t, n, r, i, a, o) {
|
|
27977
28005
|
if (t <= 0 || n <= 0) return { hitBar: null };
|
|
27978
28006
|
e.fillStyle = i.background, e.fillRect(0, 0, t, n);
|
|
27979
28007
|
let s = r.data;
|
|
27980
28008
|
if (!s || s.length === 0) return { hitBar: null };
|
|
27981
|
-
let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), l =
|
|
28009
|
+
let c = o ?? ((t, n = 11) => (e.font = Y(i, n), e.measureText(t).width)), l = xA(r, t, n, c), { plot: u, scale: d, bars: f } = l, p = r.valueFormat ?? J(d, r.locale), m = r.valueFormat ?? hm(r.locale), h = {
|
|
27982
28010
|
positive: r.positiveColor ?? i.candleUp,
|
|
27983
28011
|
negative: r.negativeColor ?? i.candleDown,
|
|
27984
28012
|
total: r.totalColor ?? i.lineColor,
|
|
27985
28013
|
subtotal: r.subtotalColor ?? i.textSecondary
|
|
27986
28014
|
};
|
|
27987
|
-
Im(e, u, d, "vertical", i, p),
|
|
28015
|
+
Im(e, u, d, "vertical", i, p), CA(e, l, r.connectorColor ?? i.textSecondary, r.connectorStyle ?? "dashed");
|
|
27988
28016
|
let g = Em(e);
|
|
27989
28017
|
for (let t of f) {
|
|
27990
28018
|
let n = g.x(t.x) - g.width / 2, r = g.x(t.x + t.width) - g.width / 2;
|
|
@@ -27992,8 +28020,8 @@ function wA(e, t, n, r, i, a, o) {
|
|
|
27992
28020
|
}
|
|
27993
28021
|
e.strokeStyle = i.axisLine;
|
|
27994
28022
|
let _ = q(d, 0, u.y, u.height, !0);
|
|
27995
|
-
Dm(e, u.x, _, u.x + u.width, _), r.showValues !== !1 &&
|
|
27996
|
-
let v = a ?
|
|
28023
|
+
Dm(e, u.x, _, u.x + u.width, _), r.showValues !== !1 && wA(e, l, i, m, r.showDelta !== !1), TA(e, l, i, r.labelFormat ?? ((e) => e), c);
|
|
28024
|
+
let v = a ? SA(l, a.x) : -1;
|
|
27997
28025
|
if (a && v >= 0) {
|
|
27998
28026
|
let r = f[v], o = r.slotX + r.slotWidth / 2;
|
|
27999
28027
|
e.save(), e.strokeStyle = i.crosshair, e.setLineDash([4, 4]), Dm(e, o, u.y, o, u.y + u.height), e.restore();
|
|
@@ -28018,22 +28046,22 @@ function wA(e, t, n, r, i, a, o) {
|
|
|
28018
28046
|
}
|
|
28019
28047
|
//#endregion
|
|
28020
28048
|
//#region src/finance/GaugeRenderer.ts
|
|
28021
|
-
var
|
|
28022
|
-
function
|
|
28049
|
+
var DA = Math.PI / 180, OA = 150, kA = 240, AA = 90, jA = .14, MA = 1.6 * DA, NA = .22, PA = 8, FA = 18, IA = 16, LA = 6.5, RA = 20, zA = 5, BA = 28;
|
|
28050
|
+
function VA(e, t, n) {
|
|
28023
28051
|
return e < t ? t : e > n ? n : e;
|
|
28024
28052
|
}
|
|
28025
|
-
function
|
|
28053
|
+
function HA(e) {
|
|
28026
28054
|
let t = Math.abs(e);
|
|
28027
28055
|
return t >= 1e6 ? (e / 1e6).toFixed(2) + "M" : t >= 1e3 ? (e / 1e3).toFixed(1) + "K" : Number.isInteger(e) ? e.toFixed(0) : e.toFixed(1);
|
|
28028
28056
|
}
|
|
28029
|
-
function
|
|
28030
|
-
let t = Number.isFinite(e.startAngle) ? e.startAngle :
|
|
28031
|
-
return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n =
|
|
28032
|
-
start: (t % 360 + 360) % 360 *
|
|
28033
|
-
sweep: n *
|
|
28057
|
+
function UA(e) {
|
|
28058
|
+
let t = Number.isFinite(e.startAngle) ? e.startAngle : OA, n = (Number.isFinite(e.endAngle) ? e.endAngle : t + kA) - t;
|
|
28059
|
+
return n <= 0 && (n = (n % 360 + 360) % 360 || 360), n = VA(n, AA, 360), {
|
|
28060
|
+
start: (t % 360 + 360) % 360 * DA,
|
|
28061
|
+
sweep: n * DA
|
|
28034
28062
|
};
|
|
28035
28063
|
}
|
|
28036
|
-
function
|
|
28064
|
+
function WA(e, t) {
|
|
28037
28065
|
let n = Math.min(Math.cos(e), Math.cos(t)), r = Math.max(Math.cos(e), Math.cos(t)), i = Math.min(Math.sin(e), Math.sin(t)), a = Math.max(Math.sin(e), Math.sin(t));
|
|
28038
28066
|
for (let o = Math.ceil(e / (Math.PI / 2)); Math.PI / 2 * o <= t; o++) {
|
|
28039
28067
|
let e = Math.PI / 2 * o;
|
|
@@ -28046,15 +28074,15 @@ function HA(e, t) {
|
|
|
28046
28074
|
maxY: a
|
|
28047
28075
|
};
|
|
28048
28076
|
}
|
|
28049
|
-
function
|
|
28077
|
+
function GA(e) {
|
|
28050
28078
|
if (e.showZoneLabels !== !0 || !e.zones) return 0;
|
|
28051
28079
|
let t = e.zones.reduce((e, t) => Math.max(e, t.label?.length ?? 0), 0);
|
|
28052
|
-
return t > 0 ? t *
|
|
28080
|
+
return t > 0 ? t * LA + 12 : 0;
|
|
28053
28081
|
}
|
|
28054
|
-
function
|
|
28082
|
+
function KA(e, t, n) {
|
|
28055
28083
|
let r = Number.isFinite(n.min) ? n.min : 0, i = Number.isFinite(n.max) ? n.max : 100;
|
|
28056
28084
|
i - r > Math.abs(r) * 1e-9 || (i = r + Math.max(1, Math.abs(r) * 1e-6));
|
|
28057
|
-
let { start: a, sweep: o } =
|
|
28085
|
+
let { start: a, sweep: o } = UA(n), s = a, c = a + o, l = VA(n.thickness ?? jA, .04, .5), u = WA(s, c), d = Math.max(u.maxY, .18), f = GA(n), p = f > 0 ? IA : 0, m = Math.max(1, e - 2 * PA - 2 * f), h = Math.max(1, t - 2 * PA - FA - p), g = 1 + l / 2, _ = Math.max(8, Math.min(m / ((u.maxX - u.minX) * g), h / ((d - u.minY) * g))), v = _ * l, y = (d - u.minY) * _ * g + FA + p, b = e / 2 - (u.maxX + u.minX) / 2 * _, x = (t - y) / 2 + p - u.minY * _ * g, S = _ - v / 2, C = Math.max(11, Math.round(S * .46)), w = u.maxY > .3 ? x - C * .12 : x - C * .55, T = Math.max(Math.sin(s), Math.sin(c)), E = T > .2 ? x + T * _ + v / 2 + 2 : Infinity, ee = Math.min(t - PA, E);
|
|
28058
28086
|
return {
|
|
28059
28087
|
cx: b,
|
|
28060
28088
|
cy: x,
|
|
@@ -28069,20 +28097,20 @@ function WA(e, t, n) {
|
|
|
28069
28097
|
textBottom: ee
|
|
28070
28098
|
};
|
|
28071
28099
|
}
|
|
28072
|
-
function
|
|
28073
|
-
let n = Number.isFinite(e) ?
|
|
28100
|
+
function qA(e, t) {
|
|
28101
|
+
let n = Number.isFinite(e) ? VA((e - t.min) / (t.max - t.min), 0, 1) : 0;
|
|
28074
28102
|
return t.startAngle + (t.endAngle - t.startAngle) * n;
|
|
28075
28103
|
}
|
|
28076
|
-
function
|
|
28104
|
+
function JA(e, t) {
|
|
28077
28105
|
if (!t || !Number.isFinite(e)) return;
|
|
28078
28106
|
let n;
|
|
28079
28107
|
for (let r of t) e >= r.from && e <= r.to && (n = r);
|
|
28080
28108
|
return n;
|
|
28081
28109
|
}
|
|
28082
|
-
function
|
|
28110
|
+
function YA(e, t, n) {
|
|
28083
28111
|
let r = (t ?? []).map((t) => ({
|
|
28084
|
-
a0:
|
|
28085
|
-
a1:
|
|
28112
|
+
a0: qA(t.from, e),
|
|
28113
|
+
a1: qA(t.to, e),
|
|
28086
28114
|
color: t.color,
|
|
28087
28115
|
track: !1
|
|
28088
28116
|
})).filter((e) => e.a1 > e.a0).sort((e, t) => e.a0 - t.a0), i = [], a = e.startAngle;
|
|
@@ -28102,70 +28130,70 @@ function qA(e, t, n) {
|
|
|
28102
28130
|
track: !0
|
|
28103
28131
|
}), i;
|
|
28104
28132
|
}
|
|
28105
|
-
function
|
|
28133
|
+
function XA(e, t, n, r, i) {
|
|
28106
28134
|
r <= n || (e.beginPath(), e.arc(t.cx, t.cy, t.radius, n, r, !1), e.lineWidth = t.thickness, e.lineCap = "butt", e.strokeStyle = i, e.stroke());
|
|
28107
28135
|
}
|
|
28108
|
-
function
|
|
28136
|
+
function ZA(e, t, n, r, i, a) {
|
|
28109
28137
|
let o = t.cx + Math.cos(n) * t.radius, s = t.cy + Math.sin(n) * t.radius, c = a === "start" ? n - Math.PI : n;
|
|
28110
28138
|
e.globalAlpha = i, e.beginPath(), e.arc(o, s, t.thickness / 2, c, c + (i >= 1 ? Math.PI * 2 : Math.PI), !1), e.closePath(), e.fillStyle = r, e.fill(), e.globalAlpha = 1;
|
|
28111
28139
|
}
|
|
28112
|
-
function
|
|
28113
|
-
let o =
|
|
28140
|
+
function QA(e, t, n, r, i, a) {
|
|
28141
|
+
let o = YA(t, n, i), s = o.some((e) => !e.track);
|
|
28114
28142
|
o.forEach((n, i) => {
|
|
28115
|
-
let a = i > 0 && !n.track && !o[i - 1].track ?
|
|
28143
|
+
let a = i > 0 && !n.track && !o[i - 1].track ? MA / 2 : 0, s = i < o.length - 1 && !n.track && !o[i + 1].track ? MA / 2 : 0, c = n.a0 + a, l = n.a1 - s;
|
|
28116
28144
|
if (n.track) {
|
|
28117
|
-
|
|
28145
|
+
XA(e, t, c, l, n.color);
|
|
28118
28146
|
return;
|
|
28119
28147
|
}
|
|
28120
|
-
e.globalAlpha =
|
|
28121
|
-
}), s ||
|
|
28122
|
-
let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 :
|
|
28123
|
-
|
|
28148
|
+
e.globalAlpha = NA, XA(e, t, c, l, n.color), e.globalAlpha = 1, XA(e, t, c, Math.min(l, r), n.color);
|
|
28149
|
+
}), s || XA(e, t, t.startAngle, r, a);
|
|
28150
|
+
let c = r > t.startAngle + 1e-9, l = r >= t.endAngle - 1e-9, u = (e, t) => e.track ? [!s && t ? a : i, 1] : [e.color, t ? 1 : NA], [d, f] = u(o[0], c), [p, m] = u(o[o.length - 1], l);
|
|
28151
|
+
ZA(e, t, t.startAngle, d, f, "start"), ZA(e, t, t.endAngle, p, m, "end");
|
|
28124
28152
|
}
|
|
28125
|
-
function
|
|
28153
|
+
function $A(e, t, n) {
|
|
28126
28154
|
let r = t.radius - t.thickness / 2;
|
|
28127
|
-
if (r <
|
|
28155
|
+
if (r < BA) return;
|
|
28128
28156
|
let i = Math.max(4, t.thickness * .45);
|
|
28129
28157
|
e.strokeStyle = n, e.lineCap = "butt";
|
|
28130
|
-
for (let n = 0; n <=
|
|
28131
|
-
let a = n %
|
|
28158
|
+
for (let n = 0; n <= RA; n++) {
|
|
28159
|
+
let a = n % zA === 0, o = t.startAngle + (t.endAngle - t.startAngle) * n / RA, s = r - i, c = s - (a ? Math.max(6, t.thickness * .55) : Math.max(3, t.thickness * .3));
|
|
28132
28160
|
e.globalAlpha = a ? .55 : .3, e.lineWidth = a ? 1.5 : 1, e.beginPath(), e.moveTo(t.cx + Math.cos(o) * s, t.cy + Math.sin(o) * s), e.lineTo(t.cx + Math.cos(o) * c, t.cy + Math.sin(o) * c), e.stroke();
|
|
28133
28161
|
}
|
|
28134
28162
|
e.globalAlpha = 1;
|
|
28135
28163
|
}
|
|
28136
|
-
function
|
|
28164
|
+
function ej(e, t, n, r, i) {
|
|
28137
28165
|
let a = t.cx + Math.cos(n) * t.radius, o = t.cy + Math.sin(n) * t.radius;
|
|
28138
28166
|
e.beginPath(), e.arc(a, o, t.thickness * .78, 0, Math.PI * 2), e.fillStyle = r, e.fill(), e.lineWidth = Math.max(2, t.thickness * .32), e.strokeStyle = i, e.stroke();
|
|
28139
28167
|
}
|
|
28140
|
-
function
|
|
28168
|
+
function tj(e, t, n, r, i) {
|
|
28141
28169
|
let a = Math.cos(n), o = Math.sin(n), s = t.radius - t.thickness * .9, c = Math.max(6, t.thickness * .6), l = Math.max(1.5, t.thickness * .14);
|
|
28142
28170
|
e.beginPath(), e.moveTo(t.cx + a * s, t.cy + o * s), e.lineTo(t.cx - o * l - a * c, t.cy + a * l - o * c), e.lineTo(t.cx + o * l - a * c, t.cy - a * l - o * c), e.closePath(), e.fillStyle = r, e.fill(), e.beginPath(), e.arc(t.cx, t.cy, Math.max(4, t.thickness * .42), 0, Math.PI * 2), e.fill(), e.lineWidth = 2, e.strokeStyle = i, e.stroke();
|
|
28143
28171
|
}
|
|
28144
|
-
function
|
|
28172
|
+
function nj(e, t, n, r, i, a, o) {
|
|
28145
28173
|
e.font = `${n} ${r}px ${i}`;
|
|
28146
28174
|
let s = e.measureText(t).width;
|
|
28147
28175
|
if (s <= a) return r;
|
|
28148
28176
|
let c = Math.floor(r * a / s);
|
|
28149
28177
|
return c < o ? 0 : (e.font = `${n} ${c}px ${i}`, c);
|
|
28150
28178
|
}
|
|
28151
|
-
function
|
|
28179
|
+
function rj(e, t, n, r, i, a, o) {
|
|
28152
28180
|
let s = a.font.family, c = (t.radius - t.thickness / 2) * 1.3, l = a.font.sizeSmall;
|
|
28153
28181
|
e.textAlign = "center", e.textBaseline = "middle";
|
|
28154
|
-
let u =
|
|
28182
|
+
let u = nj(e, n, "600", t.valueSize, s, c, l);
|
|
28155
28183
|
if (u === 0) return;
|
|
28156
28184
|
let d = o ? Math.min(t.cy + u * .8, t.textBottom - u / 2) : t.valueY;
|
|
28157
28185
|
e.fillStyle = a.text, e.fillText(n, t.cx, d);
|
|
28158
28186
|
let f = Math.max(l, Math.round(u * .26));
|
|
28159
28187
|
if (i?.label && !o) {
|
|
28160
28188
|
let n = i.label.toUpperCase();
|
|
28161
|
-
|
|
28189
|
+
nj(e, n, "600", f, s, c * .9, l) > 0 && (e.fillStyle = i.color, e.fillText(n, t.cx, d - u * .78));
|
|
28162
28190
|
}
|
|
28163
28191
|
if (r) {
|
|
28164
28192
|
let n = d + u * .72;
|
|
28165
|
-
n + f / 2 <= t.textBottom &&
|
|
28193
|
+
n + f / 2 <= t.textBottom && nj(e, r, "400", f, s, c, l) > 0 && (e.fillStyle = a.textSecondary, e.fillText(r, t.cx, n));
|
|
28166
28194
|
}
|
|
28167
28195
|
}
|
|
28168
|
-
function
|
|
28196
|
+
function ij(e, t, n, r) {
|
|
28169
28197
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall + 1}px ${r.font.family}`;
|
|
28170
28198
|
let i = t.thickness / 2 + 6;
|
|
28171
28199
|
for (let [r, a] of [[t.startAngle, t.min], [t.endAngle, t.max]]) {
|
|
@@ -28173,24 +28201,24 @@ function nj(e, t, n, r) {
|
|
|
28173
28201
|
s > .2 ? (e.textAlign = "center", e.textBaseline = "top", e.fillText(n(a), c, l + i)) : (e.textAlign = o < -.2 ? "right" : o > .2 ? "left" : "center", e.textBaseline = s < -.2 ? "bottom" : "middle", e.fillText(n(a), c + o * i, l + s * i));
|
|
28174
28202
|
}
|
|
28175
28203
|
}
|
|
28176
|
-
function
|
|
28204
|
+
function aj(e, t, n, r) {
|
|
28177
28205
|
e.fillStyle = r.textSecondary, e.font = `${r.font.sizeSmall}px ${r.font.family}`, e.textBaseline = "middle";
|
|
28178
28206
|
let i = t.radius + t.thickness / 2 + 8;
|
|
28179
28207
|
for (let r of n) {
|
|
28180
28208
|
if (!r.label) continue;
|
|
28181
|
-
let n =
|
|
28209
|
+
let n = qA((VA(r.from, t.min, t.max) + VA(r.to, t.min, t.max)) / 2, t), a = Math.cos(n);
|
|
28182
28210
|
e.textAlign = a < -.2 ? "right" : a > .2 ? "left" : "center", e.fillText(r.label, t.cx + a * i, t.cy + Math.sin(n) * i);
|
|
28183
28211
|
}
|
|
28184
28212
|
}
|
|
28185
|
-
function
|
|
28213
|
+
function oj(e, t, n, r, i, a) {
|
|
28186
28214
|
if (t <= 0 || n <= 0) return;
|
|
28187
|
-
let o =
|
|
28188
|
-
e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n),
|
|
28215
|
+
let o = KA(t, n, r), s = Number.isFinite(a), c = s ? VA(a, o.min, o.max) : o.min, l = qA(c, o), u = s ? JA(c, r.zones) : void 0, d = r.pointer === "needle", f = r.valueFormat ?? HA, p = u?.color ?? r.needleColor ?? i.lineColor;
|
|
28216
|
+
e.save(), e.fillStyle = i.background, e.fillRect(0, 0, t, n), QA(e, o, r.zones, l, r.trackColor ?? i.grid, p), $A(e, o, i.textSecondary), s && (d ? tj(e, o, l, r.needleColor ?? i.text, i.background) : ej(e, o, l, p, i.background)), r.showValue !== !1 && rj(e, o, s ? f(c) : "—", r.label, u, i, d), ij(e, o, f, i), r.showZoneLabels === !0 && r.zones?.length && aj(e, o, r.zones, i), e.restore();
|
|
28189
28217
|
}
|
|
28190
28218
|
//#endregion
|
|
28191
28219
|
//#region src/finance/BarChartRenderer.ts
|
|
28192
|
-
var
|
|
28193
|
-
function
|
|
28220
|
+
var sj = 12, cj = .72, lj = 20, uj = .35;
|
|
28221
|
+
function dj(e) {
|
|
28194
28222
|
let t = 0, n = 0, r = e.mode === "stacked";
|
|
28195
28223
|
return e.categories.forEach((i, a) => {
|
|
28196
28224
|
let o = 0, s = 0;
|
|
@@ -28201,36 +28229,36 @@ function lj(e) {
|
|
|
28201
28229
|
n = Math.max(n, o), t = Math.min(t, s);
|
|
28202
28230
|
}), [t, n];
|
|
28203
28231
|
}
|
|
28204
|
-
function
|
|
28232
|
+
function fj(e, t) {
|
|
28205
28233
|
let n = e.colorBySign;
|
|
28206
28234
|
return n ? n === !0 ? {
|
|
28207
28235
|
positive: t.candleUp,
|
|
28208
28236
|
negative: t.candleDown
|
|
28209
28237
|
} : n : null;
|
|
28210
28238
|
}
|
|
28211
|
-
function
|
|
28239
|
+
function pj(e, t, n, r, i) {
|
|
28212
28240
|
let a = e.orientation === "horizontal", o = e.legend ?? e.series.length > 1 ? Cm(e.series.map((e, t) => ({
|
|
28213
28241
|
label: e.name,
|
|
28214
28242
|
color: xm(t, e.color)
|
|
28215
|
-
})), t -
|
|
28243
|
+
})), t - sj * 2, i) : null, s = sj + (o ? o.height + 6 : 0), [c, l] = dj(e), u = um(c, l, a ? Math.max(2, Math.floor(t / 110)) : 5), d = e.valueFormat ?? J(u, e.locale), f = Math.max(0, ...u.ticks.map((e) => i(d(e), 11))), p;
|
|
28216
28244
|
if (a) {
|
|
28217
|
-
let r =
|
|
28245
|
+
let r = sj + Math.min(t * uj, Math.max(0, ...e.categories.map((e) => i(e, 11)))) + 8;
|
|
28218
28246
|
p = {
|
|
28219
28247
|
x: r,
|
|
28220
28248
|
y: s,
|
|
28221
|
-
width: Math.max(1, t - r -
|
|
28222
|
-
height: Math.max(1, n - s -
|
|
28249
|
+
width: Math.max(1, t - r - sj - f / 2),
|
|
28250
|
+
height: Math.max(1, n - s - sj - lj)
|
|
28223
28251
|
};
|
|
28224
28252
|
} else {
|
|
28225
|
-
let e =
|
|
28253
|
+
let e = sj + f + 8;
|
|
28226
28254
|
p = {
|
|
28227
28255
|
x: e,
|
|
28228
28256
|
y: s,
|
|
28229
|
-
width: Math.max(1, t - e -
|
|
28230
|
-
height: Math.max(1, n - s -
|
|
28257
|
+
width: Math.max(1, t - e - sj),
|
|
28258
|
+
height: Math.max(1, n - s - sj - lj)
|
|
28231
28259
|
};
|
|
28232
28260
|
}
|
|
28233
|
-
let m = Math.max(1, e.categories.length), h = a ? p.y : p.x, g = (a ? p.height : p.width) / m, _ = g *
|
|
28261
|
+
let m = Math.max(1, e.categories.length), h = a ? p.y : p.x, g = (a ? p.height : p.width) / m, _ = g * cj, v = e.mode === "stacked", y = v ? _ : _ / Math.max(1, e.series.length), b = (e) => a ? q(u, e, p.x, p.width) : q(u, e, p.y, p.height, !0), x = b(0), S = fj(e, r), C = Array(m).fill(0), w = Array(m).fill(0), T = [];
|
|
28234
28262
|
return e.series.forEach((t, n) => {
|
|
28235
28263
|
e.categories.forEach((e, r) => {
|
|
28236
28264
|
let i = t.values[r];
|
|
@@ -28269,23 +28297,23 @@ function dj(e, t, n, r, i) {
|
|
|
28269
28297
|
bandStart: h,
|
|
28270
28298
|
band: g,
|
|
28271
28299
|
legend: o,
|
|
28272
|
-
legendY:
|
|
28300
|
+
legendY: sj
|
|
28273
28301
|
};
|
|
28274
28302
|
}
|
|
28275
|
-
function
|
|
28303
|
+
function mj(e, t, n) {
|
|
28276
28304
|
for (let r of e.bars) if (t >= r.x - 2 && t <= r.x + r.width + 2 && n >= r.y - 2 && n <= r.y + r.height + 2) return r;
|
|
28277
28305
|
return null;
|
|
28278
28306
|
}
|
|
28279
|
-
function
|
|
28307
|
+
function hj(e, t, n, r) {
|
|
28280
28308
|
let { plot: i } = e;
|
|
28281
28309
|
if (t < i.x || t > i.x + i.width || n < i.y || n > i.y + i.height) return -1;
|
|
28282
28310
|
let a = e.orientation === "horizontal" ? n : t, o = Math.floor((a - e.bandStart) / e.band);
|
|
28283
28311
|
return o >= 0 && o < r ? o : -1;
|
|
28284
28312
|
}
|
|
28285
|
-
function
|
|
28313
|
+
function gj(e, t, n, r, i, a, o = pj(r, t, n, i, Sm(e, i))) {
|
|
28286
28314
|
let s = Sm(e, i), c = r.valueFormat ?? hm(r.locale), { plot: l, orientation: u } = o, d = u === "horizontal";
|
|
28287
|
-
e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend,
|
|
28288
|
-
let f = a && r.crosshair !== !1 ?
|
|
28315
|
+
e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend, sj, o.legendY, i), Im(e, l, o.scale, d ? "horizontal" : "vertical", i, r.valueFormat ?? J(o.scale, r.locale));
|
|
28316
|
+
let f = a && r.crosshair !== !1 ? hj(o, a.x, a.y, r.categories.length) : -1;
|
|
28289
28317
|
if (f >= 0) {
|
|
28290
28318
|
e.fillStyle = N(i.crosshair, .08);
|
|
28291
28319
|
let t = o.bandStart + f * o.band;
|
|
@@ -28294,7 +28322,7 @@ function mj(e, t, n, r, i, a, o = dj(r, t, n, i, Sm(e, i))) {
|
|
|
28294
28322
|
for (let t of o.bars) e.fillStyle = t.color, e.fillRect(t.x, t.y, Math.max(t.width, +!!d), Math.max(t.height, +!d));
|
|
28295
28323
|
e.strokeStyle = i.axisLine, e.lineWidth = 1, e.beginPath();
|
|
28296
28324
|
let p = Math.round(o.zero) + .5;
|
|
28297
|
-
if (d ? (e.moveTo(p, l.y), e.lineTo(p, l.y + l.height)) : (e.moveTo(l.x, p), e.lineTo(l.x + l.width, p)), e.stroke(),
|
|
28325
|
+
if (d ? (e.moveTo(p, l.y), e.lineTo(p, l.y + l.height)) : (e.moveTo(l.x, p), e.lineTo(l.x + l.width, p)), e.stroke(), _j(e, r.categories, o, i, s), r.showValues && vj(e, o, i, c, r.mode === "stacked"), f >= 0 && a) {
|
|
28298
28326
|
let s = [{
|
|
28299
28327
|
text: r.categories[f],
|
|
28300
28328
|
bold: !0
|
|
@@ -28312,17 +28340,17 @@ function mj(e, t, n, r, i, a, o = dj(r, t, n, i, Sm(e, i))) {
|
|
|
28312
28340
|
}
|
|
28313
28341
|
return o;
|
|
28314
28342
|
}
|
|
28315
|
-
function
|
|
28343
|
+
function _j(e, t, n, r, i) {
|
|
28316
28344
|
let { plot: a } = n;
|
|
28317
28345
|
e.save(), e.font = Y(r, 11), e.fillStyle = r.axisLabel;
|
|
28318
28346
|
let o = Math.max(0, ...t.map((e) => i(e, 11))), s = n.orientation === "vertical" ? Math.max(1, Math.ceil((o + 8) / Math.max(1, n.band))) : 1;
|
|
28319
28347
|
t.forEach((t, r) => {
|
|
28320
28348
|
if (r % s !== 0) return;
|
|
28321
28349
|
let o = n.bandStart + (r + .5) * n.band;
|
|
28322
|
-
n.orientation === "horizontal" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(Lm(t, a.x -
|
|
28350
|
+
n.orientation === "horizontal" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(Lm(t, a.x - sj - 8, i), a.x - 8, o)) : (e.textAlign = "center", e.textBaseline = "top", e.fillText(Lm(t, n.band * s - 4, i), o, a.y + a.height + 6));
|
|
28323
28351
|
}), e.restore();
|
|
28324
28352
|
}
|
|
28325
|
-
function
|
|
28353
|
+
function vj(e, t, n, r, i) {
|
|
28326
28354
|
e.save(), e.font = Y(n, 10), e.fillStyle = n.textSecondary;
|
|
28327
28355
|
for (let n of t.bars) {
|
|
28328
28356
|
let a = r(n.value);
|
|
@@ -28340,14 +28368,14 @@ function gj(e, t, n, r, i) {
|
|
|
28340
28368
|
}
|
|
28341
28369
|
//#endregion
|
|
28342
28370
|
//#region src/finance/DonutRenderer.ts
|
|
28343
|
-
var
|
|
28344
|
-
function
|
|
28371
|
+
var yj = 12, bj = -Math.PI / 2, xj = Math.PI * 2, Sj = 5, Cj = 1.4, wj = 18;
|
|
28372
|
+
function Tj(e, t, n, r, i) {
|
|
28345
28373
|
let a = e.data.filter((e) => Number.isFinite(e.value) && e.value > 0), o = a.reduce((e, t) => e + t.value, 0), s = a.map((t, n) => ({
|
|
28346
28374
|
label: `${t.label} ${gm(e.locale)(t.value / o)}`,
|
|
28347
28375
|
color: xm(n, t.color)
|
|
28348
|
-
})), c = e.legend !== !1 && a.length > 0, l = c && t >= n *
|
|
28376
|
+
})), c = e.legend !== !1 && a.length > 0, l = c && t >= n * Cj && a.length * wj <= n - yj * 2, u = l ? Math.min(t * .4, Math.max(...s.map((e) => i(e.label, 11))) + 16) : t - yj * 2, d = c ? Cm(s, u, i, l) : null, f = l ? t - u - yj * 3 : t - yj * 2, p = l ? n - yj * 2 : n - yj * 3 - (d?.height ?? 0), m = Math.max(0, Math.min(f, p) / 2 - Sj), h = yj + f / 2, g = yj + p / 2, _ = e.innerRadius, v = Math.min(.95, Math.max(0, _ !== void 0 && Number.isFinite(_) ? _ : .6)), y = bj, b = a.map((e, t) => {
|
|
28349
28377
|
let n = e.value / o, r = y;
|
|
28350
|
-
return y += n *
|
|
28378
|
+
return y += n * xj, {
|
|
28351
28379
|
label: e.label,
|
|
28352
28380
|
value: e.value,
|
|
28353
28381
|
share: n,
|
|
@@ -28365,26 +28393,26 @@ function Cj(e, t, n, r, i) {
|
|
|
28365
28393
|
total: o,
|
|
28366
28394
|
slices: b,
|
|
28367
28395
|
legend: d,
|
|
28368
|
-
legendX: l ? t - u -
|
|
28369
|
-
legendY: l ? Math.max(
|
|
28396
|
+
legendX: l ? t - u - yj : yj,
|
|
28397
|
+
legendY: l ? Math.max(yj, g - (d?.height ?? 0) / 2) : yj * 2 + p
|
|
28370
28398
|
};
|
|
28371
28399
|
}
|
|
28372
|
-
function
|
|
28400
|
+
function Ej(e, t, n) {
|
|
28373
28401
|
let r = t - e.cx, i = n - e.cy, a = Math.hypot(r, i);
|
|
28374
|
-
if (a < e.inner || a > e.radius +
|
|
28402
|
+
if (a < e.inner || a > e.radius + Sj) return null;
|
|
28375
28403
|
let o = Math.atan2(i, r);
|
|
28376
|
-
for (; o <
|
|
28404
|
+
for (; o < bj;) o += xj;
|
|
28377
28405
|
return e.slices.find((e) => o >= e.start && o < e.end) ?? null;
|
|
28378
28406
|
}
|
|
28379
|
-
function
|
|
28407
|
+
function Dj(e, t, n, r, i, a, o = Tj(r, t, n, i, Sm(e, i))) {
|
|
28380
28408
|
let s = Sm(e, i), c = r.valueFormat ?? hm(r.locale);
|
|
28381
28409
|
e.fillStyle = i.background, e.fillRect(0, 0, t, n);
|
|
28382
|
-
let l = a && r.crosshair !== !1 ?
|
|
28410
|
+
let l = a && r.crosshair !== !1 ? Ej(o, a.x, a.y) : null, { cx: u, cy: d, radius: f, inner: p } = o;
|
|
28383
28411
|
for (let t of o.slices) {
|
|
28384
|
-
let n = (t.start + t.end) / 2, r = t === l ?
|
|
28412
|
+
let n = (t.start + t.end) / 2, r = t === l ? Sj : 0, a = u + Math.cos(n) * r, s = d + Math.sin(n) * r;
|
|
28385
28413
|
e.beginPath(), e.arc(a, s, f, t.start, t.end), p > 0 ? e.arc(a, s, p, t.end, t.start, !0) : e.lineTo(a, s), e.closePath(), e.fillStyle = t.color, e.fill(), o.slices.length > 1 && (e.strokeStyle = i.background, e.lineWidth = 1.5, e.stroke());
|
|
28386
28414
|
}
|
|
28387
|
-
return r.showLabels !== !1 &&
|
|
28415
|
+
return r.showLabels !== !1 && Oj(e, o, i, r.locale), kj(e, o, r, i, s), o.legend && wm(e, o.legend, o.legendX, o.legendY, i), l && a && Tm(e, [{
|
|
28388
28416
|
text: l.label,
|
|
28389
28417
|
bold: !0,
|
|
28390
28418
|
color: l.color
|
|
@@ -28395,7 +28423,7 @@ function Tj(e, t, n, r, i, a, o = Cj(r, t, n, i, Sm(e, i))) {
|
|
|
28395
28423
|
height: n
|
|
28396
28424
|
}, i), o;
|
|
28397
28425
|
}
|
|
28398
|
-
function
|
|
28426
|
+
function Oj(e, t, n, r) {
|
|
28399
28427
|
let { cx: i, cy: a, radius: o, inner: s } = t, c = s > 0 ? (o + s) / 2 : o * .62;
|
|
28400
28428
|
e.save(), e.font = Y(n, 11, "600"), e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = "#fff";
|
|
28401
28429
|
for (let n of t.slices) {
|
|
@@ -28406,7 +28434,7 @@ function Ej(e, t, n, r) {
|
|
|
28406
28434
|
}
|
|
28407
28435
|
e.restore();
|
|
28408
28436
|
}
|
|
28409
|
-
function
|
|
28437
|
+
function kj(e, t, n, r, i) {
|
|
28410
28438
|
if (t.inner <= 0 || !n.centerLabel && !n.centerValue) return;
|
|
28411
28439
|
let a = t.inner * 1.6;
|
|
28412
28440
|
if (e.save(), e.textAlign = "center", e.textBaseline = "middle", n.centerValue) {
|
|
@@ -28417,28 +28445,28 @@ function Dj(e, t, n, r, i) {
|
|
|
28417
28445
|
}
|
|
28418
28446
|
//#endregion
|
|
28419
28447
|
//#region src/finance/ScatterRenderer.ts
|
|
28420
|
-
var
|
|
28421
|
-
function
|
|
28448
|
+
var Aj = 12, jj = 5, Mj = 3, Nj = 18, Pj = 20, Fj = 6;
|
|
28449
|
+
function Ij(e, t, n, r, i) {
|
|
28422
28450
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
28423
28451
|
for (let t of e.series) for (let e of t.points) !Number.isFinite(e.x) || !Number.isFinite(e.y) || (e.x < a && (a = e.x), e.x > o && (o = e.x), e.y < s && (s = e.y), e.y > c && (c = e.y), e.size !== void 0 && Number.isFinite(e.size) && e.size > l && (l = e.size));
|
|
28424
|
-
let u = e.maxRadius ?? 24, d = u +
|
|
28452
|
+
let u = e.maxRadius ?? 24, d = u + Fj, f = (e, t, n) => {
|
|
28425
28453
|
if (e > t) return [0, 1];
|
|
28426
28454
|
let r = (t - e) * d / Math.max(1, n - d * 2);
|
|
28427
28455
|
return [e >= 0 ? Math.max(0, e - r) : e - r, t <= 0 ? Math.min(0, t + r) : t + r];
|
|
28428
28456
|
}, p = um(...f(a, o, t * .8), Math.max(2, Math.floor(t / 110))), m = um(...f(s, c, n * .7), 5), h = e.xFormat ?? J(p, e.locale), g = e.yFormat ?? J(m, e.locale), _ = e.legend ?? e.series.length > 1 ? Cm(e.series.map((e, t) => ({
|
|
28429
28457
|
label: e.name,
|
|
28430
28458
|
color: xm(t, e.color)
|
|
28431
|
-
})), t -
|
|
28459
|
+
})), t - Aj * 2, i) : null, v = Aj + (_ ? _.height + 6 : 0), y = Math.max(0, ...m.ticks.map((e) => i(g(e), 11))), b = Aj + (e.yLabel ? Nj : 0) + y + 8, x = Aj + Pj + (e.xLabel ? Nj : 0), S = i(h(p.max), 11) / 2, C = {
|
|
28432
28460
|
x: b,
|
|
28433
28461
|
y: v,
|
|
28434
|
-
width: Math.max(1, t - b -
|
|
28462
|
+
width: Math.max(1, t - b - Aj - S),
|
|
28435
28463
|
height: Math.max(1, n - v - x)
|
|
28436
28464
|
}, w = [];
|
|
28437
28465
|
return e.series.forEach((e, t) => {
|
|
28438
28466
|
let n = xm(t, e.color), r = N(n, .55), i = N(n, .85);
|
|
28439
28467
|
for (let t of e.points) {
|
|
28440
28468
|
if (!Number.isFinite(t.x) || !Number.isFinite(t.y)) continue;
|
|
28441
|
-
let a = t.size !== void 0 && Number.isFinite(t.size) && t.size > 0 && l > 0 ? Math.max(
|
|
28469
|
+
let a = t.size !== void 0 && Number.isFinite(t.size) && t.size > 0 && l > 0 ? Math.max(Mj, u * Math.sqrt(t.size / l)) : jj;
|
|
28442
28470
|
w.push({
|
|
28443
28471
|
px: q(p, t.x, C.x, C.width),
|
|
28444
28472
|
py: q(m, t.y, C.y, C.height, !0),
|
|
@@ -28460,18 +28488,18 @@ function Pj(e, t, n, r, i) {
|
|
|
28460
28488
|
legend: _
|
|
28461
28489
|
};
|
|
28462
28490
|
}
|
|
28463
|
-
function
|
|
28491
|
+
function Lj(e, t, n) {
|
|
28464
28492
|
let r = null, i = Infinity;
|
|
28465
28493
|
for (let a of e.points) {
|
|
28466
28494
|
let e = Math.hypot(a.px - t, a.py - n);
|
|
28467
|
-
e <= a.r +
|
|
28495
|
+
e <= a.r + Fj && e < i && (r = a, i = e);
|
|
28468
28496
|
}
|
|
28469
28497
|
return r;
|
|
28470
28498
|
}
|
|
28471
|
-
function
|
|
28499
|
+
function Rj(e, t, n, r, i, a, o = Ij(r, t, n, i, Sm(e, i))) {
|
|
28472
28500
|
let { plot: s, xScale: c, yScale: l } = o, u = r.xFormat ?? J(c, r.locale), d = r.yFormat ?? J(l, r.locale);
|
|
28473
|
-
e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend,
|
|
28474
|
-
let f = a && r.crosshair !== !1 ?
|
|
28501
|
+
e.fillStyle = i.background, e.fillRect(0, 0, t, n), o.legend && wm(e, o.legend, Aj, Aj, i), Im(e, s, l, "vertical", i, d), Im(e, s, c, "horizontal", i, u), r.zeroLines !== !1 && zj(e, o, i), Bj(e, o, r, i);
|
|
28502
|
+
let f = a && r.crosshair !== !1 ? Lj(o, a.x, a.y) : null;
|
|
28475
28503
|
e.save(), e.beginPath(), e.rect(s.x, s.y, s.width, s.height), e.clip();
|
|
28476
28504
|
for (let t of o.drawOrder) {
|
|
28477
28505
|
let n = o.points[t];
|
|
@@ -28497,7 +28525,7 @@ function Ij(e, t, n, r, i, a, o = Pj(r, t, n, i, Sm(e, i))) {
|
|
|
28497
28525
|
}
|
|
28498
28526
|
return o;
|
|
28499
28527
|
}
|
|
28500
|
-
function
|
|
28528
|
+
function zj(e, t, n) {
|
|
28501
28529
|
let { plot: r, xScale: i, yScale: a } = t;
|
|
28502
28530
|
if (e.save(), e.strokeStyle = n.axisLine, e.lineWidth = 1, e.beginPath(), i.min < 0 && i.max > 0) {
|
|
28503
28531
|
let t = Math.round(q(i, 0, r.x, r.width)) + .5;
|
|
@@ -28509,17 +28537,17 @@ function Lj(e, t, n) {
|
|
|
28509
28537
|
}
|
|
28510
28538
|
e.stroke(), e.restore();
|
|
28511
28539
|
}
|
|
28512
|
-
function
|
|
28540
|
+
function Bj(e, t, n, r) {
|
|
28513
28541
|
let { plot: i } = t;
|
|
28514
|
-
e.save(), e.font = Y(r, 11, "600"), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, i.x + i.width / 2, i.y + i.height +
|
|
28542
|
+
e.save(), e.font = Y(r, 11, "600"), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, i.x + i.width / 2, i.y + i.height + Pj + Nj)), n.yLabel && (e.translate(Aj + 11 / 2, i.y + i.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
|
|
28515
28543
|
}
|
|
28516
28544
|
//#endregion
|
|
28517
28545
|
//#region src/finance/HistogramRenderer.ts
|
|
28518
|
-
var
|
|
28546
|
+
var Vj = 1e-9, Hj = 1e3, Uj = (e) => {
|
|
28519
28547
|
let t = Number(e.toPrecision(12));
|
|
28520
28548
|
return t === 0 ? 0 : t;
|
|
28521
28549
|
};
|
|
28522
|
-
function
|
|
28550
|
+
function Wj(e, t = {}) {
|
|
28523
28551
|
let n = e.filter((e) => Number.isFinite(e));
|
|
28524
28552
|
if (n.length === 0) return [];
|
|
28525
28553
|
let r = Infinity, i = -Infinity;
|
|
@@ -28531,40 +28559,40 @@ function Hj(e, t = {}) {
|
|
|
28531
28559
|
}];
|
|
28532
28560
|
let a = t.binWidth;
|
|
28533
28561
|
if (a !== void 0 && a > 0 && Number.isFinite(a)) {
|
|
28534
|
-
let e = Math.floor(r / a +
|
|
28562
|
+
let e = Math.floor(r / a + Vj), t = Math.max(e, Math.ceil(i / a - Vj) - 1) - e + 1;
|
|
28535
28563
|
if (t <= 1e3) {
|
|
28536
28564
|
let r = Array.from({ length: t }, (t, n) => ({
|
|
28537
|
-
from:
|
|
28538
|
-
to:
|
|
28565
|
+
from: Uj((e + n) * a),
|
|
28566
|
+
to: Uj((e + n + 1) * a),
|
|
28539
28567
|
count: 0
|
|
28540
28568
|
}));
|
|
28541
|
-
for (let i of n) r[Math.min(t - 1, Math.floor(i / a +
|
|
28569
|
+
for (let i of n) r[Math.min(t - 1, Math.floor(i / a + Vj) - e)].count++;
|
|
28542
28570
|
return r;
|
|
28543
28571
|
}
|
|
28544
28572
|
}
|
|
28545
|
-
let o = t.bins, s = typeof o == "number" && Number.isFinite(o) && o >= 1 ? Math.min(
|
|
28546
|
-
from:
|
|
28547
|
-
to:
|
|
28573
|
+
let o = t.bins, s = typeof o == "number" && Number.isFinite(o) && o >= 1 ? Math.min(Hj, Math.floor(o)) : Math.min(Hj, Math.ceil(Math.log2(n.length)) + 1), c = (i - r) / s, l = Array.from({ length: s }, (e, t) => ({
|
|
28574
|
+
from: Uj(r + t * c),
|
|
28575
|
+
to: Uj(t === s - 1 ? i : r + (t + 1) * c),
|
|
28548
28576
|
count: 0
|
|
28549
28577
|
}));
|
|
28550
|
-
for (let e of n) l[Math.min(s - 1, Math.floor((e - r) / c +
|
|
28578
|
+
for (let e of n) l[Math.min(s - 1, Math.floor((e - r) / c + Vj))].count++;
|
|
28551
28579
|
return l;
|
|
28552
28580
|
}
|
|
28553
|
-
var
|
|
28554
|
-
function
|
|
28581
|
+
var Gj = 12, Kj = 20, qj = 16;
|
|
28582
|
+
function Jj(e, t, n) {
|
|
28555
28583
|
return t.colorBySign ? (e.from + e.to) / 2 < 0 ? n.candleDown : n.candleUp : t.color ?? Oe[0];
|
|
28556
28584
|
}
|
|
28557
|
-
function
|
|
28558
|
-
let a =
|
|
28585
|
+
function Yj(e, t, n, r, i) {
|
|
28586
|
+
let a = Wj(e.values, {
|
|
28559
28587
|
bins: e.bins,
|
|
28560
28588
|
binWidth: e.binWidth
|
|
28561
28589
|
}), o = a.length > 0 ? a[0].from : 0, s = a.length > 0 ? a[a.length - 1].to : 1, c = (e.markers ?? []).map((e) => e.value).filter((e) => Number.isFinite(e)), l = um(Math.min(o, ...c), Math.max(s, ...c), Math.max(2, Math.floor(t / 110))), u = 0;
|
|
28562
28590
|
for (let e of a) e.count > u && (u = e.count);
|
|
28563
|
-
let d = um(0, Math.max(4, u), 4), f = e.valueFormat ?? J(l, e.locale), p = Math.max(0, ...d.ticks.map((t) => i(J(d, e.locale)(t), 11))), m =
|
|
28591
|
+
let d = um(0, Math.max(4, u), 4), f = e.valueFormat ?? J(l, e.locale), p = Math.max(0, ...d.ticks.map((t) => i(J(d, e.locale)(t), 11))), m = Gj + (c.length > 0 ? qj : 0), h = Gj + p + 8, g = Gj + i(f(l.max), 11) / 2, _ = {
|
|
28564
28592
|
x: h,
|
|
28565
28593
|
y: m,
|
|
28566
28594
|
width: Math.max(1, t - h - g),
|
|
28567
|
-
height: Math.max(1, n - m -
|
|
28595
|
+
height: Math.max(1, n - m - Gj - Kj)
|
|
28568
28596
|
};
|
|
28569
28597
|
return {
|
|
28570
28598
|
plot: _,
|
|
@@ -28578,22 +28606,22 @@ function qj(e, t, n, r, i) {
|
|
|
28578
28606
|
width: Math.max(1, i - n),
|
|
28579
28607
|
height: _.y + _.height - a,
|
|
28580
28608
|
bin: t,
|
|
28581
|
-
color:
|
|
28609
|
+
color: Jj(t, e, r)
|
|
28582
28610
|
};
|
|
28583
28611
|
}),
|
|
28584
28612
|
total: a.reduce((e, t) => e + t.count, 0)
|
|
28585
28613
|
};
|
|
28586
28614
|
}
|
|
28587
|
-
function
|
|
28615
|
+
function Xj(e, t, n) {
|
|
28588
28616
|
let { plot: r } = e;
|
|
28589
28617
|
return n < r.y || n > r.y + r.height ? null : e.bars.find((e) => t >= e.x && t < e.x + e.width) ?? null;
|
|
28590
28618
|
}
|
|
28591
|
-
function
|
|
28619
|
+
function Zj(e, t, n, r, i, a, o = Yj(r, t, n, i, Sm(e, i))) {
|
|
28592
28620
|
let s = r.valueFormat ?? hm(r.locale), { plot: c } = o;
|
|
28593
28621
|
e.fillStyle = i.background, e.fillRect(0, 0, t, n), Im(e, c, o.yScale, "vertical", i, J(o.yScale, r.locale)), Im(e, c, o.xScale, "horizontal", i, r.valueFormat ?? J(o.xScale, r.locale));
|
|
28594
|
-
let l = a && r.crosshair !== !1 ?
|
|
28622
|
+
let l = a && r.crosshair !== !1 ? Xj(o, a.x, a.y) : null;
|
|
28595
28623
|
for (let t of o.bars) e.fillStyle = t === l ? t.color : N(t.color, .75), e.fillRect(t.x + (t.width > 3 ? .5 : 0), t.y, Math.max(1, t.width - +(t.width > 3)), t.height);
|
|
28596
|
-
if (
|
|
28624
|
+
if (Qj(e, o, r, i, s), l && a) {
|
|
28597
28625
|
let { bin: c } = l;
|
|
28598
28626
|
Tm(e, [{
|
|
28599
28627
|
text: c.to > c.from ? `${s(c.from)} – ${s(c.to)}` : s(c.from),
|
|
@@ -28608,7 +28636,7 @@ function Yj(e, t, n, r, i, a, o = qj(r, t, n, i, Sm(e, i))) {
|
|
|
28608
28636
|
}
|
|
28609
28637
|
return o;
|
|
28610
28638
|
}
|
|
28611
|
-
function
|
|
28639
|
+
function Qj(e, t, n, r, i) {
|
|
28612
28640
|
let { plot: a } = t;
|
|
28613
28641
|
e.save(), e.font = Y(r, 10), e.textAlign = "center", e.textBaseline = "bottom";
|
|
28614
28642
|
let o = [];
|
|
@@ -28628,8 +28656,8 @@ function Xj(e, t, n, r, i) {
|
|
|
28628
28656
|
}
|
|
28629
28657
|
//#endregion
|
|
28630
28658
|
//#region src/finance/CalendarRenderer.ts
|
|
28631
|
-
var
|
|
28632
|
-
function
|
|
28659
|
+
var $j = 864e5, eM = 3, tM = 12, nM = 16, rM = 10, iM = 28, aM = 6;
|
|
28660
|
+
function oM(e) {
|
|
28633
28661
|
let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
28634
28662
|
if (!t) return null;
|
|
28635
28663
|
let [n, r, i] = [
|
|
@@ -28637,27 +28665,27 @@ function iM(e) {
|
|
|
28637
28665
|
Number(t[2]),
|
|
28638
28666
|
Number(t[3])
|
|
28639
28667
|
], a = Date.UTC(n, r - 1, i), o = new Date(a);
|
|
28640
|
-
return o.getUTCFullYear() !== n || o.getUTCMonth() !== r - 1 || o.getUTCDate() !== i ? null : Math.round(a /
|
|
28668
|
+
return o.getUTCFullYear() !== n || o.getUTCMonth() !== r - 1 || o.getUTCDate() !== i ? null : Math.round(a / $j);
|
|
28641
28669
|
}
|
|
28642
|
-
function
|
|
28643
|
-
return new Date(e *
|
|
28670
|
+
function sM(e) {
|
|
28671
|
+
return new Date(e * $j).toISOString().slice(0, 10);
|
|
28644
28672
|
}
|
|
28645
|
-
var
|
|
28646
|
-
function
|
|
28647
|
-
let n = e.from === void 0 ? null :
|
|
28673
|
+
var cM = (e) => ((e + 4) % 7 + 7) % 7;
|
|
28674
|
+
function lM(e, t) {
|
|
28675
|
+
let n = e.from === void 0 ? null : oM(e.from), r = e.to === void 0 ? null : oM(e.to);
|
|
28648
28676
|
if (n === null || r === null) {
|
|
28649
28677
|
let e = Infinity, i = -Infinity;
|
|
28650
28678
|
for (let n of t.keys()) n < e && (e = n), n > i && (i = n);
|
|
28651
28679
|
n ??= Number.isFinite(e) ? e : null, r ??= Number.isFinite(i) ? i : null;
|
|
28652
28680
|
}
|
|
28653
28681
|
if (n === null || r === null || n > r) return null;
|
|
28654
|
-
let i = new Date(r *
|
|
28655
|
-
return [Math.max(n, Math.round(Date.UTC(i, 0, 1) /
|
|
28682
|
+
let i = new Date(r * $j).getUTCFullYear() - 10 + 1;
|
|
28683
|
+
return [Math.max(n, Math.round(Date.UTC(i, 0, 1) / $j)), r];
|
|
28656
28684
|
}
|
|
28657
|
-
function
|
|
28685
|
+
function uM(e, t, n) {
|
|
28658
28686
|
let r = [], i = e;
|
|
28659
28687
|
for (; i <= t;) {
|
|
28660
|
-
let e = new Date(i *
|
|
28688
|
+
let e = new Date(i * $j).getUTCFullYear(), a = Math.min(t, Math.round(Date.UTC(e, 11, 31) / $j)), o = i - n(i);
|
|
28661
28689
|
r.push({
|
|
28662
28690
|
year: e,
|
|
28663
28691
|
first: i,
|
|
@@ -28668,9 +28696,9 @@ function cM(e, t, n) {
|
|
|
28668
28696
|
}
|
|
28669
28697
|
return r;
|
|
28670
28698
|
}
|
|
28671
|
-
var
|
|
28672
|
-
function
|
|
28673
|
-
let t = e ?? "", n =
|
|
28699
|
+
var dM = /* @__PURE__ */ new Map();
|
|
28700
|
+
function fM(e) {
|
|
28701
|
+
let t = e ?? "", n = dM.get(t);
|
|
28674
28702
|
if (!n) {
|
|
28675
28703
|
try {
|
|
28676
28704
|
n = {
|
|
@@ -28688,20 +28716,20 @@ function uM(e) {
|
|
|
28688
28716
|
})
|
|
28689
28717
|
};
|
|
28690
28718
|
} catch {
|
|
28691
|
-
n =
|
|
28719
|
+
n = fM(void 0);
|
|
28692
28720
|
}
|
|
28693
|
-
|
|
28721
|
+
dM.set(t, n);
|
|
28694
28722
|
}
|
|
28695
28723
|
return n;
|
|
28696
28724
|
}
|
|
28697
|
-
function
|
|
28725
|
+
function pM(e, t, n, r, i) {
|
|
28698
28726
|
let a = /* @__PURE__ */ new Map();
|
|
28699
28727
|
for (let t of e.data) {
|
|
28700
|
-
let e =
|
|
28728
|
+
let e = oM(t.date);
|
|
28701
28729
|
e !== null && Number.isFinite(t.value) && a.set(e, t);
|
|
28702
28730
|
}
|
|
28703
|
-
let o =
|
|
28704
|
-
for (; g.length > 1 && _(g.length) / (g.length * p) <
|
|
28731
|
+
let o = fM(e.locale), s = e.dateFormat ?? ((e) => o.long.format(/* @__PURE__ */ new Date(`${e}T00:00:00Z`))), c = e.weekdays === 5, l = (e) => !c || cM(e) >= 1 && cM(e) <= 5, u = lM(e, a), d = t - tM * 2, f = e.legend === !1 ? 0 : 28, p = c ? 5 : 7, m = c ? 1 : e.weekStart ?? 1, h = (e) => (cM(e) - m + 7) % 7, g = u ? uM(u[0], u[1], h) : [], _ = (e) => n - tM * 2 - f - e * nM - (e - 1) * rM;
|
|
28732
|
+
for (; g.length > 1 && _(g.length) / (g.length * p) < eM;) g = g.slice(1);
|
|
28705
28733
|
let v = [];
|
|
28706
28734
|
for (let [e, t] of a) g.length > 0 && e >= g[0].first && e <= g[g.length - 1].last && l(e) && v.push(t.value);
|
|
28707
28735
|
let y = Wm(v, r, e.colorScale), b = {
|
|
@@ -28715,17 +28743,17 @@ function dM(e, t, n, r, i) {
|
|
|
28715
28743
|
formatDate: s
|
|
28716
28744
|
};
|
|
28717
28745
|
if (g.length === 0 || d <= 0 || _(g.length) <= 0) return b;
|
|
28718
|
-
let x = g.length > 1, S = g.map((e) => String(e.year)), C = Array.from({ length: p }, (e, t) => o.weekday.format(new Date((3 + m + t) *
|
|
28746
|
+
let x = g.length > 1, S = g.map((e) => String(e.year)), C = Array.from({ length: p }, (e, t) => o.weekday.format(new Date((3 + m + t) * $j))), w = tM + Math.max(...C.map((e) => i(e, 10)), ...x ? S.map((e) => i(e, 11)) : [0]) + aM, T = Math.max(...g.map((e) => e.weeks)), E = Math.min(iM, (t - w - tM) / T, _(g.length) / (g.length * p));
|
|
28719
28747
|
if (!(E > 0)) return b;
|
|
28720
|
-
let ee = E - (E >= 6 ? Math.max(1, Math.round(E * .12)) : 0), te = T * E, D = w + Math.max(0, (t - w -
|
|
28748
|
+
let ee = E - (E >= 6 ? Math.max(1, Math.round(E * .12)) : 0), te = T * E, D = w + Math.max(0, (t - w - tM - te) / 2), O = {
|
|
28721
28749
|
...b,
|
|
28722
28750
|
pitch: E
|
|
28723
|
-
}, k =
|
|
28751
|
+
}, k = tM;
|
|
28724
28752
|
for (let [e, n] of g.entries()) {
|
|
28725
|
-
let r = k +
|
|
28753
|
+
let r = k + nM;
|
|
28726
28754
|
x && O.years.push({
|
|
28727
28755
|
label: S[e],
|
|
28728
|
-
x: D -
|
|
28756
|
+
x: D - aM,
|
|
28729
28757
|
y: k
|
|
28730
28758
|
});
|
|
28731
28759
|
let s = -1, c = -Infinity;
|
|
@@ -28736,14 +28764,14 @@ function dM(e, t, n, r, i) {
|
|
|
28736
28764
|
x: u,
|
|
28737
28765
|
y: d,
|
|
28738
28766
|
size: ee,
|
|
28739
|
-
date:
|
|
28767
|
+
date: sM(e),
|
|
28740
28768
|
day: f,
|
|
28741
28769
|
color: f && Number.isFinite(f.value) ? Gm(f.value, y) : null
|
|
28742
28770
|
});
|
|
28743
|
-
let p = new Date(e *
|
|
28771
|
+
let p = new Date(e * $j).getUTCMonth();
|
|
28744
28772
|
if (p !== s) {
|
|
28745
28773
|
s = p;
|
|
28746
|
-
let n = o.month.format(new Date(e *
|
|
28774
|
+
let n = o.month.format(new Date(e * $j)), r = u + i(n, 10);
|
|
28747
28775
|
u >= c && r <= t && (O.months.push({
|
|
28748
28776
|
label: n,
|
|
28749
28777
|
x: u,
|
|
@@ -28755,27 +28783,27 @@ function dM(e, t, n, r, i) {
|
|
|
28755
28783
|
let e = E >= 13 ? 1 : 2;
|
|
28756
28784
|
for (let t = 0; t < p; t += e) O.weekdays.push({
|
|
28757
28785
|
label: C[t],
|
|
28758
|
-
x: D -
|
|
28786
|
+
x: D - aM,
|
|
28759
28787
|
y: r + t * E + ee / 2
|
|
28760
28788
|
});
|
|
28761
28789
|
}
|
|
28762
|
-
k = r + p * E +
|
|
28790
|
+
k = r + p * E + rM;
|
|
28763
28791
|
}
|
|
28764
28792
|
return f > 0 && (O.bar = {
|
|
28765
28793
|
x: D,
|
|
28766
|
-
y: k -
|
|
28767
|
-
width: Math.min(te, t - D -
|
|
28794
|
+
y: k - rM + 8,
|
|
28795
|
+
width: Math.min(te, t - D - tM),
|
|
28768
28796
|
height: f - 8
|
|
28769
28797
|
}), O;
|
|
28770
28798
|
}
|
|
28771
|
-
function
|
|
28799
|
+
function mM(e, t, n) {
|
|
28772
28800
|
for (let r of e.cells) if (t >= r.x && t < r.x + e.pitch && n >= r.y && n < r.y + e.pitch) return r;
|
|
28773
28801
|
return null;
|
|
28774
28802
|
}
|
|
28775
|
-
function
|
|
28803
|
+
function hM(e, t, n, r, i, a, o = pM(r, t, n, i, Sm(e, i))) {
|
|
28776
28804
|
let s = r.valueFormat ?? hm(r.locale);
|
|
28777
28805
|
e.fillStyle = i.background, e.fillRect(0, 0, t, n);
|
|
28778
|
-
let c = a && r.crosshair !== !1 ?
|
|
28806
|
+
let c = a && r.crosshair !== !1 ? mM(o, a.x, a.y) : null, l = N(i.textSecondary, .12), u = o.pitch >= 10 ? 2 : 0;
|
|
28779
28807
|
e.save();
|
|
28780
28808
|
for (let t of o.cells) e.fillStyle = t.color ?? l, e.beginPath(), u > 0 && typeof e.roundRect == "function" ? e.roundRect(t.x, t.y, t.size, t.size, u) : e.rect(t.x, t.y, t.size, t.size), e.fill();
|
|
28781
28809
|
c && (e.strokeStyle = i.text, e.lineWidth = 1.5, e.strokeRect(c.x - .75, c.y - .75, c.size + 1.5, c.size + 1.5)), e.fillStyle = i.textSecondary, e.font = Y(i, 10), e.textAlign = "left", e.textBaseline = "top";
|
|
@@ -28803,16 +28831,16 @@ function pM(e, t, n, r, i, a, o = dM(r, t, n, i, Sm(e, i))) {
|
|
|
28803
28831
|
}
|
|
28804
28832
|
return o;
|
|
28805
28833
|
}
|
|
28806
|
-
var
|
|
28807
|
-
function
|
|
28834
|
+
var gM = 12, _M = 6, vM = 72, yM = Math.PI / 4, bM = Math.sin(yM);
|
|
28835
|
+
function xM(e) {
|
|
28808
28836
|
let t = e.length, n = Array.from({ length: t }, () => Array(t).fill(NaN));
|
|
28809
28837
|
for (let r = 0; r < t; r++) for (let i = r; i < t; i++) {
|
|
28810
|
-
let t =
|
|
28838
|
+
let t = SM(e[r], e[i], r === i);
|
|
28811
28839
|
n[r][i] = t, n[i][r] = t;
|
|
28812
28840
|
}
|
|
28813
28841
|
return n;
|
|
28814
28842
|
}
|
|
28815
|
-
function
|
|
28843
|
+
function SM(e, t, n) {
|
|
28816
28844
|
let r = Math.min(e.length, t.length), i = 0, a = 0, o = 0;
|
|
28817
28845
|
for (let n = 0; n < r; n++) Number.isFinite(e[n]) && Number.isFinite(t[n]) && (i++, a += e[n], o += t[n]);
|
|
28818
28846
|
if (i < 3) return NaN;
|
|
@@ -28824,15 +28852,15 @@ function bM(e, t, n) {
|
|
|
28824
28852
|
}
|
|
28825
28853
|
return u === 0 || d === 0 ? NaN : n ? 1 : Math.max(-1, Math.min(1, l / Math.sqrt(u * d)));
|
|
28826
28854
|
}
|
|
28827
|
-
var
|
|
28828
|
-
function
|
|
28855
|
+
var CM = (e) => e.toFixed(2);
|
|
28856
|
+
function wM(e, t, n, r) {
|
|
28829
28857
|
return !t || !e ? !0 : e === "lower" ? r <= n : r >= n;
|
|
28830
28858
|
}
|
|
28831
|
-
function
|
|
28859
|
+
function TM(e, t, n, r, i) {
|
|
28832
28860
|
let a = e.rows.slice(0, 200), o = (e.columns ?? e.rows).slice(0, 200), s = e.columns === void 0 || e.columns.length === e.rows.length && e.columns.every((t, n) => t === e.rows[n]), c = [];
|
|
28833
28861
|
for (let t = 0; t < a.length; t++) for (let n = 0; n < o.length; n++) {
|
|
28834
28862
|
let r = e.values[t]?.[n];
|
|
28835
|
-
Number.isFinite(r) &&
|
|
28863
|
+
Number.isFinite(r) && wM(e.triangle, s, t, n) && c.push(r);
|
|
28836
28864
|
}
|
|
28837
28865
|
let l = Wm(c, r, e.colorScale), u = {
|
|
28838
28866
|
cells: [],
|
|
@@ -28850,21 +28878,21 @@ function CM(e, t, n, r, i) {
|
|
|
28850
28878
|
at: []
|
|
28851
28879
|
};
|
|
28852
28880
|
if (a.length === 0 || o.length === 0 || t <= 0 || n <= 0) return u;
|
|
28853
|
-
let d = Math.min(t * .3, Math.max(...a.map((e) => i(e, 11)))), f = Math.max(...o.map((e) => i(e, 11))), p = e.legend === !1 ? 0 : 28, m =
|
|
28854
|
-
if (y && (b = Math.min(f, n * .33 /
|
|
28881
|
+
let d = Math.min(t * .3, Math.max(...a.map((e) => i(e, 11)))), f = Math.max(...o.map((e) => i(e, 11))), p = e.legend === !1 ? 0 : 28, m = gM + d + _M, h = t - m - gM, g = (e) => Math.min(vM, h / o.length, (n - e - gM - p) / a.length), _ = gM + 11 + _M, v = g(_), y = f > v - 4, b = f;
|
|
28882
|
+
if (y && (b = Math.min(f, n * .33 / bM), _ = gM + b * bM + 11, v = g(_)), !(v > 0)) return u;
|
|
28855
28883
|
let x = v - +(v >= 8), S = m + Math.max(0, (h - o.length * v) / 2);
|
|
28856
|
-
y && (b = Math.max(0, Math.min(b, (S + x / 2 - 2 - 11 *
|
|
28884
|
+
y && (b = Math.max(0, Math.min(b, (S + x / 2 - 2 - 11 * bM / 2) / bM))), u.grid = {
|
|
28857
28885
|
x: S,
|
|
28858
28886
|
y: _,
|
|
28859
28887
|
width: o.length * v,
|
|
28860
28888
|
height: a.length * v
|
|
28861
28889
|
}, u.pitch = v;
|
|
28862
|
-
let C = e.valueFormat ??
|
|
28890
|
+
let C = e.valueFormat ?? CM, w = e.showValues !== !1, T = Math.max(8, Math.min(11, v / 3));
|
|
28863
28891
|
for (let t = 0; t < a.length; t++) {
|
|
28864
28892
|
u.at.push([]);
|
|
28865
28893
|
for (let n = 0; n < o.length; n++) {
|
|
28866
28894
|
let r = e.values[t]?.[n];
|
|
28867
|
-
if (!Number.isFinite(r) || !
|
|
28895
|
+
if (!Number.isFinite(r) || !wM(e.triangle, s, t, n)) continue;
|
|
28868
28896
|
let c = Gm(r, l), d = w ? C(r) : "", f = w && v >= 18 && i(d, T) <= v - 4, p = {
|
|
28869
28897
|
x: S + n * v,
|
|
28870
28898
|
y: _ + t * v,
|
|
@@ -28883,42 +28911,42 @@ function CM(e, t, n, r, i) {
|
|
|
28883
28911
|
u.cells.push(p), u.at[t][n] = p;
|
|
28884
28912
|
}
|
|
28885
28913
|
}
|
|
28886
|
-
let E = Math.max(1, Math.ceil(11 / v)), ee = Math.max(1, Math.ceil(11 / (y ? v *
|
|
28914
|
+
let E = Math.max(1, Math.ceil(11 / v)), ee = Math.max(1, Math.ceil(11 / (y ? v * bM : v)));
|
|
28887
28915
|
for (let e = 0; e < a.length; e += E) u.rowLabels.push({
|
|
28888
28916
|
text: Lm(a[e], d, i),
|
|
28889
28917
|
index: e,
|
|
28890
|
-
x: S -
|
|
28918
|
+
x: S - _M,
|
|
28891
28919
|
y: _ + e * v + x / 2
|
|
28892
28920
|
});
|
|
28893
28921
|
for (let e = 0; e < o.length; e += ee) u.columnLabels.push({
|
|
28894
28922
|
text: Lm(o[e], b, i),
|
|
28895
28923
|
index: e,
|
|
28896
28924
|
x: S + e * v + x / 2,
|
|
28897
|
-
y: _ -
|
|
28925
|
+
y: _ - _M,
|
|
28898
28926
|
rotated: y
|
|
28899
28927
|
});
|
|
28900
28928
|
return p > 0 && (u.bar = {
|
|
28901
28929
|
x: S,
|
|
28902
28930
|
y: _ + a.length * v + 8,
|
|
28903
|
-
width: Math.min(u.grid.width, t - S -
|
|
28931
|
+
width: Math.min(u.grid.width, t - S - gM),
|
|
28904
28932
|
height: p - 8
|
|
28905
28933
|
}), u;
|
|
28906
28934
|
}
|
|
28907
|
-
function
|
|
28935
|
+
function EM(e, t, n) {
|
|
28908
28936
|
let { grid: r, pitch: i } = e;
|
|
28909
28937
|
return i <= 0 || t < r.x || n < r.y || t >= r.x + r.width || n >= r.y + r.height ? null : e.at[Math.floor((n - r.y) / i)]?.[Math.floor((t - r.x) / i)] ?? null;
|
|
28910
28938
|
}
|
|
28911
|
-
function
|
|
28912
|
-
let s = r.valueFormat ??
|
|
28939
|
+
function DM(e, t, n, r, i, a, o = TM(r, t, n, i, Sm(e, i))) {
|
|
28940
|
+
let s = r.valueFormat ?? CM;
|
|
28913
28941
|
e.fillStyle = i.background, e.fillRect(0, 0, t, n);
|
|
28914
|
-
let c = a && r.crosshair !== !1 ?
|
|
28942
|
+
let c = a && r.crosshair !== !1 ? EM(o, a.x, a.y) : null;
|
|
28915
28943
|
e.save();
|
|
28916
28944
|
let l = Math.max(8, Math.min(11, o.pitch / 3));
|
|
28917
28945
|
e.textAlign = "center", e.textBaseline = "middle", e.font = Y(i, l);
|
|
28918
28946
|
for (let t of o.cells) e.fillStyle = t.color, e.fillRect(t.x, t.y, t.size, t.size), t.text && (e.fillStyle = t.textColor, e.fillText(t.text, t.x + t.size / 2, t.y + t.size / 2));
|
|
28919
28947
|
c && (e.strokeStyle = i.text, e.lineWidth = 1.5, e.strokeRect(c.x + .75, c.y + .75, c.size - 1.5, c.size - 1.5)), e.font = Y(i, 11), e.fillStyle = i.textSecondary, e.textAlign = "right";
|
|
28920
28948
|
for (let t of o.rowLabels) e.fillStyle = c && c.cell.rowIndex === t.index ? i.text : i.textSecondary, e.fillText(t.text, t.x, t.y);
|
|
28921
|
-
for (let t of o.columnLabels) e.fillStyle = c && c.cell.columnIndex === t.index ? i.text : i.textSecondary, t.rotated ? (e.save(), e.translate(t.x, t.y), e.rotate(
|
|
28949
|
+
for (let t of o.columnLabels) e.fillStyle = c && c.cell.columnIndex === t.index ? i.text : i.textSecondary, t.rotated ? (e.save(), e.translate(t.x, t.y), e.rotate(yM), e.textAlign = "right", e.fillText(t.text, 0, 0), e.restore()) : (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t.text, t.x, t.y), e.textBaseline = "middle");
|
|
28922
28950
|
if (e.restore(), o.bar && Ym(e, o.bar, o.scale, s, i), c && a) {
|
|
28923
28951
|
let { cell: r } = c;
|
|
28924
28952
|
Tm(e, [{
|
|
@@ -28936,8 +28964,8 @@ function TM(e, t, n, r, i, a, o = CM(r, t, n, i, Sm(e, i))) {
|
|
|
28936
28964
|
}
|
|
28937
28965
|
//#endregion
|
|
28938
28966
|
//#region src/finance/CounterClockRenderer.ts
|
|
28939
|
-
var
|
|
28940
|
-
function
|
|
28967
|
+
var OM = 12, kM = 18, AM = 20, jM = 10, MM = .2, NM = 2e3, PM = 1e-9;
|
|
28968
|
+
function FM(e, t, n = Infinity) {
|
|
28941
28969
|
let r = Number.isFinite(t) ? Math.max(1, Math.floor(t)) : 25, i = [], a = Math.max(r - 1, e.length - (Number.isFinite(n) ? Math.max(1, Math.floor(n)) : e.length));
|
|
28942
28970
|
for (let t = a; t < e.length; t++) {
|
|
28943
28971
|
let n = 0, a = 0;
|
|
@@ -28950,21 +28978,21 @@ function NM(e, t, n = Infinity) {
|
|
|
28950
28978
|
}
|
|
28951
28979
|
return i;
|
|
28952
28980
|
}
|
|
28953
|
-
var
|
|
28954
|
-
function
|
|
28981
|
+
var IM = (e, t) => t - e > PM * Math.max(Math.abs(e), Math.abs(t));
|
|
28982
|
+
function LM(e) {
|
|
28955
28983
|
if (e.length < 2) return null;
|
|
28956
28984
|
let t = Infinity, n = -Infinity, r = Infinity, i = -Infinity;
|
|
28957
28985
|
for (let a of e) t = Math.min(t, a.volume), n = Math.max(n, a.volume), r = Math.min(r, a.price), i = Math.max(i, a.price);
|
|
28958
|
-
let a = e[e.length - 2], o = e[e.length - 1], s =
|
|
28986
|
+
let a = e[e.length - 2], o = e[e.length - 1], s = IM(t, n) ? (o.volume - a.volume) / (n - t) : 0, c = IM(r, i) ? (o.price - a.price) / (i - r) : 0;
|
|
28959
28987
|
if (Math.abs(s) < 1e-6 && Math.abs(c) < 1e-6) return null;
|
|
28960
28988
|
let l = (Math.atan2(c, s) + 2 * Math.PI) % (2 * Math.PI);
|
|
28961
28989
|
return Math.round(l / (Math.PI / 4)) % 8 + 1;
|
|
28962
28990
|
}
|
|
28963
|
-
function
|
|
28964
|
-
let a =
|
|
28991
|
+
function RM(e, t, n, r, i) {
|
|
28992
|
+
let a = FM(e.data, e.period ?? 25, zM(e)), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
28965
28993
|
for (let e of a) o = Math.min(o, e.volume), s = Math.max(s, e.volume), c = Math.min(c, e.price), l = Math.max(l, e.price);
|
|
28966
|
-
a.length > 0 && !
|
|
28967
|
-
let u = um(a.length > 0 ? o : 0, a.length > 0 ? s : 1, Math.max(2, Math.floor(t / 110))), d = um(a.length > 0 ? c : 0, a.length > 0 ? l : 1, Math.max(2, Math.floor(n / 60))), f = e.priceFormat ?? J(d, e.locale), p = e.volumeFormat ?? J(u, e.locale), m =
|
|
28994
|
+
a.length > 0 && !IM(o, s) && (s = o), a.length > 0 && !IM(c, l) && (l = c);
|
|
28995
|
+
let u = um(a.length > 0 ? o : 0, a.length > 0 ? s : 1, Math.max(2, Math.floor(t / 110))), d = um(a.length > 0 ? c : 0, a.length > 0 ? l : 1, Math.max(2, Math.floor(n / 60))), f = e.priceFormat ?? J(d, e.locale), p = e.volumeFormat ?? J(u, e.locale), m = OM + Math.max(0, ...d.ticks.map((e) => i(f(e), 11))) + 8 + (e.yLabel ? kM : 0), h = OM + i(p(u.max), 11) / 2, g = OM, _ = OM + AM + (e.xLabel ? kM : 0), v = {
|
|
28968
28996
|
x: m,
|
|
28969
28997
|
y: g,
|
|
28970
28998
|
width: Math.max(1, t - m - h),
|
|
@@ -28977,37 +29005,37 @@ function IM(e, t, n, r, i) {
|
|
|
28977
29005
|
points: a.map((e, t) => ({
|
|
28978
29006
|
px: q(u, e.volume, v.x, v.width),
|
|
28979
29007
|
py: q(d, e.price, v.y, v.height, !0),
|
|
28980
|
-
alpha:
|
|
29008
|
+
alpha: MM + (1 - MM) * t / y,
|
|
28981
29009
|
point: e
|
|
28982
29010
|
})),
|
|
28983
|
-
phase:
|
|
29011
|
+
phase: LM(a),
|
|
28984
29012
|
color: e.color ?? Oe[0]
|
|
28985
29013
|
};
|
|
28986
29014
|
}
|
|
28987
|
-
function
|
|
29015
|
+
function zM(e) {
|
|
28988
29016
|
let t = e.points ?? 60;
|
|
28989
|
-
return Number.isFinite(t) ? Math.min(
|
|
29017
|
+
return Number.isFinite(t) ? Math.min(NM, Math.max(2, Math.floor(t))) : 60;
|
|
28990
29018
|
}
|
|
28991
|
-
function
|
|
28992
|
-
let r = null, i =
|
|
29019
|
+
function BM(e, t, n) {
|
|
29020
|
+
let r = null, i = jM * jM;
|
|
28993
29021
|
for (let a = e.points.length - 1; a >= 0; a--) {
|
|
28994
29022
|
let o = e.points[a], s = (o.px - t) ** 2 + (o.py - n) ** 2;
|
|
28995
29023
|
s < i && (r = o, i = s);
|
|
28996
29024
|
}
|
|
28997
29025
|
return r;
|
|
28998
29026
|
}
|
|
28999
|
-
function
|
|
29027
|
+
function VM(e, t, n, r, i, a, o = RM(r, t, n, i, Sm(e, i))) {
|
|
29000
29028
|
let { plot: s, points: c, color: l } = o, u = r.timeFormat ?? _m(r.locale, {
|
|
29001
29029
|
year: "numeric",
|
|
29002
29030
|
month: "short",
|
|
29003
29031
|
day: "numeric"
|
|
29004
29032
|
}), d = r.priceFormat ?? hm(r.locale), f = r.volumeFormat ?? hm(r.locale);
|
|
29005
|
-
e.fillStyle = i.background, e.fillRect(0, 0, t, n), Im(e, s, o.yScale, "vertical", i, r.priceFormat ?? J(o.yScale, r.locale)), Im(e, s, o.xScale, "horizontal", i, r.volumeFormat ?? J(o.xScale, r.locale)),
|
|
29033
|
+
e.fillStyle = i.background, e.fillRect(0, 0, t, n), Im(e, s, o.yScale, "vertical", i, r.priceFormat ?? J(o.yScale, r.locale)), Im(e, s, o.xScale, "horizontal", i, r.volumeFormat ?? J(o.xScale, r.locale)), HM(e, s, r, i), e.save(), e.lineWidth = 1.5, e.lineJoin = "round";
|
|
29006
29034
|
for (let t = 1; t < c.length; t++) e.strokeStyle = N(l, c[t].alpha), e.beginPath(), e.moveTo(c[t - 1].px, c[t - 1].py), e.lineTo(c[t].px, c[t].py), e.stroke();
|
|
29007
29035
|
for (let t of c) e.fillStyle = N(l, t.alpha), e.beginPath(), e.arc(t.px, t.py, 2, 0, Math.PI * 2), e.fill();
|
|
29008
29036
|
let p = c[c.length - 1];
|
|
29009
29037
|
p && (e.fillStyle = l, e.strokeStyle = i.background, e.lineWidth = 2, e.beginPath(), e.arc(p.px, p.py, 5, 0, Math.PI * 2), e.fill(), e.stroke()), e.restore();
|
|
29010
|
-
let m = a && r.crosshair !== !1 ?
|
|
29038
|
+
let m = a && r.crosshair !== !1 ? BM(o, a.x, a.y) : null;
|
|
29011
29039
|
return m && a && (e.save(), e.strokeStyle = i.text, e.lineWidth = 1.5, e.beginPath(), e.arc(m.px, m.py, 5, 0, Math.PI * 2), e.stroke(), e.restore(), Tm(e, [
|
|
29012
29040
|
{
|
|
29013
29041
|
text: u(m.point.time),
|
|
@@ -29023,10 +29051,10 @@ function zM(e, t, n, r, i, a, o = IM(r, t, n, i, Sm(e, i))) {
|
|
|
29023
29051
|
height: n
|
|
29024
29052
|
}, i)), o;
|
|
29025
29053
|
}
|
|
29026
|
-
function
|
|
29027
|
-
e.save(), e.font = Y(r, 11), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, t.x + t.width / 2, t.y + t.height +
|
|
29054
|
+
function HM(e, t, n, r) {
|
|
29055
|
+
e.save(), e.font = Y(r, 11), e.fillStyle = r.textSecondary, e.textAlign = "center", n.xLabel && (e.textBaseline = "bottom", e.fillText(n.xLabel, t.x + t.width / 2, t.y + t.height + AM + kM)), n.yLabel && (e.translate(OM + 4, t.y + t.height / 2), e.rotate(-Math.PI / 2), e.textBaseline = "middle", e.fillText(n.yLabel, 0, 0)), e.restore();
|
|
29028
29056
|
}
|
|
29029
29057
|
//#endregion
|
|
29030
|
-
export { sx as ABCDPatternTool, Il as ADXIndicator, Ru as ALMAIndicator, Fl as ATRIndicator, dn as AXIS_LABEL_HEIGHT, wu as AcceleratorOscillatorIndicator, Pu as AccumulationDistributionIndicator, Af as AccumulativeSwingIndexIndicator, Mf as AdvanceDeclineIndicator, Xp as AlertDragHandler, HD as AlertManager, xl as AlligatorIndicator, Qx as AnchoredNoteTool, Zx as AnchoredTextTool, fl as AnchoredVWAPIndicator, _b as AnchoredVWAPTool, _k as Animator, SS as ArcTool, ur as AreaRenderer, Vl as AroonIndicator, Ix as ArrowMarkTool, sb as ArrowTool, ud as AverageDayRangeIndicator, vd as AveragePriceIndicator, Al as AwesomeOscillatorIndicator, Yp as AxisDragHandler, lu as BalanceOfPowerIndicator, Xx as BalloonTool, Cn as BarCountdown, dr as BarRenderer, rC as BarsPatternTool, bk as BaseFinanceChart, mr as BaselineRenderer, hE as BinanceAdapter, Zu as BollingerBandWidthIndicator, Yc as BollingerBandsIndicator, Xu as BollingerPercentBIndicator, fw as BracketTool, hS as BrushTool, kE as BybitAdapter, of as CANDLE_PATTERNS, zl as CCIIndicator, Wl as CMFIndicator, Sn as COUNTDOWN_HEIGHT, lh as CROSSHAIR_CURSORS, Dx as CalloutTool, bn as CandlestickRenderer, Bt as CanvasLayer, jl as ChaikinOscillatorIndicator, _u as ChaikinVolatilityIndicator, qu as ChandeKrollStopIndicator, du as ChandeMomentumIndicator, bl as ChandelierExitIndicator, iD as ChartLegend, XO as ChartMarkManager, bO as ChartStateManager, If as ChopZoneIndicator, ql as ChoppinessIndexIndicator, dx as CircleTool, CE as CoinbaseAdapter, eo as CompareRenderer, pc as CompareSymbolIndicator, mc as CompareSymbolPaneIndicator, Zl as ConnorsRSIIndicator, $l as CoppockIndicator, yc as CorrelationCoefficientIndicator, bc as CorrelationLogIndicator, Ub as CrossLineTool, $m as CrosshairHandler, Dh as CrosshairTooltip, tT as CurrentPriceLine, xS as CurveTool, yx as CyclicLinesTool, ux as CypherPatternTool, rD as DEFAULT_LEGEND_CONFIG, Pt as DEFAULT_MAX_PIXEL_RATIO, ee as DEFAULT_MAX_WEBGL_CHARTS, TD as DEFAULT_SESSION_HOURS, Iu as DEMAIndicator, te as DENSE_BAR_WIDTH, Tp as DOUBLE_TAP_MS, Ep as DOUBLE_TAP_PX, Rt as DPRManager, kO as DataExporter, hx as DateAndPriceRangeTool, Xy as DateRangeTool, li as DepthHeatmapBuffer, ui as DepthHeatmapRenderer, Uw as DepthOverlay, Ww as DepthOverlayLayer, cu as DetrendedPriceOscillatorIndicator, zv as DisjointChannelTool, Du as DisparityIndexIndicator, cl as DonchianChannelIndicator, X as DrawingBase, s_ as DrawingManager, h_ as DrawingRenderer, Jc as EMAIndicator, mu as EaseOfMovementIndicator, gk as Easing, ru as ElderRayIndicator, Vy as ElliottCorrectionTool, Uy as ElliottDoubleComboTool, By as ElliottImpulseTool, Hy as ElliottTriangleTool, Wy as ElliottTripleComboTool, zy as ElliottWaveTool, oy as EllipseTool, Yw as Emitter, Tl as EnvelopeIndicator, xr as EquivolumeRenderer, zh as EventBus, kv as ExtendedLineTool, BS as FibArcsTool, Zb as FibChannelTool, zS as FibCirclesTool, ry as FibExtensionTool, ty as FibRetracementTool, ix as FibSpeedResistanceFanTool, US as FibSpiralTool, Ab as FibTimeZonesTool, VS as FibWedgeTool, xk as FinanceCrosshair, su as FisherTransformIndicator, Nx as FlagTool, Bv as FlatTopBottomTool, Xl as ForceIndexIndicator, tC as ForecastTool, Qk as GROUP_HEADER, hb as GannBoxTool, ub as GannFanTool, WS as GannSquareTool, C as GridRenderer, hd as GuppyMMAIndicator, Cr as HLCAreaRenderer, Cf as HammingMAIndicator, cx as HeadAndShouldersTool, Or as HiLoRenderer, gS as HighlighterTool, $u as HistoricalVolatilityIndicator, fr as HollowCandleRenderer, wv as HorizontalLineTool, Tv as HorizontalRayTool, hl as HullMAIndicator, Lx as ICON_GLYPHS, Kf as INDICATOR_CATEGORIES, Lc as INDICATOR_WORKER_MIN_BARS, Rs as INTERVAL_LIMITS, Ls as INTERVAL_UNITS, il as IchimokuIndicator, zx as IconTool, R as IndicatorBase, Kc as IndicatorEngine, z as IndicatorValueMap, ip as IndicatorWorkerClient, tp as IndicatorWorkerHost, op as IndicatorWorkerPool, Gb as InfoLineTool, Ip as InteractionManager, zu as KAMAIndicator, oT as KEPT_BUCKETS, eu as KSTIndicator, gr as KagiRenderer, sl as KeltnerChannelIndicator, gh as KeyboardHandler, ou as KlingerIndicator, IE as KrakenAdapter, Bu as LSMAIndicator, Vt as LayerManager, lr as LineRenderer, Tr as LineWithMarkersRenderer, ml as LinearRegressionChannelIndicator, cd as LinearRegressionSlopeIndicator, Nl as MACDIndicator, yf as MAChannelIndicator, Wu as MACrossIndicator, Df as MADoubleIndicator, FO as MARK_BADGE_SIZE, zO as MARK_ROW_HEIGHT, gd as MARibbonIndicator, Of as MATripleIndicator, ND as MAX_ALERT_BARS, iT as MAX_BASE_RATIO, rT as MAX_BASE_REQUESTS, Bl as MFIIndicator, PD as MIN_ALERT_BARS, Kn as MIN_BAR_UNIT, qn as MIN_BAR_UNIT_LIMIT, vl as MTFMovingAverageIndicator, Nf as MajorityRuleIndicator, tD as ManualFeed, Jr as MarketProfileRenderer, uu as MassIndexIndicator, Vu as McGinleyDynamicIndicator, ak as MeasureOverlay, Zy as MeasureTool, yd as MedianPriceIndicator, gE as MockAdapter, py as ModifiedSchiffPitchforkTool, Qu as MomentumIndicator, dd as NetVolumeIndicator, Ex as NoteTool, Ll as OBVIndicator, vw as OrderDraftTool, GC as OrderRenderer, zp as PRICE_AXIS_ADD_STRIP, Xn as PRICE_SCALE_MARGIN, qp as PanHandler, Zp as PaneResizeHandler, Kw as PaperExecutionAdapter, al as ParabolicSARIndicator, Mv as ParallelChannelTool, _S as PathTool, Su as PercentagePriceOscillatorIndicator, $r as PeriodLevelsRenderer, Fh as PinnedTooltip, HS as PitchfanTool, dy as PitchforkTool, ai as PivotMarkersRenderer, ul as PivotPointsIndicator, yr as PointAndFigureRenderer, yE as PollingAdapter, vS as PolylineTool, rw as PositionRenderer, ku as PrettyGoodOscillatorIndicator, on as PriceAxis, Bp as PriceAxisAddButton, sS as PriceLabelTool, kD as PriceLines, zf as PriceOscillatorIndicator, qy as PriceRangeTool, hu as PriceVolumeTrendIndicator, nC as ProjectionTool, Ou as QstickIndicator, er as RANGE_PRESETS, Hl as ROCIndicator, Ml as RSIIndicator, Ov as RayTool, $w as ReconnectManager, ay as RectangleTool, Lv as RegressionChannelTool, Eu as RelativeMomentumIndexIndicator, vu as RelativeVigorIndicator, od as RelativeVolatilityIndexIndicator, Hn as RenderEngine, Ht as RenderLoop, hr as RenkoRenderer, XT as ReplayController, ZD as ReplayManager, _T as ResamplingAdapter, so as ReshapeMemo, Hb as RiskRewardTool, Vv as RotatedRectangleTool, mk as SELECTION_BOX_MIN_SIZE, qc as SMAIndicator, Rf as SMIErgodicIndicator, Lu as SMMAIndicator, $D as SNAPSHOT_VERSION, dc as SYMBOL_INDICATOR_IDS, aT as SYMBOL_ZONE_WAIT_MS, iu as SchaffTrendCycleIndicator, fy as SchiffPitchforkTool, pD as Screenshot, hk as SelectionBoxOverlay, vD as SessionBreaks, ED as SessionShading, yl as SessionVWAPIndicator, PO as SignalMarkerManager, Yx as SignpostTool, YS as SineLineTool, hc as SpreadIndicator, fd as StandardErrorBandsIndicator, ld as StandardErrorIndicator, Au as StdDevIndicator, wr as StepLineRenderer, Pl as StochasticIndicator, ad as StochasticMomentumIndexIndicator, yu as StochasticRSIIndicator, YT as StreamManager, ol as SupertrendIndicator, fi as SymbolSeriesStore, kl as TEMAIndicator, wp as TOUCH_REACH, fu as TRIXIndicator, Ul as TSIIndicator, Dp as TapTracker, ab as TextAnnotationTool, lx as ThreeDrivesTool, Qw as TickAggregator, ST as TickBarAdapter, xT as TickBarBuilder, bp as TimeAxis, JS as TimeCyclesTool, tk as TradeZoneManager, ow as TradingContextMenu, aw as TradingDragHandler, Pw as TradingManager, Fw as TradingRenderer, uv as TrendAngleTool, Cv as TrendLineTool, sd as TrendStrengthIndexIndicator, sy as TriangleTool, bd as TypicalPriceIndicator, VE as UPBIT_MAX_CANDLES, nd as UlcerIndexIndicator, Jl as UltimateOscillatorIndicator, xO as UndoRedoManager, KE as UpbitAdapter, kr as VOLUME_HEIGHT_RATIO, Fu as VROCIndicator, tl as VWAPIndicator, Cl as VWMAIndicator, Dv as VerticalLineTool, Qn as Viewport, kf as VolatilityIndexIndicator, Hf as VolatilityOHLCIndicator, Uf as VolatilityZeroTrendIndicator, br as VolumeCandleRenderer, Gl as VolumeDeltaIndicator, ed as VolumeOscillatorIndicator, Nu as VolumeProfileIndicator, Eb as VolumeProfileRangeTool, Nr as VolumeProfileRenderer, Ar as VolumeRenderer, Kl as VortexIndicator, wl as WMAIndicator, mD as Watermark, vE as WebSocketAdapter, gu as WilliamsADIndicator, Ku as WilliamsFractalsIndicator, Rl as WilliamsRIndicator, ox as XABCDPatternTool, pl as ZigZagIndicator, Jp as ZoomHandler, FT as adapterFromFeed, wn as alignAxisTags, Fs as alignOutput, bS as arcPoints, Kr as assignSessionLetters, J as axisFormat, vo as axisTimes, t as barIndexToTime, O as barIndexToX, d as barTimeStep, r as barTimeStepMs, xc as barsToColumns, cw as bracketRiskReward, Sm as canvasMeasure, Ft as cappedPixelRatio, S as claimGpuContext, ti as classifyPivots, Hs as cleanIntervals, Sc as columnsToBars, Mc as columnsToOutput, dj as computeBarLayout, sw as computeBracketDefaults, dM as computeCalendarLayout, IM as computeCounterClockLayout, kk as computeDepthLayout, Cj as computeDonutLayout, Uk as computeEquityLayout, qj as computeHistogramLayout, Wr as computeMarketProfile, CM as computeMatrixLayout, Qr as computePeriodLevels, Pj as computeScatterLayout, qr as computeSessionProfiles, yA as computeWaterfallLayout, yM as correlationMatrix, FM as counterClockPhase, NM as counterClockPoints, np as createIndicatorWorker, yS as curvePoints, aM as dayToIso, ym as defaultFormat, Vw as depthBars, $f as describeInputs, uf as detectCandlePatterns, gn as drawAxisValueLabels, wC as drawIcon, Zg as drawingAxisSpan, ts as drawnKeys, LT as feedFromAdapter, ln as fillTag, yk as financeTheme, g_ as findDominantSwing, ni as findPivots, h as forEachPixelColumn, eC as forecastOutcome, wh as formatTooltipTime, W as getIntParam, U as getNumberParam, $n as getVisibleData, T as gpuContextsLeft, us as hasHistogram, TT as hasTrades, Hj as histogramBins, fj as hitBar, pj as hitCategory, fM as hitDay, Jj as hitHistogramBar, wM as hitMatrixCell, wj as hitSlice, bA as hitWaterfallBar, hh as idleCssCursor, Jf as indicatorCategory, un as indicatorValuePrecision, sp as indicatorWorkerPool, hw as inferOrderType, Ms as inputSource, uh as isCrosshairCursor, jT as isDataFeed, g as isDense, CD as isInWindow, ID as isPriceLevelAlert, wD as isRegularSession, Ws as isSeriesPalette, ns as isUpTone, ep as isWorkerResponse, pn as labelTextColor, hn as layoutAxisValueLabels, $k as layoutGroupedTreemap, Cm as layoutLegend, Xk as layoutSquarifiedTreemap, Kk as layoutUniformGrid, Ps as lineSourceBars, sg as lineSpace, Wn as loadWebGL, Gn as loadWebGLRenderer, or as lttbDownsample, cr as lttbVisibleIndices, xD as mergeSessionHours, SD as minuteOfDay, RM as nearestCounterClockPoint, Fj as nearestPoint, um as niceScale, hm as numberFormat, Dc as outputToColumns, cs as paneLogRange, ss as paneValueRange, iM as parseDay, n as pastTimeStep, gm as percentFormat, os as plotColor, as as plotLook, rs as plotShown, ko as pointAndFigureColumns, c as priceBucketRow, Ut as priceScaleText, Ns as priceSourceBars, x as priceToY, e as priceToYMapper, ar as rangePresetStart, WD as readAlertOptions, Jm as readableText, iC as registerBuiltInDrawingTools, Gf as registerBuiltInIndicators, _n as renderAxisValueLabels, mj as renderBarChart, pM as renderCalendar, zM as renderCounterClock, w as renderDenseBars, Mk as renderDepthChart, Tj as renderDonut, Gk as renderEquityCurve, ij as renderGauge, lA as renderHeatmap, Yj as renderHistogram, TM as renderMatrix, ds as renderPlots, Ij as renderScatter, Sk as renderSparkline, wA as renderWaterfall, b as resolveBarIndex, Wm as resolveColorScale, Gm as scaleColor, pT as servesTimeframe, y as setMaxWebGLCharts, LM as shownCount, Vs as shownOnInterval, js as sourceParam, fn as spreadLabels, MT as streamAdapterOf, o as timeToX, s as timestampToBarIndex, to as toHeikinAshi, To as toKagi, wo as toLineBreak, Oo as toPointAndFigure, Jo as toRangeBars, yo as toRenko, Gr as tpoLetter, Fy as waveLabel, p as whenGpuContextFree, dT as withResampling, wT as withTickBars, l as xToBarIndex, i as xToTime, a as yToPrice };
|
|
29058
|
+
export { sx as ABCDPatternTool, Il as ADXIndicator, Ru as ALMAIndicator, Fl as ATRIndicator, dn as AXIS_LABEL_HEIGHT, wu as AcceleratorOscillatorIndicator, Pu as AccumulationDistributionIndicator, Af as AccumulativeSwingIndexIndicator, Mf as AdvanceDeclineIndicator, Xp as AlertDragHandler, WD as AlertManager, xl as AlligatorIndicator, Qx as AnchoredNoteTool, Zx as AnchoredTextTool, fl as AnchoredVWAPIndicator, _b as AnchoredVWAPTool, yk as Animator, SS as ArcTool, ur as AreaRenderer, Vl as AroonIndicator, Ix as ArrowMarkTool, sb as ArrowTool, ud as AverageDayRangeIndicator, vd as AveragePriceIndicator, Al as AwesomeOscillatorIndicator, Yp as AxisDragHandler, lu as BalanceOfPowerIndicator, Xx as BalloonTool, Cn as BarCountdown, dr as BarRenderer, rC as BarsPatternTool, Sk as BaseFinanceChart, mr as BaselineRenderer, _E as BinanceAdapter, Zu as BollingerBandWidthIndicator, Yc as BollingerBandsIndicator, Xu as BollingerPercentBIndicator, fw as BracketTool, hS as BrushTool, jE as BybitAdapter, of as CANDLE_PATTERNS, zl as CCIIndicator, Wl as CMFIndicator, Sn as COUNTDOWN_HEIGHT, lh as CROSSHAIR_CURSORS, Dx as CalloutTool, bn as CandlestickRenderer, Bt as CanvasLayer, jl as ChaikinOscillatorIndicator, _u as ChaikinVolatilityIndicator, qu as ChandeKrollStopIndicator, du as ChandeMomentumIndicator, bl as ChandelierExitIndicator, oD as ChartLegend, QO as ChartMarkManager, SO as ChartStateManager, If as ChopZoneIndicator, ql as ChoppinessIndexIndicator, dx as CircleTool, TE as CoinbaseAdapter, eo as CompareRenderer, pc as CompareSymbolIndicator, mc as CompareSymbolPaneIndicator, Zl as ConnorsRSIIndicator, $l as CoppockIndicator, yc as CorrelationCoefficientIndicator, bc as CorrelationLogIndicator, Ub as CrossLineTool, $m as CrosshairHandler, Dh as CrosshairTooltip, rT as CurrentPriceLine, xS as CurveTool, yx as CyclicLinesTool, ux as CypherPatternTool, aD as DEFAULT_LEGEND_CONFIG, Pt as DEFAULT_MAX_PIXEL_RATIO, ee as DEFAULT_MAX_WEBGL_CHARTS, DD as DEFAULT_SESSION_HOURS, Iu as DEMAIndicator, te as DENSE_BAR_WIDTH, Tp as DOUBLE_TAP_MS, Ep as DOUBLE_TAP_PX, Rt as DPRManager, jO as DataExporter, hx as DateAndPriceRangeTool, Xy as DateRangeTool, li as DepthHeatmapBuffer, ui as DepthHeatmapRenderer, Gw as DepthOverlay, Kw as DepthOverlayLayer, cu as DetrendedPriceOscillatorIndicator, zv as DisjointChannelTool, Du as DisparityIndexIndicator, cl as DonchianChannelIndicator, X as DrawingBase, s_ as DrawingManager, h_ as DrawingRenderer, Jc as EMAIndicator, mu as EaseOfMovementIndicator, vk as Easing, ru as ElderRayIndicator, Vy as ElliottCorrectionTool, Uy as ElliottDoubleComboTool, By as ElliottImpulseTool, Hy as ElliottTriangleTool, Wy as ElliottTripleComboTool, zy as ElliottWaveTool, oy as EllipseTool, Zw as Emitter, Tl as EnvelopeIndicator, xr as EquivolumeRenderer, zh as EventBus, kv as ExtendedLineTool, BS as FibArcsTool, Zb as FibChannelTool, zS as FibCirclesTool, ry as FibExtensionTool, ty as FibRetracementTool, ix as FibSpeedResistanceFanTool, US as FibSpiralTool, Ab as FibTimeZonesTool, VS as FibWedgeTool, Ck as FinanceCrosshair, su as FisherTransformIndicator, Nx as FlagTool, Bv as FlatTopBottomTool, Xl as ForceIndexIndicator, tC as ForecastTool, eA as GROUP_HEADER, hb as GannBoxTool, ub as GannFanTool, WS as GannSquareTool, C as GridRenderer, hd as GuppyMMAIndicator, Cr as HLCAreaRenderer, Cf as HammingMAIndicator, cx as HeadAndShouldersTool, Or as HiLoRenderer, gS as HighlighterTool, $u as HistoricalVolatilityIndicator, fr as HollowCandleRenderer, wv as HorizontalLineTool, Tv as HorizontalRayTool, hl as HullMAIndicator, Lx as ICON_GLYPHS, Kf as INDICATOR_CATEGORIES, Lc as INDICATOR_WORKER_MIN_BARS, Rs as INTERVAL_LIMITS, Ls as INTERVAL_UNITS, il as IchimokuIndicator, zx as IconTool, R as IndicatorBase, Kc as IndicatorEngine, z as IndicatorValueMap, ip as IndicatorWorkerClient, tp as IndicatorWorkerHost, op as IndicatorWorkerPool, Gb as InfoLineTool, Ip as InteractionManager, zu as KAMAIndicator, cT as KEPT_BUCKETS, eu as KSTIndicator, gr as KagiRenderer, sl as KeltnerChannelIndicator, gh as KeyboardHandler, ou as KlingerIndicator, RE as KrakenAdapter, Bu as LSMAIndicator, Vt as LayerManager, lr as LineRenderer, Tr as LineWithMarkersRenderer, ml as LinearRegressionChannelIndicator, cd as LinearRegressionSlopeIndicator, Nl as MACDIndicator, yf as MAChannelIndicator, Wu as MACrossIndicator, Df as MADoubleIndicator, LO as MARK_BADGE_SIZE, VO as MARK_ROW_HEIGHT, gd as MARibbonIndicator, Of as MATripleIndicator, FD as MAX_ALERT_BARS, oT as MAX_BASE_RATIO, aT as MAX_BASE_REQUESTS, Bl as MFIIndicator, ID as MIN_ALERT_BARS, Kn as MIN_BAR_UNIT, qn as MIN_BAR_UNIT_LIMIT, vl as MTFMovingAverageIndicator, Nf as MajorityRuleIndicator, rD as ManualFeed, Jr as MarketProfileRenderer, uu as MassIndexIndicator, Vu as McGinleyDynamicIndicator, sk as MeasureOverlay, Zy as MeasureTool, yd as MedianPriceIndicator, vE as MockAdapter, py as ModifiedSchiffPitchforkTool, Qu as MomentumIndicator, dd as NetVolumeIndicator, Ex as NoteTool, Ll as OBVIndicator, vw as OrderDraftTool, GC as OrderRenderer, zp as PRICE_AXIS_ADD_STRIP, Xn as PRICE_SCALE_MARGIN, qp as PanHandler, Zp as PaneResizeHandler, Jw as PaperExecutionAdapter, al as ParabolicSARIndicator, Mv as ParallelChannelTool, _S as PathTool, Su as PercentagePriceOscillatorIndicator, $r as PeriodLevelsRenderer, Fh as PinnedTooltip, HS as PitchfanTool, dy as PitchforkTool, ai as PivotMarkersRenderer, ul as PivotPointsIndicator, yr as PointAndFigureRenderer, xE as PollingAdapter, vS as PolylineTool, rw as PositionRenderer, ku as PrettyGoodOscillatorIndicator, on as PriceAxis, Bp as PriceAxisAddButton, sS as PriceLabelTool, jD as PriceLines, zf as PriceOscillatorIndicator, qy as PriceRangeTool, hu as PriceVolumeTrendIndicator, nC as ProjectionTool, Ou as QstickIndicator, er as RANGE_PRESETS, Hl as ROCIndicator, Ml as RSIIndicator, Ov as RayTool, tT as ReconnectManager, ay as RectangleTool, Lv as RegressionChannelTool, Eu as RelativeMomentumIndexIndicator, vu as RelativeVigorIndicator, od as RelativeVolatilityIndexIndicator, Hn as RenderEngine, Ht as RenderLoop, hr as RenkoRenderer, QT as ReplayController, $D as ReplayManager, yT as ResamplingAdapter, so as ReshapeMemo, Hb as RiskRewardTool, Vv as RotatedRectangleTool, gk as SELECTION_BOX_MIN_SIZE, qc as SMAIndicator, Rf as SMIErgodicIndicator, Lu as SMMAIndicator, tO as SNAPSHOT_VERSION, dc as SYMBOL_INDICATOR_IDS, sT as SYMBOL_ZONE_WAIT_MS, iu as SchaffTrendCycleIndicator, fy as SchiffPitchforkTool, hD as Screenshot, _k as SelectionBoxOverlay, bD as SessionBreaks, OD as SessionShading, yl as SessionVWAPIndicator, IO as SignalMarkerManager, Yx as SignpostTool, YS as SineLineTool, hc as SpreadIndicator, fd as StandardErrorBandsIndicator, ld as StandardErrorIndicator, Au as StdDevIndicator, wr as StepLineRenderer, Pl as StochasticIndicator, ad as StochasticMomentumIndexIndicator, yu as StochasticRSIIndicator, ZT as StreamManager, ol as SupertrendIndicator, fi as SymbolSeriesStore, kl as TEMAIndicator, wp as TOUCH_REACH, fu as TRIXIndicator, Ul as TSIIndicator, Dp as TapTracker, ab as TextAnnotationTool, lx as ThreeDrivesTool, eT as TickAggregator, wT as TickBarAdapter, CT as TickBarBuilder, bp as TimeAxis, JS as TimeCyclesTool, rk as TradeZoneManager, ow as TradingContextMenu, aw as TradingDragHandler, Pw as TradingManager, Fw as TradingRenderer, uv as TrendAngleTool, Cv as TrendLineTool, sd as TrendStrengthIndexIndicator, sy as TriangleTool, bd as TypicalPriceIndicator, UE as UPBIT_MAX_CANDLES, nd as UlcerIndexIndicator, Jl as UltimateOscillatorIndicator, CO as UndoRedoManager, JE as UpbitAdapter, kr as VOLUME_HEIGHT_RATIO, Fu as VROCIndicator, tl as VWAPIndicator, Cl as VWMAIndicator, Dv as VerticalLineTool, Qn as Viewport, kf as VolatilityIndexIndicator, Hf as VolatilityOHLCIndicator, Uf as VolatilityZeroTrendIndicator, br as VolumeCandleRenderer, Gl as VolumeDeltaIndicator, ed as VolumeOscillatorIndicator, Nu as VolumeProfileIndicator, Eb as VolumeProfileRangeTool, Nr as VolumeProfileRenderer, Ar as VolumeRenderer, Kl as VortexIndicator, wl as WMAIndicator, gD as Watermark, bE as WebSocketAdapter, gu as WilliamsADIndicator, Ku as WilliamsFractalsIndicator, Rl as WilliamsRIndicator, ox as XABCDPatternTool, pl as ZigZagIndicator, Jp as ZoomHandler, LT as adapterFromFeed, wn as alignAxisTags, Fs as alignOutput, bS as arcPoints, Kr as assignSessionLetters, J as axisFormat, vo as axisTimes, t as barIndexToTime, O as barIndexToX, d as barTimeStep, r as barTimeStepMs, xc as barsToColumns, cw as bracketRiskReward, Sm as canvasMeasure, Ft as cappedPixelRatio, S as claimGpuContext, ti as classifyPivots, Hs as cleanIntervals, Sc as columnsToBars, Mc as columnsToOutput, pj as computeBarLayout, sw as computeBracketDefaults, pM as computeCalendarLayout, RM as computeCounterClockLayout, jk as computeDepthLayout, Tj as computeDonutLayout, Gk as computeEquityLayout, Yj as computeHistogramLayout, Wr as computeMarketProfile, TM as computeMatrixLayout, Qr as computePeriodLevels, Ij as computeScatterLayout, qr as computeSessionProfiles, xA as computeWaterfallLayout, xM as correlationMatrix, LM as counterClockPhase, FM as counterClockPoints, np as createIndicatorWorker, yS as curvePoints, sM as dayToIso, ym as defaultFormat, Uw as depthBars, $f as describeInputs, uf as detectCandlePatterns, gn as drawAxisValueLabels, wC as drawIcon, Zg as drawingAxisSpan, ts as drawnKeys, zT as feedFromAdapter, ln as fillTag, xk as financeTheme, g_ as findDominantSwing, ni as findPivots, h as forEachPixelColumn, eC as forecastOutcome, wh as formatTooltipTime, W as getIntParam, U as getNumberParam, $n as getVisibleData, T as gpuContextsLeft, us as hasHistogram, DT as hasTrades, Wj as histogramBins, mj as hitBar, hj as hitCategory, mM as hitDay, Xj as hitHistogramBar, EM as hitMatrixCell, Ej as hitSlice, SA as hitWaterfallBar, hh as idleCssCursor, Jf as indicatorCategory, un as indicatorValuePrecision, sp as indicatorWorkerPool, hw as inferOrderType, Ms as inputSource, uh as isCrosshairCursor, NT as isDataFeed, g as isDense, TD as isInWindow, RD as isPriceLevelAlert, ED as isRegularSession, Ws as isSeriesPalette, ns as isUpTone, ep as isWorkerResponse, pn as labelTextColor, hn as layoutAxisValueLabels, tA as layoutGroupedTreemap, Cm as layoutLegend, Qk as layoutSquarifiedTreemap, Jk as layoutUniformGrid, Ps as lineSourceBars, sg as lineSpace, Wn as loadWebGL, Gn as loadWebGLRenderer, or as lttbDownsample, cr as lttbVisibleIndices, CD as mergeSessionHours, wD as minuteOfDay, BM as nearestCounterClockPoint, Lj as nearestPoint, um as niceScale, hm as numberFormat, Dc as outputToColumns, cs as paneLogRange, ss as paneValueRange, oM as parseDay, n as pastTimeStep, gm as percentFormat, os as plotColor, as as plotLook, rs as plotShown, ko as pointAndFigureColumns, c as priceBucketRow, Ut as priceScaleText, Ns as priceSourceBars, x as priceToY, e as priceToYMapper, ar as rangePresetStart, KD as readAlertOptions, Jm as readableText, iC as registerBuiltInDrawingTools, Gf as registerBuiltInIndicators, _n as renderAxisValueLabels, gj as renderBarChart, hM as renderCalendar, VM as renderCounterClock, w as renderDenseBars, Pk as renderDepthChart, Dj as renderDonut, qk as renderEquityCurve, oj as renderGauge, dA as renderHeatmap, Zj as renderHistogram, DM as renderMatrix, ds as renderPlots, Rj as renderScatter, wk as renderSparkline, EA as renderWaterfall, b as resolveBarIndex, Wm as resolveColorScale, Gm as scaleColor, hT as servesTimeframe, y as setMaxWebGLCharts, zM as shownCount, Vs as shownOnInterval, js as sourceParam, fn as spreadLabels, PT as streamAdapterOf, o as timeToX, s as timestampToBarIndex, to as toHeikinAshi, To as toKagi, wo as toLineBreak, Oo as toPointAndFigure, Jo as toRangeBars, yo as toRenko, Gr as tpoLetter, Fy as waveLabel, p as whenGpuContextFree, pT as withResampling, ET as withTickBars, l as xToBarIndex, i as xToTime, a as yToPrice };
|
|
29031
29059
|
|
|
29032
29060
|
//# sourceMappingURL=index.js.map
|