velo-plot 2.20.0 → 3.1.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 +26 -12
- package/dist/ChartCore-AnR_3Xkb.js +7338 -0
- package/dist/ChartCore-AnR_3Xkb.js.map +1 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js +75 -0
- package/dist/GpuChartRenderer-Dxc0hrQA.js.map +1 -0
- package/dist/{index.core-COREBDNq.js → PluginRegistry-CzMHebYP.js} +24 -38
- package/dist/PluginRegistry-CzMHebYP.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/{axisFormat-CzumxpCL.js → axisFormat-Sz4WIJfQ.js} +2 -2
- package/dist/{axisFormat-CzumxpCL.js.map → axisFormat-Sz4WIJfQ.js.map} +1 -1
- 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-D_rCtbFq.js +58 -0
- package/dist/chartSyncBridge-D_rCtbFq.js.map +1 -0
- package/dist/core/Chart.d.ts +1 -1
- package/dist/core/ChartStatistics.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 +14 -19
- package/dist/core/chart/ChartFeatureHooks.d.ts +7 -0
- package/dist/core/chart/chartExportPatch.d.ts +2 -0
- package/dist/core/chart/overlaySeriesRegistry.d.ts +7 -0
- package/dist/core/chart/series/SeriesActions.d.ts +1 -0
- package/dist/core/chart/series/SeriesBufferLite.d.ts +13 -0
- package/dist/core/chart/series/seriesOptionsRegistry.d.ts +8 -0
- package/dist/core/chart/series/seriesTypeRegistry.d.ts +5 -0
- 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-DqcLCFGS.js +1338 -0
- package/dist/createStackedChart-DqcLCFGS.js.map +1 -0
- package/dist/examples/PluginDemonstration.d.ts +1 -1
- package/dist/hooks-DH-3bewj.js +69 -0
- package/dist/hooks-DH-3bewj.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-qunX30Xu.js → index-B7PTX94B.js} +2133 -2133
- package/dist/index-B7PTX94B.js.map +1 -0
- package/dist/{index-BMiZoKmm.js → index-BgrvqltV.js} +67 -67
- package/dist/index-BgrvqltV.js.map +1 -0
- 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/{mockDatafeed-927foCM4.js → index-Cv6ZDLWf.js} +227 -217
- package/dist/index-Cv6ZDLWf.js.map +1 -0
- package/dist/index-Dag88bW4.js.map +1 -1
- package/dist/index-qhscKTDy.js.map +1 -1
- package/dist/index.core.d.ts +9 -7
- package/dist/index.d.ts +2 -15
- package/dist/indicators--eJGmVox.js.map +1 -1
- 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 +3 -1
- 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/createPlugin.d.ts +8 -0
- 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 +33 -33
- 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 +2033 -209
- 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 +286 -23
- 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 +766 -207
- package/dist/plugins/latex.js.map +1 -1
- package/dist/plugins/lazy-load.d.ts +2 -2
- package/dist/plugins/loading/index.d.ts +2 -3
- package/dist/plugins/loading.d.ts +2 -2
- package/dist/plugins/loading.js +3 -4
- 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/offscreen.js +11 -10
- package/dist/plugins/offscreen.js.map +1 -1
- 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 +255 -257
- 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/streaming.js +1 -1
- 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/tools.js +1 -1
- 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 +325 -24
- package/dist/react.js.map +1 -1
- package/dist/renderer/NativeWebGLRenderer.d.ts +2 -1
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +5 -1
- package/dist/renderer/native/draw.d.ts +2 -47
- package/dist/renderer/native/drawCore.d.ts +27 -0
- package/dist/renderer/native/drawExtended.d.ts +29 -0
- package/dist/renderer/native/frameRenderExtended.d.ts +1 -0
- package/dist/renderer/native/frameRenderRegistry.d.ts +27 -0
- package/dist/renderer/native/programFactoryCore.d.ts +6 -0
- package/dist/renderer/native/programFactoryExtended.d.ts +4 -0
- package/dist/renderer/native/utils.d.ts +3 -29
- package/dist/renderer/native/utilsCore.d.ts +14 -0
- package/dist/renderer/native/utilsExtended.d.ts +17 -0
- package/dist/renderer/overlaySeriesExtended.d.ts +1 -0
- package/dist/renderer/registerExtendedSeries.d.ts +1 -0
- package/dist/renderer/registerWebGPU.d.ts +2 -0
- package/dist/renderer/seriesBufferExtended.d.ts +4 -0
- package/dist/scientific/index.d.ts +44 -0
- package/dist/scientific/registerScientific.d.ts +1 -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 +169 -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 +140 -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/index.d.ts +1 -4
- package/dist/trading/registerTrading.d.ts +3 -0
- package/dist/trading.js +42 -42
- package/dist/types.d.ts +4 -4
- 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 +2216 -1346
- package/dist/velo-plot.full.js.map +1 -1
- package/dist/velo-plot.js +33 -28
- package/dist/velo-plot.js.map +1 -1
- 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 +309 -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 +96 -10
- package/dist/ChartCore-ivzLqxVb.js +0 -8350
- 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/gpuRenderer-BpaMYz-k.js +0 -1848
- package/dist/gpuRenderer-BpaMYz-k.js.map +0 -1
- package/dist/index-BBpJwOct.js.map +0 -1
- package/dist/index-BMiZoKmm.js.map +0 -1
- package/dist/index-DoYxf1cV.js.map +0 -1
- package/dist/index-qunX30Xu.js.map +0 -1
- package/dist/index-x4stH3jD.js +0 -282
- package/dist/index-x4stH3jD.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
- package/dist/symbols-DT0eLlpW.js +0 -568
- package/dist/symbols-DT0eLlpW.js.map +0 -1
|
@@ -1,67 +1,139 @@
|
|
|
1
|
-
function
|
|
1
|
+
function it(r) {
|
|
2
|
+
const e = r.close.length, s = new Float32Array(e), n = new Float32Array(e), i = new Float32Array(e), c = new Float32Array(e);
|
|
3
|
+
for (let l = 0; l < e; l++) {
|
|
4
|
+
const d = r.open[l], h = r.high[l], u = r.low[l], x = r.close[l];
|
|
5
|
+
c[l] = (d + h + u + x) / 4, s[l] = l === 0 ? (d + x) / 2 : (s[l - 1] + c[l - 1]) / 2, n[l] = Math.max(h, s[l], c[l]), i[l] = Math.min(u, s[l], c[l]);
|
|
6
|
+
}
|
|
7
|
+
return { open: s, high: n, low: i, close: c };
|
|
8
|
+
}
|
|
9
|
+
function lt(r) {
|
|
10
|
+
const e = r.length, s = new Float64Array(e), n = new Float32Array(e), i = new Float32Array(e), c = new Float32Array(e), l = new Float32Array(e), d = new Float32Array(e);
|
|
11
|
+
for (let h = 0; h < e; h++) {
|
|
12
|
+
const u = r[h];
|
|
13
|
+
s[h] = u.time, n[h] = u.open, i[h] = u.high, c[h] = u.low, l[h] = u.close, d[h] = u.volume ?? 0;
|
|
14
|
+
}
|
|
15
|
+
return { x: s, open: n, high: i, low: c, close: l, volume: d };
|
|
16
|
+
}
|
|
17
|
+
function j(r) {
|
|
18
|
+
let e = r;
|
|
19
|
+
return () => (e = e * 16807 % 2147483647, (e - 1) / 2147483646);
|
|
20
|
+
}
|
|
21
|
+
function J(r, e, s, n, i) {
|
|
22
|
+
const c = [];
|
|
23
|
+
let l = n;
|
|
24
|
+
for (let d = r; d <= e; d += s) {
|
|
25
|
+
const h = l, u = (i() - 0.48) * 2, x = Math.max(1, h + u), y = Math.max(h, x) + i() * 1.5, k = Math.min(h, x) - i() * 1.5;
|
|
26
|
+
c.push({
|
|
27
|
+
time: d,
|
|
28
|
+
open: h,
|
|
29
|
+
high: y,
|
|
30
|
+
low: k,
|
|
31
|
+
close: x,
|
|
32
|
+
volume: 1e3 + i() * 5e3
|
|
33
|
+
}), l = x;
|
|
34
|
+
}
|
|
35
|
+
return c;
|
|
36
|
+
}
|
|
37
|
+
function ct(r = {}) {
|
|
38
|
+
const e = r.barMs ?? 6e4, s = r.basePrice ?? 100, n = j(r.seed ?? 42), i = /* @__PURE__ */ new Map();
|
|
39
|
+
return {
|
|
40
|
+
async resolveSymbol(c) {
|
|
41
|
+
return {
|
|
42
|
+
symbol: c,
|
|
43
|
+
name: c,
|
|
44
|
+
description: `Mock symbol ${c}`,
|
|
45
|
+
timezone: "UTC",
|
|
46
|
+
session: "24x7",
|
|
47
|
+
pricescale: 100
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
async getBars(c) {
|
|
51
|
+
const l = `${c.symbol}:${c.from}:${c.to}`;
|
|
52
|
+
return i.has(l) || i.set(
|
|
53
|
+
l,
|
|
54
|
+
J(c.from, c.to, e, s, n)
|
|
55
|
+
), i.get(l);
|
|
56
|
+
},
|
|
57
|
+
subscribeBars(c) {
|
|
58
|
+
let l = s + n() * 5;
|
|
59
|
+
const d = setInterval(() => {
|
|
60
|
+
const h = l, u = Math.max(1, h + (n() - 0.5) * 2), x = Math.max(h, u) + n(), y = Math.min(h, u) - n();
|
|
61
|
+
c.onBar({
|
|
62
|
+
time: Date.now(),
|
|
63
|
+
open: h,
|
|
64
|
+
high: x,
|
|
65
|
+
low: y,
|
|
66
|
+
close: u,
|
|
67
|
+
volume: 1e3 + n() * 3e3
|
|
68
|
+
}), l = u;
|
|
69
|
+
}, e);
|
|
70
|
+
return () => clearInterval(d);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function K(r, e) {
|
|
2
75
|
if (r.length === 0) return -1;
|
|
3
76
|
let s = 0, n = Math.abs(r[0] - e);
|
|
4
77
|
for (let i = 1; i < r.length; i++) {
|
|
5
|
-
const
|
|
6
|
-
|
|
78
|
+
const c = Math.abs(r[i] - e);
|
|
79
|
+
c < n && (n = c, s = i);
|
|
7
80
|
}
|
|
8
81
|
return s;
|
|
9
82
|
}
|
|
10
|
-
function
|
|
83
|
+
function Q(r) {
|
|
11
84
|
if (r.barX.length === 0)
|
|
12
85
|
return { x: r.x, y: r.y };
|
|
13
|
-
const e =
|
|
86
|
+
const e = K(r.barX, r.x);
|
|
14
87
|
if (e < 0) return { x: r.x, y: r.y };
|
|
15
88
|
const s = r.barX[e], n = [
|
|
16
89
|
r.open[e],
|
|
17
90
|
r.high[e],
|
|
18
91
|
r.low[e],
|
|
19
92
|
r.close[e]
|
|
20
|
-
], i = r.dataToPixelY(r.y),
|
|
21
|
-
let
|
|
22
|
-
for (const
|
|
23
|
-
const
|
|
24
|
-
x < d && x <=
|
|
93
|
+
], i = r.dataToPixelY(r.y), c = r.pixelThreshold ?? 12;
|
|
94
|
+
let l = r.y, d = 1 / 0;
|
|
95
|
+
for (const h of n) {
|
|
96
|
+
const u = r.dataToPixelY(h), x = Math.abs(u - i);
|
|
97
|
+
x < d && x <= c && (d = x, l = h);
|
|
25
98
|
}
|
|
26
|
-
return { x: s, y:
|
|
99
|
+
return { x: s, y: l };
|
|
27
100
|
}
|
|
28
|
-
function
|
|
29
|
-
const s = e.y - r.y, n = Math.abs(r.y), i = n > 0 ? s / n * 100 : 0,
|
|
30
|
-
return { change: s, percent: i, bars:
|
|
101
|
+
function L(r, e) {
|
|
102
|
+
const s = e.y - r.y, n = Math.abs(r.y), i = n > 0 ? s / n * 100 : 0, c = Math.round(Math.abs(e.x - r.x));
|
|
103
|
+
return { change: s, percent: i, bars: c, up: s >= 0 };
|
|
31
104
|
}
|
|
32
|
-
function
|
|
105
|
+
function U(r) {
|
|
33
106
|
const e = r.change >= 0 ? "+" : "";
|
|
34
107
|
return `${e}${r.change.toFixed(2)} (${e}${r.percent.toFixed(2)}%) · ${r.bars} bars`;
|
|
35
108
|
}
|
|
36
|
-
function
|
|
109
|
+
function Y(r) {
|
|
37
110
|
const e = Math.abs(r), s = e >= 1e3 ? 0 : e >= 1 ? 2 : 4;
|
|
38
111
|
return r.toLocaleString("en-US", {
|
|
39
112
|
minimumFractionDigits: s,
|
|
40
113
|
maximumFractionDigits: s
|
|
41
114
|
});
|
|
42
115
|
}
|
|
43
|
-
const
|
|
44
|
-
function
|
|
116
|
+
const E = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1], Z = 4, C = "#26a69a", tt = "#ef5350";
|
|
117
|
+
function B(r, e) {
|
|
45
118
|
return r.startsWith("#") && r.length === 7 ? r + e : r;
|
|
46
119
|
}
|
|
47
|
-
const
|
|
120
|
+
const et = {
|
|
48
121
|
name: "velo-plot-drawing-tools",
|
|
49
122
|
version: "1.0.0",
|
|
50
123
|
description: "Interactive trendline, horizontal, vertical, rectangle, and fibonacci drawing",
|
|
51
124
|
provides: ["drawing"],
|
|
52
125
|
tags: ["drawing", "annotations", "trading"]
|
|
53
126
|
};
|
|
54
|
-
function
|
|
127
|
+
function W(r) {
|
|
55
128
|
return r !== "none" && r !== "pan";
|
|
56
129
|
}
|
|
57
|
-
function
|
|
130
|
+
function nt(r) {
|
|
58
131
|
for (const e of r.data.getAllSeries())
|
|
59
132
|
if (e.getType() === "candlestick") return e;
|
|
60
133
|
}
|
|
61
|
-
function
|
|
134
|
+
function ht(r = {}) {
|
|
62
135
|
let e = null;
|
|
63
|
-
const s = r.autoDeselect !== !1
|
|
64
|
-
let n = {
|
|
136
|
+
const s = r.autoDeselect !== !1, n = {
|
|
65
137
|
mode: "none",
|
|
66
138
|
pending: null,
|
|
67
139
|
start: null,
|
|
@@ -72,52 +144,51 @@ function it(r = {}) {
|
|
|
72
144
|
magnet: r.magnet ?? !1,
|
|
73
145
|
undoStack: [],
|
|
74
146
|
redoStack: []
|
|
75
|
-
};
|
|
76
|
-
const i = r.color ?? "#38bdf8", f = r.measureUpColor ?? Q, m = r.measureDownColor ?? Z;
|
|
147
|
+
}, i = r.color ?? "#38bdf8", c = r.measureUpColor ?? C, l = r.measureDownColor ?? tt;
|
|
77
148
|
function d() {
|
|
78
149
|
var t, o;
|
|
79
150
|
return ((o = e == null ? void 0 : (t = e.chart).getAnnotations) == null ? void 0 : o.call(t)) ?? [];
|
|
80
151
|
}
|
|
81
|
-
function
|
|
152
|
+
function h() {
|
|
82
153
|
n.undoStack.push(d()), n.redoStack = [];
|
|
83
154
|
}
|
|
84
|
-
function
|
|
155
|
+
function u() {
|
|
85
156
|
n.pending = null, n.start = null, n.dragging = !1, n.dragMoved = !1, n.dragStartPixel = null;
|
|
86
157
|
}
|
|
87
158
|
function x(t) {
|
|
88
159
|
var o, a;
|
|
89
|
-
n.mode = t,
|
|
160
|
+
n.mode = t, u(), (o = r.onModeChange) == null || o.call(r, t), (a = e == null ? void 0 : e.requestRender) == null || a.call(e);
|
|
90
161
|
}
|
|
91
|
-
function
|
|
162
|
+
function y() {
|
|
92
163
|
var t;
|
|
93
|
-
|
|
164
|
+
u(), s ? x("none") : (t = e == null ? void 0 : e.requestRender) == null || t.call(e);
|
|
94
165
|
}
|
|
95
|
-
function
|
|
166
|
+
function k(t, o) {
|
|
96
167
|
if (!e || !n.magnet) return { x: t, y: o };
|
|
97
|
-
const a =
|
|
168
|
+
const a = nt(e);
|
|
98
169
|
if (!a) return { x: t, y: o };
|
|
99
|
-
const
|
|
100
|
-
return !
|
|
170
|
+
const f = a.getData();
|
|
171
|
+
return !f.open || !f.high || !f.low || !f.close ? { x: t, y: o } : Q({
|
|
101
172
|
x: t,
|
|
102
173
|
y: o,
|
|
103
|
-
barX:
|
|
104
|
-
open:
|
|
105
|
-
high:
|
|
106
|
-
low:
|
|
107
|
-
close:
|
|
174
|
+
barX: f.x,
|
|
175
|
+
open: f.open,
|
|
176
|
+
high: f.high,
|
|
177
|
+
low: f.low,
|
|
178
|
+
close: f.close,
|
|
108
179
|
dataToPixelX: e.coords.dataToPixelX,
|
|
109
|
-
dataToPixelY: (
|
|
180
|
+
dataToPixelY: (m) => e.coords.dataToPixelY(m),
|
|
110
181
|
enabled: !0
|
|
111
182
|
});
|
|
112
183
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
184
|
+
function b(t, o) {
|
|
185
|
+
return k(
|
|
115
186
|
t.coords.pixelToDataX(o.pixelX),
|
|
116
187
|
t.coords.pixelToDataY(o.pixelY)
|
|
117
188
|
);
|
|
118
189
|
}
|
|
119
|
-
function
|
|
120
|
-
e && (
|
|
190
|
+
function D(t) {
|
|
191
|
+
e && (h(), e.chart.addAnnotation({
|
|
121
192
|
type: "horizontal-line",
|
|
122
193
|
y: t,
|
|
123
194
|
color: i,
|
|
@@ -125,7 +196,7 @@ function it(r = {}) {
|
|
|
125
196
|
}));
|
|
126
197
|
}
|
|
127
198
|
function z(t) {
|
|
128
|
-
e && (
|
|
199
|
+
e && (h(), e.chart.addAnnotation({
|
|
129
200
|
type: "vertical-line",
|
|
130
201
|
x: t,
|
|
131
202
|
color: i,
|
|
@@ -134,46 +205,46 @@ function it(r = {}) {
|
|
|
134
205
|
}
|
|
135
206
|
function _(t, o) {
|
|
136
207
|
if (!e) return;
|
|
137
|
-
|
|
138
|
-
const a =
|
|
208
|
+
h();
|
|
209
|
+
const a = L(t, o), f = a.up ? c : l, m = (t.x + o.x) / 2;
|
|
139
210
|
e.chart.addAnnotation({
|
|
140
211
|
type: "rectangle",
|
|
141
212
|
xMin: Math.min(t.x, o.x),
|
|
142
213
|
xMax: Math.max(t.x, o.x),
|
|
143
214
|
yMin: Math.min(t.y, o.y),
|
|
144
215
|
yMax: Math.max(t.y, o.y),
|
|
145
|
-
strokeColor:
|
|
146
|
-
fillColor:
|
|
216
|
+
strokeColor: f,
|
|
217
|
+
fillColor: B(f, "33"),
|
|
147
218
|
interactive: !0
|
|
148
219
|
}), e.chart.addAnnotation({
|
|
149
220
|
type: "arrow",
|
|
150
|
-
x1:
|
|
221
|
+
x1: m,
|
|
151
222
|
y1: t.y,
|
|
152
|
-
x2:
|
|
223
|
+
x2: m,
|
|
153
224
|
y2: o.y,
|
|
154
|
-
color:
|
|
225
|
+
color: f,
|
|
155
226
|
headStyle: "filled",
|
|
156
227
|
interactive: !0
|
|
157
228
|
}), e.chart.addAnnotation({
|
|
158
229
|
type: "text",
|
|
159
|
-
x:
|
|
230
|
+
x: m,
|
|
160
231
|
y: o.y,
|
|
161
|
-
text:
|
|
232
|
+
text: U(a),
|
|
162
233
|
color: "#ffffff",
|
|
163
|
-
backgroundColor:
|
|
234
|
+
backgroundColor: f,
|
|
164
235
|
padding: 4,
|
|
165
236
|
fontWeight: "bold",
|
|
166
237
|
anchor: a.up ? "bottom-center" : "top-center",
|
|
167
238
|
interactive: !0
|
|
168
239
|
});
|
|
169
240
|
}
|
|
170
|
-
function
|
|
241
|
+
function I(t, o) {
|
|
171
242
|
if (e) {
|
|
172
243
|
if (n.mode === "measure") {
|
|
173
244
|
_(t, o);
|
|
174
245
|
return;
|
|
175
246
|
}
|
|
176
|
-
if (
|
|
247
|
+
if (h(), n.mode === "trendline")
|
|
177
248
|
e.chart.addAnnotation({
|
|
178
249
|
type: "arrow",
|
|
179
250
|
x1: t.x,
|
|
@@ -195,15 +266,15 @@ function it(r = {}) {
|
|
|
195
266
|
interactive: !0
|
|
196
267
|
});
|
|
197
268
|
else if (n.mode === "fibonacci") {
|
|
198
|
-
const a = Math.min(t.y, o.y),
|
|
199
|
-
for (const
|
|
200
|
-
const M =
|
|
269
|
+
const a = Math.min(t.y, o.y), f = Math.max(t.y, o.y);
|
|
270
|
+
for (const m of E) {
|
|
271
|
+
const M = f - (f - a) * m;
|
|
201
272
|
e.chart.addAnnotation({
|
|
202
273
|
type: "horizontal-line",
|
|
203
274
|
y: M,
|
|
204
275
|
color: i,
|
|
205
|
-
lineDash:
|
|
206
|
-
label: `${(
|
|
276
|
+
lineDash: m === 0 || m === 1 ? void 0 : [4, 4],
|
|
277
|
+
label: `${(m * 100).toFixed(1)}% ${Y(M)}`,
|
|
207
278
|
labelPosition: "right",
|
|
208
279
|
interactive: !0
|
|
209
280
|
});
|
|
@@ -212,94 +283,94 @@ function it(r = {}) {
|
|
|
212
283
|
}
|
|
213
284
|
}
|
|
214
285
|
function H(t, o, a) {
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
const
|
|
286
|
+
const f = n.mode;
|
|
287
|
+
if (!W(f) || !n.cursor) return;
|
|
288
|
+
const m = n.cursor, M = n.pending ?? n.start;
|
|
218
289
|
t.save(), t.strokeStyle = i, t.lineWidth = 1.5, t.setLineDash([6, 4]), t.globalAlpha = 0.85;
|
|
219
|
-
const
|
|
290
|
+
const v = (g, w) => ({
|
|
220
291
|
px: a.dataToPixelX(g),
|
|
221
|
-
py: a.dataToPixelY(
|
|
292
|
+
py: a.dataToPixelY(w)
|
|
222
293
|
});
|
|
223
|
-
if (
|
|
224
|
-
const { py: g } =
|
|
294
|
+
if (f === "horizontal") {
|
|
295
|
+
const { py: g } = v(0, m.y);
|
|
225
296
|
t.beginPath(), t.moveTo(o.x, g), t.lineTo(o.x + o.width, g), t.stroke();
|
|
226
|
-
} else if (
|
|
227
|
-
const { px: g } =
|
|
297
|
+
} else if (f === "vertical") {
|
|
298
|
+
const { px: g } = v(m.x, 0);
|
|
228
299
|
t.beginPath(), t.moveTo(g, o.y), t.lineTo(g, o.y + o.height), t.stroke();
|
|
229
300
|
} else if (M) {
|
|
230
|
-
const g =
|
|
231
|
-
if (
|
|
232
|
-
t.beginPath(), t.moveTo(g.px, g.py), t.lineTo(
|
|
233
|
-
else if (
|
|
234
|
-
const
|
|
235
|
-
t.strokeRect(
|
|
236
|
-
} else if (
|
|
237
|
-
const
|
|
301
|
+
const g = v(M.x, M.y), w = v(m.x, m.y);
|
|
302
|
+
if (f === "trendline")
|
|
303
|
+
t.beginPath(), t.moveTo(g.px, g.py), t.lineTo(w.px, w.py), t.stroke();
|
|
304
|
+
else if (f === "rectangle") {
|
|
305
|
+
const A = Math.min(g.px, w.px), P = Math.min(g.py, w.py), p = Math.abs(w.px - g.px), S = Math.abs(w.py - g.py);
|
|
306
|
+
t.strokeRect(A, P, p, S), t.fillStyle = i + "22", t.fillRect(A, P, p, S);
|
|
307
|
+
} else if (f === "fibonacci") {
|
|
308
|
+
const A = Math.min(M.y, m.y), P = Math.max(M.y, m.y);
|
|
238
309
|
t.font = "11px sans-serif", t.textAlign = "left", t.textBaseline = "bottom";
|
|
239
|
-
for (const p of
|
|
240
|
-
const
|
|
241
|
-
t.beginPath(), t.moveTo(o.x,
|
|
242
|
-
`${(p * 100).toFixed(1)}% ${
|
|
310
|
+
for (const p of E) {
|
|
311
|
+
const S = P - (P - A) * p, { py: T } = v(0, S);
|
|
312
|
+
t.beginPath(), t.moveTo(o.x, T), t.lineTo(o.x + o.width, T), t.stroke(), t.save(), t.setLineDash([]), t.globalAlpha = 1, t.fillStyle = i, t.fillText(
|
|
313
|
+
`${(p * 100).toFixed(1)}% ${Y(S)}`,
|
|
243
314
|
o.x + 4,
|
|
244
|
-
|
|
315
|
+
T - 2
|
|
245
316
|
), t.restore();
|
|
246
317
|
}
|
|
247
|
-
} else
|
|
318
|
+
} else f === "measure" && O(t, g, w, M, m);
|
|
248
319
|
}
|
|
249
320
|
t.restore();
|
|
250
321
|
}
|
|
251
|
-
function O(t, o, a,
|
|
252
|
-
const M =
|
|
253
|
-
t.setLineDash([]), t.globalAlpha = 0.9, t.fillStyle =
|
|
322
|
+
function O(t, o, a, f, m) {
|
|
323
|
+
const M = L(f, m), v = M.up ? c : l, g = Math.min(o.px, a.px), w = Math.min(o.py, a.py), A = Math.abs(a.px - o.px), P = Math.abs(a.py - o.py);
|
|
324
|
+
t.setLineDash([]), t.globalAlpha = 0.9, t.fillStyle = B(v, "33"), t.fillRect(g, w, A, P), t.strokeStyle = v, t.lineWidth = 1.5, t.strokeRect(g, w, A, P);
|
|
254
325
|
const p = (o.px + a.px) / 2;
|
|
255
326
|
t.beginPath(), t.moveTo(p, o.py), t.lineTo(p, a.py), t.stroke();
|
|
256
|
-
const
|
|
257
|
-
t.beginPath(), t.moveTo(p, a.py), t.lineTo(p - 4, a.py -
|
|
258
|
-
const
|
|
327
|
+
const S = 7, T = a.py >= o.py ? 1 : -1;
|
|
328
|
+
t.beginPath(), t.moveTo(p, a.py), t.lineTo(p - 4, a.py - T * S), t.lineTo(p + 4, a.py - T * S), t.closePath(), t.fillStyle = v, t.fill();
|
|
329
|
+
const R = U(M);
|
|
259
330
|
t.font = "12px sans-serif";
|
|
260
|
-
const
|
|
261
|
-
t.globalAlpha = 1, t.fillStyle =
|
|
331
|
+
const X = t.measureText(R).width + 6 * 2, F = 20, G = p - X / 2, $ = M.up ? a.py - F - 8 : a.py + 8;
|
|
332
|
+
t.globalAlpha = 1, t.fillStyle = v, t.fillRect(G, $, X, F), t.fillStyle = "#ffffff", t.textAlign = "center", t.textBaseline = "middle", t.fillText(R, p, $ + F / 2);
|
|
262
333
|
}
|
|
263
334
|
function N(t, o) {
|
|
264
|
-
var
|
|
335
|
+
var f;
|
|
265
336
|
if (!o.inPlotArea) return;
|
|
266
337
|
o.preventDefault();
|
|
267
|
-
const a =
|
|
338
|
+
const a = b(t, o);
|
|
268
339
|
if (n.mode === "horizontal") {
|
|
269
|
-
|
|
340
|
+
D(a.y), y();
|
|
270
341
|
return;
|
|
271
342
|
}
|
|
272
343
|
if (n.mode === "vertical") {
|
|
273
|
-
z(a.x),
|
|
344
|
+
z(a.x), y();
|
|
274
345
|
return;
|
|
275
346
|
}
|
|
276
347
|
if (n.pending) {
|
|
277
|
-
|
|
348
|
+
I(n.pending, a), y();
|
|
278
349
|
return;
|
|
279
350
|
}
|
|
280
|
-
n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (
|
|
351
|
+
n.start = a, n.dragging = !0, n.dragMoved = !1, n.dragStartPixel = { x: o.pixelX, y: o.pixelY }, n.cursor = a, (f = t.requestRender) == null || f.call(t);
|
|
281
352
|
}
|
|
282
353
|
function V(t, o) {
|
|
283
|
-
var
|
|
284
|
-
const a =
|
|
354
|
+
var f;
|
|
355
|
+
const a = b(t, o);
|
|
285
356
|
if (n.cursor = a, n.dragging && n.dragStartPixel) {
|
|
286
|
-
const
|
|
287
|
-
Math.hypot(
|
|
357
|
+
const m = o.pixelX - n.dragStartPixel.x, M = o.pixelY - n.dragStartPixel.y;
|
|
358
|
+
Math.hypot(m, M) >= Z && (n.dragMoved = !0);
|
|
288
359
|
}
|
|
289
|
-
o.preventDefault(), (
|
|
360
|
+
o.preventDefault(), (f = t.requestRender) == null || f.call(t);
|
|
290
361
|
}
|
|
291
362
|
function q(t, o) {
|
|
292
|
-
var
|
|
363
|
+
var m;
|
|
293
364
|
if (!n.dragging || !n.start) return;
|
|
294
|
-
const a =
|
|
365
|
+
const a = b(t, o), f = n.start;
|
|
295
366
|
if (n.dragging = !1, n.dragStartPixel = null, n.dragMoved) {
|
|
296
|
-
|
|
367
|
+
I(f, a), y();
|
|
297
368
|
return;
|
|
298
369
|
}
|
|
299
|
-
n.pending =
|
|
370
|
+
n.pending = f, n.start = null, n.cursor = a, (m = t.requestRender) == null || m.call(t);
|
|
300
371
|
}
|
|
301
372
|
return {
|
|
302
|
-
manifest:
|
|
373
|
+
manifest: et,
|
|
303
374
|
api: {
|
|
304
375
|
setMode(t) {
|
|
305
376
|
x(t);
|
|
@@ -331,7 +402,7 @@ function it(r = {}) {
|
|
|
331
402
|
},
|
|
332
403
|
clear() {
|
|
333
404
|
if (e) {
|
|
334
|
-
|
|
405
|
+
h();
|
|
335
406
|
for (const t of d()) e.chart.removeAnnotation(t.id);
|
|
336
407
|
}
|
|
337
408
|
}
|
|
@@ -343,7 +414,7 @@ function it(r = {}) {
|
|
|
343
414
|
e = null;
|
|
344
415
|
},
|
|
345
416
|
onInteraction(t, o) {
|
|
346
|
-
if (
|
|
417
|
+
if (W(n.mode)) {
|
|
347
418
|
if (o.type === "mousedown") {
|
|
348
419
|
N(t, o);
|
|
349
420
|
return;
|
|
@@ -361,46 +432,49 @@ function it(r = {}) {
|
|
|
361
432
|
}
|
|
362
433
|
};
|
|
363
434
|
}
|
|
364
|
-
const
|
|
435
|
+
const ot = {
|
|
365
436
|
name: "velo-plot-replay",
|
|
366
437
|
version: "1.0.0",
|
|
367
438
|
description: "Bar-by-bar chart replay with speed control",
|
|
368
439
|
provides: ["replay"],
|
|
369
440
|
tags: ["replay", "trading"]
|
|
370
441
|
};
|
|
371
|
-
function
|
|
372
|
-
let e = null, s = null, n = 0, i = null,
|
|
373
|
-
const
|
|
374
|
-
function d(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
close: u(s.close)
|
|
442
|
+
function ft(r) {
|
|
443
|
+
let e = null, s = null, n = 0, i = null, c = 1;
|
|
444
|
+
const l = r.frameMs ?? 250;
|
|
445
|
+
function d(u) {
|
|
446
|
+
const x = e, y = s, k = Math.min(u + 1, y.x.length), b = (D) => D ? D.subarray(0, k) : void 0;
|
|
447
|
+
x.chart.updateSeries(r.seriesId, {
|
|
448
|
+
x: b(y.x),
|
|
449
|
+
y: b(y.y),
|
|
450
|
+
open: b(y.open),
|
|
451
|
+
high: b(y.high),
|
|
452
|
+
low: b(y.low),
|
|
453
|
+
close: b(y.close)
|
|
384
454
|
});
|
|
385
455
|
}
|
|
386
|
-
const
|
|
387
|
-
play(
|
|
388
|
-
s && (
|
|
456
|
+
const h = {
|
|
457
|
+
play(u = 1) {
|
|
458
|
+
s && (c = Math.max(0.1, u), i && clearInterval(i), i = setInterval(() => {
|
|
459
|
+
if (!e || !s) {
|
|
460
|
+
h.pause();
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
389
463
|
if (n >= s.x.length - 1) {
|
|
390
|
-
|
|
464
|
+
h.pause();
|
|
391
465
|
return;
|
|
392
466
|
}
|
|
393
467
|
n++, d(n);
|
|
394
|
-
},
|
|
468
|
+
}, l / c));
|
|
395
469
|
},
|
|
396
470
|
pause() {
|
|
397
471
|
i && (clearInterval(i), i = null);
|
|
398
472
|
},
|
|
399
|
-
step(
|
|
400
|
-
s && (n = Math.min(s.x.length - 1, n +
|
|
473
|
+
step(u = 1) {
|
|
474
|
+
s && (n = Math.min(s.x.length - 1, n + u), d(n));
|
|
401
475
|
},
|
|
402
|
-
seek(
|
|
403
|
-
s && (n = Math.max(0, Math.min(s.x.length - 1,
|
|
476
|
+
seek(u) {
|
|
477
|
+
s && (n = Math.max(0, Math.min(s.x.length - 1, u)), d(n));
|
|
404
478
|
},
|
|
405
479
|
getIndex() {
|
|
406
480
|
return n;
|
|
@@ -413,99 +487,35 @@ function lt(r) {
|
|
|
413
487
|
}
|
|
414
488
|
};
|
|
415
489
|
return {
|
|
416
|
-
manifest:
|
|
417
|
-
api:
|
|
418
|
-
onInit(
|
|
419
|
-
e =
|
|
490
|
+
manifest: ot,
|
|
491
|
+
api: h,
|
|
492
|
+
onInit(u) {
|
|
493
|
+
e = u;
|
|
420
494
|
const x = e.chart.getSeries(r.seriesId);
|
|
421
495
|
if (!x) {
|
|
422
496
|
console.warn(`[PluginReplay] Series "${r.seriesId}" not found`);
|
|
423
497
|
return;
|
|
424
498
|
}
|
|
425
|
-
const
|
|
499
|
+
const y = x.getData();
|
|
426
500
|
s = {
|
|
427
|
-
x: Float32Array.from(
|
|
428
|
-
y:
|
|
429
|
-
open:
|
|
430
|
-
high:
|
|
431
|
-
low:
|
|
432
|
-
close:
|
|
501
|
+
x: Float32Array.from(y.x),
|
|
502
|
+
y: y.y ? Float32Array.from(y.y) : void 0,
|
|
503
|
+
open: y.open ? Float32Array.from(y.open) : void 0,
|
|
504
|
+
high: y.high ? Float32Array.from(y.high) : void 0,
|
|
505
|
+
low: y.low ? Float32Array.from(y.low) : void 0,
|
|
506
|
+
close: y.close ? Float32Array.from(y.close) : void 0
|
|
433
507
|
}, n = Math.max(0, s.x.length - 1);
|
|
434
508
|
},
|
|
435
509
|
onDestroy() {
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
function ct(r) {
|
|
441
|
-
const e = r.length, s = new Float64Array(e), n = new Float32Array(e), i = new Float32Array(e), f = new Float32Array(e), m = new Float32Array(e), d = new Float32Array(e);
|
|
442
|
-
for (let c = 0; c < e; c++) {
|
|
443
|
-
const h = r[c];
|
|
444
|
-
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
|
-
}
|
|
446
|
-
return { x: s, open: n, high: i, low: f, close: m, volume: d };
|
|
447
|
-
}
|
|
448
|
-
function nt(r) {
|
|
449
|
-
let e = r;
|
|
450
|
-
return () => (e = e * 16807 % 2147483647, (e - 1) / 2147483646);
|
|
451
|
-
}
|
|
452
|
-
function ot(r, e, s, n, i) {
|
|
453
|
-
const f = [];
|
|
454
|
-
let m = n;
|
|
455
|
-
for (let d = r; d <= e; d += s) {
|
|
456
|
-
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
|
-
f.push({
|
|
458
|
-
time: d,
|
|
459
|
-
open: c,
|
|
460
|
-
high: u,
|
|
461
|
-
low: T,
|
|
462
|
-
close: x,
|
|
463
|
-
volume: 1e3 + i() * 5e3
|
|
464
|
-
}), m = x;
|
|
465
|
-
}
|
|
466
|
-
return f;
|
|
467
|
-
}
|
|
468
|
-
function ft(r = {}) {
|
|
469
|
-
const e = r.barMs ?? 6e4, s = r.basePrice ?? 100, n = nt(r.seed ?? 42), i = /* @__PURE__ */ new Map();
|
|
470
|
-
return {
|
|
471
|
-
async resolveSymbol(f) {
|
|
472
|
-
return {
|
|
473
|
-
symbol: f,
|
|
474
|
-
name: f,
|
|
475
|
-
description: `Mock symbol ${f}`,
|
|
476
|
-
timezone: "UTC",
|
|
477
|
-
session: "24x7",
|
|
478
|
-
pricescale: 100
|
|
479
|
-
};
|
|
480
|
-
},
|
|
481
|
-
async getBars(f) {
|
|
482
|
-
const m = `${f.symbol}:${f.from}:${f.to}`;
|
|
483
|
-
return i.has(m) || i.set(
|
|
484
|
-
m,
|
|
485
|
-
ot(f.from, f.to, e, s, n)
|
|
486
|
-
), i.get(m);
|
|
487
|
-
},
|
|
488
|
-
subscribeBars(f) {
|
|
489
|
-
let m = s + n() * 5;
|
|
490
|
-
const d = setInterval(() => {
|
|
491
|
-
const c = m, h = Math.max(1, c + (n() - 0.5) * 2), x = Math.max(c, h) + n(), u = Math.min(c, h) - n();
|
|
492
|
-
f.onBar({
|
|
493
|
-
time: Date.now(),
|
|
494
|
-
open: c,
|
|
495
|
-
high: x,
|
|
496
|
-
low: u,
|
|
497
|
-
close: h,
|
|
498
|
-
volume: 1e3 + n() * 3e3
|
|
499
|
-
}), m = h;
|
|
500
|
-
}, e);
|
|
501
|
-
return () => clearInterval(d);
|
|
510
|
+
h.pause(), e = null, s = null;
|
|
502
511
|
}
|
|
503
512
|
};
|
|
504
513
|
}
|
|
505
514
|
export {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
515
|
+
ht as P,
|
|
516
|
+
ft as a,
|
|
517
|
+
lt as b,
|
|
518
|
+
it as c,
|
|
519
|
+
ct as d
|
|
510
520
|
};
|
|
511
|
-
//# sourceMappingURL=
|
|
521
|
+
//# sourceMappingURL=index-Cv6ZDLWf.js.map
|