velo-plot 2.20.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/dist/{ChartCore-ivzLqxVb.js → ChartCore-BpzRvN4Y.js} +978 -861
- package/dist/ChartCore-BpzRvN4Y.js.map +1 -0
- package/dist/a11y-Bw6urYpr.js +105 -0
- package/dist/a11y-Bw6urYpr.js.map +1 -0
- package/dist/angular/hooks-entry.d.ts +1 -0
- package/dist/angular/hooks.d.ts +26 -0
- package/dist/angular/index.d.ts +8 -0
- package/dist/angular/velo-plot.component.d.ts +46 -0
- package/dist/angular-hooks.d.ts +1 -0
- package/dist/angular-hooks.js +9 -0
- package/dist/angular-hooks.js.map +1 -0
- package/dist/angular.d.ts +1 -0
- package/dist/angular.js +166 -0
- package/dist/angular.js.map +1 -0
- package/dist/assets/indicator.worker-bv0zC4EX.js.map +1 -1
- package/dist/astro/StackedPlot.astro +19 -0
- package/dist/astro/VeloPlot.astro +23 -0
- package/dist/bindings/shared/a11y.d.ts +26 -0
- package/dist/bindings/shared/chartLifecycle.d.ts +16 -0
- package/dist/bindings/shared/chartSyncBridge.d.ts +8 -0
- package/dist/bindings/shared/dimensions.d.ts +1 -0
- package/dist/bindings/shared/index.d.ts +9 -0
- package/dist/bindings/shared/indicatorBridge.d.ts +11 -0
- package/dist/bindings/shared/optionsSync.d.ts +7 -0
- package/dist/bindings/shared/seriesDiff.d.ts +8 -0
- package/dist/bindings/shared/stackedSync.d.ts +9 -0
- package/dist/bindings/shared/types.d.ts +46 -0
- package/dist/bindings/test-utils/index.d.ts +35 -0
- package/dist/bindings/test-utils/mockLifecycle.d.ts +120 -0
- package/dist/bindings/test-utils/vitestSveltePlugin.d.ts +3 -0
- package/dist/chartSyncBridge-DbWrwtyP.js +57 -0
- package/dist/chartSyncBridge-DbWrwtyP.js.map +1 -0
- package/dist/core/Chart.d.ts +1 -1
- package/dist/core/InteractionManager.d.ts +7 -1
- package/dist/core/OverlayRenderer.d.ts +5 -0
- package/dist/core/annotations/types.d.ts +1 -1
- package/dist/core/chart/ChartCore.d.ts +2 -2
- package/dist/core/chart/types.d.ts +1 -1
- package/dist/core/clipboard/index.d.ts +1 -1
- package/dist/core/debug/index.d.ts +1 -1
- package/dist/core/keybindings/index.d.ts +1 -1
- package/dist/core/loading/index.d.ts +1 -1
- package/dist/core/locale/index.d.ts +1 -1
- package/dist/core/stacked/paneResize.d.ts +3 -0
- package/dist/core/stacked/types.d.ts +10 -0
- package/dist/core/theme-editor/index.d.ts +1 -1
- package/dist/createStackedChart-Dm-YqUT7.js +756 -0
- package/dist/createStackedChart-Dm-YqUT7.js.map +1 -0
- package/dist/examples/PluginDemonstration.d.ts +1 -1
- package/dist/gpuRenderer-BpaMYz-k.js.map +1 -1
- package/dist/hooks-CYPCxoZx.js +69 -0
- package/dist/hooks-CYPCxoZx.js.map +1 -0
- package/dist/{index-BBpJwOct.js → index-0InEyj0q.js} +119 -121
- package/dist/index-0InEyj0q.js.map +1 -0
- package/dist/index-BMiZoKmm.js.map +1 -1
- package/dist/{index-DoYxf1cV.js → index-CWxIHdwX.js} +38 -98
- package/dist/index-CWxIHdwX.js.map +1 -0
- package/dist/index-CaXWSOTk.js.map +1 -1
- package/dist/index-Dag88bW4.js.map +1 -1
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index-qunX30Xu.js.map +1 -1
- package/dist/index-x4stH3jD.js.map +1 -1
- package/dist/{index.core-COREBDNq.js → index.core-BmZe2jRQ.js} +9 -9
- package/dist/index.core-BmZe2jRQ.js.map +1 -0
- package/dist/index.core.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/indicators--eJGmVox.js.map +1 -1
- package/dist/{mockDatafeed-927foCM4.js → mockDatafeed-DHIDPcpX.js} +150 -146
- package/dist/mockDatafeed-DHIDPcpX.js.map +1 -0
- package/dist/optionsSync-QUiN4Inw.js +119 -0
- package/dist/optionsSync-QUiN4Inw.js.map +1 -0
- package/dist/plugins/3d/index.d.ts +2 -2
- package/dist/plugins/3d.d.ts +2 -2
- package/dist/plugins/3d.js.map +1 -1
- package/dist/plugins/analysis/index.d.ts +1 -1
- package/dist/plugins/analysis/indicators.d.ts +1 -1
- package/dist/plugins/analysis.d.ts +2 -2
- package/dist/plugins/analysis.js +2 -2
- package/dist/plugins/analysis.js.map +1 -1
- package/dist/plugins/annotations/index.d.ts +1 -1
- package/dist/plugins/annotations.d.ts +2 -2
- package/dist/plugins/annotations.js.map +1 -1
- package/dist/plugins/anomaly-detection.js +1 -1
- package/dist/plugins/anomaly-detection.js.map +1 -1
- package/dist/plugins/broken-axis.d.ts +2 -2
- package/dist/plugins/builtins/crosshair/CrosshairPlugin.d.ts +1 -1
- package/dist/plugins/builtins/index.d.ts +1 -1
- package/dist/plugins/caching.d.ts +2 -2
- package/dist/plugins/clipboard/index.d.ts +2 -2
- package/dist/plugins/clipboard.d.ts +2 -2
- package/dist/plugins/clipboard.js.map +1 -1
- package/dist/plugins/context-menu/index.d.ts +1 -1
- package/dist/plugins/context-menu.d.ts +2 -2
- package/dist/plugins/context-menu.js +1 -1
- package/dist/plugins/context-menu.js.map +1 -1
- package/dist/plugins/data-export/index.d.ts +1 -1
- package/dist/plugins/data-export.d.ts +2 -2
- package/dist/plugins/data-export.js +2 -2
- package/dist/plugins/data-export.js.map +1 -1
- package/dist/plugins/data-transform.d.ts +2 -2
- package/dist/plugins/data-transform.js +19 -19
- package/dist/plugins/data-transform.js.map +1 -1
- package/dist/plugins/debug/index.d.ts +2 -2
- package/dist/plugins/debug.d.ts +2 -2
- package/dist/plugins/debug.js +2 -2
- package/dist/plugins/debug.js.map +1 -1
- package/dist/plugins/forecasting/index.d.ts +1 -1
- package/dist/plugins/forecasting.js.map +1 -1
- package/dist/plugins/gpu/index.d.ts +2 -2
- package/dist/plugins/gpu.d.ts +2 -2
- package/dist/plugins/gpu.js.map +1 -1
- package/dist/plugins/i18n/index.d.ts +2 -2
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/i18n.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/keyboard.d.ts +2 -2
- package/dist/plugins/keyboard.js +65 -5
- package/dist/plugins/keyboard.js.map +1 -1
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/lazy-load.d.ts +2 -2
- package/dist/plugins/loading/index.d.ts +1 -1
- package/dist/plugins/loading.d.ts +2 -2
- package/dist/plugins/ml-integration.d.ts +2 -2
- package/dist/plugins/ml-integration.js +5 -5
- package/dist/plugins/ml-integration.js.map +1 -1
- package/dist/plugins/offscreen.d.ts +2 -2
- package/dist/plugins/pattern-recognition.d.ts +2 -2
- package/dist/plugins/pattern-recognition.js +1 -1
- package/dist/plugins/pattern-recognition.js.map +1 -1
- package/dist/plugins/radar.d.ts +2 -2
- package/dist/plugins/regression.d.ts +2 -2
- package/dist/plugins/regression.js +1 -1
- package/dist/plugins/regression.js.map +1 -1
- package/dist/plugins/roi.js +9 -9
- package/dist/plugins/roi.js.map +1 -1
- package/dist/plugins/snapshot/index.d.ts +1 -1
- package/dist/plugins/snapshot/types.d.ts +1 -1
- package/dist/plugins/snapshot.d.ts +2 -2
- package/dist/plugins/snapshot.js.map +1 -1
- package/dist/plugins/streaming/index.d.ts +2 -2
- package/dist/plugins/streaming.d.ts +2 -2
- package/dist/plugins/sync/index.d.ts +3 -2
- package/dist/plugins/sync.d.ts +2 -2
- package/dist/plugins/sync.js.map +1 -1
- package/dist/plugins/theme-editor/index.d.ts +1 -1
- package/dist/plugins/theme-editor.d.ts +2 -2
- package/dist/plugins/tools/index.d.ts +1 -1
- package/dist/plugins/tools/tooltip/index.d.ts +1 -1
- package/dist/plugins/tools.d.ts +2 -2
- package/dist/plugins/types.d.ts +1 -1
- package/dist/plugins/video-recorder.d.ts +2 -2
- package/dist/plugins/virtualization.d.ts +2 -2
- package/dist/plugins/virtualization.js +1 -1
- package/dist/pool-DZ8shSqv.js +109 -0
- package/dist/pool-DZ8shSqv.js.map +1 -0
- package/dist/react/StackedPlot.d.ts +31 -0
- package/dist/react/VeloPlot.d.ts +29 -0
- package/dist/react/index.d.ts +25 -3
- package/dist/react/useChartSync.d.ts +8 -0
- package/dist/react/useIndicator.d.ts +12 -0
- package/dist/react/useVeloPlot.d.ts +19 -0
- package/dist/react.js +328 -24
- package/dist/react.js.map +1 -1
- package/dist/scientific/index.d.ts +48 -0
- package/dist/scientific.d.ts +1 -0
- package/dist/scientific.js +91 -0
- package/dist/scientific.js.map +1 -0
- package/dist/solid/VeloPlot.d.ts +16 -0
- package/dist/solid/index.d.ts +13 -0
- package/dist/solid/useChartSync.d.ts +6 -0
- package/dist/solid/useIndicator.d.ts +11 -0
- package/dist/solid/useStackedPlot.d.ts +14 -0
- package/dist/solid/useVeloPlot.d.ts +18 -0
- package/dist/solid.d.ts +1 -0
- package/dist/solid.js +172 -0
- package/dist/solid.js.map +1 -0
- package/dist/stackedSync-tnrunZMt.js +100 -0
- package/dist/stackedSync-tnrunZMt.js.map +1 -0
- package/dist/svelte/StackedPlot.svelte +29 -0
- package/dist/svelte/StackedPlot.test.ts +114 -0
- package/dist/svelte/VeloPlot.svelte +44 -0
- package/dist/svelte/VeloPlot.test.ts +105 -0
- package/dist/svelte/index.d.ts +11 -0
- package/dist/svelte/index.test.ts +20 -0
- package/dist/svelte/index.ts +15 -0
- package/dist/svelte/useChartSync.d.ts +8 -0
- package/dist/svelte/useChartSync.test.ts +49 -0
- package/dist/svelte/useChartSync.ts +29 -0
- package/dist/svelte/useIndicator.d.ts +13 -0
- package/dist/svelte/useIndicator.test.ts +67 -0
- package/dist/svelte/useIndicator.ts +43 -0
- package/dist/svelte/useStackedPlot.d.ts +16 -0
- package/dist/svelte/useStackedPlot.test.ts +76 -0
- package/dist/svelte/useStackedPlot.ts +54 -0
- package/dist/svelte/useVeloPlot.d.ts +21 -0
- package/dist/svelte/useVeloPlot.test.ts +100 -0
- package/dist/svelte/useVeloPlot.ts +81 -0
- package/dist/svelte.d.ts +1 -0
- package/dist/svelte.js +143 -0
- package/dist/svelte.js.map +1 -0
- package/dist/testing/index.d.ts +1 -1
- package/dist/theme/index.d.ts +2 -1
- package/dist/trading.js +6 -6
- package/dist/types.d.ts +1 -1
- package/dist/{utils-BK5UUXxj.js → utils-Dx0h0bgQ.js} +9 -9
- package/dist/{utils-BK5UUXxj.js.map → utils-Dx0h0bgQ.js.map} +1 -1
- package/dist/velo-plot.full.js +452 -443
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +15 -15
- package/dist/vue/StackedPlot.vue.d.ts +48 -0
- package/dist/vue/VeloPlot.vue.d.ts +64 -0
- package/dist/vue/index.d.ts +250 -0
- package/dist/vue/useChartSync.d.ts +52 -0
- package/dist/vue/useIndicator.d.ts +23 -0
- package/dist/vue/useStackedPlot.d.ts +15 -0
- package/dist/vue/useVeloPlot.d.ts +20 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +312 -0
- package/dist/vue.js.map +1 -0
- package/dist/workers/indicatorsAsync.d.ts +2 -0
- package/dist/workers/pool.d.ts +9 -0
- package/package.json +88 -10
- package/dist/ChartCore-ivzLqxVb.js.map +0 -1
- package/dist/SciPlot-CEU4ApgD.js +0 -463
- package/dist/SciPlot-CEU4ApgD.js.map +0 -1
- package/dist/createStackedChart-DxNW0VkF.js +0 -705
- package/dist/createStackedChart-DxNW0VkF.js.map +0 -1
- package/dist/index-BBpJwOct.js.map +0 -1
- package/dist/index-DoYxf1cV.js.map +0 -1
- package/dist/index.core-COREBDNq.js.map +0 -1
- package/dist/mockDatafeed-927foCM4.js.map +0 -1
- package/dist/pool-15HMCNv8.js +0 -88
- package/dist/pool-15HMCNv8.js.map +0 -1
- package/dist/react/SciPlot.d.ts +0 -60
- package/dist/react/useSciPlot.d.ts +0 -56
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function j(r,
|
|
1
|
+
function j(r, t) {
|
|
2
2
|
if (r.length === 0) return -1;
|
|
3
|
-
let s = 0, n = Math.abs(r[0] -
|
|
3
|
+
let s = 0, n = Math.abs(r[0] - t);
|
|
4
4
|
for (let i = 1; i < r.length; i++) {
|
|
5
|
-
const f = Math.abs(r[i] -
|
|
5
|
+
const f = Math.abs(r[i] - t);
|
|
6
6
|
f < n && (n = f, s = i);
|
|
7
7
|
}
|
|
8
8
|
return s;
|
|
@@ -10,13 +10,13 @@ function j(r, e) {
|
|
|
10
10
|
function J(r) {
|
|
11
11
|
if (r.barX.length === 0)
|
|
12
12
|
return { x: r.x, y: r.y };
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
15
|
-
const s = r.barX[
|
|
16
|
-
r.open[
|
|
17
|
-
r.high[
|
|
18
|
-
r.low[
|
|
19
|
-
r.close[
|
|
13
|
+
const t = j(r.barX, r.x);
|
|
14
|
+
if (t < 0) return { x: r.x, y: r.y };
|
|
15
|
+
const s = r.barX[t], n = [
|
|
16
|
+
r.open[t],
|
|
17
|
+
r.high[t],
|
|
18
|
+
r.low[t],
|
|
19
|
+
r.close[t]
|
|
20
20
|
], i = r.dataToPixelY(r.y), f = r.pixelThreshold ?? 12;
|
|
21
21
|
let m = r.y, d = 1 / 0;
|
|
22
22
|
for (const c of n) {
|
|
@@ -25,24 +25,24 @@ function J(r) {
|
|
|
25
25
|
}
|
|
26
26
|
return { x: s, y: m };
|
|
27
27
|
}
|
|
28
|
-
function $(r,
|
|
29
|
-
const s =
|
|
28
|
+
function $(r, t) {
|
|
29
|
+
const s = t.y - r.y, n = Math.abs(r.y), i = n > 0 ? s / n * 100 : 0, f = Math.round(Math.abs(t.x - r.x));
|
|
30
30
|
return { change: s, percent: i, bars: f, up: s >= 0 };
|
|
31
31
|
}
|
|
32
32
|
function L(r) {
|
|
33
|
-
const
|
|
34
|
-
return `${
|
|
33
|
+
const t = r.change >= 0 ? "+" : "";
|
|
34
|
+
return `${t}${r.change.toFixed(2)} (${t}${r.percent.toFixed(2)}%) · ${r.bars} bars`;
|
|
35
35
|
}
|
|
36
36
|
function U(r) {
|
|
37
|
-
const
|
|
37
|
+
const t = Math.abs(r), s = t >= 1e3 ? 0 : t >= 1 ? 2 : 4;
|
|
38
38
|
return r.toLocaleString("en-US", {
|
|
39
39
|
minimumFractionDigits: s,
|
|
40
40
|
maximumFractionDigits: s
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
const Y = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1], K = 4, Q = "#26a69a", Z = "#ef5350";
|
|
44
|
-
function E(r,
|
|
45
|
-
return r.startsWith("#") && r.length === 7 ? r +
|
|
44
|
+
function E(r, t) {
|
|
45
|
+
return r.startsWith("#") && r.length === 7 ? r + t : r;
|
|
46
46
|
}
|
|
47
47
|
const C = {
|
|
48
48
|
name: "velo-plot-drawing-tools",
|
|
@@ -54,12 +54,12 @@ const C = {
|
|
|
54
54
|
function B(r) {
|
|
55
55
|
return r !== "none" && r !== "pan";
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
for (const
|
|
59
|
-
if (
|
|
57
|
+
function ee(r) {
|
|
58
|
+
for (const t of r.data.getAllSeries())
|
|
59
|
+
if (t.getType() === "candlestick") return t;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
let
|
|
61
|
+
function ie(r = {}) {
|
|
62
|
+
let t = null;
|
|
63
63
|
const s = r.autoDeselect !== !1;
|
|
64
64
|
let n = {
|
|
65
65
|
mode: "none",
|
|
@@ -75,8 +75,8 @@ function it(r = {}) {
|
|
|
75
75
|
};
|
|
76
76
|
const i = r.color ?? "#38bdf8", f = r.measureUpColor ?? Q, m = r.measureDownColor ?? Z;
|
|
77
77
|
function d() {
|
|
78
|
-
var
|
|
79
|
-
return ((o =
|
|
78
|
+
var e, o;
|
|
79
|
+
return ((o = t == null ? void 0 : (e = t.chart).getAnnotations) == null ? void 0 : o.call(e)) ?? [];
|
|
80
80
|
}
|
|
81
81
|
function c() {
|
|
82
82
|
n.undoStack.push(d()), n.redoStack = [];
|
|
@@ -84,77 +84,77 @@ function it(r = {}) {
|
|
|
84
84
|
function h() {
|
|
85
85
|
n.pending = null, n.start = null, n.dragging = !1, n.dragMoved = !1, n.dragStartPixel = null;
|
|
86
86
|
}
|
|
87
|
-
function x(
|
|
87
|
+
function x(e) {
|
|
88
88
|
var o, a;
|
|
89
|
-
n.mode =
|
|
89
|
+
n.mode = e, h(), (o = r.onModeChange) == null || o.call(r, e), (a = t == null ? void 0 : t.requestRender) == null || a.call(t);
|
|
90
90
|
}
|
|
91
91
|
function u() {
|
|
92
|
-
var
|
|
93
|
-
h(), s ? x("none") : (
|
|
92
|
+
var e;
|
|
93
|
+
h(), s ? x("none") : (e = t == null ? void 0 : t.requestRender) == null || e.call(t);
|
|
94
94
|
}
|
|
95
|
-
function T(
|
|
96
|
-
if (!
|
|
97
|
-
const a =
|
|
98
|
-
if (!a) return { x:
|
|
95
|
+
function T(e, o) {
|
|
96
|
+
if (!t || !n.magnet) return { x: e, y: o };
|
|
97
|
+
const a = ee(t);
|
|
98
|
+
if (!a) return { x: e, y: o };
|
|
99
99
|
const l = a.getData();
|
|
100
|
-
return !l.open || !l.high || !l.low || !l.close ? { x:
|
|
101
|
-
x:
|
|
100
|
+
return !l.open || !l.high || !l.low || !l.close ? { x: e, y: o } : J({
|
|
101
|
+
x: e,
|
|
102
102
|
y: o,
|
|
103
103
|
barX: l.x,
|
|
104
104
|
open: l.open,
|
|
105
105
|
high: l.high,
|
|
106
106
|
low: l.low,
|
|
107
107
|
close: l.close,
|
|
108
|
-
dataToPixelX:
|
|
109
|
-
dataToPixelY: (y) =>
|
|
108
|
+
dataToPixelX: t.coords.dataToPixelX,
|
|
109
|
+
dataToPixelY: (y) => t.coords.dataToPixelY(y),
|
|
110
110
|
enabled: !0
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
function k(
|
|
113
|
+
function k(e, o) {
|
|
114
114
|
return T(
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
e.coords.pixelToDataX(o.pixelX),
|
|
116
|
+
e.coords.pixelToDataY(o.pixelY)
|
|
117
117
|
);
|
|
118
118
|
}
|
|
119
|
-
function W(
|
|
120
|
-
|
|
119
|
+
function W(e) {
|
|
120
|
+
t && (c(), t.chart.addAnnotation({
|
|
121
121
|
type: "horizontal-line",
|
|
122
|
-
y:
|
|
122
|
+
y: e,
|
|
123
123
|
color: i,
|
|
124
124
|
interactive: !0
|
|
125
125
|
}));
|
|
126
126
|
}
|
|
127
|
-
function z(
|
|
128
|
-
|
|
127
|
+
function z(e) {
|
|
128
|
+
t && (c(), t.chart.addAnnotation({
|
|
129
129
|
type: "vertical-line",
|
|
130
|
-
x:
|
|
130
|
+
x: e,
|
|
131
131
|
color: i,
|
|
132
132
|
interactive: !0
|
|
133
133
|
}));
|
|
134
134
|
}
|
|
135
|
-
function _(
|
|
136
|
-
if (!
|
|
135
|
+
function _(e, o) {
|
|
136
|
+
if (!t) return;
|
|
137
137
|
c();
|
|
138
|
-
const a = $(
|
|
139
|
-
|
|
138
|
+
const a = $(e, o), l = a.up ? f : m, y = (e.x + o.x) / 2;
|
|
139
|
+
t.chart.addAnnotation({
|
|
140
140
|
type: "rectangle",
|
|
141
|
-
xMin: Math.min(
|
|
142
|
-
xMax: Math.max(
|
|
143
|
-
yMin: Math.min(
|
|
144
|
-
yMax: Math.max(
|
|
141
|
+
xMin: Math.min(e.x, o.x),
|
|
142
|
+
xMax: Math.max(e.x, o.x),
|
|
143
|
+
yMin: Math.min(e.y, o.y),
|
|
144
|
+
yMax: Math.max(e.y, o.y),
|
|
145
145
|
strokeColor: l,
|
|
146
146
|
fillColor: E(l, "33"),
|
|
147
147
|
interactive: !0
|
|
148
|
-
}),
|
|
148
|
+
}), t.chart.addAnnotation({
|
|
149
149
|
type: "arrow",
|
|
150
150
|
x1: y,
|
|
151
|
-
y1:
|
|
151
|
+
y1: e.y,
|
|
152
152
|
x2: y,
|
|
153
153
|
y2: o.y,
|
|
154
154
|
color: l,
|
|
155
155
|
headStyle: "filled",
|
|
156
156
|
interactive: !0
|
|
157
|
-
}),
|
|
157
|
+
}), t.chart.addAnnotation({
|
|
158
158
|
type: "text",
|
|
159
159
|
x: y,
|
|
160
160
|
y: o.y,
|
|
@@ -167,38 +167,38 @@ function it(r = {}) {
|
|
|
167
167
|
interactive: !0
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
function F(
|
|
171
|
-
if (
|
|
170
|
+
function F(e, o) {
|
|
171
|
+
if (t) {
|
|
172
172
|
if (n.mode === "measure") {
|
|
173
|
-
_(
|
|
173
|
+
_(e, o);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
if (c(), n.mode === "trendline")
|
|
177
|
-
|
|
177
|
+
t.chart.addAnnotation({
|
|
178
178
|
type: "arrow",
|
|
179
|
-
x1:
|
|
180
|
-
y1:
|
|
179
|
+
x1: e.x,
|
|
180
|
+
y1: e.y,
|
|
181
181
|
x2: o.x,
|
|
182
182
|
y2: o.y,
|
|
183
183
|
color: i,
|
|
184
184
|
interactive: !0
|
|
185
185
|
});
|
|
186
186
|
else if (n.mode === "rectangle")
|
|
187
|
-
|
|
187
|
+
t.chart.addAnnotation({
|
|
188
188
|
type: "rectangle",
|
|
189
|
-
xMin: Math.min(
|
|
190
|
-
xMax: Math.max(
|
|
191
|
-
yMin: Math.min(
|
|
192
|
-
yMax: Math.max(
|
|
189
|
+
xMin: Math.min(e.x, o.x),
|
|
190
|
+
xMax: Math.max(e.x, o.x),
|
|
191
|
+
yMin: Math.min(e.y, o.y),
|
|
192
|
+
yMax: Math.max(e.y, o.y),
|
|
193
193
|
strokeColor: i,
|
|
194
194
|
fillColor: i + "22",
|
|
195
195
|
interactive: !0
|
|
196
196
|
});
|
|
197
197
|
else if (n.mode === "fibonacci") {
|
|
198
|
-
const a = Math.min(
|
|
198
|
+
const a = Math.min(e.y, o.y), l = Math.max(e.y, o.y);
|
|
199
199
|
for (const y of Y) {
|
|
200
200
|
const M = l - (l - a) * y;
|
|
201
|
-
|
|
201
|
+
t.chart.addAnnotation({
|
|
202
202
|
type: "horizontal-line",
|
|
203
203
|
y: M,
|
|
204
204
|
color: i,
|
|
@@ -211,60 +211,60 @@ function it(r = {}) {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function H(
|
|
214
|
+
function H(e, o, a) {
|
|
215
215
|
const l = n.mode;
|
|
216
216
|
if (!B(l) || !n.cursor) return;
|
|
217
217
|
const y = n.cursor, M = n.pending ?? n.start;
|
|
218
|
-
|
|
218
|
+
e.save(), e.strokeStyle = i, e.lineWidth = 1.5, e.setLineDash([6, 4]), e.globalAlpha = 0.85;
|
|
219
219
|
const b = (g, v) => ({
|
|
220
220
|
px: a.dataToPixelX(g),
|
|
221
221
|
py: a.dataToPixelY(v)
|
|
222
222
|
});
|
|
223
223
|
if (l === "horizontal") {
|
|
224
224
|
const { py: g } = b(0, y.y);
|
|
225
|
-
|
|
225
|
+
e.beginPath(), e.moveTo(o.x, g), e.lineTo(o.x + o.width, g), e.stroke();
|
|
226
226
|
} else if (l === "vertical") {
|
|
227
227
|
const { px: g } = b(y.x, 0);
|
|
228
|
-
|
|
228
|
+
e.beginPath(), e.moveTo(g, o.y), e.lineTo(g, o.y + o.height), e.stroke();
|
|
229
229
|
} else if (M) {
|
|
230
230
|
const g = b(M.x, M.y), v = b(y.x, y.y);
|
|
231
231
|
if (l === "trendline")
|
|
232
|
-
|
|
232
|
+
e.beginPath(), e.moveTo(g.px, g.py), e.lineTo(v.px, v.py), e.stroke();
|
|
233
233
|
else if (l === "rectangle") {
|
|
234
234
|
const S = Math.min(g.px, v.px), w = Math.min(g.py, v.py), p = Math.abs(v.px - g.px), P = Math.abs(v.py - g.py);
|
|
235
|
-
|
|
235
|
+
e.strokeRect(S, w, p, P), e.fillStyle = i + "22", e.fillRect(S, w, p, P);
|
|
236
236
|
} else if (l === "fibonacci") {
|
|
237
237
|
const S = Math.min(M.y, y.y), w = Math.max(M.y, y.y);
|
|
238
|
-
|
|
238
|
+
e.font = "11px sans-serif", e.textAlign = "left", e.textBaseline = "bottom";
|
|
239
239
|
for (const p of Y) {
|
|
240
240
|
const P = w - (w - S) * p, { py: A } = b(0, P);
|
|
241
|
-
|
|
241
|
+
e.beginPath(), e.moveTo(o.x, A), e.lineTo(o.x + o.width, A), e.stroke(), e.save(), e.setLineDash([]), e.globalAlpha = 1, e.fillStyle = i, e.fillText(
|
|
242
242
|
`${(p * 100).toFixed(1)}% ${U(P)}`,
|
|
243
243
|
o.x + 4,
|
|
244
244
|
A - 2
|
|
245
|
-
),
|
|
245
|
+
), e.restore();
|
|
246
246
|
}
|
|
247
|
-
} else l === "measure" && O(
|
|
247
|
+
} else l === "measure" && O(e, g, v, M, y);
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
e.restore();
|
|
250
250
|
}
|
|
251
|
-
function O(
|
|
251
|
+
function O(e, o, a, l, y) {
|
|
252
252
|
const M = $(l, y), b = M.up ? f : m, g = Math.min(o.px, a.px), v = Math.min(o.py, a.py), S = Math.abs(a.px - o.px), w = Math.abs(a.py - o.py);
|
|
253
|
-
|
|
253
|
+
e.setLineDash([]), e.globalAlpha = 0.9, e.fillStyle = E(b, "33"), e.fillRect(g, v, S, w), e.strokeStyle = b, e.lineWidth = 1.5, e.strokeRect(g, v, S, w);
|
|
254
254
|
const p = (o.px + a.px) / 2;
|
|
255
|
-
|
|
255
|
+
e.beginPath(), e.moveTo(p, o.py), e.lineTo(p, a.py), e.stroke();
|
|
256
256
|
const P = 7, A = a.py >= o.py ? 1 : -1;
|
|
257
|
-
|
|
257
|
+
e.beginPath(), e.moveTo(p, a.py), e.lineTo(p - 4, a.py - A * P), e.lineTo(p + 4, a.py - A * P), e.closePath(), e.fillStyle = b, e.fill();
|
|
258
258
|
const I = L(M);
|
|
259
|
-
|
|
260
|
-
const R =
|
|
261
|
-
|
|
259
|
+
e.font = "12px sans-serif";
|
|
260
|
+
const R = e.measureText(I).width + 6 * 2, D = 20, G = p - R / 2, X = M.up ? a.py - D - 8 : a.py + 8;
|
|
261
|
+
e.globalAlpha = 1, e.fillStyle = b, e.fillRect(G, X, R, D), e.fillStyle = "#ffffff", e.textAlign = "center", e.textBaseline = "middle", e.fillText(I, p, X + D / 2);
|
|
262
262
|
}
|
|
263
|
-
function N(
|
|
263
|
+
function N(e, o) {
|
|
264
264
|
var l;
|
|
265
265
|
if (!o.inPlotArea) return;
|
|
266
266
|
o.preventDefault();
|
|
267
|
-
const a = k(
|
|
267
|
+
const a = k(e, o);
|
|
268
268
|
if (n.mode === "horizontal") {
|
|
269
269
|
W(a.y), u();
|
|
270
270
|
return;
|
|
@@ -277,104 +277,104 @@ function it(r = {}) {
|
|
|
277
277
|
F(n.pending, a), u();
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (l =
|
|
280
|
+
n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (l = e.requestRender) == null || l.call(e);
|
|
281
281
|
}
|
|
282
|
-
function V(
|
|
282
|
+
function V(e, o) {
|
|
283
283
|
var l;
|
|
284
|
-
const a = k(
|
|
284
|
+
const a = k(e, o);
|
|
285
285
|
if (n.cursor = a, n.dragging && n.dragStartPixel) {
|
|
286
286
|
const y = o.pixelX - n.dragStartPixel.x, M = o.pixelY - n.dragStartPixel.y;
|
|
287
287
|
Math.hypot(y, M) >= K && (n.dragMoved = !0);
|
|
288
288
|
}
|
|
289
|
-
o.preventDefault(), (l =
|
|
289
|
+
o.preventDefault(), (l = e.requestRender) == null || l.call(e);
|
|
290
290
|
}
|
|
291
|
-
function q(
|
|
291
|
+
function q(e, o) {
|
|
292
292
|
var y;
|
|
293
293
|
if (!n.dragging || !n.start) return;
|
|
294
|
-
const a = k(
|
|
294
|
+
const a = k(e, o), l = n.start;
|
|
295
295
|
if (n.dragging = !1, n.dragStartPixel = null, n.dragMoved) {
|
|
296
296
|
F(l, a), u();
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
|
-
n.pending = l, n.start = null, n.cursor = a, (y =
|
|
299
|
+
n.pending = l, n.start = null, n.cursor = a, (y = e.requestRender) == null || y.call(e);
|
|
300
300
|
}
|
|
301
301
|
return {
|
|
302
302
|
manifest: C,
|
|
303
303
|
api: {
|
|
304
|
-
setMode(
|
|
305
|
-
x(
|
|
304
|
+
setMode(e) {
|
|
305
|
+
x(e);
|
|
306
306
|
},
|
|
307
307
|
getMode() {
|
|
308
308
|
return n.mode;
|
|
309
309
|
},
|
|
310
|
-
setMagnet(
|
|
311
|
-
n.magnet =
|
|
310
|
+
setMagnet(e) {
|
|
311
|
+
n.magnet = e;
|
|
312
312
|
},
|
|
313
313
|
isMagnet() {
|
|
314
314
|
return n.magnet;
|
|
315
315
|
},
|
|
316
316
|
undo() {
|
|
317
|
-
if (!
|
|
317
|
+
if (!t || n.undoStack.length === 0) return !1;
|
|
318
318
|
n.redoStack.push(d());
|
|
319
|
-
const
|
|
320
|
-
for (const a of o)
|
|
321
|
-
for (const a of
|
|
319
|
+
const e = n.undoStack.pop(), o = d();
|
|
320
|
+
for (const a of o) t.chart.removeAnnotation(a.id);
|
|
321
|
+
for (const a of e) t.chart.addAnnotation(a);
|
|
322
322
|
return !0;
|
|
323
323
|
},
|
|
324
324
|
redo() {
|
|
325
|
-
if (!
|
|
325
|
+
if (!t || n.redoStack.length === 0) return !1;
|
|
326
326
|
n.undoStack.push(d());
|
|
327
|
-
const
|
|
328
|
-
for (const a of o)
|
|
329
|
-
for (const a of
|
|
327
|
+
const e = n.redoStack.pop(), o = d();
|
|
328
|
+
for (const a of o) t.chart.removeAnnotation(a.id);
|
|
329
|
+
for (const a of e) t.chart.addAnnotation(a);
|
|
330
330
|
return !0;
|
|
331
331
|
},
|
|
332
332
|
clear() {
|
|
333
|
-
if (
|
|
333
|
+
if (t) {
|
|
334
334
|
c();
|
|
335
|
-
for (const
|
|
335
|
+
for (const e of d()) t.chart.removeAnnotation(e.id);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
},
|
|
339
|
-
onInit(
|
|
340
|
-
|
|
339
|
+
onInit(e) {
|
|
340
|
+
t = e;
|
|
341
341
|
},
|
|
342
342
|
onDestroy() {
|
|
343
|
-
|
|
343
|
+
t = null;
|
|
344
344
|
},
|
|
345
|
-
onInteraction(
|
|
345
|
+
onInteraction(e, o) {
|
|
346
346
|
if (B(n.mode)) {
|
|
347
347
|
if (o.type === "mousedown") {
|
|
348
|
-
N(
|
|
348
|
+
N(e, o);
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
351
|
if (o.type === "mousemove") {
|
|
352
|
-
V(
|
|
352
|
+
V(e, o);
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
|
-
o.type === "mouseup" && q(
|
|
355
|
+
o.type === "mouseup" && q(e, o);
|
|
356
356
|
}
|
|
357
357
|
},
|
|
358
|
-
onRenderOverlay(
|
|
359
|
-
const o =
|
|
360
|
-
o && H(o,
|
|
358
|
+
onRenderOverlay(e) {
|
|
359
|
+
const o = e.render.ctx2d;
|
|
360
|
+
o && H(o, e.render.plotArea, e.coords);
|
|
361
361
|
}
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
|
-
const
|
|
364
|
+
const te = {
|
|
365
365
|
name: "velo-plot-replay",
|
|
366
366
|
version: "1.0.0",
|
|
367
367
|
description: "Bar-by-bar chart replay with speed control",
|
|
368
368
|
provides: ["replay"],
|
|
369
369
|
tags: ["replay", "trading"]
|
|
370
370
|
};
|
|
371
|
-
function
|
|
372
|
-
let
|
|
371
|
+
function le(r) {
|
|
372
|
+
let t = null, s = null, n = 0, i = null, f = 1;
|
|
373
373
|
const m = r.frameMs ?? 250;
|
|
374
374
|
function d(h) {
|
|
375
|
-
if (!
|
|
375
|
+
if (!t || !s) return;
|
|
376
376
|
const x = Math.min(h + 1, s.x.length), u = (T) => T ? T.subarray(0, x) : void 0;
|
|
377
|
-
|
|
377
|
+
t.chart.updateSeries(r.seriesId, {
|
|
378
378
|
x: u(s.x),
|
|
379
379
|
y: u(s.y),
|
|
380
380
|
open: u(s.open),
|
|
@@ -386,6 +386,10 @@ function lt(r) {
|
|
|
386
386
|
const c = {
|
|
387
387
|
play(h = 1) {
|
|
388
388
|
s && (f = Math.max(0.1, h), i && clearInterval(i), i = setInterval(() => {
|
|
389
|
+
if (!t || !s) {
|
|
390
|
+
c.pause();
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
389
393
|
if (n >= s.x.length - 1) {
|
|
390
394
|
c.pause();
|
|
391
395
|
return;
|
|
@@ -413,11 +417,11 @@ function lt(r) {
|
|
|
413
417
|
}
|
|
414
418
|
};
|
|
415
419
|
return {
|
|
416
|
-
manifest:
|
|
420
|
+
manifest: te,
|
|
417
421
|
api: c,
|
|
418
422
|
onInit(h) {
|
|
419
|
-
|
|
420
|
-
const x =
|
|
423
|
+
t = h;
|
|
424
|
+
const x = t.chart.getSeries(r.seriesId);
|
|
421
425
|
if (!x) {
|
|
422
426
|
console.warn(`[PluginReplay] Series "${r.seriesId}" not found`);
|
|
423
427
|
return;
|
|
@@ -433,26 +437,26 @@ function lt(r) {
|
|
|
433
437
|
}, n = Math.max(0, s.x.length - 1);
|
|
434
438
|
},
|
|
435
439
|
onDestroy() {
|
|
436
|
-
c.pause(),
|
|
440
|
+
c.pause(), t = null, s = null;
|
|
437
441
|
}
|
|
438
442
|
};
|
|
439
443
|
}
|
|
440
|
-
function
|
|
441
|
-
const
|
|
442
|
-
for (let c = 0; c <
|
|
444
|
+
function ce(r) {
|
|
445
|
+
const t = r.length, s = new Float64Array(t), n = new Float32Array(t), i = new Float32Array(t), f = new Float32Array(t), m = new Float32Array(t), d = new Float32Array(t);
|
|
446
|
+
for (let c = 0; c < t; c++) {
|
|
443
447
|
const h = r[c];
|
|
444
448
|
s[c] = h.time, n[c] = h.open, i[c] = h.high, f[c] = h.low, m[c] = h.close, d[c] = h.volume ?? 0;
|
|
445
449
|
}
|
|
446
450
|
return { x: s, open: n, high: i, low: f, close: m, volume: d };
|
|
447
451
|
}
|
|
448
|
-
function
|
|
449
|
-
let
|
|
450
|
-
return () => (
|
|
452
|
+
function ne(r) {
|
|
453
|
+
let t = r;
|
|
454
|
+
return () => (t = t * 16807 % 2147483647, (t - 1) / 2147483646);
|
|
451
455
|
}
|
|
452
|
-
function
|
|
456
|
+
function oe(r, t, s, n, i) {
|
|
453
457
|
const f = [];
|
|
454
458
|
let m = n;
|
|
455
|
-
for (let d = r; d <=
|
|
459
|
+
for (let d = r; d <= t; d += s) {
|
|
456
460
|
const c = m, h = (i() - 0.48) * 2, x = Math.max(1, c + h), u = Math.max(c, x) + i() * 1.5, T = Math.min(c, x) - i() * 1.5;
|
|
457
461
|
f.push({
|
|
458
462
|
time: d,
|
|
@@ -465,8 +469,8 @@ function ot(r, e, s, n, i) {
|
|
|
465
469
|
}
|
|
466
470
|
return f;
|
|
467
471
|
}
|
|
468
|
-
function
|
|
469
|
-
const
|
|
472
|
+
function fe(r = {}) {
|
|
473
|
+
const t = r.barMs ?? 6e4, s = r.basePrice ?? 100, n = ne(r.seed ?? 42), i = /* @__PURE__ */ new Map();
|
|
470
474
|
return {
|
|
471
475
|
async resolveSymbol(f) {
|
|
472
476
|
return {
|
|
@@ -482,7 +486,7 @@ function ft(r = {}) {
|
|
|
482
486
|
const m = `${f.symbol}:${f.from}:${f.to}`;
|
|
483
487
|
return i.has(m) || i.set(
|
|
484
488
|
m,
|
|
485
|
-
|
|
489
|
+
oe(f.from, f.to, t, s, n)
|
|
486
490
|
), i.get(m);
|
|
487
491
|
},
|
|
488
492
|
subscribeBars(f) {
|
|
@@ -497,15 +501,15 @@ function ft(r = {}) {
|
|
|
497
501
|
close: h,
|
|
498
502
|
volume: 1e3 + n() * 3e3
|
|
499
503
|
}), m = h;
|
|
500
|
-
},
|
|
504
|
+
}, t);
|
|
501
505
|
return () => clearInterval(d);
|
|
502
506
|
}
|
|
503
507
|
};
|
|
504
508
|
}
|
|
505
509
|
export {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
+
ie as P,
|
|
511
|
+
le as a,
|
|
512
|
+
ce as b,
|
|
513
|
+
fe as c
|
|
510
514
|
};
|
|
511
|
-
//# sourceMappingURL=mockDatafeed-
|
|
515
|
+
//# sourceMappingURL=mockDatafeed-DHIDPcpX.js.map
|