@backtest-kit/ui 13.2.0 → 13.3.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 +254 -254
- package/build/index.cjs +16 -1
- package/build/index.mjs +16 -1
- package/build/modules/frontend/build/3rdparty/ace_1.4.12/ace.js +21337 -21337
- package/build/modules/frontend/build/3rdparty/ace_1.4.12/mode-javascript.js +797 -797
- package/build/modules/frontend/build/3rdparty/ace_1.4.12/theme-chrome.js +137 -137
- package/build/modules/frontend/build/3rdparty/ace_1.4.12/theme-twilight.js +115 -115
- package/build/modules/frontend/build/3rdparty/ace_1.4.12/worker-javascript.js +15012 -15012
- package/build/modules/frontend/build/3rdparty/qfchart_0.8.7/echarts.min.js +45 -45
- package/build/modules/frontend/build/assets/{Article-CcCiTpSc.js → Article-sbYRbQe0.js} +1 -1
- package/build/modules/frontend/build/assets/{Background-DMirKacq.js → Background-dyHMipOI.js} +1 -1
- package/build/modules/frontend/build/assets/{IconPhoto-BxDqzGvT.js → IconPhoto-CHqApvRw.js} +1 -1
- package/build/modules/frontend/build/assets/{KeyboardArrowLeft-Dko7SALS.js → KeyboardArrowLeft-CHOMu6qx.js} +1 -1
- package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-Dmg5gexr.js → PictureAsPdfOutlined-DzknxeSi.js} +1 -1
- package/build/modules/frontend/build/assets/{Refresh-CBda8h_u.js → Refresh-DmSh3yQM.js} +1 -1
- package/build/modules/frontend/build/assets/emitters-BNMcCjB_.js +1 -0
- package/build/modules/frontend/build/assets/{hasRouteMatch-BSKJnbXT.js → hasRouteMatch-DqwdOTLY.js} +1 -1
- package/build/modules/frontend/build/assets/{html2canvas-DksZ0g2p.js → html2canvas-CHKh6bmw.js} +1 -1
- package/build/modules/frontend/build/assets/{index-B4z69zXs.js → index-0MseBgyH.js} +8 -8
- package/build/modules/frontend/build/assets/{index-CeAm-0jJ.js → index-9MTo_fXC.js} +1 -1
- package/build/modules/frontend/build/assets/{index-C9jW4IvD.js → index-BGUfC2GH.js} +1 -1
- package/build/modules/frontend/build/assets/index-BkciU9PY.js +1 -0
- package/build/modules/frontend/build/assets/{index-BfM_1muQ.js → index-Bm2KpX4M.js} +1 -1
- package/build/modules/frontend/build/assets/{index-DqktEUrK.js → index-COEOSThW.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CAviDo-e.js → index-C_bLqeg4.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CnaffmZK.js → index-CkS6tnju.js} +1 -1
- package/build/modules/frontend/build/assets/{index-6eAhZo78.js → index-DUb1EyrG.js} +1 -1
- package/build/modules/frontend/build/assets/{index-kU3NMO0i.js → index-DYoETulh.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CJGWLPLp.js → index-Dq8WsVMT.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CikHR8SM.js → index-DrklJPOF.js} +1 -1
- package/build/modules/frontend/build/assets/index-DtlxmULa.js +1 -0
- package/build/modules/frontend/build/assets/{index.es-Q_57HRa4.js → index.es-Bnd2KFus.js} +2 -2
- package/build/modules/frontend/build/assets/{markdownit-BiE4Ht5c.js → markdownit-CWkrj-EI.js} +1 -1
- package/build/modules/frontend/build/index.html +87 -87
- package/build/modules/frontend/build/manifest.json +23 -23
- package/package.json +118 -118
- package/build/modules/frontend/build/assets/emitters-DfGc10Om.js +0 -1
- package/build/modules/frontend/build/assets/index-CGJADttI.js +0 -1
- package/build/modules/frontend/build/assets/index-D3OaZoyW.js +0 -1
package/build/modules/frontend/build/assets/{markdownit-BiE4Ht5c.js → markdownit-CWkrj-EI.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bM as e,bN as t}from"./index-0MseBgyH.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as m};
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="ru" translate="no">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<title>BacktestKit</title>
|
|
6
|
-
<meta
|
|
7
|
-
name="viewport"
|
|
8
|
-
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, minimal-ui"
|
|
9
|
-
/>
|
|
10
|
-
<link rel="stylesheet" href="/3rdparty/typeface-roboto_0.0.75/typeface-roboto.css" />
|
|
11
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
12
|
-
<meta name="apple-mobile-web-app-title" content="BacktestKit" />
|
|
13
|
-
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
14
|
-
<meta name="mobile-web-app-capable" content="yes" />
|
|
15
|
-
<script src="/3rdparty/ace_1.4.12/ace.js"></script>
|
|
16
|
-
<script src="/3rdparty/ace_1.4.12/mode-javascript.js"></script>
|
|
17
|
-
<script src="/3rdparty/ace_1.4.12/theme-twilight.js"></script>
|
|
18
|
-
<script src="/3rdparty/ace_1.4.12/theme-chrome.js"></script>
|
|
19
|
-
<script src="/3rdparty/ace_1.4.12/worker-javascript.js"></script>
|
|
20
|
-
<script src="/3rdparty/qfchart_0.8.7/echarts.min.js"></script>
|
|
21
|
-
<script src="/3rdparty/qfchart_0.8.7/qfchart.js"></script>
|
|
22
|
-
<script src="/3rdparty/qfchart_0.8.7/pinets.js"></script>
|
|
23
|
-
<link
|
|
24
|
-
rel="apple-touch-icon"
|
|
25
|
-
sizes="512x512"
|
|
26
|
-
href="/logo/icon512_maskable.png"
|
|
27
|
-
/>
|
|
28
|
-
<link
|
|
29
|
-
rel="icon"
|
|
30
|
-
type="image/png"
|
|
31
|
-
sizes="512x512"
|
|
32
|
-
href="/logo/icon512_maskable.png"
|
|
33
|
-
/>
|
|
34
|
-
<link rel="manifest" href="/manifest.json" />
|
|
35
|
-
<link
|
|
36
|
-
rel="prefetch"
|
|
37
|
-
href="/images/cubes.png"
|
|
38
|
-
as="image"
|
|
39
|
-
type="image/png"
|
|
40
|
-
/>
|
|
41
|
-
<link
|
|
42
|
-
rel="prefetch"
|
|
43
|
-
href="/images/snow.png"
|
|
44
|
-
as="image"
|
|
45
|
-
type="image/png"
|
|
46
|
-
/>
|
|
47
|
-
<link
|
|
48
|
-
rel="prefetch"
|
|
49
|
-
href="/images/square.png"
|
|
50
|
-
as="image"
|
|
51
|
-
type="image/png"
|
|
52
|
-
/>
|
|
53
|
-
<link
|
|
54
|
-
rel="prefetch"
|
|
55
|
-
href="/images/triangle.png"
|
|
56
|
-
as="image"
|
|
57
|
-
type="image/png"
|
|
58
|
-
/>
|
|
59
|
-
<link
|
|
60
|
-
rel="prefetch"
|
|
61
|
-
href="/images/dots.png"
|
|
62
|
-
as="image"
|
|
63
|
-
type="image/png"
|
|
64
|
-
/>
|
|
65
|
-
<link
|
|
66
|
-
rel="prefetch"
|
|
67
|
-
href="/logo/icon512_maskable.png"
|
|
68
|
-
as="image/png"
|
|
69
|
-
/>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="ru" translate="no">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>BacktestKit</title>
|
|
6
|
+
<meta
|
|
7
|
+
name="viewport"
|
|
8
|
+
content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, minimal-ui"
|
|
9
|
+
/>
|
|
10
|
+
<link rel="stylesheet" href="/3rdparty/typeface-roboto_0.0.75/typeface-roboto.css" />
|
|
11
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
12
|
+
<meta name="apple-mobile-web-app-title" content="BacktestKit" />
|
|
13
|
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
14
|
+
<meta name="mobile-web-app-capable" content="yes" />
|
|
15
|
+
<script src="/3rdparty/ace_1.4.12/ace.js"></script>
|
|
16
|
+
<script src="/3rdparty/ace_1.4.12/mode-javascript.js"></script>
|
|
17
|
+
<script src="/3rdparty/ace_1.4.12/theme-twilight.js"></script>
|
|
18
|
+
<script src="/3rdparty/ace_1.4.12/theme-chrome.js"></script>
|
|
19
|
+
<script src="/3rdparty/ace_1.4.12/worker-javascript.js"></script>
|
|
20
|
+
<script src="/3rdparty/qfchart_0.8.7/echarts.min.js"></script>
|
|
21
|
+
<script src="/3rdparty/qfchart_0.8.7/qfchart.js"></script>
|
|
22
|
+
<script src="/3rdparty/qfchart_0.8.7/pinets.js"></script>
|
|
23
|
+
<link
|
|
24
|
+
rel="apple-touch-icon"
|
|
25
|
+
sizes="512x512"
|
|
26
|
+
href="/logo/icon512_maskable.png"
|
|
27
|
+
/>
|
|
28
|
+
<link
|
|
29
|
+
rel="icon"
|
|
30
|
+
type="image/png"
|
|
31
|
+
sizes="512x512"
|
|
32
|
+
href="/logo/icon512_maskable.png"
|
|
33
|
+
/>
|
|
34
|
+
<link rel="manifest" href="/manifest.json" />
|
|
35
|
+
<link
|
|
36
|
+
rel="prefetch"
|
|
37
|
+
href="/images/cubes.png"
|
|
38
|
+
as="image"
|
|
39
|
+
type="image/png"
|
|
40
|
+
/>
|
|
41
|
+
<link
|
|
42
|
+
rel="prefetch"
|
|
43
|
+
href="/images/snow.png"
|
|
44
|
+
as="image"
|
|
45
|
+
type="image/png"
|
|
46
|
+
/>
|
|
47
|
+
<link
|
|
48
|
+
rel="prefetch"
|
|
49
|
+
href="/images/square.png"
|
|
50
|
+
as="image"
|
|
51
|
+
type="image/png"
|
|
52
|
+
/>
|
|
53
|
+
<link
|
|
54
|
+
rel="prefetch"
|
|
55
|
+
href="/images/triangle.png"
|
|
56
|
+
as="image"
|
|
57
|
+
type="image/png"
|
|
58
|
+
/>
|
|
59
|
+
<link
|
|
60
|
+
rel="prefetch"
|
|
61
|
+
href="/images/dots.png"
|
|
62
|
+
as="image"
|
|
63
|
+
type="image/png"
|
|
64
|
+
/>
|
|
65
|
+
<link
|
|
66
|
+
rel="prefetch"
|
|
67
|
+
href="/logo/icon512_maskable.png"
|
|
68
|
+
as="image/png"
|
|
69
|
+
/>
|
|
70
70
|
<style>
|
|
71
71
|
html,
|
|
72
72
|
body {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
scrollbar-width: none;
|
|
79
79
|
background: #eee !important;
|
|
80
80
|
}
|
|
81
|
-
</style>
|
|
81
|
+
</style>
|
|
82
82
|
<style>
|
|
83
83
|
.loader_wraper {
|
|
84
84
|
display: flex;
|
|
@@ -143,21 +143,21 @@
|
|
|
143
143
|
* {
|
|
144
144
|
font-family: "Roboto", sans-serif !important;
|
|
145
145
|
}
|
|
146
|
-
</style>
|
|
147
|
-
<link
|
|
148
|
-
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
149
|
-
rel="stylesheet"
|
|
150
|
-
/>
|
|
151
|
-
<script type="module" crossorigin src="/assets/index-
|
|
146
|
+
</style>
|
|
147
|
+
<link
|
|
148
|
+
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
|
|
149
|
+
rel="stylesheet"
|
|
150
|
+
/>
|
|
151
|
+
<script type="module" crossorigin src="/assets/index-0MseBgyH.js"></script>
|
|
152
152
|
<link rel="stylesheet" crossorigin href="/assets/index-DrRm3Jka.css">
|
|
153
|
-
</head>
|
|
154
|
-
|
|
155
|
-
<body>
|
|
156
|
-
<div id="root">
|
|
157
|
-
<div class="loader_wraper">
|
|
158
|
-
<div class="loader"></div>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
162
|
-
</body>
|
|
163
|
-
</html>
|
|
153
|
+
</head>
|
|
154
|
+
|
|
155
|
+
<body>
|
|
156
|
+
<div id="root">
|
|
157
|
+
<div class="loader_wraper">
|
|
158
|
+
<div class="loader"></div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
162
|
+
</body>
|
|
163
|
+
</html>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "BacktestKit",
|
|
3
|
-
"theme_color": "#6974b0",
|
|
4
|
-
"background_color": "#6974b0",
|
|
5
|
-
"icons": [
|
|
6
|
-
{
|
|
7
|
-
"purpose": "maskable",
|
|
8
|
-
"sizes": "512x512",
|
|
9
|
-
"src": "/logo/icon512_maskable.png",
|
|
10
|
-
"type": "image/png"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"purpose": "any",
|
|
14
|
-
"sizes": "512x512",
|
|
15
|
-
"src": "/logo/icon512_rounded.png",
|
|
16
|
-
"type": "image/png"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"orientation": "any",
|
|
20
|
-
"display": "standalone",
|
|
21
|
-
"dir": "ltr",
|
|
22
|
-
"lang": "ru-RU"
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "BacktestKit",
|
|
3
|
+
"theme_color": "#6974b0",
|
|
4
|
+
"background_color": "#6974b0",
|
|
5
|
+
"icons": [
|
|
6
|
+
{
|
|
7
|
+
"purpose": "maskable",
|
|
8
|
+
"sizes": "512x512",
|
|
9
|
+
"src": "/logo/icon512_maskable.png",
|
|
10
|
+
"type": "image/png"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"purpose": "any",
|
|
14
|
+
"sizes": "512x512",
|
|
15
|
+
"src": "/logo/icon512_rounded.png",
|
|
16
|
+
"type": "image/png"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"orientation": "any",
|
|
20
|
+
"display": "standalone",
|
|
21
|
+
"dir": "ltr",
|
|
22
|
+
"lang": "ru-RU"
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@backtest-kit/ui",
|
|
3
|
-
"version": "13.
|
|
4
|
-
"description": "Full-stack UI framework for visualizing cryptocurrency trading signals, backtests, and real-time market data. React dashboard with candlestick charts, signal tracking, and risk analysis.",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Petr Tripolsky",
|
|
7
|
-
"email": "tripolskypetr@gmail.com",
|
|
8
|
-
"url": "https://github.com/tripolskypetr"
|
|
9
|
-
},
|
|
10
|
-
"funding": {
|
|
11
|
-
"type": "individual",
|
|
12
|
-
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
-
},
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"homepage": "https://backtest-kit.github.io/documents/article_07_ai_news_trading_signals.html",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"backtest",
|
|
18
|
-
"backtesting",
|
|
19
|
-
"trading",
|
|
20
|
-
"crypto",
|
|
21
|
-
"cryptocurrency",
|
|
22
|
-
"bitcoin",
|
|
23
|
-
"ethereum",
|
|
24
|
-
"dashboard",
|
|
25
|
-
"ui",
|
|
26
|
-
"react",
|
|
27
|
-
"material-ui",
|
|
28
|
-
"mui",
|
|
29
|
-
"charts",
|
|
30
|
-
"candlestick",
|
|
31
|
-
"lightweight-charts",
|
|
32
|
-
"signals",
|
|
33
|
-
"trading-signals",
|
|
34
|
-
"risk-management",
|
|
35
|
-
"ccxt",
|
|
36
|
-
"binance",
|
|
37
|
-
"exchange",
|
|
38
|
-
"visualization",
|
|
39
|
-
"trading-bot",
|
|
40
|
-
"algo-trading",
|
|
41
|
-
"algorithmic-trading",
|
|
42
|
-
"quantitative-trading"
|
|
43
|
-
],
|
|
44
|
-
"files": [
|
|
45
|
-
"build",
|
|
46
|
-
"types.d.ts",
|
|
47
|
-
"README.md"
|
|
48
|
-
],
|
|
49
|
-
"repository": {
|
|
50
|
-
"type": "git",
|
|
51
|
-
"url": "https://github.com/tripolskypetr/backtest-kit",
|
|
52
|
-
"documentation": "https://github.com/tripolskypetr/backtest-kit/tree/master/docs"
|
|
53
|
-
},
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/tripolskypetr/backtest-kit/issues"
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"start": "npm run build && cross-env NODE_ENV=development CC_ENABLE_MOCK=1 npm run serve",
|
|
59
|
-
"serve": "node ./scripts/mock.mjs",
|
|
60
|
-
"build:modules": "npm run build:modules:win",
|
|
61
|
-
"build:modules:win": "dotenv -e .env -- .\\scripts\\win\\build.bat && npm run build:copy && npm run build:postbuild",
|
|
62
|
-
"build:modules:x": "dotenv -e .env -- sh ./scripts/linux/build.sh && npm run build:copy && npm run build:postbuild",
|
|
63
|
-
"build:copy": "node ./scripts/copy.mjs",
|
|
64
|
-
"build:postbuild": "node ./scripts/postbuild.mjs",
|
|
65
|
-
"build": "rollup -c"
|
|
66
|
-
},
|
|
67
|
-
"main": "build/index.cjs",
|
|
68
|
-
"module": "build/index.mjs",
|
|
69
|
-
"source": "src/index.ts",
|
|
70
|
-
"types": "./types.d.ts",
|
|
71
|
-
"exports": {
|
|
72
|
-
"require": "./build/index.cjs",
|
|
73
|
-
"types": "./types.d.ts",
|
|
74
|
-
"import": "./build/index.mjs",
|
|
75
|
-
"default": "./build/index.cjs"
|
|
76
|
-
},
|
|
77
|
-
"devDependencies": {
|
|
78
|
-
"@rollup/plugin-typescript": "11.1.6",
|
|
79
|
-
"@rollup/plugin-terser": "0.4.4",
|
|
80
|
-
"@types/finalhandler": "1.2.3",
|
|
81
|
-
"@types/serve-handler": "6.1.4",
|
|
82
|
-
"cross-env": "7.0.3",
|
|
83
|
-
"@types/node": "22.9.0",
|
|
84
|
-
"glob": "11.0.1",
|
|
85
|
-
"rimraf": "6.0.1",
|
|
86
|
-
"rollup": "3.29.5",
|
|
87
|
-
"rollup-plugin-dts": "6.1.1",
|
|
88
|
-
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
89
|
-
"ts-morph": "27.0.2",
|
|
90
|
-
"tslib": "2.7.0",
|
|
91
|
-
"typedoc": "0.27.9",
|
|
92
|
-
"ccxt": "4.5.24",
|
|
93
|
-
"touch": "3.1.1",
|
|
94
|
-
"worker-testbed": "2.0.0",
|
|
95
|
-
"backtest-kit": "13.
|
|
96
|
-
"markdown-it": "14.1.0"
|
|
97
|
-
},
|
|
98
|
-
"peerDependencies": {
|
|
99
|
-
"backtest-kit": "^13.
|
|
100
|
-
"markdown-it": "^14.1.0",
|
|
101
|
-
"ccxt": "^4.5.24",
|
|
102
|
-
"typescript": "^5.0.0"
|
|
103
|
-
},
|
|
104
|
-
"dependencies": {
|
|
105
|
-
"di-kit": "^1.1.1",
|
|
106
|
-
"di-scoped": "^1.0.21",
|
|
107
|
-
"functools-kit": "^2.3.0",
|
|
108
|
-
"get-moment-stamp": "^2.0.0",
|
|
109
|
-
"finalhandler": "^1.3.1",
|
|
110
|
-
"serve-handler": "^6.1.6",
|
|
111
|
-
"cryptocurrency-icons": "^0.18.1",
|
|
112
|
-
"router": "^1.3.8",
|
|
113
|
-
"micro": "^10.0.1"
|
|
114
|
-
},
|
|
115
|
-
"publishConfig": {
|
|
116
|
-
"access": "public"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@backtest-kit/ui",
|
|
3
|
+
"version": "13.3.0",
|
|
4
|
+
"description": "Full-stack UI framework for visualizing cryptocurrency trading signals, backtests, and real-time market data. React dashboard with candlestick charts, signal tracking, and risk analysis.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Petr Tripolsky",
|
|
7
|
+
"email": "tripolskypetr@gmail.com",
|
|
8
|
+
"url": "https://github.com/tripolskypetr"
|
|
9
|
+
},
|
|
10
|
+
"funding": {
|
|
11
|
+
"type": "individual",
|
|
12
|
+
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://backtest-kit.github.io/documents/article_07_ai_news_trading_signals.html",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"backtest",
|
|
18
|
+
"backtesting",
|
|
19
|
+
"trading",
|
|
20
|
+
"crypto",
|
|
21
|
+
"cryptocurrency",
|
|
22
|
+
"bitcoin",
|
|
23
|
+
"ethereum",
|
|
24
|
+
"dashboard",
|
|
25
|
+
"ui",
|
|
26
|
+
"react",
|
|
27
|
+
"material-ui",
|
|
28
|
+
"mui",
|
|
29
|
+
"charts",
|
|
30
|
+
"candlestick",
|
|
31
|
+
"lightweight-charts",
|
|
32
|
+
"signals",
|
|
33
|
+
"trading-signals",
|
|
34
|
+
"risk-management",
|
|
35
|
+
"ccxt",
|
|
36
|
+
"binance",
|
|
37
|
+
"exchange",
|
|
38
|
+
"visualization",
|
|
39
|
+
"trading-bot",
|
|
40
|
+
"algo-trading",
|
|
41
|
+
"algorithmic-trading",
|
|
42
|
+
"quantitative-trading"
|
|
43
|
+
],
|
|
44
|
+
"files": [
|
|
45
|
+
"build",
|
|
46
|
+
"types.d.ts",
|
|
47
|
+
"README.md"
|
|
48
|
+
],
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/tripolskypetr/backtest-kit",
|
|
52
|
+
"documentation": "https://github.com/tripolskypetr/backtest-kit/tree/master/docs"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/tripolskypetr/backtest-kit/issues"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"start": "npm run build && cross-env NODE_ENV=development CC_ENABLE_MOCK=1 npm run serve",
|
|
59
|
+
"serve": "node ./scripts/mock.mjs",
|
|
60
|
+
"build:modules": "npm run build:modules:win",
|
|
61
|
+
"build:modules:win": "dotenv -e .env -- .\\scripts\\win\\build.bat && npm run build:copy && npm run build:postbuild",
|
|
62
|
+
"build:modules:x": "dotenv -e .env -- sh ./scripts/linux/build.sh && npm run build:copy && npm run build:postbuild",
|
|
63
|
+
"build:copy": "node ./scripts/copy.mjs",
|
|
64
|
+
"build:postbuild": "node ./scripts/postbuild.mjs",
|
|
65
|
+
"build": "rollup -c"
|
|
66
|
+
},
|
|
67
|
+
"main": "build/index.cjs",
|
|
68
|
+
"module": "build/index.mjs",
|
|
69
|
+
"source": "src/index.ts",
|
|
70
|
+
"types": "./types.d.ts",
|
|
71
|
+
"exports": {
|
|
72
|
+
"require": "./build/index.cjs",
|
|
73
|
+
"types": "./types.d.ts",
|
|
74
|
+
"import": "./build/index.mjs",
|
|
75
|
+
"default": "./build/index.cjs"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
79
|
+
"@rollup/plugin-terser": "0.4.4",
|
|
80
|
+
"@types/finalhandler": "1.2.3",
|
|
81
|
+
"@types/serve-handler": "6.1.4",
|
|
82
|
+
"cross-env": "7.0.3",
|
|
83
|
+
"@types/node": "22.9.0",
|
|
84
|
+
"glob": "11.0.1",
|
|
85
|
+
"rimraf": "6.0.1",
|
|
86
|
+
"rollup": "3.29.5",
|
|
87
|
+
"rollup-plugin-dts": "6.1.1",
|
|
88
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
89
|
+
"ts-morph": "27.0.2",
|
|
90
|
+
"tslib": "2.7.0",
|
|
91
|
+
"typedoc": "0.27.9",
|
|
92
|
+
"ccxt": "4.5.24",
|
|
93
|
+
"touch": "3.1.1",
|
|
94
|
+
"worker-testbed": "2.0.0",
|
|
95
|
+
"backtest-kit": "13.3.0",
|
|
96
|
+
"markdown-it": "14.1.0"
|
|
97
|
+
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"backtest-kit": "^13.3.0",
|
|
100
|
+
"markdown-it": "^14.1.0",
|
|
101
|
+
"ccxt": "^4.5.24",
|
|
102
|
+
"typescript": "^5.0.0"
|
|
103
|
+
},
|
|
104
|
+
"dependencies": {
|
|
105
|
+
"di-kit": "^1.1.1",
|
|
106
|
+
"di-scoped": "^1.0.21",
|
|
107
|
+
"functools-kit": "^2.3.0",
|
|
108
|
+
"get-moment-stamp": "^2.0.0",
|
|
109
|
+
"finalhandler": "^1.3.1",
|
|
110
|
+
"serve-handler": "^6.1.6",
|
|
111
|
+
"cryptocurrency-icons": "^0.18.1",
|
|
112
|
+
"router": "^1.3.8",
|
|
113
|
+
"micro": "^10.0.1"
|
|
114
|
+
},
|
|
115
|
+
"publishConfig": {
|
|
116
|
+
"access": "public"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a8 as o}from"./index-B4z69zXs.js";const r=new o;export{r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as x,T as y,aq as v,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as F,I as R,at as z,F as $,au as N,av as D}from"./index-B4z69zXs.js";import{R as O,C as T}from"./Refresh-CBda8h_u.js";import{K as j}from"./KeyboardArrowLeft-Dko7SALS.js";import{I as C}from"./IconPhoto-BxDqzGvT.js";import{B as W}from"./Background-DMirKacq.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),A=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),V=new o,E=[{type:t.Link,action:"back-action",label:a(j,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"}],H=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:B,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:A,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:O,color:"#4caf50"})}],I=()=>a(n,{items:E,actions:H,onAction:V.next});const M=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:N}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),D=d(i),O=d(e);p(()=>V.subscribe(e=>{if("update-now"===e&&N(),"download-action"===e){const e=new Blob([JSON.stringify(D.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${O.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${O.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),j=e=>{const o=T[e]||[];return o.length?a($,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(b,{primary:a(x,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(y,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:P("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",o.length-n]}),a(y,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===t.position?"#1976D2":"#F57C00",color:"white"},children:"long"===t.position?"LONG":"SHORT"}),a(y,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),F(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceOpen),"$"]})]}),a(y,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),F(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceTakeProfit),"$"]})]}),a(y,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),F(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(y,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),F(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(y,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:t.pnl.pnlPercentage>=0?P("#4caf50",.15):P("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",F(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(y,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(y,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(y,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?P("#4caf50",.2):"scheduled"===t.status?P("#ff9800",.2):"closed"===t.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(y,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(i=t.createdAt,new Date(i).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a(R,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(u,{children:a(b,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[T],children:async()=>{const o=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",s=(null==(n=T[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(x,{sx:{position:"relative",paddingRight:"8px"},children:a(C,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(x,{flex:1}),a(y,{variant:"body2",sx:{fontWeight:"medium"},children:v(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(x,{sx:{marginTop:"16px",marginBottom:"16px"},children:j(e)})]})},`section-${e}`);var l}):a(u,{children:a(b,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=D(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:M,isActive:e=>J(["/backtest"],e)},{id:"live",element:M,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(T,{children:[a(N,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:I,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(W,{})]})};export{X as OverviewPage,X as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,a as t,r as o,u as a,_ as i,d as n,f as r,e as l,k as s,s as c,P as p,b as d,Q as m,x as y,i as u,O as g,R as h,p as b,a2 as f,Z as v,T as x,b2 as C,W as w,B as S,F as N,a3 as P,E as k,A as L,a5 as A,l as M,n as T,a4 as $,a6 as B,ai as R,b3 as V,b4 as F,w as E,X as z,a8 as I,b5 as O,D,b6 as j,b7 as H,ag as W,V as G,N as q,a1 as _,b8 as U,ad as Y,b9 as Q,ba as J,bb as K,J as X,bc as Z,aX as ee,ah as te,bd as oe,aQ as ae,aO as ie,a$ as ne,be as re,bf as le,bg as se,I as ce,av as pe,al as de,bh as me,aj as ye}from"./index-B4z69zXs.js";import{h as ue}from"./hasRouteMatch-BSKJnbXT.js";import{I as ge}from"./IconPhoto-BxDqzGvT.js";import{C as he,R as be}from"./Refresh-CBda8h_u.js";import{K as fe}from"./KeyboardArrowLeft-Dko7SALS.js";import{B as ve}from"./Background-DMirKacq.js";import{r as xe}from"./emitters-DfGc10Om.js";function Ce(t){return e("MuiCard",t)}t("MuiCard",["root"]);const we=["className","raised"],Se=c(p,{name:"MuiCard",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({overflow:"hidden"})),Ne=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCard"}),{className:c,raised:p=!1}=o,d=i(o,we),m=n({},o,{raised:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},Ce,t)})(m);return r(Se,n({className:l(y.root,c),elevation:p?8:void 0,ref:t,ownerState:m},d))});function Pe(t){return e("MuiCardContent",t)}t("MuiCardContent",["root"]);const ke=["className","component"],Le=c("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}})),Ae=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCardContent"}),{className:c,component:p="div"}=o,d=i(o,ke),m=n({},o,{component:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},Pe,t)})(m);return r(Le,n({as:p,className:l(y.root,c),ownerState:m,ref:t},d))}),Me=d(r("path",{d:"M18.21 9.21C15.93 10.78 13.45 13.3 13 17h2v2H9v-2h2c-.5-4.5-4.37-8-9-8V7c4.39 0 8.22 2.55 10 6.3 1.13-2.43 2.99-4.25 4.78-5.52L14 5h7v7l-2.79-2.79z"}),"AirlineStops"),Te=d(r("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckCircle"),$e=d(r("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}),"CloseOutlined"),Be=d(r("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5l-8-3zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25v4.7z"}),"ShieldOutlined"),Re=d(r("path",{d:"m16 6 2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6h-6z"}),"TrendingUpOutlined"),Ve=d(r("path",{d:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-10 7H8v3H6v-3H3v-2h3V8h2v3h3v2zm4.5 2c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4-3c-.83 0-1.5-.67-1.5-1.5S18.67 9 19.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"VideogameAsset"),Fe="backtest-kit__groupHeader",Ee="backtest-kit__groupRoot",ze="backtest-kit__symbolImage",Ie=b()({root:{[`& .${Ee}:hover .${Fe}`]:{opacity:"1 !important"}}});function Oe(e){return B(e,"#000000")>B(e,"#FFFFFF")}const De=[{type:h.Link,action:"back-action",label:r(fe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Main"},{type:h.Link,action:"back-action",label:"Status"}],je=[{action:"update-now",label:"Refresh",icon:()=>r(v,{icon:be,color:"#4caf50"})}],He=(e,t)=>({type:f.Group,className:Ee,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:f.Component,className:Fe,style:{transition:"opacity 500ms",opacity:.5},element:()=>r(L,{direction:"row",children:[r(P,{variant:"outlined",size:"small",color:"info",label:`${k.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),r(S,{flex:1})]})},{type:f.Group,fields:t.map(({symbol:e,label:t,to:o,color:a})=>((e,t,o,a)=>({type:f.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>r($,{component:A,onClick:()=>{u.routerService.push(`/status/${t}`)},sx:{width:"100%",background:a,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ze}`]:{transition:"filter 500ms"},"&:hover":{background:()=>Oe(a)?M(a,.33):T(a,.33),[`& .${ze}`]:{transition:"filter 500ms",filter:Oe(a)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:r(ge,{className:ze,symbol:e}),children:r(S,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(e,o,t,a))}]}),We=[{type:h.Link,action:"back-action",label:r(fe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Main"},{type:h.Link,action:"back-action",label:"Status"},{type:h.Link,action:"back-action",compute:e=>e?`${String(e.symbol).toUpperCase()} (${e.strategyName})`:"Live"},{type:h.Button,action:"control-action",label:"Manual Control",icon:Ve},{type:h.Fab,action:"print-action",label:"Print",icon:O}],Ge=[{action:"print-action",label:"Print",icon:()=>r(v,{icon:O,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>r(v,{icon:D,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>r(v,{icon:be,color:"#4caf50"})}],qe=new I,_e=new I,Ue=new I,Ye=new I,Qe=new I,Je=_.createLoader(12),Ke=({payload:e})=>r(S,{sx:{mb:1,minHeight:48},children:r(H,{sx:{height:"100%",minHeight:48},hideOverflowY:!0,children:r(L,{direction:"row",gap:1,sx:{pointerEvents:"all"},children:[r(W,{startIcon:r(Me,{}),onClick:async()=>await _e.next(),color:"success",sx:{whiteSpace:"nowrap"},children:"Open Position"}),r(W,{startIcon:r(Re,{}),onClick:async()=>await Ue.next(),color:"warning",sx:{whiteSpace:"nowrap"},children:"Commit Averaging"}),r(W,{startIcon:r(Be,{}),onClick:async()=>await Qe.next(),sx:{whiteSpace:"nowrap"},children:"Commit Breakeven"}),r(S,{flex:1}),r(G,{Loader:Je,deps:[e.symbol,e.exchangeName,e.strategyName],reloadSubject:xe,children:async()=>{const t=await u.controlViewService.getAveragePrice(e.symbol,{exchangeName:e.exchangeName,strategyName:e.strategyName}),o=Number(t);return r(x,{height:"100%",display:"flex",alignItems:"center",whiteSpace:"nowrap",mr:1,children:["Avg price ",e.symbol,":",k.nbsp,r("b",{children:`${o.toFixed(q(o))}$`})]})}}),r(W,{startIcon:r($e,{}),onClick:async()=>await Ye.next(),sx:{whiteSpace:"nowrap"},color:"error",children:"Close Position"})]})})}),Xe=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Open Position"},{type:f.Outline,fields:[{type:f.Combo,name:"position",title:"Direction",placeholder:"Select direction",itemList:["long","short"],validation:{required:!0},defaultValue:"long"},{type:f.Text,name:"cost",inputPattern:"[0-9]*",inputMode:"numeric",inputType:"tel",trailingIcon:Y,trailingIconClick:(e,{},{},t)=>{t("")},validation:{required:!0},title:"Amount USDT",placeholder:"00000",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9]/,defaultValue:"100"},{type:f.Text,outlined:!0,name:"quantity",sx:{cursor:"not-allowed","& *":{cursor:"not-allowed"}},title:"Coin Quantity",placeholder:"0.00",compute:(e,t)=>{const o=parseFloat(e.cost||"0"),a=parseFloat(t.averagePrice||"0");return o&&a?(o/a).toFixed(6):"0"},inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/,readonly:!0},{type:f.Text,name:"note",title:"Note",placeholder:"Reason for opening the position"}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} After pressing the Next button, the position will be opened IMMEDIATELY`}]}}],Ze=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Open Position"},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:"Symbol"},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${X(e.averagePrice)}$`,title:"Coin Price",placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} Carefully verify that this is the coin you want to open a position on. Rely on the symbol AND THE PRICE`}]}}],et=({type:e,title:t,description:o,amount:a,price:i,symbol:n})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:r(Te,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:r(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:r(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:r(ne,{}),chipColor:"default"};return r(Ne,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:r(Ae,{sx:{p:3},children:[r(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[r(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),r(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),n&&r(P,{label:n,size:"small",color:s.chipColor,variant:"outlined",icon:r(ee,{})})]}),o&&r(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&r(S,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:te(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${te(s.color,.1)}`},children:[a&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Amount"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Price"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},tt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:n})=>{const l=U([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>n(!0),onLoadEnd:()=>n(!1)});return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!!s,labelPrev:"Close",onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:r(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:Ze}):null})},isActive:e=>!!re("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[n,l]=o.useState(e),s=U([e],50);return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{n&&(i({position:n.position,cost:n.cost,note:n.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:r(w,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:Q,fields:Xe,sx:{pt:1}})})},isActive:e=>!!re("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const{position:n,cost:l,note:s,symbol:c}=o.useMemo(()=>{const{position:t,cost:o,note:a,symbol:i}=e.data.form;return{position:t,cost:o,note:a,symbol:i}},[e]),[p,{error:d,loading:m}]=y(async()=>{const e=t.getContext();return await u.controlViewService.commitOpenPending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{position:n,cost:parseFloat(l||"0"),note:s||""}),!0},{onLoadStart:()=>i(!0),onLoadEnd:()=>i(!1)});return r(K,{Navigation:r(J,{hasNext:p||!!d,labelNext:"Close",onNext:async()=>{await a()}}),children:r(S,{p:1,children:r(et,d?{type:"error",title:"Position Opening Error",description:"An error occurred while opening the position",amount:`${X(parseFloat(l||"0"))}$`,symbol:c}:m||!p?{type:"loading",title:"Opening Position",description:"Please wait. Your operation is being processed...",amount:`${X(parseFloat(l||"0"))}$`,symbol:c}:{type:"success",title:"Position Opened",description:"Congratulations! The position was opened successfully",amount:`${X(parseFloat(l||"0"))}$`,symbol:c})})})},isActive:e=>!!re("/submit",e)}],ot=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Opening"}],at="/brief",it=pe(),nt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Average Position"},{type:f.Outline,fields:[{type:f.Text,name:"cost",inputPattern:"[0-9]*",inputMode:"numeric",inputType:"tel",trailingIcon:Y,trailingIconClick:(e,{},{},t)=>{t("")},validation:{required:!0},title:"Amount USDT",placeholder:"00000",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9]/,defaultValue:"100"},{type:f.Text,outlined:!0,name:"quantity",sx:{cursor:"not-allowed","& *":{cursor:"not-allowed"}},title:"Coin Quantity",placeholder:"0.00",compute:(e,t)=>{const o=parseFloat(e.cost||"0"),a=parseFloat(t.averagePrice||"0");return o&&a?(o/a).toFixed(6):"0"},inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/,readonly:!0},{type:f.Text,name:"note",title:"Note",placeholder:"Reason for averaging the position"}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} After pressing the Next button, the averaging will be performed IMMEDIATELY`}]}}],rt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Average Position"},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:"Symbol"},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${X(e.averagePrice)}$`,title:"Coin Price",placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} Carefully verify that this is the coin you want to average the position on. Rely on the symbol AND THE PRICE`}]}}],lt=({type:e,title:t,description:o,amount:a,price:i,symbol:n})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:r(Te,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:r(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:r(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:r(ne,{}),chipColor:"default"};return r(Ne,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:r(Ae,{sx:{p:3},children:[r(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[r(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),r(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),n&&r(P,{label:n,size:"small",color:s.chipColor,variant:"outlined",icon:r(ee,{})})]}),o&&r(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&r(S,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:te(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${te(s.color,.1)}`},children:[a&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Amount"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Price"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},st=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:n})=>{const l=U([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>n(!0),onLoadEnd:()=>n(!1)});return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!!s,labelPrev:"Close",onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:r(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:rt}):null})},isActive:e=>!!re("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[n,l]=o.useState(e),s=U([e],50);return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{n&&(i({cost:n.cost,note:n.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:r(w,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:Q,fields:nt,sx:{pt:1}})})},isActive:e=>!!re("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const{cost:n,note:l,symbol:s}=o.useMemo(()=>{const{cost:t,note:o,symbol:a}=e.data.form;return{cost:t,note:o,symbol:a}},[e]),[c,{error:p,loading:d}]=y(async()=>{const e=t.getContext();return await u.controlViewService.commitAverageBuy(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{cost:parseFloat(n||"0"),note:l||""}),!0},{onLoadStart:()=>i(!0),onLoadEnd:()=>i(!1)});return r(K,{Navigation:r(J,{hasNext:c||!!p,labelNext:"Close",onNext:async()=>{await a()}}),children:r(S,{p:1,children:r(lt,p?{type:"error",title:"Averaging Error",description:"An error occurred while averaging the position",amount:`${X(parseFloat(n||"0"))}$`,symbol:s}:d||!c?{type:"loading",title:"Averaging Position",description:"Please wait. Your operation is being processed...",amount:`${X(parseFloat(n||"0"))}$`,symbol:s}:{type:"success",title:"Position Averaged",description:"Congratulations! The position was averaged successfully",amount:`${X(parseFloat(n||"0"))}$`,symbol:s})})})},isActive:e=>!!re("/submit",e)}],ct=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Averaging"}],pt="/brief",dt=pe(),mt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Close Position"},{type:f.Outline,fields:[{type:f.Text,name:"note",title:"Note",placeholder:"Reason for closing the position"}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} After pressing the Next button, the closing will be performed IMMEDIATELY`}]}}],yt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Close Position"},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:"Symbol"},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${X(e.averagePrice)}$`,title:"Coin Price",placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} Carefully verify that this is the coin you want to close the position on. Rely on the symbol AND THE PRICE`}]}}],ut=({type:e,title:t,description:o,amount:a,price:i,symbol:n})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:r(Te,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:r(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:r(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:r(ne,{}),chipColor:"default"};return r(Ne,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:r(Ae,{sx:{p:3},children:[r(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[r(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),r(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),n&&r(P,{label:n,size:"small",color:s.chipColor,variant:"outlined",icon:r(ee,{})})]}),o&&r(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&r(S,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:te(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${te(s.color,.1)}`},children:[a&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Amount"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Price"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},gt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:n})=>{const l=U([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>n(!0),onLoadEnd:()=>n(!1)});return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!!s,labelPrev:"Close",onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:r(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:yt}):null})},isActive:e=>!!re("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[n,l]=o.useState(e),s=U([e],50);return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{n&&(i({note:n.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:r(w,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:Q,fields:mt,sx:{pt:1}})})},isActive:e=>!!re("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const{note:n,symbol:l}=o.useMemo(()=>{const{note:t,symbol:o}=e.data.form;return{note:t,symbol:o}},[e]),[s,{error:c,loading:p}]=y(async()=>{const e=t.getContext();return await u.controlViewService.commitClosePending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{note:n||""}),!0},{onLoadStart:()=>i(!0),onLoadEnd:()=>i(!1)});return r(K,{Navigation:r(J,{hasNext:s||!!c,labelNext:"Close",onNext:async()=>{await a()}}),children:r(S,{p:1,children:r(ut,c?{type:"error",title:"Position Closing Error",description:"An error occurred while closing the position",symbol:l}:p||!s?{type:"loading",title:"Closing Position",description:"Please wait. Your operation is being processed...",symbol:l}:{type:"success",title:"Position Closed",description:"Congratulations! The position was closed successfully",symbol:l})})})},isActive:e=>!!re("/submit",e)}],ht=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Closing"}],bt="/brief",ft=pe(),vt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Move to Breakeven"},{type:f.Outline,fields:[{type:f.Typography,typoVariant:"body1",placeholder:"The stop-loss will be moved to the breakeven point of the current position. No additional input is required."}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} After pressing the Next button, the move to breakeven will be performed IMMEDIATELY`}]}}],xt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Move to Breakeven"},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:"Symbol"},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${X(e.averagePrice)}$`,title:"Coin Price",placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${k.bullet} Carefully verify that this is the coin whose stop you want to move to breakeven. Rely on the symbol AND THE PRICE`}]}}],Ct=({type:e,title:t,description:o,amount:a,price:i,symbol:n})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:r(Te,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:r(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:r(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:r(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:r(ne,{}),chipColor:"default"};return r(Ne,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:r(Ae,{sx:{p:3},children:[r(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[r(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),r(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),n&&r(P,{label:n,size:"small",color:s.chipColor,variant:"outlined",icon:r(ee,{})})]}),o&&r(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&r(S,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:te(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${te(s.color,.1)}`},children:[a&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Amount"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&r(S,{children:[r(x,{variant:"caption",color:"text.secondary",children:"Price"}),r(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},wt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:n})=>{const l=U([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>n(!0),onLoadEnd:()=>n(!1)});return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!!s,labelPrev:"Close",onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:r(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:xt}):null})},isActive:e=>!!re("/brief",e)},{id:"form",element:({data:e,history:t,formState:o,onChange:a})=>{const i=U([e],50);return r(K,{Navigation:r(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{a({symbol:o.data.brief.symbol}),await i(),t.replace("/submit")}}),children:r(w,{payload:()=>({averagePrice:o.data.brief.averagePrice}),slots:Q,fields:vt,sx:{pt:1}})})},isActive:e=>!!re("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const{symbol:n}=o.useMemo(()=>{const{symbol:t}=e.data.form;return{symbol:t}},[e]),[l,{error:s,loading:c}]=y(async()=>{const e=t.getContext();return await u.controlViewService.commitBreakeven(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),!0},{onLoadStart:()=>i(!0),onLoadEnd:()=>i(!1)});return r(K,{Navigation:r(J,{hasNext:l||!!s,labelNext:"Close",onNext:async()=>{await a()}}),children:r(S,{p:1,children:r(Ct,s?{type:"error",title:"Breakeven Error",description:"An error occurred while moving to breakeven",symbol:n}:c||!l?{type:"loading",title:"Moving to Breakeven",description:"Please wait. Your operation is being processed...",symbol:n}:{type:"success",title:"Breakeven Set",description:"Congratulations! The stop-loss was moved to breakeven",symbol:n})})})},isActive:e=>!!re("/submit",e)}],St=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Breakeven"}],Nt="/brief",Pt=pe(),kt=e=>"pnl"===e?"P&L":e,Lt=[{type:h.Link,action:"back-action",label:r(fe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Main"},{type:h.Link,action:"back-action",label:"Status"},{type:h.Link,action:"back-action",compute:e=>e?`${String(e.symbol).toUpperCase()} (${e.strategyName})`:"Live"},{type:h.Link,action:"back-action",label:"Manual Control"}],At=[{action:"download-action",label:"Download",icon:()=>r(v,{icon:D,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>r(v,{icon:be,color:"#4caf50"})}],Mt=[{id:"control",element:({params:e})=>{const[t]=y(async()=>{const t=await u.statusViewService.getStatusMap();return R.get(t,e.id,null)},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),[o,{loading:a,execute:i}]=y(async()=>t?await u.controlViewService.getStrategyStatus(t.symbol,{strategyName:t.strategyName,exchangeName:t.exchangeName}):null,{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]}),n=de(t),{pickData:l,render:s}=(({payload:e})=>{const{pickData:t,render:o}=le({history:it,animation:"none",title:"Open Position",AfterTitle:({onClose:e})=>r(L,{direction:"row",gap:1,children:r(ce,{size:"small",onClick:e,children:r(Y,{})})}),mapPayload:()=>e,pathname:at,sizeRequest:se,routes:tt,steps:ot,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{it.push(at),t()},render:o}})({payload:{getContext:()=>n.current,reloadSubject:xe}}),{pickData:c,render:d}=(({payload:e})=>{const{pickData:t,render:o}=le({history:dt,animation:"none",title:"Average Position",AfterTitle:({onClose:e})=>r(L,{direction:"row",gap:1,children:r(ce,{size:"small",onClick:e,children:r(Y,{})})}),mapPayload:()=>e,pathname:pt,sizeRequest:se,routes:st,steps:ct,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{dt.push(pt),t()},render:o}})({payload:{getContext:()=>n.current,reloadSubject:xe}}),{pickData:m,render:h}=(({payload:e})=>{const{pickData:t,render:o}=le({history:ft,animation:"none",title:"Close Position",AfterTitle:({onClose:e})=>r(L,{direction:"row",gap:1,children:r(ce,{size:"small",onClick:e,children:r(Y,{})})}),mapPayload:()=>e,pathname:bt,sizeRequest:se,routes:gt,steps:ht,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{ft.push(bt),t()},render:o}})({payload:{getContext:()=>n.current,reloadSubject:xe}}),{pickData:b,render:f}=(({payload:e})=>{const{pickData:t,render:o}=le({history:Pt,animation:"none",title:"Move to Breakeven",AfterTitle:({onClose:e})=>r(L,{direction:"row",gap:1,children:r(ce,{size:"small",onClick:e,children:r(Y,{})})}),mapPayload:()=>e,pathname:Nt,sizeRequest:se,routes:wt,steps:St,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{Pt.push(Nt),t()},render:o}})({payload:{getContext:()=>n.current,reloadSubject:xe}});z(xe.subscribe(i)),z(_e.subscribe(l)),z(Ue.subscribe(c)),z(Ye.subscribe(m)),z(Qe.subscribe(b));const v=V(async()=>{if(!o)return;const e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);u.layoutService.downloadFile(t,`manual_control_${Date.now()}.json`)});return r(he,{children:[r(g,{items:Lt,actions:At,payload:t,onAction:async t=>{"back-action"===t&&u.routerService.push(`/status/${e.id}`),"download-action"===t&&v(),"update-now"===t&&await xe.next()}}),o?a?null:r(me,{component:p,sx:{p:1,minHeight:"calc(100dvh - 175px)"},payload:t,formatSearch:kt,AfterSearch:Ke,data:o}):null,r(S,{sx:{paddingBottom:"24px"}}),r(ve,{}),s(),d(),h(),f()]})},isActive:e=>ue(["/status/:id/control"],e)},{id:"status",element:({params:e})=>{const[t]=y(async()=>{const t=await u.statusViewService.getStatusMap();return R.get(t,e.id,null)},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),[o,{loading:a,execute:i}]=y(async()=>await u.statusViewService.getStatusOne(e.id),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),n=V(async()=>{if(!o)return;const e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);u.layoutService.downloadFile(t,`status_${Date.now()}.json`)}),l=V(async()=>{if(!o)return;const e=u.markdownHelperService.buildMarkdownFromFields(F,o);await E(e)});z(()=>qe.subscribe(i));return r(he,{children:[r(g,{items:We,actions:Ge,payload:t,onAction:async t=>{"back-action"===t&&(async()=>{1!==(await u.statusViewService.getStatusList()).length?u.routerService.push("/status"):u.routerService.push("/")})(),"control-action"===t&&u.routerService.push(`/status/${e.id}/control`),"update-now"===t&&await qe.next(),"download-action"===t&&await n(),"print-action"===t&&await l()}}),a?r(C,{children:r(x,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o?r(N,{children:[r(w,{handler:o,fields:j}),r(S,{paddingBottom:"24px"})]}):r(C,{children:r(x,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),r(ve,{})]})},isActive:e=>ue(["/status/:id"],e)},{id:"main",element:()=>{const{classes:e}=Ie(),{reloadTrigger:t,doReload:o}=m();y(async()=>{const e=await u.statusViewService.getStatusList();if(1===e.length){const[{id:t}]=e;u.routerService.push(`/status/${t}`)}},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});const[a,{loading:i}]=y(async()=>await(async()=>{const[e,t]=await Promise.all([u.symbolGlobalService.getSymbolMap(),u.statusViewService.getStatusList()]);if(!t||0===t.length)return[{type:f.Typography,typoVariant:"h6",placeholder:"Listening for a pending signal...",sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};t.forEach(t=>{const a=e[t.symbol],i=t.strategyName;o[i]||(o[i]=[]),o[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",to:t.id})});const a=Object.entries(o).sort(([,e],[,t])=>t.length-e.length),i=[],n=[],r=[];return a.forEach(([e,t],o)=>{const a=He(e,t);o%2==0?i.push(a):n.push(a),r.push(a)}),[{type:f.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:i},{type:f.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:f.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:r}]})(),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});return r(he,{children:[r(g,{items:De,actions:je,onAction:e=>{"back-action"===e&&u.routerService.push("/"),"update-now"===e&&o()}}),i||!a?r(C,{children:r(x,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a.length?r(N,{children:[r(w,{className:e.root,fields:a},t),r(S,{paddingBottom:"24px"})]}):r(C,{children:r(x,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>ue(["/status"],e)}],Tt=({id:e})=>r(ye,{history:u.routerService,onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),routes:Mt,params:{id:e}});export{Tt as StatusPage,Tt as default};
|