@tradecanvas/chart 2.0.0-beta.4 → 2.0.0-beta.5
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/README.md +1 -0
- package/dist/{LayoutSession-B-rE954l.js → LayoutSession-DlRfUBgK.js} +2 -2
- package/dist/{LayoutSession-B-rE954l.js.map → LayoutSession-DlRfUBgK.js.map} +1 -1
- package/dist/{LayoutSession-D7EpWpv3.cjs → LayoutSession-Dv9lhmSU.cjs} +2 -2
- package/dist/{LayoutSession-D7EpWpv3.cjs.map → LayoutSession-Dv9lhmSU.cjs.map} +1 -1
- package/dist/finance/DepthChart.d.ts +2 -0
- package/dist/finance/DepthChart.d.ts.map +1 -1
- package/dist/finance/EquityCurveChart.d.ts +2 -0
- package/dist/finance/EquityCurveChart.d.ts.map +1 -1
- package/dist/finance/GaugeChart.d.ts +2 -0
- package/dist/finance/GaugeChart.d.ts.map +1 -1
- package/dist/finance/PerformanceDashboard.d.ts +8 -2
- package/dist/finance/PerformanceDashboard.d.ts.map +1 -1
- package/dist/finance/SparklineChart.d.ts +2 -0
- package/dist/finance/SparklineChart.d.ts.map +1 -1
- package/dist/finance/WaterfallChart.d.ts +2 -0
- package/dist/finance/WaterfallChart.d.ts.map +1 -1
- package/dist/finance/index.d.ts +2 -2
- package/dist/finance/index.d.ts.map +1 -1
- package/dist/finance/performanceData.d.ts +19 -2
- package/dist/finance/performanceData.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +246 -182
- package/dist/index.js.map +1 -1
- package/dist/widget/index.cjs +1 -1
- package/dist/widget/index.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, a as l, b as u, c as
|
|
2
|
-
import { CHART_SPACING as
|
|
3
|
-
import { AlertManager as
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, a as l, b as u, c as d, d as f, f as p, g as ee, h as m, i as te, j as ne, k as re, l as h, m as ie, n as ae, p as oe, r as se, s as g, t as ce, w as le, x as ue, y as de } from "./LayoutSession-DlRfUBgK.js";
|
|
2
|
+
import { CHART_SPACING as fe, CHART_STYLE_KEYS as pe, DARK_PRICE_LIMITS as me, DARK_TERMINAL as he, DARK_THEME as ge, DEFAULT_DRAWING_STYLE as _e, DEFAULT_FONT_FAMILY as ve, DEFAULT_RECONNECT as ye, DEFAULT_SIGNAL_STYLE as be, DEFAULT_STREAM_CONFIG as xe, DEFAULT_TIMEFRAME_FAVORITES as Se, DEFAULT_TRADE_ZONE_STYLE as Ce, DEFAULT_TRADING_CONFIG as we, HNX_SESSIONS as Te, HOSE_SESSIONS as Ee, KRX_SESSIONS as De, KR_COLORS as Oe, LIGHT_PRICE_LIMITS as ke, LIGHT_THEME as Ae, MARKET_CRYPTO as je, MARKET_HNX as Me, MARKET_HOSE as Ne, MARKET_HOSE_ETF as Pe, MARKET_KRX as Fe, MARKET_NXT as Ie, MARKET_NYSE as Le, MARKET_UPBIT_KRW as Re, MARKET_UPCOM as ze, MARKET_VN30F as Be, MS_TIME_THRESHOLD as Ve, NXT_SESSIONS as He, PRICE_SOURCES as Ue, SANS_FONT_FAMILY as We, TC_PALETTE as Ge, TC_SERIES_COLORS as Ke, TIMEFRAMES_CRYPTO as qe, TIMEFRAMES_FOREX as Je, TIMEFRAMES_STOCK as Ye, UPCOM_SESSIONS as Xe, VN30F_SESSIONS as Ze, VN_COLORS as Qe, VOLUME_ALPHA as $e, barTimeUnit as et, barsAreDaily as tt, computePriceLimits as nt, contrastRatio as rt, createMarketTheme as it, createVNTheme as at, formatFraction as ot, formatNumber as st, formatVND as ct, formatVolumeLoc as lt, fractionTick as ut, getCurrentSession as dt, getLocale as ft, indicatorSource as pt, inkOn as mt, isPriceSource as ht, isTimeFrame as gt, isValidTimeZone as _t, marketStatus as vt, normalizeBar as yt, normalizeBarTime as bt, offsetAt as xt, parseIndicatorSource as St, parseTimeframe as Ct, pickBaseTimeframe as wt, priceFormatterFor as Tt, priceStepAt as Et, rankSymbols as Dt, readNews as Ot, readQuote as kt, readableOn as At, registerLocale as jt, resampleBars as Mt, roundToPriceStep as Nt, scaleMarketPrices as Pt, setLocale as Ft, sourcePrice as It, stepDecimals as Lt, symbolTimeZone as Rt, t as zt, tickBarCount as Bt, tickerOf as Vt, timeframeBucketStart as Ht, timeframeBucketStart as Ut, timeframeToMs as Wt, usesKoreanUnits as Gt, vn30fContracts as Kt, vn30fLastTradingDay as qt, volumeColor as Jt, wallToUtc as Yt, zoneOffsetMinutes as Xt } from "@tradecanvas/commons";
|
|
3
|
+
import { AlertManager as Zt, Animator as Qt, BarCountdown as $t, BaseFinanceChart as _, BinanceAdapter as en, BybitAdapter as tn, CANDLE_PATTERNS as nn, ChartLegend as rn, ChartStateManager as an, CoinbaseAdapter as on, CompareRenderer as sn, CrosshairTooltip as cn, CurrentPriceLine as ln, DEFAULT_LEGEND_CONFIG as un, DEFAULT_MAX_WEBGL_CHARTS as dn, DEFAULT_SESSION_HOURS as fn, DataExporter as pn, DrawingBase as mn, Easing as hn, FinanceCrosshair as v, GROUP_HEADER as gn, INDICATOR_CATEGORIES as _n, IndicatorBase as vn, IndicatorValueMap as yn, KEPT_BUCKETS as bn, KeyboardHandler as xn, KrakenAdapter as Sn, MAX_ALERT_BARS as Cn, MIN_ALERT_BARS as wn, ManualFeed as Tn, MockAdapter as En, PaperExecutionAdapter as Dn, PollingAdapter as On, RANGE_PRESETS as kn, ReconnectManager as An, ReplayController as jn, ReplayManager as Mn, ResamplingAdapter as Nn, ReshapeMemo as Pn, Screenshot as Fn, SessionBreaks as In, SessionShading as Ln, SignalMarkerManager as Rn, StreamManager as zn, TickAggregator as Bn, TickBarAdapter as Vn, TickBarBuilder as Hn, TradeZoneManager as Un, UndoRedoManager as Wn, UpbitAdapter as Gn, VolumeRenderer as Kn, Watermark as qn, WebSocketAdapter as Jn, adapterFromFeed as Yn, axisTimes as Xn, barIndexToTime as Zn, barIndexToX as Qn, barIndexToX as y, canvasMeasure as $n, computeBarLayout as er, computeCalendarLayout as tr, computeCounterClockLayout as nr, computeDonutLayout as rr, computeHistogramLayout as ir, computeMatrixLayout as ar, computeScatterLayout as or, correlationMatrix as sr, counterClockPhase as cr, counterClockPhase as lr, counterClockPoints as ur, counterClockPoints as dr, describeInputs as fr, detectCandlePatterns as pr, feedFromAdapter as mr, financeTheme as b, formatTooltipTime as hr, histogramBins as gr, hitBar as x, hitDay as S, hitMatrixCell as C, hitSlice as w, indicatorCategory as _r, isDataFeed as vr, isDataFeed as yr, isPriceLevelAlert as br, layoutGroupedTreemap as xr, layoutSquarifiedTreemap as Sr, layoutUniformGrid as Cr, lttbDownsample as wr, lttbVisibleIndices as Tr, nearestCounterClockPoint as T, nearestPoint as E, niceScale as Er, priceToY as Dr, priceToYMapper as Or, priceToYMapper as kr, rangePresetStart as Ar, renderBarChart as jr, renderCalendar as Mr, renderCounterClock as Nr, renderDepthChart as Pr, renderDonut as Fr, renderEquityCurve as Ir, renderGauge as Lr, renderHeatmap as Rr, renderHistogram as zr, renderMatrix as Br, renderScatter as Vr, renderSparkline as Hr, renderWaterfall as Ur, servesTimeframe as Wr, setMaxWebGLCharts as Gr, shownCount as Kr, timeToX as qr, timestampToBarIndex as Jr, timestampToBarIndex as Yr, toHeikinAshi as Xr, toKagi as Zr, toLineBreak as Qr, toPointAndFigure as $r, toRangeBars as ei, toRenko as ti, withResampling as ni, withTickBars as ri, xToBarIndex as ii, xToBarIndex as D, xToTime as ai, yToPrice as oi, yToPrice as si } from "@tradecanvas/core";
|
|
4
4
|
//#region src/frameworks/syncIndicators.ts
|
|
5
|
-
function
|
|
5
|
+
function ci(e) {
|
|
6
6
|
let { id: t, params: n = {}, position: r = null } = typeof e == "string" ? { id: e } : e;
|
|
7
7
|
return JSON.stringify([
|
|
8
8
|
t,
|
|
@@ -10,9 +10,9 @@ function li(e) {
|
|
|
10
10
|
r
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function li(e, t, n) {
|
|
14
14
|
let r = /* @__PURE__ */ new Map(), i = t.map((e) => {
|
|
15
|
-
let t =
|
|
15
|
+
let t = ci(e), n = r.get(t) ?? 0;
|
|
16
16
|
return r.set(t, n + 1), {
|
|
17
17
|
spec: e,
|
|
18
18
|
key: `${t}#${n}`
|
|
@@ -27,7 +27,7 @@ function ui(e, t, n) {
|
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/frameworks/feedBars.ts
|
|
30
|
-
var
|
|
30
|
+
var ui = 3, O = (e) => ({
|
|
31
31
|
time: e.time,
|
|
32
32
|
open: e.open,
|
|
33
33
|
high: e.high,
|
|
@@ -35,16 +35,16 @@ var di = 3, O = (e) => ({
|
|
|
35
35
|
close: e.close,
|
|
36
36
|
volume: e.volume
|
|
37
37
|
}), k = (e) => e.length > 0 ? e[e.length - 1] : null;
|
|
38
|
-
function
|
|
38
|
+
function di(e, t, n) {
|
|
39
39
|
for (let r = 0; r < n; r++) if (!a(e[r], t[r])) return !1;
|
|
40
40
|
return !0;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function fi(e, t) {
|
|
43
43
|
if (e.isReplayActive()) return !0;
|
|
44
44
|
let n = k(e.getData());
|
|
45
45
|
return t.inReplay ? n?.time === t.last?.time : n === t.shownBar ? n?.time === t.last?.time || !e.isExtendedHoursVisible() : !1;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function pi(e, t, n) {
|
|
48
48
|
let r = [];
|
|
49
49
|
for (let o = 0; o < t.length; o++) {
|
|
50
50
|
let s = e[n + o];
|
|
@@ -55,16 +55,16 @@ function mi(e, t, n) {
|
|
|
55
55
|
}
|
|
56
56
|
return r;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function mi(e, t) {
|
|
59
59
|
if (t.length === 0) return !0;
|
|
60
60
|
if (!e.updateBar) return !1;
|
|
61
61
|
for (let n of t) if (!e.updateBar(n)) return !1;
|
|
62
62
|
return !0;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function hi(e) {
|
|
65
65
|
return e.slice(Math.max(1, e.length - 1 - 3), -1).map(O);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function gi(e, t) {
|
|
68
68
|
let n = [];
|
|
69
69
|
for (let r = t; r < e.length; r++) {
|
|
70
70
|
if (!i(e[r]) || !(e[r].time > e[r - 1].time)) return null;
|
|
@@ -72,38 +72,38 @@ function _i(e, t) {
|
|
|
72
72
|
}
|
|
73
73
|
return n;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function _i(e, t, n) {
|
|
76
76
|
let r = n.length;
|
|
77
|
-
if (r === 0 || !n.last || !i(n.last) || t.length < r || !
|
|
77
|
+
if (r === 0 || !n.last || !i(n.last) || t.length < r || !fi(e, n)) return !1;
|
|
78
78
|
let o = n.recent ?? [], s = r - 1 - o.length;
|
|
79
|
-
if (t !== n.source && (n.source.length !== r || !
|
|
79
|
+
if (t !== n.source && (n.source.length !== r || !di(n.source, t, s))) return !1;
|
|
80
80
|
let c = t[r - 1];
|
|
81
81
|
if (c.time !== n.last.time || !i(c)) return !1;
|
|
82
|
-
let l =
|
|
83
|
-
return !l || !u || !
|
|
82
|
+
let l = pi(t, o, s), u = gi(t, r);
|
|
83
|
+
return !l || !u || !mi(e, l) ? !1 : (a(c, n.last) || e.updateLastBar(O(c)), u.length === 1 ? e.appendBar(u[0]) : u.length > 1 && e.appendBars(u), !0);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
(!n || !
|
|
85
|
+
function vi(e, t, n) {
|
|
86
|
+
(!n || !_i(e, t, n)) && e.setData(t.map(O));
|
|
87
87
|
let r = t.length > 0 ? O(t[t.length - 1]) : null, i = e.isReplayActive();
|
|
88
88
|
return {
|
|
89
89
|
source: t,
|
|
90
90
|
length: t.length,
|
|
91
91
|
last: r,
|
|
92
|
-
recent:
|
|
92
|
+
recent: hi(t),
|
|
93
93
|
shownBar: i ? null : k(e.getData()),
|
|
94
94
|
inReplay: i
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/brand/poweredBy.ts
|
|
99
|
-
var A = "https://tradecanvas.dev", j = "Powered by TradeCanvas", M = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M186 70A82 82 0 1 0 186 186\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"22\" stroke-linecap=\"round\"/><rect x=\"92\" y=\"74\" width=\"72\" height=\"20\" rx=\"10\" fill=\"currentColor\"/><path fill=\"#E8961E\" d=\"M119 94H137V108H144a10 10 0 0 1 10 10V164a10 10 0 0 1-10 10H137V190H119V174H112a10 10 0 0 1-10-10V118a10 10 0 0 1 10-10H119Z\"/></svg>", N = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 16 686 88\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" transform=\"translate(0 101.64)\" d=\"M27.24 0.00L27.24 -69.72L1.32 -69.72L1.32 -83.64L68.76 -83.64L68.76 -69.72L42.96 -69.72L42.96 0.00ZM70.90 0.00L70.90 -59.16L85.90 -59.16L85.90 -50.64Q86.26 -51.36 86.74 -51.96Q89.50 -55.92 93.52 -58.14Q97.54 -60.36 101.74 -60.36Q104.74 -60.36 107.44 -59.58Q110.14 -58.80 113.02 -57.00L105.82 -43.56Q104.50 -44.28 102.46 -44.88Q100.42 -45.48 98.38 -45.48Q95.98 -45.48 93.76 -44.64Q91.54 -43.80 89.80 -42.00Q88.06 -40.20 86.98 -37.20Q86.50 -35.52 86.20 -32.94Q85.90 -30.36 85.90 -25.44L85.90 0.00ZM156.44 0.00L155.36 -7.56Q155.00 -6.96 154.52 -6.36Q151.28 -2.40 147.20 -0.60Q143.12 1.20 138.56 1.20Q132.08 1.20 126.98 -1.20Q121.88 -3.60 118.94 -8.04Q116.00 -12.48 116.00 -18.24Q116.00 -23.40 118.10 -27.06Q120.20 -30.72 123.68 -32.64Q126.68 -34.44 130.34 -35.16Q134.00 -35.88 138.20 -35.88L155.24 -35.88L155.24 -37.32Q155.24 -42.60 151.94 -45.18Q148.64 -47.76 143.00 -47.76Q138.32 -47.76 133.46 -45.90Q128.60 -44.04 124.88 -40.68L117.32 -50.88Q123.56 -55.92 130.10 -58.14Q136.64 -60.36 144.20 -60.36Q156.44 -60.36 163.28 -54.24Q170.12 -48.12 170.12 -37.32L170.12 0.00ZM155.24 -24.84L140.36 -24.84Q138.44 -24.84 136.58 -24.54Q134.72 -24.24 133.40 -23.16Q132.20 -22.32 131.60 -21.06Q131.00 -19.80 131.00 -18.24Q131.00 -14.88 133.64 -12.84Q136.28 -10.80 140.72 -10.80Q144.68 -10.80 147.98 -12.54Q151.28 -14.28 153.26 -17.34Q155.24 -20.40 155.24 -24.36ZM202.98 1.20Q195.18 1.20 189.54 -2.82Q183.90 -6.84 180.84 -13.86Q177.78 -20.88 177.78 -29.64Q177.78 -39.36 181.20 -46.20Q184.62 -53.04 190.38 -56.70Q196.14 -60.36 202.98 -60.36Q207.78 -60.36 211.92 -58.38Q216.06 -56.40 219.06 -52.44Q219.54 -51.72 220.02 -51.00L220.02 -83.64L234.78 -83.64L234.78 0.00L220.02 0.00L220.02 -8.04Q219.54 -7.20 218.94 -6.48Q215.70 -2.28 211.56 -0.54Q207.42 1.20 202.98 1.20ZM207.06 -12.48Q211.50 -12.48 214.68 -14.64Q217.86 -16.80 219.60 -20.64Q221.34 -24.48 221.34 -29.64Q221.34 -34.80 219.60 -38.64Q217.86 -42.48 214.68 -44.58Q211.50 -46.68 207.06 -46.68Q202.74 -46.68 199.50 -44.58Q196.26 -42.48 194.52 -38.70Q192.78 -34.92 192.78 -29.64Q192.78 -24.36 194.52 -20.52Q196.26 -16.68 199.50 -14.58Q202.74 -12.48 207.06 -12.48ZM272.32 1.20Q264.64 1.20 259.12 -1.32Q253.60 -3.84 250.06 -8.10Q246.52 -12.36 244.84 -17.82Q243.16 -23.28 243.16 -29.28Q243.16 -35.04 244.84 -40.56Q246.52 -46.08 249.88 -50.52Q253.24 -54.96 258.58 -57.66Q263.92 -60.36 271.36 -60.36Q278.32 -60.36 283.48 -58.02Q288.64 -55.68 292.00 -51.54Q295.36 -47.40 297.10 -41.88Q298.84 -36.36 298.84 -30.12Q298.84 -29.28 298.78 -27.78Q298.72 -26.28 298.48 -24.60L258.04 -24.60Q258.64 -18.24 262.78 -15.00Q266.92 -11.76 273.16 -11.76Q277.72 -11.76 282.04 -13.38Q286.36 -15.00 289.72 -18.00L297.16 -7.92Q292.96 -4.68 289.24 -2.64Q285.52 -0.60 281.50 0.30Q277.48 1.20 272.32 1.20ZM284.68 -35.64Q284.68 -35.76 284.68 -35.76Q284.68 -38.28 283.72 -40.50Q282.76 -42.72 281.08 -44.40Q279.40 -46.08 277.06 -46.98Q274.72 -47.88 271.72 -47.88Q267.28 -47.88 264.28 -46.08Q261.28 -44.28 259.78 -41.46Q258.28 -38.64 257.92 -35.64ZM346.66 1.56Q335.02 1.56 326.20 -3.84Q317.38 -9.24 312.46 -19.08Q307.54 -28.92 307.54 -41.88Q307.54 -54.84 312.46 -64.62Q317.38 -74.40 326.20 -79.80Q335.02 -85.20 346.66 -85.20Q359.50 -85.20 368.92 -78.84Q378.34 -72.48 382.42 -61.20L371.02 -57.00Q368.02 -64.80 361.78 -69.18Q355.54 -73.56 346.66 -73.56Q338.50 -73.56 332.44 -69.66Q326.38 -65.76 323.08 -58.74Q319.78 -51.72 319.78 -41.88Q319.78 -32.04 323.08 -24.96Q326.38 -17.88 332.44 -13.98Q338.50 -10.08 346.66 -10.08Q355.54 -10.08 361.78 -14.46Q368.02 -18.84 371.02 -26.64L382.42 -22.56Q378.34 -11.40 368.92 -4.92Q359.50 1.56 346.66 1.56ZM429.04 0.00L428.32 -8.64Q428.20 -8.52 428.08 -8.40Q424.96 -3.72 420.34 -1.32Q415.72 1.08 409.96 1.08Q403.36 1.08 398.32 -1.32Q393.28 -3.72 390.52 -7.98Q387.76 -12.24 387.76 -17.88Q387.76 -22.80 389.80 -26.34Q391.84 -29.88 395.08 -31.80Q398.08 -33.72 401.98 -34.50Q405.88 -35.28 410.32 -35.28L428.08 -35.28L428.08 -37.20Q428.08 -43.44 424.48 -46.80Q420.88 -50.16 414.04 -50.16Q409.24 -50.16 404.86 -48.24Q400.48 -46.32 396.52 -42.00L389.20 -49.56Q394.48 -55.08 400.90 -57.66Q407.32 -60.24 414.88 -60.24Q426.76 -60.24 433.30 -54.18Q439.84 -48.12 439.84 -37.20L439.84 0.00ZM428.08 -26.40L412.00 -26.40Q409.60 -26.40 407.02 -25.98Q404.44 -25.56 402.64 -24.24Q401.20 -23.16 400.36 -21.54Q399.52 -19.92 399.52 -17.76Q399.52 -13.56 402.76 -11.04Q406.00 -8.52 411.40 -8.52Q415.96 -8.52 419.74 -10.62Q423.52 -12.72 425.80 -16.38Q428.08 -20.04 428.08 -24.72ZM451.94 0.00L451.94 -59.16L463.82 -59.16L463.82 -50.88Q464.78 -52.44 465.98 -53.76Q468.86 -56.88 472.88 -58.56Q476.90 -60.24 481.58 -60.24Q491.42 -60.24 497.00 -54.54Q502.58 -48.84 502.58 -37.92L502.58 0.00L490.82 0.00L490.82 -33.60Q490.82 -42.12 487.76 -46.08Q484.70 -50.04 478.34 -50.04Q473.54 -50.04 470.36 -47.88Q467.18 -45.72 465.50 -41.04Q463.82 -36.36 463.82 -29.16L463.82 0.00ZM533.28 0.00L509.04 -59.16L522.00 -59.16L538.08 -15.24L554.40 -59.16L567.12 -59.16L543.12 0.00ZM610.56 0.00L609.84 -8.64Q609.72 -8.52 609.60 -8.40Q606.48 -3.72 601.86 -1.32Q597.24 1.08 591.48 1.08Q584.88 1.08 579.84 -1.32Q574.80 -3.72 572.04 -7.98Q569.28 -12.24 569.28 -17.88Q569.28 -22.80 571.32 -26.34Q573.36 -29.88 576.60 -31.80Q579.60 -33.72 583.50 -34.50Q587.40 -35.28 591.84 -35.28L609.60 -35.28L609.60 -37.20Q609.60 -43.44 606.00 -46.80Q602.40 -50.16 595.56 -50.16Q590.76 -50.16 586.38 -48.24Q582.00 -46.32 578.04 -42.00L570.72 -49.56Q576.00 -55.08 582.42 -57.66Q588.84 -60.24 596.40 -60.24Q608.28 -60.24 614.82 -54.18Q621.36 -48.12 621.36 -37.20L621.36 0.00ZM609.60 -26.40L593.52 -26.40Q591.12 -26.40 588.54 -25.98Q585.96 -25.56 584.16 -24.24Q582.72 -23.16 581.88 -21.54Q581.04 -19.92 581.04 -17.76Q581.04 -13.56 584.28 -11.04Q587.52 -8.52 592.92 -8.52Q597.48 -8.52 601.26 -10.62Q605.04 -12.72 607.32 -16.38Q609.60 -20.04 609.60 -24.72ZM653.38 1.08Q647.14 1.08 642.34 -0.78Q637.54 -2.64 634.12 -5.58Q630.70 -8.52 628.66 -11.64L636.70 -18.60Q638.98 -14.52 643.24 -11.58Q647.50 -8.64 653.50 -8.64Q658.78 -8.64 661.84 -10.86Q664.90 -13.08 664.90 -16.68Q664.90 -19.56 662.98 -21.30Q661.06 -23.04 657.94 -24.18Q654.82 -25.32 651.10 -26.16Q647.74 -27.12 644.26 -28.32Q640.78 -29.52 637.96 -31.38Q635.14 -33.24 633.40 -36.18Q631.66 -39.12 631.66 -43.44Q631.66 -51.00 637.48 -55.62Q643.30 -60.24 652.90 -60.24Q659.74 -60.24 665.38 -57.42Q671.02 -54.60 674.14 -49.08L666.82 -43.44Q664.42 -47.40 660.64 -49.20Q656.86 -51.00 652.42 -51.00Q648.22 -51.00 645.40 -49.26Q642.58 -47.52 642.58 -44.52Q642.58 -42.36 643.84 -40.98Q645.10 -39.60 647.80 -38.58Q650.50 -37.56 654.46 -36.60Q658.18 -35.76 662.02 -34.56Q665.86 -33.36 669.10 -31.44Q672.34 -29.52 674.38 -26.28Q676.42 -23.04 676.42 -17.88Q676.42 -12.24 673.54 -7.98Q670.66 -3.72 665.50 -1.32Q660.34 1.08 653.38 1.08Z\"/></svg>",
|
|
99
|
+
var A = "https://tradecanvas.dev", j = "Powered by TradeCanvas", M = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M186 70A82 82 0 1 0 186 186\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"22\" stroke-linecap=\"round\"/><rect x=\"92\" y=\"74\" width=\"72\" height=\"20\" rx=\"10\" fill=\"currentColor\"/><path fill=\"#E8961E\" d=\"M119 94H137V108H144a10 10 0 0 1 10 10V164a10 10 0 0 1-10 10H137V190H119V174H112a10 10 0 0 1-10-10V118a10 10 0 0 1 10-10H119Z\"/></svg>", N = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 16 686 88\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" transform=\"translate(0 101.64)\" d=\"M27.24 0.00L27.24 -69.72L1.32 -69.72L1.32 -83.64L68.76 -83.64L68.76 -69.72L42.96 -69.72L42.96 0.00ZM70.90 0.00L70.90 -59.16L85.90 -59.16L85.90 -50.64Q86.26 -51.36 86.74 -51.96Q89.50 -55.92 93.52 -58.14Q97.54 -60.36 101.74 -60.36Q104.74 -60.36 107.44 -59.58Q110.14 -58.80 113.02 -57.00L105.82 -43.56Q104.50 -44.28 102.46 -44.88Q100.42 -45.48 98.38 -45.48Q95.98 -45.48 93.76 -44.64Q91.54 -43.80 89.80 -42.00Q88.06 -40.20 86.98 -37.20Q86.50 -35.52 86.20 -32.94Q85.90 -30.36 85.90 -25.44L85.90 0.00ZM156.44 0.00L155.36 -7.56Q155.00 -6.96 154.52 -6.36Q151.28 -2.40 147.20 -0.60Q143.12 1.20 138.56 1.20Q132.08 1.20 126.98 -1.20Q121.88 -3.60 118.94 -8.04Q116.00 -12.48 116.00 -18.24Q116.00 -23.40 118.10 -27.06Q120.20 -30.72 123.68 -32.64Q126.68 -34.44 130.34 -35.16Q134.00 -35.88 138.20 -35.88L155.24 -35.88L155.24 -37.32Q155.24 -42.60 151.94 -45.18Q148.64 -47.76 143.00 -47.76Q138.32 -47.76 133.46 -45.90Q128.60 -44.04 124.88 -40.68L117.32 -50.88Q123.56 -55.92 130.10 -58.14Q136.64 -60.36 144.20 -60.36Q156.44 -60.36 163.28 -54.24Q170.12 -48.12 170.12 -37.32L170.12 0.00ZM155.24 -24.84L140.36 -24.84Q138.44 -24.84 136.58 -24.54Q134.72 -24.24 133.40 -23.16Q132.20 -22.32 131.60 -21.06Q131.00 -19.80 131.00 -18.24Q131.00 -14.88 133.64 -12.84Q136.28 -10.80 140.72 -10.80Q144.68 -10.80 147.98 -12.54Q151.28 -14.28 153.26 -17.34Q155.24 -20.40 155.24 -24.36ZM202.98 1.20Q195.18 1.20 189.54 -2.82Q183.90 -6.84 180.84 -13.86Q177.78 -20.88 177.78 -29.64Q177.78 -39.36 181.20 -46.20Q184.62 -53.04 190.38 -56.70Q196.14 -60.36 202.98 -60.36Q207.78 -60.36 211.92 -58.38Q216.06 -56.40 219.06 -52.44Q219.54 -51.72 220.02 -51.00L220.02 -83.64L234.78 -83.64L234.78 0.00L220.02 0.00L220.02 -8.04Q219.54 -7.20 218.94 -6.48Q215.70 -2.28 211.56 -0.54Q207.42 1.20 202.98 1.20ZM207.06 -12.48Q211.50 -12.48 214.68 -14.64Q217.86 -16.80 219.60 -20.64Q221.34 -24.48 221.34 -29.64Q221.34 -34.80 219.60 -38.64Q217.86 -42.48 214.68 -44.58Q211.50 -46.68 207.06 -46.68Q202.74 -46.68 199.50 -44.58Q196.26 -42.48 194.52 -38.70Q192.78 -34.92 192.78 -29.64Q192.78 -24.36 194.52 -20.52Q196.26 -16.68 199.50 -14.58Q202.74 -12.48 207.06 -12.48ZM272.32 1.20Q264.64 1.20 259.12 -1.32Q253.60 -3.84 250.06 -8.10Q246.52 -12.36 244.84 -17.82Q243.16 -23.28 243.16 -29.28Q243.16 -35.04 244.84 -40.56Q246.52 -46.08 249.88 -50.52Q253.24 -54.96 258.58 -57.66Q263.92 -60.36 271.36 -60.36Q278.32 -60.36 283.48 -58.02Q288.64 -55.68 292.00 -51.54Q295.36 -47.40 297.10 -41.88Q298.84 -36.36 298.84 -30.12Q298.84 -29.28 298.78 -27.78Q298.72 -26.28 298.48 -24.60L258.04 -24.60Q258.64 -18.24 262.78 -15.00Q266.92 -11.76 273.16 -11.76Q277.72 -11.76 282.04 -13.38Q286.36 -15.00 289.72 -18.00L297.16 -7.92Q292.96 -4.68 289.24 -2.64Q285.52 -0.60 281.50 0.30Q277.48 1.20 272.32 1.20ZM284.68 -35.64Q284.68 -35.76 284.68 -35.76Q284.68 -38.28 283.72 -40.50Q282.76 -42.72 281.08 -44.40Q279.40 -46.08 277.06 -46.98Q274.72 -47.88 271.72 -47.88Q267.28 -47.88 264.28 -46.08Q261.28 -44.28 259.78 -41.46Q258.28 -38.64 257.92 -35.64ZM346.66 1.56Q335.02 1.56 326.20 -3.84Q317.38 -9.24 312.46 -19.08Q307.54 -28.92 307.54 -41.88Q307.54 -54.84 312.46 -64.62Q317.38 -74.40 326.20 -79.80Q335.02 -85.20 346.66 -85.20Q359.50 -85.20 368.92 -78.84Q378.34 -72.48 382.42 -61.20L371.02 -57.00Q368.02 -64.80 361.78 -69.18Q355.54 -73.56 346.66 -73.56Q338.50 -73.56 332.44 -69.66Q326.38 -65.76 323.08 -58.74Q319.78 -51.72 319.78 -41.88Q319.78 -32.04 323.08 -24.96Q326.38 -17.88 332.44 -13.98Q338.50 -10.08 346.66 -10.08Q355.54 -10.08 361.78 -14.46Q368.02 -18.84 371.02 -26.64L382.42 -22.56Q378.34 -11.40 368.92 -4.92Q359.50 1.56 346.66 1.56ZM429.04 0.00L428.32 -8.64Q428.20 -8.52 428.08 -8.40Q424.96 -3.72 420.34 -1.32Q415.72 1.08 409.96 1.08Q403.36 1.08 398.32 -1.32Q393.28 -3.72 390.52 -7.98Q387.76 -12.24 387.76 -17.88Q387.76 -22.80 389.80 -26.34Q391.84 -29.88 395.08 -31.80Q398.08 -33.72 401.98 -34.50Q405.88 -35.28 410.32 -35.28L428.08 -35.28L428.08 -37.20Q428.08 -43.44 424.48 -46.80Q420.88 -50.16 414.04 -50.16Q409.24 -50.16 404.86 -48.24Q400.48 -46.32 396.52 -42.00L389.20 -49.56Q394.48 -55.08 400.90 -57.66Q407.32 -60.24 414.88 -60.24Q426.76 -60.24 433.30 -54.18Q439.84 -48.12 439.84 -37.20L439.84 0.00ZM428.08 -26.40L412.00 -26.40Q409.60 -26.40 407.02 -25.98Q404.44 -25.56 402.64 -24.24Q401.20 -23.16 400.36 -21.54Q399.52 -19.92 399.52 -17.76Q399.52 -13.56 402.76 -11.04Q406.00 -8.52 411.40 -8.52Q415.96 -8.52 419.74 -10.62Q423.52 -12.72 425.80 -16.38Q428.08 -20.04 428.08 -24.72ZM451.94 0.00L451.94 -59.16L463.82 -59.16L463.82 -50.88Q464.78 -52.44 465.98 -53.76Q468.86 -56.88 472.88 -58.56Q476.90 -60.24 481.58 -60.24Q491.42 -60.24 497.00 -54.54Q502.58 -48.84 502.58 -37.92L502.58 0.00L490.82 0.00L490.82 -33.60Q490.82 -42.12 487.76 -46.08Q484.70 -50.04 478.34 -50.04Q473.54 -50.04 470.36 -47.88Q467.18 -45.72 465.50 -41.04Q463.82 -36.36 463.82 -29.16L463.82 0.00ZM533.28 0.00L509.04 -59.16L522.00 -59.16L538.08 -15.24L554.40 -59.16L567.12 -59.16L543.12 0.00ZM610.56 0.00L609.84 -8.64Q609.72 -8.52 609.60 -8.40Q606.48 -3.72 601.86 -1.32Q597.24 1.08 591.48 1.08Q584.88 1.08 579.84 -1.32Q574.80 -3.72 572.04 -7.98Q569.28 -12.24 569.28 -17.88Q569.28 -22.80 571.32 -26.34Q573.36 -29.88 576.60 -31.80Q579.60 -33.72 583.50 -34.50Q587.40 -35.28 591.84 -35.28L609.60 -35.28L609.60 -37.20Q609.60 -43.44 606.00 -46.80Q602.40 -50.16 595.56 -50.16Q590.76 -50.16 586.38 -48.24Q582.00 -46.32 578.04 -42.00L570.72 -49.56Q576.00 -55.08 582.42 -57.66Q588.84 -60.24 596.40 -60.24Q608.28 -60.24 614.82 -54.18Q621.36 -48.12 621.36 -37.20L621.36 0.00ZM609.60 -26.40L593.52 -26.40Q591.12 -26.40 588.54 -25.98Q585.96 -25.56 584.16 -24.24Q582.72 -23.16 581.88 -21.54Q581.04 -19.92 581.04 -17.76Q581.04 -13.56 584.28 -11.04Q587.52 -8.52 592.92 -8.52Q597.48 -8.52 601.26 -10.62Q605.04 -12.72 607.32 -16.38Q609.60 -20.04 609.60 -24.72ZM653.38 1.08Q647.14 1.08 642.34 -0.78Q637.54 -2.64 634.12 -5.58Q630.70 -8.52 628.66 -11.64L636.70 -18.60Q638.98 -14.52 643.24 -11.58Q647.50 -8.64 653.50 -8.64Q658.78 -8.64 661.84 -10.86Q664.90 -13.08 664.90 -16.68Q664.90 -19.56 662.98 -21.30Q661.06 -23.04 657.94 -24.18Q654.82 -25.32 651.10 -26.16Q647.74 -27.12 644.26 -28.32Q640.78 -29.52 637.96 -31.38Q635.14 -33.24 633.40 -36.18Q631.66 -39.12 631.66 -43.44Q631.66 -51.00 637.48 -55.62Q643.30 -60.24 652.90 -60.24Q659.74 -60.24 665.38 -57.42Q671.02 -54.60 674.14 -49.08L666.82 -43.44Q664.42 -47.40 660.64 -49.20Q656.86 -51.00 652.42 -51.00Q648.22 -51.00 645.40 -49.26Q642.58 -47.52 642.58 -44.52Q642.58 -42.36 643.84 -40.98Q645.10 -39.60 647.80 -38.58Q650.50 -37.56 654.46 -36.60Q658.18 -35.76 662.02 -34.56Q665.86 -33.36 669.10 -31.44Q672.34 -29.52 674.38 -26.28Q676.42 -23.04 676.42 -17.88Q676.42 -12.24 673.54 -7.98Q670.66 -3.72 665.50 -1.32Q660.34 1.08 653.38 1.08Z\"/></svg>", yi = 12, P = 16, bi = .58, xi = 10, Si = .56, Ci = 686 / 88, wi = 83.64 / 88, Ti = .25;
|
|
100
100
|
function F(e = P) {
|
|
101
|
-
let t = Number.isFinite(e) ? Math.max(
|
|
101
|
+
let t = Number.isFinite(e) ? Math.max(yi, e) : P, n = I(t * Si / wi);
|
|
102
102
|
return {
|
|
103
103
|
height: t,
|
|
104
|
-
fontSize: I(Math.max(
|
|
105
|
-
gap: I(t *
|
|
106
|
-
wordmarkWidth: I(n *
|
|
104
|
+
fontSize: I(Math.max(xi, t * bi)),
|
|
105
|
+
gap: I(t * Ti),
|
|
106
|
+
wordmarkWidth: I(n * Ci),
|
|
107
107
|
wordmarkHeight: n
|
|
108
108
|
};
|
|
109
109
|
}
|
|
@@ -126,24 +126,24 @@ function V(e = {}) {
|
|
|
126
126
|
let t = F(e.height), n = L(R(e.href)), r = e.target ?? "_blank";
|
|
127
127
|
return `<a class="tc-powered-by" href="${n}"${r ? ` target="${L(r)}"${z(r) ? " rel=\"noopener noreferrer\"" : ""}` : ""} aria-label="${j}" style="${`display:inline-flex;align-items:center;gap:${t.gap}px;height:${t.height}px;color:inherit;text-decoration:none;font-size:${t.fontSize}px;line-height:1;white-space:nowrap`}"><span aria-hidden="true">Powered by</span>` + B(M, t.height, t.height) + B(N, t.wordmarkWidth, t.wordmarkHeight) + "</a>";
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Ei(e = {}, t = document) {
|
|
130
130
|
let n = t.createElement("div");
|
|
131
131
|
return n.innerHTML = V(e), n.firstElementChild;
|
|
132
132
|
}
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region src/plugins/overlayScale.ts
|
|
135
|
-
function
|
|
136
|
-
let { viewport: t, data: n } = e, r =
|
|
135
|
+
function Di(e) {
|
|
136
|
+
let { viewport: t, data: n } = e, r = kr(t), i = n.length - 1, a = Math.max(0, Math.floor(t.visibleRange.from)), o = Math.min(i, Math.ceil(t.visibleRange.to)), s = (e) => n.length > 0 ? Yr(e, n) : e;
|
|
137
137
|
return {
|
|
138
|
-
timeToX: (e) =>
|
|
138
|
+
timeToX: (e) => y(s(e), t),
|
|
139
139
|
xToTime: (e) => {
|
|
140
140
|
let r = D(e, t);
|
|
141
|
-
return n.length > 0 ?
|
|
141
|
+
return n.length > 0 ? Zn(r, n) : r;
|
|
142
142
|
},
|
|
143
|
-
indexToX: (e) =>
|
|
143
|
+
indexToX: (e) => y(e, t),
|
|
144
144
|
xToIndex: (e) => D(e, t),
|
|
145
145
|
priceToY: r,
|
|
146
|
-
yToPrice: (e) =>
|
|
146
|
+
yToPrice: (e) => si(e, t),
|
|
147
147
|
barWidth: t.barWidth,
|
|
148
148
|
visible: o < a ? {
|
|
149
149
|
from: 0,
|
|
@@ -156,7 +156,7 @@ function Oi(e) {
|
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/grid/ChartGrid.ts
|
|
159
|
-
var
|
|
159
|
+
var Oi = class {
|
|
160
160
|
root;
|
|
161
161
|
cells = [];
|
|
162
162
|
layout;
|
|
@@ -164,25 +164,25 @@ var ki = class {
|
|
|
164
164
|
destroyed = !1;
|
|
165
165
|
syncing = !1;
|
|
166
166
|
constructor(e, t = {}) {
|
|
167
|
-
this.options = t, this.layout =
|
|
167
|
+
this.options = t, this.layout = f(t.layout) ? t.layout : "2x2", this.root = document.createElement("div"), this.root.style.cssText = "display:grid;width:100%;height:100%;overflow:hidden;", e.appendChild(this.root), this.applyLayout(), this.createCells();
|
|
168
168
|
}
|
|
169
169
|
applyLayout() {
|
|
170
|
-
let { cols: e, rows: t } =
|
|
170
|
+
let { cols: e, rows: t } = g[this.layout], n = this.options.gap ?? 1;
|
|
171
171
|
this.root.style.gridTemplateColumns = `repeat(${e}, minmax(0, 1fr))`, this.root.style.gridTemplateRows = `repeat(${t}, minmax(0, 1fr))`, this.root.style.gap = `${n}px`, this.placeCells();
|
|
172
172
|
}
|
|
173
173
|
placeCells() {
|
|
174
|
-
let e =
|
|
175
|
-
this.cells.forEach((t, n) =>
|
|
174
|
+
let e = d(g[this.layout]);
|
|
175
|
+
this.cells.forEach((t, n) => p(t.container, e[n]));
|
|
176
176
|
}
|
|
177
177
|
createCells() {
|
|
178
|
-
let e =
|
|
178
|
+
let e = h(g[this.layout]);
|
|
179
179
|
for (let t = 0; t < e; t++) this.cells.push(this.createCell(t));
|
|
180
180
|
this.placeCells();
|
|
181
181
|
}
|
|
182
182
|
createCell(e) {
|
|
183
183
|
let t = this.options.cells?.[e] ?? {}, n = document.createElement("div");
|
|
184
184
|
n.style.cssText = "position:relative;overflow:hidden;min-width:0;min-height:0;", this.root.appendChild(n);
|
|
185
|
-
let r = new
|
|
185
|
+
let r = new m(n, {
|
|
186
186
|
chartType: "candlestick",
|
|
187
187
|
autoScale: !0,
|
|
188
188
|
features: {
|
|
@@ -220,8 +220,8 @@ var ki = class {
|
|
|
220
220
|
}), i;
|
|
221
221
|
}
|
|
222
222
|
setLayout(e) {
|
|
223
|
-
if (e === this.layout || !
|
|
224
|
-
let t = this.cells.length, n =
|
|
223
|
+
if (e === this.layout || !f(e)) return;
|
|
224
|
+
let t = this.cells.length, n = h(g[e]);
|
|
225
225
|
if (n < t) for (let e = t - 1; e >= n; e--) {
|
|
226
226
|
let t = this.cells[e];
|
|
227
227
|
t.chart.destroy(), t.container.remove(), this.cells.pop();
|
|
@@ -255,7 +255,7 @@ var ki = class {
|
|
|
255
255
|
async connectAll(e, t, n, r = 500) {
|
|
256
256
|
let i = [];
|
|
257
257
|
for (let a = 0; a < this.cells.length && a < t.length; a++) i.push(this.connectCell(a, {
|
|
258
|
-
...typeof e == "function" ? { adapter: e(t[a], a) } :
|
|
258
|
+
...typeof e == "function" ? { adapter: e(t[a], a) } : yr(e) ? { feed: e } : { adapter: e },
|
|
259
259
|
symbol: t[a],
|
|
260
260
|
timeframe: n,
|
|
261
261
|
historyLimit: r
|
|
@@ -272,49 +272,61 @@ var ki = class {
|
|
|
272
272
|
this.cells = [], this.root.remove();
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
},
|
|
275
|
+
}, ki = class extends _ {
|
|
276
276
|
options;
|
|
277
277
|
constructor(e, t) {
|
|
278
|
-
super(e, t.theme), this.options = t, this.
|
|
278
|
+
super(e, t.theme, t.font), this.options = t, this.applyLabel(), this.requestRender();
|
|
279
|
+
}
|
|
280
|
+
applyLabel() {
|
|
281
|
+
this.setLabel(this.options.ariaLabel ?? `Sparkline of ${this.options.data.length} points`);
|
|
279
282
|
}
|
|
280
283
|
renderChart(e, t, n, r) {
|
|
281
|
-
|
|
284
|
+
Hr(e, t, n, this.options, r);
|
|
282
285
|
}
|
|
283
286
|
update(e) {
|
|
284
287
|
this.options = {
|
|
285
288
|
...this.options,
|
|
286
289
|
data: e
|
|
287
|
-
}, this.requestRender();
|
|
290
|
+
}, this.applyLabel(), this.requestRender();
|
|
288
291
|
}
|
|
289
292
|
setOptions(e) {
|
|
290
293
|
this.options = {
|
|
291
294
|
...this.options,
|
|
292
295
|
...e
|
|
293
|
-
}, this.applyBaseOptions(
|
|
296
|
+
}, this.applyBaseOptions({
|
|
297
|
+
...e,
|
|
298
|
+
ariaLabel: void 0
|
|
299
|
+
}), this.applyLabel(), this.requestRender();
|
|
294
300
|
}
|
|
295
|
-
},
|
|
301
|
+
}, Ai = class extends _ {
|
|
296
302
|
options;
|
|
297
303
|
crosshair;
|
|
298
304
|
constructor(e, t) {
|
|
299
|
-
super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => {
|
|
305
|
+
super(e, t.theme, t.font), this.options = t, this.crosshair = new v(this.canvas, () => {
|
|
300
306
|
this.options.crosshair !== !1 && this.requestRender();
|
|
301
|
-
}), this.
|
|
307
|
+
}), this.applyLabel(), this.requestRender();
|
|
308
|
+
}
|
|
309
|
+
applyLabel() {
|
|
310
|
+
this.setLabel(this.options.ariaLabel ?? `Depth chart of ${this.options.data.bids.length} bids and ${this.options.data.asks.length} asks`);
|
|
302
311
|
}
|
|
303
312
|
renderChart(e, t, n, r) {
|
|
304
313
|
let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
|
|
305
|
-
|
|
314
|
+
Pr(e, t, n, this.options, r, i);
|
|
306
315
|
}
|
|
307
316
|
update(e) {
|
|
308
317
|
this.options = {
|
|
309
318
|
...this.options,
|
|
310
319
|
data: e
|
|
311
|
-
}, this.requestRender();
|
|
320
|
+
}, this.applyLabel(), this.requestRender();
|
|
312
321
|
}
|
|
313
322
|
setOptions(e) {
|
|
314
323
|
this.options = {
|
|
315
324
|
...this.options,
|
|
316
325
|
...e
|
|
317
|
-
}, this.applyBaseOptions(
|
|
326
|
+
}, this.applyBaseOptions({
|
|
327
|
+
...e,
|
|
328
|
+
ariaLabel: void 0
|
|
329
|
+
}), this.applyLabel(), this.requestRender();
|
|
318
330
|
}
|
|
319
331
|
destroy() {
|
|
320
332
|
this.crosshair.destroy(), super.destroy();
|
|
@@ -323,13 +335,16 @@ var ki = class {
|
|
|
323
335
|
options;
|
|
324
336
|
crosshair;
|
|
325
337
|
constructor(e, t) {
|
|
326
|
-
super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => {
|
|
338
|
+
super(e, t.theme, t.font), this.options = t, this.crosshair = new v(this.canvas, () => {
|
|
327
339
|
this.options.crosshair !== !1 && this.requestRender();
|
|
328
|
-
}), this.
|
|
340
|
+
}), this.applyLabel(), this.requestRender();
|
|
341
|
+
}
|
|
342
|
+
applyLabel() {
|
|
343
|
+
this.setLabel(this.options.ariaLabel ?? `Equity curve of ${this.options.data.length} points`);
|
|
329
344
|
}
|
|
330
345
|
renderChart(e, t, n, r) {
|
|
331
346
|
let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
|
|
332
|
-
|
|
347
|
+
Ir(e, t, n, this.options, r, i);
|
|
333
348
|
}
|
|
334
349
|
update(e, t) {
|
|
335
350
|
this.options = {
|
|
@@ -338,13 +353,16 @@ var ki = class {
|
|
|
338
353
|
}, t !== void 0 && (this.options = {
|
|
339
354
|
...this.options,
|
|
340
355
|
benchmark: t
|
|
341
|
-
}), this.requestRender();
|
|
356
|
+
}), this.applyLabel(), this.requestRender();
|
|
342
357
|
}
|
|
343
358
|
setOptions(e) {
|
|
344
359
|
this.options = {
|
|
345
360
|
...this.options,
|
|
346
361
|
...e
|
|
347
|
-
}, this.applyBaseOptions(
|
|
362
|
+
}, this.applyBaseOptions({
|
|
363
|
+
...e,
|
|
364
|
+
ariaLabel: void 0
|
|
365
|
+
}), this.applyLabel(), this.requestRender();
|
|
348
366
|
}
|
|
349
367
|
destroy() {
|
|
350
368
|
this.crosshair.destroy(), super.destroy();
|
|
@@ -362,7 +380,7 @@ var ki = class {
|
|
|
362
380
|
this.onCanvasClick(e.clientX - t.left, e.clientY - t.top);
|
|
363
381
|
};
|
|
364
382
|
constructor(e, t) {
|
|
365
|
-
super(e, t.theme), this.options = t, this.currentData = t.data ?? [], this.crosshair = new v(this.canvas, () => {
|
|
383
|
+
super(e, t.theme, t.font), this.options = t, this.currentData = t.data ?? [], this.crosshair = new v(this.canvas, () => {
|
|
366
384
|
this.options.crosshair !== !1 && this.requestRender();
|
|
367
385
|
}), this.canvas.addEventListener("click", this.handleClick), this.applyLabel(), this.recomputeLayout(), this.requestRender();
|
|
368
386
|
}
|
|
@@ -378,20 +396,20 @@ var ki = class {
|
|
|
378
396
|
height: this.height
|
|
379
397
|
}, t = this.options.cellPadding ?? 2;
|
|
380
398
|
if (this.lastLayoutWidth = this.width, this.lastLayoutHeight = this.height, this.cachedGroups = [], this.options.grouped) {
|
|
381
|
-
let { groups: n, cells: r } =
|
|
399
|
+
let { groups: n, cells: r } = xr(this.currentData.map((e) => ({
|
|
382
400
|
id: e.id,
|
|
383
401
|
weight: e.weight ?? (Math.abs(e.value) || 1),
|
|
384
402
|
group: e.group,
|
|
385
403
|
value: e.value
|
|
386
|
-
})), e, t,
|
|
404
|
+
})), e, t, gn);
|
|
387
405
|
this.cachedRects = r, this.cachedGroups = n;
|
|
388
406
|
} else if (this.options.weighted) {
|
|
389
407
|
let n = this.currentData.map((e) => ({
|
|
390
408
|
id: e.id,
|
|
391
409
|
weight: e.weight ?? (Math.abs(e.value) || 1)
|
|
392
410
|
}));
|
|
393
|
-
this.cachedRects =
|
|
394
|
-
} else this.cachedRects =
|
|
411
|
+
this.cachedRects = Sr(n, e, t);
|
|
412
|
+
} else this.cachedRects = Cr(this.currentData.map((e) => ({ id: e.id })), e, t);
|
|
395
413
|
}
|
|
396
414
|
onCanvasClick(e, t) {
|
|
397
415
|
if (this.options.onCellClick) for (let n of this.cachedRects) {
|
|
@@ -406,7 +424,7 @@ var ki = class {
|
|
|
406
424
|
renderChart(e, t, n, r) {
|
|
407
425
|
(t !== this.lastLayoutWidth || n !== this.lastLayoutHeight) && this.recomputeLayout();
|
|
408
426
|
let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
|
|
409
|
-
|
|
427
|
+
Rr(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
|
|
410
428
|
}
|
|
411
429
|
update(e) {
|
|
412
430
|
this.currentData = e, this.options = {
|
|
@@ -418,44 +436,53 @@ var ki = class {
|
|
|
418
436
|
this.options = {
|
|
419
437
|
...this.options,
|
|
420
438
|
...e
|
|
421
|
-
},
|
|
439
|
+
}, this.applyBaseOptions({
|
|
440
|
+
..."theme" in e ? { theme: e.theme } : {},
|
|
441
|
+
..."font" in e ? { font: e.font } : {}
|
|
442
|
+
}), e.data && (this.currentData = e.data), this.applyLabel(), this.recomputeLayout(), this.requestRender();
|
|
422
443
|
}
|
|
423
444
|
destroy() {
|
|
424
445
|
this.crosshair.destroy(), this.canvas.removeEventListener("click", this.handleClick), super.destroy();
|
|
425
446
|
}
|
|
426
|
-
},
|
|
447
|
+
}, ji = class extends _ {
|
|
427
448
|
options;
|
|
428
449
|
crosshair;
|
|
429
450
|
constructor(e, t) {
|
|
430
|
-
super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => {
|
|
451
|
+
super(e, t.theme, t.font), this.options = t, this.crosshair = new v(this.canvas, () => {
|
|
431
452
|
this.options.crosshair !== !1 && this.requestRender();
|
|
432
|
-
}), this.
|
|
453
|
+
}), this.applyLabel(), this.requestRender();
|
|
454
|
+
}
|
|
455
|
+
applyLabel() {
|
|
456
|
+
this.setLabel(this.options.ariaLabel ?? `Waterfall chart of ${(this.options.data ?? []).length} steps`);
|
|
433
457
|
}
|
|
434
458
|
renderChart(e, t, n, r) {
|
|
435
459
|
let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition();
|
|
436
|
-
|
|
460
|
+
Ur(e, t, n, this.options, r, i);
|
|
437
461
|
}
|
|
438
462
|
update(e) {
|
|
439
463
|
this.options = {
|
|
440
464
|
...this.options,
|
|
441
465
|
data: e
|
|
442
|
-
}, this.requestRender();
|
|
466
|
+
}, this.applyLabel(), this.requestRender();
|
|
443
467
|
}
|
|
444
468
|
setOptions(e) {
|
|
445
469
|
this.options = {
|
|
446
470
|
...this.options,
|
|
447
471
|
...e
|
|
448
|
-
}, this.applyBaseOptions(
|
|
472
|
+
}, this.applyBaseOptions({
|
|
473
|
+
...e,
|
|
474
|
+
ariaLabel: void 0
|
|
475
|
+
}), this.applyLabel(), this.requestRender();
|
|
449
476
|
}
|
|
450
477
|
destroy() {
|
|
451
478
|
this.crosshair.destroy(), super.destroy();
|
|
452
479
|
}
|
|
453
|
-
},
|
|
454
|
-
function
|
|
480
|
+
}, Mi = 500;
|
|
481
|
+
function Ni(e) {
|
|
455
482
|
let t = 1 - e;
|
|
456
483
|
return 1 - t * t * t;
|
|
457
484
|
}
|
|
458
|
-
var
|
|
485
|
+
var Pi = class extends _ {
|
|
459
486
|
options;
|
|
460
487
|
currentValue;
|
|
461
488
|
targetValue;
|
|
@@ -463,40 +490,46 @@ var Fi = class extends _ {
|
|
|
463
490
|
animationFrom = 0;
|
|
464
491
|
animationFrameId = null;
|
|
465
492
|
constructor(e, t) {
|
|
466
|
-
super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.
|
|
493
|
+
super(e, t.theme, t.font), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.applyLabel(), this.requestRender();
|
|
494
|
+
}
|
|
495
|
+
applyLabel() {
|
|
496
|
+
this.setLabel(this.options.ariaLabel ?? `Gauge at ${this.options.value}`);
|
|
467
497
|
}
|
|
468
498
|
renderChart(e, t, n, r) {
|
|
469
|
-
|
|
499
|
+
Lr(e, t, n, this.options, r, this.currentValue);
|
|
470
500
|
}
|
|
471
501
|
setValue(e) {
|
|
472
502
|
if (this.options.animate === !1) {
|
|
473
503
|
this.cancelAnimation(), this.currentValue = e, this.targetValue = e, this.options = {
|
|
474
504
|
...this.options,
|
|
475
505
|
value: e
|
|
476
|
-
}, this.requestRender();
|
|
506
|
+
}, this.applyLabel(), this.requestRender();
|
|
477
507
|
return;
|
|
478
508
|
}
|
|
479
509
|
this.targetValue = e, this.animationFrom = this.currentValue, this.animationStart = performance.now(), this.options = {
|
|
480
510
|
...this.options,
|
|
481
511
|
value: e
|
|
482
|
-
}, this.startAnimationLoop();
|
|
512
|
+
}, this.applyLabel(), this.startAnimationLoop();
|
|
483
513
|
}
|
|
484
514
|
setOptions(e) {
|
|
485
515
|
let t = {
|
|
486
516
|
...this.options,
|
|
487
517
|
...e
|
|
488
518
|
};
|
|
489
|
-
if (this.applyBaseOptions(
|
|
519
|
+
if (this.applyBaseOptions({
|
|
520
|
+
...e,
|
|
521
|
+
ariaLabel: void 0
|
|
522
|
+
}), e.value !== void 0 && e.value !== this.targetValue) {
|
|
490
523
|
this.options = t, this.setValue(e.value);
|
|
491
524
|
return;
|
|
492
525
|
}
|
|
493
|
-
this.options = t, this.requestRender();
|
|
526
|
+
this.options = t, this.applyLabel(), this.requestRender();
|
|
494
527
|
}
|
|
495
528
|
startAnimationLoop() {
|
|
496
529
|
if (this.animationFrameId !== null) return;
|
|
497
530
|
let e = () => {
|
|
498
531
|
if (this.animationFrameId = null, this.animationStart === null) return;
|
|
499
|
-
let t = this.options.animationDuration ??
|
|
532
|
+
let t = this.options.animationDuration ?? Mi, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = Ni(r);
|
|
500
533
|
this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * i, this.requestRender(), r < 1 ? this.animationFrameId = requestAnimationFrame(e) : (this.currentValue = this.targetValue, this.animationStart = null);
|
|
501
534
|
};
|
|
502
535
|
this.animationFrameId = requestAnimationFrame(e);
|
|
@@ -522,11 +555,11 @@ var Fi = class extends _ {
|
|
|
522
555
|
this.canvas.style.cursor = this.hits(this.layout, e.clientX - t.left, e.clientY - t.top) ? "pointer" : "";
|
|
523
556
|
};
|
|
524
557
|
constructor(e, t) {
|
|
525
|
-
super(e, t.theme), this.options = t, this.crosshair = new v(this.canvas, () => this.requestRender()), this.canvas.addEventListener("click", this.onClick), this.canvas.addEventListener("pointermove", this.onMove), this.applyLabel(), this.requestRender();
|
|
558
|
+
super(e, t.theme, t.font), this.options = t, this.crosshair = new v(this.canvas, () => this.requestRender()), this.canvas.addEventListener("click", this.onClick), this.canvas.addEventListener("pointermove", this.onMove), this.applyLabel(), this.requestRender();
|
|
526
559
|
}
|
|
527
560
|
renderChart(e, t, n, r) {
|
|
528
561
|
let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition(), a = this.layoutFor;
|
|
529
|
-
(!this.layout || !a || a.options !== this.options || a.width !== t || a.height !== n || a.theme !== r) && (this.layout = this.compute(t, n, r,
|
|
562
|
+
(!this.layout || !a || a.options !== this.options || a.width !== t || a.height !== n || a.theme !== r) && (this.layout = this.compute(t, n, r, $n(e, r)), this.layoutFor = {
|
|
530
563
|
options: this.options,
|
|
531
564
|
width: t,
|
|
532
565
|
height: n,
|
|
@@ -537,7 +570,10 @@ var Fi = class extends _ {
|
|
|
537
570
|
this.options = {
|
|
538
571
|
...this.options,
|
|
539
572
|
...e
|
|
540
|
-
},
|
|
573
|
+
}, this.applyBaseOptions({
|
|
574
|
+
..."theme" in e ? { theme: e.theme } : {},
|
|
575
|
+
..."font" in e ? { font: e.font } : {}
|
|
576
|
+
}), this.applyLabel(), this.requestRender();
|
|
541
577
|
}
|
|
542
578
|
applyLabel() {
|
|
543
579
|
this.setLabel(this.options.ariaLabel ?? this.describe());
|
|
@@ -545,12 +581,12 @@ var Fi = class extends _ {
|
|
|
545
581
|
destroy() {
|
|
546
582
|
this.crosshair.destroy(), this.canvas.removeEventListener("click", this.onClick), this.canvas.removeEventListener("pointermove", this.onMove), super.destroy();
|
|
547
583
|
}
|
|
548
|
-
},
|
|
584
|
+
}, Fi = class extends W {
|
|
549
585
|
compute(e, t, n, r) {
|
|
550
|
-
return
|
|
586
|
+
return er(this.options, e, t, n, r);
|
|
551
587
|
}
|
|
552
588
|
draw(e, t, n, r, i, a) {
|
|
553
|
-
|
|
589
|
+
jr(e, t, n, this.options, r, i, a);
|
|
554
590
|
}
|
|
555
591
|
describe() {
|
|
556
592
|
return `Bar chart of ${this.options.series.map((e) => e.name).join(", ")}, ${this.options.categories.length} categories`;
|
|
@@ -576,12 +612,12 @@ var Fi = class extends _ {
|
|
|
576
612
|
series: t
|
|
577
613
|
});
|
|
578
614
|
}
|
|
579
|
-
},
|
|
615
|
+
}, Ii = class extends W {
|
|
580
616
|
compute(e, t, n, r) {
|
|
581
|
-
return
|
|
617
|
+
return rr(this.options, e, t, n, r);
|
|
582
618
|
}
|
|
583
619
|
draw(e, t, n, r, i, a) {
|
|
584
|
-
|
|
620
|
+
Fr(e, t, n, this.options, r, i, a);
|
|
585
621
|
}
|
|
586
622
|
describe() {
|
|
587
623
|
let e = this.options.data.filter((e) => Number.isFinite(e.value) && e.value > 0).map((e) => e.label).join(", ");
|
|
@@ -600,12 +636,12 @@ var Fi = class extends _ {
|
|
|
600
636
|
update(e) {
|
|
601
637
|
this.setOptions({ data: e });
|
|
602
638
|
}
|
|
603
|
-
},
|
|
639
|
+
}, Li = class extends W {
|
|
604
640
|
compute(e, t, n, r) {
|
|
605
|
-
return
|
|
641
|
+
return or(this.options, e, t, n, r);
|
|
606
642
|
}
|
|
607
643
|
draw(e, t, n, r, i, a) {
|
|
608
|
-
|
|
644
|
+
Vr(e, t, n, this.options, r, i, a);
|
|
609
645
|
}
|
|
610
646
|
describe() {
|
|
611
647
|
let e = this.options.series.reduce((e, t) => e + t.points.length, 0);
|
|
@@ -624,12 +660,12 @@ var Fi = class extends _ {
|
|
|
624
660
|
update(e) {
|
|
625
661
|
this.setOptions({ series: e });
|
|
626
662
|
}
|
|
627
|
-
},
|
|
663
|
+
}, Ri = class extends W {
|
|
628
664
|
compute(e, t, n, r) {
|
|
629
|
-
return
|
|
665
|
+
return ir(this.options, e, t, n, r);
|
|
630
666
|
}
|
|
631
667
|
draw(e, t, n, r, i, a) {
|
|
632
|
-
|
|
668
|
+
zr(e, t, n, this.options, r, i, a);
|
|
633
669
|
}
|
|
634
670
|
describe() {
|
|
635
671
|
return `Histogram of ${this.options.values.length} values`;
|
|
@@ -644,12 +680,12 @@ var Fi = class extends _ {
|
|
|
644
680
|
update(e) {
|
|
645
681
|
this.setOptions({ values: e });
|
|
646
682
|
}
|
|
647
|
-
},
|
|
683
|
+
}, zi = class extends W {
|
|
648
684
|
compute(e, t, n, r) {
|
|
649
|
-
return
|
|
685
|
+
return tr(this.options, e, t, n, r);
|
|
650
686
|
}
|
|
651
687
|
draw(e, t, n, r, i, a) {
|
|
652
|
-
|
|
688
|
+
Mr(e, t, n, this.options, r, i, a);
|
|
653
689
|
}
|
|
654
690
|
describe() {
|
|
655
691
|
let e = this.options.data.map((e) => e.date).filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e)).sort(), t = this.options.from ?? e[0], n = this.options.to ?? e[e.length - 1];
|
|
@@ -668,12 +704,12 @@ var Fi = class extends _ {
|
|
|
668
704
|
update(e) {
|
|
669
705
|
this.setOptions({ data: e });
|
|
670
706
|
}
|
|
671
|
-
}, G = 12,
|
|
707
|
+
}, G = 12, Bi = class extends W {
|
|
672
708
|
compute(e, t, n, r) {
|
|
673
|
-
return
|
|
709
|
+
return ar(this.options, e, t, n, r);
|
|
674
710
|
}
|
|
675
711
|
draw(e, t, n, r, i, a) {
|
|
676
|
-
|
|
712
|
+
Br(e, t, n, this.options, r, i, a);
|
|
677
713
|
}
|
|
678
714
|
describe() {
|
|
679
715
|
let { rows: e, columns: t } = this.options;
|
|
@@ -692,12 +728,12 @@ var Fi = class extends _ {
|
|
|
692
728
|
update(e) {
|
|
693
729
|
this.setOptions({ values: e });
|
|
694
730
|
}
|
|
695
|
-
},
|
|
731
|
+
}, Vi = class extends W {
|
|
696
732
|
compute(e, t, n, r) {
|
|
697
|
-
return
|
|
733
|
+
return nr(this.options, e, t, n, r);
|
|
698
734
|
}
|
|
699
735
|
draw(e, t, n, r, i, a) {
|
|
700
|
-
|
|
736
|
+
Nr(e, t, n, this.options, r, i, a);
|
|
701
737
|
}
|
|
702
738
|
describe() {
|
|
703
739
|
return `Counter-clock chart of price against volume, ${this.options.period ?? 25}-bar averages`;
|
|
@@ -713,32 +749,46 @@ var Fi = class extends _ {
|
|
|
713
749
|
r && this.options.onPointClick?.(r.point);
|
|
714
750
|
}
|
|
715
751
|
getPhase() {
|
|
716
|
-
return
|
|
752
|
+
return lr(dr(this.options.data, this.options.period ?? 25, Kr(this.options)));
|
|
717
753
|
}
|
|
718
754
|
update(e) {
|
|
719
755
|
this.setOptions({ data: e });
|
|
720
756
|
}
|
|
721
|
-
},
|
|
722
|
-
"
|
|
723
|
-
"
|
|
724
|
-
"
|
|
725
|
-
"
|
|
726
|
-
"
|
|
727
|
-
"
|
|
728
|
-
"
|
|
729
|
-
"
|
|
730
|
-
"
|
|
731
|
-
"
|
|
732
|
-
"
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
757
|
+
}, K = Object.freeze({
|
|
758
|
+
equityCurve: "Equity Curve",
|
|
759
|
+
drawdown: "Drawdown",
|
|
760
|
+
monthlyReturns: "Monthly Returns",
|
|
761
|
+
totalReturn: "Total Return",
|
|
762
|
+
cagr: "CAGR",
|
|
763
|
+
sharpe: "Sharpe",
|
|
764
|
+
sortino: "Sortino",
|
|
765
|
+
maxDrawdown: "Max Drawdown",
|
|
766
|
+
winRate: "Win Rate",
|
|
767
|
+
profitFactor: "Profit Factor",
|
|
768
|
+
trades: "Trades"
|
|
769
|
+
});
|
|
770
|
+
function Hi(e) {
|
|
771
|
+
let t;
|
|
772
|
+
try {
|
|
773
|
+
t = new Intl.DateTimeFormat(e, {
|
|
774
|
+
month: "short",
|
|
775
|
+
timeZone: "UTC"
|
|
776
|
+
});
|
|
777
|
+
} catch {
|
|
778
|
+
t = new Intl.DateTimeFormat(void 0, {
|
|
779
|
+
month: "short",
|
|
780
|
+
timeZone: "UTC"
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
return Array.from({ length: 12 }, (e, n) => t.format(new Date(Date.UTC(2024, n, 15))));
|
|
784
|
+
}
|
|
785
|
+
function q(e) {
|
|
736
786
|
return e.map((e) => ({
|
|
737
787
|
time: e.time,
|
|
738
788
|
value: e.equity
|
|
739
789
|
}));
|
|
740
790
|
}
|
|
741
|
-
function
|
|
791
|
+
function J(e) {
|
|
742
792
|
let t = -Infinity;
|
|
743
793
|
return e.map((e) => {
|
|
744
794
|
e.equity > t && (t = e.equity);
|
|
@@ -749,76 +799,84 @@ function q(e) {
|
|
|
749
799
|
};
|
|
750
800
|
});
|
|
751
801
|
}
|
|
752
|
-
function
|
|
802
|
+
function Y(e, t) {
|
|
753
803
|
if (e.length === 0) return [];
|
|
754
|
-
let t = [];
|
|
755
|
-
for (let
|
|
756
|
-
let e =
|
|
757
|
-
|
|
804
|
+
let n = Hi(t), r = [];
|
|
805
|
+
for (let t of e) {
|
|
806
|
+
let e = Ut(t.time, "1M"), n = r[r.length - 1];
|
|
807
|
+
n && n.key === e ? n.close = t.equity : r.push({
|
|
758
808
|
key: e,
|
|
759
|
-
close:
|
|
809
|
+
close: t.equity
|
|
760
810
|
});
|
|
761
811
|
}
|
|
762
|
-
let
|
|
763
|
-
for (let e of
|
|
764
|
-
let t =
|
|
765
|
-
|
|
766
|
-
let
|
|
767
|
-
|
|
768
|
-
id: `${
|
|
769
|
-
label:
|
|
770
|
-
group: String(
|
|
771
|
-
value:
|
|
812
|
+
let i = e[0].equity, a = [];
|
|
813
|
+
for (let e of r) {
|
|
814
|
+
let t = i === 0 ? 1 : i, r = (e.close / t - 1) * 100;
|
|
815
|
+
i = e.close;
|
|
816
|
+
let o = new Date(e.key), s = o.getUTCFullYear(), c = o.getUTCMonth();
|
|
817
|
+
a.push({
|
|
818
|
+
id: `${s}-${String(c + 1).padStart(2, "0")}`,
|
|
819
|
+
label: n[c],
|
|
820
|
+
group: String(s),
|
|
821
|
+
value: r
|
|
772
822
|
});
|
|
773
823
|
}
|
|
774
|
-
return
|
|
824
|
+
return a;
|
|
775
825
|
}
|
|
776
|
-
var
|
|
777
|
-
function
|
|
826
|
+
var X = 100;
|
|
827
|
+
function Z(e) {
|
|
778
828
|
return `${e > 0 ? "+" : ""}${e.toFixed(2)}%`;
|
|
779
829
|
}
|
|
780
|
-
function
|
|
830
|
+
function Q(e) {
|
|
781
831
|
return e > 0 ? "positive" : e < 0 ? "negative" : "neutral";
|
|
782
832
|
}
|
|
783
|
-
function
|
|
833
|
+
function $(e = {}) {
|
|
834
|
+
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => typeof e == "string"));
|
|
835
|
+
return {
|
|
836
|
+
...K,
|
|
837
|
+
...t
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
function Ui(e, t = {}) {
|
|
841
|
+
let n = $(t);
|
|
784
842
|
return [
|
|
785
843
|
{
|
|
786
|
-
label:
|
|
787
|
-
value:
|
|
788
|
-
tone:
|
|
844
|
+
label: n.totalReturn,
|
|
845
|
+
value: Z(e.totalReturnPct * X),
|
|
846
|
+
tone: Q(e.totalReturnPct)
|
|
789
847
|
},
|
|
790
848
|
{
|
|
791
|
-
label:
|
|
792
|
-
value:
|
|
793
|
-
tone:
|
|
849
|
+
label: n.cagr,
|
|
850
|
+
value: Z(e.cagr * X),
|
|
851
|
+
tone: Q(e.cagr)
|
|
794
852
|
},
|
|
795
853
|
{
|
|
796
|
-
label:
|
|
854
|
+
label: n.sharpe,
|
|
797
855
|
value: e.sharpe.toFixed(2),
|
|
798
|
-
tone:
|
|
856
|
+
tone: Q(e.sharpe)
|
|
799
857
|
},
|
|
800
858
|
{
|
|
801
|
-
label:
|
|
859
|
+
label: n.sortino,
|
|
802
860
|
value: e.sortino.toFixed(2),
|
|
803
|
-
tone:
|
|
861
|
+
tone: Q(e.sortino)
|
|
804
862
|
},
|
|
805
863
|
{
|
|
806
|
-
label:
|
|
807
|
-
value:
|
|
864
|
+
label: n.maxDrawdown,
|
|
865
|
+
value: Z(-Math.abs(e.maxDrawdownPct) * X),
|
|
808
866
|
tone: "negative"
|
|
809
867
|
},
|
|
810
868
|
{
|
|
811
|
-
label:
|
|
812
|
-
value: `${(e.winRate *
|
|
869
|
+
label: n.winRate,
|
|
870
|
+
value: `${(e.winRate * X).toFixed(1)}%`,
|
|
813
871
|
tone: "neutral"
|
|
814
872
|
},
|
|
815
873
|
{
|
|
816
|
-
label:
|
|
874
|
+
label: n.profitFactor,
|
|
817
875
|
value: Number.isFinite(e.profitFactor) ? e.profitFactor.toFixed(2) : "∞",
|
|
818
|
-
tone:
|
|
876
|
+
tone: Q(e.profitFactor - 1)
|
|
819
877
|
},
|
|
820
878
|
{
|
|
821
|
-
label:
|
|
879
|
+
label: n.trades,
|
|
822
880
|
value: String(e.trades),
|
|
823
881
|
tone: "neutral"
|
|
824
882
|
}
|
|
@@ -826,9 +884,6 @@ function Q(e) {
|
|
|
826
884
|
}
|
|
827
885
|
//#endregion
|
|
828
886
|
//#region src/finance/PerformanceDashboard.ts
|
|
829
|
-
function $(e) {
|
|
830
|
-
return !e || e === "dark" ? ye : e === "light" ? Pe : e;
|
|
831
|
-
}
|
|
832
887
|
var Wi = class {
|
|
833
888
|
options;
|
|
834
889
|
theme;
|
|
@@ -837,10 +892,10 @@ var Wi = class {
|
|
|
837
892
|
drawdownChart = null;
|
|
838
893
|
heatmap = null;
|
|
839
894
|
constructor(e, t) {
|
|
840
|
-
this.options = t, this.theme =
|
|
895
|
+
this.options = t, this.theme = b(t.theme, t.font), this.root = document.createElement("div"), this.build(), e.appendChild(this.root);
|
|
841
896
|
}
|
|
842
897
|
build() {
|
|
843
|
-
let e = this.theme, { result: t, title: n, subtitle: r } = this.options,
|
|
898
|
+
let e = this.theme, { result: t, title: n, subtitle: r, locale: i } = this.options, a = $(this.options.labels), o = e.font, s = this.panelBackground(), c = e.grid;
|
|
844
899
|
if (this.root.style.cssText = [
|
|
845
900
|
"display:flex",
|
|
846
901
|
"flex-direction:column",
|
|
@@ -863,40 +918,49 @@ var Wi = class {
|
|
|
863
918
|
}
|
|
864
919
|
this.root.appendChild(t);
|
|
865
920
|
}
|
|
866
|
-
this.root.appendChild(this.buildStatsStrip(
|
|
867
|
-
let
|
|
868
|
-
|
|
921
|
+
this.root.appendChild(this.buildStatsStrip(Ui(t.metrics, a), s, c));
|
|
922
|
+
let l = document.createElement("div");
|
|
923
|
+
l.style.cssText = [
|
|
869
924
|
"display:grid",
|
|
870
925
|
"grid-template-columns:repeat(auto-fit, minmax(280px, 1fr))",
|
|
871
926
|
"grid-auto-rows:220px",
|
|
872
927
|
"gap:14px"
|
|
873
|
-
].join(";"), this.root.appendChild(
|
|
874
|
-
let
|
|
875
|
-
|
|
876
|
-
data:
|
|
928
|
+
].join(";"), this.root.appendChild(l);
|
|
929
|
+
let u = this.buildPanel(a.equityCurve, s, c);
|
|
930
|
+
u.wrap.style.gridColumn = "1 / -1", l.appendChild(u.wrap), this.equityChart = new H(u.body, {
|
|
931
|
+
data: q(t.equityCurve),
|
|
877
932
|
theme: e,
|
|
933
|
+
font: o,
|
|
934
|
+
locale: i,
|
|
935
|
+
ariaLabel: a.equityCurve,
|
|
878
936
|
lineColor: e.candleUp,
|
|
879
937
|
fillArea: !0,
|
|
880
938
|
crosshair: !0
|
|
881
939
|
});
|
|
882
|
-
let
|
|
883
|
-
|
|
884
|
-
data:
|
|
940
|
+
let d = this.buildPanel(a.drawdown, s, c);
|
|
941
|
+
l.appendChild(d.wrap), this.drawdownChart = new H(d.body, {
|
|
942
|
+
data: J(t.equityCurve),
|
|
885
943
|
theme: e,
|
|
944
|
+
font: o,
|
|
945
|
+
locale: i,
|
|
946
|
+
ariaLabel: a.drawdown,
|
|
886
947
|
lineColor: e.candleDown,
|
|
887
948
|
fillArea: !0,
|
|
888
949
|
crosshair: !0,
|
|
889
950
|
valueFormat: (e) => `${e.toFixed(1)}%`
|
|
890
951
|
});
|
|
891
|
-
let
|
|
892
|
-
|
|
893
|
-
data:
|
|
952
|
+
let f = Y(t.equityCurve, i), p = this.buildPanel(a.monthlyReturns, s, c);
|
|
953
|
+
l.appendChild(p.wrap), this.heatmap = new U(p.body, {
|
|
954
|
+
data: f,
|
|
894
955
|
theme: e,
|
|
956
|
+
font: o,
|
|
957
|
+
locale: i,
|
|
958
|
+
ariaLabel: a.monthlyReturns,
|
|
895
959
|
showValues: !0,
|
|
896
960
|
valueFormat: (e) => `${e >= 0 ? "+" : ""}${e.toFixed(1)}`,
|
|
897
961
|
colorScale: {
|
|
898
962
|
negative: e.candleDown,
|
|
899
|
-
zero:
|
|
963
|
+
zero: s,
|
|
900
964
|
positive: e.candleUp
|
|
901
965
|
}
|
|
902
966
|
});
|
|
@@ -965,7 +1029,7 @@ var Wi = class {
|
|
|
965
1029
|
}, this.destroyCharts(), this.root.replaceChildren(), this.build();
|
|
966
1030
|
}
|
|
967
1031
|
setTheme(e) {
|
|
968
|
-
this.theme =
|
|
1032
|
+
this.theme = b(e, this.options.font), this.options = {
|
|
969
1033
|
...this.options,
|
|
970
1034
|
theme: e
|
|
971
1035
|
}, this.destroyCharts(), this.root.replaceChildren(), this.build();
|
|
@@ -978,6 +1042,6 @@ var Wi = class {
|
|
|
978
1042
|
}
|
|
979
1043
|
};
|
|
980
1044
|
//#endregion
|
|
981
|
-
export {
|
|
1045
|
+
export { Zt as AlertManager, Qt as Animator, Fi as BarChart, $t as BarCountdown, en as BinanceAdapter, tn as BybitAdapter, nn as CANDLE_PATTERNS, fe as CHART_SPACING, pe as CHART_STYLE_KEYS, ui as CORRECTABLE_BARS, zi as CalendarChart, m as Chart, Oi as ChartGrid, rn as ChartLegend, an as ChartStateManager, on as CoinbaseAdapter, sn as CompareRenderer, Vi as CounterClockChart, cn as CrosshairTooltip, ln as CurrentPriceLine, me as DARK_PRICE_LIMITS, he as DARK_TERMINAL, ge as DARK_THEME, K as DEFAULT_DASHBOARD_LABELS, _e as DEFAULT_DRAWING_STYLE, ve as DEFAULT_FONT_FAMILY, re as DEFAULT_HISTORY_PAGE_SIZE, un as DEFAULT_LEGEND_CONFIG, dn as DEFAULT_MAX_WEBGL_CHARTS, ye as DEFAULT_RECONNECT, fn as DEFAULT_SESSION_HOURS, be as DEFAULT_SIGNAL_STYLE, xe as DEFAULT_STREAM_CONFIG, Se as DEFAULT_TIMEFRAME_FAVORITES, Ce as DEFAULT_TRADE_ZONE_STYLE, we as DEFAULT_TRADING_CONFIG, pn as DataExporter, ne as DataManager, Ai as DepthChart, Ii as DonutChart, oe as DragDropImporter, mn as DrawingBase, ee as EXCHANGE_TIME_ZONE, hn as Easing, H as EquityCurveChart, Pi as GaugeChart, e as HISTORY_RETRY_MS, Te as HNX_SESSIONS, Ee as HOSE_SESSIONS, U as HeatmapChart, Ri as HistogramChart, _n as INDICATOR_CATEGORIES, vn as IndicatorBase, yn as IndicatorValueMap, bn as KEPT_BUCKETS, De as KRX_SESSIONS, Oe as KR_COLORS, xn as KeyboardHandler, Sn as KrakenAdapter, ke as LIGHT_PRICE_LIMITS, Ae as LIGHT_THEME, n as LayoutManager, ce as LayoutSession, je as MARKET_CRYPTO, Me as MARKET_HNX, Ne as MARKET_HOSE, Pe as MARKET_HOSE_ETF, Fe as MARKET_KRX, Ie as MARKET_NXT, Le as MARKET_NYSE, Re as MARKET_UPBIT_KRW, ze as MARKET_UPCOM, Be as MARKET_VN30F, Cn as MAX_ALERT_BARS, ae as MAX_LAYOUT_NAME, wn as MIN_ALERT_BARS, Ve as MS_TIME_THRESHOLD, Tn as ManualFeed, Bi as MatrixChart, En as MockAdapter, He as NXT_SESSIONS, le as PLUGIN_API_VERSION, j as POWERED_BY_LABEL, Ue as PRICE_SOURCES, Dn as PaperExecutionAdapter, Wi as PerformanceDashboard, de as PluginManager, On as PollingAdapter, kn as RANGE_PRESETS, An as ReconnectManager, jn as ReplayController, Mn as ReplayManager, Nn as ResamplingAdapter, Pn as ReshapeMemo, We as SANS_FONT_FAMILY, Li as ScatterChart, Fn as Screenshot, In as SessionBreaks, Ln as SessionShading, Rn as SignalMarkerManager, ki as SparklineChart, zn as StreamManager, Ge as TC_PALETTE, Ke as TC_SERIES_COLORS, qe as TIMEFRAMES_CRYPTO, Je as TIMEFRAMES_FOREX, Ye as TIMEFRAMES_STOCK, M as TRADECANVAS_MARK_SVG, A as TRADECANVAS_URL, N as TRADECANVAS_WORDMARK_SVG, o as ThemeManager, Bn as TickAggregator, Vn as TickBarAdapter, Hn as TickBarBuilder, Un as TradeZoneManager, Xe as UPCOM_SESSIONS, Wn as UndoRedoManager, Gn as UpbitAdapter, Ze as VN30F_SESSIONS, Qe as VN_COLORS, $e as VOLUME_ALPHA, Kn as VolumeRenderer, ji as WaterfallChart, qn as Watermark, Jn as WebSocketAdapter, Yn as adapterFromFeed, Xn as axisTimes, Qn as barIndexToX, et as barTimeUnit, tt as barsAreDaily, se as cleanLayoutName, u as clearGlobalPlugins, J as computeDrawdownCurve, Y as computeMonthlyReturns, nt as computePriceLimits, rt as contrastRatio, sr as correlationMatrix, cr as counterClockPhase, ur as counterClockPoints, it as createMarketTheme, Ei as createPoweredBy, at as createVNTheme, fr as describeInputs, pr as detectCandlePatterns, vi as feedBars, mr as feedFromAdapter, ot as formatFraction, st as formatNumber, hr as formatTooltipTime, ct as formatVND, lt as formatVolumeLoc, ut as fractionTick, dt as getCurrentSession, ue as getGlobalPlugins, ft as getLocale, gr as histogramBins, _r as indicatorCategory, pt as indicatorSource, mt as inkOn, vr as isDataFeed, br as isPriceLevelAlert, ht as isPriceSource, gt as isTimeFrame, _t as isValidTimeZone, te as localStorageLayouts, wr as lttbDownsample, Tr as lttbVisibleIndices, vt as marketStatus, l as memoryLayouts, Er as niceScale, yt as normalizeBar, bt as normalizeBarTime, xt as offsetAt, z as opensElsewhere, Di as overlayScale, c as overlaysForLayer, St as parseIndicatorSource, ie as parseOHLCV, Ct as parseTimeframe, wt as pickBaseTimeframe, r as pluginKey, V as poweredByHtml, F as poweredByLayout, Tt as priceFormatterFor, Et as priceStepAt, Dr as priceToY, Or as priceToYMapper, Ar as rangePresetStart, Dt as rankSymbols, Ot as readNews, kt as readQuote, At as readableOn, jt as registerLocale, s as registerPlugin, Mt as resampleBars, Nt as roundToPriceStep, R as safeBadgeHref, Pt as scaleMarketPrices, Ui as selectKeyStats, Wr as servesTimeframe, Ft as setLocale, Gr as setMaxWebGLCharts, It as sourcePrice, Lt as stepDecimals, Rt as symbolTimeZone, li as syncIndicators, zt as t, Bt as tickBarCount, Vt as tickerOf, qr as timeToX, Ht as timeframeBucketStart, Wt as timeframeToMs, Jr as timestampToBarIndex, q as toEquityPoints, Xr as toHeikinAshi, Zr as toKagi, Qr as toLineBreak, $r as toPointAndFigure, ei as toRangeBars, ti as toRenko, t as unregisterPlugin, Gt as usesKoreanUnits, Kt as vn30fContracts, qt as vn30fLastTradingDay, Jt as volumeColor, Yt as wallToUtc, ni as withResampling, ri as withTickBars, ii as xToBarIndex, ai as xToTime, oi as yToPrice, Xt as zoneOffsetMinutes };
|
|
982
1046
|
|
|
983
1047
|
//# sourceMappingURL=index.js.map
|