@lilt-ui/charts 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/activity-ring.d.ts +4 -1
- package/dist/chart-context.d.ts +1 -1
- package/dist/engine/lifecycle.d.ts +2 -2
- package/dist/finance.js +382 -378
- package/dist/index.js +2599 -2547
- package/dist/lifecycle/skeleton-exit.d.ts +28 -0
- package/dist/{skeleton-block-Bs6JLXVq.js → skeleton-block-9CpTCbZr.js} +2298 -2269
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/finance.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as e, C as t, I as n, J as r, L as i, P as a,
|
|
3
|
-
import { S as
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { min as
|
|
2
|
+
import { A as e, C as t, I as n, J as r, L as i, P as a, R as o, S as s, T as c, X as l, Y as u, _ as d, _t as f, a as p, b as m, ct as h, et as g, f as _, i as v, it as y, n as b, q as x, t as S, u as C, v as w, w as T, x as E, y as D, z as O } from "./skeleton-block-9CpTCbZr.js";
|
|
3
|
+
import { S as k, d as A, g as ee, h as te, p as j, u as M } from "./report-context-CkzH-r8B.js";
|
|
4
|
+
import { useEffect as N, useMemo as P, useRef as F, useState as I } from "react";
|
|
5
|
+
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
6
|
+
import { min as B } from "d3-array";
|
|
7
7
|
//#region src/finance/candle-geometry.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var V = "var(--lilt-candle-up)", H = "var(--lilt-candle-down)";
|
|
9
|
+
function U(e) {
|
|
10
10
|
return Math.round(e * 100) / 100;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function W(e, t, n) {
|
|
13
13
|
let r = e.fields[t], i = r?.[n.open], a = r?.[n.high], o = r?.[n.low], s = e.values[t];
|
|
14
14
|
return i == null || a == null || o == null || s == null ? null : {
|
|
15
15
|
open: i,
|
|
@@ -19,22 +19,22 @@ function U(e, t, n) {
|
|
|
19
19
|
up: s >= i
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function G(e, t, n) {
|
|
23
23
|
for (let r of e) {
|
|
24
|
-
let e =
|
|
24
|
+
let e = W(r, t, n);
|
|
25
25
|
if (!e) continue;
|
|
26
26
|
let i = Math.max(e.open, e.close), a = Math.min(e.open, e.close);
|
|
27
27
|
if (e.high < i || e.low > a) throw Error(`Lilt Candles on series "${t}" expects low ≤ open, close ≤ high at row ${r.sourceIndex + 1}.`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
let o = Math.max(1, n.columnWidth), s = o / 2, c =
|
|
30
|
+
function K(e, t, n, r, i = !1) {
|
|
31
|
+
let o = Math.max(1, n.columnWidth), s = o / 2, c = U(e), l = U(n.y(t.high)), u = U(n.y(t.low));
|
|
32
32
|
if (r === "ohlc") {
|
|
33
|
-
let r =
|
|
33
|
+
let r = U(n.y(t.open)), i = U(n.y(t.close)), a = U(Math.max(2, s));
|
|
34
34
|
return {
|
|
35
35
|
body: null,
|
|
36
36
|
hollow: null,
|
|
37
|
-
stroke: `M${c},${l}V${u}M${
|
|
37
|
+
stroke: `M${c},${l}V${u}M${U(e - a)},${r}H${c}M${c},${i}H${U(e + a)}`,
|
|
38
38
|
side: null,
|
|
39
39
|
top: null
|
|
40
40
|
};
|
|
@@ -44,25 +44,25 @@ function G(e, t, n, r, i = !1) {
|
|
|
44
44
|
let e = (d + f) / 2;
|
|
45
45
|
d = e - .5, f = e + .5;
|
|
46
46
|
}
|
|
47
|
-
let p = r === "hollow" && t.up && o >= 3, m = p ? .5 : 0, h = i ?
|
|
47
|
+
let p = r === "hollow" && t.up && o >= 3, m = p ? .5 : 0, h = i ? y(e, d, o, f - d) : null, g = h ? e - h.frontWidth / 2 : e - s, _ = a(g + m, d + m, Math.max(1, (h ? h.frontWidth : o) - m * 2), Math.max(1, f - d - m * 2), !h && o >= 6 ? 1.5 : 0), v = (l < d ? `M${c},${l}V${U(d)}` : "") + (u > f ? `M${c},${U(f)}V${u}` : "");
|
|
48
48
|
return {
|
|
49
|
-
body: p ? null :
|
|
50
|
-
hollow: p ?
|
|
51
|
-
stroke:
|
|
49
|
+
body: p ? null : _,
|
|
50
|
+
hollow: p ? _ : null,
|
|
51
|
+
stroke: v,
|
|
52
52
|
side: h?.side ?? null,
|
|
53
53
|
top: h?.top ?? null
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
let
|
|
58
|
-
for (let { row:
|
|
59
|
-
let e =
|
|
56
|
+
function ne(t, n, r, i, a, o, s = !1) {
|
|
57
|
+
let l = new c(), u = new c(), d = new c(), f = new c(), p = new c();
|
|
58
|
+
for (let { row: c, cx: m } of e(t, i)) {
|
|
59
|
+
let e = W(c, n, r);
|
|
60
60
|
if (!e) continue;
|
|
61
|
-
let t = o(
|
|
62
|
-
h.side && f.add(t, h.side), h.top && p.add(t, h.top), h.body &&
|
|
61
|
+
let t = o(c, e), h = K(m, e, i, a, s);
|
|
62
|
+
h.side && f.add(t, h.side), h.top && p.add(t, h.top), h.body && l.add(t, h.body), h.hollow && u.add(t, h.hollow), h.stroke && d.add(t, h.stroke);
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
65
|
-
bodies:
|
|
65
|
+
bodies: l.entries(),
|
|
66
66
|
hollow: u.entries(),
|
|
67
67
|
strokes: d.entries(),
|
|
68
68
|
sides: f.entries(),
|
|
@@ -71,32 +71,32 @@ function K(t, n, r, i, a, o, s = !1) {
|
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/finance/candles.tsx
|
|
74
|
-
function
|
|
75
|
-
return
|
|
74
|
+
function re(e, t, n) {
|
|
75
|
+
return O(e, t, n.up ? V : H);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ie({ paths: e, display: t }) {
|
|
78
78
|
let n = t === "ohlc" ? 1.5 : 1;
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ z(L, { children: [
|
|
80
|
+
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */ R("path", {
|
|
81
81
|
d: r,
|
|
82
82
|
fill: "none",
|
|
83
83
|
strokeWidth: n,
|
|
84
84
|
strokeLinecap: t === "ohlc" ? "round" : "butt",
|
|
85
85
|
style: { stroke: e }
|
|
86
86
|
}, `stroke-${e}`)),
|
|
87
|
-
e.sides.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
87
|
+
e.sides.map(({ color: e, d: t }) => /* @__PURE__ */ R("path", {
|
|
88
88
|
d: t,
|
|
89
|
-
style: { fill:
|
|
89
|
+
style: { fill: g(e).side }
|
|
90
90
|
}, `side-${e}`)),
|
|
91
|
-
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
91
|
+
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */ R("path", {
|
|
92
92
|
d: t,
|
|
93
|
-
style: { fill:
|
|
93
|
+
style: { fill: g(e).top }
|
|
94
94
|
}, `top-${e}`)),
|
|
95
|
-
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
95
|
+
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */ R("path", {
|
|
96
96
|
d: t,
|
|
97
97
|
style: { fill: e }
|
|
98
98
|
}, `body-${e}`)),
|
|
99
|
-
e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
99
|
+
e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */ R("path", {
|
|
100
100
|
d: t,
|
|
101
101
|
strokeWidth: 1,
|
|
102
102
|
style: {
|
|
@@ -106,43 +106,43 @@ function ne({ paths: e, display: t }) {
|
|
|
106
106
|
}, `hollow-${e}`))
|
|
107
107
|
] });
|
|
108
108
|
}
|
|
109
|
-
var
|
|
110
|
-
let
|
|
109
|
+
var ae = o(function({ series: e, open: t, high: n, low: r, display: i = "candle", depth: a = !1, className: o }) {
|
|
110
|
+
let s = T("Candles", e, [
|
|
111
111
|
t,
|
|
112
112
|
n,
|
|
113
|
-
|
|
114
|
-
], "column"), { snapshot:
|
|
115
|
-
let
|
|
113
|
+
r
|
|
114
|
+
], "column"), { snapshot: c, descriptor: u, scales: d } = s, f = P(() => {
|
|
115
|
+
let o = {
|
|
116
116
|
open: t,
|
|
117
117
|
high: n,
|
|
118
|
-
low:
|
|
118
|
+
low: r
|
|
119
119
|
};
|
|
120
|
-
return
|
|
120
|
+
return G(c.data.rows, e, o), ne(c.data.rows, e, o, d, i, (e, t) => re(u, e, t), a);
|
|
121
121
|
}, [
|
|
122
|
-
|
|
122
|
+
c,
|
|
123
123
|
e,
|
|
124
124
|
t,
|
|
125
125
|
n,
|
|
126
|
-
|
|
126
|
+
r,
|
|
127
127
|
d,
|
|
128
|
-
|
|
128
|
+
i,
|
|
129
129
|
u,
|
|
130
|
-
|
|
130
|
+
a
|
|
131
131
|
]);
|
|
132
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ z("g", {
|
|
133
133
|
"aria-hidden": "true",
|
|
134
|
-
className: ["lilt-chart__candles",
|
|
134
|
+
className: ["lilt-chart__candles", o].filter(Boolean).join(" "),
|
|
135
135
|
"data-series": e,
|
|
136
|
-
"data-display":
|
|
137
|
-
clipPath:
|
|
138
|
-
mask:
|
|
136
|
+
"data-display": i,
|
|
137
|
+
clipPath: a ? `url(#${s.depthClip.id})` : s.clipPath,
|
|
138
|
+
mask: s.mask,
|
|
139
139
|
style: {
|
|
140
|
-
opacity:
|
|
141
|
-
transition:
|
|
140
|
+
opacity: s.opacity,
|
|
141
|
+
transition: s.reducedMotion ? void 0 : "opacity 160ms ease-out"
|
|
142
142
|
},
|
|
143
|
-
children: [
|
|
143
|
+
children: [a ? /* @__PURE__ */ R(l, { clip: s.depthClip }) : null, /* @__PURE__ */ R(ie, {
|
|
144
144
|
paths: f,
|
|
145
|
-
display:
|
|
145
|
+
display: i
|
|
146
146
|
})]
|
|
147
147
|
});
|
|
148
148
|
}, {
|
|
@@ -151,36 +151,36 @@ var re = s(function({ series: e, open: t, high: n, low: i, display: a = "candle"
|
|
|
151
151
|
kind: e.display === "ohlc" ? "ohlc" : "candle",
|
|
152
152
|
depth: e.depth && e.display !== "ohlc",
|
|
153
153
|
render: ({ cx: t, low: n, high: r, scales: i, mask: a }) => {
|
|
154
|
-
let
|
|
154
|
+
let o = a ? "white" : "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))", s = K(t, {
|
|
155
155
|
low: n,
|
|
156
156
|
high: r,
|
|
157
157
|
open: n + (r - n) * .28,
|
|
158
158
|
close: r - (r - n) * .23,
|
|
159
159
|
up: !0
|
|
160
|
-
}, i, e.display ?? "candle", e.depth),
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
|
|
163
|
-
d:
|
|
160
|
+
}, i, e.display ?? "candle", e.depth), c = g(o);
|
|
161
|
+
return /* @__PURE__ */ z(L, { children: [
|
|
162
|
+
s.stroke ? /* @__PURE__ */ R("path", {
|
|
163
|
+
d: s.stroke,
|
|
164
164
|
fill: "none",
|
|
165
|
-
stroke:
|
|
165
|
+
stroke: o,
|
|
166
166
|
strokeWidth: 1.5
|
|
167
167
|
}) : null,
|
|
168
|
-
|
|
169
|
-
d:
|
|
170
|
-
fill: a ?
|
|
168
|
+
s.side ? /* @__PURE__ */ R("path", {
|
|
169
|
+
d: s.side,
|
|
170
|
+
fill: a ? o : c.side
|
|
171
171
|
}) : null,
|
|
172
|
-
|
|
173
|
-
d:
|
|
174
|
-
fill: a ?
|
|
172
|
+
s.top ? /* @__PURE__ */ R("path", {
|
|
173
|
+
d: s.top,
|
|
174
|
+
fill: a ? o : c.top
|
|
175
175
|
}) : null,
|
|
176
|
-
|
|
177
|
-
d:
|
|
178
|
-
fill:
|
|
176
|
+
s.body ? /* @__PURE__ */ R("path", {
|
|
177
|
+
d: s.body,
|
|
178
|
+
fill: o
|
|
179
179
|
}) : null,
|
|
180
|
-
|
|
181
|
-
d:
|
|
180
|
+
s.hollow ? /* @__PURE__ */ R("path", {
|
|
181
|
+
d: s.hollow,
|
|
182
182
|
fill: a ? "black" : "var(--lilt-surface)",
|
|
183
|
-
stroke:
|
|
183
|
+
stroke: o
|
|
184
184
|
}) : null
|
|
185
185
|
] });
|
|
186
186
|
}
|
|
@@ -192,12 +192,12 @@ var re = s(function({ series: e, open: t, high: n, low: i, display: a = "candle"
|
|
|
192
192
|
e.low
|
|
193
193
|
],
|
|
194
194
|
highlight: (e, { row: n, snapshot: r, descriptor: i }) => {
|
|
195
|
-
let a =
|
|
195
|
+
let a = W(n, e.series, e);
|
|
196
196
|
if (!a) return null;
|
|
197
|
-
let o = e.display ?? "candle", s = t(r, e.series), c =
|
|
198
|
-
return /* @__PURE__ */
|
|
197
|
+
let o = e.display ?? "candle", s = t(r, e.series), c = K(s.x(n.x), a, s, o, e.depth), l = re(i, n, a);
|
|
198
|
+
return /* @__PURE__ */ R("g", {
|
|
199
199
|
className: "lilt-chart__candle-highlight",
|
|
200
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ R(ie, {
|
|
201
201
|
display: o,
|
|
202
202
|
paths: {
|
|
203
203
|
bodies: c.body ? [{
|
|
@@ -227,18 +227,18 @@ var re = s(function({ series: e, open: t, high: n, low: i, display: a = "candle"
|
|
|
227
227
|
});
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/finance/cards/pane.tsx
|
|
230
|
-
function q({ context: e, label: t, caption: n, readout: r, series: a, height: o, y: s, bars: c, xAxis: l = !1, children:
|
|
231
|
-
let [
|
|
232
|
-
return /* @__PURE__ */
|
|
230
|
+
function q({ context: e, label: t, caption: n, readout: r, series: a, height: o, y: s, bars: c, xAxis: l = !1, children: u }) {
|
|
231
|
+
let [p, m] = I(null), h = p ?? e.data.at(-1) ?? null;
|
|
232
|
+
return /* @__PURE__ */ z("div", {
|
|
233
233
|
className: "lilt-card__pane",
|
|
234
|
-
children: [n ? /* @__PURE__ */
|
|
234
|
+
children: [n ? /* @__PURE__ */ z("span", {
|
|
235
235
|
className: "lilt-card__pane-caption",
|
|
236
236
|
"aria-hidden": "true",
|
|
237
|
-
children: [/* @__PURE__ */
|
|
237
|
+
children: [/* @__PURE__ */ R("span", {
|
|
238
238
|
className: "lilt-card__pane-name",
|
|
239
239
|
children: n
|
|
240
240
|
}), r && h && !e.loading ? r(h) : null]
|
|
241
|
-
}) : null, /* @__PURE__ */
|
|
241
|
+
}) : null, /* @__PURE__ */ R(f, {
|
|
242
242
|
className: "lilt-card__chart",
|
|
243
243
|
"aria-label": t,
|
|
244
244
|
data: e.data,
|
|
@@ -246,11 +246,11 @@ function q({ context: e, label: t, caption: n, readout: r, series: a, height: o,
|
|
|
246
246
|
y: s,
|
|
247
247
|
series: a,
|
|
248
248
|
controller: e.controller,
|
|
249
|
-
onSelectionChange: r ? (e) =>
|
|
249
|
+
onSelectionChange: r ? (e) => m(e?.row ?? null) : void 0,
|
|
250
250
|
motion: e.motion,
|
|
251
251
|
status: e.loading ? "loading" : "ready",
|
|
252
252
|
loadingStyle: e.loadingStyle,
|
|
253
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ z(i, {
|
|
254
254
|
height: o,
|
|
255
255
|
margins: {
|
|
256
256
|
...e.margins,
|
|
@@ -263,7 +263,7 @@ function q({ context: e, label: t, caption: n, readout: r, series: a, height: o,
|
|
|
263
263
|
slots: e.slots || !!c,
|
|
264
264
|
bars: c,
|
|
265
265
|
background: "none",
|
|
266
|
-
children: [
|
|
266
|
+
children: [u, l ? /* @__PURE__ */ R(d, { labels: "fit" }) : null]
|
|
267
267
|
})
|
|
268
268
|
})]
|
|
269
269
|
});
|
|
@@ -278,25 +278,25 @@ function Y(e, t, n) {
|
|
|
278
278
|
let r = e.length ? J(e[0], t) : null, i = e.length ? J(e.at(-1), n) : null;
|
|
279
279
|
return r && i !== null ? i / r - 1 : void 0;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function oe(e) {
|
|
282
282
|
return (t) => {
|
|
283
283
|
let n = t.series[0]?.fields;
|
|
284
284
|
return !n?.length || n.some((e) => e.value === null) ? null : n.map((t) => `${t.label[0]} ${e(t.value)}`).join(" ");
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
var
|
|
287
|
+
var se = {
|
|
288
288
|
minimumFractionDigits: 2,
|
|
289
289
|
maximumFractionDigits: 2
|
|
290
290
|
};
|
|
291
|
-
function
|
|
292
|
-
let x =
|
|
291
|
+
function ce({ open: e, high: t, low: r, close: i, volume: a, display: o = "candle", depth: s = !1, scale: c = "linear", label: l = "Price", live: u = !1, data: d, ranges: f, delta: p, valueFormat: h = se, locale: g = "en-US", volumeHeight: _ = 64, ...y }) {
|
|
292
|
+
let x = P(() => v(g, h).full, [g, JSON.stringify(h)]), S = P(() => v(g).compact, [g]), C = P(() => f?.map((t) => ({
|
|
293
293
|
...t,
|
|
294
294
|
delta: t.delta ?? Y(t.data, e, i)
|
|
295
295
|
})), [
|
|
296
|
-
|
|
296
|
+
f,
|
|
297
297
|
e,
|
|
298
298
|
i
|
|
299
|
-
]),
|
|
299
|
+
]), w = (Y(d ?? f?.[0]?.data ?? [], e, i) ?? 0) >= 0, T = (t) => (J(t, i) ?? 0) >= (J(t, e) ?? 0), D = o === "area", O = {
|
|
300
300
|
open: {
|
|
301
301
|
label: "Open",
|
|
302
302
|
accessor: (t) => J(t, e)
|
|
@@ -310,21 +310,21 @@ function oe({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
310
310
|
accessor: (e) => J(e, r)
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
|
-
return /* @__PURE__ */
|
|
314
|
-
...
|
|
313
|
+
return /* @__PURE__ */ R(b, {
|
|
314
|
+
...y,
|
|
315
315
|
depth: s,
|
|
316
316
|
data: d,
|
|
317
317
|
ranges: C,
|
|
318
|
-
delta:
|
|
319
|
-
valueFormat:
|
|
320
|
-
locale:
|
|
318
|
+
delta: p ?? (d ? Y(d, e, i) : void 0),
|
|
319
|
+
valueFormat: h,
|
|
320
|
+
locale: g,
|
|
321
321
|
aggregate: "last",
|
|
322
322
|
tiles: !1,
|
|
323
323
|
live: u,
|
|
324
324
|
series: [{
|
|
325
325
|
key: i,
|
|
326
326
|
label: l,
|
|
327
|
-
color: D ?
|
|
327
|
+
color: D ? w ? V : H : void 0
|
|
328
328
|
}],
|
|
329
329
|
shape: {
|
|
330
330
|
kind: "marks",
|
|
@@ -341,8 +341,8 @@ function oe({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
341
341
|
fields: O,
|
|
342
342
|
line: { showInspectionPoint: !1 }
|
|
343
343
|
},
|
|
344
|
-
describe:
|
|
345
|
-
draw: (e) => e.map((e) => D ? [/* @__PURE__ */
|
|
344
|
+
describe: oe(x),
|
|
345
|
+
draw: (e) => e.map((e) => D ? [/* @__PURE__ */ R(n, { series: e }, `area-${e}`), /* @__PURE__ */ R(E, { series: e }, `line-${e}`)] : /* @__PURE__ */ R(ae, {
|
|
346
346
|
series: e,
|
|
347
347
|
open: "open",
|
|
348
348
|
high: "high",
|
|
@@ -351,11 +351,11 @@ function oe({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
351
351
|
depth: s
|
|
352
352
|
}, e))
|
|
353
353
|
},
|
|
354
|
-
panes: a ? (e) => /* @__PURE__ */
|
|
354
|
+
panes: a ? (e) => /* @__PURE__ */ R(q, {
|
|
355
355
|
context: e,
|
|
356
|
-
label: `${
|
|
356
|
+
label: `${y.title} volume`,
|
|
357
357
|
caption: "Volume",
|
|
358
|
-
height:
|
|
358
|
+
height: _,
|
|
359
359
|
xAxis: !0,
|
|
360
360
|
y: {
|
|
361
361
|
includeZero: !0,
|
|
@@ -368,10 +368,10 @@ function oe({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
368
368
|
label: "Volume",
|
|
369
369
|
accessor: (e) => J(e, a),
|
|
370
370
|
formatValue: S,
|
|
371
|
-
colorAt: (e) =>
|
|
371
|
+
colorAt: (e) => T(e) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
372
372
|
bar: { radius: 1 }
|
|
373
373
|
}],
|
|
374
|
-
children: /* @__PURE__ */
|
|
374
|
+
children: /* @__PURE__ */ R(m, { series: "volume" })
|
|
375
375
|
}) : void 0
|
|
376
376
|
});
|
|
377
377
|
}
|
|
@@ -380,11 +380,11 @@ function oe({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
380
380
|
function X(e) {
|
|
381
381
|
return typeof e == "number" && Number.isFinite(e);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function le(e, t) {
|
|
384
384
|
if (!Number.isInteger(t) || t < 1) throw Error(`Lilt ${e} period must be a positive integer; received ${t}.`);
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
|
|
386
|
+
function ue(e, t) {
|
|
387
|
+
le("sma", t);
|
|
388
388
|
let n = [], r = 0, i = 0;
|
|
389
389
|
for (let a = 0; a < e.length; a += 1) {
|
|
390
390
|
let o = e[a];
|
|
@@ -395,7 +395,7 @@ function ce(e, t) {
|
|
|
395
395
|
return n;
|
|
396
396
|
}
|
|
397
397
|
function Z(e, t) {
|
|
398
|
-
|
|
398
|
+
le("ema", t);
|
|
399
399
|
let n = 2 / (t + 1), r = [], i = null, a = [];
|
|
400
400
|
for (let o of e) {
|
|
401
401
|
if (!X(o)) {
|
|
@@ -410,8 +410,8 @@ function Z(e, t) {
|
|
|
410
410
|
}
|
|
411
411
|
return r;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
413
|
+
function de(e, t = 14) {
|
|
414
|
+
le("rsi", t);
|
|
415
415
|
let n = e.map(() => null), r = null, i = 0, a = 0, o = 0, s = 0, c = 0;
|
|
416
416
|
return e.forEach((e, l) => {
|
|
417
417
|
if (!X(e)) return;
|
|
@@ -429,7 +429,7 @@ function le(e, t = 14) {
|
|
|
429
429
|
n[l] = c === 0 ? s === 0 ? 50 : 100 : 100 - 100 / (1 + s / c);
|
|
430
430
|
}), n;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function fe(e, t = 12, n = 26, r = 9) {
|
|
433
433
|
if (t >= n) throw Error("Lilt macd needs a fast period shorter than the slow period.");
|
|
434
434
|
let i = Z(e, t), a = Z(e, n), o = e.map((e, t) => {
|
|
435
435
|
let n = i[t], r = a[t];
|
|
@@ -444,8 +444,8 @@ function ue(e, t = 12, n = 26, r = 9) {
|
|
|
444
444
|
})
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
let r =
|
|
447
|
+
function pe(e, t = 20, n = 2) {
|
|
448
|
+
let r = ue(e, t), i = [], a = [];
|
|
449
449
|
return r.forEach((r, o) => {
|
|
450
450
|
if (r === null) {
|
|
451
451
|
i.push(null), a.push(null);
|
|
@@ -461,19 +461,19 @@ function de(e, t = 20, n = 2) {
|
|
|
461
461
|
lower: a
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function me(e) {
|
|
465
465
|
let t = -Infinity;
|
|
466
466
|
return e.map((e) => X(e) ? (t = Math.max(t, e), t > 0 ? e / t - 1 : 0) : null);
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function he(e) {
|
|
469
469
|
let t = e.find(X);
|
|
470
470
|
return e.map((e) => X(e) && t !== void 0 && t !== 0 ? e / t - 1 : null);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function ge(e, t) {
|
|
473
473
|
for (let n of t) if (!X(n.price) || !X(n.size) || n.size < 0) throw Error(`Lilt order book ${e} need finite prices and non-negative sizes; received ${n.price} × ${n.size}.`);
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
|
|
475
|
+
function _e(e, t) {
|
|
476
|
+
ge("bids", e), ge("asks", t);
|
|
477
477
|
let n = (e) => {
|
|
478
478
|
let t = /* @__PURE__ */ new Map();
|
|
479
479
|
for (let n of e) t.set(n.price, (t.get(n.price) ?? 0) + n.size);
|
|
@@ -508,7 +508,7 @@ function he(e, t) {
|
|
|
508
508
|
}
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region src/finance/cards/indicator-chart-card.tsx
|
|
511
|
-
function
|
|
511
|
+
function ve(e) {
|
|
512
512
|
return e.map((e, t) => {
|
|
513
513
|
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();
|
|
514
514
|
return {
|
|
@@ -520,7 +520,7 @@ function ge(e) {
|
|
|
520
520
|
};
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function ye(e) {
|
|
524
524
|
return e.map((e, t) => {
|
|
525
525
|
let n = typeof e == "string" ? { kind: e } : e;
|
|
526
526
|
return {
|
|
@@ -538,47 +538,47 @@ function Q(e, t) {
|
|
|
538
538
|
let n = e[t];
|
|
539
539
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function be(e, t, n, r) {
|
|
542
542
|
let i = e.map((e) => Q(e, t)), a = e.map((e) => ({ ...e })), o = (e, t) => t.forEach((t, n) => a[n][e] = t);
|
|
543
543
|
for (let e of n) if (e.kind === "bollinger") {
|
|
544
|
-
let t =
|
|
544
|
+
let t = pe(i, e.period, e.deviations);
|
|
545
545
|
o(e.id, t.middle), o(`${e.id}Upper`, t.upper), o(`${e.id}Lower`, t.lower);
|
|
546
|
-
} else o(e.id, (e.kind === "sma" ?
|
|
547
|
-
for (let e of r) if (e.kind === "rsi" && o(e.id,
|
|
548
|
-
let t =
|
|
546
|
+
} else o(e.id, (e.kind === "sma" ? ue : Z)(i, e.period));
|
|
547
|
+
for (let e of r) if (e.kind === "rsi" && o(e.id, de(i, e.period)), e.kind === "macd") {
|
|
548
|
+
let t = fe(i, e.fast, e.slow, e.signal);
|
|
549
549
|
o(`${e.id}Macd`, t.macd), o(`${e.id}Signal`, t.signal), o(`${e.id}Histogram`, t.histogram);
|
|
550
550
|
}
|
|
551
551
|
return a;
|
|
552
552
|
}
|
|
553
|
-
var
|
|
553
|
+
var xe = {
|
|
554
554
|
minimumFractionDigits: 2,
|
|
555
555
|
maximumFractionDigits: 2
|
|
556
|
-
},
|
|
556
|
+
}, Se = [
|
|
557
557
|
"var(--lilt-series-4)",
|
|
558
558
|
"var(--lilt-series-3)",
|
|
559
559
|
"var(--lilt-series-5)"
|
|
560
560
|
];
|
|
561
|
-
function
|
|
562
|
-
let
|
|
563
|
-
if (
|
|
564
|
-
let D = JSON.stringify(o), O = JSON.stringify(
|
|
561
|
+
function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlays: o = [], panes: c = ["rsi", "macd"], label: l = "Price", scale: u = "linear", live: d = !1, data: f, ranges: p, delta: h, valueFormat: g = xe, locale: y = "en-US", paneHeight: x = 72, ...S }) {
|
|
562
|
+
let w = !!(t && n && r), T = a ?? (w ? "candle" : "line");
|
|
563
|
+
if (T !== "line" && !w) throw Error("Lilt IndicatorChartCard candles need open, high and low fields.");
|
|
564
|
+
let D = JSON.stringify(o), O = JSON.stringify(c), k = P(() => ve(o), [D]), A = P(() => ye(c), [O]);
|
|
565
565
|
if (A.some((e) => e.kind === "volume") && !i) throw Error("Lilt IndicatorChartCard needs a `volume` field for a volume pane.");
|
|
566
|
-
let
|
|
567
|
-
|
|
566
|
+
let ee = P(() => f ? be(f, e, k, A) : void 0, [
|
|
567
|
+
f,
|
|
568
568
|
e,
|
|
569
569
|
k,
|
|
570
570
|
A
|
|
571
|
-
]),
|
|
571
|
+
]), te = P(() => p?.map((n) => ({
|
|
572
572
|
...n,
|
|
573
|
-
data:
|
|
573
|
+
data: be(n.data, e, k, A),
|
|
574
574
|
delta: n.delta ?? (t ? Y(n.data, t, e) : void 0)
|
|
575
575
|
})), [
|
|
576
|
-
|
|
576
|
+
p,
|
|
577
577
|
e,
|
|
578
578
|
t,
|
|
579
579
|
k,
|
|
580
580
|
A
|
|
581
|
-
]),
|
|
581
|
+
]), j = P(() => v(y, g).full, [y, JSON.stringify(g)]), M = P(() => v(y, { maximumFractionDigits: 2 }).full, [y]), N = P(() => v(y).compact, [y]), F = w ? {
|
|
582
582
|
open: {
|
|
583
583
|
label: "Open",
|
|
584
584
|
accessor: (e) => Q(e, t)
|
|
@@ -591,46 +591,46 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
591
591
|
label: "Low",
|
|
592
592
|
accessor: (e) => Q(e, r)
|
|
593
593
|
}
|
|
594
|
-
} : void 0,
|
|
595
|
-
let a = n.id ===
|
|
594
|
+
} : void 0, I = new Map(k.map((e) => [e.id, e])), B = f?.length ? Q(f[0], e) : null, U = f?.length ? Q(f.at(-1), e) : null, W = B === null || U === null || U >= B, G = A.at(-1)?.id, K = (n, r) => {
|
|
595
|
+
let a = n.id === G, o = (e) => (t) => Q(t, e), s = (e, t, n) => {
|
|
596
596
|
let r = Q(e, t);
|
|
597
|
-
return /* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ z("span", {
|
|
598
598
|
className: "lilt-card__pane-value",
|
|
599
|
-
children: [n ? `${n} ` : "", r === null ? "—" :
|
|
599
|
+
children: [n ? `${n} ` : "", r === null ? "—" : M(r)]
|
|
600
600
|
}, t);
|
|
601
601
|
};
|
|
602
|
-
if (n.kind === "volume") return /* @__PURE__ */
|
|
602
|
+
if (n.kind === "volume") return /* @__PURE__ */ R(q, {
|
|
603
603
|
context: r,
|
|
604
|
-
label: `${
|
|
604
|
+
label: `${S.title} volume`,
|
|
605
605
|
caption: "Volume",
|
|
606
|
-
readout: (e) => /* @__PURE__ */
|
|
606
|
+
readout: (e) => /* @__PURE__ */ R("span", {
|
|
607
607
|
className: "lilt-card__pane-value",
|
|
608
|
-
children: Q(e, i) === null ? "—" :
|
|
608
|
+
children: Q(e, i) === null ? "—" : N(Q(e, i))
|
|
609
609
|
}),
|
|
610
|
-
height:
|
|
610
|
+
height: x,
|
|
611
611
|
xAxis: a,
|
|
612
612
|
y: {
|
|
613
613
|
includeZero: !0,
|
|
614
614
|
ticks: 2,
|
|
615
|
-
format:
|
|
615
|
+
format: N
|
|
616
616
|
},
|
|
617
617
|
bars: { series: ["volume"] },
|
|
618
618
|
series: [{
|
|
619
619
|
id: "volume",
|
|
620
620
|
label: "Volume",
|
|
621
621
|
accessor: o(i),
|
|
622
|
-
formatValue:
|
|
622
|
+
formatValue: N,
|
|
623
623
|
colorAt: (n) => (Q(n, e) ?? 0) >= (Q(n, t) ?? Q(n, e) ?? 0) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
624
624
|
bar: { radius: 1 }
|
|
625
625
|
}],
|
|
626
|
-
children: /* @__PURE__ */
|
|
626
|
+
children: /* @__PURE__ */ R(m, { series: "volume" })
|
|
627
627
|
}, n.id);
|
|
628
|
-
if (n.kind === "rsi") return /* @__PURE__ */
|
|
628
|
+
if (n.kind === "rsi") return /* @__PURE__ */ z(q, {
|
|
629
629
|
context: r,
|
|
630
|
-
label: `${
|
|
630
|
+
label: `${S.title} RSI ${n.period}`,
|
|
631
631
|
caption: `RSI ${n.period}`,
|
|
632
632
|
readout: (e) => s(e, n.id),
|
|
633
|
-
height:
|
|
633
|
+
height: x,
|
|
634
634
|
xAxis: a,
|
|
635
635
|
y: {
|
|
636
636
|
domain: [0, 100],
|
|
@@ -642,42 +642,42 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
642
642
|
label: `RSI ${n.period}`,
|
|
643
643
|
accessor: o(n.id),
|
|
644
644
|
color: "var(--lilt-series-1)",
|
|
645
|
-
formatValue:
|
|
645
|
+
formatValue: M,
|
|
646
646
|
line: {
|
|
647
647
|
width: 1.5,
|
|
648
|
-
depth:
|
|
648
|
+
depth: S.depth
|
|
649
649
|
}
|
|
650
650
|
}],
|
|
651
651
|
children: [
|
|
652
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ R(_, {
|
|
653
653
|
axis: "y",
|
|
654
654
|
from: 30,
|
|
655
655
|
to: 70,
|
|
656
656
|
color: "var(--lilt-series-1)"
|
|
657
657
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ R(C, {
|
|
659
659
|
value: 70,
|
|
660
660
|
color: "var(--lilt-muted)"
|
|
661
661
|
}),
|
|
662
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ R(C, {
|
|
663
663
|
value: 30,
|
|
664
664
|
color: "var(--lilt-muted)"
|
|
665
665
|
}),
|
|
666
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ R(E, { series: n.id })
|
|
667
667
|
]
|
|
668
668
|
}, n.id);
|
|
669
669
|
let c = `${n.id}Macd`, l = `${n.id}Signal`, u = `${n.id}Histogram`;
|
|
670
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ z(q, {
|
|
671
671
|
context: r,
|
|
672
|
-
label: `${
|
|
672
|
+
label: `${S.title} MACD`,
|
|
673
673
|
caption: `MACD ${n.fast} · ${n.slow} · ${n.signal}`,
|
|
674
674
|
readout: (e) => [s(e, c), s(e, l, "Signal")],
|
|
675
|
-
height:
|
|
675
|
+
height: x,
|
|
676
676
|
xAxis: a,
|
|
677
677
|
y: {
|
|
678
678
|
includeZero: !0,
|
|
679
679
|
ticks: 2,
|
|
680
|
-
format:
|
|
680
|
+
format: M
|
|
681
681
|
},
|
|
682
682
|
bars: { series: [u] },
|
|
683
683
|
series: [
|
|
@@ -685,7 +685,7 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
685
685
|
id: u,
|
|
686
686
|
label: "Histogram",
|
|
687
687
|
accessor: o(u),
|
|
688
|
-
formatValue:
|
|
688
|
+
formatValue: M,
|
|
689
689
|
colorAt: (e) => (Q(e, u) ?? 0) >= 0 ? "color-mix(in srgb, var(--lilt-candle-up) 55%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 55%, transparent)",
|
|
690
690
|
bar: { radius: 1 }
|
|
691
691
|
},
|
|
@@ -694,10 +694,10 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
694
694
|
label: "MACD",
|
|
695
695
|
accessor: o(c),
|
|
696
696
|
color: "var(--lilt-series-4)",
|
|
697
|
-
formatValue:
|
|
697
|
+
formatValue: M,
|
|
698
698
|
line: {
|
|
699
699
|
width: 1.5,
|
|
700
|
-
depth:
|
|
700
|
+
depth: S.depth
|
|
701
701
|
}
|
|
702
702
|
},
|
|
703
703
|
{
|
|
@@ -705,7 +705,7 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
705
705
|
label: "Signal",
|
|
706
706
|
accessor: o(l),
|
|
707
707
|
color: "var(--lilt-series-3)",
|
|
708
|
-
formatValue:
|
|
708
|
+
formatValue: M,
|
|
709
709
|
line: {
|
|
710
710
|
width: 1.5,
|
|
711
711
|
dasharray: "3 3"
|
|
@@ -713,19 +713,19 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
713
713
|
}
|
|
714
714
|
],
|
|
715
715
|
children: [
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ R(m, { series: u }),
|
|
717
|
+
/* @__PURE__ */ R(E, { series: c }),
|
|
718
|
+
/* @__PURE__ */ R(E, { series: l })
|
|
719
719
|
]
|
|
720
720
|
}, n.id);
|
|
721
721
|
};
|
|
722
|
-
return /* @__PURE__ */
|
|
723
|
-
...
|
|
724
|
-
data:
|
|
725
|
-
ranges:
|
|
726
|
-
delta:
|
|
727
|
-
valueFormat:
|
|
728
|
-
locale:
|
|
722
|
+
return /* @__PURE__ */ R(b, {
|
|
723
|
+
...S,
|
|
724
|
+
data: ee,
|
|
725
|
+
ranges: te,
|
|
726
|
+
delta: h ?? (f && t ? Y(f, t, e) : void 0),
|
|
727
|
+
valueFormat: g,
|
|
728
|
+
locale: y,
|
|
729
729
|
aggregate: "last",
|
|
730
730
|
headlineSeries: e,
|
|
731
731
|
pillSeries: e,
|
|
@@ -734,27 +734,27 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
734
734
|
series: [{
|
|
735
735
|
key: e,
|
|
736
736
|
label: l,
|
|
737
|
-
color:
|
|
737
|
+
color: T === "line" ? W ? V : H : void 0
|
|
738
738
|
}, ...k.map((e, t) => ({
|
|
739
739
|
key: e.id,
|
|
740
740
|
label: e.label,
|
|
741
|
-
color:
|
|
741
|
+
color: Se[t % Se.length]
|
|
742
742
|
}))],
|
|
743
743
|
shape: {
|
|
744
744
|
kind: "marks",
|
|
745
|
-
id: `indicator:${
|
|
745
|
+
id: `indicator:${T}:${u}:${t}:${n}:${r}:${D}:${O}`,
|
|
746
746
|
includeZero: !1,
|
|
747
747
|
scale: u,
|
|
748
748
|
slots: !0,
|
|
749
749
|
xAxis: A.length === 0,
|
|
750
750
|
series: (e) => {
|
|
751
|
-
let t =
|
|
751
|
+
let t = I.get(e);
|
|
752
752
|
return t ? {
|
|
753
753
|
curve: "monotone",
|
|
754
754
|
line: {
|
|
755
755
|
width: 1.5,
|
|
756
756
|
showInspectionPoint: !1,
|
|
757
|
-
depth:
|
|
757
|
+
depth: S.depth
|
|
758
758
|
},
|
|
759
759
|
...t.kind === "bollinger" ? { fields: {
|
|
760
760
|
upper: {
|
|
@@ -766,52 +766,52 @@ function xe({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
766
766
|
accessor: (e) => Q(e, `${t.id}Lower`)
|
|
767
767
|
}
|
|
768
768
|
} } : {}
|
|
769
|
-
} :
|
|
770
|
-
fields:
|
|
769
|
+
} : T === "line" ? {
|
|
770
|
+
fields: F,
|
|
771
771
|
curve: "linear",
|
|
772
772
|
line: {
|
|
773
773
|
width: 2,
|
|
774
|
-
depth:
|
|
774
|
+
depth: S.depth
|
|
775
775
|
}
|
|
776
|
-
} : { fields:
|
|
776
|
+
} : { fields: F };
|
|
777
777
|
},
|
|
778
|
-
describe:
|
|
778
|
+
describe: w ? oe(j) : void 0,
|
|
779
779
|
draw: (e) => e.map((e) => {
|
|
780
|
-
let t =
|
|
781
|
-
return t ? t.kind === "bollinger" ? [/* @__PURE__ */
|
|
780
|
+
let t = I.get(e);
|
|
781
|
+
return t ? t.kind === "bollinger" ? [/* @__PURE__ */ R(s, {
|
|
782
782
|
series: e,
|
|
783
783
|
lower: "lower",
|
|
784
784
|
upper: "upper"
|
|
785
|
-
}, `band-${e}`), /* @__PURE__ */
|
|
785
|
+
}, `band-${e}`), /* @__PURE__ */ R(E, { series: e }, `line-${e}`)] : /* @__PURE__ */ R(E, { series: e }, e) : T === "line" ? /* @__PURE__ */ R(E, { series: e }, e) : /* @__PURE__ */ R(ae, {
|
|
786
786
|
series: e,
|
|
787
787
|
open: "open",
|
|
788
788
|
high: "high",
|
|
789
789
|
low: "low",
|
|
790
|
-
display:
|
|
791
|
-
depth:
|
|
790
|
+
display: T,
|
|
791
|
+
depth: S.depth
|
|
792
792
|
}, e);
|
|
793
793
|
})
|
|
794
794
|
},
|
|
795
|
-
panes: A.length ? (e) => /* @__PURE__ */ L
|
|
795
|
+
panes: A.length ? (e) => /* @__PURE__ */ R(L, { children: A.map((t) => K(t, e)) }) : void 0
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
//#endregion
|
|
799
799
|
//#region src/finance/cards/depth-chart-card.tsx
|
|
800
|
-
function
|
|
801
|
-
let { snapshot: n } =
|
|
800
|
+
function we({ price: e, label: t }) {
|
|
801
|
+
let { snapshot: n } = h();
|
|
802
802
|
if (e < n.xDomain[0] || e > n.xDomain[1]) return null;
|
|
803
803
|
let r = n.xToPixel(e);
|
|
804
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ z("g", {
|
|
805
805
|
className: "lilt-card__depth-mid",
|
|
806
806
|
"aria-hidden": "true",
|
|
807
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ R("line", {
|
|
808
808
|
x1: r,
|
|
809
809
|
x2: r,
|
|
810
810
|
y1: n.plot.top + 18,
|
|
811
811
|
y2: n.plot.bottom,
|
|
812
812
|
strokeDasharray: "2 4",
|
|
813
813
|
vectorEffect: "non-scaling-stroke"
|
|
814
|
-
}), /* @__PURE__ */
|
|
814
|
+
}), /* @__PURE__ */ R("text", {
|
|
815
815
|
x: r,
|
|
816
816
|
y: n.plot.top + 10,
|
|
817
817
|
textAnchor: "middle",
|
|
@@ -819,101 +819,101 @@ function Se({ price: e, label: t }) {
|
|
|
819
819
|
})]
|
|
820
820
|
});
|
|
821
821
|
}
|
|
822
|
-
var
|
|
822
|
+
var Te = {
|
|
823
823
|
style: "currency",
|
|
824
824
|
currency: "USD",
|
|
825
825
|
minimumFractionDigits: 2,
|
|
826
826
|
maximumFractionDigits: 2
|
|
827
827
|
};
|
|
828
|
-
function
|
|
829
|
-
let
|
|
828
|
+
function Ee({ title: e, bids: t, asks: r, valueFormat: a = Te, sizeFormat: o, locale: s = "en-US", height: c = 220, axis: l = "minimal", background: u = "dots", hoverStyle: p = "soft", surface: m, numberStyle: h, loading: g = !1, loadingStyle: _ = "shimmer", motion: y, className: b, style: x, depth: S = !1 }) {
|
|
829
|
+
let C = P(() => _e(t, r), [t, r]), T = JSON.stringify(a), O = JSON.stringify(o ?? null), k = P(() => v(s, a), [s, T]), N = P(() => v(s, o), [s, O]), F = P(() => v(s, {
|
|
830
830
|
style: "percent",
|
|
831
831
|
maximumFractionDigits: 3
|
|
832
|
-
}).full, [s]), [
|
|
832
|
+
}).full, [s]), [L, B] = I(null), U = P(() => [{
|
|
833
833
|
id: "bid",
|
|
834
834
|
label: "Bids",
|
|
835
835
|
accessor: (e) => e.bid,
|
|
836
|
-
color:
|
|
836
|
+
color: V,
|
|
837
837
|
curve: "step-before",
|
|
838
838
|
area: { treatment: "fade" },
|
|
839
839
|
line: {
|
|
840
840
|
width: 1.5,
|
|
841
|
-
depth:
|
|
841
|
+
depth: S
|
|
842
842
|
},
|
|
843
|
-
formatValue:
|
|
843
|
+
formatValue: N.full
|
|
844
844
|
}, {
|
|
845
845
|
id: "ask",
|
|
846
846
|
label: "Asks",
|
|
847
847
|
accessor: (e) => e.ask,
|
|
848
|
-
color:
|
|
848
|
+
color: H,
|
|
849
849
|
curve: "step-after",
|
|
850
850
|
area: { treatment: "fade" },
|
|
851
851
|
line: {
|
|
852
852
|
width: 1.5,
|
|
853
|
-
depth:
|
|
853
|
+
depth: S
|
|
854
854
|
},
|
|
855
|
-
formatValue:
|
|
856
|
-
}], [
|
|
857
|
-
return /* @__PURE__ */
|
|
855
|
+
formatValue: N.full
|
|
856
|
+
}], [N, S]), W = C.spread !== null && C.mid ? `${k.full(C.spread)} (${F(C.spread / C.mid)})` : "—", G = L ? L.bid ?? L.ask : null;
|
|
857
|
+
return /* @__PURE__ */ z(M, {
|
|
858
858
|
"aria-label": e,
|
|
859
|
-
surface:
|
|
860
|
-
numberStyle:
|
|
859
|
+
surface: m,
|
|
860
|
+
numberStyle: h,
|
|
861
861
|
motion: y,
|
|
862
862
|
className: ["lilt-card--depth", b].filter(Boolean).join(" "),
|
|
863
863
|
style: x,
|
|
864
864
|
children: [
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
value:
|
|
867
|
-
format:
|
|
868
|
-
loading:
|
|
865
|
+
/* @__PURE__ */ z(j, { children: [/* @__PURE__ */ R(te, { children: e }), /* @__PURE__ */ R(ee, {
|
|
866
|
+
value: C.mid,
|
|
867
|
+
format: k.full,
|
|
868
|
+
loading: g,
|
|
869
869
|
motion: y,
|
|
870
|
-
children:
|
|
871
|
-
|
|
870
|
+
children: g ? null : L && G !== null ? /* @__PURE__ */ z(A, { children: [
|
|
871
|
+
N.full(G),
|
|
872
872
|
" ",
|
|
873
|
-
|
|
873
|
+
L.side === "bid" ? "bid" : "ask",
|
|
874
874
|
" depth at",
|
|
875
875
|
" ",
|
|
876
|
-
|
|
877
|
-
] }) : /* @__PURE__ */
|
|
876
|
+
k.full(L.price)
|
|
877
|
+
] }) : /* @__PURE__ */ R(A, { children: "Mid price" })
|
|
878
878
|
})] }),
|
|
879
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ z("dl", {
|
|
880
880
|
className: "lilt-card__stats",
|
|
881
881
|
children: [
|
|
882
|
-
/* @__PURE__ */
|
|
883
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("dt", { children: "Spread" }), /* @__PURE__ */ R("dd", { children: g ? "—" : W })] }),
|
|
883
|
+
/* @__PURE__ */ z("div", {
|
|
884
884
|
"data-side": "bid",
|
|
885
|
-
children: [/* @__PURE__ */
|
|
885
|
+
children: [/* @__PURE__ */ R("dt", { children: "Bid depth" }), /* @__PURE__ */ R("dd", { children: g ? "—" : N.compact(C.bidDepth) })]
|
|
886
886
|
}),
|
|
887
|
-
/* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ z("div", {
|
|
888
888
|
"data-side": "ask",
|
|
889
|
-
children: [/* @__PURE__ */
|
|
889
|
+
children: [/* @__PURE__ */ R("dt", { children: "Ask depth" }), /* @__PURE__ */ R("dd", { children: g ? "—" : N.compact(C.askDepth) })]
|
|
890
890
|
})
|
|
891
891
|
]
|
|
892
892
|
}),
|
|
893
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ R(f, {
|
|
894
894
|
className: "lilt-card__chart",
|
|
895
895
|
"aria-label": `${e} depth by price`,
|
|
896
|
-
data:
|
|
896
|
+
data: C.levels,
|
|
897
897
|
x: {
|
|
898
898
|
type: "number",
|
|
899
899
|
accessor: (e) => e.price,
|
|
900
|
-
format:
|
|
900
|
+
format: k.full
|
|
901
901
|
},
|
|
902
902
|
y: {
|
|
903
903
|
includeZero: !0,
|
|
904
904
|
ticks: 3,
|
|
905
|
-
format:
|
|
905
|
+
format: N.compact
|
|
906
906
|
},
|
|
907
|
-
series:
|
|
908
|
-
onSelectionChange: (e) =>
|
|
907
|
+
series: U,
|
|
908
|
+
onSelectionChange: (e) => B(e?.row ?? null),
|
|
909
909
|
motion: y,
|
|
910
|
-
status:
|
|
911
|
-
loadingStyle:
|
|
912
|
-
children: /* @__PURE__ */
|
|
910
|
+
status: g ? "loading" : "ready",
|
|
911
|
+
loadingStyle: _,
|
|
912
|
+
children: /* @__PURE__ */ z(i, {
|
|
913
913
|
height: c,
|
|
914
914
|
axis: l,
|
|
915
|
-
background:
|
|
916
|
-
pill:
|
|
915
|
+
background: u,
|
|
916
|
+
pill: p,
|
|
917
917
|
margins: {
|
|
918
918
|
top: 8,
|
|
919
919
|
right: 4,
|
|
@@ -921,17 +921,17 @@ function we({ title: e, bids: t, asks: r, valueFormat: a = Ce, sizeFormat: o, lo
|
|
|
921
921
|
left: 4
|
|
922
922
|
},
|
|
923
923
|
children: [
|
|
924
|
-
/* @__PURE__ */
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */
|
|
928
|
-
/* @__PURE__ */
|
|
929
|
-
|
|
930
|
-
price:
|
|
931
|
-
label: `Mid ${
|
|
924
|
+
/* @__PURE__ */ R(D, { pattern: "lines" }),
|
|
925
|
+
/* @__PURE__ */ R(n, { series: "bid" }),
|
|
926
|
+
/* @__PURE__ */ R(n, { series: "ask" }),
|
|
927
|
+
/* @__PURE__ */ R(E, { series: "bid" }),
|
|
928
|
+
/* @__PURE__ */ R(E, { series: "ask" }),
|
|
929
|
+
C.mid === null ? null : /* @__PURE__ */ R(we, {
|
|
930
|
+
price: C.mid,
|
|
931
|
+
label: `Mid ${k.full(C.mid)}`
|
|
932
932
|
}),
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */
|
|
933
|
+
/* @__PURE__ */ R(d, { labels: "fit" }),
|
|
934
|
+
/* @__PURE__ */ R(w, {})
|
|
935
935
|
]
|
|
936
936
|
})
|
|
937
937
|
})
|
|
@@ -945,31 +945,31 @@ function $(e, t) {
|
|
|
945
945
|
let n = e[t];
|
|
946
946
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function De(e, t, n) {
|
|
949
949
|
let r = e.at(-1), i = $(r, t), a = $(r, n);
|
|
950
950
|
return i !== null && a ? i / a - 1 : void 0;
|
|
951
951
|
}
|
|
952
|
-
function
|
|
953
|
-
let d = o ?? s?.[0]?.data ?? [], f =
|
|
952
|
+
function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...u }) {
|
|
953
|
+
let d = o ?? s?.[0]?.data ?? [], f = P(() => s?.map((n) => ({
|
|
954
954
|
...n,
|
|
955
|
-
delta: n.delta ??
|
|
955
|
+
delta: n.delta ?? De(n.data, e, t)
|
|
956
956
|
})), [
|
|
957
957
|
s,
|
|
958
958
|
e,
|
|
959
959
|
t
|
|
960
|
-
]), p =
|
|
960
|
+
]), p = P(() => v(l, {
|
|
961
961
|
style: "percent",
|
|
962
962
|
minimumFractionDigits: 1,
|
|
963
963
|
maximumFractionDigits: 1
|
|
964
|
-
}).full, [l]), m =
|
|
965
|
-
let t =
|
|
966
|
-
return
|
|
964
|
+
}).full, [l]), m = P(() => {
|
|
965
|
+
let t = me(d.map((t) => $(t, e))).filter((e) => e !== null);
|
|
966
|
+
return B(t) ?? null;
|
|
967
967
|
}, [d, e]);
|
|
968
|
-
return /* @__PURE__ */
|
|
968
|
+
return /* @__PURE__ */ R(b, {
|
|
969
969
|
...u,
|
|
970
970
|
data: o,
|
|
971
971
|
ranges: f,
|
|
972
|
-
delta: c ?? (o ?
|
|
972
|
+
delta: c ?? (o ? De(o, e, t) : void 0),
|
|
973
973
|
locale: l,
|
|
974
974
|
aggregate: "last",
|
|
975
975
|
headlineSeries: e,
|
|
@@ -996,18 +996,18 @@ function Ee({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
996
996
|
area: { treatment: "fade" },
|
|
997
997
|
curve: "monotone"
|
|
998
998
|
},
|
|
999
|
-
draw: (e) => e.map((e) => [/* @__PURE__ */
|
|
999
|
+
draw: (e) => e.map((e) => [/* @__PURE__ */ R(n, { series: e }, `area-${e}`), /* @__PURE__ */ R(E, { series: e }, e)])
|
|
1000
1000
|
},
|
|
1001
1001
|
panes: i ? (t) => {
|
|
1002
|
-
let r =
|
|
1003
|
-
return /* @__PURE__ */
|
|
1002
|
+
let r = me(t.data.map((t) => $(t, e))), i = new Map(t.data.map((e, t) => [e, r[t] ?? null]));
|
|
1003
|
+
return /* @__PURE__ */ z(q, {
|
|
1004
1004
|
context: t,
|
|
1005
1005
|
label: `${u.title} drawdown`,
|
|
1006
1006
|
caption: "Drawdown",
|
|
1007
|
-
readout: (e) => /* @__PURE__ */
|
|
1007
|
+
readout: (e) => /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("span", {
|
|
1008
1008
|
className: "lilt-card__pane-value",
|
|
1009
1009
|
children: i.get(e) == null ? "—" : p(i.get(e))
|
|
1010
|
-
}), m === null ? null : /* @__PURE__ */
|
|
1010
|
+
}), m === null ? null : /* @__PURE__ */ z("span", {
|
|
1011
1011
|
className: "lilt-card__pane-value",
|
|
1012
1012
|
children: ["Max ", p(m)]
|
|
1013
1013
|
})] }),
|
|
@@ -1028,118 +1028,118 @@ function Ee({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
1028
1028
|
line: { width: 1.5 },
|
|
1029
1029
|
curve: "monotone"
|
|
1030
1030
|
}],
|
|
1031
|
-
children: [/* @__PURE__ */
|
|
1031
|
+
children: [/* @__PURE__ */ R(n, { series: "drawdown" }), /* @__PURE__ */ R(E, { series: "drawdown" })]
|
|
1032
1032
|
});
|
|
1033
1033
|
} : void 0
|
|
1034
1034
|
});
|
|
1035
1035
|
}
|
|
1036
1036
|
//#endregion
|
|
1037
1037
|
//#region src/finance/cards/price-chart-card.tsx
|
|
1038
|
-
function
|
|
1038
|
+
function ke(e, t) {
|
|
1039
1039
|
let n = e[t];
|
|
1040
1040
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1043
|
-
let n = e.map((e) =>
|
|
1042
|
+
function Ae(e, t) {
|
|
1043
|
+
let n = e.map((e) => ke(e, t)).filter((e) => e !== null);
|
|
1044
1044
|
return n.length > 1 ? {
|
|
1045
1045
|
first: n[0],
|
|
1046
1046
|
last: n.at(-1)
|
|
1047
1047
|
} : null;
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function je(e, t) {
|
|
1050
1050
|
let n = e.map((e) => ({ ...e }));
|
|
1051
|
-
for (let r of t)
|
|
1051
|
+
for (let r of t) he(e.map((e) => ke(e, r))).forEach((e, t) => n[t][`__rebased${r}`] = e);
|
|
1052
1052
|
return n;
|
|
1053
1053
|
}
|
|
1054
|
-
var
|
|
1054
|
+
var Me = {
|
|
1055
1055
|
style: "currency",
|
|
1056
1056
|
currency: "USD",
|
|
1057
1057
|
minimumFractionDigits: 2,
|
|
1058
1058
|
maximumFractionDigits: 2
|
|
1059
1059
|
};
|
|
1060
|
-
function
|
|
1061
|
-
let
|
|
1060
|
+
function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus: o, data: s, ranges: c, delta: l, valueFormat: u = Me, locale: d = "en-US", title: f, ...m }) {
|
|
1061
|
+
let h = !!o?.length, g = P(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), _ = P(() => s ? h ? je(s, g) : s : void 0, [
|
|
1062
1062
|
s,
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
]),
|
|
1066
|
-
let n =
|
|
1063
|
+
h,
|
|
1064
|
+
g
|
|
1065
|
+
]), y = P(() => c?.map((t) => {
|
|
1066
|
+
let n = Ae(t.data, e);
|
|
1067
1067
|
return {
|
|
1068
1068
|
...t,
|
|
1069
|
-
data:
|
|
1069
|
+
data: h ? je(t.data, g) : t.data,
|
|
1070
1070
|
delta: t.delta ?? (n && n.first ? n.last / n.first - 1 : void 0)
|
|
1071
1071
|
};
|
|
1072
1072
|
}), [
|
|
1073
1073
|
c,
|
|
1074
|
-
|
|
1075
|
-
|
|
1074
|
+
h,
|
|
1075
|
+
g,
|
|
1076
1076
|
e
|
|
1077
|
-
]), x =
|
|
1077
|
+
]), x = Ae(s ?? c?.[0]?.data ?? [], e), S = !x || x.last >= x.first, C = P(() => v(d, u).full, [d, JSON.stringify(u)]), w = P(() => v(d, {
|
|
1078
1078
|
style: "percent",
|
|
1079
1079
|
minimumFractionDigits: 1,
|
|
1080
1080
|
maximumFractionDigits: 1
|
|
1081
|
-
}).full, [
|
|
1081
|
+
}).full, [d]), T = (e) => h ? `__rebased${e}` : e, D = /* @__PURE__ */ z("span", {
|
|
1082
1082
|
className: "lilt-card__ticker",
|
|
1083
1083
|
children: [
|
|
1084
|
-
i ? /* @__PURE__ */
|
|
1084
|
+
i ? /* @__PURE__ */ R("span", {
|
|
1085
1085
|
className: "lilt-card__ticker-icon",
|
|
1086
1086
|
children: i
|
|
1087
1087
|
}) : null,
|
|
1088
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ R("span", {
|
|
1089
1089
|
className: "lilt-card__ticker-symbol",
|
|
1090
|
-
children: t ??
|
|
1090
|
+
children: t ?? f
|
|
1091
1091
|
}),
|
|
1092
|
-
r ? /* @__PURE__ */
|
|
1092
|
+
r ? /* @__PURE__ */ R("span", {
|
|
1093
1093
|
className: "lilt-card__ticker-name",
|
|
1094
1094
|
children: r
|
|
1095
1095
|
}) : null
|
|
1096
1096
|
]
|
|
1097
1097
|
});
|
|
1098
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ R(b, {
|
|
1099
1099
|
...m,
|
|
1100
|
-
title:
|
|
1100
|
+
title: f,
|
|
1101
1101
|
heading: D,
|
|
1102
|
-
data:
|
|
1103
|
-
ranges:
|
|
1104
|
-
delta:
|
|
1105
|
-
valueFormat:
|
|
1102
|
+
data: _,
|
|
1103
|
+
ranges: y,
|
|
1104
|
+
delta: h ? void 0 : l ?? (s && x && x.first ? x.last / x.first - 1 : void 0),
|
|
1105
|
+
valueFormat: h ? {
|
|
1106
1106
|
style: "percent",
|
|
1107
1107
|
maximumFractionDigits: 1
|
|
1108
1108
|
} : u,
|
|
1109
|
-
formatValue:
|
|
1110
|
-
locale:
|
|
1109
|
+
formatValue: h ? (e) => p(w)(e) : void 0,
|
|
1110
|
+
locale: d,
|
|
1111
1111
|
aggregate: "last",
|
|
1112
|
-
headlineSeries:
|
|
1113
|
-
pillSeries:
|
|
1114
|
-
tiles:
|
|
1115
|
-
restCaption:
|
|
1116
|
-
let n =
|
|
1117
|
-
return n ?
|
|
1112
|
+
headlineSeries: T(e),
|
|
1113
|
+
pillSeries: h ? "nearest" : T(e),
|
|
1114
|
+
tiles: h,
|
|
1115
|
+
restCaption: h ? void 0 : (t) => {
|
|
1116
|
+
let n = Ae(t, e);
|
|
1117
|
+
return n ? p(C)(n.last - n.first) : null;
|
|
1118
1118
|
},
|
|
1119
1119
|
series: [{
|
|
1120
|
-
key:
|
|
1121
|
-
label: t ??
|
|
1122
|
-
color:
|
|
1120
|
+
key: T(e),
|
|
1121
|
+
label: t ?? f,
|
|
1122
|
+
color: h ? void 0 : S ? V : H
|
|
1123
1123
|
}, ...(o ?? []).map((e) => ({
|
|
1124
1124
|
...e,
|
|
1125
|
-
key:
|
|
1125
|
+
key: T(e.key)
|
|
1126
1126
|
}))],
|
|
1127
1127
|
shape: {
|
|
1128
1128
|
kind: "marks",
|
|
1129
|
-
id: `price:${a}:${
|
|
1130
|
-
includeZero:
|
|
1131
|
-
series: () => a === "area" && !
|
|
1129
|
+
id: `price:${a}:${g.join()}:${h}`,
|
|
1130
|
+
includeZero: h,
|
|
1131
|
+
series: () => a === "area" && !h ? {
|
|
1132
1132
|
area: { treatment: "fade" },
|
|
1133
1133
|
curve: "monotone"
|
|
1134
1134
|
} : { curve: "monotone" },
|
|
1135
|
-
draw: (e) => e.map((e) => a === "area" && !
|
|
1135
|
+
draw: (e) => e.map((e) => a === "area" && !h ? [/* @__PURE__ */ R(n, { series: e }, `area-${e}`), /* @__PURE__ */ R(E, { series: e }, e)] : /* @__PURE__ */ R(E, { series: e }, e))
|
|
1136
1136
|
},
|
|
1137
1137
|
bleed: m.bleed ?? !0
|
|
1138
1138
|
});
|
|
1139
1139
|
}
|
|
1140
1140
|
//#endregion
|
|
1141
1141
|
//#region src/finance/order-book.tsx
|
|
1142
|
-
function
|
|
1142
|
+
function Pe(e, t, n) {
|
|
1143
1143
|
let r = /* @__PURE__ */ new Map();
|
|
1144
1144
|
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);
|
|
1145
1145
|
let i = [...r].map(([e, t]) => ({
|
|
@@ -1152,9 +1152,9 @@ function Me(e, t, n) {
|
|
|
1152
1152
|
side: t
|
|
1153
1153
|
}));
|
|
1154
1154
|
}
|
|
1155
|
-
function
|
|
1156
|
-
let n =
|
|
1157
|
-
return
|
|
1155
|
+
function Fe(e, t) {
|
|
1156
|
+
let n = F(null), [r, i] = I(/* @__PURE__ */ new Set());
|
|
1157
|
+
return N(() => {
|
|
1158
1158
|
let r = new Map(e.map((e) => [`${e.side}:${e.price}`, e.size])), a = n.current;
|
|
1159
1159
|
if (n.current = r, !t || !a) return;
|
|
1160
1160
|
let o = new Set([...r].filter(([e, t]) => a.get(e) !== t).map(([e]) => e));
|
|
@@ -1164,103 +1164,107 @@ function Ne(e, t) {
|
|
|
1164
1164
|
return () => window.clearTimeout(s);
|
|
1165
1165
|
}, [e, t]), r;
|
|
1166
1166
|
}
|
|
1167
|
-
function
|
|
1167
|
+
function Ie({ title: e, bids: t, asks: n, levels: i = 8, depth: a = !1, valueFormat: o = {
|
|
1168
1168
|
minimumFractionDigits: 2,
|
|
1169
1169
|
maximumFractionDigits: 2
|
|
1170
|
-
}, sizeFormat:
|
|
1171
|
-
let
|
|
1170
|
+
}, sizeFormat: s, locale: c = "en-US", flash: l = !0, surface: d, loading: f = !1, loadingStyle: p = "shimmer", motion: m, className: h, style: g }) {
|
|
1171
|
+
let _ = k(m ?? "auto"), y = u(f, p), b = r(f, _), C = JSON.stringify(o), w = JSON.stringify(s ?? null), T = P(() => v(c, o).full, [c, C]), E = P(() => v(c, s).compact, [c, w]), D = P(() => v(c, {
|
|
1172
1172
|
style: "percent",
|
|
1173
1173
|
maximumFractionDigits: 3
|
|
1174
|
-
}).full, [
|
|
1175
|
-
value:
|
|
1176
|
-
mid: (
|
|
1177
|
-
} : null,
|
|
1174
|
+
}).full, [c]), O = P(() => Pe(t, "bid", i), [t, i]), A = P(() => Pe(n, "ask", i), [n, i]), ee = Fe(P(() => [...A, ...O], [A, O]), l && !_ && !f), te = Math.max(1, A.at(-1)?.total ?? 0, O.at(-1)?.total ?? 0), j = O[0]?.price, N = A[0]?.price, F = j !== void 0 && N !== void 0 ? {
|
|
1175
|
+
value: N - j,
|
|
1176
|
+
mid: (N + j) / 2
|
|
1177
|
+
} : null, I = (e) => /* @__PURE__ */ z("tr", {
|
|
1178
1178
|
className: "lilt-order-book__level",
|
|
1179
1179
|
"data-side": e.side,
|
|
1180
|
-
"data-flash":
|
|
1181
|
-
style: { "--lilt-depth": `${e.total /
|
|
1180
|
+
"data-flash": ee.has(`${e.side}:${e.price}`) || void 0,
|
|
1181
|
+
style: { "--lilt-depth": `${e.total / te * 100}%` },
|
|
1182
1182
|
children: [
|
|
1183
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ z("th", {
|
|
1184
1184
|
scope: "row",
|
|
1185
|
-
children: [
|
|
1185
|
+
children: [a ? /* @__PURE__ */ R("span", {
|
|
1186
1186
|
className: "lilt-order-book__bar",
|
|
1187
1187
|
"aria-hidden": "true"
|
|
1188
|
-
}) : null,
|
|
1188
|
+
}) : null, T(e.price)]
|
|
1189
1189
|
}),
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ R("td", { children: E(e.size) }),
|
|
1191
|
+
/* @__PURE__ */ R("td", { children: E(e.total) })
|
|
1192
1192
|
]
|
|
1193
|
-
}, `${e.side}:${e.price}`),
|
|
1193
|
+
}, `${e.side}:${e.price}`), L = (e) => Array.from({ length: Math.max(1, Math.min(50, i)) }, (t, n) => /* @__PURE__ */ z("tr", {
|
|
1194
1194
|
className: "lilt-order-book__placeholder",
|
|
1195
1195
|
"aria-hidden": "true",
|
|
1196
1196
|
children: [
|
|
1197
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ R("td", { children: /* @__PURE__ */ R(S, {
|
|
1198
1198
|
width: `${86 - n * 4}%`,
|
|
1199
1199
|
step: n
|
|
1200
1200
|
}) }),
|
|
1201
|
-
/* @__PURE__ */
|
|
1201
|
+
/* @__PURE__ */ R("td", { children: /* @__PURE__ */ R(S, {
|
|
1202
1202
|
width: "60%",
|
|
1203
1203
|
step: n
|
|
1204
1204
|
}) }),
|
|
1205
|
-
/* @__PURE__ */
|
|
1205
|
+
/* @__PURE__ */ R("td", { children: /* @__PURE__ */ R(S, {
|
|
1206
1206
|
width: "72%",
|
|
1207
1207
|
step: n
|
|
1208
1208
|
}) })
|
|
1209
1209
|
]
|
|
1210
1210
|
}, `${e}-${n}`));
|
|
1211
|
-
return /* @__PURE__ */
|
|
1211
|
+
return /* @__PURE__ */ R(M, {
|
|
1212
1212
|
"aria-label": e,
|
|
1213
|
-
surface:
|
|
1214
|
-
motion:
|
|
1215
|
-
className: ["lilt-card--order-book",
|
|
1216
|
-
style:
|
|
1217
|
-
children: /* @__PURE__ */ R(
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1213
|
+
surface: d,
|
|
1214
|
+
motion: m,
|
|
1215
|
+
className: ["lilt-card--order-book", h].filter(Boolean).join(" "),
|
|
1216
|
+
style: g,
|
|
1217
|
+
children: /* @__PURE__ */ R(x, {
|
|
1218
|
+
leaving: b,
|
|
1219
|
+
origin: "center",
|
|
1220
|
+
children: /* @__PURE__ */ z("table", {
|
|
1221
|
+
ref: y,
|
|
1222
|
+
className: f ? "lilt-order-book lilt-skeleton" : "lilt-order-book",
|
|
1223
|
+
"data-depth": a || void 0,
|
|
1224
|
+
"data-style": f ? p : void 0,
|
|
1225
|
+
"data-reduced-motion": _ || void 0,
|
|
1226
|
+
"aria-busy": f,
|
|
1227
|
+
children: [
|
|
1228
|
+
/* @__PURE__ */ R("caption", { children: e }),
|
|
1229
|
+
/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ z("tr", { children: [
|
|
1230
|
+
/* @__PURE__ */ R("th", {
|
|
1231
|
+
scope: "col",
|
|
1232
|
+
children: "Price"
|
|
1233
|
+
}),
|
|
1234
|
+
/* @__PURE__ */ R("th", {
|
|
1235
|
+
scope: "col",
|
|
1236
|
+
children: "Size"
|
|
1237
|
+
}),
|
|
1238
|
+
/* @__PURE__ */ R("th", {
|
|
1239
|
+
scope: "col",
|
|
1240
|
+
children: "Total"
|
|
1241
|
+
})
|
|
1242
|
+
] }) }),
|
|
1243
|
+
/* @__PURE__ */ R("tbody", {
|
|
1244
|
+
"aria-label": "Asks",
|
|
1245
|
+
children: f ? L("ask") : [...A].reverse().map(I)
|
|
1230
1246
|
}),
|
|
1231
|
-
/* @__PURE__ */
|
|
1232
|
-
|
|
1233
|
-
children: "
|
|
1247
|
+
/* @__PURE__ */ R("tbody", {
|
|
1248
|
+
"aria-label": "Spread",
|
|
1249
|
+
children: /* @__PURE__ */ z("tr", {
|
|
1250
|
+
className: "lilt-order-book__spread",
|
|
1251
|
+
children: [/* @__PURE__ */ R("th", {
|
|
1252
|
+
scope: "row",
|
|
1253
|
+
children: f ? "—" : F ? T(F.mid) : "—"
|
|
1254
|
+
}), /* @__PURE__ */ R("td", {
|
|
1255
|
+
colSpan: 2,
|
|
1256
|
+
children: f ? "Loading order book" : F ? `Spread ${T(F.value)} · ${D(F.value / F.mid)}` : "No spread"
|
|
1257
|
+
})]
|
|
1258
|
+
})
|
|
1234
1259
|
}),
|
|
1235
|
-
/* @__PURE__ */
|
|
1236
|
-
|
|
1237
|
-
children: "
|
|
1238
|
-
})
|
|
1239
|
-
] }) }),
|
|
1240
|
-
/* @__PURE__ */ L("tbody", {
|
|
1241
|
-
"aria-label": "Asks",
|
|
1242
|
-
children: u ? F("ask") : [...E].reverse().map(P)
|
|
1243
|
-
}),
|
|
1244
|
-
/* @__PURE__ */ L("tbody", {
|
|
1245
|
-
"aria-label": "Spread",
|
|
1246
|
-
children: /* @__PURE__ */ R("tr", {
|
|
1247
|
-
className: "lilt-order-book__spread",
|
|
1248
|
-
children: [/* @__PURE__ */ L("th", {
|
|
1249
|
-
scope: "row",
|
|
1250
|
-
children: u ? "—" : M ? S(M.mid) : "—"
|
|
1251
|
-
}), /* @__PURE__ */ L("td", {
|
|
1252
|
-
colSpan: 2,
|
|
1253
|
-
children: u ? "Loading order book" : M ? `Spread ${S(M.value)} · ${w(M.value / M.mid)}` : "No spread"
|
|
1254
|
-
})]
|
|
1260
|
+
/* @__PURE__ */ R("tbody", {
|
|
1261
|
+
"aria-label": "Bids",
|
|
1262
|
+
children: f ? L("bid") : O.map(I)
|
|
1255
1263
|
})
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
"aria-label": "Bids",
|
|
1259
|
-
children: u ? F("bid") : T.map(P)
|
|
1260
|
-
})
|
|
1261
|
-
]
|
|
1264
|
+
]
|
|
1265
|
+
})
|
|
1262
1266
|
})
|
|
1263
1267
|
});
|
|
1264
1268
|
}
|
|
1265
1269
|
//#endregion
|
|
1266
|
-
export {
|
|
1270
|
+
export { ae as Candles, ce as CandlestickChartCard, Ee as DepthChartCard, Ce as IndicatorChartCard, Ie as OrderBook, Oe as PortfolioChartCard, Ne as PriceChartCard, pe as bollinger, _e as depthLevels, me as drawdown, Z as ema, fe as macd, he as rebase, de as rsi, ue as sma };
|