@lilt-ui/charts 0.4.0 → 0.5.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/CHANGELOG.md +27 -0
- package/dist/activity-ring.d.ts +3 -1
- package/dist/cards/activity-ring-card.d.ts +3 -1
- package/dist/cards/bar-chart-card.d.ts +5 -2
- package/dist/cards/box-plot-card.d.ts +3 -1
- package/dist/cards/cartesian-card.d.ts +15 -3
- package/dist/cards/combo-chart-card.d.ts +4 -2
- package/dist/cards/funnel-chart-card.d.ts +26 -2
- package/dist/cards/heatmap-chart-card.d.ts +6 -1
- package/dist/cards/horizontal-bar-chart-card.d.ts +7 -3
- package/dist/cards/progress-card.d.ts +6 -1
- package/dist/cards/radar-chart-card.d.ts +9 -2
- package/dist/cards/radial-chart-card.d.ts +14 -5
- package/dist/cards/range-chart-card.d.ts +3 -1
- package/dist/cards/sankey-chart-card.d.ts +6 -1
- package/dist/cards/scatter-chart-card.d.ts +11 -2
- package/dist/cards/slope-chart-card.d.ts +6 -1
- package/dist/cards/stat-card.d.ts +7 -2
- package/dist/{cartesian-card-Cj1o38DC.js → cartesian-card-7DAiMU3w.js} +2023 -1604
- package/dist/engine/depth.d.ts +42 -0
- package/dist/engine/isometric-bars.d.ts +25 -0
- package/dist/engine/ranges.d.ts +31 -0
- package/dist/finance/candle-geometry.d.ts +13 -2
- package/dist/finance/candles.d.ts +5 -0
- package/dist/finance/cards/candlestick-chart-card.d.ts +6 -1
- package/dist/finance/cards/depth-chart-card.d.ts +3 -1
- package/dist/finance/order-book.d.ts +4 -2
- package/dist/finance.js +492 -447
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2276 -1765
- package/dist/interaction/legend-meter.d.ts +11 -0
- package/dist/interaction/value-legend.d.ts +8 -2
- package/dist/marks/use-range-mark.d.ts +8 -0
- package/dist/primitives/depth-paint.d.ts +103 -0
- package/dist/primitives/isometric-bar.d.ts +18 -0
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +30 -4
- package/package.json +1 -1
package/dist/finance.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { S, d as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { Fragment as
|
|
2
|
+
import { C as e, F as t, I as n, L as r, N as i, R as a, S as o, U as s, Z as c, _ as l, b as u, d, dt as f, g as p, i as m, k as h, l as g, nt as _, q as v, r as y, t as b, v as x, w as S, x as C, y as w } from "./cartesian-card-7DAiMU3w.js";
|
|
3
|
+
import { S as T, d as E, g as D, h as O, p as k, u as A } from "./report-context-Cz0AYdV2.js";
|
|
4
|
+
import { useEffect as ee, useMemo as j, useRef as te, useState as M } from "react";
|
|
5
|
+
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
6
6
|
//#region src/finance/candle-geometry.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var I = "var(--lilt-candle-up)", L = "var(--lilt-candle-down)";
|
|
8
|
+
function R(e) {
|
|
9
9
|
return Math.round(e * 100) / 100;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function z(e, t, n) {
|
|
12
12
|
let r = e.fields[t], i = r?.[n.open], a = r?.[n.high], o = r?.[n.low], s = e.values[t];
|
|
13
13
|
return i == null || a == null || o == null || s == null ? null : {
|
|
14
14
|
open: i,
|
|
@@ -18,70 +18,84 @@ function R(e, t, n) {
|
|
|
18
18
|
up: s >= i
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function B(e, t, n) {
|
|
22
22
|
for (let r of e) {
|
|
23
|
-
let e =
|
|
23
|
+
let e = z(r, t, n);
|
|
24
24
|
if (!e) continue;
|
|
25
25
|
let i = Math.max(e.open, e.close), a = Math.min(e.open, e.close);
|
|
26
26
|
if (e.high < i || e.low > a) throw Error(`Lilt Candles on series "${t}" expects low ≤ open, close ≤ high at row ${r.sourceIndex + 1}.`);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
let
|
|
29
|
+
function V(e, t, n, r, a = !1) {
|
|
30
|
+
let o = Math.max(1, n.columnWidth), s = o / 2, l = R(e), u = R(n.y(t.high)), d = R(n.y(t.low));
|
|
31
|
+
if (r === "ohlc") {
|
|
32
|
+
let r = R(n.y(t.open)), i = R(n.y(t.close)), a = R(Math.max(2, s));
|
|
33
33
|
return {
|
|
34
34
|
body: null,
|
|
35
35
|
hollow: null,
|
|
36
|
-
stroke: `M${
|
|
36
|
+
stroke: `M${l},${u}V${d}M${R(e - a)},${r}H${l}M${l},${i}H${R(e + a)}`,
|
|
37
|
+
side: null,
|
|
38
|
+
top: null
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
|
-
let
|
|
40
|
-
if (
|
|
41
|
-
let e = (
|
|
42
|
-
|
|
41
|
+
let f = n.y(Math.max(t.open, t.close)), p = n.y(Math.min(t.open, t.close));
|
|
42
|
+
if (p - f < 1) {
|
|
43
|
+
let e = (f + p) / 2;
|
|
44
|
+
f = e - .5, p = e + .5;
|
|
43
45
|
}
|
|
44
|
-
let
|
|
46
|
+
let m = r === "hollow" && t.up && o >= 3, h = m ? .5 : 0, g = a ? c(e, f, o, p - f) : null, _ = g ? e - g.frontWidth / 2 : e - s, v = i(_ + h, f + h, Math.max(1, (g ? g.frontWidth : o) - h * 2), Math.max(1, p - f - h * 2), !g && o >= 6 ? 1.5 : 0), y = (u < f ? `M${l},${u}V${R(f)}` : "") + (d > p ? `M${l},${R(p)}V${d}` : "");
|
|
45
47
|
return {
|
|
46
|
-
body:
|
|
47
|
-
hollow:
|
|
48
|
-
stroke:
|
|
48
|
+
body: m ? null : v,
|
|
49
|
+
hollow: m ? v : null,
|
|
50
|
+
stroke: y,
|
|
51
|
+
side: g?.side ?? null,
|
|
52
|
+
top: g?.top ?? null
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
|
-
function
|
|
52
|
-
let
|
|
53
|
-
for (let { row:
|
|
54
|
-
let e =
|
|
55
|
+
function H(e, t, n, r, i, a, o = !1) {
|
|
56
|
+
let s = new S(), c = new S(), l = new S(), u = new S(), d = new S();
|
|
57
|
+
for (let { row: f, cx: p } of h(e, r)) {
|
|
58
|
+
let e = z(f, t, n);
|
|
55
59
|
if (!e) continue;
|
|
56
|
-
let
|
|
57
|
-
|
|
60
|
+
let m = a(f, e), h = V(p, e, r, i, o);
|
|
61
|
+
h.side && u.add(m, h.side), h.top && d.add(m, h.top), h.body && s.add(m, h.body), h.hollow && c.add(m, h.hollow), h.stroke && l.add(m, h.stroke);
|
|
58
62
|
}
|
|
59
63
|
return {
|
|
60
|
-
bodies:
|
|
61
|
-
hollow:
|
|
62
|
-
strokes:
|
|
64
|
+
bodies: s.entries(),
|
|
65
|
+
hollow: c.entries(),
|
|
66
|
+
strokes: l.entries(),
|
|
67
|
+
sides: u.entries(),
|
|
68
|
+
tops: d.entries()
|
|
63
69
|
};
|
|
64
70
|
}
|
|
65
71
|
//#endregion
|
|
66
72
|
//#region src/finance/candles.tsx
|
|
67
|
-
function
|
|
68
|
-
return
|
|
73
|
+
function U(e, t, n) {
|
|
74
|
+
return a(e, t, n.up ? I : L);
|
|
69
75
|
}
|
|
70
|
-
function
|
|
76
|
+
function W({ paths: e, display: t }) {
|
|
71
77
|
let n = t === "ohlc" ? 1.5 : 1;
|
|
72
|
-
return /* @__PURE__ */
|
|
73
|
-
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ F(N, { children: [
|
|
79
|
+
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */ P("path", {
|
|
74
80
|
d: r,
|
|
75
81
|
fill: "none",
|
|
76
82
|
strokeWidth: n,
|
|
77
83
|
strokeLinecap: t === "ohlc" ? "round" : "butt",
|
|
78
84
|
style: { stroke: e }
|
|
79
85
|
}, `stroke-${e}`)),
|
|
80
|
-
e.
|
|
86
|
+
e.sides.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
|
|
87
|
+
d: t,
|
|
88
|
+
style: { fill: v(e).side }
|
|
89
|
+
}, `side-${e}`)),
|
|
90
|
+
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
|
|
91
|
+
d: t,
|
|
92
|
+
style: { fill: v(e).top }
|
|
93
|
+
}, `top-${e}`)),
|
|
94
|
+
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
|
|
81
95
|
d: t,
|
|
82
96
|
style: { fill: e }
|
|
83
97
|
}, `body-${e}`)),
|
|
84
|
-
e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
98
|
+
e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
|
|
85
99
|
d: t,
|
|
86
100
|
strokeWidth: 1,
|
|
87
101
|
style: {
|
|
@@ -91,43 +105,44 @@ function U({ paths: e, display: t }) {
|
|
|
91
105
|
}, `hollow-${e}`))
|
|
92
106
|
] });
|
|
93
107
|
}
|
|
94
|
-
var
|
|
95
|
-
let
|
|
96
|
-
t,
|
|
108
|
+
var G = r(function({ series: t, open: n, high: r, low: i, display: a = "candle", depth: o = !1, className: c }) {
|
|
109
|
+
let l = e("Candles", t, [
|
|
97
110
|
n,
|
|
98
|
-
r
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
111
|
+
r,
|
|
112
|
+
i
|
|
113
|
+
], "column"), { snapshot: u, descriptor: d, scales: f } = l, p = j(() => {
|
|
114
|
+
let e = {
|
|
115
|
+
open: n,
|
|
116
|
+
high: r,
|
|
117
|
+
low: i
|
|
104
118
|
};
|
|
105
|
-
return
|
|
119
|
+
return B(u.data.rows, t, e), H(u.data.rows, t, e, f, a, (e, t) => U(d, e, t), o);
|
|
106
120
|
}, [
|
|
107
|
-
|
|
108
|
-
e,
|
|
121
|
+
u,
|
|
109
122
|
t,
|
|
110
123
|
n,
|
|
111
124
|
r,
|
|
112
|
-
u,
|
|
113
125
|
i,
|
|
114
|
-
|
|
126
|
+
f,
|
|
127
|
+
a,
|
|
128
|
+
d,
|
|
129
|
+
o
|
|
115
130
|
]);
|
|
116
|
-
return /* @__PURE__ */
|
|
131
|
+
return /* @__PURE__ */ F("g", {
|
|
117
132
|
"aria-hidden": "true",
|
|
118
|
-
className: ["lilt-chart__candles",
|
|
119
|
-
"data-series":
|
|
120
|
-
"data-display":
|
|
121
|
-
clipPath:
|
|
122
|
-
mask:
|
|
133
|
+
className: ["lilt-chart__candles", c].filter(Boolean).join(" "),
|
|
134
|
+
"data-series": t,
|
|
135
|
+
"data-display": a,
|
|
136
|
+
clipPath: o ? `url(#${l.depthClip.id})` : l.clipPath,
|
|
137
|
+
mask: l.mask,
|
|
123
138
|
style: {
|
|
124
|
-
opacity:
|
|
125
|
-
transition:
|
|
139
|
+
opacity: l.opacity,
|
|
140
|
+
transition: l.reducedMotion ? void 0 : "opacity 160ms ease-out"
|
|
126
141
|
},
|
|
127
|
-
children: /* @__PURE__ */
|
|
128
|
-
paths:
|
|
129
|
-
display:
|
|
130
|
-
})
|
|
142
|
+
children: [o ? /* @__PURE__ */ P(s, { clip: l.depthClip }) : null, /* @__PURE__ */ P(W, {
|
|
143
|
+
paths: p,
|
|
144
|
+
display: a
|
|
145
|
+
})]
|
|
131
146
|
});
|
|
132
147
|
}, {
|
|
133
148
|
layout: "column",
|
|
@@ -138,25 +153,33 @@ var W = u(function({ series: e, open: t, high: n, low: r, display: i = "candle",
|
|
|
138
153
|
e.low
|
|
139
154
|
],
|
|
140
155
|
highlight: (e, { row: t, snapshot: n, descriptor: r }) => {
|
|
141
|
-
let i =
|
|
156
|
+
let i = z(t, e.series, e);
|
|
142
157
|
if (!i) return null;
|
|
143
|
-
let a = e.display ?? "candle",
|
|
144
|
-
return /* @__PURE__ */
|
|
158
|
+
let a = e.display ?? "candle", s = o(n, e.series), c = V(s.x(t.x), i, s, a, e.depth), l = U(r, t, i);
|
|
159
|
+
return /* @__PURE__ */ P("g", {
|
|
145
160
|
className: "lilt-chart__candle-highlight",
|
|
146
|
-
children: /* @__PURE__ */
|
|
161
|
+
children: /* @__PURE__ */ P(W, {
|
|
147
162
|
display: a,
|
|
148
163
|
paths: {
|
|
149
|
-
bodies:
|
|
150
|
-
color:
|
|
151
|
-
d:
|
|
164
|
+
bodies: c.body ? [{
|
|
165
|
+
color: l,
|
|
166
|
+
d: c.body
|
|
167
|
+
}] : [],
|
|
168
|
+
hollow: c.hollow ? [{
|
|
169
|
+
color: l,
|
|
170
|
+
d: c.hollow
|
|
152
171
|
}] : [],
|
|
153
|
-
|
|
154
|
-
color:
|
|
155
|
-
d:
|
|
172
|
+
strokes: c.stroke ? [{
|
|
173
|
+
color: l,
|
|
174
|
+
d: c.stroke
|
|
156
175
|
}] : [],
|
|
157
|
-
|
|
158
|
-
color:
|
|
159
|
-
d:
|
|
176
|
+
sides: c.side ? [{
|
|
177
|
+
color: l,
|
|
178
|
+
d: c.side
|
|
179
|
+
}] : [],
|
|
180
|
+
tops: c.top ? [{
|
|
181
|
+
color: l,
|
|
182
|
+
d: c.top
|
|
160
183
|
}] : []
|
|
161
184
|
}
|
|
162
185
|
})
|
|
@@ -165,132 +188,134 @@ var W = u(function({ series: e, open: t, high: n, low: r, display: i = "candle",
|
|
|
165
188
|
});
|
|
166
189
|
//#endregion
|
|
167
190
|
//#region src/finance/cards/pane.tsx
|
|
168
|
-
function
|
|
169
|
-
let [
|
|
170
|
-
return /* @__PURE__ */
|
|
191
|
+
function K({ context: e, label: t, caption: r, readout: i, series: a, height: o, y: s, bars: c, xAxis: l = !1, children: u }) {
|
|
192
|
+
let [d, m] = M(null), h = d ?? e.data.at(-1) ?? null;
|
|
193
|
+
return /* @__PURE__ */ F("div", {
|
|
171
194
|
className: "lilt-card__pane",
|
|
172
|
-
children: [
|
|
195
|
+
children: [r ? /* @__PURE__ */ F("span", {
|
|
173
196
|
className: "lilt-card__pane-caption",
|
|
174
197
|
"aria-hidden": "true",
|
|
175
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ P("span", {
|
|
176
199
|
className: "lilt-card__pane-name",
|
|
177
|
-
children:
|
|
178
|
-
}),
|
|
179
|
-
}) : null, /* @__PURE__ */
|
|
200
|
+
children: r
|
|
201
|
+
}), i && h && !e.loading ? i(h) : null]
|
|
202
|
+
}) : null, /* @__PURE__ */ P(f, {
|
|
180
203
|
className: "lilt-card__chart",
|
|
181
|
-
"aria-label":
|
|
182
|
-
data:
|
|
183
|
-
x:
|
|
184
|
-
y:
|
|
185
|
-
series:
|
|
186
|
-
controller:
|
|
187
|
-
onSelectionChange:
|
|
188
|
-
motion:
|
|
189
|
-
status:
|
|
190
|
-
children: /* @__PURE__ */
|
|
191
|
-
height:
|
|
204
|
+
"aria-label": t,
|
|
205
|
+
data: e.data,
|
|
206
|
+
x: e.x,
|
|
207
|
+
y: s,
|
|
208
|
+
series: a,
|
|
209
|
+
controller: e.controller,
|
|
210
|
+
onSelectionChange: i ? (e) => m(e?.row ?? null) : void 0,
|
|
211
|
+
motion: e.motion,
|
|
212
|
+
status: e.loading ? "loading" : "ready",
|
|
213
|
+
children: /* @__PURE__ */ F(n, {
|
|
214
|
+
height: o,
|
|
192
215
|
margins: {
|
|
193
|
-
...
|
|
216
|
+
...e.margins,
|
|
194
217
|
top: 6,
|
|
195
|
-
bottom:
|
|
218
|
+
bottom: l ? 28 : 4
|
|
196
219
|
},
|
|
197
|
-
axis:
|
|
198
|
-
pill:
|
|
199
|
-
axisInset:
|
|
200
|
-
slots:
|
|
201
|
-
bars:
|
|
220
|
+
axis: e.axis,
|
|
221
|
+
pill: e.hoverStyle,
|
|
222
|
+
axisInset: e.axisInset,
|
|
223
|
+
slots: e.slots || !!c,
|
|
224
|
+
bars: c,
|
|
202
225
|
background: "none",
|
|
203
|
-
children: [
|
|
226
|
+
children: [u, l ? /* @__PURE__ */ P(p, { labels: "fit" }) : null]
|
|
204
227
|
})
|
|
205
228
|
})]
|
|
206
229
|
});
|
|
207
230
|
}
|
|
208
231
|
//#endregion
|
|
209
232
|
//#region src/finance/cards/candlestick-chart-card.tsx
|
|
210
|
-
function
|
|
233
|
+
function q(e, t) {
|
|
211
234
|
let n = e[t];
|
|
212
235
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
213
236
|
}
|
|
214
|
-
function
|
|
215
|
-
let r = e.length ?
|
|
237
|
+
function J(e, t, n) {
|
|
238
|
+
let r = e.length ? q(e[0], t) : null, i = e.length ? q(e.at(-1), n) : null;
|
|
216
239
|
return r && i !== null ? i / r - 1 : void 0;
|
|
217
240
|
}
|
|
218
|
-
function
|
|
241
|
+
function ne(e) {
|
|
219
242
|
return (t) => {
|
|
220
243
|
let n = t.series[0]?.fields;
|
|
221
244
|
return !n?.length || n.some((e) => e.value === null) ? null : n.map((t) => `${t.label[0]} ${e(t.value)}`).join(" ");
|
|
222
245
|
};
|
|
223
246
|
}
|
|
224
|
-
var
|
|
247
|
+
var re = {
|
|
225
248
|
minimumFractionDigits: 2,
|
|
226
249
|
maximumFractionDigits: 2
|
|
227
250
|
};
|
|
228
|
-
function
|
|
229
|
-
let x =
|
|
251
|
+
function ie({ open: e, high: n, low: r, close: i, volume: a, display: o = "candle", depth: s = !1, scale: c = "linear", label: l = "Price", live: d = !1, data: f, ranges: p, delta: m, valueFormat: h = re, locale: g = "en-US", volumeHeight: _ = 64, ...v }) {
|
|
252
|
+
let x = j(() => y(g, h).full, [g, JSON.stringify(h)]), S = j(() => y(g).compact, [g]), C = j(() => p?.map((t) => ({
|
|
230
253
|
...t,
|
|
231
|
-
delta: t.delta ??
|
|
254
|
+
delta: t.delta ?? J(t.data, e, i)
|
|
232
255
|
})), [
|
|
233
256
|
p,
|
|
234
257
|
e,
|
|
235
|
-
|
|
236
|
-
]),
|
|
258
|
+
i
|
|
259
|
+
]), T = (J(f ?? p?.[0]?.data ?? [], e, i) ?? 0) >= 0, E = (t) => (q(t, i) ?? 0) >= (q(t, e) ?? 0), D = o === "area", O = {
|
|
237
260
|
open: {
|
|
238
261
|
label: "Open",
|
|
239
|
-
accessor: (t) =>
|
|
262
|
+
accessor: (t) => q(t, e)
|
|
240
263
|
},
|
|
241
264
|
high: {
|
|
242
265
|
label: "High",
|
|
243
|
-
accessor: (e) =>
|
|
266
|
+
accessor: (e) => q(e, n)
|
|
244
267
|
},
|
|
245
268
|
low: {
|
|
246
269
|
label: "Low",
|
|
247
|
-
accessor: (e) =>
|
|
270
|
+
accessor: (e) => q(e, r)
|
|
248
271
|
}
|
|
249
272
|
};
|
|
250
|
-
return /* @__PURE__ */
|
|
251
|
-
...
|
|
273
|
+
return /* @__PURE__ */ P(b, {
|
|
274
|
+
...v,
|
|
275
|
+
depth: s,
|
|
252
276
|
data: f,
|
|
253
277
|
ranges: C,
|
|
254
|
-
delta: m ?? (f ?
|
|
255
|
-
valueFormat:
|
|
256
|
-
locale:
|
|
278
|
+
delta: m ?? (f ? J(f, e, i) : void 0),
|
|
279
|
+
valueFormat: h,
|
|
280
|
+
locale: g,
|
|
257
281
|
aggregate: "last",
|
|
258
282
|
tiles: !1,
|
|
259
|
-
live:
|
|
283
|
+
live: d,
|
|
260
284
|
series: [{
|
|
261
|
-
key:
|
|
285
|
+
key: i,
|
|
262
286
|
label: l,
|
|
263
|
-
color:
|
|
287
|
+
color: D ? T ? I : L : void 0
|
|
264
288
|
}],
|
|
265
289
|
shape: {
|
|
266
290
|
kind: "marks",
|
|
267
|
-
id: `candles:${o}:${c}:${e}:${
|
|
291
|
+
id: `candles:${o}:${s}:${c}:${e}:${n}:${r}:${!!a}`,
|
|
268
292
|
includeZero: !1,
|
|
269
293
|
scale: c,
|
|
270
294
|
slots: !0,
|
|
271
295
|
xAxis: !a,
|
|
272
|
-
series: () =>
|
|
273
|
-
fields:
|
|
296
|
+
series: () => D ? {
|
|
297
|
+
fields: O,
|
|
274
298
|
area: { treatment: "fade" },
|
|
275
299
|
curve: "linear"
|
|
276
300
|
} : {
|
|
277
|
-
fields:
|
|
301
|
+
fields: O,
|
|
278
302
|
line: { showInspectionPoint: !1 }
|
|
279
303
|
},
|
|
280
|
-
describe:
|
|
281
|
-
draw: (e) => e.map((e) =>
|
|
304
|
+
describe: ne(x),
|
|
305
|
+
draw: (e) => e.map((e) => D ? [/* @__PURE__ */ P(t, { series: e }, `area-${e}`), /* @__PURE__ */ P(u, { series: e }, `line-${e}`)] : /* @__PURE__ */ P(G, {
|
|
282
306
|
series: e,
|
|
283
307
|
open: "open",
|
|
284
308
|
high: "high",
|
|
285
309
|
low: "low",
|
|
286
|
-
display: o
|
|
310
|
+
display: o,
|
|
311
|
+
depth: s
|
|
287
312
|
}, e))
|
|
288
313
|
},
|
|
289
|
-
panes: a ? (e) => /* @__PURE__ */
|
|
314
|
+
panes: a ? (e) => /* @__PURE__ */ P(K, {
|
|
290
315
|
context: e,
|
|
291
|
-
label: `${
|
|
316
|
+
label: `${v.title} volume`,
|
|
292
317
|
caption: "Volume",
|
|
293
|
-
height:
|
|
318
|
+
height: _,
|
|
294
319
|
xAxis: !0,
|
|
295
320
|
y: {
|
|
296
321
|
includeZero: !0,
|
|
@@ -301,39 +326,39 @@ function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candl
|
|
|
301
326
|
series: [{
|
|
302
327
|
id: "volume",
|
|
303
328
|
label: "Volume",
|
|
304
|
-
accessor: (e) =>
|
|
329
|
+
accessor: (e) => q(e, a),
|
|
305
330
|
formatValue: S,
|
|
306
|
-
colorAt: (e) =>
|
|
331
|
+
colorAt: (e) => E(e) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
307
332
|
bar: { radius: 1 }
|
|
308
333
|
}],
|
|
309
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ P(w, { series: "volume" })
|
|
310
335
|
}) : void 0
|
|
311
336
|
});
|
|
312
337
|
}
|
|
313
338
|
//#endregion
|
|
314
339
|
//#region src/finance/indicators.ts
|
|
315
|
-
function
|
|
340
|
+
function Y(e) {
|
|
316
341
|
return typeof e == "number" && Number.isFinite(e);
|
|
317
342
|
}
|
|
318
|
-
function
|
|
343
|
+
function ae(e, t) {
|
|
319
344
|
if (!Number.isInteger(t) || t < 1) throw Error(`Lilt ${e} period must be a positive integer; received ${t}.`);
|
|
320
345
|
}
|
|
321
|
-
function
|
|
322
|
-
|
|
346
|
+
function oe(e, t) {
|
|
347
|
+
ae("sma", t);
|
|
323
348
|
let n = [], r = 0, i = 0;
|
|
324
349
|
for (let a = 0; a < e.length; a += 1) {
|
|
325
350
|
let o = e[a];
|
|
326
|
-
|
|
351
|
+
Y(o) && (r += o, i += 1);
|
|
327
352
|
let s = a - t >= 0 ? e[a - t] : void 0;
|
|
328
|
-
a - t >= 0 &&
|
|
353
|
+
a - t >= 0 && Y(s) && (r -= s, --i), n.push(a >= t - 1 && i === t ? r / t : null);
|
|
329
354
|
}
|
|
330
355
|
return n;
|
|
331
356
|
}
|
|
332
|
-
function
|
|
333
|
-
|
|
357
|
+
function X(e, t) {
|
|
358
|
+
ae("ema", t);
|
|
334
359
|
let n = 2 / (t + 1), r = [], i = null, a = [];
|
|
335
360
|
for (let o of e) {
|
|
336
|
-
if (!
|
|
361
|
+
if (!Y(o)) {
|
|
337
362
|
r.push(null);
|
|
338
363
|
continue;
|
|
339
364
|
}
|
|
@@ -345,11 +370,11 @@ function Z(e, t) {
|
|
|
345
370
|
}
|
|
346
371
|
return r;
|
|
347
372
|
}
|
|
348
|
-
function
|
|
349
|
-
|
|
373
|
+
function se(e, t = 14) {
|
|
374
|
+
ae("rsi", t);
|
|
350
375
|
let n = e.map(() => null), r = null, i = 0, a = 0, o = 0, s = 0, c = 0;
|
|
351
376
|
return e.forEach((e, l) => {
|
|
352
|
-
if (!
|
|
377
|
+
if (!Y(e)) return;
|
|
353
378
|
if (r === null) {
|
|
354
379
|
r = e;
|
|
355
380
|
return;
|
|
@@ -364,12 +389,12 @@ function re(e, t = 14) {
|
|
|
364
389
|
n[l] = c === 0 ? s === 0 ? 50 : 100 : 100 - 100 / (1 + s / c);
|
|
365
390
|
}), n;
|
|
366
391
|
}
|
|
367
|
-
function
|
|
392
|
+
function ce(e, t = 12, n = 26, r = 9) {
|
|
368
393
|
if (t >= n) throw Error("Lilt macd needs a fast period shorter than the slow period.");
|
|
369
|
-
let i =
|
|
394
|
+
let i = X(e, t), a = X(e, n), o = e.map((e, t) => {
|
|
370
395
|
let n = i[t], r = a[t];
|
|
371
396
|
return n === null || r === null ? null : n - r;
|
|
372
|
-
}), s =
|
|
397
|
+
}), s = X(o, r);
|
|
373
398
|
return {
|
|
374
399
|
macd: o,
|
|
375
400
|
signal: s,
|
|
@@ -379,8 +404,8 @@ function ie(e, t = 12, n = 26, r = 9) {
|
|
|
379
404
|
})
|
|
380
405
|
};
|
|
381
406
|
}
|
|
382
|
-
function
|
|
383
|
-
let r =
|
|
407
|
+
function le(e, t = 20, n = 2) {
|
|
408
|
+
let r = oe(e, t), i = [], a = [];
|
|
384
409
|
return r.forEach((r, o) => {
|
|
385
410
|
if (r === null) {
|
|
386
411
|
i.push(null), a.push(null);
|
|
@@ -396,19 +421,19 @@ function ae(e, t = 20, n = 2) {
|
|
|
396
421
|
lower: a
|
|
397
422
|
};
|
|
398
423
|
}
|
|
399
|
-
function
|
|
424
|
+
function ue(e) {
|
|
400
425
|
let t = -Infinity;
|
|
401
|
-
return e.map((e) =>
|
|
426
|
+
return e.map((e) => Y(e) ? (t = Math.max(t, e), t > 0 ? e / t - 1 : 0) : null);
|
|
402
427
|
}
|
|
403
|
-
function
|
|
404
|
-
let t = e.find(
|
|
405
|
-
return e.map((e) =>
|
|
428
|
+
function de(e) {
|
|
429
|
+
let t = e.find(Y);
|
|
430
|
+
return e.map((e) => Y(e) && t !== void 0 && t !== 0 ? e / t - 1 : null);
|
|
406
431
|
}
|
|
407
|
-
function
|
|
408
|
-
for (let n of t) if (!
|
|
432
|
+
function fe(e, t) {
|
|
433
|
+
for (let n of t) if (!Y(n.price) || !Y(n.size) || n.size < 0) throw Error(`Lilt order book ${e} need finite prices and non-negative sizes; received ${n.price} × ${n.size}.`);
|
|
409
434
|
}
|
|
410
|
-
function
|
|
411
|
-
|
|
435
|
+
function pe(e, t) {
|
|
436
|
+
fe("bids", e), fe("asks", t);
|
|
412
437
|
let n = (e) => {
|
|
413
438
|
let t = /* @__PURE__ */ new Map();
|
|
414
439
|
for (let n of e) t.set(n.price, (t.get(n.price) ?? 0) + n.size);
|
|
@@ -443,7 +468,7 @@ function le(e, t) {
|
|
|
443
468
|
}
|
|
444
469
|
//#endregion
|
|
445
470
|
//#region src/finance/cards/indicator-chart-card.tsx
|
|
446
|
-
function
|
|
471
|
+
function me(e) {
|
|
447
472
|
return e.map((e, t) => {
|
|
448
473
|
let n = typeof e == "string" ? { kind: e } : e, r = "period" in n && n.period !== void 0 ? n.period : (n.kind, 20), i = "deviations" in n && n.deviations !== void 0 ? n.deviations : 2, a = n.kind === "bollinger" ? "BB" : n.kind.toUpperCase();
|
|
449
474
|
return {
|
|
@@ -455,7 +480,7 @@ function ue(e) {
|
|
|
455
480
|
};
|
|
456
481
|
});
|
|
457
482
|
}
|
|
458
|
-
function
|
|
483
|
+
function he(e) {
|
|
459
484
|
return e.map((e, t) => {
|
|
460
485
|
let n = typeof e == "string" ? { kind: e } : e;
|
|
461
486
|
return {
|
|
@@ -468,105 +493,105 @@ function de(e) {
|
|
|
468
493
|
};
|
|
469
494
|
});
|
|
470
495
|
}
|
|
471
|
-
function
|
|
496
|
+
function Z(e, t) {
|
|
472
497
|
if (!t) return null;
|
|
473
498
|
let n = e[t];
|
|
474
499
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
475
500
|
}
|
|
476
|
-
function
|
|
477
|
-
let i = e.map((e) =>
|
|
501
|
+
function ge(e, t, n, r) {
|
|
502
|
+
let i = e.map((e) => Z(e, t)), a = e.map((e) => ({ ...e })), o = (e, t) => t.forEach((t, n) => a[n][e] = t);
|
|
478
503
|
for (let e of n) if (e.kind === "bollinger") {
|
|
479
|
-
let t =
|
|
504
|
+
let t = le(i, e.period, e.deviations);
|
|
480
505
|
o(e.id, t.middle), o(`${e.id}Upper`, t.upper), o(`${e.id}Lower`, t.lower);
|
|
481
|
-
} else o(e.id, (e.kind === "sma" ?
|
|
482
|
-
for (let e of r) if (e.kind === "rsi" && o(e.id,
|
|
483
|
-
let t =
|
|
506
|
+
} else o(e.id, (e.kind === "sma" ? oe : X)(i, e.period));
|
|
507
|
+
for (let e of r) if (e.kind === "rsi" && o(e.id, se(i, e.period)), e.kind === "macd") {
|
|
508
|
+
let t = ce(i, e.fast, e.slow, e.signal);
|
|
484
509
|
o(`${e.id}Macd`, t.macd), o(`${e.id}Signal`, t.signal), o(`${e.id}Histogram`, t.histogram);
|
|
485
510
|
}
|
|
486
511
|
return a;
|
|
487
512
|
}
|
|
488
|
-
var
|
|
513
|
+
var _e = {
|
|
489
514
|
minimumFractionDigits: 2,
|
|
490
515
|
maximumFractionDigits: 2
|
|
491
|
-
},
|
|
516
|
+
}, ve = [
|
|
492
517
|
"var(--lilt-series-4)",
|
|
493
518
|
"var(--lilt-series-3)",
|
|
494
519
|
"var(--lilt-series-5)"
|
|
495
520
|
];
|
|
496
|
-
function
|
|
497
|
-
let T = !!(t && n && r), E =
|
|
521
|
+
function ye({ close: e, open: t, high: n, low: r, volume: i, display: a, overlays: o = [], panes: s = ["rsi", "macd"], label: c = "Price", scale: l = "linear", live: f = !1, data: p, ranges: m, delta: h, valueFormat: _ = _e, locale: v = "en-US", paneHeight: x = 72, ...S }) {
|
|
522
|
+
let T = !!(t && n && r), E = a ?? (T ? "candle" : "line");
|
|
498
523
|
if (E !== "line" && !T) throw Error("Lilt IndicatorChartCard candles need open, high and low fields.");
|
|
499
|
-
let D = JSON.stringify(
|
|
500
|
-
if (
|
|
501
|
-
let
|
|
502
|
-
|
|
524
|
+
let D = JSON.stringify(o), O = JSON.stringify(s), k = j(() => me(o), [D]), A = j(() => he(s), [O]);
|
|
525
|
+
if (A.some((e) => e.kind === "volume") && !i) throw Error("Lilt IndicatorChartCard needs a `volume` field for a volume pane.");
|
|
526
|
+
let ee = j(() => p ? ge(p, e, k, A) : void 0, [
|
|
527
|
+
p,
|
|
503
528
|
e,
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
]),
|
|
529
|
+
k,
|
|
530
|
+
A
|
|
531
|
+
]), te = j(() => m?.map((n) => ({
|
|
507
532
|
...n,
|
|
508
|
-
data:
|
|
509
|
-
delta: n.delta ?? (t ?
|
|
533
|
+
data: ge(n.data, e, k, A),
|
|
534
|
+
delta: n.delta ?? (t ? J(n.data, t, e) : void 0)
|
|
510
535
|
})), [
|
|
511
|
-
|
|
536
|
+
m,
|
|
512
537
|
e,
|
|
513
538
|
t,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
]),
|
|
539
|
+
k,
|
|
540
|
+
A
|
|
541
|
+
]), M = j(() => y(v, _).full, [v, JSON.stringify(_)]), R = j(() => y(v, { maximumFractionDigits: 2 }).full, [v]), z = j(() => y(v).compact, [v]), B = T ? {
|
|
517
542
|
open: {
|
|
518
543
|
label: "Open",
|
|
519
|
-
accessor: (e) =>
|
|
544
|
+
accessor: (e) => Z(e, t)
|
|
520
545
|
},
|
|
521
546
|
high: {
|
|
522
547
|
label: "High",
|
|
523
|
-
accessor: (e) =>
|
|
548
|
+
accessor: (e) => Z(e, n)
|
|
524
549
|
},
|
|
525
550
|
low: {
|
|
526
551
|
label: "Low",
|
|
527
|
-
accessor: (e) =>
|
|
552
|
+
accessor: (e) => Z(e, r)
|
|
528
553
|
}
|
|
529
|
-
} : void 0,
|
|
530
|
-
let
|
|
531
|
-
let r =
|
|
532
|
-
return /* @__PURE__ */
|
|
554
|
+
} : void 0, V = new Map(k.map((e) => [e.id, e])), H = p?.length ? Z(p[0], e) : null, U = p?.length ? Z(p.at(-1), e) : null, W = H === null || U === null || U >= H, q = A.at(-1)?.id, re = (n, r) => {
|
|
555
|
+
let a = n.id === q, o = (e) => (t) => Z(t, e), s = (e, t, n) => {
|
|
556
|
+
let r = Z(e, t);
|
|
557
|
+
return /* @__PURE__ */ F("span", {
|
|
533
558
|
className: "lilt-card__pane-value",
|
|
534
|
-
children: [n ? `${n} ` : "", r === null ? "—" :
|
|
559
|
+
children: [n ? `${n} ` : "", r === null ? "—" : R(r)]
|
|
535
560
|
}, t);
|
|
536
561
|
};
|
|
537
|
-
if (n.kind === "volume") return /* @__PURE__ */
|
|
562
|
+
if (n.kind === "volume") return /* @__PURE__ */ P(K, {
|
|
538
563
|
context: r,
|
|
539
|
-
label: `${
|
|
564
|
+
label: `${S.title} volume`,
|
|
540
565
|
caption: "Volume",
|
|
541
|
-
readout: (e) => /* @__PURE__ */
|
|
566
|
+
readout: (e) => /* @__PURE__ */ P("span", {
|
|
542
567
|
className: "lilt-card__pane-value",
|
|
543
|
-
children:
|
|
568
|
+
children: Z(e, i) === null ? "—" : z(Z(e, i))
|
|
544
569
|
}),
|
|
545
|
-
height:
|
|
546
|
-
xAxis:
|
|
570
|
+
height: x,
|
|
571
|
+
xAxis: a,
|
|
547
572
|
y: {
|
|
548
573
|
includeZero: !0,
|
|
549
574
|
ticks: 2,
|
|
550
|
-
format:
|
|
575
|
+
format: z
|
|
551
576
|
},
|
|
552
577
|
bars: { series: ["volume"] },
|
|
553
578
|
series: [{
|
|
554
579
|
id: "volume",
|
|
555
580
|
label: "Volume",
|
|
556
|
-
accessor:
|
|
557
|
-
formatValue:
|
|
558
|
-
colorAt: (n) => (
|
|
581
|
+
accessor: o(i),
|
|
582
|
+
formatValue: z,
|
|
583
|
+
colorAt: (n) => (Z(n, e) ?? 0) >= (Z(n, t) ?? Z(n, e) ?? 0) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
559
584
|
bar: { radius: 1 }
|
|
560
585
|
}],
|
|
561
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ P(w, { series: "volume" })
|
|
562
587
|
}, n.id);
|
|
563
|
-
if (n.kind === "rsi") return /* @__PURE__ */
|
|
588
|
+
if (n.kind === "rsi") return /* @__PURE__ */ F(K, {
|
|
564
589
|
context: r,
|
|
565
|
-
label: `${
|
|
590
|
+
label: `${S.title} RSI ${n.period}`,
|
|
566
591
|
caption: `RSI ${n.period}`,
|
|
567
|
-
readout: (e) =>
|
|
568
|
-
height:
|
|
569
|
-
xAxis:
|
|
592
|
+
readout: (e) => s(e, n.id),
|
|
593
|
+
height: x,
|
|
594
|
+
xAxis: a,
|
|
570
595
|
y: {
|
|
571
596
|
domain: [0, 100],
|
|
572
597
|
ticks: 2,
|
|
@@ -575,66 +600,72 @@ function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlay
|
|
|
575
600
|
series: [{
|
|
576
601
|
id: n.id,
|
|
577
602
|
label: `RSI ${n.period}`,
|
|
578
|
-
accessor:
|
|
603
|
+
accessor: o(n.id),
|
|
579
604
|
color: "var(--lilt-series-1)",
|
|
580
|
-
formatValue:
|
|
581
|
-
line: {
|
|
605
|
+
formatValue: R,
|
|
606
|
+
line: {
|
|
607
|
+
width: 1.5,
|
|
608
|
+
depth: S.depth
|
|
609
|
+
}
|
|
582
610
|
}],
|
|
583
611
|
children: [
|
|
584
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ P(d, {
|
|
585
613
|
axis: "y",
|
|
586
614
|
from: 30,
|
|
587
615
|
to: 70,
|
|
588
616
|
color: "var(--lilt-series-1)"
|
|
589
617
|
}),
|
|
590
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ P(g, {
|
|
591
619
|
value: 70,
|
|
592
620
|
color: "var(--lilt-muted)"
|
|
593
621
|
}),
|
|
594
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ P(g, {
|
|
595
623
|
value: 30,
|
|
596
624
|
color: "var(--lilt-muted)"
|
|
597
625
|
}),
|
|
598
|
-
/* @__PURE__ */
|
|
626
|
+
/* @__PURE__ */ P(u, { series: n.id })
|
|
599
627
|
]
|
|
600
628
|
}, n.id);
|
|
601
|
-
let
|
|
602
|
-
return /* @__PURE__ */
|
|
629
|
+
let c = `${n.id}Macd`, l = `${n.id}Signal`, f = `${n.id}Histogram`;
|
|
630
|
+
return /* @__PURE__ */ F(K, {
|
|
603
631
|
context: r,
|
|
604
|
-
label: `${
|
|
632
|
+
label: `${S.title} MACD`,
|
|
605
633
|
caption: `MACD ${n.fast} · ${n.slow} · ${n.signal}`,
|
|
606
|
-
readout: (e) => [
|
|
607
|
-
height:
|
|
608
|
-
xAxis:
|
|
634
|
+
readout: (e) => [s(e, c), s(e, l, "Signal")],
|
|
635
|
+
height: x,
|
|
636
|
+
xAxis: a,
|
|
609
637
|
y: {
|
|
610
638
|
includeZero: !0,
|
|
611
639
|
ticks: 2,
|
|
612
|
-
format:
|
|
640
|
+
format: R
|
|
613
641
|
},
|
|
614
|
-
bars: { series: [
|
|
642
|
+
bars: { series: [f] },
|
|
615
643
|
series: [
|
|
616
644
|
{
|
|
617
|
-
id:
|
|
645
|
+
id: f,
|
|
618
646
|
label: "Histogram",
|
|
619
|
-
accessor:
|
|
620
|
-
formatValue:
|
|
621
|
-
colorAt: (e) => (
|
|
647
|
+
accessor: o(f),
|
|
648
|
+
formatValue: R,
|
|
649
|
+
colorAt: (e) => (Z(e, f) ?? 0) >= 0 ? "color-mix(in srgb, var(--lilt-candle-up) 55%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 55%, transparent)",
|
|
622
650
|
bar: { radius: 1 }
|
|
623
651
|
},
|
|
624
652
|
{
|
|
625
|
-
id:
|
|
653
|
+
id: c,
|
|
626
654
|
label: "MACD",
|
|
627
|
-
accessor:
|
|
655
|
+
accessor: o(c),
|
|
628
656
|
color: "var(--lilt-series-4)",
|
|
629
|
-
formatValue:
|
|
630
|
-
line: {
|
|
657
|
+
formatValue: R,
|
|
658
|
+
line: {
|
|
659
|
+
width: 1.5,
|
|
660
|
+
depth: S.depth
|
|
661
|
+
}
|
|
631
662
|
},
|
|
632
663
|
{
|
|
633
|
-
id:
|
|
664
|
+
id: l,
|
|
634
665
|
label: "Signal",
|
|
635
|
-
accessor: l
|
|
666
|
+
accessor: o(l),
|
|
636
667
|
color: "var(--lilt-series-3)",
|
|
637
|
-
formatValue:
|
|
668
|
+
formatValue: R,
|
|
638
669
|
line: {
|
|
639
670
|
width: 1.5,
|
|
640
671
|
dasharray: "3 3"
|
|
@@ -642,72 +673,76 @@ function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlay
|
|
|
642
673
|
}
|
|
643
674
|
],
|
|
644
675
|
children: [
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
676
|
+
/* @__PURE__ */ P(w, { series: f }),
|
|
677
|
+
/* @__PURE__ */ P(u, { series: c }),
|
|
678
|
+
/* @__PURE__ */ P(u, { series: l })
|
|
648
679
|
]
|
|
649
680
|
}, n.id);
|
|
650
681
|
};
|
|
651
|
-
return /* @__PURE__ */
|
|
652
|
-
...
|
|
653
|
-
data:
|
|
654
|
-
ranges:
|
|
655
|
-
delta:
|
|
656
|
-
valueFormat:
|
|
657
|
-
locale:
|
|
682
|
+
return /* @__PURE__ */ P(b, {
|
|
683
|
+
...S,
|
|
684
|
+
data: ee,
|
|
685
|
+
ranges: te,
|
|
686
|
+
delta: h ?? (p && t ? J(p, t, e) : void 0),
|
|
687
|
+
valueFormat: _,
|
|
688
|
+
locale: v,
|
|
658
689
|
aggregate: "last",
|
|
659
690
|
headlineSeries: e,
|
|
660
691
|
pillSeries: e,
|
|
661
692
|
tiles: !1,
|
|
662
|
-
live:
|
|
693
|
+
live: f,
|
|
663
694
|
series: [{
|
|
664
695
|
key: e,
|
|
665
|
-
label:
|
|
666
|
-
color: E === "line" ?
|
|
667
|
-
}, ...
|
|
696
|
+
label: c,
|
|
697
|
+
color: E === "line" ? W ? I : L : void 0
|
|
698
|
+
}, ...k.map((e, t) => ({
|
|
668
699
|
key: e.id,
|
|
669
700
|
label: e.label,
|
|
670
|
-
color:
|
|
701
|
+
color: ve[t % ve.length]
|
|
671
702
|
}))],
|
|
672
703
|
shape: {
|
|
673
704
|
kind: "marks",
|
|
674
|
-
id: `indicator:${E}:${
|
|
705
|
+
id: `indicator:${E}:${l}:${t}:${n}:${r}:${D}:${O}`,
|
|
675
706
|
includeZero: !1,
|
|
676
|
-
scale:
|
|
707
|
+
scale: l,
|
|
677
708
|
slots: !0,
|
|
678
|
-
xAxis:
|
|
709
|
+
xAxis: A.length === 0,
|
|
679
710
|
series: (e) => {
|
|
680
|
-
let t =
|
|
711
|
+
let t = V.get(e);
|
|
681
712
|
return t ? {
|
|
682
713
|
curve: "monotone",
|
|
683
714
|
line: {
|
|
684
715
|
width: 1.5,
|
|
685
|
-
showInspectionPoint: !1
|
|
716
|
+
showInspectionPoint: !1,
|
|
717
|
+
depth: S.depth
|
|
686
718
|
},
|
|
687
719
|
...t.kind === "bollinger" ? { fields: {
|
|
688
720
|
upper: {
|
|
689
721
|
label: "Upper",
|
|
690
|
-
accessor: (e) =>
|
|
722
|
+
accessor: (e) => Z(e, `${t.id}Upper`)
|
|
691
723
|
},
|
|
692
724
|
lower: {
|
|
693
725
|
label: "Lower",
|
|
694
|
-
accessor: (e) =>
|
|
726
|
+
accessor: (e) => Z(e, `${t.id}Lower`)
|
|
695
727
|
}
|
|
696
728
|
} } : {}
|
|
697
729
|
} : E === "line" ? {
|
|
698
|
-
fields:
|
|
730
|
+
fields: B,
|
|
699
731
|
curve: "linear",
|
|
700
|
-
line: {
|
|
701
|
-
|
|
732
|
+
line: {
|
|
733
|
+
width: 2,
|
|
734
|
+
depth: S.depth
|
|
735
|
+
}
|
|
736
|
+
} : { fields: B };
|
|
702
737
|
},
|
|
703
|
-
describe: T ?
|
|
738
|
+
describe: T ? ne(M) : void 0,
|
|
704
739
|
draw: (e) => e.map((e) => {
|
|
705
|
-
let t =
|
|
706
|
-
return t ? t.kind === "bollinger" ? [/* @__PURE__ */
|
|
740
|
+
let t = V.get(e);
|
|
741
|
+
return t ? t.kind === "bollinger" ? [/* @__PURE__ */ P(C, {
|
|
707
742
|
series: e,
|
|
708
743
|
lower: "lower",
|
|
709
744
|
upper: "upper"
|
|
710
|
-
}, `band-${e}`), /* @__PURE__ */
|
|
745
|
+
}, `band-${e}`), /* @__PURE__ */ P(u, { series: e }, `line-${e}`)] : /* @__PURE__ */ P(u, { series: e }, e) : E === "line" ? /* @__PURE__ */ P(u, { series: e }, e) : /* @__PURE__ */ P(G, {
|
|
711
746
|
series: e,
|
|
712
747
|
open: "open",
|
|
713
748
|
high: "high",
|
|
@@ -716,26 +751,26 @@ function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlay
|
|
|
716
751
|
}, e);
|
|
717
752
|
})
|
|
718
753
|
},
|
|
719
|
-
panes:
|
|
754
|
+
panes: A.length ? (e) => /* @__PURE__ */ P(N, { children: A.map((t) => re(t, e)) }) : void 0
|
|
720
755
|
});
|
|
721
756
|
}
|
|
722
757
|
//#endregion
|
|
723
758
|
//#region src/finance/cards/depth-chart-card.tsx
|
|
724
|
-
function
|
|
725
|
-
let { snapshot: n } =
|
|
759
|
+
function be({ price: e, label: t }) {
|
|
760
|
+
let { snapshot: n } = _();
|
|
726
761
|
if (e < n.xDomain[0] || e > n.xDomain[1]) return null;
|
|
727
762
|
let r = n.xToPixel(e);
|
|
728
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ F("g", {
|
|
729
764
|
className: "lilt-card__depth-mid",
|
|
730
765
|
"aria-hidden": "true",
|
|
731
|
-
children: [/* @__PURE__ */
|
|
766
|
+
children: [/* @__PURE__ */ P("line", {
|
|
732
767
|
x1: r,
|
|
733
768
|
x2: r,
|
|
734
769
|
y1: n.plot.top + 18,
|
|
735
770
|
y2: n.plot.bottom,
|
|
736
771
|
strokeDasharray: "2 4",
|
|
737
772
|
vectorEffect: "non-scaling-stroke"
|
|
738
|
-
}), /* @__PURE__ */
|
|
773
|
+
}), /* @__PURE__ */ P("text", {
|
|
739
774
|
x: r,
|
|
740
775
|
y: n.plot.top + 10,
|
|
741
776
|
textAnchor: "middle",
|
|
@@ -743,94 +778,100 @@ function ge({ price: e, label: t }) {
|
|
|
743
778
|
})]
|
|
744
779
|
});
|
|
745
780
|
}
|
|
746
|
-
var
|
|
781
|
+
var xe = {
|
|
747
782
|
style: "currency",
|
|
748
783
|
currency: "USD",
|
|
749
784
|
minimumFractionDigits: 2,
|
|
750
785
|
maximumFractionDigits: 2
|
|
751
786
|
};
|
|
752
|
-
function
|
|
753
|
-
let
|
|
787
|
+
function Se({ title: e, bids: r, asks: i, valueFormat: a = xe, sizeFormat: o, locale: s = "en-US", height: c = 220, axis: d = "minimal", background: m = "dots", hoverStyle: h = "soft", surface: g, numberStyle: _, loading: v = !1, motion: b, className: S, style: C, depth: w = !1 }) {
|
|
788
|
+
let T = j(() => pe(r, i), [r, i]), ee = JSON.stringify(a), te = JSON.stringify(o ?? null), N = j(() => y(s, a), [s, ee]), R = j(() => y(s, o), [s, te]), z = j(() => y(s, {
|
|
754
789
|
style: "percent",
|
|
755
790
|
maximumFractionDigits: 3
|
|
756
|
-
}).full, [
|
|
791
|
+
}).full, [s]), [B, V] = M(null), H = j(() => [{
|
|
757
792
|
id: "bid",
|
|
758
793
|
label: "Bids",
|
|
759
794
|
accessor: (e) => e.bid,
|
|
760
|
-
color:
|
|
795
|
+
color: I,
|
|
761
796
|
curve: "step-before",
|
|
762
797
|
area: { treatment: "fade" },
|
|
763
|
-
line: {
|
|
764
|
-
|
|
798
|
+
line: {
|
|
799
|
+
width: 1.5,
|
|
800
|
+
depth: w
|
|
801
|
+
},
|
|
802
|
+
formatValue: R.full
|
|
765
803
|
}, {
|
|
766
804
|
id: "ask",
|
|
767
805
|
label: "Asks",
|
|
768
806
|
accessor: (e) => e.ask,
|
|
769
|
-
color:
|
|
807
|
+
color: L,
|
|
770
808
|
curve: "step-after",
|
|
771
809
|
area: { treatment: "fade" },
|
|
772
|
-
line: {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
810
|
+
line: {
|
|
811
|
+
width: 1.5,
|
|
812
|
+
depth: w
|
|
813
|
+
},
|
|
814
|
+
formatValue: R.full
|
|
815
|
+
}], [R, w]), U = T.spread !== null && T.mid ? `${N.full(T.spread)} (${z(T.spread / T.mid)})` : "—", W = B ? B.bid ?? B.ask : null;
|
|
816
|
+
return /* @__PURE__ */ F(A, {
|
|
817
|
+
"aria-label": e,
|
|
818
|
+
surface: g,
|
|
819
|
+
numberStyle: _,
|
|
820
|
+
motion: b,
|
|
780
821
|
className: ["lilt-card--depth", S].filter(Boolean).join(" "),
|
|
781
|
-
style:
|
|
822
|
+
style: C,
|
|
782
823
|
children: [
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
value:
|
|
785
|
-
format:
|
|
786
|
-
loading:
|
|
787
|
-
motion:
|
|
788
|
-
children:
|
|
789
|
-
|
|
824
|
+
/* @__PURE__ */ F(k, { children: [/* @__PURE__ */ P(O, { children: e }), /* @__PURE__ */ P(D, {
|
|
825
|
+
value: T.mid,
|
|
826
|
+
format: N.full,
|
|
827
|
+
loading: v,
|
|
828
|
+
motion: b,
|
|
829
|
+
children: v ? null : B && W !== null ? /* @__PURE__ */ F(E, { children: [
|
|
830
|
+
R.full(W),
|
|
790
831
|
" ",
|
|
791
|
-
|
|
832
|
+
B.side === "bid" ? "bid" : "ask",
|
|
792
833
|
" depth at",
|
|
793
834
|
" ",
|
|
794
|
-
|
|
795
|
-
] }) : /* @__PURE__ */
|
|
835
|
+
N.full(B.price)
|
|
836
|
+
] }) : /* @__PURE__ */ P(E, { children: "Mid price" })
|
|
796
837
|
})] }),
|
|
797
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ F("dl", {
|
|
798
839
|
className: "lilt-card__stats",
|
|
799
840
|
children: [
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("dt", { children: "Spread" }), /* @__PURE__ */ P("dd", { children: v ? "—" : U })] }),
|
|
842
|
+
/* @__PURE__ */ F("div", {
|
|
802
843
|
"data-side": "bid",
|
|
803
|
-
children: [/* @__PURE__ */
|
|
844
|
+
children: [/* @__PURE__ */ P("dt", { children: "Bid depth" }), /* @__PURE__ */ P("dd", { children: v ? "—" : R.compact(T.bidDepth) })]
|
|
804
845
|
}),
|
|
805
|
-
/* @__PURE__ */
|
|
846
|
+
/* @__PURE__ */ F("div", {
|
|
806
847
|
"data-side": "ask",
|
|
807
|
-
children: [/* @__PURE__ */
|
|
848
|
+
children: [/* @__PURE__ */ P("dt", { children: "Ask depth" }), /* @__PURE__ */ P("dd", { children: v ? "—" : R.compact(T.askDepth) })]
|
|
808
849
|
})
|
|
809
850
|
]
|
|
810
851
|
}),
|
|
811
|
-
/* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ P(f, {
|
|
812
853
|
className: "lilt-card__chart",
|
|
813
|
-
"aria-label": `${
|
|
814
|
-
data:
|
|
854
|
+
"aria-label": `${e} depth by price`,
|
|
855
|
+
data: T.levels,
|
|
815
856
|
x: {
|
|
816
857
|
type: "number",
|
|
817
858
|
accessor: (e) => e.price,
|
|
818
|
-
format:
|
|
859
|
+
format: N.full
|
|
819
860
|
},
|
|
820
861
|
y: {
|
|
821
862
|
includeZero: !0,
|
|
822
863
|
ticks: 3,
|
|
823
|
-
format:
|
|
864
|
+
format: R.compact
|
|
824
865
|
},
|
|
825
|
-
series:
|
|
826
|
-
onSelectionChange: (e) =>
|
|
827
|
-
motion:
|
|
828
|
-
status:
|
|
829
|
-
children: /* @__PURE__ */
|
|
830
|
-
height:
|
|
831
|
-
axis:
|
|
832
|
-
background:
|
|
833
|
-
pill:
|
|
866
|
+
series: H,
|
|
867
|
+
onSelectionChange: (e) => V(e?.row ?? null),
|
|
868
|
+
motion: b,
|
|
869
|
+
status: v ? "loading" : "ready",
|
|
870
|
+
children: /* @__PURE__ */ F(n, {
|
|
871
|
+
height: c,
|
|
872
|
+
axis: d,
|
|
873
|
+
background: m,
|
|
874
|
+
pill: h,
|
|
834
875
|
margins: {
|
|
835
876
|
top: 8,
|
|
836
877
|
right: 4,
|
|
@@ -838,17 +879,17 @@ function ve({ title: t, bids: r, asks: a, valueFormat: o = _e, sizeFormat: s, lo
|
|
|
838
879
|
left: 4
|
|
839
880
|
},
|
|
840
881
|
children: [
|
|
841
|
-
/* @__PURE__ */
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
/* @__PURE__ */
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
846
|
-
|
|
847
|
-
price:
|
|
848
|
-
label: `Mid ${
|
|
882
|
+
/* @__PURE__ */ P(x, { pattern: "lines" }),
|
|
883
|
+
/* @__PURE__ */ P(t, { series: "bid" }),
|
|
884
|
+
/* @__PURE__ */ P(t, { series: "ask" }),
|
|
885
|
+
/* @__PURE__ */ P(u, { series: "bid" }),
|
|
886
|
+
/* @__PURE__ */ P(u, { series: "ask" }),
|
|
887
|
+
T.mid === null ? null : /* @__PURE__ */ P(be, {
|
|
888
|
+
price: T.mid,
|
|
889
|
+
label: `Mid ${N.full(T.mid)}`
|
|
849
890
|
}),
|
|
850
|
-
/* @__PURE__ */
|
|
851
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ P(p, { labels: "fit" }),
|
|
892
|
+
/* @__PURE__ */ P(l, {})
|
|
852
893
|
]
|
|
853
894
|
})
|
|
854
895
|
})
|
|
@@ -857,76 +898,76 @@ function ve({ title: t, bids: r, asks: a, valueFormat: o = _e, sizeFormat: s, lo
|
|
|
857
898
|
}
|
|
858
899
|
//#endregion
|
|
859
900
|
//#region src/finance/cards/portfolio-chart-card.tsx
|
|
860
|
-
function
|
|
901
|
+
function Q(e, t) {
|
|
861
902
|
if (!t) return null;
|
|
862
903
|
let n = e[t];
|
|
863
904
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
864
905
|
}
|
|
865
|
-
function
|
|
866
|
-
let r = e.at(-1), i =
|
|
906
|
+
function Ce(e, t, n) {
|
|
907
|
+
let r = e.at(-1), i = Q(r, t), a = Q(r, n);
|
|
867
908
|
return i !== null && a ? i / a - 1 : void 0;
|
|
868
909
|
}
|
|
869
|
-
function
|
|
870
|
-
let f = o ?? s?.[0]?.data ?? [], p =
|
|
871
|
-
...
|
|
872
|
-
delta:
|
|
910
|
+
function we({ value: e, basis: n, label: r = "Value", drawdown: i = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...d }) {
|
|
911
|
+
let f = o ?? s?.[0]?.data ?? [], p = j(() => s?.map((t) => ({
|
|
912
|
+
...t,
|
|
913
|
+
delta: t.delta ?? Ce(t.data, e, n)
|
|
873
914
|
})), [
|
|
874
915
|
s,
|
|
875
916
|
e,
|
|
876
|
-
|
|
877
|
-
]), m =
|
|
917
|
+
n
|
|
918
|
+
]), m = j(() => y(l, {
|
|
878
919
|
style: "percent",
|
|
879
920
|
minimumFractionDigits: 1,
|
|
880
921
|
maximumFractionDigits: 1
|
|
881
|
-
}).full, [l]),
|
|
882
|
-
let t =
|
|
922
|
+
}).full, [l]), h = j(() => {
|
|
923
|
+
let t = ue(f.map((t) => Q(t, e))).filter((e) => e !== null);
|
|
883
924
|
return t.length ? Math.min(...t) : null;
|
|
884
925
|
}, [f, e]);
|
|
885
|
-
return /* @__PURE__ */
|
|
886
|
-
...
|
|
926
|
+
return /* @__PURE__ */ P(b, {
|
|
927
|
+
...d,
|
|
887
928
|
data: o,
|
|
888
929
|
ranges: p,
|
|
889
|
-
delta: c ?? (o ?
|
|
930
|
+
delta: c ?? (o ? Ce(o, e, n) : void 0),
|
|
890
931
|
locale: l,
|
|
891
932
|
aggregate: "last",
|
|
892
933
|
headlineSeries: e,
|
|
893
934
|
pillSeries: e,
|
|
894
935
|
tiles: !1,
|
|
895
|
-
restCaption:
|
|
936
|
+
restCaption: n ? () => "over basis" : void 0,
|
|
896
937
|
series: [{
|
|
897
938
|
key: e,
|
|
898
|
-
label:
|
|
899
|
-
}, ...
|
|
900
|
-
key:
|
|
939
|
+
label: r
|
|
940
|
+
}, ...n ? [{
|
|
941
|
+
key: n,
|
|
901
942
|
label: "Basis",
|
|
902
943
|
dashed: !0
|
|
903
944
|
}] : []],
|
|
904
945
|
shape: {
|
|
905
946
|
kind: "marks",
|
|
906
|
-
id: `portfolio:${e}:${
|
|
947
|
+
id: `portfolio:${e}:${n}:${i}`,
|
|
907
948
|
includeZero: !1,
|
|
908
|
-
xAxis: !
|
|
909
|
-
series: (e) => e ===
|
|
949
|
+
xAxis: !i,
|
|
950
|
+
series: (e) => e === n ? {
|
|
910
951
|
curve: "step-after",
|
|
911
952
|
color: "var(--lilt-muted)"
|
|
912
953
|
} : {
|
|
913
954
|
area: { treatment: "fade" },
|
|
914
955
|
curve: "monotone"
|
|
915
956
|
},
|
|
916
|
-
draw: (e) => e.map((e) => [/* @__PURE__ */
|
|
957
|
+
draw: (e) => e.map((e) => [/* @__PURE__ */ P(t, { series: e }, `area-${e}`), /* @__PURE__ */ P(u, { series: e }, e)])
|
|
917
958
|
},
|
|
918
|
-
panes:
|
|
919
|
-
let
|
|
920
|
-
return /* @__PURE__ */
|
|
921
|
-
context:
|
|
922
|
-
label: `${
|
|
959
|
+
panes: i ? (n) => {
|
|
960
|
+
let r = ue(n.data.map((t) => Q(t, e))), i = new Map(n.data.map((e, t) => [e, r[t] ?? null]));
|
|
961
|
+
return /* @__PURE__ */ F(K, {
|
|
962
|
+
context: n,
|
|
963
|
+
label: `${d.title} drawdown`,
|
|
923
964
|
caption: "Drawdown",
|
|
924
|
-
readout: (e) => /* @__PURE__ */
|
|
965
|
+
readout: (e) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("span", {
|
|
925
966
|
className: "lilt-card__pane-value",
|
|
926
|
-
children:
|
|
927
|
-
}),
|
|
967
|
+
children: i.get(e) == null ? "—" : m(i.get(e))
|
|
968
|
+
}), h === null ? null : /* @__PURE__ */ F("span", {
|
|
928
969
|
className: "lilt-card__pane-value",
|
|
929
|
-
children: ["Max ", m(
|
|
970
|
+
children: ["Max ", m(h)]
|
|
930
971
|
})] }),
|
|
931
972
|
height: a,
|
|
932
973
|
xAxis: !0,
|
|
@@ -938,125 +979,125 @@ function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdown
|
|
|
938
979
|
series: [{
|
|
939
980
|
id: "drawdown",
|
|
940
981
|
label: "Drawdown",
|
|
941
|
-
accessor: (e) =>
|
|
982
|
+
accessor: (e) => i.get(e) ?? null,
|
|
942
983
|
color: "var(--lilt-candle-down)",
|
|
943
984
|
formatValue: m,
|
|
944
985
|
area: { treatment: "fade" },
|
|
945
986
|
line: { width: 1.5 },
|
|
946
987
|
curve: "monotone"
|
|
947
988
|
}],
|
|
948
|
-
children: [/* @__PURE__ */
|
|
989
|
+
children: [/* @__PURE__ */ P(t, { series: "drawdown" }), /* @__PURE__ */ P(u, { series: "drawdown" })]
|
|
949
990
|
});
|
|
950
991
|
} : void 0
|
|
951
992
|
});
|
|
952
993
|
}
|
|
953
994
|
//#endregion
|
|
954
995
|
//#region src/finance/cards/price-chart-card.tsx
|
|
955
|
-
function
|
|
996
|
+
function Te(e, t) {
|
|
956
997
|
let n = e[t];
|
|
957
998
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
958
999
|
}
|
|
959
|
-
function
|
|
960
|
-
let n = e.map((e) =>
|
|
1000
|
+
function $(e, t) {
|
|
1001
|
+
let n = e.map((e) => Te(e, t)).filter((e) => e !== null);
|
|
961
1002
|
return n.length > 1 ? {
|
|
962
1003
|
first: n[0],
|
|
963
1004
|
last: n.at(-1)
|
|
964
1005
|
} : null;
|
|
965
1006
|
}
|
|
966
|
-
function
|
|
1007
|
+
function Ee(e, t) {
|
|
967
1008
|
let n = e.map((e) => ({ ...e }));
|
|
968
|
-
for (let r of t)
|
|
1009
|
+
for (let r of t) de(e.map((e) => Te(e, r))).forEach((e, t) => n[t][`__rebased${r}`] = e);
|
|
969
1010
|
return n;
|
|
970
1011
|
}
|
|
971
|
-
var
|
|
1012
|
+
var De = {
|
|
972
1013
|
style: "currency",
|
|
973
1014
|
currency: "USD",
|
|
974
1015
|
minimumFractionDigits: 2,
|
|
975
1016
|
maximumFractionDigits: 2
|
|
976
1017
|
};
|
|
977
|
-
function
|
|
978
|
-
let
|
|
1018
|
+
function Oe({ price: e, symbol: n, name: r, icon: i, display: a = "area", versus: o, data: s, ranges: c, delta: l, valueFormat: d = De, locale: f = "en-US", title: p, ...h }) {
|
|
1019
|
+
let g = !!o?.length, _ = j(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), v = j(() => s ? g ? Ee(s, _) : s : void 0, [
|
|
979
1020
|
s,
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
]), x =
|
|
983
|
-
let n =
|
|
1021
|
+
g,
|
|
1022
|
+
_
|
|
1023
|
+
]), x = j(() => c?.map((t) => {
|
|
1024
|
+
let n = $(t.data, e);
|
|
984
1025
|
return {
|
|
985
1026
|
...t,
|
|
986
|
-
data:
|
|
1027
|
+
data: g ? Ee(t.data, _) : t.data,
|
|
987
1028
|
delta: t.delta ?? (n && n.first ? n.last / n.first - 1 : void 0)
|
|
988
1029
|
};
|
|
989
1030
|
}), [
|
|
990
1031
|
c,
|
|
991
|
-
|
|
992
|
-
|
|
1032
|
+
g,
|
|
1033
|
+
_,
|
|
993
1034
|
e
|
|
994
|
-
]), S =
|
|
1035
|
+
]), S = $(s ?? c?.[0]?.data ?? [], e), C = !S || S.last >= S.first, w = j(() => y(f, d).full, [f, JSON.stringify(d)]), T = j(() => y(f, {
|
|
995
1036
|
style: "percent",
|
|
996
1037
|
minimumFractionDigits: 1,
|
|
997
1038
|
maximumFractionDigits: 1
|
|
998
|
-
}).full, [
|
|
1039
|
+
}).full, [f]), E = (e) => g ? `__rebased${e}` : e, D = /* @__PURE__ */ F("span", {
|
|
999
1040
|
className: "lilt-card__ticker",
|
|
1000
1041
|
children: [
|
|
1001
|
-
|
|
1042
|
+
i ? /* @__PURE__ */ P("span", {
|
|
1002
1043
|
className: "lilt-card__ticker-icon",
|
|
1003
|
-
children:
|
|
1044
|
+
children: i
|
|
1004
1045
|
}) : null,
|
|
1005
|
-
/* @__PURE__ */
|
|
1046
|
+
/* @__PURE__ */ P("span", {
|
|
1006
1047
|
className: "lilt-card__ticker-symbol",
|
|
1007
|
-
children:
|
|
1048
|
+
children: n ?? p
|
|
1008
1049
|
}),
|
|
1009
|
-
|
|
1050
|
+
r ? /* @__PURE__ */ P("span", {
|
|
1010
1051
|
className: "lilt-card__ticker-name",
|
|
1011
|
-
children:
|
|
1052
|
+
children: r
|
|
1012
1053
|
}) : null
|
|
1013
1054
|
]
|
|
1014
1055
|
});
|
|
1015
|
-
return /* @__PURE__ */
|
|
1016
|
-
...
|
|
1017
|
-
title:
|
|
1056
|
+
return /* @__PURE__ */ P(b, {
|
|
1057
|
+
...h,
|
|
1058
|
+
title: p,
|
|
1018
1059
|
heading: D,
|
|
1019
|
-
data:
|
|
1060
|
+
data: v,
|
|
1020
1061
|
ranges: x,
|
|
1021
|
-
delta:
|
|
1022
|
-
valueFormat:
|
|
1062
|
+
delta: g ? void 0 : l ?? (s && S && S.first ? S.last / S.first - 1 : void 0),
|
|
1063
|
+
valueFormat: g ? {
|
|
1023
1064
|
style: "percent",
|
|
1024
1065
|
maximumFractionDigits: 1
|
|
1025
|
-
} :
|
|
1026
|
-
formatValue:
|
|
1027
|
-
locale:
|
|
1066
|
+
} : d,
|
|
1067
|
+
formatValue: g ? (e) => m(T)(e) : void 0,
|
|
1068
|
+
locale: f,
|
|
1028
1069
|
aggregate: "last",
|
|
1029
1070
|
headlineSeries: E(e),
|
|
1030
|
-
pillSeries:
|
|
1031
|
-
tiles:
|
|
1032
|
-
restCaption:
|
|
1033
|
-
let n =
|
|
1034
|
-
return n ?
|
|
1071
|
+
pillSeries: g ? "nearest" : E(e),
|
|
1072
|
+
tiles: g,
|
|
1073
|
+
restCaption: g ? void 0 : (t) => {
|
|
1074
|
+
let n = $(t, e);
|
|
1075
|
+
return n ? m(w)(n.last - n.first) : null;
|
|
1035
1076
|
},
|
|
1036
1077
|
series: [{
|
|
1037
1078
|
key: E(e),
|
|
1038
|
-
label:
|
|
1039
|
-
color:
|
|
1079
|
+
label: n ?? p,
|
|
1080
|
+
color: g ? void 0 : C ? I : L
|
|
1040
1081
|
}, ...(o ?? []).map((e) => ({
|
|
1041
1082
|
...e,
|
|
1042
1083
|
key: E(e.key)
|
|
1043
1084
|
}))],
|
|
1044
1085
|
shape: {
|
|
1045
1086
|
kind: "marks",
|
|
1046
|
-
id: `price:${a}:${
|
|
1047
|
-
includeZero:
|
|
1048
|
-
series: () => a === "area" && !
|
|
1087
|
+
id: `price:${a}:${_.join()}:${g}`,
|
|
1088
|
+
includeZero: g,
|
|
1089
|
+
series: () => a === "area" && !g ? {
|
|
1049
1090
|
area: { treatment: "fade" },
|
|
1050
1091
|
curve: "monotone"
|
|
1051
1092
|
} : { curve: "monotone" },
|
|
1052
|
-
draw: (e) => e.map((e) => a === "area" && !
|
|
1093
|
+
draw: (e) => e.map((e) => a === "area" && !g ? [/* @__PURE__ */ P(t, { series: e }, `area-${e}`), /* @__PURE__ */ P(u, { series: e }, e)] : /* @__PURE__ */ P(u, { series: e }, e))
|
|
1053
1094
|
},
|
|
1054
|
-
bleed:
|
|
1095
|
+
bleed: h.bleed ?? !0
|
|
1055
1096
|
});
|
|
1056
1097
|
}
|
|
1057
1098
|
//#endregion
|
|
1058
1099
|
//#region src/finance/order-book.tsx
|
|
1059
|
-
function
|
|
1100
|
+
function ke(e, t, n) {
|
|
1060
1101
|
let r = /* @__PURE__ */ new Map();
|
|
1061
1102
|
for (let t of e) Number.isFinite(t.price) && Number.isFinite(t.size) && t.size > 0 && r.set(t.price, (r.get(t.price) ?? 0) + t.size);
|
|
1062
1103
|
let i = [...r].map(([e, t]) => ({
|
|
@@ -1069,9 +1110,9 @@ function Ee(e, t, n) {
|
|
|
1069
1110
|
side: t
|
|
1070
1111
|
}));
|
|
1071
1112
|
}
|
|
1072
|
-
function
|
|
1073
|
-
let n =
|
|
1074
|
-
return
|
|
1113
|
+
function Ae(e, t) {
|
|
1114
|
+
let n = te(null), [r, i] = M(/* @__PURE__ */ new Set());
|
|
1115
|
+
return ee(() => {
|
|
1075
1116
|
let r = new Map(e.map((e) => [`${e.side}:${e.price}`, e.size])), a = n.current;
|
|
1076
1117
|
if (n.current = r, !t || !a) return;
|
|
1077
1118
|
let o = new Set([...r].filter(([e, t]) => a.get(e) !== t).map(([e]) => e));
|
|
@@ -1081,78 +1122,82 @@ function De(e, t) {
|
|
|
1081
1122
|
return () => window.clearTimeout(s);
|
|
1082
1123
|
}, [e, t]), r;
|
|
1083
1124
|
}
|
|
1084
|
-
function
|
|
1125
|
+
function je({ title: e, bids: t, asks: n, levels: r = 8, depth: i = !1, valueFormat: a = {
|
|
1085
1126
|
minimumFractionDigits: 2,
|
|
1086
1127
|
maximumFractionDigits: 2
|
|
1087
|
-
}, sizeFormat:
|
|
1088
|
-
let
|
|
1128
|
+
}, sizeFormat: o, locale: s = "en-US", flash: c = !0, surface: l, motion: u, className: d, style: f }) {
|
|
1129
|
+
let p = T(u ?? "auto"), m = JSON.stringify(a), h = JSON.stringify(o ?? null), g = j(() => y(s, a).full, [s, m]), _ = j(() => y(s, o).compact, [s, h]), v = j(() => y(s, {
|
|
1089
1130
|
style: "percent",
|
|
1090
1131
|
maximumFractionDigits: 3
|
|
1091
|
-
}).full, [
|
|
1092
|
-
value:
|
|
1093
|
-
mid: (
|
|
1094
|
-
} : null, O = (e) => /* @__PURE__ */
|
|
1132
|
+
}).full, [s]), b = j(() => ke(t, "bid", r), [t, r]), x = j(() => ke(n, "ask", r), [n, r]), S = Ae(j(() => [...x, ...b], [x, b]), c && !p), C = Math.max(1, x.at(-1)?.total ?? 0, b.at(-1)?.total ?? 0), w = b[0]?.price, E = x[0]?.price, D = w !== void 0 && E !== void 0 ? {
|
|
1133
|
+
value: E - w,
|
|
1134
|
+
mid: (E + w) / 2
|
|
1135
|
+
} : null, O = (e) => /* @__PURE__ */ F("tr", {
|
|
1095
1136
|
className: "lilt-order-book__level",
|
|
1096
1137
|
"data-side": e.side,
|
|
1097
|
-
"data-flash":
|
|
1138
|
+
"data-flash": S.has(`${e.side}:${e.price}`) || void 0,
|
|
1098
1139
|
style: { "--lilt-depth": `${e.total / C * 100}%` },
|
|
1099
1140
|
children: [
|
|
1100
|
-
/* @__PURE__ */
|
|
1141
|
+
/* @__PURE__ */ F("th", {
|
|
1101
1142
|
scope: "row",
|
|
1102
|
-
children:
|
|
1143
|
+
children: [i ? /* @__PURE__ */ P("span", {
|
|
1144
|
+
className: "lilt-order-book__bar",
|
|
1145
|
+
"aria-hidden": "true"
|
|
1146
|
+
}) : null, g(e.price)]
|
|
1103
1147
|
}),
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1148
|
+
/* @__PURE__ */ P("td", { children: _(e.size) }),
|
|
1149
|
+
/* @__PURE__ */ P("td", { children: _(e.total) })
|
|
1106
1150
|
]
|
|
1107
1151
|
}, `${e.side}:${e.price}`);
|
|
1108
|
-
return /* @__PURE__ */
|
|
1152
|
+
return /* @__PURE__ */ P(A, {
|
|
1109
1153
|
"aria-label": e,
|
|
1110
|
-
surface:
|
|
1111
|
-
motion:
|
|
1112
|
-
className: ["lilt-card--order-book",
|
|
1113
|
-
style:
|
|
1114
|
-
children: /* @__PURE__ */
|
|
1154
|
+
surface: l,
|
|
1155
|
+
motion: u,
|
|
1156
|
+
className: ["lilt-card--order-book", d].filter(Boolean).join(" "),
|
|
1157
|
+
style: f,
|
|
1158
|
+
children: /* @__PURE__ */ F("table", {
|
|
1115
1159
|
className: "lilt-order-book",
|
|
1160
|
+
"data-depth": i || void 0,
|
|
1116
1161
|
children: [
|
|
1117
|
-
/* @__PURE__ */
|
|
1118
|
-
/* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1162
|
+
/* @__PURE__ */ P("caption", { children: e }),
|
|
1163
|
+
/* @__PURE__ */ P("thead", { children: /* @__PURE__ */ F("tr", { children: [
|
|
1164
|
+
/* @__PURE__ */ P("th", {
|
|
1120
1165
|
scope: "col",
|
|
1121
1166
|
children: "Price"
|
|
1122
1167
|
}),
|
|
1123
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ P("th", {
|
|
1124
1169
|
scope: "col",
|
|
1125
1170
|
children: "Size"
|
|
1126
1171
|
}),
|
|
1127
|
-
/* @__PURE__ */
|
|
1172
|
+
/* @__PURE__ */ P("th", {
|
|
1128
1173
|
scope: "col",
|
|
1129
1174
|
children: "Total"
|
|
1130
1175
|
})
|
|
1131
1176
|
] }) }),
|
|
1132
|
-
/* @__PURE__ */
|
|
1177
|
+
/* @__PURE__ */ P("tbody", {
|
|
1133
1178
|
"aria-label": "Asks",
|
|
1134
|
-
children: [...
|
|
1179
|
+
children: [...x].reverse().map(O)
|
|
1135
1180
|
}),
|
|
1136
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ P("tbody", {
|
|
1137
1182
|
"aria-label": "Spread",
|
|
1138
|
-
children: /* @__PURE__ */
|
|
1183
|
+
children: /* @__PURE__ */ F("tr", {
|
|
1139
1184
|
className: "lilt-order-book__spread",
|
|
1140
|
-
children: [/* @__PURE__ */
|
|
1185
|
+
children: [/* @__PURE__ */ P("th", {
|
|
1141
1186
|
scope: "row",
|
|
1142
|
-
children:
|
|
1143
|
-
}), /* @__PURE__ */
|
|
1187
|
+
children: D ? g(D.mid) : "—"
|
|
1188
|
+
}), /* @__PURE__ */ P("td", {
|
|
1144
1189
|
colSpan: 2,
|
|
1145
|
-
children:
|
|
1190
|
+
children: D ? `Spread ${g(D.value)} · ${v(D.value / D.mid)}` : "No spread"
|
|
1146
1191
|
})]
|
|
1147
1192
|
})
|
|
1148
1193
|
}),
|
|
1149
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ P("tbody", {
|
|
1150
1195
|
"aria-label": "Bids",
|
|
1151
|
-
children:
|
|
1196
|
+
children: b.map(O)
|
|
1152
1197
|
})
|
|
1153
1198
|
]
|
|
1154
1199
|
})
|
|
1155
1200
|
});
|
|
1156
1201
|
}
|
|
1157
1202
|
//#endregion
|
|
1158
|
-
export {
|
|
1203
|
+
export { G as Candles, ie as CandlestickChartCard, Se as DepthChartCard, ye as IndicatorChartCard, je as OrderBook, we as PortfolioChartCard, Oe as PriceChartCard, le as bollinger, pe as depthLevels, ue as drawdown, X as ema, ce as macd, de as rebase, se as rsi, oe as sma };
|