@backtest-kit/ui 14.1.0 → 15.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.
Files changed (44) hide show
  1. package/README.md +273 -273
  2. package/build/index.cjs +28 -8
  3. package/build/index.mjs +28 -8
  4. package/build/modules/frontend/build/3rdparty/ace_1.4.12/ace.js +21337 -21337
  5. package/build/modules/frontend/build/3rdparty/ace_1.4.12/mode-javascript.js +797 -797
  6. package/build/modules/frontend/build/3rdparty/ace_1.4.12/theme-chrome.js +137 -137
  7. package/build/modules/frontend/build/3rdparty/ace_1.4.12/theme-twilight.js +115 -115
  8. package/build/modules/frontend/build/3rdparty/ace_1.4.12/worker-javascript.js +15012 -15012
  9. package/build/modules/frontend/build/3rdparty/qfchart_0.8.7/echarts.min.js +45 -45
  10. package/build/modules/frontend/build/assets/{Article-CpU7DBcT.js → Article-BbLUOulC.js} +1 -1
  11. package/build/modules/frontend/build/assets/{Background-DISIt7NA.js → Background-CDTP9p37.js} +1 -1
  12. package/build/modules/frontend/build/assets/{IconPhoto-Czod_jkW.js → IconPhoto-HzRJjN64.js} +1 -1
  13. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-BUZ_pXI5.js → KeyboardArrowLeft-CUCkEYvJ.js} +1 -1
  14. package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-BgifaQ0L.js → PictureAsPdfOutlined-C-gvxvB-.js} +1 -1
  15. package/build/modules/frontend/build/assets/{Refresh-3cixHjvW.js → Refresh-CaTTs-6v.js} +1 -1
  16. package/build/modules/frontend/build/assets/emitters-8dLQtS6C.js +1 -0
  17. package/build/modules/frontend/build/assets/{hasRouteMatch-CqJJG3sx.js → hasRouteMatch-SXqr3R6f.js} +1 -1
  18. package/build/modules/frontend/build/assets/{html2canvas-Ds2vwzb-.js → html2canvas-87cBQTS1.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-BMq2INDq.js → index-B0S0LDjw.js} +1 -1
  20. package/build/modules/frontend/build/assets/index-B7aH-J6E.js +1 -0
  21. package/build/modules/frontend/build/assets/index-BCnA_-zg.js +1 -0
  22. package/build/modules/frontend/build/assets/index-BPxBQtFc.js +1 -0
  23. package/build/modules/frontend/build/assets/{index-BI3k7b1T.js → index-BnHudNsk.js} +161 -67
  24. package/build/modules/frontend/build/assets/{index-C8oIDQdm.js → index-Bo3Xqg5b.js} +1 -1
  25. package/build/modules/frontend/build/assets/{index-CA19hrNH.js → index-C-BaXIVA.js} +1 -1
  26. package/build/modules/frontend/build/assets/{index-ruSh1u75.js → index-Cb6Ol44V.js} +1 -1
  27. package/build/modules/frontend/build/assets/index-Cd-Fw809.js +1 -0
  28. package/build/modules/frontend/build/assets/index-DC4vTBIw.js +1 -0
  29. package/build/modules/frontend/build/assets/index-HwaagyGP.js +1 -0
  30. package/build/modules/frontend/build/assets/{index-B1plXuf6.js → index-HyrIJdm0.js} +1 -1
  31. package/build/modules/frontend/build/assets/index-mYQFfqbM.js +1 -0
  32. package/build/modules/frontend/build/assets/{index.es-DPOJOdbj.js → index.es-B5F8LBE-.js} +1 -1
  33. package/build/modules/frontend/build/assets/{markdownit-C4X6Sysk.js → markdownit-BjYdF6dQ.js} +1 -1
  34. package/build/modules/frontend/build/index.html +87 -87
  35. package/build/modules/frontend/build/manifest.json +23 -23
  36. package/package.json +118 -118
  37. package/build/modules/frontend/build/assets/emitters-DmNf0ttF.js +0 -1
  38. package/build/modules/frontend/build/assets/index-BYiuApxW.js +0 -1
  39. package/build/modules/frontend/build/assets/index-BYnSX2YX.js +0 -1
  40. package/build/modules/frontend/build/assets/index-Cqt7co-7.js +0 -1
  41. package/build/modules/frontend/build/assets/index-DJ7B8Och.js +0 -1
  42. package/build/modules/frontend/build/assets/index-DwO4-4_F.js +0 -1
  43. package/build/modules/frontend/build/assets/index-VxkdhxAi.js +0 -1
  44. package/build/modules/frontend/build/assets/index-pxXO4P81.js +0 -1
