kline-charts-react 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -6
- package/dist/SubPaneTitle-B2y5WQqq.js +2019 -0
- package/dist/SubPaneTitle-BAu9MdQQ.cjs +1 -0
- package/dist/hooks/useEcharts.d.ts +1 -1
- package/dist/hooks/useKlineData.d.ts +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1 -3
- package/dist/index.js +462 -2231
- package/dist/kline-charts-react.css +1 -1
- package/dist/types/props.d.ts +28 -23
- package/dist/unstable.cjs +1 -0
- package/dist/unstable.d.ts +2 -0
- package/dist/unstable.js +53 -0
- package/dist/utils/controllable.d.ts +7 -0
- package/dist/utils/formatters.d.ts +4 -21
- package/dist/utils/indicatorMeta.d.ts +7 -0
- package/dist/utils/marketSessions.d.ts +2 -0
- package/package.json +27 -8
- package/dist/index.umd.js +0 -7
package/dist/index.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { useState as H, useRef as Z, useCallback as $, useEffect as W, useMemo as ne, forwardRef as vt, useImperativeHandle as bt } from "react";
|
|
6
|
-
import { StockSDK as yt } from "stock-sdk";
|
|
7
|
-
import * as Ge from "echarts/core";
|
|
8
|
-
import { CandlestickChart as xt, LineChart as wt, BarChart as Ct, ScatterChart as It } from "echarts/charts";
|
|
9
|
-
import { TitleComponent as At, TooltipComponent as St, GridComponent as $t, DataZoomComponent as kt, LegendComponent as Mt, AxisPointerComponent as _t } from "echarts/components";
|
|
10
|
-
import { CanvasRenderer as Dt } from "echarts/renderers";
|
|
1
|
+
import { jsxs as O, jsx as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as se, useCallback as x, forwardRef as at, useRef as N, useMemo as ae, useEffect as w, useImperativeHandle as st } from "react";
|
|
3
|
+
import { f as ye, a as Ne, g as lt, u as it, b as ct, c as dt, D as He, d as Ve, e as ut, m as ft, P as ht, T as mt, I as gt, L as pt, S as Ct, h as xt } from "./SubPaneTitle-B2y5WQqq.js";
|
|
4
|
+
import { i as Ot, j as jt, k as Ft, l as Kt, n as Ut, o as Wt, p as qt, q as zt, r as Gt, s as Jt, t as Yt, v as Qt, w as Xt, x as eo, y as to, z as oo, A as no, B as ro, C as ao, E as so, F as lo, G as io, H as co } from "./SubPaneTitle-B2y5WQqq.js";
|
|
11
5
|
const Ze = {
|
|
12
6
|
backgroundColor: "#ffffff",
|
|
13
7
|
textColor: "#333333",
|
|
@@ -26,7 +20,7 @@ const Ze = {
|
|
|
26
20
|
activeColor: "#1890ff",
|
|
27
21
|
bollColors: ["#faad14", "#1890ff", "#722ed1"],
|
|
28
22
|
kcColors: ["#52c41a", "#13c2c2", "#eb2f96"]
|
|
29
|
-
},
|
|
23
|
+
}, bt = {
|
|
30
24
|
backgroundColor: "#1a1a1a",
|
|
31
25
|
textColor: "#d1d1d1",
|
|
32
26
|
textColorSecondary: "#666666",
|
|
@@ -45,1502 +39,59 @@ const Ze = {
|
|
|
45
39
|
bollColors: ["#faad14", "#1890ff", "#722ed1"],
|
|
46
40
|
kcColors: ["#52c41a", "#13c2c2", "#eb2f96"]
|
|
47
41
|
};
|
|
48
|
-
function
|
|
49
|
-
return typeof
|
|
50
|
-
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function ae(e, t) {
|
|
65
|
-
const n = [], r = 2 / (t + 1);
|
|
66
|
-
let a = null;
|
|
67
|
-
for (let i = 0; i < e.length; i++) {
|
|
68
|
-
const c = e[i];
|
|
69
|
-
if (c == null) {
|
|
70
|
-
n.push(a);
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
a === null ? a = c : a = c * r + a * (1 - r), n.push(a);
|
|
74
|
-
}
|
|
75
|
-
return n;
|
|
76
|
-
}
|
|
77
|
-
function Rt(e, t) {
|
|
78
|
-
const n = [], r = Array.from({ length: t }, (i, c) => c + 1), a = r.reduce((i, c) => i + c, 0);
|
|
79
|
-
for (let i = 0; i < e.length; i++) {
|
|
80
|
-
if (i < t - 1) {
|
|
81
|
-
n.push(null);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
let c = 0, o = 0;
|
|
85
|
-
for (let l = 0; l < t; l++) {
|
|
86
|
-
const s = e[i - t + 1 + l], d = r[l];
|
|
87
|
-
s != null && d !== void 0 && (c += s * d, o++);
|
|
88
|
-
}
|
|
89
|
-
o === t ? n.push(c / a) : n.push(null);
|
|
90
|
-
}
|
|
91
|
-
return n;
|
|
92
|
-
}
|
|
93
|
-
function jt(e, t = {}) {
|
|
94
|
-
const { periods: n = [5, 10, 20, 30, 60], type: r = "sma" } = t, a = {};
|
|
95
|
-
for (const c of n) {
|
|
96
|
-
const o = `ma${c}`;
|
|
97
|
-
switch (r) {
|
|
98
|
-
case "ema":
|
|
99
|
-
a[o] = ae(e, c);
|
|
100
|
-
break;
|
|
101
|
-
case "wma":
|
|
102
|
-
a[o] = Rt(e, c);
|
|
103
|
-
break;
|
|
104
|
-
default:
|
|
105
|
-
a[o] = fe(e, c);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const i = [];
|
|
109
|
-
for (let c = 0; c < e.length; c++) {
|
|
110
|
-
const o = {};
|
|
111
|
-
for (const l of Object.keys(a)) {
|
|
112
|
-
const s = a[l];
|
|
113
|
-
o[l] = s !== void 0 ? s[c] ?? null : null;
|
|
114
|
-
}
|
|
115
|
-
i.push(o);
|
|
116
|
-
}
|
|
117
|
-
return i;
|
|
118
|
-
}
|
|
119
|
-
function Tt(e, t = {}) {
|
|
120
|
-
const { short: n = 12, long: r = 26, signal: a = 9 } = t, i = ae(e, n), c = ae(e, r), o = [];
|
|
121
|
-
for (let d = 0; d < e.length; d++) {
|
|
122
|
-
const h = i[d], m = c[d];
|
|
123
|
-
h != null && m !== null && m !== void 0 ? o.push(h - m) : o.push(null);
|
|
124
|
-
}
|
|
125
|
-
const l = ae(o, a), s = [];
|
|
126
|
-
for (let d = 0; d < e.length; d++) {
|
|
127
|
-
const h = o[d] ?? null, m = l[d] ?? null;
|
|
128
|
-
s.push({
|
|
129
|
-
dif: h,
|
|
130
|
-
dea: m,
|
|
131
|
-
macd: h !== null && m !== null ? (h - m) * 2 : null
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return s;
|
|
135
|
-
}
|
|
136
|
-
function Bt(e, t = {}) {
|
|
137
|
-
const { period: n = 20, stdDev: r = 2 } = t, a = fe(e, n), i = [];
|
|
138
|
-
for (let c = 0; c < e.length; c++) {
|
|
139
|
-
const o = a[c];
|
|
140
|
-
if (o == null || c < n - 1) {
|
|
141
|
-
i.push({ mid: null, upper: null, lower: null, bandwidth: null });
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
let l = 0, s = 0;
|
|
145
|
-
for (let d = c - n + 1; d <= c; d++) {
|
|
146
|
-
const h = e[d];
|
|
147
|
-
h != null && (l += Math.pow(h - o, 2), s++);
|
|
148
|
-
}
|
|
149
|
-
if (s === n) {
|
|
150
|
-
const d = Math.sqrt(l / n), h = o + r * d, m = o - r * d;
|
|
151
|
-
i.push({
|
|
152
|
-
mid: o,
|
|
153
|
-
upper: h,
|
|
154
|
-
lower: m,
|
|
155
|
-
bandwidth: o !== 0 ? (h - m) / o * 100 : null
|
|
156
|
-
});
|
|
157
|
-
} else
|
|
158
|
-
i.push({ mid: o, upper: null, lower: null, bandwidth: null });
|
|
159
|
-
}
|
|
160
|
-
return i;
|
|
161
|
-
}
|
|
162
|
-
function Pt(e, t = {}) {
|
|
163
|
-
const { period: n = 9, kPeriod: r = 3, dPeriod: a = 3 } = t, i = [];
|
|
164
|
-
let c = 50, o = 50;
|
|
165
|
-
for (let l = 0; l < e.length; l++) {
|
|
166
|
-
if (l < n - 1) {
|
|
167
|
-
i.push({ k: null, d: null, j: null });
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
let s = -1 / 0, d = 1 / 0;
|
|
171
|
-
for (let v = l - n + 1; v <= l; v++) {
|
|
172
|
-
const p = e[v];
|
|
173
|
-
p !== void 0 && p.high !== null && p.high !== void 0 && (s = Math.max(s, p.high)), p !== void 0 && p.low !== null && p.low !== void 0 && (d = Math.min(d, p.low));
|
|
174
|
-
}
|
|
175
|
-
const h = e[l], m = h !== void 0 ? h.close : null;
|
|
176
|
-
if (m == null || s === -1 / 0 || d === 1 / 0) {
|
|
177
|
-
i.push({ k: null, d: null, j: null });
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
const f = s === d ? 50 : (m - d) / (s - d) * 100, u = (c * (r - 1) + f) / r, y = (o * (a - 1) + u) / a, x = 3 * u - 2 * y;
|
|
181
|
-
i.push({ k: u, d: y, j: x }), c = u, o = y;
|
|
182
|
-
}
|
|
183
|
-
return i;
|
|
184
|
-
}
|
|
185
|
-
function Ot(e, t = {}) {
|
|
186
|
-
const { periods: n = [6, 12, 24] } = t, r = {};
|
|
187
|
-
for (const i of n) {
|
|
188
|
-
const c = `rsi${i}`, o = [];
|
|
189
|
-
let l = 0, s = 0;
|
|
190
|
-
for (let d = 0; d < e.length; d++) {
|
|
191
|
-
const h = e[d], m = e[d - 1];
|
|
192
|
-
if (d === 0 || h === null || h === void 0 || m === null || m === void 0) {
|
|
193
|
-
o.push(null);
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
const f = h - m, u = f > 0 ? f : 0, y = f < 0 ? -f : 0;
|
|
197
|
-
if (d < i)
|
|
198
|
-
l += u, s += y, o.push(null);
|
|
199
|
-
else if (d === i) {
|
|
200
|
-
l = (l + u) / i, s = (s + y) / i;
|
|
201
|
-
const x = s === 0 ? 100 : l / s;
|
|
202
|
-
o.push(100 - 100 / (1 + x));
|
|
203
|
-
} else {
|
|
204
|
-
l = (l * (i - 1) + u) / i, s = (s * (i - 1) + y) / i;
|
|
205
|
-
const x = s === 0 ? 100 : l / s;
|
|
206
|
-
o.push(100 - 100 / (1 + x));
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
r[c] = o;
|
|
210
|
-
}
|
|
211
|
-
const a = [];
|
|
212
|
-
for (let i = 0; i < e.length; i++) {
|
|
213
|
-
const c = {};
|
|
214
|
-
for (const o of Object.keys(r)) {
|
|
215
|
-
const l = r[o];
|
|
216
|
-
c[o] = l !== void 0 ? l[i] ?? null : null;
|
|
217
|
-
}
|
|
218
|
-
a.push(c);
|
|
219
|
-
}
|
|
220
|
-
return a;
|
|
221
|
-
}
|
|
222
|
-
function Kt(e, t = {}) {
|
|
223
|
-
const { periods: n = [6, 10] } = t, r = {};
|
|
224
|
-
for (const i of n) {
|
|
225
|
-
const c = `wr${i}`, o = [];
|
|
226
|
-
for (let l = 0; l < e.length; l++) {
|
|
227
|
-
if (l < i - 1) {
|
|
228
|
-
o.push(null);
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
let s = -1 / 0, d = 1 / 0;
|
|
232
|
-
for (let f = l - i + 1; f <= l; f++) {
|
|
233
|
-
const u = e[f];
|
|
234
|
-
u !== void 0 && u.high !== null && u.high !== void 0 && (s = Math.max(s, u.high)), u !== void 0 && u.low !== null && u.low !== void 0 && (d = Math.min(d, u.low));
|
|
235
|
-
}
|
|
236
|
-
const h = e[l], m = h !== void 0 ? h.close : null;
|
|
237
|
-
m == null || s === d ? o.push(null) : o.push((s - m) / (s - d) * -100);
|
|
238
|
-
}
|
|
239
|
-
r[c] = o;
|
|
240
|
-
}
|
|
241
|
-
const a = [];
|
|
242
|
-
for (let i = 0; i < e.length; i++) {
|
|
243
|
-
const c = {};
|
|
244
|
-
for (const o of Object.keys(r)) {
|
|
245
|
-
const l = r[o];
|
|
246
|
-
c[o] = l !== void 0 ? l[i] ?? null : null;
|
|
247
|
-
}
|
|
248
|
-
a.push(c);
|
|
249
|
-
}
|
|
250
|
-
return a;
|
|
251
|
-
}
|
|
252
|
-
function Et(e, t = {}) {
|
|
253
|
-
const { periods: n = [6, 12, 24] } = t, r = {};
|
|
254
|
-
for (const i of n) {
|
|
255
|
-
const c = `bias${i}`, o = fe(e, i), l = [];
|
|
256
|
-
for (let s = 0; s < e.length; s++) {
|
|
257
|
-
const d = e[s], h = o[s];
|
|
258
|
-
d == null || h === null || h === void 0 || h === 0 ? l.push(null) : l.push((d - h) / h * 100);
|
|
259
|
-
}
|
|
260
|
-
r[c] = l;
|
|
261
|
-
}
|
|
262
|
-
const a = [];
|
|
263
|
-
for (let i = 0; i < e.length; i++) {
|
|
264
|
-
const c = {};
|
|
265
|
-
for (const o of Object.keys(r)) {
|
|
266
|
-
const l = r[o];
|
|
267
|
-
c[o] = l !== void 0 ? l[i] ?? null : null;
|
|
268
|
-
}
|
|
269
|
-
a.push(c);
|
|
270
|
-
}
|
|
271
|
-
return a;
|
|
272
|
-
}
|
|
273
|
-
function zt(e, t = {}) {
|
|
274
|
-
const { period: n = 14 } = t, r = e.map((c) => c.high === null || c.low === null || c.close === null ? null : (c.high + c.low + c.close) / 3), a = fe(r, n), i = [];
|
|
275
|
-
for (let c = 0; c < e.length; c++) {
|
|
276
|
-
const o = r[c], l = a[c];
|
|
277
|
-
if (c < n - 1 || o === null || o === void 0 || l === null || l === void 0) {
|
|
278
|
-
i.push({ cci: null });
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
let s = 0, d = 0;
|
|
282
|
-
for (let m = c - n + 1; m <= c; m++) {
|
|
283
|
-
const f = r[m];
|
|
284
|
-
f != null && (s += Math.abs(f - l), d++);
|
|
285
|
-
}
|
|
286
|
-
const h = d > 0 ? s / d : 0;
|
|
287
|
-
h === 0 ? i.push({ cci: 0 }) : i.push({ cci: (o - l) / (0.015 * h) });
|
|
288
|
-
}
|
|
289
|
-
return i;
|
|
290
|
-
}
|
|
291
|
-
function Je(e, t = {}) {
|
|
292
|
-
const { period: n = 14 } = t, r = [], a = [];
|
|
293
|
-
for (let i = 0; i < e.length; i++) {
|
|
294
|
-
const c = e[i];
|
|
295
|
-
if (c === void 0 || c.high === null || c.low === null || c.close === null) {
|
|
296
|
-
a.push(null), r.push({ tr: null, atr: null });
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
let o;
|
|
300
|
-
if (i === 0)
|
|
301
|
-
o = c.high - c.low;
|
|
302
|
-
else {
|
|
303
|
-
const l = e[i - 1], s = l !== void 0 ? l.close : null;
|
|
304
|
-
s == null ? o = c.high - c.low : o = Math.max(
|
|
305
|
-
c.high - c.low,
|
|
306
|
-
Math.abs(c.high - s),
|
|
307
|
-
Math.abs(c.low - s)
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
if (a.push(o), i < n - 1)
|
|
311
|
-
r.push({ tr: o, atr: null });
|
|
312
|
-
else if (i === n - 1) {
|
|
313
|
-
let l = 0;
|
|
314
|
-
for (let s = 0; s < n; s++)
|
|
315
|
-
l += a[s] ?? 0;
|
|
316
|
-
r.push({ tr: o, atr: l / n });
|
|
317
|
-
} else {
|
|
318
|
-
const l = r[i - 1], s = l !== void 0 ? l.atr : null;
|
|
319
|
-
s == null ? r.push({ tr: o, atr: null }) : r.push({ tr: o, atr: (s * (n - 1) + o) / n });
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
return r;
|
|
323
|
-
}
|
|
324
|
-
function Ht(e, t = {}) {
|
|
325
|
-
const { maPeriod: n = 30 } = t, r = [];
|
|
326
|
-
let a = 0;
|
|
327
|
-
for (let o = 0; o < e.length; o++) {
|
|
328
|
-
const l = e[o];
|
|
329
|
-
if (l === void 0 || l.close === null || l.volume === null || l.volume === void 0) {
|
|
330
|
-
r.push({ obv: null, obvMa: null });
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
if (o === 0)
|
|
334
|
-
a = l.volume;
|
|
335
|
-
else {
|
|
336
|
-
const s = e[o - 1], d = s !== void 0 ? s.close : null;
|
|
337
|
-
d == null ? a = l.volume : l.close > d ? a += l.volume : l.close < d && (a -= l.volume);
|
|
338
|
-
}
|
|
339
|
-
r.push({ obv: a, obvMa: null });
|
|
340
|
-
}
|
|
341
|
-
const i = r.map((o) => o.obv), c = fe(i, n);
|
|
342
|
-
for (let o = 0; o < r.length; o++) {
|
|
343
|
-
const l = r[o];
|
|
344
|
-
l !== void 0 && (l.obvMa = c[o] ?? null);
|
|
345
|
-
}
|
|
346
|
-
return r;
|
|
347
|
-
}
|
|
348
|
-
function Ft(e, t = {}) {
|
|
349
|
-
const { period: n = 12, signalPeriod: r = 6 } = t, a = [];
|
|
350
|
-
for (let o = 0; o < e.length; o++) {
|
|
351
|
-
const l = e[o], s = e[o - n];
|
|
352
|
-
o < n || l === null || l === void 0 || s === null || s === void 0 || s === 0 ? a.push(null) : a.push((l - s) / s * 100);
|
|
353
|
-
}
|
|
354
|
-
const i = ae(a, r), c = [];
|
|
355
|
-
for (let o = 0; o < e.length; o++)
|
|
356
|
-
c.push({
|
|
357
|
-
roc: a[o] ?? null,
|
|
358
|
-
signal: i[o] ?? null
|
|
359
|
-
});
|
|
360
|
-
return c;
|
|
361
|
-
}
|
|
362
|
-
function Ut(e, t = {}) {
|
|
363
|
-
const { period: n = 14, adxPeriod: r = 14 } = t, a = [], i = [], c = [], o = [];
|
|
364
|
-
for (let l = 0; l < e.length; l++) {
|
|
365
|
-
const s = e[l];
|
|
366
|
-
if (s === void 0 || s.high === null || s.low === null || s.close === null) {
|
|
367
|
-
a.push({ pdi: null, mdi: null, adx: null, adxr: null });
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
let d;
|
|
371
|
-
if (l === 0)
|
|
372
|
-
d = s.high - s.low;
|
|
373
|
-
else {
|
|
374
|
-
const b = e[l - 1], C = b !== void 0 ? b.close : null;
|
|
375
|
-
C == null ? d = s.high - s.low : d = Math.max(
|
|
376
|
-
s.high - s.low,
|
|
377
|
-
Math.abs(s.high - C),
|
|
378
|
-
Math.abs(s.low - C)
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
if (i.push(d), l === 0)
|
|
382
|
-
c.push(0), o.push(0);
|
|
383
|
-
else {
|
|
384
|
-
const b = e[l - 1];
|
|
385
|
-
if (b === void 0 || b.high === null || b.low === null)
|
|
386
|
-
c.push(0), o.push(0);
|
|
387
|
-
else {
|
|
388
|
-
const C = s.high - b.high, _ = b.low - s.low, B = C > _ && C > 0 ? C : 0, G = _ > C && _ > 0 ? _ : 0;
|
|
389
|
-
c.push(B), o.push(G);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
if (l < n - 1) {
|
|
393
|
-
a.push({ pdi: null, mdi: null, adx: null, adxr: null });
|
|
394
|
-
continue;
|
|
395
|
-
}
|
|
396
|
-
let h = 0, m = 0, f = 0;
|
|
397
|
-
for (let b = l - n + 1; b <= l; b++)
|
|
398
|
-
h += i[b] ?? 0, m += c[b] ?? 0, f += o[b] ?? 0;
|
|
399
|
-
const u = h > 0 ? m / h * 100 : 0, y = h > 0 ? f / h * 100 : 0, x = u + y, v = x > 0 ? Math.abs(u - y) / x * 100 : 0;
|
|
400
|
-
let p = null;
|
|
401
|
-
if (l >= n - 1 + r - 1) {
|
|
402
|
-
let b = 0;
|
|
403
|
-
for (let C = l - r + 1; C <= l; C++) {
|
|
404
|
-
if (a[C] === void 0) continue;
|
|
405
|
-
let B = 0, G = 0, j = 0;
|
|
406
|
-
for (let U = C - n + 1; U <= C; U++)
|
|
407
|
-
B += i[U] ?? 0, G += c[U] ?? 0, j += o[U] ?? 0;
|
|
408
|
-
const O = B > 0 ? G / B * 100 : 0, F = B > 0 ? j / B * 100 : 0, Q = O + F, R = Q > 0 ? Math.abs(O - F) / Q * 100 : 0;
|
|
409
|
-
b += R;
|
|
410
|
-
}
|
|
411
|
-
b += v, p = b / r;
|
|
412
|
-
}
|
|
413
|
-
let w = null;
|
|
414
|
-
if (p !== null && l >= n - 1 + r - 1 + r) {
|
|
415
|
-
const b = a[l - r];
|
|
416
|
-
b !== void 0 && b.adx !== null && (w = (p + b.adx) / 2);
|
|
417
|
-
}
|
|
418
|
-
a.push({ pdi: u, mdi: y, adx: p, adxr: w });
|
|
419
|
-
}
|
|
420
|
-
return a;
|
|
421
|
-
}
|
|
422
|
-
function Vt(e, t = {}) {
|
|
423
|
-
var d, h;
|
|
424
|
-
const { afStart: n = 0.02, afIncrement: r = 0.02, afMax: a = 0.2 } = t, i = [];
|
|
425
|
-
if (e.length === 0) return i;
|
|
426
|
-
let c = 1, o = ((d = e[0]) == null ? void 0 : d.low) ?? 0, l = ((h = e[0]) == null ? void 0 : h.high) ?? 0, s = n;
|
|
427
|
-
for (let m = 0; m < e.length; m++) {
|
|
428
|
-
const f = e[m];
|
|
429
|
-
if (f === void 0 || f.high === null || f.low === null) {
|
|
430
|
-
i.push({ sar: null, trend: null, ep: null, af: null });
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
if (m === 0) {
|
|
434
|
-
i.push({ sar: f.low, trend: 1, ep: f.high, af: n }), o = f.low, l = f.high, c = 1, s = n;
|
|
435
|
-
continue;
|
|
436
|
-
}
|
|
437
|
-
const u = o;
|
|
438
|
-
if (o = u + s * (l - u), c === 1) {
|
|
439
|
-
const y = e[m - 1], x = e[m - 2];
|
|
440
|
-
y !== void 0 && y.low !== null && (o = Math.min(o, y.low)), x !== void 0 && x.low !== null && (o = Math.min(o, x.low)), f.low < o ? (c = -1, o = l, l = f.low, s = n) : f.high > l && (l = f.high, s = Math.min(s + r, a));
|
|
441
|
-
} else {
|
|
442
|
-
const y = e[m - 1], x = e[m - 2];
|
|
443
|
-
y !== void 0 && y.high !== null && (o = Math.max(o, y.high)), x !== void 0 && x.high !== null && (o = Math.max(o, x.high)), f.high > o ? (c = 1, o = l, l = f.high, s = n) : f.low < l && (l = f.low, s = Math.min(s + r, a));
|
|
444
|
-
}
|
|
445
|
-
i.push({ sar: o, trend: c, ep: l, af: s });
|
|
446
|
-
}
|
|
447
|
-
return i;
|
|
448
|
-
}
|
|
449
|
-
function Wt(e, t = {}) {
|
|
450
|
-
var s;
|
|
451
|
-
const { emaPeriod: n = 20, atrPeriod: r = 10, multiplier: a = 2 } = t, i = e.map((d) => d.close), c = ae(i, n), o = Je(e, { period: r }), l = [];
|
|
452
|
-
for (let d = 0; d < e.length; d++) {
|
|
453
|
-
const h = c[d], m = (s = o[d]) == null ? void 0 : s.atr;
|
|
454
|
-
if (h == null || m === null || m === void 0) {
|
|
455
|
-
l.push({ mid: null, upper: null, lower: null, width: null });
|
|
456
|
-
continue;
|
|
457
|
-
}
|
|
458
|
-
const f = h + a * m, u = h - a * m, y = h !== 0 ? (f - u) / h * 100 : null;
|
|
459
|
-
l.push({ mid: h, upper: f, lower: u, width: y });
|
|
460
|
-
}
|
|
461
|
-
return l;
|
|
462
|
-
}
|
|
463
|
-
const Zt = {
|
|
464
|
-
enabled: !0,
|
|
465
|
-
ttl: 300 * 1e3,
|
|
466
|
-
// 5 分钟
|
|
467
|
-
maxSize: 100
|
|
468
|
-
// 增加缓存容量
|
|
469
|
-
};
|
|
470
|
-
function Yt(e) {
|
|
471
|
-
switch (e) {
|
|
472
|
-
case "timeline":
|
|
473
|
-
case "timeline5":
|
|
474
|
-
return 30 * 1e3;
|
|
475
|
-
// 30 秒
|
|
476
|
-
case "1":
|
|
477
|
-
case "5":
|
|
478
|
-
case "15":
|
|
479
|
-
case "30":
|
|
480
|
-
case "60":
|
|
481
|
-
return 120 * 1e3;
|
|
482
|
-
// 2 分钟
|
|
483
|
-
case "daily":
|
|
484
|
-
case "weekly":
|
|
485
|
-
case "monthly":
|
|
486
|
-
default:
|
|
487
|
-
return 600 * 1e3;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
class ce {
|
|
491
|
-
constructor(t = {}) {
|
|
492
|
-
Re(this, "cache", /* @__PURE__ */ new Map());
|
|
493
|
-
Re(this, "config");
|
|
494
|
-
this.config = { ...Zt, ...t };
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* 生成缓存 key
|
|
498
|
-
*/
|
|
499
|
-
static buildKey(t) {
|
|
500
|
-
return Object.entries(t).filter(([, n]) => n !== void 0).sort(([n], [r]) => n.localeCompare(r)).map(([n, r]) => `${n}:${String(r)}`).join("|");
|
|
501
|
-
}
|
|
502
|
-
/**
|
|
503
|
-
* 获取缓存
|
|
504
|
-
*/
|
|
505
|
-
get(t) {
|
|
506
|
-
if (!this.config.enabled) return;
|
|
507
|
-
const n = this.cache.get(t);
|
|
508
|
-
if (!n) return;
|
|
509
|
-
const r = n.ttl ?? this.config.ttl;
|
|
510
|
-
if (Date.now() - n.timestamp > r) {
|
|
511
|
-
this.cache.delete(t);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
return n.data;
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* 设置缓存
|
|
518
|
-
* @param key 缓存键
|
|
519
|
-
* @param data 缓存数据
|
|
520
|
-
* @param ttl 可选的自定义 TTL(毫秒)
|
|
521
|
-
*/
|
|
522
|
-
set(t, n, r) {
|
|
523
|
-
if (this.config.enabled) {
|
|
524
|
-
if (this.cache.size >= this.config.maxSize && (this.cleanup(), this.cache.size >= this.config.maxSize)) {
|
|
525
|
-
const a = this.cache.keys().next().value;
|
|
526
|
-
a && this.cache.delete(a);
|
|
527
|
-
}
|
|
528
|
-
this.cache.set(t, { data: n, timestamp: Date.now(), ttl: r });
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* 清理过期缓存
|
|
533
|
-
*/
|
|
534
|
-
cleanup() {
|
|
535
|
-
const t = Date.now();
|
|
536
|
-
for (const [n, r] of this.cache.entries()) {
|
|
537
|
-
const a = r.ttl ?? this.config.ttl;
|
|
538
|
-
t - r.timestamp > a && this.cache.delete(n);
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* 删除缓存
|
|
543
|
-
*/
|
|
544
|
-
delete(t) {
|
|
545
|
-
return this.cache.delete(t);
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* 清空缓存
|
|
549
|
-
*/
|
|
550
|
-
clear() {
|
|
551
|
-
this.cache.clear();
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* 获取缓存大小
|
|
555
|
-
*/
|
|
556
|
-
size() {
|
|
557
|
-
return this.cache.size;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
new ce();
|
|
561
|
-
const de = new ce(), je = /* @__PURE__ */ new Map(), qt = 150;
|
|
562
|
-
function Gt(e) {
|
|
563
|
-
const t = new yt(e);
|
|
564
|
-
return {
|
|
565
|
-
getKline: async (n) => {
|
|
566
|
-
const { symbol: r, market: a, period: i, adjust: c } = n;
|
|
567
|
-
if (i === "timeline") {
|
|
568
|
-
const s = await t.getTodayTimeline(r);
|
|
569
|
-
return s.data.map((d) => ({
|
|
570
|
-
date: `${s.date.slice(0, 4)}-${s.date.slice(4, 6)}-${s.date.slice(6, 8)} ${d.time}`,
|
|
571
|
-
open: d.price,
|
|
572
|
-
close: d.price,
|
|
573
|
-
high: d.price,
|
|
574
|
-
low: d.price,
|
|
575
|
-
volume: d.volume,
|
|
576
|
-
amount: d.amount
|
|
577
|
-
}));
|
|
578
|
-
}
|
|
579
|
-
if (i === "timeline5") {
|
|
580
|
-
const s = /* @__PURE__ */ new Date(), d = /* @__PURE__ */ new Date();
|
|
581
|
-
d.setDate(d.getDate() - 7);
|
|
582
|
-
const h = (f) => {
|
|
583
|
-
const u = f.getFullYear(), y = String(f.getMonth() + 1).padStart(2, "0"), x = String(f.getDate()).padStart(2, "0");
|
|
584
|
-
return `${u}-${y}-${x}`;
|
|
585
|
-
};
|
|
586
|
-
return (await t.getMinuteKline(r, {
|
|
587
|
-
period: "1",
|
|
588
|
-
startDate: h(d),
|
|
589
|
-
endDate: h(s)
|
|
590
|
-
})).map((f) => ({
|
|
591
|
-
date: "time" in f ? f.time : "",
|
|
592
|
-
open: f.open,
|
|
593
|
-
close: f.close,
|
|
594
|
-
high: f.high,
|
|
595
|
-
low: f.low,
|
|
596
|
-
volume: f.volume,
|
|
597
|
-
amount: f.amount
|
|
598
|
-
}));
|
|
599
|
-
}
|
|
600
|
-
if (["1", "5", "15", "30", "60"].includes(i)) {
|
|
601
|
-
let d = (await t.getMinuteKline(r, {
|
|
602
|
-
period: i,
|
|
603
|
-
adjust: c || "qfq"
|
|
604
|
-
})).map((h) => ({
|
|
605
|
-
date: "time" in h ? h.time : "",
|
|
606
|
-
open: h.open,
|
|
607
|
-
close: h.close,
|
|
608
|
-
high: h.high,
|
|
609
|
-
low: h.low,
|
|
610
|
-
volume: h.volume,
|
|
611
|
-
amount: h.amount,
|
|
612
|
-
changePercent: "changePercent" in h ? h.changePercent : void 0,
|
|
613
|
-
change: "change" in h ? h.change : void 0,
|
|
614
|
-
amplitude: "amplitude" in h ? h.amplitude : void 0,
|
|
615
|
-
turnoverRate: "turnoverRate" in h ? h.turnoverRate : void 0
|
|
616
|
-
}));
|
|
617
|
-
if (i === "1" && d.length > 0) {
|
|
618
|
-
const h = d[d.length - 1].date.split(" ")[0];
|
|
619
|
-
d = d.filter((m) => m.date.startsWith(h));
|
|
620
|
-
}
|
|
621
|
-
return d;
|
|
622
|
-
}
|
|
623
|
-
const l = {
|
|
624
|
-
daily: "daily",
|
|
625
|
-
weekly: "weekly",
|
|
626
|
-
monthly: "monthly"
|
|
627
|
-
}[i] ?? "daily";
|
|
628
|
-
switch (a) {
|
|
629
|
-
case "HK":
|
|
630
|
-
return await t.getHKHistoryKline(r, {
|
|
631
|
-
period: l,
|
|
632
|
-
adjust: c || "qfq"
|
|
633
|
-
});
|
|
634
|
-
case "US":
|
|
635
|
-
return await t.getUSHistoryKline(r, {
|
|
636
|
-
period: l,
|
|
637
|
-
adjust: c || "qfq"
|
|
638
|
-
});
|
|
639
|
-
default:
|
|
640
|
-
return await t.getHistoryKline(r, {
|
|
641
|
-
period: l,
|
|
642
|
-
adjust: c || "qfq"
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
getTimeline: async (n) => (await t.getTodayTimeline(n.symbol)).data
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
function Jt(e, t, n = {}) {
|
|
650
|
-
if (e.length === 0) return [];
|
|
651
|
-
const r = e.map((w) => w.close), a = e.map((w) => ({
|
|
652
|
-
open: w.open,
|
|
653
|
-
high: w.high,
|
|
654
|
-
low: w.low,
|
|
655
|
-
close: w.close,
|
|
656
|
-
volume: w.volume
|
|
657
|
-
})), i = t.includes("ma") ? jt(r, typeof n.ma == "object" ? n.ma : {}) : null, c = t.includes("macd") ? Tt(r, typeof n.macd == "object" ? n.macd : {}) : null, o = t.includes("boll") ? Bt(r, typeof n.boll == "object" ? n.boll : {}) : null, l = t.includes("kdj") ? Pt(a, typeof n.kdj == "object" ? n.kdj : {}) : null, s = t.includes("rsi") ? Ot(r, typeof n.rsi == "object" ? n.rsi : {}) : null, d = t.includes("wr") ? Kt(a, typeof n.wr == "object" ? n.wr : {}) : null, h = t.includes("bias") ? Et(r, typeof n.bias == "object" ? n.bias : {}) : null, m = t.includes("cci") ? zt(a, typeof n.cci == "object" ? n.cci : {}) : null, f = t.includes("atr") ? Je(a, typeof n.atr == "object" ? n.atr : {}) : null, u = t.includes("obv") ? Ht(a, typeof n.obv == "object" ? n.obv : {}) : null, y = t.includes("roc") ? Ft(r, typeof n.roc == "object" ? n.roc : {}) : null, x = t.includes("dmi") ? Ut(a, typeof n.dmi == "object" ? n.dmi : {}) : null, v = t.includes("sar") ? Vt(a, typeof n.sar == "object" ? n.sar : {}) : null, p = t.includes("kc") ? Wt(a, typeof n.kc == "object" ? n.kc : {}) : null;
|
|
658
|
-
return e.map((w, b) => ({
|
|
659
|
-
...w,
|
|
660
|
-
ma: i == null ? void 0 : i[b],
|
|
661
|
-
macd: c == null ? void 0 : c[b],
|
|
662
|
-
boll: o == null ? void 0 : o[b],
|
|
663
|
-
kdj: l == null ? void 0 : l[b],
|
|
664
|
-
rsi: s == null ? void 0 : s[b],
|
|
665
|
-
wr: d == null ? void 0 : d[b],
|
|
666
|
-
bias: h == null ? void 0 : h[b],
|
|
667
|
-
cci: m == null ? void 0 : m[b],
|
|
668
|
-
atr: f == null ? void 0 : f[b],
|
|
669
|
-
obv: u == null ? void 0 : u[b],
|
|
670
|
-
roc: y == null ? void 0 : y[b],
|
|
671
|
-
dmi: x == null ? void 0 : x[b],
|
|
672
|
-
sar: v == null ? void 0 : v[b],
|
|
673
|
-
kc: p == null ? void 0 : p[b]
|
|
674
|
-
}));
|
|
675
|
-
}
|
|
676
|
-
function Xt(e) {
|
|
677
|
-
const {
|
|
678
|
-
symbol: t,
|
|
679
|
-
market: n,
|
|
680
|
-
period: r,
|
|
681
|
-
adjust: a,
|
|
682
|
-
dataProvider: i,
|
|
683
|
-
sdkOptions: c,
|
|
684
|
-
requestOptions: o,
|
|
685
|
-
indicatorOptions: l,
|
|
686
|
-
indicators: s = ["ma", "volume", "macd"]
|
|
687
|
-
} = e, [d, h] = H([]), [m, f] = H([]), [u, y] = H(!1), [x, v] = H(null), p = Z(null), w = Z(null), b = Z(null), C = $(() => i || (b.current || (b.current = Gt(c)), b.current), [i, c]), _ = $(async () => {
|
|
688
|
-
(o == null ? void 0 : o.abortOnChange) !== !1 && p.current && p.current.abort();
|
|
689
|
-
const j = new AbortController();
|
|
690
|
-
p.current = j, y(!0), v(null);
|
|
691
|
-
try {
|
|
692
|
-
const O = C(), F = ce.buildKey({ symbol: t, market: n, period: r, adjust: a }), Q = de.get(F);
|
|
693
|
-
if (Q && (o == null ? void 0 : o.dedupe) !== !1) {
|
|
694
|
-
if (h(Q), y(!1), r === "timeline") {
|
|
695
|
-
const z = ce.buildKey({ symbol: t, market: n, type: "timeline" }), ee = de.get(z);
|
|
696
|
-
ee && f(ee);
|
|
697
|
-
}
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
const R = je.get(F);
|
|
701
|
-
if (R) {
|
|
702
|
-
try {
|
|
703
|
-
const z = await R;
|
|
704
|
-
j.signal.aborted || h(z);
|
|
705
|
-
} catch {
|
|
706
|
-
} finally {
|
|
707
|
-
j.signal.aborted || y(!1);
|
|
708
|
-
}
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
const U = O.getKline(
|
|
712
|
-
{ symbol: t, market: n, period: r, adjust: a },
|
|
713
|
-
j.signal
|
|
714
|
-
);
|
|
715
|
-
je.set(F, U);
|
|
716
|
-
try {
|
|
717
|
-
const z = await U;
|
|
718
|
-
if (j.signal.aborted) return;
|
|
719
|
-
const ee = Yt(r);
|
|
720
|
-
if (de.set(F, z, ee), h(z), r === "timeline" && O.getTimeline) {
|
|
721
|
-
const E = await O.getTimeline({ symbol: t, market: n }, j.signal);
|
|
722
|
-
if (!j.signal.aborted) {
|
|
723
|
-
const Ce = ce.buildKey({ symbol: t, market: n, type: "timeline" });
|
|
724
|
-
de.set(Ce, E, ee), f(E);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
} finally {
|
|
728
|
-
je.delete(F);
|
|
729
|
-
}
|
|
730
|
-
} catch (O) {
|
|
731
|
-
if (O.name === "AbortError") return;
|
|
732
|
-
v(O);
|
|
733
|
-
} finally {
|
|
734
|
-
j.signal.aborted || y(!1);
|
|
735
|
-
}
|
|
736
|
-
}, [t, n, r, a, C, o]), B = $(async () => {
|
|
737
|
-
const j = ce.buildKey({ symbol: t, market: n, period: r, adjust: a });
|
|
738
|
-
de.delete(j), await _();
|
|
739
|
-
}, [t, n, r, a, _]);
|
|
740
|
-
return W(() => {
|
|
741
|
-
w.current && clearTimeout(w.current);
|
|
742
|
-
const j = (o == null ? void 0 : o.debounceMs) ?? qt;
|
|
743
|
-
return w.current = setTimeout(_, j), () => {
|
|
744
|
-
w.current && clearTimeout(w.current), p.current && p.current.abort();
|
|
745
|
-
};
|
|
746
|
-
}, [t, n, r, a, _, o == null ? void 0 : o.debounceMs]), { data: ne(
|
|
747
|
-
() => Jt(d, s, l),
|
|
748
|
-
[d, s, l]
|
|
749
|
-
), timelineData: m, loading: u, error: x, refresh: B };
|
|
750
|
-
}
|
|
751
|
-
Ge.use([
|
|
752
|
-
xt,
|
|
753
|
-
wt,
|
|
754
|
-
Ct,
|
|
755
|
-
It,
|
|
756
|
-
At,
|
|
757
|
-
St,
|
|
758
|
-
$t,
|
|
759
|
-
kt,
|
|
760
|
-
Mt,
|
|
761
|
-
_t,
|
|
762
|
-
Dt
|
|
763
|
-
]);
|
|
764
|
-
function Qt() {
|
|
765
|
-
const e = Z(null), t = Z(null);
|
|
766
|
-
W(() => {
|
|
767
|
-
if (!e.current) return;
|
|
768
|
-
t.current = Ge.init(e.current);
|
|
769
|
-
const o = new ResizeObserver(() => {
|
|
770
|
-
var l;
|
|
771
|
-
(l = t.current) == null || l.resize();
|
|
772
|
-
});
|
|
773
|
-
return o.observe(e.current), () => {
|
|
774
|
-
var l;
|
|
775
|
-
o.disconnect(), (l = t.current) == null || l.dispose(), t.current = null;
|
|
776
|
-
};
|
|
777
|
-
}, []);
|
|
778
|
-
const n = $(
|
|
779
|
-
(o, l, s = !1) => {
|
|
780
|
-
var h;
|
|
781
|
-
let d;
|
|
782
|
-
typeof l == "boolean" ? d = { notMerge: l, lazyUpdate: s } : d = l ?? {}, (h = t.current) == null || h.setOption(o, d);
|
|
783
|
-
},
|
|
784
|
-
[]
|
|
785
|
-
), r = $(() => {
|
|
786
|
-
var o;
|
|
787
|
-
(o = t.current) == null || o.resize();
|
|
788
|
-
}, []), a = $(() => {
|
|
789
|
-
var o;
|
|
790
|
-
(o = t.current) == null || o.dispose(), t.current = null;
|
|
791
|
-
}, []), i = $(
|
|
792
|
-
(o) => t.current ? t.current.getDataURL({
|
|
793
|
-
type: (o == null ? void 0 : o.type) ?? "png",
|
|
794
|
-
pixelRatio: (o == null ? void 0 : o.pixelRatio) ?? 2,
|
|
795
|
-
backgroundColor: (o == null ? void 0 : o.backgroundColor) ?? "#fff"
|
|
796
|
-
}) : "",
|
|
797
|
-
[]
|
|
798
|
-
), c = $(
|
|
799
|
-
(o, l) => {
|
|
800
|
-
const s = t.current;
|
|
801
|
-
return s ? (s.on(o, l), () => {
|
|
802
|
-
s.off(o, l);
|
|
803
|
-
}) : () => {
|
|
804
|
-
};
|
|
805
|
-
},
|
|
806
|
-
[]
|
|
807
|
-
);
|
|
808
|
-
return {
|
|
809
|
-
chartRef: e,
|
|
810
|
-
chartInstance: t.current,
|
|
811
|
-
setOption: n,
|
|
812
|
-
resize: r,
|
|
813
|
-
dispose: a,
|
|
814
|
-
getDataURL: i,
|
|
815
|
-
bindEvent: c
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
const en = { start: 70, end: 100 }, tn = 50;
|
|
819
|
-
function nn(e = en) {
|
|
820
|
-
const t = Z([e]), n = Z(0), [, r] = H({}), a = t.current[n.current] ?? e, i = $((s) => {
|
|
821
|
-
n.current < t.current.length - 1 && (t.current = t.current.slice(0, n.current + 1)), t.current.length >= tn && (t.current = t.current.slice(1)), t.current.push(s), n.current = t.current.length - 1, r({});
|
|
822
|
-
}, []), c = $(() => n.current > 0 ? (n.current--, r({}), t.current[n.current] ?? null) : null, []), o = $(() => n.current < t.current.length - 1 ? (n.current++, r({}), t.current[n.current] ?? null) : null, []), l = $((s = e) => {
|
|
823
|
-
t.current = [s], n.current = 0, r({});
|
|
824
|
-
}, [e]);
|
|
825
|
-
return {
|
|
826
|
-
canUndo: n.current > 0,
|
|
827
|
-
canRedo: n.current < t.current.length - 1,
|
|
828
|
-
currentState: a,
|
|
829
|
-
pushState: i,
|
|
830
|
-
undo: c,
|
|
831
|
-
redo: o,
|
|
832
|
-
reset: l
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
function on(e, t = 2) {
|
|
836
|
-
return e == null || isNaN(e) ? "--" : e.toLocaleString("zh-CN", {
|
|
837
|
-
minimumFractionDigits: t,
|
|
838
|
-
maximumFractionDigits: t
|
|
839
|
-
});
|
|
840
|
-
}
|
|
841
|
-
function g(e) {
|
|
842
|
-
return on(e, 2);
|
|
843
|
-
}
|
|
844
|
-
function ln(e) {
|
|
845
|
-
return e == null || isNaN(e) ? "--" : `${e > 0 ? "+" : ""}${e.toFixed(2)}%`;
|
|
846
|
-
}
|
|
847
|
-
function rn(e) {
|
|
848
|
-
return e == null || isNaN(e) ? "--" : `${e > 0 ? "+" : ""}${e.toFixed(2)}`;
|
|
849
|
-
}
|
|
850
|
-
function me(e, t) {
|
|
851
|
-
return Number.isInteger(e) ? e.toString() : e.toFixed(t).replace(/\.?0+$/, "");
|
|
852
|
-
}
|
|
853
|
-
function q(e) {
|
|
854
|
-
return e == null || isNaN(e) ? "--" : e >= 1e8 ? `${me(e / 1e8, 2)}亿` : e >= 1e4 ? `${me(e / 1e4, 2)}万` : e.toFixed(0);
|
|
855
|
-
}
|
|
856
|
-
function sn(e) {
|
|
857
|
-
return e == null || isNaN(e) ? "--" : e >= 1e8 ? `${me(e / 1e8, 2)}亿` : e >= 1e4 ? `${me(e / 1e4, 2)}万` : me(e, 2);
|
|
858
|
-
}
|
|
859
|
-
function fo(e, t = "YYYY-MM-DD") {
|
|
860
|
-
const n = typeof e == "string" ? new Date(e) : e;
|
|
861
|
-
if (isNaN(n.getTime()))
|
|
862
|
-
return e;
|
|
863
|
-
const r = n.getFullYear(), a = String(n.getMonth() + 1).padStart(2, "0"), i = String(n.getDate()).padStart(2, "0"), c = String(n.getHours()).padStart(2, "0"), o = String(n.getMinutes()).padStart(2, "0");
|
|
864
|
-
return t.replace("YYYY", String(r)).replace("MM", a).replace("DD", i).replace("HH", c).replace("mm", o);
|
|
865
|
-
}
|
|
866
|
-
function cn(e) {
|
|
867
|
-
const t = [
|
|
868
|
-
`<div style="font-weight:bold;margin-bottom:4px">${e.date}</div>`,
|
|
869
|
-
`<div>开盘: <span style="font-weight:500">${g(e.open)}</span></div>`,
|
|
870
|
-
`<div>最高: <span style="font-weight:500">${g(e.high)}</span></div>`,
|
|
871
|
-
`<div>最低: <span style="font-weight:500">${g(e.low)}</span></div>`,
|
|
872
|
-
`<div>收盘: <span style="font-weight:500">${g(e.close)}</span></div>`
|
|
873
|
-
];
|
|
874
|
-
if (e.change !== void 0 && e.changePercent !== void 0) {
|
|
875
|
-
const a = e.change !== null && e.change > 0 ? "#f5222d" : e.change !== null && e.change < 0 ? "#52c41a" : "inherit";
|
|
876
|
-
t.push(
|
|
877
|
-
`<div>涨跌: <span style="color:${a};font-weight:500">${rn(e.change)} (${ln(e.changePercent)})</span></div>`
|
|
878
|
-
);
|
|
879
|
-
}
|
|
880
|
-
e.volume !== void 0 && t.push(`<div>成交量: ${q(e.volume)}</div>`), e.amount !== void 0 && t.push(`<div>成交额: ${sn(e.amount)}</div>`), e.turnoverRate !== void 0 && e.turnoverRate !== null && t.push(`<div>换手率: ${e.turnoverRate.toFixed(2)}%</div>`), e.amplitude !== void 0 && e.amplitude !== null && t.push(`<div>振幅: ${e.amplitude.toFixed(2)}%</div>`);
|
|
881
|
-
const n = e.indicators ?? [];
|
|
882
|
-
let r = !1;
|
|
883
|
-
if (n.includes("ma") && e.ma && (r ? t.push(`<div>MA: ${g(e.ma.ma5)} / ${g(e.ma.ma10)} / ${g(e.ma.ma20)}</div>`) : (t.push(`<div style="margin-top:4px;border-top:1px solid #eee;padding-top:4px">MA: ${g(e.ma.ma5)} / ${g(e.ma.ma10)} / ${g(e.ma.ma20)}</div>`), r = !0)), n.includes("boll") && e.boll && (r ? t.push(`<div>BOLL: 上 ${g(e.boll.upper)} 中 ${g(e.boll.mid)} 下 ${g(e.boll.lower)}</div>`) : (t.push(`<div style="margin-top:4px;border-top:1px solid #eee;padding-top:4px">BOLL: 上 ${g(e.boll.upper)} 中 ${g(e.boll.mid)} 下 ${g(e.boll.lower)}</div>`), r = !0)), n.includes("sar") && e.sar) {
|
|
884
|
-
const a = e.sar.trend === 1 ? "↑" : "↓";
|
|
885
|
-
r ? t.push(`<div>SAR: ${g(e.sar.sar)} ${a}</div>`) : (t.push(`<div style="margin-top:4px;border-top:1px solid #eee;padding-top:4px">SAR: ${g(e.sar.sar)} ${a}</div>`), r = !0);
|
|
886
|
-
}
|
|
887
|
-
return n.includes("kc") && e.kc && (r ? t.push(`<div>KC: 上 ${g(e.kc.upper)} 中 ${g(e.kc.mid)} 下 ${g(e.kc.lower)}</div>`) : (t.push(`<div style="margin-top:4px;border-top:1px solid #eee;padding-top:4px">KC: 上 ${g(e.kc.upper)} 中 ${g(e.kc.mid)} 下 ${g(e.kc.lower)}</div>`), r = !0)), n.includes("macd") && e.macd && (r ? t.push(`<div>MACD: DIF ${g(e.macd.dif)} DEA ${g(e.macd.dea)} MACD ${g(e.macd.macd)}</div>`) : (t.push(`<div style="margin-top:4px;border-top:1px solid #eee;padding-top:4px">MACD: DIF ${g(e.macd.dif)} DEA ${g(e.macd.dea)} MACD ${g(e.macd.macd)}</div>`), r = !0)), n.includes("kdj") && e.kdj && t.push(`<div>KDJ: K ${g(e.kdj.k)} D ${g(e.kdj.d)} J ${g(e.kdj.j)}</div>`), n.includes("rsi") && e.rsi && t.push(`<div>RSI: ${g(e.rsi.rsi6)} / ${g(e.rsi.rsi12)} / ${g(e.rsi.rsi24)}</div>`), n.includes("wr") && e.wr && t.push(`<div>WR: ${g(e.wr.wr6)} / ${g(e.wr.wr10)}</div>`), n.includes("bias") && e.bias && t.push(`<div>BIAS: ${g(e.bias.bias6)} / ${g(e.bias.bias12)} / ${g(e.bias.bias24)}</div>`), n.includes("cci") && e.cci && t.push(`<div>CCI: ${g(e.cci.cci)}</div>`), n.includes("atr") && e.atr && t.push(`<div>ATR: ${g(e.atr.atr)}</div>`), n.includes("obv") && e.obv && t.push(`<div>OBV: ${q(e.obv.obv)} MA ${q(e.obv.obvMa)}</div>`), n.includes("roc") && e.roc && t.push(`<div>ROC: ${g(e.roc.roc)} SIGNAL ${g(e.roc.signal)}</div>`), n.includes("dmi") && e.dmi && t.push(`<div>DMI: +DI ${g(e.dmi.pdi)} -DI ${g(e.dmi.mdi)} ADX ${g(e.dmi.adx)}</div>`), t.join("");
|
|
888
|
-
}
|
|
889
|
-
const Te = ["ma", "boll", "sar", "kc"], Xe = "kline-zoom-inside", Qe = "kline-zoom-slider";
|
|
890
|
-
function he(e, t) {
|
|
891
|
-
return Number.isInteger(e) ? e.toString() : e.toFixed(t).replace(/\.?0+$/, "");
|
|
892
|
-
}
|
|
893
|
-
function an(e, t) {
|
|
894
|
-
return t.includes("volume") ? q(e) : Math.abs(e) >= 100 || Math.abs(e) >= 10 || Math.abs(e) >= 1 || Math.abs(e) >= 0.01 ? he(e, 2) : he(e, 4);
|
|
895
|
-
}
|
|
896
|
-
function et(e, t = {}) {
|
|
897
|
-
const n = Math.min(Math.max(t.maxSubPanes ?? 3, 0), 3), r = e.filter((s) => !Te.includes(s));
|
|
898
|
-
if (n === 0)
|
|
899
|
-
return [
|
|
900
|
-
{
|
|
901
|
-
id: "main",
|
|
902
|
-
height: "95%",
|
|
903
|
-
indicators: Te.filter((s) => e.includes(s))
|
|
904
|
-
}
|
|
905
|
-
];
|
|
906
|
-
const a = r.length, i = Math.min(a, n), o = i === 0 ? { main: "95%", sub: "0%" } : i === 1 ? { main: "78%", sub: "18%" } : i === 2 ? { main: "65%", sub: "15%" } : { main: "55%", sub: "13%" }, l = [
|
|
907
|
-
{
|
|
908
|
-
id: "main",
|
|
909
|
-
height: o.main,
|
|
910
|
-
indicators: Te.filter((s) => e.includes(s))
|
|
911
|
-
}
|
|
912
|
-
];
|
|
913
|
-
return r.slice(0, n).forEach((s, d) => {
|
|
914
|
-
l.push({
|
|
915
|
-
id: `sub_${s}_${d}`,
|
|
916
|
-
height: o.sub,
|
|
917
|
-
indicators: [s]
|
|
918
|
-
});
|
|
919
|
-
}), l;
|
|
920
|
-
}
|
|
921
|
-
const Be = {
|
|
922
|
-
gap: 25,
|
|
923
|
-
topMargin: 50,
|
|
924
|
-
bottomMargin: 55,
|
|
925
|
-
leftMargin: 60,
|
|
926
|
-
rightMargin: 60
|
|
927
|
-
};
|
|
928
|
-
function tt(e, t) {
|
|
929
|
-
const n = [], { gap: r, topMargin: a, bottomMargin: i } = Be, c = t - a - i - (e.length - 1) * r;
|
|
930
|
-
let o = 0;
|
|
931
|
-
const l = [];
|
|
932
|
-
for (const m of e)
|
|
933
|
-
if (typeof m.height == "string" && m.height.endsWith("%")) {
|
|
934
|
-
const f = parseFloat(m.height) / 100;
|
|
935
|
-
l.push(f), o += f;
|
|
936
|
-
} else typeof m.height == "number" ? (l.push(m.height / c), o += m.height / c) : l.push(0);
|
|
937
|
-
const s = l.filter((m) => m === 0).length;
|
|
938
|
-
if (s > 0 && o < 1) {
|
|
939
|
-
const m = (1 - o) / s;
|
|
940
|
-
for (let f = 0; f < l.length; f++)
|
|
941
|
-
l[f] === 0 && (l[f] = m);
|
|
942
|
-
}
|
|
943
|
-
const d = l.reduce((m, f) => m + f, 0);
|
|
944
|
-
for (let m = 0; m < l.length; m++)
|
|
945
|
-
l[m] = l[m] / d * c;
|
|
946
|
-
let h = a;
|
|
947
|
-
for (let m = 0; m < e.length; m++)
|
|
948
|
-
n.push({
|
|
949
|
-
id: e[m].id,
|
|
950
|
-
left: Be.leftMargin,
|
|
951
|
-
right: Be.rightMargin,
|
|
952
|
-
top: h,
|
|
953
|
-
height: l[m]
|
|
954
|
-
}), h += l[m] + r;
|
|
955
|
-
return n;
|
|
956
|
-
}
|
|
957
|
-
function un(e) {
|
|
958
|
-
const {
|
|
959
|
-
data: t,
|
|
960
|
-
theme: n,
|
|
961
|
-
indicators: r,
|
|
962
|
-
panes: a = et(r),
|
|
963
|
-
containerHeight: i = 500,
|
|
964
|
-
indicatorOptions: c
|
|
965
|
-
} = e, o = typeof (c == null ? void 0 : c.ma) == "object" ? c.ma : void 0, l = (o == null ? void 0 : o.periods) ?? [5, 10, 20, 30, 60];
|
|
966
|
-
if (t.length === 0)
|
|
967
|
-
return {
|
|
968
|
-
title: {
|
|
969
|
-
text: "暂无数据",
|
|
970
|
-
left: "center",
|
|
971
|
-
top: "center",
|
|
972
|
-
textStyle: { color: n.textColorSecondary }
|
|
973
|
-
}
|
|
974
|
-
};
|
|
975
|
-
const s = tt(a, i), d = t.map((u) => u.date), h = t.map((u) => u.close), m = {
|
|
976
|
-
animation: !1,
|
|
977
|
-
backgroundColor: n.backgroundColor,
|
|
978
|
-
// 显式清除 title(避免 "暂无数据" 残留)
|
|
979
|
-
title: { text: "", show: !1 },
|
|
980
|
-
tooltip: {
|
|
981
|
-
trigger: "axis",
|
|
982
|
-
axisPointer: {
|
|
983
|
-
type: "cross",
|
|
984
|
-
crossStyle: { color: n.crosshairColor },
|
|
985
|
-
lineStyle: { color: n.crosshairColor, type: "dashed" }
|
|
986
|
-
},
|
|
987
|
-
backgroundColor: n.tooltipBgColor,
|
|
988
|
-
borderColor: n.tooltipBorderColor,
|
|
989
|
-
textStyle: { color: n.textColor, fontSize: 12 },
|
|
990
|
-
formatter: (u) => {
|
|
991
|
-
if (!Array.isArray(u) || u.length === 0) return "";
|
|
992
|
-
const y = u[0].dataIndex, x = t[y];
|
|
993
|
-
return x ? cn({
|
|
994
|
-
date: x.date,
|
|
995
|
-
open: x.open,
|
|
996
|
-
high: x.high,
|
|
997
|
-
low: x.low,
|
|
998
|
-
close: x.close,
|
|
999
|
-
volume: x.volume,
|
|
1000
|
-
amount: x.amount,
|
|
1001
|
-
change: x.change,
|
|
1002
|
-
changePercent: x.changePercent,
|
|
1003
|
-
turnoverRate: x.turnoverRate,
|
|
1004
|
-
amplitude: x.amplitude,
|
|
1005
|
-
// 传递指标数据
|
|
1006
|
-
indicators: r,
|
|
1007
|
-
// 主图指标
|
|
1008
|
-
ma: x.ma,
|
|
1009
|
-
boll: x.boll,
|
|
1010
|
-
sar: x.sar,
|
|
1011
|
-
kc: x.kc,
|
|
1012
|
-
// 副图指标
|
|
1013
|
-
macd: x.macd,
|
|
1014
|
-
kdj: x.kdj,
|
|
1015
|
-
rsi: x.rsi,
|
|
1016
|
-
wr: x.wr,
|
|
1017
|
-
bias: x.bias,
|
|
1018
|
-
cci: x.cci,
|
|
1019
|
-
atr: x.atr,
|
|
1020
|
-
obv: x.obv,
|
|
1021
|
-
roc: x.roc,
|
|
1022
|
-
dmi: x.dmi
|
|
1023
|
-
}) : "";
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
axisPointer: {
|
|
1027
|
-
link: [{ xAxisIndex: "all" }]
|
|
1028
|
-
},
|
|
1029
|
-
grid: s.map((u) => ({
|
|
1030
|
-
left: u.left,
|
|
1031
|
-
right: u.right,
|
|
1032
|
-
top: u.top,
|
|
1033
|
-
height: u.height
|
|
1034
|
-
})),
|
|
1035
|
-
xAxis: s.map((u, y) => ({
|
|
1036
|
-
type: "category",
|
|
1037
|
-
data: d,
|
|
1038
|
-
gridIndex: y,
|
|
1039
|
-
axisLine: { lineStyle: { color: n.gridLineColor } },
|
|
1040
|
-
axisTick: { show: !1 },
|
|
1041
|
-
axisLabel: {
|
|
1042
|
-
show: y === s.length - 1,
|
|
1043
|
-
color: n.textColorSecondary,
|
|
1044
|
-
fontSize: 11
|
|
1045
|
-
},
|
|
1046
|
-
splitLine: { show: !1 },
|
|
1047
|
-
boundaryGap: !0,
|
|
1048
|
-
min: "dataMin",
|
|
1049
|
-
max: "dataMax"
|
|
1050
|
-
})),
|
|
1051
|
-
yAxis: s.map((u, y) => ({
|
|
1052
|
-
type: "value",
|
|
1053
|
-
gridIndex: y,
|
|
1054
|
-
position: "right",
|
|
1055
|
-
axisLine: { show: !1 },
|
|
1056
|
-
axisTick: { show: !1 },
|
|
1057
|
-
axisLabel: {
|
|
1058
|
-
color: n.textColorSecondary,
|
|
1059
|
-
fontSize: 11,
|
|
1060
|
-
formatter: (x) => an(x, u.id)
|
|
1061
|
-
},
|
|
1062
|
-
splitLine: {
|
|
1063
|
-
lineStyle: { color: n.splitLineColor, type: "dashed" }
|
|
1064
|
-
},
|
|
1065
|
-
// 主图 3 根分割线,副图 2 根
|
|
1066
|
-
splitNumber: u.id === "main" ? 3 : 2,
|
|
1067
|
-
scale: u.id !== "volume" && !u.id.includes("volume")
|
|
1068
|
-
})),
|
|
1069
|
-
dataZoom: [
|
|
1070
|
-
{
|
|
1071
|
-
id: Xe,
|
|
1072
|
-
type: "inside",
|
|
1073
|
-
xAxisIndex: s.map((u, y) => y),
|
|
1074
|
-
minValueSpan: 10
|
|
1075
|
-
},
|
|
1076
|
-
{
|
|
1077
|
-
id: Qe,
|
|
1078
|
-
type: "slider",
|
|
1079
|
-
xAxisIndex: s.map((u, y) => y),
|
|
1080
|
-
bottom: 8,
|
|
1081
|
-
height: 20,
|
|
1082
|
-
borderColor: n.gridLineColor,
|
|
1083
|
-
fillerColor: "rgba(24,144,255,0.1)",
|
|
1084
|
-
handleStyle: { color: n.activeColor },
|
|
1085
|
-
textStyle: { color: n.textColorSecondary }
|
|
1086
|
-
}
|
|
1087
|
-
],
|
|
1088
|
-
series: []
|
|
1089
|
-
}, f = [];
|
|
1090
|
-
for (let u = 0; u < a.length; u++) {
|
|
1091
|
-
const y = a[u];
|
|
1092
|
-
if (s[u].id === "main" && f.push({
|
|
1093
|
-
type: "candlestick",
|
|
1094
|
-
name: "K线",
|
|
1095
|
-
xAxisIndex: u,
|
|
1096
|
-
yAxisIndex: u,
|
|
1097
|
-
data: t.map((v) => [v.open, v.close, v.low, v.high]),
|
|
1098
|
-
itemStyle: {
|
|
1099
|
-
color: n.upColor,
|
|
1100
|
-
color0: n.downColor,
|
|
1101
|
-
borderColor: n.upColor,
|
|
1102
|
-
borderColor0: n.downColor
|
|
1103
|
-
}
|
|
1104
|
-
}), y.indicators.includes("ma") && l.forEach((v, p) => {
|
|
1105
|
-
const w = `ma${v}`, b = t.map((C) => {
|
|
1106
|
-
var _;
|
|
1107
|
-
return ((_ = C.ma) == null ? void 0 : _[w]) ?? null;
|
|
1108
|
-
});
|
|
1109
|
-
f.push({
|
|
1110
|
-
type: "line",
|
|
1111
|
-
name: `MA${v}`,
|
|
1112
|
-
xAxisIndex: u,
|
|
1113
|
-
yAxisIndex: u,
|
|
1114
|
-
data: b,
|
|
1115
|
-
smooth: !0,
|
|
1116
|
-
symbol: "none",
|
|
1117
|
-
lineStyle: {
|
|
1118
|
-
width: 1,
|
|
1119
|
-
color: n.maColors[p] ?? n.maColors[0]
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
}), y.indicators.includes("boll")) {
|
|
1123
|
-
const [v, p, w] = n.bollColors;
|
|
1124
|
-
f.push(
|
|
1125
|
-
{
|
|
1126
|
-
type: "line",
|
|
1127
|
-
name: "BOLL上轨",
|
|
1128
|
-
xAxisIndex: u,
|
|
1129
|
-
yAxisIndex: u,
|
|
1130
|
-
data: t.map((b) => {
|
|
1131
|
-
var C;
|
|
1132
|
-
return ((C = b.boll) == null ? void 0 : C.upper) ?? null;
|
|
1133
|
-
}),
|
|
1134
|
-
smooth: !0,
|
|
1135
|
-
symbol: "none",
|
|
1136
|
-
lineStyle: { width: 1, color: v }
|
|
1137
|
-
},
|
|
1138
|
-
{
|
|
1139
|
-
type: "line",
|
|
1140
|
-
name: "BOLL中轨",
|
|
1141
|
-
xAxisIndex: u,
|
|
1142
|
-
yAxisIndex: u,
|
|
1143
|
-
data: t.map((b) => {
|
|
1144
|
-
var C;
|
|
1145
|
-
return ((C = b.boll) == null ? void 0 : C.mid) ?? null;
|
|
1146
|
-
}),
|
|
1147
|
-
smooth: !0,
|
|
1148
|
-
symbol: "none",
|
|
1149
|
-
lineStyle: { width: 1, color: p }
|
|
1150
|
-
},
|
|
1151
|
-
{
|
|
1152
|
-
type: "line",
|
|
1153
|
-
name: "BOLL下轨",
|
|
1154
|
-
xAxisIndex: u,
|
|
1155
|
-
yAxisIndex: u,
|
|
1156
|
-
data: t.map((b) => {
|
|
1157
|
-
var C;
|
|
1158
|
-
return ((C = b.boll) == null ? void 0 : C.lower) ?? null;
|
|
1159
|
-
}),
|
|
1160
|
-
smooth: !0,
|
|
1161
|
-
symbol: "none",
|
|
1162
|
-
lineStyle: { width: 1, color: w }
|
|
1163
|
-
}
|
|
1164
|
-
);
|
|
1165
|
-
}
|
|
1166
|
-
if (y.indicators.includes("volume") && f.push({
|
|
1167
|
-
type: "bar",
|
|
1168
|
-
name: "成交量",
|
|
1169
|
-
xAxisIndex: u,
|
|
1170
|
-
yAxisIndex: u,
|
|
1171
|
-
data: t.map((v, p) => {
|
|
1172
|
-
const w = p > 0 ? h[p - 1] : v.open, b = (v.close ?? 0) >= (w ?? 0);
|
|
1173
|
-
return {
|
|
1174
|
-
value: v.volume,
|
|
1175
|
-
itemStyle: {
|
|
1176
|
-
color: b ? n.volumeUpColor : n.volumeDownColor
|
|
1177
|
-
}
|
|
1178
|
-
};
|
|
1179
|
-
})
|
|
1180
|
-
}), y.indicators.includes("macd") && f.push(
|
|
1181
|
-
{
|
|
1182
|
-
type: "bar",
|
|
1183
|
-
name: "MACD",
|
|
1184
|
-
xAxisIndex: u,
|
|
1185
|
-
yAxisIndex: u,
|
|
1186
|
-
data: t.map((v) => {
|
|
1187
|
-
var p, w;
|
|
1188
|
-
return {
|
|
1189
|
-
value: ((p = v.macd) == null ? void 0 : p.macd) ?? null,
|
|
1190
|
-
itemStyle: {
|
|
1191
|
-
color: (((w = v.macd) == null ? void 0 : w.macd) ?? 0) >= 0 ? n.upColor : n.downColor
|
|
1192
|
-
}
|
|
1193
|
-
};
|
|
1194
|
-
})
|
|
1195
|
-
},
|
|
1196
|
-
{
|
|
1197
|
-
type: "line",
|
|
1198
|
-
name: "DIF",
|
|
1199
|
-
xAxisIndex: u,
|
|
1200
|
-
yAxisIndex: u,
|
|
1201
|
-
data: t.map((v) => {
|
|
1202
|
-
var p;
|
|
1203
|
-
return ((p = v.macd) == null ? void 0 : p.dif) ?? null;
|
|
1204
|
-
}),
|
|
1205
|
-
symbol: "none",
|
|
1206
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
type: "line",
|
|
1210
|
-
name: "DEA",
|
|
1211
|
-
xAxisIndex: u,
|
|
1212
|
-
yAxisIndex: u,
|
|
1213
|
-
data: t.map((v) => {
|
|
1214
|
-
var p;
|
|
1215
|
-
return ((p = v.macd) == null ? void 0 : p.dea) ?? null;
|
|
1216
|
-
}),
|
|
1217
|
-
symbol: "none",
|
|
1218
|
-
lineStyle: { width: 1, color: "#faad14" }
|
|
1219
|
-
}
|
|
1220
|
-
), y.indicators.includes("kdj") && f.push(
|
|
1221
|
-
{
|
|
1222
|
-
type: "line",
|
|
1223
|
-
name: "K",
|
|
1224
|
-
xAxisIndex: u,
|
|
1225
|
-
yAxisIndex: u,
|
|
1226
|
-
data: t.map((v) => {
|
|
1227
|
-
var p;
|
|
1228
|
-
return ((p = v.kdj) == null ? void 0 : p.k) ?? null;
|
|
1229
|
-
}),
|
|
1230
|
-
symbol: "none",
|
|
1231
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1232
|
-
},
|
|
1233
|
-
{
|
|
1234
|
-
type: "line",
|
|
1235
|
-
name: "D",
|
|
1236
|
-
xAxisIndex: u,
|
|
1237
|
-
yAxisIndex: u,
|
|
1238
|
-
data: t.map((v) => {
|
|
1239
|
-
var p;
|
|
1240
|
-
return ((p = v.kdj) == null ? void 0 : p.d) ?? null;
|
|
1241
|
-
}),
|
|
1242
|
-
symbol: "none",
|
|
1243
|
-
lineStyle: { width: 1, color: "#faad14" }
|
|
1244
|
-
},
|
|
1245
|
-
{
|
|
1246
|
-
type: "line",
|
|
1247
|
-
name: "J",
|
|
1248
|
-
xAxisIndex: u,
|
|
1249
|
-
yAxisIndex: u,
|
|
1250
|
-
data: t.map((v) => {
|
|
1251
|
-
var p;
|
|
1252
|
-
return ((p = v.kdj) == null ? void 0 : p.j) ?? null;
|
|
1253
|
-
}),
|
|
1254
|
-
symbol: "none",
|
|
1255
|
-
lineStyle: { width: 1, color: "#722ed1" }
|
|
1256
|
-
}
|
|
1257
|
-
), y.indicators.includes("rsi") && [6, 12, 24].forEach((p, w) => {
|
|
1258
|
-
f.push({
|
|
1259
|
-
type: "line",
|
|
1260
|
-
name: `RSI${p}`,
|
|
1261
|
-
xAxisIndex: u,
|
|
1262
|
-
yAxisIndex: u,
|
|
1263
|
-
data: t.map((b) => {
|
|
1264
|
-
var C;
|
|
1265
|
-
return ((C = b.rsi) == null ? void 0 : C[`rsi${p}`]) ?? null;
|
|
1266
|
-
}),
|
|
1267
|
-
symbol: "none",
|
|
1268
|
-
lineStyle: { width: 1, color: n.maColors[w] ?? "#1890ff" }
|
|
1269
|
-
});
|
|
1270
|
-
}), y.indicators.includes("wr") && [6, 10].forEach((p, w) => {
|
|
1271
|
-
f.push({
|
|
1272
|
-
type: "line",
|
|
1273
|
-
name: `WR${p}`,
|
|
1274
|
-
xAxisIndex: u,
|
|
1275
|
-
yAxisIndex: u,
|
|
1276
|
-
data: t.map((b) => {
|
|
1277
|
-
var C;
|
|
1278
|
-
return ((C = b.wr) == null ? void 0 : C[`wr${p}`]) ?? null;
|
|
1279
|
-
}),
|
|
1280
|
-
symbol: "none",
|
|
1281
|
-
lineStyle: { width: 1, color: n.maColors[w] ?? "#1890ff" }
|
|
1282
|
-
});
|
|
1283
|
-
}), y.indicators.includes("bias") && [6, 12, 24].forEach((p, w) => {
|
|
1284
|
-
f.push({
|
|
1285
|
-
type: "line",
|
|
1286
|
-
name: `BIAS${p}`,
|
|
1287
|
-
xAxisIndex: u,
|
|
1288
|
-
yAxisIndex: u,
|
|
1289
|
-
data: t.map((b) => {
|
|
1290
|
-
var C;
|
|
1291
|
-
return ((C = b.bias) == null ? void 0 : C[`bias${p}`]) ?? null;
|
|
1292
|
-
}),
|
|
1293
|
-
symbol: "none",
|
|
1294
|
-
lineStyle: { width: 1, color: n.maColors[w] ?? "#1890ff" }
|
|
1295
|
-
});
|
|
1296
|
-
}), y.indicators.includes("cci") && f.push({
|
|
1297
|
-
type: "line",
|
|
1298
|
-
name: "CCI",
|
|
1299
|
-
xAxisIndex: u,
|
|
1300
|
-
yAxisIndex: u,
|
|
1301
|
-
data: t.map((v) => {
|
|
1302
|
-
var p;
|
|
1303
|
-
return ((p = v.cci) == null ? void 0 : p.cci) ?? null;
|
|
1304
|
-
}),
|
|
1305
|
-
symbol: "none",
|
|
1306
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1307
|
-
}), y.indicators.includes("atr") && f.push({
|
|
1308
|
-
type: "line",
|
|
1309
|
-
name: "ATR",
|
|
1310
|
-
xAxisIndex: u,
|
|
1311
|
-
yAxisIndex: u,
|
|
1312
|
-
data: t.map((v) => {
|
|
1313
|
-
var p;
|
|
1314
|
-
return ((p = v.atr) == null ? void 0 : p.atr) ?? null;
|
|
1315
|
-
}),
|
|
1316
|
-
symbol: "none",
|
|
1317
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1318
|
-
}), y.indicators.includes("obv") && f.push(
|
|
1319
|
-
{
|
|
1320
|
-
type: "line",
|
|
1321
|
-
name: "OBV",
|
|
1322
|
-
xAxisIndex: u,
|
|
1323
|
-
yAxisIndex: u,
|
|
1324
|
-
data: t.map((v) => {
|
|
1325
|
-
var p;
|
|
1326
|
-
return ((p = v.obv) == null ? void 0 : p.obv) ?? null;
|
|
1327
|
-
}),
|
|
1328
|
-
symbol: "none",
|
|
1329
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1330
|
-
},
|
|
1331
|
-
{
|
|
1332
|
-
type: "line",
|
|
1333
|
-
name: "OBV_MA",
|
|
1334
|
-
xAxisIndex: u,
|
|
1335
|
-
yAxisIndex: u,
|
|
1336
|
-
data: t.map((v) => {
|
|
1337
|
-
var p;
|
|
1338
|
-
return ((p = v.obv) == null ? void 0 : p.obvMa) ?? null;
|
|
1339
|
-
}),
|
|
1340
|
-
symbol: "none",
|
|
1341
|
-
lineStyle: { width: 1, color: "#faad14" }
|
|
1342
|
-
}
|
|
1343
|
-
), y.indicators.includes("roc") && f.push(
|
|
1344
|
-
{
|
|
1345
|
-
type: "line",
|
|
1346
|
-
name: "ROC",
|
|
1347
|
-
xAxisIndex: u,
|
|
1348
|
-
yAxisIndex: u,
|
|
1349
|
-
data: t.map((v) => {
|
|
1350
|
-
var p;
|
|
1351
|
-
return ((p = v.roc) == null ? void 0 : p.roc) ?? null;
|
|
1352
|
-
}),
|
|
1353
|
-
symbol: "none",
|
|
1354
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1355
|
-
},
|
|
1356
|
-
{
|
|
1357
|
-
type: "line",
|
|
1358
|
-
name: "ROC_MA",
|
|
1359
|
-
xAxisIndex: u,
|
|
1360
|
-
yAxisIndex: u,
|
|
1361
|
-
data: t.map((v) => {
|
|
1362
|
-
var p;
|
|
1363
|
-
return ((p = v.roc) == null ? void 0 : p.signal) ?? null;
|
|
1364
|
-
}),
|
|
1365
|
-
symbol: "none",
|
|
1366
|
-
lineStyle: { width: 1, color: "#faad14" }
|
|
1367
|
-
}
|
|
1368
|
-
), y.indicators.includes("dmi") && f.push(
|
|
1369
|
-
{
|
|
1370
|
-
type: "line",
|
|
1371
|
-
name: "+DI",
|
|
1372
|
-
xAxisIndex: u,
|
|
1373
|
-
yAxisIndex: u,
|
|
1374
|
-
data: t.map((v) => {
|
|
1375
|
-
var p;
|
|
1376
|
-
return ((p = v.dmi) == null ? void 0 : p.pdi) ?? null;
|
|
1377
|
-
}),
|
|
1378
|
-
symbol: "none",
|
|
1379
|
-
lineStyle: { width: 1, color: n.upColor }
|
|
1380
|
-
},
|
|
1381
|
-
{
|
|
1382
|
-
type: "line",
|
|
1383
|
-
name: "-DI",
|
|
1384
|
-
xAxisIndex: u,
|
|
1385
|
-
yAxisIndex: u,
|
|
1386
|
-
data: t.map((v) => {
|
|
1387
|
-
var p;
|
|
1388
|
-
return ((p = v.dmi) == null ? void 0 : p.mdi) ?? null;
|
|
1389
|
-
}),
|
|
1390
|
-
symbol: "none",
|
|
1391
|
-
lineStyle: { width: 1, color: n.downColor }
|
|
1392
|
-
},
|
|
1393
|
-
{
|
|
1394
|
-
type: "line",
|
|
1395
|
-
name: "ADX",
|
|
1396
|
-
xAxisIndex: u,
|
|
1397
|
-
yAxisIndex: u,
|
|
1398
|
-
data: t.map((v) => {
|
|
1399
|
-
var p;
|
|
1400
|
-
return ((p = v.dmi) == null ? void 0 : p.adx) ?? null;
|
|
1401
|
-
}),
|
|
1402
|
-
symbol: "none",
|
|
1403
|
-
lineStyle: { width: 1, color: "#1890ff" }
|
|
1404
|
-
},
|
|
1405
|
-
{
|
|
1406
|
-
type: "line",
|
|
1407
|
-
name: "ADXR",
|
|
1408
|
-
xAxisIndex: u,
|
|
1409
|
-
yAxisIndex: u,
|
|
1410
|
-
data: t.map((v) => {
|
|
1411
|
-
var p;
|
|
1412
|
-
return ((p = v.dmi) == null ? void 0 : p.adxr) ?? null;
|
|
1413
|
-
}),
|
|
1414
|
-
symbol: "none",
|
|
1415
|
-
lineStyle: { width: 1, color: "#722ed1", type: "dashed" }
|
|
1416
|
-
}
|
|
1417
|
-
), y.indicators.includes("sar") && f.push({
|
|
1418
|
-
type: "scatter",
|
|
1419
|
-
name: "SAR",
|
|
1420
|
-
xAxisIndex: u,
|
|
1421
|
-
yAxisIndex: u,
|
|
1422
|
-
data: t.map((v) => {
|
|
1423
|
-
var p, w;
|
|
1424
|
-
return {
|
|
1425
|
-
value: ((p = v.sar) == null ? void 0 : p.sar) ?? null,
|
|
1426
|
-
itemStyle: {
|
|
1427
|
-
// 上升趋势用红色,下降趋势用绿色
|
|
1428
|
-
color: ((w = v.sar) == null ? void 0 : w.trend) === 1 ? n.upColor : n.downColor
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
}),
|
|
1432
|
-
symbol: "circle",
|
|
1433
|
-
symbolSize: 4
|
|
1434
|
-
}), y.indicators.includes("kc")) {
|
|
1435
|
-
const [v, p, w] = n.kcColors;
|
|
1436
|
-
f.push(
|
|
1437
|
-
{
|
|
1438
|
-
type: "line",
|
|
1439
|
-
name: "KC上轨",
|
|
1440
|
-
xAxisIndex: u,
|
|
1441
|
-
yAxisIndex: u,
|
|
1442
|
-
data: t.map((b) => {
|
|
1443
|
-
var C;
|
|
1444
|
-
return ((C = b.kc) == null ? void 0 : C.upper) ?? null;
|
|
1445
|
-
}),
|
|
1446
|
-
smooth: !0,
|
|
1447
|
-
symbol: "none",
|
|
1448
|
-
lineStyle: { width: 1, color: v }
|
|
1449
|
-
},
|
|
1450
|
-
{
|
|
1451
|
-
type: "line",
|
|
1452
|
-
name: "KC中轨",
|
|
1453
|
-
xAxisIndex: u,
|
|
1454
|
-
yAxisIndex: u,
|
|
1455
|
-
data: t.map((b) => {
|
|
1456
|
-
var C;
|
|
1457
|
-
return ((C = b.kc) == null ? void 0 : C.mid) ?? null;
|
|
1458
|
-
}),
|
|
1459
|
-
smooth: !0,
|
|
1460
|
-
symbol: "none",
|
|
1461
|
-
lineStyle: { width: 1, color: p }
|
|
1462
|
-
},
|
|
1463
|
-
{
|
|
1464
|
-
type: "line",
|
|
1465
|
-
name: "KC下轨",
|
|
1466
|
-
xAxisIndex: u,
|
|
1467
|
-
yAxisIndex: u,
|
|
1468
|
-
data: t.map((b) => {
|
|
1469
|
-
var C;
|
|
1470
|
-
return ((C = b.kc) == null ? void 0 : C.lower) ?? null;
|
|
1471
|
-
}),
|
|
1472
|
-
smooth: !0,
|
|
1473
|
-
symbol: "none",
|
|
1474
|
-
lineStyle: { width: 1, color: w }
|
|
1475
|
-
}
|
|
1476
|
-
);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
return m.series = f, m;
|
|
1480
|
-
}
|
|
1481
|
-
function dn(e, t, n = "safeMerge") {
|
|
1482
|
-
if (!t) return e;
|
|
1483
|
-
if (n === "replace") return t;
|
|
1484
|
-
const r = { ...e };
|
|
1485
|
-
for (const a of Object.keys(t)) {
|
|
1486
|
-
const i = t[a];
|
|
1487
|
-
i !== void 0 && (Array.isArray(i) ? r[a] = i : typeof i == "object" && i !== null ? r[a] = {
|
|
1488
|
-
...r[a],
|
|
1489
|
-
...i
|
|
1490
|
-
} : r[a] = i);
|
|
1491
|
-
}
|
|
1492
|
-
return r;
|
|
1493
|
-
}
|
|
1494
|
-
function Ye(e, t) {
|
|
1495
|
-
if (e.startsWith("rgba"))
|
|
1496
|
-
return e.replace(/,\s*[\d.]+\)$/, `, ${t})`);
|
|
1497
|
-
if (e.startsWith("rgb("))
|
|
1498
|
-
return e.replace("rgb(", "rgba(").replace(")", `, ${t})`);
|
|
1499
|
-
let n = e.replace("#", "");
|
|
1500
|
-
n.length === 3 && (n = n[0] + n[0] + n[1] + n[1] + n[2] + n[2]);
|
|
1501
|
-
const r = parseInt(n.slice(0, 2), 16), a = parseInt(n.slice(2, 4), 16), i = parseInt(n.slice(4, 6), 16);
|
|
1502
|
-
return `rgba(${r}, ${a}, ${i}, ${t})`;
|
|
1503
|
-
}
|
|
1504
|
-
function hn(e) {
|
|
1505
|
-
const { data: t, theme: n, prevClose: r, containerHeight: a = 500 } = e;
|
|
1506
|
-
if (t.length === 0)
|
|
42
|
+
function yt(a) {
|
|
43
|
+
return typeof a == "string" ? a === "dark" ? bt : Ze : { ...Ze, ...a };
|
|
44
|
+
}
|
|
45
|
+
function Oe(a, i) {
|
|
46
|
+
if (a.startsWith("rgba"))
|
|
47
|
+
return a.replace(/,\s*[\d.]+\)$/, `, ${i})`);
|
|
48
|
+
if (a.startsWith("rgb("))
|
|
49
|
+
return a.replace("rgb(", "rgba(").replace(")", `, ${i})`);
|
|
50
|
+
let t = a.replace("#", "");
|
|
51
|
+
t.length === 3 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]);
|
|
52
|
+
const l = parseInt(t.slice(0, 2), 16), m = parseInt(t.slice(2, 4), 16), g = parseInt(t.slice(4, 6), 16);
|
|
53
|
+
return `rgba(${l}, ${m}, ${g}, ${i})`;
|
|
54
|
+
}
|
|
55
|
+
function vt(a) {
|
|
56
|
+
const { data: i, theme: t, prevClose: l, containerHeight: m = 500 } = a;
|
|
57
|
+
if (i.length === 0)
|
|
1507
58
|
return {
|
|
1508
59
|
title: {
|
|
1509
60
|
text: "暂无分时数据",
|
|
1510
61
|
left: "center",
|
|
1511
62
|
top: "center",
|
|
1512
|
-
textStyle: { color:
|
|
63
|
+
textStyle: { color: t.textColorSecondary }
|
|
1513
64
|
}
|
|
1514
65
|
};
|
|
1515
|
-
const
|
|
1516
|
-
var
|
|
1517
|
-
const C =
|
|
1518
|
-
return
|
|
1519
|
-
}),
|
|
66
|
+
const g = i.map((s) => s.time), p = i.map((s) => s.price), R = i.map((s) => s.avgPrice), I = i.map((s, y) => {
|
|
67
|
+
var L;
|
|
68
|
+
const C = y > 0 ? ((L = i[y - 1]) == null ? void 0 : L.volume) ?? 0 : 0;
|
|
69
|
+
return s.volume - C;
|
|
70
|
+
}), b = p.filter((s) => s > 0), j = b.length > 0 ? Math.min(...b) : 0, k = b.length > 0 ? Math.max(...b) : 0, F = (k - j) * 0.1 || 1, H = p[p.length - 1] ?? 0, D = l ? H >= l ? t.upColor : t.downColor : t.activeColor, K = Math.max(60, m * 0.15), U = m - K - 100;
|
|
1520
71
|
return {
|
|
1521
72
|
animation: !1,
|
|
1522
|
-
backgroundColor:
|
|
73
|
+
backgroundColor: t.backgroundColor,
|
|
1523
74
|
tooltip: {
|
|
1524
75
|
trigger: "axis",
|
|
1525
76
|
axisPointer: {
|
|
1526
77
|
type: "cross",
|
|
1527
|
-
crossStyle: { color:
|
|
1528
|
-
lineStyle: { color:
|
|
78
|
+
crossStyle: { color: t.crosshairColor },
|
|
79
|
+
lineStyle: { color: t.crosshairColor, type: "dashed" }
|
|
1529
80
|
},
|
|
1530
|
-
backgroundColor:
|
|
1531
|
-
borderColor:
|
|
1532
|
-
textStyle: { color:
|
|
1533
|
-
formatter: (
|
|
1534
|
-
if (!Array.isArray(
|
|
1535
|
-
const
|
|
81
|
+
backgroundColor: t.tooltipBgColor,
|
|
82
|
+
borderColor: t.tooltipBorderColor,
|
|
83
|
+
textStyle: { color: t.textColor, fontSize: 12 },
|
|
84
|
+
formatter: (s) => {
|
|
85
|
+
if (!Array.isArray(s) || s.length === 0) return "";
|
|
86
|
+
const y = s[0].dataIndex, C = i[y];
|
|
1536
87
|
if (!C) return "";
|
|
1537
|
-
const
|
|
88
|
+
const L = l ? ((C.price - l) / l * 100).toFixed(2) : "--", q = l && C.price >= l ? t.upColor : t.downColor;
|
|
1538
89
|
return `
|
|
1539
90
|
<div style="font-weight:bold;margin-bottom:4px">${C.time}</div>
|
|
1540
|
-
<div>价格: <span style="color:${
|
|
1541
|
-
<div>均价: ${
|
|
1542
|
-
<div>涨跌: <span style="color:${
|
|
1543
|
-
<div>成交量: ${
|
|
91
|
+
<div>价格: <span style="color:${q};font-weight:500">${ye(C.price)}</span></div>
|
|
92
|
+
<div>均价: ${ye(C.avgPrice)}</div>
|
|
93
|
+
<div>涨跌: <span style="color:${q}">${L}%</span></div>
|
|
94
|
+
<div>成交量: ${Ne(C.volume)}</div>
|
|
1544
95
|
`;
|
|
1545
96
|
}
|
|
1546
97
|
},
|
|
@@ -1552,21 +103,21 @@ function hn(e) {
|
|
|
1552
103
|
left: 60,
|
|
1553
104
|
right: 60,
|
|
1554
105
|
top: 40,
|
|
1555
|
-
height:
|
|
106
|
+
height: U
|
|
1556
107
|
},
|
|
1557
108
|
{
|
|
1558
109
|
left: 60,
|
|
1559
110
|
right: 60,
|
|
1560
|
-
top:
|
|
1561
|
-
height:
|
|
111
|
+
top: U + 70,
|
|
112
|
+
height: K
|
|
1562
113
|
}
|
|
1563
114
|
],
|
|
1564
115
|
xAxis: [
|
|
1565
116
|
{
|
|
1566
117
|
type: "category",
|
|
1567
|
-
data:
|
|
118
|
+
data: g,
|
|
1568
119
|
gridIndex: 0,
|
|
1569
|
-
axisLine: { lineStyle: { color:
|
|
120
|
+
axisLine: { lineStyle: { color: t.gridLineColor } },
|
|
1570
121
|
axisTick: { show: !1 },
|
|
1571
122
|
axisLabel: { show: !1 },
|
|
1572
123
|
splitLine: { show: !1 },
|
|
@@ -1574,14 +125,14 @@ function hn(e) {
|
|
|
1574
125
|
},
|
|
1575
126
|
{
|
|
1576
127
|
type: "category",
|
|
1577
|
-
data:
|
|
128
|
+
data: g,
|
|
1578
129
|
gridIndex: 1,
|
|
1579
|
-
axisLine: { lineStyle: { color:
|
|
130
|
+
axisLine: { lineStyle: { color: t.gridLineColor } },
|
|
1580
131
|
axisTick: { show: !1 },
|
|
1581
132
|
axisLabel: {
|
|
1582
|
-
color:
|
|
133
|
+
color: t.textColorSecondary,
|
|
1583
134
|
fontSize: 11,
|
|
1584
|
-
formatter: (
|
|
135
|
+
formatter: (s) => s
|
|
1585
136
|
},
|
|
1586
137
|
splitLine: { show: !1 },
|
|
1587
138
|
boundaryGap: !1
|
|
@@ -1595,15 +146,15 @@ function hn(e) {
|
|
|
1595
146
|
axisLine: { show: !1 },
|
|
1596
147
|
axisTick: { show: !1 },
|
|
1597
148
|
axisLabel: {
|
|
1598
|
-
color:
|
|
149
|
+
color: t.textColorSecondary,
|
|
1599
150
|
fontSize: 11,
|
|
1600
|
-
formatter: (
|
|
151
|
+
formatter: (s) => ye(s)
|
|
1601
152
|
},
|
|
1602
153
|
splitLine: {
|
|
1603
|
-
lineStyle: { color:
|
|
154
|
+
lineStyle: { color: t.splitLineColor, type: "dashed" }
|
|
1604
155
|
},
|
|
1605
|
-
min:
|
|
1606
|
-
max:
|
|
156
|
+
min: j - F,
|
|
157
|
+
max: k + F
|
|
1607
158
|
},
|
|
1608
159
|
{
|
|
1609
160
|
type: "value",
|
|
@@ -1612,12 +163,12 @@ function hn(e) {
|
|
|
1612
163
|
axisLine: { show: !1 },
|
|
1613
164
|
axisTick: { show: !1 },
|
|
1614
165
|
axisLabel: {
|
|
1615
|
-
color:
|
|
166
|
+
color: t.textColorSecondary,
|
|
1616
167
|
fontSize: 11,
|
|
1617
|
-
formatter: (
|
|
168
|
+
formatter: (s) => Ne(s)
|
|
1618
169
|
},
|
|
1619
170
|
splitLine: {
|
|
1620
|
-
lineStyle: { color:
|
|
171
|
+
lineStyle: { color: t.splitLineColor, type: "dashed" }
|
|
1621
172
|
}
|
|
1622
173
|
}
|
|
1623
174
|
],
|
|
@@ -1628,11 +179,11 @@ function hn(e) {
|
|
|
1628
179
|
name: "价格",
|
|
1629
180
|
xAxisIndex: 0,
|
|
1630
181
|
yAxisIndex: 0,
|
|
1631
|
-
data:
|
|
182
|
+
data: p,
|
|
1632
183
|
symbol: "none",
|
|
1633
184
|
lineStyle: {
|
|
1634
185
|
width: 1.5,
|
|
1635
|
-
color:
|
|
186
|
+
color: D
|
|
1636
187
|
},
|
|
1637
188
|
areaStyle: {
|
|
1638
189
|
color: {
|
|
@@ -1642,8 +193,8 @@ function hn(e) {
|
|
|
1642
193
|
x2: 0,
|
|
1643
194
|
y2: 1,
|
|
1644
195
|
colorStops: [
|
|
1645
|
-
{ offset: 0, color:
|
|
1646
|
-
{ offset: 1, color:
|
|
196
|
+
{ offset: 0, color: Oe(D, 0.3) },
|
|
197
|
+
{ offset: 1, color: Oe(D, 0.05) }
|
|
1647
198
|
]
|
|
1648
199
|
}
|
|
1649
200
|
}
|
|
@@ -1654,7 +205,7 @@ function hn(e) {
|
|
|
1654
205
|
name: "均价",
|
|
1655
206
|
xAxisIndex: 0,
|
|
1656
207
|
yAxisIndex: 0,
|
|
1657
|
-
data:
|
|
208
|
+
data: R,
|
|
1658
209
|
symbol: "none",
|
|
1659
210
|
lineStyle: {
|
|
1660
211
|
width: 1,
|
|
@@ -1663,17 +214,17 @@ function hn(e) {
|
|
|
1663
214
|
}
|
|
1664
215
|
},
|
|
1665
216
|
// 昨收线
|
|
1666
|
-
...
|
|
217
|
+
...l ? [
|
|
1667
218
|
{
|
|
1668
219
|
type: "line",
|
|
1669
220
|
name: "昨收",
|
|
1670
221
|
xAxisIndex: 0,
|
|
1671
222
|
yAxisIndex: 0,
|
|
1672
|
-
data:
|
|
223
|
+
data: g.map(() => l),
|
|
1673
224
|
symbol: "none",
|
|
1674
225
|
lineStyle: {
|
|
1675
226
|
width: 1,
|
|
1676
|
-
color:
|
|
227
|
+
color: t.textColorSecondary,
|
|
1677
228
|
type: "dotted"
|
|
1678
229
|
}
|
|
1679
230
|
}
|
|
@@ -1684,12 +235,12 @@ function hn(e) {
|
|
|
1684
235
|
name: "成交量",
|
|
1685
236
|
xAxisIndex: 1,
|
|
1686
237
|
yAxisIndex: 1,
|
|
1687
|
-
data:
|
|
1688
|
-
const C =
|
|
238
|
+
data: I.map((s, y) => {
|
|
239
|
+
const C = p[y] ?? 0, L = y > 0 ? p[y - 1] ?? C : l ?? C;
|
|
1689
240
|
return {
|
|
1690
|
-
value:
|
|
241
|
+
value: s,
|
|
1691
242
|
itemStyle: {
|
|
1692
|
-
color: C >=
|
|
243
|
+
color: C >= L ? t.volumeUpColor : t.volumeDownColor
|
|
1693
244
|
}
|
|
1694
245
|
};
|
|
1695
246
|
})
|
|
@@ -1697,787 +248,467 @@ function hn(e) {
|
|
|
1697
248
|
]
|
|
1698
249
|
};
|
|
1699
250
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
button: xn,
|
|
1720
|
-
active: wn
|
|
1721
|
-
}, Cn = [
|
|
1722
|
-
{
|
|
1723
|
-
label: "分时",
|
|
1724
|
-
periods: [
|
|
1725
|
-
{ value: "timeline", label: "分时" },
|
|
1726
|
-
{ value: "timeline5", label: "五日" }
|
|
251
|
+
function ve({
|
|
252
|
+
value: a,
|
|
253
|
+
defaultValue: i,
|
|
254
|
+
onChange: t
|
|
255
|
+
}) {
|
|
256
|
+
const [l, m] = se(i), g = a !== void 0, p = g ? a : l, R = x(
|
|
257
|
+
(I) => {
|
|
258
|
+
g || m(I), t == null || t(I);
|
|
259
|
+
},
|
|
260
|
+
[g, t]
|
|
261
|
+
);
|
|
262
|
+
return [p, R];
|
|
263
|
+
}
|
|
264
|
+
const St = {
|
|
265
|
+
A: {
|
|
266
|
+
timeZone: "Asia/Shanghai",
|
|
267
|
+
sessions: [
|
|
268
|
+
[570, 690],
|
|
269
|
+
[780, 900]
|
|
1727
270
|
]
|
|
1728
271
|
},
|
|
1729
|
-
{
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
{ value: "monthly", label: "月K" }
|
|
272
|
+
HK: {
|
|
273
|
+
timeZone: "Asia/Hong_Kong",
|
|
274
|
+
sessions: [
|
|
275
|
+
[570, 720],
|
|
276
|
+
[780, 960]
|
|
1735
277
|
]
|
|
1736
278
|
},
|
|
1737
|
-
{
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
"
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
{ value: "rsi", label: "RSI", group: "sub" },
|
|
1775
|
-
{ value: "wr", label: "WR", group: "sub" },
|
|
1776
|
-
{ value: "bias", label: "BIAS", group: "sub" },
|
|
1777
|
-
{ value: "cci", label: "CCI", group: "sub" },
|
|
1778
|
-
{ value: "atr", label: "ATR", group: "sub" },
|
|
1779
|
-
{ value: "obv", label: "OBV", group: "sub" },
|
|
1780
|
-
{ value: "roc", label: "ROC", group: "sub" },
|
|
1781
|
-
{ value: "dmi", label: "DMI", group: "sub" }
|
|
1782
|
-
];
|
|
1783
|
-
function Pe(e) {
|
|
1784
|
-
return nt.find((n) => n.value === e) ? "main" : "sub";
|
|
1785
|
-
}
|
|
1786
|
-
function _n({
|
|
1787
|
-
value: e,
|
|
1788
|
-
onChange: t,
|
|
1789
|
-
maxSubPanes: n = 3,
|
|
1790
|
-
maxMainIndicators: r = 2
|
|
1791
|
-
}) {
|
|
1792
|
-
const a = (i) => {
|
|
1793
|
-
const c = Pe(i);
|
|
1794
|
-
if (e.includes(i))
|
|
1795
|
-
t(e.filter((o) => o !== i));
|
|
1796
|
-
else if (c === "main") {
|
|
1797
|
-
const o = e.filter((l) => Pe(l) === "main");
|
|
1798
|
-
if (o.length >= r) {
|
|
1799
|
-
const l = o[o.length - 1], s = e.filter((d) => d !== l);
|
|
1800
|
-
t([...s, i]);
|
|
1801
|
-
} else
|
|
1802
|
-
t([...e, i]);
|
|
1803
|
-
} else {
|
|
1804
|
-
const o = e.filter((l) => Pe(l) === "sub");
|
|
1805
|
-
if (o.length >= n) {
|
|
1806
|
-
const l = o[o.length - 1], s = e.filter((d) => d !== l);
|
|
1807
|
-
t([...s, i]);
|
|
1808
|
-
} else
|
|
1809
|
-
t([...e, i]);
|
|
1810
|
-
}
|
|
1811
|
-
};
|
|
1812
|
-
return /* @__PURE__ */ k("div", { className: se.container, children: [
|
|
1813
|
-
nt.map((i) => /* @__PURE__ */ A(
|
|
1814
|
-
"button",
|
|
1815
|
-
{
|
|
1816
|
-
type: "button",
|
|
1817
|
-
className: `${se.button} ${e.includes(i.value) ? se.active : ""}`,
|
|
1818
|
-
onClick: () => a(i.value),
|
|
1819
|
-
children: i.label
|
|
1820
|
-
},
|
|
1821
|
-
i.value
|
|
1822
|
-
)),
|
|
1823
|
-
/* @__PURE__ */ A("div", { className: se.divider }),
|
|
1824
|
-
Mn.map((i) => /* @__PURE__ */ A(
|
|
1825
|
-
"button",
|
|
1826
|
-
{
|
|
1827
|
-
type: "button",
|
|
1828
|
-
className: `${se.button} ${e.includes(i.value) ? se.active : ""}`,
|
|
1829
|
-
onClick: () => a(i.value),
|
|
1830
|
-
children: i.label
|
|
1831
|
-
},
|
|
1832
|
-
i.value
|
|
1833
|
-
))
|
|
1834
|
-
] });
|
|
1835
|
-
}
|
|
1836
|
-
const Dn = "_container_2tswg_1", Ln = "_group_2tswg_10", Nn = "_divider_2tswg_16", Rn = "_spacer_2tswg_23", jn = "_iconButton_2tswg_27", Tn = "_textButton_2tswg_51", Bn = "_active_2tswg_67", N = {
|
|
1837
|
-
container: Dn,
|
|
1838
|
-
group: Ln,
|
|
1839
|
-
divider: Nn,
|
|
1840
|
-
spacer: Rn,
|
|
1841
|
-
iconButton: jn,
|
|
1842
|
-
textButton: Tn,
|
|
1843
|
-
active: Bn
|
|
1844
|
-
}, Pn = [
|
|
1845
|
-
{ value: "", label: "不复权" },
|
|
1846
|
-
{ value: "qfq", label: "前复权" },
|
|
1847
|
-
{ value: "hfq", label: "后复权" }
|
|
1848
|
-
];
|
|
1849
|
-
function On({
|
|
1850
|
-
adjust: e,
|
|
1851
|
-
onAdjustChange: t,
|
|
1852
|
-
canUndo: n,
|
|
1853
|
-
canRedo: r,
|
|
1854
|
-
onUndo: a,
|
|
1855
|
-
onRedo: i,
|
|
1856
|
-
onZoomIn: c,
|
|
1857
|
-
onZoomOut: o,
|
|
1858
|
-
onPanLeft: l,
|
|
1859
|
-
onPanRight: s,
|
|
1860
|
-
onReset: d,
|
|
1861
|
-
onFullscreen: h
|
|
1862
|
-
}) {
|
|
1863
|
-
return /* @__PURE__ */ k("div", { className: N.container, children: [
|
|
1864
|
-
/* @__PURE__ */ k("div", { className: N.group, children: [
|
|
1865
|
-
/* @__PURE__ */ A(
|
|
1866
|
-
"button",
|
|
1867
|
-
{
|
|
1868
|
-
type: "button",
|
|
1869
|
-
className: N.iconButton,
|
|
1870
|
-
onClick: a,
|
|
1871
|
-
disabled: !n,
|
|
1872
|
-
title: "撤销",
|
|
1873
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z" }) })
|
|
1874
|
-
}
|
|
1875
|
-
),
|
|
1876
|
-
/* @__PURE__ */ A(
|
|
1877
|
-
"button",
|
|
1878
|
-
{
|
|
1879
|
-
type: "button",
|
|
1880
|
-
className: N.iconButton,
|
|
1881
|
-
onClick: i,
|
|
1882
|
-
disabled: !r,
|
|
1883
|
-
title: "重做",
|
|
1884
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z" }) })
|
|
1885
|
-
}
|
|
1886
|
-
)
|
|
1887
|
-
] }),
|
|
1888
|
-
/* @__PURE__ */ A("div", { className: N.divider }),
|
|
1889
|
-
/* @__PURE__ */ k("div", { className: N.group, children: [
|
|
1890
|
-
/* @__PURE__ */ A(
|
|
1891
|
-
"button",
|
|
1892
|
-
{
|
|
1893
|
-
type: "button",
|
|
1894
|
-
className: N.iconButton,
|
|
1895
|
-
onClick: c,
|
|
1896
|
-
title: "放大",
|
|
1897
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" }) })
|
|
1898
|
-
}
|
|
1899
|
-
),
|
|
1900
|
-
/* @__PURE__ */ A(
|
|
1901
|
-
"button",
|
|
1902
|
-
{
|
|
1903
|
-
type: "button",
|
|
1904
|
-
className: N.iconButton,
|
|
1905
|
-
onClick: o,
|
|
1906
|
-
title: "缩小",
|
|
1907
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M19 13H5v-2h14v2z" }) })
|
|
1908
|
-
}
|
|
1909
|
-
)
|
|
1910
|
-
] }),
|
|
1911
|
-
/* @__PURE__ */ A("div", { className: N.divider }),
|
|
1912
|
-
/* @__PURE__ */ k("div", { className: N.group, children: [
|
|
1913
|
-
/* @__PURE__ */ A(
|
|
1914
|
-
"button",
|
|
1915
|
-
{
|
|
1916
|
-
type: "button",
|
|
1917
|
-
className: N.iconButton,
|
|
1918
|
-
onClick: l,
|
|
1919
|
-
title: "向左",
|
|
1920
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) })
|
|
1921
|
-
}
|
|
1922
|
-
),
|
|
1923
|
-
/* @__PURE__ */ A(
|
|
1924
|
-
"button",
|
|
1925
|
-
{
|
|
1926
|
-
type: "button",
|
|
1927
|
-
className: N.iconButton,
|
|
1928
|
-
onClick: s,
|
|
1929
|
-
title: "向右",
|
|
1930
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) })
|
|
1931
|
-
}
|
|
1932
|
-
)
|
|
1933
|
-
] }),
|
|
1934
|
-
/* @__PURE__ */ A("div", { className: N.divider }),
|
|
1935
|
-
/* @__PURE__ */ A("div", { className: N.group, children: /* @__PURE__ */ A(
|
|
1936
|
-
"button",
|
|
1937
|
-
{
|
|
1938
|
-
type: "button",
|
|
1939
|
-
className: N.textButton,
|
|
1940
|
-
onClick: d,
|
|
1941
|
-
title: "重置",
|
|
1942
|
-
children: "重置"
|
|
1943
|
-
}
|
|
1944
|
-
) }),
|
|
1945
|
-
/* @__PURE__ */ A("div", { className: N.spacer }),
|
|
1946
|
-
/* @__PURE__ */ A("div", { className: N.group, children: Pn.map((m) => /* @__PURE__ */ A(
|
|
1947
|
-
"button",
|
|
1948
|
-
{
|
|
1949
|
-
type: "button",
|
|
1950
|
-
className: `${N.textButton} ${e === m.value ? N.active : ""}`,
|
|
1951
|
-
onClick: () => t(m.value),
|
|
1952
|
-
children: m.label
|
|
1953
|
-
},
|
|
1954
|
-
m.value
|
|
1955
|
-
)) }),
|
|
1956
|
-
h && /* @__PURE__ */ k(qe, { children: [
|
|
1957
|
-
/* @__PURE__ */ A("div", { className: N.divider }),
|
|
1958
|
-
/* @__PURE__ */ A(
|
|
1959
|
-
"button",
|
|
1960
|
-
{
|
|
1961
|
-
type: "button",
|
|
1962
|
-
className: N.iconButton,
|
|
1963
|
-
onClick: h,
|
|
1964
|
-
title: "全屏",
|
|
1965
|
-
children: /* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", width: "16", height: "16", fill: "currentColor", children: /* @__PURE__ */ A("path", { d: "M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z" }) })
|
|
1966
|
-
}
|
|
1967
|
-
)
|
|
1968
|
-
] })
|
|
1969
|
-
] });
|
|
1970
|
-
}
|
|
1971
|
-
const Kn = "_container_1vdme_1", En = "_group_1vdme_11", zn = "_item_1vdme_18", K = {
|
|
1972
|
-
container: Kn,
|
|
1973
|
-
group: En,
|
|
1974
|
-
item: zn
|
|
1975
|
-
};
|
|
1976
|
-
function Hn({ data: e, indicators: t, hoverIndex: n, theme: r }) {
|
|
1977
|
-
const a = r.maColors, i = r.bollColors, c = r.kcColors, o = ne(() => {
|
|
1978
|
-
const m = n ?? e.length - 1, f = e[m];
|
|
1979
|
-
return f || null;
|
|
1980
|
-
}, [e, n]);
|
|
1981
|
-
if (!o)
|
|
1982
|
-
return null;
|
|
1983
|
-
const l = t.includes("ma"), s = t.includes("boll"), d = t.includes("sar"), h = t.includes("kc");
|
|
1984
|
-
return !l && !s && !d && !h ? null : /* @__PURE__ */ k("div", { className: K.container, children: [
|
|
1985
|
-
l && o.ma && /* @__PURE__ */ A("div", { className: K.group, children: Object.keys(o.ma).filter((m) => {
|
|
1986
|
-
var f, u;
|
|
1987
|
-
return m.startsWith("ma") && ((f = o.ma) == null ? void 0 : f[m]) !== null && ((u = o.ma) == null ? void 0 : u[m]) !== void 0;
|
|
1988
|
-
}).map((m, f) => {
|
|
1989
|
-
var x;
|
|
1990
|
-
const u = (x = o.ma) == null ? void 0 : x[m], y = a[f] ?? "#999";
|
|
1991
|
-
return /* @__PURE__ */ k("span", { className: K.item, style: { color: y }, children: [
|
|
1992
|
-
m.toUpperCase(),
|
|
1993
|
-
": ",
|
|
1994
|
-
g(u)
|
|
1995
|
-
] }, m);
|
|
1996
|
-
}) }),
|
|
1997
|
-
s && o.boll && /* @__PURE__ */ k("div", { className: K.group, children: [
|
|
1998
|
-
/* @__PURE__ */ k("span", { className: K.item, style: { color: i[0] }, children: [
|
|
1999
|
-
"UPPER: ",
|
|
2000
|
-
g(o.boll.upper)
|
|
2001
|
-
] }),
|
|
2002
|
-
/* @__PURE__ */ k("span", { className: K.item, style: { color: i[1] }, children: [
|
|
2003
|
-
"MID: ",
|
|
2004
|
-
g(o.boll.mid)
|
|
2005
|
-
] }),
|
|
2006
|
-
/* @__PURE__ */ k("span", { className: K.item, style: { color: i[2] }, children: [
|
|
2007
|
-
"LOWER: ",
|
|
2008
|
-
g(o.boll.lower)
|
|
2009
|
-
] })
|
|
2010
|
-
] }),
|
|
2011
|
-
d && o.sar && /* @__PURE__ */ A("div", { className: K.group, children: /* @__PURE__ */ k(
|
|
2012
|
-
"span",
|
|
2013
|
-
{
|
|
2014
|
-
className: K.item,
|
|
2015
|
-
style: { color: o.sar.trend === 1 ? r.upColor : r.downColor },
|
|
2016
|
-
children: [
|
|
2017
|
-
"SAR: ",
|
|
2018
|
-
g(o.sar.sar),
|
|
2019
|
-
" ",
|
|
2020
|
-
o.sar.trend === 1 ? "↑" : "↓"
|
|
2021
|
-
]
|
|
2022
|
-
}
|
|
2023
|
-
) }),
|
|
2024
|
-
h && o.kc && /* @__PURE__ */ k("div", { className: K.group, children: [
|
|
2025
|
-
/* @__PURE__ */ k("span", { className: K.item, style: { color: c[0] }, children: [
|
|
2026
|
-
"KC上: ",
|
|
2027
|
-
g(o.kc.upper)
|
|
2028
|
-
] }),
|
|
2029
|
-
/* @__PURE__ */ k("span", { className: K.item, style: { color: c[1] }, children: [
|
|
2030
|
-
"KC中: ",
|
|
2031
|
-
g(o.kc.mid)
|
|
2032
|
-
] }),
|
|
2033
|
-
/* @__PURE__ */ k("span", { className: K.item, style: { color: c[2] }, children: [
|
|
2034
|
-
"KC下: ",
|
|
2035
|
-
g(o.kc.lower)
|
|
2036
|
-
] })
|
|
2037
|
-
] })
|
|
2038
|
-
] });
|
|
2039
|
-
}
|
|
2040
|
-
const Fn = "_title_p093j_1", Un = "_label_p093j_16", Vn = "_value_p093j_21", Oe = {
|
|
2041
|
-
title: Fn,
|
|
2042
|
-
label: Un,
|
|
2043
|
-
value: Vn
|
|
2044
|
-
}, Wn = {
|
|
2045
|
-
ma: "MA",
|
|
2046
|
-
boll: "BOLL",
|
|
2047
|
-
sar: "SAR",
|
|
2048
|
-
kc: "KC",
|
|
2049
|
-
volume: "成交量",
|
|
2050
|
-
macd: "MACD",
|
|
2051
|
-
kdj: "KDJ",
|
|
2052
|
-
rsi: "RSI",
|
|
2053
|
-
wr: "WR",
|
|
2054
|
-
bias: "BIAS",
|
|
2055
|
-
cci: "CCI",
|
|
2056
|
-
atr: "ATR",
|
|
2057
|
-
obv: "OBV",
|
|
2058
|
-
roc: "ROC",
|
|
2059
|
-
dmi: "DMI"
|
|
2060
|
-
};
|
|
2061
|
-
function Zn(e, t) {
|
|
2062
|
-
if (!t) return "";
|
|
2063
|
-
switch (e) {
|
|
2064
|
-
case "volume":
|
|
2065
|
-
return `VOL: ${q(t.volume)}`;
|
|
2066
|
-
case "macd":
|
|
2067
|
-
return t.macd ? `DIF: ${g(t.macd.dif)} DEA: ${g(t.macd.dea)} MACD: ${g(t.macd.macd)}` : "";
|
|
2068
|
-
case "kdj":
|
|
2069
|
-
return t.kdj ? `K: ${g(t.kdj.k)} D: ${g(t.kdj.d)} J: ${g(t.kdj.j)}` : "";
|
|
2070
|
-
case "rsi":
|
|
2071
|
-
return t.rsi ? `RSI6: ${g(t.rsi.rsi6)} RSI12: ${g(t.rsi.rsi12)} RSI24: ${g(t.rsi.rsi24)}` : "";
|
|
2072
|
-
case "wr":
|
|
2073
|
-
return t.wr ? `WR6: ${g(t.wr.wr6)} WR10: ${g(t.wr.wr10)}` : "";
|
|
2074
|
-
case "bias":
|
|
2075
|
-
return t.bias ? `BIAS6: ${g(t.bias.bias6)} BIAS12: ${g(t.bias.bias12)} BIAS24: ${g(t.bias.bias24)}` : "";
|
|
2076
|
-
case "cci":
|
|
2077
|
-
return t.cci ? `CCI: ${g(t.cci.cci)}` : "";
|
|
2078
|
-
case "atr":
|
|
2079
|
-
return t.atr ? `ATR: ${g(t.atr.atr)}` : "";
|
|
2080
|
-
case "obv":
|
|
2081
|
-
return t.obv ? `OBV: ${q(t.obv.obv)} MA: ${q(t.obv.obvMa)}` : "";
|
|
2082
|
-
case "roc":
|
|
2083
|
-
return t.roc ? `ROC: ${g(t.roc.roc)} SIGNAL: ${g(t.roc.signal)}` : "";
|
|
2084
|
-
case "dmi":
|
|
2085
|
-
return t.dmi ? `+DI: ${g(t.dmi.pdi)} -DI: ${g(t.dmi.mdi)} ADX: ${g(t.dmi.adx)}` : "";
|
|
2086
|
-
case "sar":
|
|
2087
|
-
return t.sar ? `SAR: ${g(t.sar.sar)} ${t.sar.trend === 1 ? "↑" : "↓"}` : "";
|
|
2088
|
-
case "kc":
|
|
2089
|
-
return t.kc ? `上: ${g(t.kc.upper)} 中: ${g(t.kc.mid)} 下: ${g(t.kc.lower)}` : "";
|
|
2090
|
-
default:
|
|
2091
|
-
return "";
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
function Yn(e, t) {
|
|
2095
|
-
return tt(e, t).map((r) => ({ top: r.top, height: r.height }));
|
|
2096
|
-
}
|
|
2097
|
-
function qn({ panes: e, data: t, hoverIndex: n, containerHeight: r }) {
|
|
2098
|
-
const a = n ?? t.length - 1, i = t[a], c = ne(
|
|
2099
|
-
() => Yn(e, r),
|
|
2100
|
-
[e, r]
|
|
2101
|
-
), o = e.slice(1), l = c.slice(1);
|
|
2102
|
-
return o.length === 0 ? null : /* @__PURE__ */ A(qe, { children: o.map((s, d) => {
|
|
2103
|
-
const h = s.indicators[0];
|
|
2104
|
-
if (!h) return null;
|
|
2105
|
-
const m = Wn[h] || h.toUpperCase(), f = Zn(h, i), u = l[d];
|
|
2106
|
-
return /* @__PURE__ */ k(
|
|
2107
|
-
"div",
|
|
2108
|
-
{
|
|
2109
|
-
className: Oe.title,
|
|
2110
|
-
style: { top: (u == null ? void 0 : u.top) ?? 0 },
|
|
2111
|
-
children: [
|
|
2112
|
-
/* @__PURE__ */ A("span", { className: Oe.label, children: m }),
|
|
2113
|
-
f && /* @__PURE__ */ A("span", { className: Oe.value, children: f })
|
|
2114
|
-
]
|
|
2115
|
-
},
|
|
2116
|
-
s.id
|
|
2117
|
-
);
|
|
2118
|
-
}) });
|
|
2119
|
-
}
|
|
2120
|
-
const Gn = "_container_o8wlo_1", Jn = "_fullscreen_o8wlo_12", Xn = "_chartWrapper_o8wlo_23", Qn = "_chart_o8wlo_23", eo = "_error_o8wlo_34", to = "_timelineToolbar_o8wlo_63", no = "_timelineLabel_o8wlo_71", oo = "_refreshButton_o8wlo_77", lo = "_fullscreenButton_o8wlo_78", Y = {
|
|
2121
|
-
container: Gn,
|
|
2122
|
-
fullscreen: Jn,
|
|
2123
|
-
chartWrapper: Xn,
|
|
2124
|
-
chart: Qn,
|
|
2125
|
-
error: eo,
|
|
2126
|
-
timelineToolbar: to,
|
|
2127
|
-
timelineLabel: no,
|
|
2128
|
-
refreshButton: oo,
|
|
2129
|
-
fullscreenButton: lo
|
|
279
|
+
US: {
|
|
280
|
+
timeZone: "America/New_York",
|
|
281
|
+
sessions: [[570, 960]]
|
|
282
|
+
}
|
|
283
|
+
}, je = /* @__PURE__ */ new Map();
|
|
284
|
+
function wt(a) {
|
|
285
|
+
const i = je.get(a);
|
|
286
|
+
if (i)
|
|
287
|
+
return i;
|
|
288
|
+
const t = new Intl.DateTimeFormat("en-US", {
|
|
289
|
+
timeZone: a,
|
|
290
|
+
weekday: "short",
|
|
291
|
+
hour: "2-digit",
|
|
292
|
+
minute: "2-digit",
|
|
293
|
+
hour12: !1
|
|
294
|
+
});
|
|
295
|
+
return je.set(a, t), t;
|
|
296
|
+
}
|
|
297
|
+
function It(a, i) {
|
|
298
|
+
var p, R, I;
|
|
299
|
+
const t = wt(i).formatToParts(a), l = ((p = t.find((b) => b.type === "weekday")) == null ? void 0 : p.value) ?? "Sun", m = Number(((R = t.find((b) => b.type === "hour")) == null ? void 0 : R.value) ?? "0"), g = Number(((I = t.find((b) => b.type === "minute")) == null ? void 0 : I.value) ?? "0");
|
|
300
|
+
return { weekday: l, minutes: m * 60 + g };
|
|
301
|
+
}
|
|
302
|
+
function kt(a, i = /* @__PURE__ */ new Date()) {
|
|
303
|
+
const t = St[a], { weekday: l, minutes: m } = It(i, t.timeZone);
|
|
304
|
+
return l === "Sat" || l === "Sun" ? !1 : t.sessions.some(([g, p]) => m >= g && m <= p);
|
|
305
|
+
}
|
|
306
|
+
const At = "_container_o8wlo_1", Rt = "_fullscreen_o8wlo_12", Lt = "_chartWrapper_o8wlo_23", _t = "_chart_o8wlo_23", Pt = "_error_o8wlo_34", Tt = "_timelineToolbar_o8wlo_63", Mt = "_timelineLabel_o8wlo_71", Dt = "_refreshButton_o8wlo_77", Et = "_fullscreenButton_o8wlo_78", A = {
|
|
307
|
+
container: At,
|
|
308
|
+
fullscreen: Rt,
|
|
309
|
+
chartWrapper: Lt,
|
|
310
|
+
chart: _t,
|
|
311
|
+
error: Pt,
|
|
312
|
+
timelineToolbar: Tt,
|
|
313
|
+
timelineLabel: Mt,
|
|
314
|
+
refreshButton: Dt,
|
|
315
|
+
fullscreenButton: Et
|
|
2130
316
|
};
|
|
2131
|
-
function
|
|
2132
|
-
return
|
|
317
|
+
function P(a) {
|
|
318
|
+
return a === "timeline" || a === "timeline5";
|
|
2133
319
|
}
|
|
2134
|
-
function
|
|
2135
|
-
const e = /* @__PURE__ */ new Date(), t = e.getDay();
|
|
2136
|
-
if (t === 0 || t === 6) return !1;
|
|
2137
|
-
const n = e.getHours(), r = e.getMinutes(), a = n * 60 + r;
|
|
2138
|
-
return a >= 570 && a <= 690 || a >= 780 && a <= 900;
|
|
2139
|
-
}
|
|
2140
|
-
const po = vt(function(t, n) {
|
|
320
|
+
const Ht = at(function(i, t) {
|
|
2141
321
|
const {
|
|
2142
|
-
symbol:
|
|
2143
|
-
market:
|
|
2144
|
-
period:
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
322
|
+
symbol: l,
|
|
323
|
+
market: m = "A",
|
|
324
|
+
period: g,
|
|
325
|
+
defaultPeriod: p = "daily",
|
|
326
|
+
adjust: R,
|
|
327
|
+
defaultAdjust: I = "qfq",
|
|
328
|
+
height: b = 500,
|
|
329
|
+
width: j = "100%",
|
|
330
|
+
theme: k = "light",
|
|
331
|
+
indicators: Se,
|
|
332
|
+
defaultIndicators: F = ["ma", "volume", "macd"],
|
|
333
|
+
indicatorOptions: H,
|
|
334
|
+
showToolbar: D = !0,
|
|
335
|
+
showPeriodSelector: K = !0,
|
|
336
|
+
showIndicatorSelector: U = !0,
|
|
337
|
+
maxSubPanes: W = 3,
|
|
338
|
+
visibleCount: s = 60,
|
|
339
|
+
onDataLoad: y,
|
|
340
|
+
onPeriodChange: C,
|
|
341
|
+
onAdjustChange: L,
|
|
342
|
+
onIndicatorsChange: q,
|
|
343
|
+
onVisibleRangeChange: le,
|
|
344
|
+
onError: ie,
|
|
345
|
+
dataProvider: Fe,
|
|
346
|
+
sdkOptions: Ke,
|
|
347
|
+
requestOptions: Ue,
|
|
348
|
+
autoRefresh: z,
|
|
349
|
+
panes: we,
|
|
350
|
+
echartsOption: Ie,
|
|
351
|
+
echartsOptionMerge: T,
|
|
352
|
+
className: We,
|
|
353
|
+
style: qe
|
|
354
|
+
} = i, [h, ke] = ve({
|
|
355
|
+
value: g,
|
|
356
|
+
defaultValue: p,
|
|
357
|
+
onChange: C
|
|
358
|
+
}), [E, Ae] = ve({
|
|
359
|
+
value: R,
|
|
360
|
+
defaultValue: I,
|
|
361
|
+
onChange: L
|
|
362
|
+
}), [_, Re] = ve({
|
|
363
|
+
value: Se,
|
|
364
|
+
defaultValue: F,
|
|
365
|
+
onChange: q
|
|
366
|
+
}), [ce, de] = se(!1), [Le, _e] = se(null), ue = N(null), $ = N(null), G = N(null), Pe = N(!1), J = N(null), v = ae(() => yt(k), [k]), fe = ae(
|
|
367
|
+
() => we ?? lt(_, { maxSubPanes: W }),
|
|
368
|
+
[we, _, W]
|
|
369
|
+
), { data: c, timelineData: Y, loading: Q, error: V, refresh: B } = it({
|
|
370
|
+
symbol: l,
|
|
371
|
+
market: m,
|
|
372
|
+
period: h,
|
|
373
|
+
adjust: E,
|
|
374
|
+
dataProvider: Fe,
|
|
375
|
+
sdkOptions: Ke,
|
|
376
|
+
requestOptions: Ue,
|
|
377
|
+
indicatorOptions: H,
|
|
378
|
+
indicators: _
|
|
379
|
+
}), { chartRef: he, setOption: X, getInstance: ee, getDataURL: Te, bindEvent: Z } = ct(), { canUndo: ze, canRedo: Ge, currentState: u, pushState: te, undo: Me, redo: De, reset: oe } = dt(), [ne, Je] = se(500);
|
|
380
|
+
w(() => {
|
|
381
|
+
const e = he.current;
|
|
382
|
+
if (!e) return;
|
|
383
|
+
const o = () => {
|
|
384
|
+
const r = e.offsetHeight;
|
|
385
|
+
r > 0 && Je(r);
|
|
2188
386
|
};
|
|
2189
|
-
|
|
2190
|
-
const
|
|
2191
|
-
return
|
|
2192
|
-
}, []);
|
|
2193
|
-
const
|
|
2194
|
-
|
|
2195
|
-
if (
|
|
2196
|
-
const { intervalMs:
|
|
2197
|
-
return
|
|
2198
|
-
|
|
2199
|
-
},
|
|
2200
|
-
|
|
387
|
+
o();
|
|
388
|
+
const n = new ResizeObserver(o);
|
|
389
|
+
return n.observe(e), () => n.disconnect();
|
|
390
|
+
}, [he]);
|
|
391
|
+
const me = ae(() => z ? z === !0 ? { intervalMs: 5e3, onlyTradingTime: !0 } : z : null, [z]);
|
|
392
|
+
w(() => {
|
|
393
|
+
if ($.current && (clearInterval($.current), $.current = null), !me || !P(h)) return;
|
|
394
|
+
const { intervalMs: e = 5e3, onlyTradingTime: o = !0 } = me;
|
|
395
|
+
return $.current = setInterval(() => {
|
|
396
|
+
o && !kt(m) || B();
|
|
397
|
+
}, e), () => {
|
|
398
|
+
$.current && clearInterval($.current);
|
|
2201
399
|
};
|
|
2202
|
-
}, [
|
|
2203
|
-
const
|
|
2204
|
-
const
|
|
2205
|
-
(
|
|
2206
|
-
}),
|
|
2207
|
-
|
|
400
|
+
}, [me, m, h, B]), w(() => {
|
|
401
|
+
const e = Z("mousemove", (n) => {
|
|
402
|
+
const r = n;
|
|
403
|
+
(r == null ? void 0 : r.dataIndex) !== void 0 && _e(r.dataIndex);
|
|
404
|
+
}), o = Z("mouseout", () => {
|
|
405
|
+
_e(null);
|
|
2208
406
|
});
|
|
2209
407
|
return () => {
|
|
2210
|
-
|
|
408
|
+
e(), o();
|
|
2211
409
|
};
|
|
2212
|
-
}, [
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
410
|
+
}, [Z]);
|
|
411
|
+
const Ee = x(() => {
|
|
412
|
+
var r;
|
|
413
|
+
const e = (r = ee()) == null ? void 0 : r.getOption(), o = e == null ? void 0 : e.dataZoom, n = (o == null ? void 0 : o.find((d) => d.id === He)) ?? (o == null ? void 0 : o.find((d) => d.id === Ve)) ?? (o == null ? void 0 : o[0]);
|
|
414
|
+
return {
|
|
415
|
+
start: Number((n == null ? void 0 : n.start) ?? u.start),
|
|
416
|
+
end: Number((n == null ? void 0 : n.end) ?? u.end)
|
|
417
|
+
};
|
|
418
|
+
}, [u.end, u.start, ee]);
|
|
419
|
+
w(() => Z("datazoom", () => {
|
|
420
|
+
const o = Ee(), n = G.current;
|
|
421
|
+
if (n && n.start === o.start && n.end === o.end) {
|
|
422
|
+
G.current = null;
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
G.current = null, te(o);
|
|
426
|
+
}), [Z, Ee, te]), w(() => {
|
|
427
|
+
var e, o;
|
|
428
|
+
if (le) {
|
|
429
|
+
if (!Pe.current) {
|
|
430
|
+
Pe.current = !0, J.current = u;
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
((e = J.current) == null ? void 0 : e.start) === u.start && ((o = J.current) == null ? void 0 : o.end) === u.end || (J.current = u, le(u));
|
|
434
|
+
}
|
|
435
|
+
}, [u, le]), w(() => {
|
|
436
|
+
var r;
|
|
437
|
+
if (c.length === 0 && !Q) return;
|
|
438
|
+
let e;
|
|
439
|
+
if (P(h) && Y.length > 0) {
|
|
440
|
+
const d = c.length > 0 ? ((r = c[0]) == null ? void 0 : r.close) ?? void 0 : void 0;
|
|
441
|
+
e = vt({
|
|
442
|
+
data: Y,
|
|
443
|
+
theme: v,
|
|
444
|
+
prevClose: d ?? void 0,
|
|
445
|
+
containerHeight: ne
|
|
2223
446
|
});
|
|
2224
447
|
} else
|
|
2225
|
-
|
|
2226
|
-
data:
|
|
2227
|
-
theme:
|
|
2228
|
-
indicators:
|
|
2229
|
-
panes:
|
|
2230
|
-
containerHeight:
|
|
2231
|
-
indicatorOptions:
|
|
448
|
+
e = ut({
|
|
449
|
+
data: c,
|
|
450
|
+
theme: v,
|
|
451
|
+
indicators: _,
|
|
452
|
+
panes: fe,
|
|
453
|
+
containerHeight: ne,
|
|
454
|
+
indicatorOptions: H
|
|
2232
455
|
});
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
456
|
+
const o = ft(
|
|
457
|
+
e,
|
|
458
|
+
Ie,
|
|
459
|
+
T == null ? void 0 : T.mode
|
|
460
|
+
), n = Array.from(
|
|
461
|
+
/* @__PURE__ */ new Set([
|
|
462
|
+
"series",
|
|
463
|
+
"xAxis",
|
|
464
|
+
"yAxis",
|
|
465
|
+
"grid",
|
|
466
|
+
"title",
|
|
467
|
+
...(T == null ? void 0 : T.replaceMerge) ?? []
|
|
468
|
+
])
|
|
2237
469
|
);
|
|
2238
|
-
|
|
2239
|
-
replaceMerge:
|
|
470
|
+
X(o, {
|
|
471
|
+
replaceMerge: n
|
|
2240
472
|
});
|
|
2241
473
|
}, [
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
474
|
+
c,
|
|
475
|
+
Y,
|
|
476
|
+
v,
|
|
477
|
+
_,
|
|
478
|
+
fe,
|
|
479
|
+
s,
|
|
480
|
+
ne,
|
|
481
|
+
Ie,
|
|
482
|
+
T,
|
|
483
|
+
H,
|
|
484
|
+
X,
|
|
485
|
+
Q,
|
|
486
|
+
h
|
|
487
|
+
]), w(() => {
|
|
488
|
+
c.length > 0 && y && y(c);
|
|
489
|
+
}, [c, y]), w(() => {
|
|
490
|
+
V && ie && ie(V);
|
|
491
|
+
}, [V, ie]);
|
|
492
|
+
const ge = x(
|
|
493
|
+
(e) => {
|
|
494
|
+
e !== h && ke(e);
|
|
2262
495
|
},
|
|
2263
|
-
[
|
|
2264
|
-
),
|
|
2265
|
-
|
|
2266
|
-
}, []),
|
|
2267
|
-
|
|
2268
|
-
}, []),
|
|
2269
|
-
(
|
|
2270
|
-
const
|
|
2271
|
-
|
|
496
|
+
[h, ke]
|
|
497
|
+
), pe = x((e) => {
|
|
498
|
+
e !== E && Ae(e);
|
|
499
|
+
}, [E, Ae]), Ce = x((e) => {
|
|
500
|
+
Re(e);
|
|
501
|
+
}, [Re]), f = x(
|
|
502
|
+
(e, o, n = !0) => {
|
|
503
|
+
const r = Math.max(0, Math.min(100, e)), d = Math.max(r, Math.min(100, o));
|
|
504
|
+
n || (G.current = { start: r, end: d }), X({
|
|
2272
505
|
dataZoom: [
|
|
2273
|
-
{ id:
|
|
2274
|
-
{ id:
|
|
506
|
+
{ id: He, start: r, end: d },
|
|
507
|
+
{ id: Ve, start: r, end: d }
|
|
2275
508
|
]
|
|
2276
|
-
}),
|
|
509
|
+
}), n && te({ start: r, end: d });
|
|
2277
510
|
},
|
|
2278
|
-
[
|
|
2279
|
-
),
|
|
2280
|
-
(
|
|
2281
|
-
[
|
|
2282
|
-
),
|
|
2283
|
-
const { start:
|
|
2284
|
-
|
|
2285
|
-
}, [
|
|
2286
|
-
const { start:
|
|
2287
|
-
|
|
2288
|
-
}, [
|
|
2289
|
-
const { start:
|
|
2290
|
-
|
|
2291
|
-
}, [
|
|
2292
|
-
const { start:
|
|
2293
|
-
|
|
2294
|
-
}, [
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
}, [
|
|
2298
|
-
const
|
|
2299
|
-
|
|
2300
|
-
}, [
|
|
2301
|
-
const { start:
|
|
2302
|
-
|
|
2303
|
-
}, [
|
|
2304
|
-
|
|
2305
|
-
|
|
511
|
+
[X, te]
|
|
512
|
+
), re = x(
|
|
513
|
+
(e) => e <= 0 ? { start: 0, end: 100 } : { start: Math.max(0, (e - s) / e * 100), end: 100 },
|
|
514
|
+
[s]
|
|
515
|
+
), Ye = x(() => {
|
|
516
|
+
const { start: e, end: o } = u, n = o - e, r = Math.max(n * 0.6, 5), d = (e + o) / 2, M = Math.max(0, d - r / 2), be = Math.min(100, d + r / 2);
|
|
517
|
+
f(M, be);
|
|
518
|
+
}, [f, u]), Qe = x(() => {
|
|
519
|
+
const { start: e, end: o } = u, n = o - e, r = Math.min(n * 1.5, 100), d = (e + o) / 2, M = Math.max(0, d - r / 2), be = Math.min(100, d + r / 2);
|
|
520
|
+
f(M, be);
|
|
521
|
+
}, [f, u]), Xe = x(() => {
|
|
522
|
+
const { start: e, end: o } = u, n = o - e, r = n * 0.2, d = Math.max(0, e - r), M = d + n;
|
|
523
|
+
f(d, M);
|
|
524
|
+
}, [f, u]), et = x(() => {
|
|
525
|
+
const { start: e, end: o } = u, n = o - e, r = n * 0.2, d = Math.min(100, o + r), M = d - n;
|
|
526
|
+
f(M, d);
|
|
527
|
+
}, [f, u]), tt = x(() => {
|
|
528
|
+
const e = Me();
|
|
529
|
+
e && f(e.start, e.end, !1);
|
|
530
|
+
}, [Me, f]), ot = x(() => {
|
|
531
|
+
const e = De();
|
|
532
|
+
e && f(e.start, e.end, !1);
|
|
533
|
+
}, [De, f]), xe = x(() => {
|
|
534
|
+
const { start: e, end: o } = re(c.length);
|
|
535
|
+
f(e, o, !1), oe({ start: e, end: o });
|
|
536
|
+
}, [c.length, re, f, oe]), $e = x(() => {
|
|
537
|
+
ue.current && (document.fullscreenElement ? document.exitFullscreen().then(() => {
|
|
538
|
+
de(!1);
|
|
2306
539
|
}).catch(() => {
|
|
2307
|
-
}) :
|
|
2308
|
-
|
|
540
|
+
}) : ue.current.requestFullscreen().then(() => {
|
|
541
|
+
de(!0);
|
|
2309
542
|
}).catch(() => {
|
|
2310
543
|
}));
|
|
2311
544
|
}, []);
|
|
2312
|
-
|
|
2313
|
-
const
|
|
2314
|
-
|
|
545
|
+
w(() => {
|
|
546
|
+
const e = () => {
|
|
547
|
+
de(!!document.fullscreenElement);
|
|
2315
548
|
};
|
|
2316
|
-
return document.addEventListener("fullscreenchange",
|
|
2317
|
-
document.removeEventListener("fullscreenchange",
|
|
549
|
+
return document.addEventListener("fullscreenchange", e), () => {
|
|
550
|
+
document.removeEventListener("fullscreenchange", e);
|
|
2318
551
|
};
|
|
2319
|
-
}, []),
|
|
2320
|
-
|
|
552
|
+
}, []), st(
|
|
553
|
+
t,
|
|
2321
554
|
() => ({
|
|
2322
|
-
refresh:
|
|
2323
|
-
setPeriod:
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
555
|
+
refresh: B,
|
|
556
|
+
setPeriod: ge,
|
|
557
|
+
setAdjust: pe,
|
|
558
|
+
setIndicators: Ce,
|
|
559
|
+
zoomTo: (e, o) => {
|
|
560
|
+
f(e, o);
|
|
2327
561
|
},
|
|
2328
|
-
resetZoom:
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
562
|
+
resetZoom: xe,
|
|
563
|
+
getVisibleRange: () => u,
|
|
564
|
+
getEchartsInstance: () => ee(),
|
|
565
|
+
exportImage: (e) => Te({ type: e, backgroundColor: v.backgroundColor }),
|
|
566
|
+
getData: () => c
|
|
2332
567
|
}),
|
|
2333
568
|
[
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
569
|
+
B,
|
|
570
|
+
ge,
|
|
571
|
+
pe,
|
|
572
|
+
Ce,
|
|
573
|
+
xe,
|
|
574
|
+
f,
|
|
575
|
+
u,
|
|
576
|
+
ee,
|
|
577
|
+
Te,
|
|
578
|
+
c,
|
|
579
|
+
v.backgroundColor
|
|
2342
580
|
]
|
|
2343
581
|
);
|
|
2344
|
-
const
|
|
2345
|
-
|
|
2346
|
-
if (
|
|
2347
|
-
const
|
|
2348
|
-
if (
|
|
2349
|
-
|
|
2350
|
-
const { start:
|
|
2351
|
-
|
|
2352
|
-
}, [
|
|
2353
|
-
const
|
|
582
|
+
const Be = N("");
|
|
583
|
+
w(() => {
|
|
584
|
+
if (P(h) || c.length === 0) return;
|
|
585
|
+
const e = `${l}_${h}_${E}`;
|
|
586
|
+
if (e === Be.current) return;
|
|
587
|
+
Be.current = e;
|
|
588
|
+
const { start: o, end: n } = re(c.length);
|
|
589
|
+
f(o, n, !1), oe({ start: o, end: n });
|
|
590
|
+
}, [l, h, E, c.length, re, f, oe]);
|
|
591
|
+
const nt = ae(
|
|
2354
592
|
() => ({
|
|
2355
|
-
"--kline-bg-color":
|
|
2356
|
-
"--kline-text-color":
|
|
2357
|
-
"--kline-text-secondary":
|
|
2358
|
-
"--kline-border-color":
|
|
2359
|
-
"--kline-active-color":
|
|
2360
|
-
"--kline-hover-bg":
|
|
2361
|
-
"--kline-tag-bg":
|
|
2362
|
-
"--kline-text-disabled":
|
|
593
|
+
"--kline-bg-color": v.backgroundColor,
|
|
594
|
+
"--kline-text-color": v.textColor,
|
|
595
|
+
"--kline-text-secondary": v.textColorSecondary,
|
|
596
|
+
"--kline-border-color": v.gridLineColor,
|
|
597
|
+
"--kline-active-color": v.activeColor,
|
|
598
|
+
"--kline-hover-bg": k === "dark" ? "#2a2a2a" : "#f5f5f5",
|
|
599
|
+
"--kline-tag-bg": k === "dark" ? "#2a2a2a" : "#f0f0f0",
|
|
600
|
+
"--kline-text-disabled": k === "dark" ? "#444" : "#ccc"
|
|
2363
601
|
}),
|
|
2364
|
-
[
|
|
2365
|
-
),
|
|
2366
|
-
return /* @__PURE__ */
|
|
602
|
+
[v, k]
|
|
603
|
+
), rt = _.some((e) => ["ma", "boll", "sar", "kc"].includes(e)) && !P(h) && c.length > 0;
|
|
604
|
+
return /* @__PURE__ */ O(
|
|
2367
605
|
"div",
|
|
2368
606
|
{
|
|
2369
|
-
ref:
|
|
2370
|
-
className: `${
|
|
2371
|
-
style: { ...
|
|
607
|
+
ref: ue,
|
|
608
|
+
className: `${A.container} ${ce ? A.fullscreen : ""} ${We ?? ""}`,
|
|
609
|
+
style: { ...nt, width: j, height: ce ? "100vh" : b, ...qe },
|
|
2372
610
|
children: [
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
611
|
+
K && /* @__PURE__ */ S(ht, { value: h, onChange: ge }),
|
|
612
|
+
D && !P(h) && /* @__PURE__ */ S(
|
|
613
|
+
mt,
|
|
2376
614
|
{
|
|
2377
|
-
adjust:
|
|
2378
|
-
onAdjustChange:
|
|
2379
|
-
canUndo:
|
|
2380
|
-
canRedo:
|
|
2381
|
-
onUndo:
|
|
2382
|
-
onRedo:
|
|
2383
|
-
onZoomIn:
|
|
2384
|
-
onZoomOut:
|
|
2385
|
-
onPanLeft:
|
|
2386
|
-
onPanRight:
|
|
2387
|
-
onReset:
|
|
2388
|
-
onFullscreen:
|
|
615
|
+
adjust: E,
|
|
616
|
+
onAdjustChange: pe,
|
|
617
|
+
canUndo: ze,
|
|
618
|
+
canRedo: Ge,
|
|
619
|
+
onUndo: tt,
|
|
620
|
+
onRedo: ot,
|
|
621
|
+
onZoomIn: Ye,
|
|
622
|
+
onZoomOut: Qe,
|
|
623
|
+
onPanLeft: Xe,
|
|
624
|
+
onPanRight: et,
|
|
625
|
+
onReset: xe,
|
|
626
|
+
onFullscreen: $e
|
|
2389
627
|
}
|
|
2390
628
|
),
|
|
2391
|
-
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
/* @__PURE__ */
|
|
629
|
+
D && P(h) && /* @__PURE__ */ O("div", { className: A.timelineToolbar, children: [
|
|
630
|
+
/* @__PURE__ */ S("span", { className: A.timelineLabel, children: "分时走势" }),
|
|
631
|
+
/* @__PURE__ */ S(
|
|
2394
632
|
"button",
|
|
2395
633
|
{
|
|
2396
634
|
type: "button",
|
|
2397
|
-
className:
|
|
2398
|
-
onClick:
|
|
2399
|
-
disabled:
|
|
635
|
+
className: A.refreshButton,
|
|
636
|
+
onClick: B,
|
|
637
|
+
disabled: Q,
|
|
2400
638
|
children: "刷新"
|
|
2401
639
|
}
|
|
2402
640
|
),
|
|
2403
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ S(
|
|
2404
642
|
"button",
|
|
2405
643
|
{
|
|
2406
644
|
type: "button",
|
|
2407
|
-
className:
|
|
2408
|
-
onClick:
|
|
2409
|
-
children:
|
|
645
|
+
className: A.fullscreenButton,
|
|
646
|
+
onClick: $e,
|
|
647
|
+
children: ce ? "退出全屏" : "全屏"
|
|
2410
648
|
}
|
|
2411
649
|
)
|
|
2412
650
|
] }),
|
|
2413
|
-
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
/* @__PURE__ */
|
|
651
|
+
rt && /* @__PURE__ */ S(gt, { data: c, indicators: _, hoverIndex: Le, theme: v }),
|
|
652
|
+
/* @__PURE__ */ O("div", { className: A.chartWrapper, children: [
|
|
653
|
+
Q && c.length === 0 && /* @__PURE__ */ S(pt, {}),
|
|
654
|
+
V && c.length === 0 && /* @__PURE__ */ O("div", { className: A.error, children: [
|
|
655
|
+
/* @__PURE__ */ O("span", { children: [
|
|
2418
656
|
"加载失败:",
|
|
2419
|
-
|
|
657
|
+
V.message
|
|
2420
658
|
] }),
|
|
2421
|
-
/* @__PURE__ */
|
|
659
|
+
/* @__PURE__ */ S("button", { type: "button", onClick: B, children: "重试" })
|
|
2422
660
|
] }),
|
|
2423
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ S(
|
|
2424
662
|
"div",
|
|
2425
663
|
{
|
|
2426
|
-
ref:
|
|
2427
|
-
className:
|
|
2428
|
-
style: { visibility:
|
|
664
|
+
ref: he,
|
|
665
|
+
className: A.chart,
|
|
666
|
+
style: { visibility: c.length > 0 || Y.length > 0 ? "visible" : "hidden" }
|
|
2429
667
|
}
|
|
2430
668
|
),
|
|
2431
|
-
!
|
|
2432
|
-
|
|
669
|
+
!P(h) && c.length > 0 && /* @__PURE__ */ S(
|
|
670
|
+
Ct,
|
|
2433
671
|
{
|
|
2434
|
-
panes:
|
|
2435
|
-
data:
|
|
2436
|
-
hoverIndex:
|
|
2437
|
-
containerHeight:
|
|
672
|
+
panes: fe,
|
|
673
|
+
data: c,
|
|
674
|
+
hoverIndex: Le,
|
|
675
|
+
containerHeight: ne
|
|
2438
676
|
}
|
|
2439
677
|
)
|
|
2440
678
|
] }),
|
|
2441
|
-
|
|
679
|
+
U && !P(h) && /* @__PURE__ */ S(xt, { value: _, onChange: Ce, maxSubPanes: W })
|
|
2442
680
|
]
|
|
2443
681
|
}
|
|
2444
682
|
);
|
|
2445
683
|
});
|
|
2446
684
|
export {
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
Je as calcATR,
|
|
2453
|
-
Et as calcBIAS,
|
|
2454
|
-
Bt as calcBOLL,
|
|
2455
|
-
zt as calcCCI,
|
|
685
|
+
Ht as KLineChart,
|
|
686
|
+
Ot as calcATR,
|
|
687
|
+
jt as calcBIAS,
|
|
688
|
+
Ft as calcBOLL,
|
|
689
|
+
Kt as calcCCI,
|
|
2456
690
|
Ut as calcDMI,
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
Ze as lightTheme
|
|
2480
|
-
Qt as useEcharts,
|
|
2481
|
-
Xt as useKlineData,
|
|
2482
|
-
nn as useZoomHistory
|
|
691
|
+
Wt as calcEMA,
|
|
692
|
+
qt as calcKC,
|
|
693
|
+
zt as calcKDJ,
|
|
694
|
+
Gt as calcMA,
|
|
695
|
+
Jt as calcMACD,
|
|
696
|
+
Yt as calcOBV,
|
|
697
|
+
Qt as calcROC,
|
|
698
|
+
Xt as calcRSI,
|
|
699
|
+
eo as calcSAR,
|
|
700
|
+
to as calcSMA,
|
|
701
|
+
oo as calcWMA,
|
|
702
|
+
no as calcWR,
|
|
703
|
+
bt as darkTheme,
|
|
704
|
+
ro as formatAmount,
|
|
705
|
+
ao as formatChange,
|
|
706
|
+
so as formatDate,
|
|
707
|
+
lo as formatKlineTooltip,
|
|
708
|
+
io as formatNumber,
|
|
709
|
+
co as formatPercent,
|
|
710
|
+
ye as formatPrice,
|
|
711
|
+
Ne as formatVolume,
|
|
712
|
+
yt as getTheme,
|
|
713
|
+
Ze as lightTheme
|
|
2483
714
|
};
|