@@ -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": "14.1.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.1.0",
95
- "backtest-kit": "14.1.0",
96
- "markdown-it": "14.1.0"
97
- },
98
- "peerDependencies": {
99
- "backtest-kit": "^14.1.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": "^3.0.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": "15.1.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": "3.0.0",
95
+ "backtest-kit": "15.1.0",
96
+ "markdown-it": "14.1.0"
97
+ },
98
+ "peerDependencies": {
99
+ "backtest-kit": "^15.1.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": "^4.0.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-BI3k7b1T.js";const r=new o;export{r};
@@ -1 +0,0 @@
1
- import{g as e,a as t,b as a,f as o,r,u as n,_ as i,d as s,I as l,C as c,e as d,j as p,k as h,s as v,P as m,l as u,n as g,T as f,o as y,B as w,M as $,t as x,p as b,q as S,D as z,F as C,v as P,i as L,w as M,Q as k,x as A,y as V,X as R,z as N,L as D,A as H,E as T,G as F,H as I,J as B,K as W,N as E,O,R as j,V as Y,W as J,Y as _,Z as G,$ as U,a0 as q,a1 as Z,a2 as K,a3 as Q,a4 as X,a5 as ee,a6 as te,a7 as ae}from"./index-BI3k7b1T.js";import{r as oe}from"./emitters-DmNf0ttF.js";import{C as re,R as ne}from"./Refresh-3cixHjvW.js";function ie(t){return e("MuiAlert",t)}const se=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),le=a(o("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),ce=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),de=a(o("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),pe=a(o("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),he=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],ve=v(m,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.variant],t[`${a.variant}${p(a.color||a.severity)}`]]}})(({theme:e,ownerState:t})=>{const a="light"===e.palette.mode?u:g,o="light"===e.palette.mode?g:u,r=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},r&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:o(e.palette[r].light,.9),[`& .${se.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${se.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${r}FilledColor`],backgroundColor:e.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[r].dark:e.palette[r].main,color:e.palette.getContrastText(e.palette[r].main)}))}),me=v("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ue=v("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ge=v("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),fe={success:o(le,{fontSize:"inherit"}),warning:o(ce,{fontSize:"inherit"}),error:o(de,{fontSize:"inherit"}),info:o(pe,{fontSize:"inherit"})},ye=r.forwardRef(function(e,t){var a,r,v,m,u,g;const f=n({props:e,name:"MuiAlert"}),{action:y,children:w,className:$,closeText:x="Close",color:b,components:S={},componentsProps:z={},icon:C,iconMapping:P=fe,onClose:L,role:M="alert",severity:k="success",slotProps:A={},slots:V={},variant:R="standard"}=f,N=i(f,he),D=s({},f,{color:b,severity:k,variant:R}),H=(e=>{const{variant:t,color:a,severity:o,classes:r}=e,n={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(n,ie,r)})(D),T=null!=(a=null!=(r=V.closeButton)?r:S.CloseButton)?a:l,F=null!=(v=null!=(m=V.closeIcon)?m:S.CloseIcon)?v:c,I=null!=(u=A.closeButton)?u:z.closeButton,B=null!=(g=A.closeIcon)?g:z.closeIcon;return o(ve,s({role:M,elevation:0,ownerState:D,className:d(H.root,$),ref:t},N,{children:[!1!==C?o(me,{ownerState:D,className:H.icon,children:C||P[k]||fe[k]}):null,o(ue,{ownerState:D,className:H.message,children:w}),null!=y?o(ge,{ownerState:D,className:H.action,children:y}):null,null==y&&L?o(ge,{ownerState:D,className:H.action,children:o(T,s({size:"small","aria-label":x,title:x,color:"inherit",onClick:L},I,{children:o(F,s({fontSize:"small"},B))}))}):null]}))}),we=a([o("path",{d:"M13 17c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h6V5H5v14h14v-2h-6z",opacity:".3"}),o("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.38-1-1.72zM20 9v6h-7V9h7zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2H5z"}),o("circle",{cx:"16",cy:"12",r:"1.5"})],"AccountBalanceWalletTwoTone"),$e=a([o("path",{d:"M8 6h8v6H8zm11 8H5c-.55 0-1 .45-1 1v3h16v-3c0-.55-.45-1-1-1zm-1 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z",opacity:".3"}),o("path",{d:"M19 12h-1V4H6v8H5c-1.66 0-3 1.34-3 3v5h20v-5c0-1.66-1.34-3-3-3zM8 6h8v6H8V6zm12 12H4v-3c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v3z"}),o("circle",{cx:"18",cy:"16",r:"1"})],"AdfScannerTwoTone"),xe=a([o("path",{d:"M9 4H7v2H5v12h2v2h2v-2h2V6H9V4zm0 12H7V8h2v8z"}),o("path",{d:"M7 8h2v8H7zm8 2h2v3h-2z",opacity:".3"}),o("path",{d:"M19 8h-2V4h-2v4h-2v7h2v5h2v-5h2V8zm-2 5h-2v-3h2v3z"})],"CandlestickChartTwoTone"),be=a([o("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm0 14.5c-.83 0-1.5-.67-1.5-1.5h3c0 .83-.67 1.5-1.5 1.5zm5-2.5H7v-2h1v-2.61C8 9.27 9.03 7.47 11 7v-.5c0-.57.43-1 1-1s1 .43 1 1V7c1.97.47 3 2.28 3 4.39V14h1v2z",opacity:".3"}),o("path",{d:"M12 18.5c.83 0 1.5-.67 1.5-1.5h-3c0 .83.67 1.5 1.5 1.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4-8.61c0-2.11-1.03-3.92-3-4.39v-.5c0-.57-.43-1-1-1s-1 .43-1 1V7c-1.97.47-3 2.27-3 4.39V14H7v2h10v-2h-1v-2.61zM14 14h-4v-3c0-1.1.9-2 2-2s2 .9 2 2v3z"})],"CircleNotificationsTwoTone"),Se=a(o("path",{d:"M21.5 14.98c-.02 0-.03 0-.05.01C21.2 13.3 19.76 12 18 12c-1.4 0-2.6.83-3.16 2.02C13.26 14.1 12 15.4 12 17c0 1.66 1.34 3 3 3l6.5-.02c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5zM10 4.26v2.09C7.67 7.18 6 9.39 6 12c0 1.77.78 3.34 2 4.44V14h2v6H4v-2h2.73C5.06 16.54 4 14.4 4 12c0-3.73 2.55-6.85 6-7.74zM20 6h-2.73c1.43 1.26 2.41 3.01 2.66 5h-2.02c-.23-1.36-.93-2.55-1.91-3.44V10h-2V4h6v2z"}),"CloudSync"),ze=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),Ce=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Pe=a([o("path",{d:"M14 4H6v16h12V8h-4V4zm2 7v4c0 2.21-1.79 4-4 4s-4-1.79-4-4V9.5C8 8.12 9.12 7 10.5 7S13 8.12 13 9.5V15h-2V9.5c0-.28-.22-.5-.5-.5s-.5.22-.5.5V15c0 1.1.9 2 2 2s2-.9 2-2v-4h2z",opacity:".3"}),o("path",{d:"M14 15c0 1.1-.9 2-2 2s-2-.9-2-2V9.5c0-.28.22-.5.5-.5s.5.22.5.5V15h2V9.5C13 8.12 11.88 7 10.5 7S8 8.12 8 9.5V15c0 2.21 1.79 4 4 4s4-1.79 4-4v-4h-2v4z"}),o("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h8v4h4v12z"})],"FilePresentTwoTone"),Le=a([o("path",{d:"M19 5H5v14h14V5zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z",opacity:".3"}),o("path",{d:"M3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2zm2 0h14v14H5V5zm2 5h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"})],"InsertChartTwoTone"),Me=a([o("path",{d:"M10 5h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z",opacity:".3"}),o("path",{d:"M16 11V3H8v6H2v12h20V11h-6zm-6-6h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z"})],"LeaderboardTwoTone"),ke=a(o(r.Fragment,{children:[o("path",{d:"M12 20c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8zM10 7.5l6 4.5-6 4.5v-9z",opacity:".3"}),o("path",{d:"M12 22c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm0-18c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8zm-2 3.5v9l6-4.5z"})]}),"PlayCircleFilledWhiteTwoTone"),Ae=a([o("path",{d:"M4 18h16V8H4v10zm8-3h6v2h-6v-2zm-5.91-4.59L7.5 9l4 4-4 4-1.41-1.41L8.67 13l-2.58-2.59z",opacity:".3"}),o("path",{d:"M12 15h6v2h-6z"}),o("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H4V8h16v10z"}),o("path",{d:"m7.5 17 4-4-4-4-1.41 1.41L8.67 13l-2.58 2.59z"})],"TerminalTwoTone"),Ve=b()(e=>({root:{marginTop:e.spacing(1),marginBottom:e.spacing(2),marginLeft:e.spacing(2),marginRight:e.spacing(3),background:"white",transition:"opacity 500ms","&:hover":{opacity:1},opacity:.35,cursor:"pointer"},open:{opacity:1},expandButton:{cursor:"pointer !important",marginLeft:e.spacing(1)},copyButton:{cursor:"pointer !important",marginRight:e.spacing(1)},downloadButton:{cursor:"pointer !important"}})),Re=(e,t="%")=>e?`${e.toFixed(2)}${t}`:"—",Ne=e=>e?`${e.toFixed(1)} min`:"—",De=e=>window.Translate?window.Translate.translateText(e):e,He=({data:e})=>{const{classes:t,cx:a}=Ve(),[n,i]=r.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:r,portfolioStdDev:n,portfolioSortinoRatio:i,portfolioCalmarRatio:s,portfolioRecoveryFactor:l,portfolioExpectancy:c,portfolioAvgPeakPnl:d,portfolioAvgFallPnl:p,portfolioPeakProfitPnl:h,portfolioMaxDrawdownPnl:v,portfolioAvgDuration:m,portfolioMedianPnl:u,portfolioAvgConsecutiveWinPnl:g,portfolioAvgConsecutiveLossPnl:f,portfolioAvgWinDuration:y,portfolioAvgLossDuration:w,portfolioAnnualizedSharpeRatio:$,portfolioCertaintyRatio:x,portfolioExpectedYearlyReturns:b,portfolioTradesPerYear:S,symbols:z,backtest:C}=e,P=De(C?"Backtest":"Live"),L=t.frameName?` / ${t.frameName}`:"",M=[`## ${P}: ${t.strategyName} / ${t.exchangeName}${L}`,"",`**${De("Total PNL")}:** ${Re(a)} `,`**Sharpe Ratio:** ${Re(o,"")} `,`**${De("Annualized Sharpe")}:** ${Re($,"")} `,`**${De("Certainty Ratio")}:** ${Re(x,"")} `,`**${De("Expected Yearly Returns")}:** ${Re(b)} `,`**${De("Trades Per Year")}:** ${null!==S?S.toFixed(1):"—"} `,`**${De("Total trades")}:** ${r} `,`**${De("Standard Deviation Per Trade")}:** ${Re(n)} `,`**${De("Sortino Ratio")}:** ${Re(i,"")} `,`**${De("Calmar Ratio")}:** ${Re(s,"")} `,`**${De("Recovery Factor Per Equity Drawdown")}:** ${Re(l,"")} `,`**${De("Expectancy")}:** ${Re(c)} `,`**${De("Median PNL")}:** ${Re(u)} `,`**${De("Avg Peak PNL")}:** ${Re(d)} `,`**${De("Avg Drawdown PNL")}:** ${Re(p)} `,`**${De("Peak Profit PNL")}:** ${Re(h)} `,`**${De("Max Drawdown PNL")}:** ${Re(v)} `,`**${De("Avg Duration")}:** ${Ne(m)} `,`**${De("Avg Win Duration")}:** ${Ne(y)} `,`**${De("Avg Loss Duration")}:** ${Ne(w)} `,`**${De("Avg Consecutive Win PNL")}:** ${Re(g)} `,`**${De("Avg Consecutive Loss PNL")}:** ${Re(f)}`,""];for(const k of z)M.push(`### ${k.symbol}`,"",`**PNL:** ${Re(k.totalPnl)} `,`**${De("Avg PNL")}:** ${Re(k.avgPnl)} `,`**${De("Median PNL")}:** ${Re(k.medianPnl)} `,`**Win Rate:** ${Re(k.winRate)} `,`**Profit Factor:** ${Re(k.profitFactor,"")} `,`**Max Drawdown:** ${Re(k.maxDrawdown)} `,`**Expectancy:** ${Re(k.expectancy)} `,`**Sharpe Ratio:** ${Re(k.sharpeRatio,"")} `,`**Annualized Sharpe:** ${Re(k.annualizedSharpeRatio,"")} `,`**Certainty Ratio:** ${Re(k.certaintyRatio,"")} `,`**Expected Yearly Returns:** ${Re(k.expectedYearlyReturns)} `,`**Trades Per Year:** ${null!==k.tradesPerYear?k.tradesPerYear.toFixed(1):"—"} `,`**Sortino Ratio:** ${Re(k.sortinoRatio,"")} `,`**Calmar Ratio:** ${Re(k.calmarRatio,"")} `,`**Recovery Factor Per Equity Drawdown:** ${Re(k.recoveryFactor,"")} `,`**Standard Deviation:** ${Re(k.stdDev)} `,`**Avg Win:** ${Re(k.avgWin)} `,`**Avg Loss:** ${Re(k.avgLoss)} `,`**Max Win Streak:** ${k.maxWinStreak} `,`**Max Loss Streak:** ${k.maxLossStreak} `,`**Avg Peak PNL:** ${Re(k.avgPeakPnl)} `,`**Avg Drawdown PNL:** ${Re(k.avgFallPnl)} `,`**Peak Profit PNL:** ${Re(k.peakProfitPnl)} `,`**Max Drawdown PNL:** ${Re(k.maxDrawdownPnl)} `,`**Avg Duration:** ${Ne(k.avgDuration)} `,`**Avg Win Duration:** ${Ne(k.avgWinDuration)} `,`**Avg Loss Duration:** ${Ne(k.avgLossDuration)} `,`**Avg Consecutive Win PNL:** ${Re(k.avgConsecutiveWinPnl)} `,`**Avg Consecutive Loss PNL:** ${Re(k.avgConsecutiveLossPnl)} `,`**${De("Trades")}:** ${k.totalTrades}`,"");return M.join("\n")})(e),c=()=>{i(!n)},d=async e=>{e.stopPropagation(),await M(s)},p=async e=>{e.stopPropagation(),await P(s)&&L.alertService.notify("Copied!")};return o(ye,{className:a(t.root,{[t.open]:n}),action:o(C,{children:[o(l,{className:t.copyButton,onClick:p,size:"small",children:o(S,{})}),o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(z,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(n?ze:Ce,{})})]}),onClick:c,variant:"outlined",severity:"info",children:o(f,{minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",width:"100%",children:[o(f,{variant:"body2",sx:{opacity:n?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?"Backtest":"Live",": ",e.context.strategyName]}),o(y,{in:n,timeout:"auto",unmountOnExit:!0,children:[o(w,{paddingBottom:"16px"}),o($,{content:s}),o(w,{paddingBottom:"32px"})]}),!n&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[x(s).slice(0,150),"..."]})]})})},Te="backtest-kit__groupHeader",Fe="backtest-kit__groupRoot",Ie="backtest-kit__symbolImage",Be=b()({root:{[`& .${Fe}:hover .${Te}`]:{opacity:"1 !important"}}});function We(e){return te(e,"#000000")>te(e,"#FFFFFF")}const Ee=[{type:j.Component,element:()=>{const{reloadTrigger:e,doReload:t}=k(15e3),[a,{execute:r}]=A(async()=>{L.runtimeViewService.getRuntimeInfo.clear();const e=V(L.runtimeViewService.getRuntimeInfo,{defaultValue:null});return await e()},{onLoadStart:()=>L.layoutService.setAppbarLoader(!0),onLoadEnd:()=>L.layoutService.setAppbarLoader(!1),deps:[e]});R(()=>oe.subscribe(r));return o(H,{direction:"row",alignItems:"center",children:[o(N,{"aria-label":"breadcrumb",children:[o(D,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:"Main"}),o(D,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:"Navigation"})]}),o(w,{flex:1}),(()=>{if(!a)return null;const{symbol:e,when:r,currentPrice:n,backtest:i}=a;return o(W,{placement:"bottom",description:i?"Backtest mode":"Live mode",children:o(H,{direction:"row",alignItems:"center",spacing:1,sx:{display:{xs:"none",sm:"flex"},cursor:"pointer",userSelect:"none"},onClick:()=>{L.runtimeViewService.getRuntimeInfo.clear(),t()},children:[o(l,{size:"small",children:o(Se,{})}),o(f,{variant:"body2",sx:{opacity:.5},children:["Symbol:",T.nbsp,o("b",{children:e})]}),o(F,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:["Time:",T.nbsp,o("b",{children:I(r).format("HH:mm DD MMM YYYY")})]}),o(F,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:["Price:",T.nbsp,o("b",{children:[B(n,E(n)),"$"]})]})]})})})(),o(w,{pr:1})]})}}],Oe=[{action:"download-json",label:"Download Heatmap JSON",icon:()=>o(G,{icon:_,color:"#4caf50"})},{action:"download-markdown",label:"Download Heatmap Markdown",icon:()=>o(G,{icon:U,color:"#4caf50"})},{action:"download-pdf",label:"Download Heatmap PDF",icon:()=>o(G,{icon:q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(G,{icon:ne,color:"#4caf50"})}],je=(e,t)=>({type:K.Group,className:Fe,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:K.Component,className:Te,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(H,{direction:"row",children:[o(Q,{variant:"outlined",size:"medium",color:"info",label:`${T.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(w,{flex:1})]})},{type:K.Group,fields:t.map(({label:e,description:t,to:a,color:r,icon:n})=>((e,t,a,r,n)=>({type:K.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(W,{description:a,children:o(X,{component:ee,onClick:()=>{L.routerService.push(e)},sx:{width:"100%",background:r,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ie}`]:{transition:"filter 500ms"},"&:hover":{background:()=>We(r)?u(r,.33):g(r,.33),[`& .${Ie}`]:{transition:"filter 500ms",filter:We(r)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:Ie}),children:t})})}))(a,e,t,r,n))}]}),Ye=[{label:"Portfolio Overview",description:ae.newline("Closed trading signals grouped by symbol for Backtest and Live modes","Each card shows position type, entry price, TP/SL levels, PNL amount and percent","Displays DCA entry count and partial close count where applicable","Supports JSON export and manual refresh of the signal list"),to:"/overview",color:"#0033AD",icon:we},{label:"PNL Performance",description:ae.newline("KPI dashboard with aggregated trading performance metrics per symbol","Shows daily trade counts, success rates, resolved/rejected breakdowns","Revenue analytics across today, yesterday, 7-day and 31-day windows","Toggle between Backtest and Live modes; supports JSON export"),to:"/dashboard",color:"#E6007A",icon:Le},{label:"System Logs",description:ae.newline("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log","Each entry shows topic, timestamp and raw JSON arguments in monospace","Filter by keyword or regex via search prompt","Supports full log export as JSON file"),to:"/logs",color:"#58BF00",icon:Ae}],Je=[{label:"Notifications",description:ae.newline("Event feed for all trading signals: opens, closes, schedules, errors","Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices","Infinite-scroll pagination; click any card to open a detailed modal","Supports manual refresh to pull the latest activity"),to:"/notifications",color:"#F7931A",icon:be},{label:"Pending Status",description:ae.newline("Live view of active trading signals grouped by strategy","Grid of strategy buttons; click to inspect individual signal state","Detail view shows entry, exit, effective price, DCA and partial counts","Supports per-signal JSON export and manual refresh"),to:"/status",color:"#6F42C1",icon:ke},{label:"Dump Explorer",description:ae.newline("Tree-structured file browser for backtest output and artifact files","Icons indicate file type: image, JSON, plain text or generic","Click any file to open a full-screen preview modal","Supports keyword search and manual refresh of the file tree"),to:"/dump",color:"#0090FF",icon:Pe}],_e=[{label:"Markdown Reports",description:ae.newline("Strategy performance reports rendered from markdown for Backtest and Live runs","Grid of strategy buttons grouped by type and sorted by signal volume","Download reports as markdown, PDF or raw JSON","Supports manual refresh to regenerate report content"),to:"/report",color:"#009688",icon:$e},{label:"Price Charts",description:ae.newline("Interactive candlestick charts powered by TradingView Lightweight Charts","Navigate by symbol then interval (1m, 15m, 1h) to view price history","Overlays active signal lines: entry, take profit (green) and stop loss (red)","Supports chart image export and signal detail inspection"),to:"/price_chart",color:"#1565C0",icon:xe},{label:"Heatmap",description:ae.newline("Color-coded performance heatmap across all tracked symbols","Cells show win rate, profit factor, Sharpe ratio and other key metrics","Download heatmap as JSON, markdown report or PDF","Supports manual refresh to recalculate aggregated statistics"),to:"/heat",color:"#8D6E63",icon:Me}],Ge=[je("Application",Ye),je("Live",Je),je("Other",_e)],Ue=()=>o(Z,{sx:{width:"100%",height:"75px"}}),qe=()=>{const{classes:e}=Be();return o(re,{children:[o(O,{items:Ee,actions:Oe,onAction:async e=>{"update-now"===e&&await(async()=>{L.statusViewService.getStatusInfo.clear(),oe.next()})(),"download-markdown"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);L.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport();await M(e)})(),"download-json"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);L.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),o(Y,{Loader:Ue,reloadSubject:oe,children:async()=>{const e=await L.statusViewService.getStatusInfo();return e?o(He,{data:e}):null}}),o(J,{className:e.root,fields:Ge,payload:()=>({history:history})}),o(w,{paddingBottom:"24px"})]})};export{qe as MainPage,qe as default};
@@ -1 +0,0 @@
1
- import{f as e,b7 as t,M as a,B as i,q as r,bj as o,i as n,bk as l,v as s,b3 as c,bl as d,Y as w,Z as p,$ as h,a0 as m,b0 as k,bm as g,aI as b,bn as v,av as y,bh as u,b5 as f,ad as S,A as x,bo as _,ax as D,w as V,Q as N,x as O,O as R,R as L,p as B,a2 as A,T as P,b2 as C,W as $,F as j,a3 as J,E as M,a5 as G,l as F,n as X,a4 as H,a6 as I,aj as E}from"./index-BI3k7b1T.js";import{h as z}from"./hasRouteMatch-CqJJG3sx.js";import{I as T}from"./IconPhoto-Czod_jkW.js";import{C as U,R as W}from"./Refresh-3cixHjvW.js";import{K as q}from"./KeyboardArrowLeft-BUZ_pXI5.js";const K=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Q=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Y=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Z=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,className:a,style:i,sx:r,disabled:t,options:Z,onAction:s})},te=y(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:y}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},y=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:K,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Y,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:y,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return I(e,"#000000")>I(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(q,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:W,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${M.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:r,type:o,color:n})=>((t,a,r,o,n)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:l})=>e(H,{component:G,onClick:()=>{l.handleOpen(t,a)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(n)?F(n,.33):X(n,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:r}),children:e(i,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(r,o,t,a,n))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(j,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(E,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
@@ -1 +0,0 @@
1
- import{r as e,f as a,P as i,B as r,A as n,a9 as t,T as o,H as c,a3 as s,aa as l,N as d,J as p,F as m,G as u,M as b,aO as v,aP as y,aQ as g,aR as h,ad as x,aS as k,aT as f,aU as $,aV as P,aW as w,aX as C,aY as S,i as _,aG as A,a8 as O,aH as N,O as E,R as D,aZ as L,a_ as F,Z as z}from"./index-BI3k7b1T.js";import{C as T,R as j}from"./Refresh-3cixHjvW.js";import{K as R}from"./KeyboardArrowLeft-BUZ_pXI5.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(C,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(x,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(P,{sx:i});case"breakeven.available":case"breakeven.commit":return a(w,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(f,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(h,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(y,{sx:i});case"error.critical":return a(g,{sx:i});default:return a(v,{sx:i})}},I=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;default:return l("Unknown")}},U=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},W=e=>"symbol"in e,M=e=>"position"in e,H=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,Y=e=>"pnlPercentage"in e,V=e=>"level"in e,G=e=>"percentToClose"in e,K=e=>"currentPrice"in e,Z=e=>"duration"in e,q=e=>"closeReason"in e,J=e=>"cancelReason"in e,Q=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),ee=e=>"message"in e,ae=e=>"rejectionNote"in e,ie=e=>"activePositionCount"in e,re=e=>"effectivePriceOpen"in e,ne=e=>"totalEntries"in e&&e.totalEntries>1,te=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),oe=e=>"totalPartials"in e&&e.totalPartials>0,ce=e=>"cost"in e,se=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,le=e=>"peakProfitPriceClose"in e,de=e=>"maxDrawdownPriceClose"in e,pe=e.forwardRef(({item:e,className:v,style:y,sx:g},h)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:v,style:y,ref:h,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":_.layoutService.pickRisk(e.id);break;case"signal.opened":_.layoutService.pickSignalOpened(e.id);break;case"signal.closed":_.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":_.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":_.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":_.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":_.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":_.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":_.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":_.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":_.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":_.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":_.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":_.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":_.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":_.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":_.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":_.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":_.layoutService.pickClosePending(e.id);break;case"signal.info":_.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...g},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:I(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:U(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),W(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),Y(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"PnL: "+(e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"),color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ie(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}$`:"N/A"}`,variant:"outlined"}),re(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):"N/A"}`,variant:"outlined",color:"warning"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):"N/A"}`,variant:"outlined"})]}),H(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[K(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):"N/A"]})]})]}),se(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}$`:"N/A"]})]})]}),le(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}$`:"N/A"]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}$`:"N/A"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(b,{content:e.note})})]}),ae(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),ee(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),me=[{action:"update-now",label:"Refresh manually",icon:()=>a(z,{icon:j,color:"#4caf50"})}],ue=[{type:D.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:D.Link,action:"back-action",label:"Main"},{type:D.Link,action:"back-action",label:"Notifications"}],be=new O,ve=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=A({handler:async(e,a)=>{const i=await _.notificationViewService.getList(),r=N(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>_.layoutService.setAppbarLoader(!0),onLoadEnd:()=>_.layoutService.setAppbarLoader(!1),reloadSubject:be});return a(T,{children:[a(E,{items:ue,actions:me,onAction:async e=>{"back-action"===e&&_.routerService.push("/"),"update-now"===e&&await be.next()}}),a(L,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:F,hasMore:i,children:e.map(e=>a(pe,{item:e,sx:{mb:1}},e.id))})]})};export{ve as NotificationPage,ve as default};
@@ -1 +0,0 @@
1
- import{g as e,a as t,r as o,u as a,_ as i,d as r,f as n,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,a5 as L,l as M,n as T,a4 as $,a6 as B,ai as R,b3 as F,b4 as V,w as z,X as I,a8 as E,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 re,be as ne,bf as le,bg as se,bh as ce,I as pe,av as de,al as me,bi as ye,aj as ue}from"./index-BI3k7b1T.js";import{h as ge}from"./hasRouteMatch-CqJJG3sx.js";import{I as he}from"./IconPhoto-Czod_jkW.js";import{C as be,R as fe}from"./Refresh-3cixHjvW.js";import{K as ve}from"./KeyboardArrowLeft-BUZ_pXI5.js";import{B as xe}from"./Background-DISIt7NA.js";import{r as Ce}from"./emitters-DmNf0ttF.js";function we(t){return e("MuiCard",t)}t("MuiCard",["root"]);const Se=["className","raised"],Ne=c(p,{name:"MuiCard",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({overflow:"hidden"})),Pe=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCard"}),{className:c,raised:p=!1}=o,d=i(o,Se),m=r({},o,{raised:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},we,t)})(m);return n(Ne,r({className:l(y.root,c),elevation:p?8:void 0,ref:t,ownerState:m},d))});function ke(t){return e("MuiCardContent",t)}t("MuiCardContent",["root"]);const Ae=["className","component"],Le=c("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}})),Me=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCardContent"}),{className:c,component:p="div"}=o,d=i(o,Ae),m=r({},o,{component:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},ke,t)})(m);return n(Le,r({as:p,className:l(y.root,c),ownerState:m,ref:t},d))}),Te=d(n("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"),$e=d(n("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"),Be=d(n("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"),Re=d(n("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"),Fe=d(n("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(n("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"),ze="backtest-kit__groupHeader",Ie="backtest-kit__groupRoot",Ee="backtest-kit__symbolImage",Oe=b()({root:{[`& .${Ie}:hover .${ze}`]:{opacity:"1 !important"}}});function De(e){return B(e,"#000000")>B(e,"#FFFFFF")}const je=[{type:h.Link,action:"back-action",label:n(ve,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Main"},{type:h.Link,action:"back-action",label:"Status"}],He=[{action:"update-now",label:"Refresh",icon:()=>n(v,{icon:fe,color:"#4caf50"})}],We=(e,t)=>({type:f.Group,className:Ie,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:f.Component,className:ze,style:{transition:"opacity 500ms",opacity:.5},element:()=>n(A,{direction:"row",children:[n(P,{variant:"outlined",size:"small",color:"info",label:`${k.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),n(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:()=>n($,{component:L,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",[`& .${Ee}`]:{transition:"filter 500ms"},"&:hover":{background:()=>De(a)?M(a,.33):T(a,.33),[`& .${Ee}`]:{transition:"filter 500ms",filter:De(a)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:n(he,{className:Ee,symbol:e}),children:n(S,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(e,o,t,a))}]}),Ge=[{type:h.Link,action:"back-action",label:n(ve,{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},{type:h.Fab,action:"update-now",label:"Refresh",icon:fe}],qe=[{action:"print-action",label:"Print",icon:()=>n(v,{icon:O,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>n(v,{icon:D,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>n(v,{icon:fe,color:"#4caf50"})}],_e=new E,Ue=new E,Ye=new E,Qe=new E,Je=new E,Ke=_.createLoader(12),Xe=({payload:e})=>n(S,{sx:{mb:1,minHeight:48},children:n(H,{sx:{height:"100%",minHeight:48},hideOverflowY:!0,children:n(A,{direction:"row",gap:1,sx:{pointerEvents:"all"},children:[n(W,{startIcon:n(Te,{}),onClick:async()=>await Ue.next(),color:"success",sx:{whiteSpace:"nowrap"},children:"Open Position"}),n(W,{startIcon:n(Fe,{}),onClick:async()=>await Ye.next(),color:"warning",sx:{whiteSpace:"nowrap"},children:"Commit Averaging"}),n(W,{startIcon:n(Re,{}),onClick:async()=>await Je.next(),sx:{whiteSpace:"nowrap"},children:"Commit Breakeven"}),n(S,{flex:1}),n(G,{Loader:Ke,deps:[e.symbol,e.exchangeName,e.strategyName],reloadSubject:Ce,children:async()=>{const t=await u.controlViewService.getAveragePrice(e.symbol,{exchangeName:e.exchangeName,strategyName:e.strategyName}),o=Number(t);return n(x,{height:"100%",display:"flex",alignItems:"center",whiteSpace:"nowrap",mr:1,children:["Avg price ",e.symbol,":",k.nbsp,n("b",{children:`${o.toFixed(q(o))}$`})]})}}),n(W,{startIcon:n(Be,{}),onClick:async()=>await Qe.next(),sx:{whiteSpace:"nowrap"},color:"error",children:"Close Position"})]})})}),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.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`}]}}],et=[{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`}]}}],tt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:n($e,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:n(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:n(re,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:n(re,{}),chipColor:"default"};return n(Pe,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(P,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(ee,{})})]}),o&&n(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(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&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Amount"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Price"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},ot={success:!1,loading:!0,error:""},at=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{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:()=>r(!0),onLoadEnd:()=>r(!1)});return n(K,{Navigation:n(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:n(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:et}):null})},isActive:e=>!!le("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=U([e],50);return n(K,{Navigation:n(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({position:r.position,cost:r.cost,note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(w,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:Q,fields:Ze,sx:{pt:1}})})},isActive:e=>!!le("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(ot),{position:s,cost:c,note:p,symbol:d}=o.useMemo(()=>{const{position:t,cost:o,note:a,symbol:i}=e.data.form;return{position:t,cost:o,note:a,symbol:i}},[e]);I(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitOpenPending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{position:s,cost:parseFloat(c||"0"),note:p||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:ne(e)})}finally{i(!1)}});return n(K,{Navigation:n(J,{hasNext:r.success||!!r.error,labelNext:"Close",onNext:async()=>{await a()}}),children:n(S,{p:1,children:r.error?n(tt,{type:"error",title:"Position Opening Error",description:r.error,amount:`${X(parseFloat(c||"0"))}$`,symbol:d}):r.loading?n(tt,{type:"loading",title:"Opening Position",description:"Please wait. Your operation is being processed...",amount:`${X(parseFloat(c||"0"))}$`,symbol:d}):n(tt,{type:"success",title:"Position Opened",description:"Position has been scheduled successfully. Waiting for the order to be executed on the exchange",amount:`${X(parseFloat(c||"0"))}$`,symbol:d})})})},isActive:e=>!!le("/submit",e)}],it=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Opening"}],rt="/brief",nt=de(),lt=[{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`}]}}],st=[{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`}]}}],ct=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:n($e,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:n(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:n(re,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:n(re,{}),chipColor:"default"};return n(Pe,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(P,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(ee,{})})]}),o&&n(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(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&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Amount"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Price"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},pt={success:!1,loading:!0,error:""},dt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{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:()=>r(!0),onLoadEnd:()=>r(!1)});return n(K,{Navigation:n(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:n(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:st}):null})},isActive:e=>!!le("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=U([e],50);return n(K,{Navigation:n(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({cost:r.cost,note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(w,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:Q,fields:lt,sx:{pt:1}})})},isActive:e=>!!le("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(pt),{cost:s,note:c,symbol:p}=o.useMemo(()=>{const{cost:t,note:o,symbol:a}=e.data.form;return{cost:t,note:o,symbol:a}},[e]);I(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitAverageBuy(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{cost:parseFloat(s||"0"),note:c||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:ne(e)})}finally{i(!1)}});return n(K,{Navigation:n(J,{hasNext:r.success||!!r.error,labelNext:"Close",onNext:async()=>{await a()}}),children:n(S,{p:1,children:r.error?n(ct,{type:"error",title:"Averaging Error",description:r.error,amount:`${X(parseFloat(s||"0"))}$`,symbol:p}):r.loading?n(ct,{type:"loading",title:"Averaging Position",description:"Please wait. Your operation is being processed...",amount:`${X(parseFloat(s||"0"))}$`,symbol:p}):n(ct,{type:"success",title:"Position Averaged",description:"Averaging has been scheduled successfully. Waiting for the order to be executed on the exchange",amount:`${X(parseFloat(s||"0"))}$`,symbol:p})})})},isActive:e=>!!le("/submit",e)}],mt=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Averaging"}],yt="/brief",ut=de(),gt=[{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`}]}}],ht=[{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`}]}}],bt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:n($e,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:n(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:n(re,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:n(re,{}),chipColor:"default"};return n(Pe,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(P,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(ee,{})})]}),o&&n(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(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&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Amount"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Price"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},ft={success:!1,loading:!0,error:""},vt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{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:()=>r(!0),onLoadEnd:()=>r(!1)});return n(K,{Navigation:n(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:n(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:ht}):null})},isActive:e=>!!le("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=U([e],50);return n(K,{Navigation:n(J,{hasPrev:!0,hasNext:!0,labelPrev:"Back",onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(w,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:Q,fields:gt,sx:{pt:1}})})},isActive:e=>!!le("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(ft),{note:s,symbol:c}=o.useMemo(()=>{const{note:t,symbol:o}=e.data.form;return{note:t,symbol:o}},[e]);I(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitClosePending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{note:s||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:ne(e)})}finally{i(!1)}});return n(K,{Navigation:n(J,{hasNext:r.success||!!r.error,labelNext:"Close",onNext:async()=>{await a()}}),children:n(S,{p:1,children:r.error?n(bt,{type:"error",title:"Position Closing Error",description:r.error,symbol:c}):r.loading?n(bt,{type:"loading",title:"Closing Position",description:"Please wait. Your operation is being processed...",symbol:c}):n(bt,{type:"success",title:"Position Closed",description:"Closing has been scheduled successfully. Waiting for the order to be executed on the exchange",symbol:c})})})},isActive:e=>!!le("/submit",e)}],xt=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Closing"}],Ct="/brief",wt=de(),St=[{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`}]}}],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:"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`}]}}],Pt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=Z(),s="loading"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(oe,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:te(l.palette.success.main,.1),icon:n($e,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:te(l.palette.error.main,.1),icon:n(ae,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:te(l.palette.warning.main,.1),icon:n(ie,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:te(l.palette.info.main,.1),icon:n(re,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:te(l.palette.grey[500],.1),icon:n(re,{}),chipColor:"default"};return n(Pe,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${te(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(S,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(S,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(x,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(P,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(ee,{})})]}),o&&n(x,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(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&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Amount"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(S,{children:[n(x,{variant:"caption",color:"text.secondary",children:"Price"}),n(x,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},kt={success:!1,loading:!0,error:""},At=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{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:()=>r(!0),onLoadEnd:()=>r(!1)});return n(K,{Navigation:n(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:n(w,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:Q,fields:Nt}):null})},isActive:e=>!!le("/brief",e)},{id:"form",element:({data:e,history:t,formState:o,onChange:a})=>{const i=U([e],50);return n(K,{Navigation:n(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:n(w,{payload:()=>({averagePrice:o.data.brief.averagePrice}),slots:Q,fields:St,sx:{pt:1}})})},isActive:e=>!!le("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(kt),{symbol:s}=o.useMemo(()=>{const{symbol:t}=e.data.form;return{symbol:t}},[e]);I(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitBreakeven(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:ne(e)})}finally{i(!1)}});return n(K,{Navigation:n(J,{hasNext:r.success||!!r.error,labelNext:"Close",onNext:async()=>{await a()}}),children:n(S,{p:1,children:r.error?n(Pt,{type:"error",title:"Breakeven Error",description:r.error,symbol:s}):r.loading?n(Pt,{type:"loading",title:"Moving to Breakeven",description:"Please wait. Your operation is being processed...",symbol:s}):n(Pt,{type:"success",title:"Breakeven Set",description:"Breakeven has been scheduled successfully. Waiting for the order to be executed on the exchange",symbol:s})})})},isActive:e=>!!le("/submit",e)}],Lt=[{id:"brief",label:"Briefing"},{id:"form",label:"Input"},{id:"submit",label:"Breakeven"}],Mt="/brief",Tt=de(),$t=e=>"pnl"===e?"P&L":e,Bt=[{type:h.Link,action:"back-action",label:n(ve,{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"},{type:h.Button,action:"update-now",label:"Refresh",icon:fe}],Rt=[{action:"download-action",label:"Download",icon:()=>n(v,{icon:D,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>n(v,{icon:fe,color:"#4caf50"})}],Ft=[{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]}),r=me(t),{pickData:l,render:s}=(({payload:e})=>{const{pickData:t,render:o}=se({history:nt,animation:"none",title:"Open Position",AfterTitle:({onClose:e})=>n(A,{direction:"row",gap:1,children:n(pe,{size:"small",onClick:e,children:n(Y,{})})}),mapPayload:()=>e,pathname:rt,sizeRequest:ce,routes:at,steps:it,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{nt.push(rt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:Ce}}),{pickData:c,render:d}=(({payload:e})=>{const{pickData:t,render:o}=se({history:ut,animation:"none",title:"Average Position",AfterTitle:({onClose:e})=>n(A,{direction:"row",gap:1,children:n(pe,{size:"small",onClick:e,children:n(Y,{})})}),mapPayload:()=>e,pathname:yt,sizeRequest:ce,routes:dt,steps:mt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{ut.push(yt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:Ce}}),{pickData:m,render:h}=(({payload:e})=>{const{pickData:t,render:o}=se({history:wt,animation:"none",title:"Close Position",AfterTitle:({onClose:e})=>n(A,{direction:"row",gap:1,children:n(pe,{size:"small",onClick:e,children:n(Y,{})})}),mapPayload:()=>e,pathname:Ct,sizeRequest:ce,routes:vt,steps:xt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{wt.push(Ct),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:Ce}}),{pickData:b,render:f}=(({payload:e})=>{const{pickData:t,render:o}=se({history:Tt,animation:"none",title:"Move to Breakeven",AfterTitle:({onClose:e})=>n(A,{direction:"row",gap:1,children:n(pe,{size:"small",onClick:e,children:n(Y,{})})}),mapPayload:()=>e,pathname:Mt,sizeRequest:ce,routes:At,steps:Lt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{Tt.push(Mt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:Ce}});I(Ce.subscribe(i)),I(Ue.subscribe(l)),I(Ye.subscribe(c)),I(Qe.subscribe(m)),I(Je.subscribe(b));const v=F(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 n(be,{children:[n(g,{items:Bt,actions:Rt,payload:t,onAction:async t=>{"back-action"===t&&u.routerService.push(`/status/${e.id}`),"download-action"===t&&v(),"update-now"===t&&await Ce.next()}}),o?a?null:n(ye,{component:p,withExpandAll:!0,sx:{p:1,minHeight:"calc(100dvh - 175px)"},payload:t,formatSearch:$t,AfterSearch:Xe,data:o}):null,n(S,{sx:{paddingBottom:"24px"}}),n(xe,{}),s(),d(),h(),f()]})},isActive:e=>ge(["/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]}),r=F(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=F(async()=>{if(!o)return;const e=u.markdownHelperService.buildMarkdownFromFields(V,o);await z(e)});I(()=>_e.subscribe(i));return n(be,{children:[n(g,{items:Ge,actions:qe,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 _e.next(),"download-action"===t&&await r(),"print-action"===t&&await l()}}),a?n(C,{children:n(x,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o?n(N,{children:[n(w,{handler:o,fields:j}),n(S,{paddingBottom:"24px"})]}):n(C,{children:n(x,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),n(xe,{})]})},isActive:e=>ge(["/status/:id"],e)},{id:"main",element:()=>{const{classes:e}=Oe(),{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=[],r=[],n=[];return a.forEach(([e,t],o)=>{const a=We(e,t);o%2==0?i.push(a):r.push(a),n.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:r},{type:f.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:n}]})(),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});return n(be,{children:[n(g,{items:je,actions:He,onAction:e=>{"back-action"===e&&u.routerService.push("/"),"update-now"===e&&o()}}),i||!a?n(C,{children:n(x,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a.length?n(N,{children:[n(w,{className:e.root,fields:a},t),n(S,{paddingBottom:"24px"})]}):n(C,{children:n(x,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>ge(["/status"],e)}],Vt=({id:e})=>n(ue,{history:u.routerService,onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),routes:Ft,params:{id:e}});export{Vt as StatusPage,Vt as default};
@@ -1 +0,0 @@
1
- import{b as e,f as o,Q as t,x as i,i as a,O as n,R as l,p as s,a2 as r,Z as c,T as p,b2 as d,W as m,B as u,F as h,a3 as b,E as y,A as f,a5 as g,l as k,n as v,a4 as C,a6 as S,r as x,aD as L,bz as w,bA as P,bB as T,bC as V,bD as $,bE as H,H as z,J as M,N,al as O,X as A,bk as _,a$ as E,G as I,P as F,a1 as R,az as j,bF as G,a8 as D,aI as W,aJ as B,b3 as U,ag as Y,I as J,ad as K,D as Q,aj as X}from"./index-BI3k7b1T.js";import{h as Z}from"./hasRouteMatch-CqJJG3sx.js";import{I as q}from"./IconPhoto-Czod_jkW.js";import{C as ee,R as oe}from"./Refresh-3cixHjvW.js";import{K as te}from"./KeyboardArrowLeft-BUZ_pXI5.js";const ie=e([o("path",{d:"M5 19h14V5H5v14zm4-4h4v-2h-2v-2h2V9H9V7h4c1.1 0 2 .89 2 2v1.5c0 .83-.67 1.5-1.5 1.5.83 0 1.5.67 1.5 1.5V15c0 1.11-.9 2-2 2H9v-2z",opacity:".3"}),o("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})],"Looks3TwoTone"),ae=e([o("path",{d:"M19 5H5v14h14V5zm-5 12h-2V9h-2V7h4v10z",opacity:".3"}),o("path",{d:"M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm5 4h2v8h2V7h-4z"})],"LooksOneTwoTone"),ne=e([o("path",{d:"M19 5H5v14h14V5zm-4 6c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2v2z",opacity:".3"}),o("path",{d:"M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm8 2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2z"})],"LooksTwoTwoTone"),le="backtest-kit__groupHeader",se="backtest-kit__groupRoot",re="backtest-kit__symbolImage",ce=s()({root:{[`& .${se}:hover .${le}`]:{opacity:"1 !important"}}});function pe(e){return S(e,"#000000")>S(e,"#FFFFFF")}const de=[{type:l.Link,action:"back-action",label:o(te,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"}],me=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:oe,color:"#4caf50"})}],ue=(e,t)=>({type:r.Group,className:se,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:le,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(f,{direction:"row",children:[o(b,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:t.map(({symbol:e,label:t,color:i})=>((e,t,i)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(C,{component:g,onClick:()=>{a.routerService.push(`/price_chart/${e.toLowerCase()}`)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${re}`]:{transition:"filter 500ms"},"&:hover":{background:()=>pe(i)?k(i,.33):v(i,.33),[`& .${re}`]:{transition:"filter 500ms",filter:pe(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(q,{className:re,symbol:e}),children:o(u,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:t})})}))(e,t,i))}]}),he="backtest-kit__groupHeader",be="backtest-kit__groupRoot",ye="backtest-kit__symbolImage",fe=s()({root:{[`& .${be}:hover .${he}`]:{opacity:"1 !important"}}});function ge(e){return S(e,"#000000")>S(e,"#FFFFFF")}const ke=[{type:l.Link,action:"back-action",label:o(te,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"},{type:l.Link,action:"back-action",compute:e=>String(e).toUpperCase()}],ve=(e,t)=>({type:r.Group,className:be,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:r.Component,className:he,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(f,{direction:"row",children:[o(b,{variant:"outlined",size:"medium",color:"info",label:`${y.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:t.map(({label:e,to:t,color:i,icon:n})=>((e,t,i,n)=>({type:r.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(C,{component:g,onClick:()=>{a.routerService.push(e)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${ye}`]:{transition:"filter 500ms"},"&:hover":{background:()=>ge(i)?k(i,.33):v(i,.33),[`& .${ye}`]:{transition:"filter 500ms",filter:ge(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:ye}),children:t})}))(t,e,i,n))}]}),Ce=s()({root:{position:"relative"},tooltip:{position:"absolute",margin:0,left:5,top:5,backgroundColor:"#343434",zIndex:999,color:"white",fontWeight:"bold",padding:"5px 10px",borderRadius:3,fontSize:"12px",pointerEvents:"none",touchAction:"none"}}),Se={layout:{textColor:"#d4d4d8",backgroundColor:"#ffffff"},rightPriceScale:{scaleMargins:{top:.3,bottom:.25}},crosshair:{vertLine:{width:4,color:"#ebe0e301",style:0},horzLine:{visible:!1,labelVisible:!1}},grid:{vertLines:{color:"#f8b3"},horzLines:{color:"#f8b3"}},handleScroll:{vertTouchDrag:!1}},xe=({height:e,width:t,items:i,position:a,priceOpen:n,priceStopLoss:l,priceTakeProfit:s})=>{const{classes:r}=Ce(),c=x.useRef(void 0),[p,d]=x.useState(null);return x.useLayoutEffect(()=>{const{current:o}=c,r=L(o,{...Se,localization:{priceFormatter:e=>M(e,N(e))},width:t,height:e,crosshair:{mode:w.Normal,vertLine:{labelVisible:!1},horzLine:{visible:!1,labelVisible:!0}},timeScale:{timeVisible:!0,secondsVisible:!0,tickMarkFormatter:e=>{const o=i.find(o=>o.timestamp===Number(e))||i[0];if(!o||!o.timestamp)return"Invalid date";const t=z(o.timestamp);return t.isValid()?t.format("HH:mm:ss"):"Invalid date"}}}),p=r.addLineSeries({lastValueVisible:!1,color:P[400]}),m=i.map(e=>({time:Math.floor(e.timestamp),value:parseFloat(e.close)}));if(p.setData(m),a&&n){const e="long"===a?P[700]:V[700];p.createPriceLine({price:n,color:e,lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"long"===a?"LONG Entry":"SHORT Entry"})}return l&&p.createPriceLine({price:l,color:$[500],lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"SL"}),s&&p.createPriceLine({price:s,color:H[500],lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"TP"}),r.subscribeCrosshairMove(e=>{if(e.time){const o=i.find(o=>o.timestamp===Number(e.time));if(o){const e=z(o.timestamp).format("DD/MM/YYYY HH:mm:ss"),t=M(o.close,N(o.close));d(`${e}: ${t}`)}else d(null)}else d(null)}),r.timeScale().fitContent(),()=>{r.remove()}},[e,t,i]),o("div",{ref:c,className:r.root,children:p&&o("div",{className:r.tooltip,children:p})})},Le={"1m":"#2979ff","15m":"#f3a43a","1h":"#d500f9"},we={"1m":"1 minute","15m":"15 minutes","1h":"1 hour"};const Pe=({symbol:e,interval:t,reloadSubject:n,downloadSubject:l,onInfoClick:s,disableInfo:r,position:c,priceOpen:d,priceStopLoss:m,priceTakeProfit:h,sx:y})=>{const[f,{loading:g,execute:k}]=i(async()=>await a.exchangeViewService.getLastCandles(e,t),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e,t]}),v=O(f);A(()=>n.subscribe(k)),A(()=>l.subscribe(()=>{const{current:o}=v;!function(e,o="data.json"){const t=new Blob([e],{type:"application/json"}),i=window.URL.createObjectURL(t);a.layoutService.downloadFile(i,o)}(JSON.stringify(o,null,2),`${e}-${t}.json`)}));return o(F,{sx:{...y,display:"flex",flexDirection:"column",alignItems:"stretch",overflow:"clip"},children:[o(u,{sx:{background:Le[t]||"#607d8b",minHeight:"48px",display:"flex",alignItems:"center",pl:2,pr:1},children:[o(p,{variant:"h6",sx:{color:"white",fontWeight:"bold",mr:1},children:we[t]||t}),!!c&&o(b,{variant:"filled",sx:{color:"white"},color:"short"===c?"warning":"success",label:String(c).toUpperCase()}),o(u,{sx:{flex:1}}),o(_,{disabled:r,onClick:s,children:o(E,{style:{color:"white",opacity:r?.5:1}})})]}),o(I,{}),!f||g?o(R,{sx:{height:"100%",width:"100%"}}):o(u,{sx:{position:"relative",flex:1},children:o(j,{style:{position:"absolute"},children:({height:e,width:t})=>o(xe,{items:f,height:e,width:t,position:c,priceOpen:d,priceStopLoss:m,priceTakeProfit:h})})})]})},Te=[{type:l.Link,action:"back-action",label:o(te,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"},{type:l.Link,action:"back-action",compute:({symbol:e})=>String(e).toUpperCase()},{type:l.Link,action:"back-action",compute:({interval:e})=>String(e).toUpperCase()}],Ve=[{action:"download-now",label:"Download",icon:()=>o(c,{icon:Q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:oe,color:"#4caf50"})}],$e=new D,He=new D,ze=[{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"position",title:"Position",readonly:!0,compute:e=>"long"===e.position?"🔵 LONG (profit on rise)":"🟠 SHORT (profit on fall)"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceOpen",title:"Entry",readonly:!0,compute:e=>e.priceOpen?`${M(e.priceOpen)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceOpen",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalPriceOpen&&e.originalPriceOpen!==e.priceOpen,compute:e=>e.originalPriceOpen?`${M(e.originalPriceOpen)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceTakeProfit",title:"Take Profit",readonly:!0,compute:e=>e.priceTakeProfit?`${M(e.priceTakeProfit)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceTakeProfit",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalPriceTakeProfit&&e.originalPriceTakeProfit!==e.priceTakeProfit,compute:e=>e.originalPriceTakeProfit?`${M(e.originalPriceTakeProfit)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceStopLoss",title:"Stop Loss",readonly:!0,compute:e=>e.priceStopLoss?`${M(e.priceStopLoss)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceStopLoss",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalPriceStopLoss&&e.originalPriceStopLoss!==e.priceStopLoss,compute:e=>e.originalPriceStopLoss?`${M(e.originalPriceStopLoss)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalEntries",title:"Total Entries",readonly:!0,isVisible:e=>null!=e.totalEntries&&e.totalEntries>1,compute:e=>String(e.totalEntries)},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalPartials",title:"Total Closes",readonly:!0,isVisible:e=>null!=e.totalPartials&&e.totalPartials>0,compute:e=>String(e.totalPartials)},{type:r.Component,sx:{mt:2},element:({payload:e})=>o(C,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],Me=[{id:"chart",element:({params:e})=>{const t=G(()=>({symbol:String(e.symbol).toUpperCase(),interval:e.interval})),[l,{loading:s,execute:r}]=i(async()=>{const o=String(e.symbol).toUpperCase();return await a.signalViewService.getPendingSignal(o)},{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e.symbol]});A(()=>$e.subscribe(r));const c=x.useMemo(()=>l?l.priceTakeProfit:0,[l]),p=x.useMemo(()=>l?l.priceStopLoss:0,[l]),d=x.useMemo(()=>l?l.priceOpen:0,[l]),m=x.useMemo(()=>l?l.position:null,[l]),[u,h]=W(null),{pickData:b,setOpen:y,render:g}=B({title:"Info",AfterTitle:({onClose:e})=>o(f,{direction:"row",gap:2,children:[o(Y,{onClick:()=>a.layoutService.pickSignal(u.current.id),variant:"outlined",children:"Show Details"}),o(J,{size:"small",onClick:e,children:o(K,{})})]}),payload:()=>({handleClose(){y(!1)}}),fields:ze,handler:()=>u.current,withActionButton:!1}),k=U(async()=>{l&&(h(l),b(l.id))});return o(ee,{children:[o(n,{items:Te,actions:Ve,payload:t,onAction:async o=>{"back-action"===o&&a.routerService.push(`/price_chart/${e.symbol}`),"update-now"===o&&await $e.next(),"download-now"===o&&await He.next()}}),s?null:o(Pe,{symbol:t.symbol,interval:t.interval,disableInfo:!l,reloadSubject:$e,downloadSubject:He,onInfoClick:k,position:m,priceOpen:d,priceStopLoss:p,priceTakeProfit:c,sx:{height:"calc(100dvh - 165px)"}}),g()]})},isActive:e=>Z(["/price_chart/:symbol/:interval"],e)},{id:"coin",element:({params:e})=>{const{classes:t}=fe(),i=e.symbol,l=x.useMemo(()=>[{label:"1 minute",to:`/price_chart/${i}/1m`,color:"#2979ff",icon:ae},{label:"15 minutes",to:`/price_chart/${i}/15m`,color:"#f3a43a",icon:ne},{label:"1 hour",to:`/price_chart/${i}/1h`,color:"#d500f9",icon:ie}],[i]),s=x.useMemo(()=>[ve("Chart",l)],[l]);return o(ee,{children:[o(n,{items:ke,payload:i,onAction:e=>{"back-action"===e&&a.routerService.push("/price_chart")}}),o(m,{className:t.root,fields:s}),o(u,{paddingBottom:"24px"})]})},isActive:e=>Z(["/price_chart/:symbol"],e)},{id:"main",element:()=>{const{classes:e}=ce(),{reloadTrigger:l,doReload:s}=t(),[c,{loading:b}]=i(async()=>await(async()=>{const[e,o]=await Promise.all([a.symbolGlobalService.getSymbolList(),a.symbolGlobalService.getSymbolMap()]),t={};e.forEach((e,i)=>{const a=o[e],n=i+1,l=(null==a?void 0:a.priority)||n;t[l]||(t[l]=[]),t[l].push({symbol:e,label:(null==a?void 0:a.displayName)||e,color:(null==a?void 0:a.color)||"#ccc"})});const i=Object.entries(t).map(([e,o])=>({priority:parseInt(e),routes:o})).sort(({priority:e,routes:{length:o}},{priority:t,routes:{length:i}})=>i-o||t-e),n=[],l=[],s=[];return i.forEach(({routes:e,priority:o},t)=>{const i=ue(`Priority ${o}`,e);t%2==0&&n.push(i),t%2==1&&l.push(i),s.push(i)}),s.length?[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:l},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:s}]:[]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[l]});return o(ee,{children:[o(n,{items:de,actions:me,onAction:e=>{"back-action"===e&&a.routerService.push("/"),"update-now"===e&&s()}}),b||!c?o(d,{children:o(p,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):c.length?o(h,{children:[o(m,{className:e.root,fields:c},l),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(p,{variant:"h6",sx:{opacity:.5},children:"No symbols found"})})]})},isActive:e=>Z(["/price_chart"],e)}],Ne=({symbol:e,interval:t})=>o(X,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:Me,params:{symbol:e,interval:t}});export{Ne as PriceChartPage,Ne as default};
@@ -1 +0,0 @@
1
- import{b as a,f as e,aZ as t,B as o,A as r,a9 as n,T as i,H as s,a3 as c,F as l,G as d,P as h,aO as p,a$ as u,b0 as b,aG as w,a8 as f,i as x,aH as g,al as y,aL as v,O as m,R as S,b1 as L,a_ as k,D as j,Z as A}from"./index-BI3k7b1T.js";import{A as H}from"./Article-CpU7DBcT.js";import{C as R,R as z}from"./Refresh-3cixHjvW.js";import{K as C}from"./KeyboardArrowLeft-BUZ_pXI5.js";const B=a(e("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"}),"BugReport"),D=a=>{const t={color:"white",fontSize:28};switch(a.type){case"debug":return e(B,{sx:t});case"info":return e(u,{sx:t});case"warn":return e(p,{sx:t});default:return e(H,{sx:t})}},E=t.virtualize(({data:a,sx:t})=>{const p=(a=>{switch(a.type){case"debug":default:return"#9E9E9E";case"info":return"#2196F3";case"warn":return"#FF9800";case"log":return"#4CAF50"}})(a);return e(h,{variant:"outlined",sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",...t},children:e(o,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[e(r,{direction:"row",spacing:2,sx:{p:2},children:[e(n,{sx:{width:56,height:56,background:p},children:D(a)}),e(r,{flex:1,spacing:1,children:[e(r,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[e(i,{variant:"h6",sx:{fontWeight:600,wordBreak:"break-all"},children:a.topic}),e(i,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:s(a.createdAt).format("HH:mm DD/MM/YYYY")})]}),e(r,{direction:"row",spacing:1,flexWrap:"wrap",children:e(c,{size:"small",label:a.type.toUpperCase(),sx:{background:p,color:"white",fontWeight:500}})}),a.args.length>0&&e(l,{children:[e(d,{sx:{my:1}}),e(o,{component:"pre",sx:{m:0,fontSize:"0.75rem",whiteSpace:"pre-wrap",wordBreak:"break-all",color:"text.secondary"},children:JSON.stringify(1===a.args.length?a.args[0]:a.args,null,2)})]})]})]}),e(o,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:p}})]})})}),F=[{action:"download-action",label:"Download",icon:()=>e(A,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh manually",icon:()=>e(A,{icon:z,color:"#4caf50"})}],M=[{type:S.Link,action:"back-action",label:e(C,{sx:{display:"block"}})},{type:S.Link,action:"back-action",label:"Main"},{type:S.Link,action:"back-action",label:"Logs"},{type:S.Button,icon:L,action:"search-action",label:"Search"}],O=new f,Y=()=>{const[a,o]=b(""),{data:r,hasMore:n,loading:i,onSkip:s}=w({handler:async(e,t)=>{const o=await x.logViewService.getList(),r=g(e,t);for(const n of o)if(new RegExp(a.current,"i").test(n.topic)&&r([n]).done)break;return r().rows},onLoadStart:()=>x.layoutService.setAppbarLoader(!0),onLoadEnd:()=>x.layoutService.setAppbarLoader(!1),reloadSubject:O}),c=y(r),{execute:l}=v(async()=>{const a=new Blob([JSON.stringify(c.current,null,2)],{type:"application/json"}),e=URL.createObjectURL(a);x.layoutService.downloadFile(e,`logs_${Date.now()}.json`)},{onLoadStart:()=>x.layoutService.setAppbarLoader(!0),onLoadEnd:()=>x.layoutService.setAppbarLoader(!1)});return e(R,{children:[e(m,{items:M,actions:F,onAction:async a=>{"back-action"===a&&x.routerService.push("/"),"download-action"===a&&l(),"update-now"===a&&(o(""),await O.next()),"search-action"===a&&(async()=>{const a=await x.layoutService.prompt("Search keyword");if(a)return o(a),void O.next();o(""),O.next()})()}}),e(t,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:i,onDataRequest:s,bufferSize:k,hasMore:n,children:r.map(a=>e(E,{data:a,sx:{mb:1}},a.id))})]})};export{Y as LogPage,Y as default};