@backtest-kit/ui 15.1.0 → 15.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/build/modules/frontend/build/assets/{Article-BbLUOulC.js → Article-CV6sYzXB.js} +1 -1
  2. package/build/modules/frontend/build/assets/{Background-CDTP9p37.js → Background-Djt8-6Ze.js} +1 -1
  3. package/build/modules/frontend/build/assets/{IconPhoto-HzRJjN64.js → IconPhoto-CtWTATuX.js} +1 -1
  4. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-CUCkEYvJ.js → KeyboardArrowLeft-C3lIqTl8.js} +1 -1
  5. package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-C-gvxvB-.js → PictureAsPdfOutlined-B1KE8AuD.js} +1 -1
  6. package/build/modules/frontend/build/assets/{Refresh-CaTTs-6v.js → Refresh-KIrQPPBf.js} +1 -1
  7. package/build/modules/frontend/build/assets/emitters-qnXuWOnN.js +1 -0
  8. package/build/modules/frontend/build/assets/{hasRouteMatch-SXqr3R6f.js → hasRouteMatch-B6-B9b9t.js} +1 -1
  9. package/build/modules/frontend/build/assets/{html2canvas-87cBQTS1.js → html2canvas-CdSt4VzX.js} +1 -1
  10. package/build/modules/frontend/build/assets/index-0JctlSLr.js +1 -0
  11. package/build/modules/frontend/build/assets/index-1K1HGT_8.js +1 -0
  12. package/build/modules/frontend/build/assets/index-8b7X5vYC.js +1 -0
  13. package/build/modules/frontend/build/assets/index-BFzLQzbk.js +1 -0
  14. package/build/modules/frontend/build/assets/index-BmoE1JTl.js +1 -0
  15. package/build/modules/frontend/build/assets/index-C3X0Cyxd.js +1 -0
  16. package/build/modules/frontend/build/assets/index-C5m6_YJk.js +1 -0
  17. package/build/modules/frontend/build/assets/index-CHkGhaAk.js +1 -0
  18. package/build/modules/frontend/build/assets/index-Dg5tMbmL.js +1 -0
  19. package/build/modules/frontend/build/assets/index-DkFd37tu.js +1 -0
  20. package/build/modules/frontend/build/assets/index-OFztncO3.js +1 -0
  21. package/build/modules/frontend/build/assets/index-WrZQf7cw.js +1672 -0
  22. package/build/modules/frontend/build/assets/index-ZG9R-qtJ.js +1 -0
  23. package/build/modules/frontend/build/assets/{index.es-B5F8LBE-.js → index.es-DenpndJP.js} +1 -1
  24. package/build/modules/frontend/build/index.html +1 -1
  25. package/package.json +4 -4
  26. package/build/modules/frontend/build/assets/emitters-8dLQtS6C.js +0 -1
  27. package/build/modules/frontend/build/assets/index-B0S0LDjw.js +0 -1
  28. package/build/modules/frontend/build/assets/index-B7aH-J6E.js +0 -1
  29. package/build/modules/frontend/build/assets/index-BCnA_-zg.js +0 -1
  30. package/build/modules/frontend/build/assets/index-BPxBQtFc.js +0 -1
  31. package/build/modules/frontend/build/assets/index-BnHudNsk.js +0 -1672
  32. package/build/modules/frontend/build/assets/index-Bo3Xqg5b.js +0 -1
  33. package/build/modules/frontend/build/assets/index-C-BaXIVA.js +0 -1
  34. package/build/modules/frontend/build/assets/index-Cb6Ol44V.js +0 -1
  35. package/build/modules/frontend/build/assets/index-Cd-Fw809.js +0 -1
  36. package/build/modules/frontend/build/assets/index-DC4vTBIw.js +0 -1
  37. package/build/modules/frontend/build/assets/index-HwaagyGP.js +0 -1
  38. package/build/modules/frontend/build/assets/index-HyrIJdm0.js +0 -1
  39. package/build/modules/frontend/build/assets/index-mYQFfqbM.js +0 -1
  40. package/build/modules/frontend/build/assets/markdownit-BjYdF6dQ.js +0 -1
@@ -1 +1 @@
1
- import{d as c,f as v}from"./index-BnHudNsk.js";const h=c(v("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-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
1
+ import{d as c,f as v}from"./index-WrZQf7cw.js";const h=c(v("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-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
@@ -1 +1 @@
1
- import{f as n,S as o}from"./index-BnHudNsk.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
1
+ import{f as n,S as o}from"./index-WrZQf7cw.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
@@ -1 +1 @@
1
- import{f as e,i as t,B as r,W as s}from"./index-BnHudNsk.js";const o=({className:o,symbol:i,style:a,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[i],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:a,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:i,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:a,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
1
+ import{f as e,i as t,B as r,X as s}from"./index-WrZQf7cw.js";const o=({className:o,symbol:i,style:a,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[i],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:a,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:i,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:a,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
@@ -1 +1 @@
1
- import{d as o,f as r}from"./index-BnHudNsk.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
1
+ import{d as o,f as r}from"./index-WrZQf7cw.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
@@ -1 +1 @@
1
- import{d as h,f as c}from"./index-BnHudNsk.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
1
+ import{d as h,f as c}from"./index-WrZQf7cw.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
@@ -1 +1 @@
1
- import{bI as e,e as t,r as a,_ as s,f as i,bJ as n,j as o,bK as r,k as d,bL as m,g as u,u as p,s as x,d as c}from"./index-BnHudNsk.js";const h=e(),l=["className","component","disableGutters","fixed","maxWidth","classes"],b=m(),f=h("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:b});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:c,component:h="div",disableGutters:b=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,l),k=t({},r,{component:h,disableGutters:b,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:h,ownerState:k,className:n(S.root,c),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})}),k=c(i("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{W as C,k as R};
1
+ import{bJ as e,e as t,r as a,_ as s,f as i,bK as n,j as o,bL as r,k as d,bM as m,g as u,u as p,s as x,d as c}from"./index-WrZQf7cw.js";const h=e(),l=["className","component","disableGutters","fixed","maxWidth","classes"],b=m(),f=h("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:b});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:c,component:h="div",disableGutters:b=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,l),k=t({},r,{component:h,disableGutters:b,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:h,ownerState:k,className:n(S.root,c),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})}),k=c(i("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{W as C,k as R};
@@ -0,0 +1 @@
1
+ import{a9 as o}from"./index-WrZQf7cw.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{i as a,bG as e,bH as t}from"./index-BnHudNsk.js";const i=(i,o=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>i.includes(a)),o);export{i as h};
1
+ import{i as a,bH as e,bI as t}from"./index-WrZQf7cw.js";const i=(i,o=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>i.includes(a)),o);export{i as h};
@@ -1 +1 @@
1
- import{bM as e,bO as t}from"./index-BnHudNsk.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
1
+ import{bN as e,bO as t}from"./index-WrZQf7cw.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
@@ -0,0 +1 @@
1
+ import{d as e,f as t,A as i,i as n,G as a,a9 as o,V as r,W as l,$ as s,t as d,Z as c,a0 as p,a1 as m,a3 as g,Y as f,y as u,aa as _,T as h,m as y,B as C,l as E,ab as A,ac as x,a5 as b,D as w,ad as S,ae as M,af as R,ag as v,a8 as T,ah as O,ai as D,aj as N}from"./index-WrZQf7cw.js";import{h as L}from"./hasRouteMatch-B6-B9b9t.js";import{P as k}from"./PictureAsPdfOutlined-B1KE8AuD.js";import{C as I,R as B}from"./Refresh-KIrQPPBf.js";import{K as P}from"./KeyboardArrowLeft-C3lIqTl8.js";const W=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),F=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),V=144,G=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:d("Dashboard")},{type:l.Link,action:"back-action",label:d("Performance")},{type:l.Button,action:"download-pdf",label:d("Download PDF"),icon:k},{type:l.Fab,action:"setup-action",label:d("Settings"),icon:W}],K=[{action:"setup-action",label:d("Settings"),icon:()=>t(s,{icon:W,color:"#4caf50"})},{divider:!0},{action:"download-json",label:d("Download JSON"),icon:()=>t(s,{icon:c,color:"#4caf50"})},{action:"download-markdown",label:d("Download Markdown"),icon:()=>t(s,{icon:p,color:"#4caf50"})},{action:"download-pdf",label:d("Download PDF"),icon:()=>t(s,{icon:m,color:"#4caf50"})},{divider:!0},{action:"update-now",label:d("Refresh"),icon:()=>t(s,{icon:B,color:"#4caf50"})}],X=({name:e,title:t})=>({type:g.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:g.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:g.Div},{type:g.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${d("ms")}`:t:"-",name:e}]}),H=({name:e,title:i})=>({type:g.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:g.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:i},{type:g.Div},{type:g.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:i})=>{const n="github"===e,a=n?"#6A1B9A":"#24A1DE";return t(b,{size:"medium",disabled:!i,startIcon:t(_,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(n?x:F,{sx:{color:a,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:a,"&:hover":{background:"white",color:a}},onClick:()=>{if(n)A(String(i));else{const e=String(i).replaceAll("@","");A(`https://t.me/${e}`)}},children:d(i?"Open":"Not configured")})},name:e}]}),U=[{type:g.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:g.Layout,customLayout:({children:e})=>t(E,{sx:{width:"335px"},children:e}),fields:[{type:g.Component,element:()=>t(C,{sx:{background:e=>y(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(_,{sx:{height:V,width:V,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(h,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:g.Layout,customLayout:({children:e})=>t(C,{p:1,children:e}),fields:[{type:g.Div,style:{height:"2px"}},{type:g.Div,style:{height:"12px"}},X({name:"totalEvents",title:d("Total events")}),X({name:"totalDuration",title:d("Total time")}),X({name:"avgDuration",title:d("Average time")}),H({name:"channel",title:d("Channel")}),H({name:"github",title:"GitHub"})]}]}}],Y=new o,j=new o,z=({title:e,name:t,idx:i})=>({type:g.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr 125px",pointerEvents:"none",alignItems:"center",background:e=>i%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent",padding:"8px",paddingLeft:"8px",paddingRight:"8px"},fields:[{type:g.Typography,style:{fontSize:"12px"},typoVariant:"subtitle2",fieldBottomMargin:"0",placeholder:e},{type:g.Box,sx:{minWidth:"8px"}},{type:g.Text,readonly:!0,outlined:i%2==0,name:t,compute(e){const i=D.get(e,t);return String(i)},title:"",fieldBottomMargin:"0",fieldRightMargin:"0"}]}),$=[{title:d("JSONL files"),description:d("Files processed by Claude Code, HuggingFace, Parquet"),name:"recent_enabled"},{title:d("Markdown files"),description:d("Human-readable files. Useful when running without a GUI"),name:"markdown_enabled"},{title:d("Dump files"),description:d("Conversation dump with the AI agent used for trading signals"),name:"dump_enabled"}],q=[{type:g.Box,sx:{maxWidth:420,minWidth:340},fields:[{type:g.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto auto",alignItems:"center",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"4px"},fields:[{type:g.Typography,style:{opacity:.5},fieldBottomMargin:"0",typoVariant:"subtitle2",placeholder:d("Runtime Configuration")},{type:g.Box},{type:g.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:w,async click(e,t,i,n){await j.next(),await n.handleDownloadConfig()}},{type:g.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:S,click:()=>j.next()}]},{type:g.Layout,customLayout:({children:e})=>t(C,{sx:{overflow:"clip",overflowY:"auto",marginBottom:"16px",maxHeight:{xs:"min(365px, 80vh - 235px)",sm:"min(475px, 80vh - 235px)"},width:"100%"},children:e}),fields:[z({idx:0,title:"CC_SCHEDULE_AWAIT_MINUTES",name:"config.CC_SCHEDULE_AWAIT_MINUTES",description:T.newline("Time to wait for scheduled signal to activate (in minutes).","If signal does not activate within this time, it will be cancelled.")}),z({idx:1,title:"CC_AVG_PRICE_CANDLES_COUNT",name:"config.CC_AVG_PRICE_CANDLES_COUNT",description:T.newline("Number of candles to use for average price calculation (VWAP).","Default: 5 candles (last 5 minutes when using 1m interval).")}),z({idx:2,title:"CC_PERCENT_SLIPPAGE",name:"config.CC_PERCENT_SLIPPAGE",description:T.newline("Slippage percentage applied to entry and exit prices.","Simulates market impact and order book depth.","Applied twice (entry and exit) for realistic execution simulation.","Default: 0.1% per transaction.")}),z({idx:3,title:"CC_PERCENT_FEE",name:"config.CC_PERCENT_FEE",description:T.newline("Fee percentage charged per transaction.","Applied twice (entry and exit) for total fee calculation.","Default: 0.1% per transaction (total 0.2%).")}),z({idx:4,title:"CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",name:"config.CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",description:T.newline("Minimum TakeProfit distance from priceOpen (percentage).","Must be greater than (slippage + fees) to ensure profitable trades.","Default: 0.5% (covers all costs + minimum profit margin).")}),z({idx:5,title:"CC_MIN_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MIN_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Minimum StopLoss distance from priceOpen (percentage).","Prevents signals from being immediately stopped out due to price volatility.","Default: 0.5% (buffer to avoid instant stop loss on normal market fluctuations).")}),z({idx:6,title:"CC_MAX_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MAX_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Maximum StopLoss distance from priceOpen (percentage).","Prevents catastrophic losses from extreme StopLoss values.","Default: 20% (one signal cannot lose more than 20% of position).")}),z({idx:7,title:"CC_MAX_SIGNAL_LIFETIME_MINUTES",name:"config.CC_MAX_SIGNAL_LIFETIME_MINUTES",description:T.newline("Maximum signal lifetime in minutes.","Also used as the default when minuteEstimatedTime is not provided in ISignalDto.","Prevents eternal signals that block risk limits for weeks/months.","Use Infinity to allow signals to live indefinitely (until TP/SL or explicit close).","Default: 1440 minutes (1 day).")}),z({idx:8,title:"CC_MAX_SIGNAL_GENERATION_SECONDS",name:"config.CC_MAX_SIGNAL_GENERATION_SECONDS",description:T.newline("Maximum time allowed for signal generation (in seconds).","Prevents long-running or stuck signal generation routines from blocking execution or consuming resources indefinitely.","If generation exceeds this threshold the attempt should be aborted, logged and optionally retried.","Default: 180 seconds (3 minutes).")}),z({idx:9,title:"CC_GET_CANDLES_RETRY_COUNT",name:"config.CC_GET_CANDLES_RETRY_COUNT",description:T.newline("Number of retries for getCandles function.","Default: 3 retries.")}),z({idx:10,title:"CC_GET_CANDLES_RETRY_DELAY_MS",name:"config.CC_GET_CANDLES_RETRY_DELAY_MS",description:T.newline("Delay between retries for getCandles function (in milliseconds).","Default: 5000 ms (5 seconds).")}),z({idx:11,title:"CC_MAX_CANDLES_PER_REQUEST",name:"config.CC_MAX_CANDLES_PER_REQUEST",description:T.newline("Maximum number of candles to request per single API call.","If a request exceeds this limit, data will be fetched using pagination.","Default: 1000 candles per request.")}),z({idx:12,title:"CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",name:"config.CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",description:T.newline("Maximum allowed deviation factor for price anomaly detection.","Price should not be more than this factor lower than reference price.","Example: BTC at $50,000 median → threshold $50 (catches $0.01-1 anomalies).")}),z({idx:13,title:"CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",name:"config.CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",description:T.newline("Minimum number of candles required for reliable median calculation.","Below this threshold, use simple average instead of median.","Example: 3 candles = 12 points (use average), 5 candles = 20 points (use median).")}),z({idx:14,title:"CC_REPORT_SHOW_SIGNAL_NOTE",name:"config.CC_REPORT_SHOW_SIGNAL_NOTE",description:T.newline("Controls visibility of signal notes in markdown report tables.",'When enabled, the "Note" column will be displayed in all markdown reports (backtest, live, schedule, risk, etc.)',"Default: false (notes are hidden to reduce table width and improve readability).")}),z({idx:15,title:"CC_BREAKEVEN_THRESHOLD",name:"config.CC_BREAKEVEN_THRESHOLD",description:T.newline("Breakeven threshold percentage - minimum profit distance from entry to enable breakeven.","When price moves this percentage in profit direction, stop-loss can be moved to entry (breakeven).","Default: 0.2% (additional buffer above costs to ensure no loss when moving to breakeven).")}),z({idx:16,title:"CC_ORDER_BOOK_TIME_OFFSET_MINUTES",name:"config.CC_ORDER_BOOK_TIME_OFFSET_MINUTES",description:T.newline("Time offset in minutes for order book fetching.","Subtracts this amount from the current time when fetching order book data.","This helps get a more stable snapshot of the order book by avoiding real-time volatility.","Default: 10 minutes.")}),z({idx:17,title:"CC_ORDER_BOOK_MAX_DEPTH_LEVELS",name:"config.CC_ORDER_BOOK_MAX_DEPTH_LEVELS",description:T.newline("Maximum depth levels for order book fetching.","Specifies how many price levels to fetch from both bids and asks.","Default: 20 levels.")}),z({idx:18,title:"CC_AGGREGATED_TRADES_MAX_MINUTES",name:"config.CC_AGGREGATED_TRADES_MAX_MINUTES",description:T.newline("Maximum minutes of aggregated trades to fetch when no limit is provided.","If limit is not specified, the system will fetch aggregated trades for this many minutes starting from the current time minus the offset.","Binance requirement.")}),z({idx:19,title:"CC_MAX_BACKTEST_MARKDOWN_ROWS",name:"config.CC_MAX_BACKTEST_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in backtest markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:20,title:"CC_MAX_BREAKEVEN_MARKDOWN_ROWS",name:"config.CC_MAX_BREAKEVEN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in breakeven markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:21,title:"CC_MAX_HEATMAP_MARKDOWN_ROWS",name:"config.CC_MAX_HEATMAP_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in heatmap markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:22,title:"CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",name:"config.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in highest profit markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:23,title:"CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",name:"config.CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in max drawdown markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:24,title:"CC_MAX_LIVE_MARKDOWN_ROWS",name:"config.CC_MAX_LIVE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in live markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:25,title:"CC_MAX_PARTIAL_MARKDOWN_ROWS",name:"config.CC_MAX_PARTIAL_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in partial markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:26,title:"CC_MAX_RISK_MARKDOWN_ROWS",name:"config.CC_MAX_RISK_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in risk markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:27,title:"CC_MAX_SCHEDULE_MARKDOWN_ROWS",name:"config.CC_MAX_SCHEDULE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in schedule markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:28,title:"CC_MAX_STRATEGY_MARKDOWN_ROWS",name:"config.CC_MAX_STRATEGY_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in strategy markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:29,title:"CC_MAX_SYNC_MARKDOWN_ROWS",name:"config.CC_MAX_SYNC_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in sync markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:30,title:"CC_WALKER_MARKDOWN_TOP_N",name:"config.CC_WALKER_MARKDOWN_TOP_N",description:T.newline("Number of top strategies to include in the walker comparison table.","Default: 10 strategies.")}),z({idx:31,title:"CC_MAX_PERFORMANCE_MARKDOWN_ROWS",name:"config.CC_MAX_PERFORMANCE_MARKDOWN_ROWS",description:T.newline("Maximum number of performance metric events to keep in storage.","Older events are removed when this limit is exceeded.","Higher than other report event limits because performance metrics are lightweight and benefit from larger sample sizes for accurate statistical analysis.","Default: 10000 events.")}),z({idx:32,title:"CC_MAX_NOTIFICATIONS",name:"config.CC_MAX_NOTIFICATIONS",description:T.newline("Maximum number of notifications to keep in storage.","Older notifications are removed when this limit is exceeded.","Default: 500 notifications.")}),z({idx:33,title:"CC_MAX_SIGNALS",name:"config.CC_MAX_SIGNALS",description:T.newline("Maximum number of signals to keep in storage.","Older signals are removed when this limit is exceeded.","Default: 50 signals.")}),z({idx:34,title:"CC_MAX_LOG_LINES",name:"config.CC_MAX_LOG_LINES",description:T.newline("Maximum number of log lines to keep in storage.","Older log lines are removed when this limit is exceeded.","This helps prevent unbounded log growth which can consume memory and degrade performance over time.","Default: 1000 log lines.")}),z({idx:35,title:"CC_ENABLE_CANDLE_FETCH_MUTEX",name:"config.CC_ENABLE_CANDLE_FETCH_MUTEX",description:T.newline("Enables mutex locking for candle fetching to prevent concurrent fetches of the same candles.","This can help avoid redundant API calls and ensure data consistency when multiple processes/threads attempt to fetch candles simultaneously.","Default: true (mutex locking enabled for candle fetching).")}),z({idx:36,title:"CC_ENABLE_BACKTEST_PARALLEL_SPIN",name:"config.CC_ENABLE_BACKTEST_PARALLEL_SPIN",description:T.newline("Enables cooperative interleaving of concurrently running backtests after each candle fetch.","Hands the event loop to a peer backtest waiting on the same mutex, so multiple parallel Backtest.run / Walker workloads progress in round-robin fashion instead of one monopolizing the event loop until completion.","Default: true (parallel backtests are interleaved on each candle fetch boundary).")}),z({idx:37,title:"CC_ENABLE_DCA_EVERYWHERE",name:"config.CC_ENABLE_DCA_EVERYWHERE",description:T.newline("Enables DCA (Dollar-Cost Averaging) logic even if antirecord is not broken.","Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.","Default: false (DCA logic enabled only when antirecord is broken).")}),z({idx:38,title:"CC_ENABLE_PPPL_EVERYWHERE",name:"config.CC_ENABLE_PPPL_EVERYWHERE",description:T.newline("Enables PPPL (Partial Profit, Partial Loss) logic even if this breaks a direction of exits.","Allows to take partial profit or loss on a position even if it results in a mix of profit and loss exits.","Default: false (PPPL logic is only applied when it does not break the direction of exits, ensuring clearer profit/loss outcomes).")}),z({idx:39,title:"CC_ENABLE_LONG_SIGNAL",name:"config.CC_ENABLE_LONG_SIGNAL",description:T.newline("Enables long signals in strategies that are primarily designed for short signals.","This allows the strategy to generate and manage long signals in addition to short signals, even if the original design was focused on short trading.","Default: false (long signals are only enabled in strategies that are designed for them, ensuring strategy logic is aligned with signal types).")}),z({idx:40,title:"CC_ENABLE_SHORT_SIGNAL",name:"config.CC_ENABLE_SHORT_SIGNAL",description:T.newline("Enables short signals in strategies that are primarily designed for long signals.","This allows the strategy to generate and manage short signals in addition to long signals, even if the original design was focused on long trading.")}),z({idx:41,title:"CC_ENABLE_TRAILING_EVERYWHERE",name:"config.CC_ENABLE_TRAILING_EVERYWHERE",description:T.newline("Enables trailing logic (Trailing Take / Trailing Stop) without requiring absorption conditions.","Allows trailing mechanisms to be activated regardless of whether absorption has been detected.","Default: false (trailing logic is applied only when absorption conditions are met).")}),z({idx:42,title:"CC_POSITION_ENTRY_COST",name:"config.CC_POSITION_ENTRY_COST",description:T.newline("Cost of entering a position (in USD).","This is used as a default value for calculating position size and risk management when cost data is not provided by the strategy.","Default: $100 per position.")})]},{type:g.Box,sx:{p:1},child:{type:g.Button,fieldBottomMargin:"0",fieldRightMargin:"0",buttonVariant:"contained",title:d("Download"),click:async(e,t,i,n)=>{await j.next(),await n.handleDownloadConfig()},icon:w}}]}],J=[{type:g.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:g.Paper,fieldBottomMargin:"1",fields:[{type:g.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"center"},fields:[{type:g.Box,sx:{display:"grid",gridTemplateColumns:"1fr"},fields:[{type:g.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:d("Running mode")},{type:g.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:d("Historical data processing")},{type:g.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:d("Real-time exchange integration")},{type:g.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:d("UI only")}]},{type:g.Box},{type:g.Component,fieldBottomMargin:"0",element:({_fieldData:e,payload:i})=>t(M,{noBadge:!0,size:"small",sx:{transform:"translate(10px, -28px)",opacity:"0.5",transition:"opacity 500ms","&:hover":{opacity:"1.0"}},oneSx:{padding:"0 !important"},fields:q,closeSubject:j,payload:i,handler:()=>e,children:t(W,{})})}]},{type:g.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:d("Historical data")},{type:g.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:d("Real-time")},{type:g.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:d("Frontend only")}]},{type:g.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:g.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:g.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:d("Log mode")},{type:g.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:d("Logs take up disk space but are needed for debugging")}]},...$.map(({name:e,title:t,description:i},n)=>(({title:e,description:t,name:i,idx:n})=>({type:g.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>n%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:g.Box,fields:[{type:g.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:g.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:g.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:i}]}))({name:e,title:t,description:i,idx:n}))]},{type:g.Paper,fieldBottomMargin:"1",fields:[{type:g.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:d("User interface")},{type:g.Switch,readonly:!0,fieldBottomMargin:"0",title:d("Save notifications"),name:"notification_enabled"},{type:g.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:d("Event history is saved to disk")},{type:g.Switch,readonly:!0,fieldBottomMargin:"0",title:d("Save signals"),name:"storage_enabled"},{type:g.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:d("Latest signal state is saved to disk")}]}]},{type:g.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:g.Paper,fieldBottomMargin:"1",fields:[{type:g.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:d("Strategy")},{type:g.Typography,placeholder:d("Broker")},{type:g.Outline,fieldBottomMargin:"3",fields:[{type:g.Checkbox,readonly:!0,fieldBottomMargin:"0",title:d("Connected to mainnet (production)"),name:"broker_enabled"}]},{type:g.Typography,placeholder:d("Market signals")},{type:g.Outline,fieldBottomMargin:"4",fields:[{type:g.Checkbox,readonly:!0,fieldBottomMargin:"0",title:d("Use BM25 for RAG"),name:"memory_enabled"},{type:g.Checkbox,readonly:!0,fieldBottomMargin:"0",title:d("Use stateful strategies"),name:"state_enabled"},{type:g.Checkbox,readonly:!0,fieldBottomMargin:"0",title:d("Save previous signal"),name:"recent_enabled"}]}]},{type:g.Paper,fieldBottomMargin:"1",fields:[{type:g.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:d("Risk management")},{type:g.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:d("Use LONG or SHORT positions depending on market conditions")},{type:g.Checkbox,readonly:!0,fieldBottomMargin:"0",title:d("Enable LONG"),name:"enable_long"},{type:g.Checkbox,readonly:!0,fieldBottomMargin:"1",title:d("Enable SHORT"),name:"enable_short"}]}]},{type:g.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const i=R();return t(v,{variant:"contained",size:"large",startIcon:t(B,{}),onClick:async()=>{await e.handleReload(),i()},children:d("Refresh")})}}],Q=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:d("Dashboard")},{type:l.Link,action:"back-action",label:d("Performance")},{type:l.Link,action:"back-action",label:d("Settings")},{type:l.Button,action:"update-now",label:d("Refresh"),icon:B}],Z=[{action:"update-now",label:d("Refresh"),icon:()=>t(s,{icon:B,color:"#4caf50"})}],ee=new o,te=async()=>{n.setupViewService.getSetupData.clear(),await ee.next()},ie=async()=>{const{config:e}=await n.setupViewService.getSetupData(),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`config_${Date.now()}.json`)},ne=[{id:"search",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.performanceViewService.getPerformanceData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Y.subscribe(o));const[s,{execute:d,loading:c}]=i(async()=>await n.environmentViewService.getEnvironmentData());a(()=>Y.subscribe(d));return t(I,{children:[t(r,{items:G,actions:K,onAction:async e=>{"back-action"===e&&n.routerService.push("/main"),"setup-action"===e&&n.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{n.performanceViewService.getPerformanceData.clear(),n.performanceViewService.getPerformanceReport.clear(),n.environmentViewService.getEnvironmentData.clear(),await Y.next()})(),"download-markdown"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport();await u(e)})(),"download-json"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),i=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(i);n.layoutService.downloadFile(a,`performance_${Date.now()}.json`)})()}}),e&&s?l||c?null:t(f,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:s.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:U}):null]})},isActive:e=>L(["/about"],e)},{id:"main",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.setupViewService.getSetupData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>ee.subscribe(o));return t(I,{children:[t(r,{items:Q,actions:Z,onAction:async e=>{"back-action"===e&&n.routerService.push("/about"),"update-now"===e&&await te()}}),e?l?null:t(f,{handler:e,payload:()=>({handleReload:te,handleDownloadConfig:ie}),fields:J}):null]})},isActive:e=>L(["/about/setup"],e)}],ae=()=>t(N,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:ne});export{ae as AboutPage,ae as default};
@@ -0,0 +1 @@
1
+ import{P as e,f as t,t as n,c as r,r as i,i as o,S as a,F as l,a as c}from"./index-WrZQf7cw.js";const[s,u]=e("pine-code-context"),d=e=>t(s,{initialState:'//@version=5\nindicator("Simple MA", overlay=true)\n\nlength = input.int(20, "Length")\nsma = ta.sma(close, length)\n\nplot(sma, "SMA", color.blue, linewidth=2)',children:e.children}),[v,h]=e("pine-from-date-context"),m=e=>t(v,{initialState:"",children:e.children}),[p,g]=e("pine-limit-context"),f=e=>t(p,{initialState:250,children:e.children}),[y,b]=e("pine-symbol-context"),C=e=>t(y,{initialState:"BTCUSDT",children:e.children}),[D,x]=e("pine-timeframe-context"),S=e=>t(D,{initialState:"1",children:e.children}),[w,T]=e("pine-to-date-context"),k=e=>t(w,{initialState:"",children:e.children}),R=r(e=>t("div",{style:e.v0,children:[t("input",{type:"text",value:e.v1,onChange:e.v2,style:e.v3,placeholder:"BTCUSDT"}),t("select",{value:e.v4,onChange:e.v5,style:e.v6,children:e.v7}),t("input",{type:"number",value:e.v8,min:100,step:100,onChange:e.v9,style:e.v10,title:e.v11}),t("input",{type:"date",value:e.v12,onChange:e.v13,style:e.v14,title:e.v15}),t("input",{type:"date",value:e.v16,onChange:e.v17,style:e.v18,title:e.v19}),t("button",{onClick:e.v20,disabled:e.v21,style:e.v22,children:e.v23}),e.v24]}),{name:"Toolbar_1",portals:["v7","v23","v24"]}),z=function({symbol:e,timeframe:r,fromDate:i,toDate:o,limit:a,running:l,status:c,onSymbolChange:s,onTimeframeChange:u,onFromDateChange:d,onToDateChange:v,onLimitChange:h,onRun:m}){return t(R,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>s(e.target.value.toUpperCase()),v3:{...B,width:100},v4:r,v5:e=>u(e.target.value),v6:B,v7:F.map(e=>t("option",{children:e},e)),v8:a,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:n("Bars limit"),v12:i,v13:e=>d(e.target.value),v14:$,v15:n("From date"),v16:o,v17:e=>v(e.target.value),v18:$,v19:n("To date"),v20:m,v21:l,v22:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v23:l?"...":n("▶ Run"),v24:c&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:c})})},F=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},$={...B,colorScheme:"dark"},U=r(e=>t("textarea",{value:e.v0,onChange:e.v1,onKeyDown:e.v2,spellCheck:!1,style:e.v3}),{name:"CodeEditor_1"}),E=function({value:e,onChange:n,onRun:r}){return t(U,{v0:e,v1:e=>n(e.target.value),v2:e=>{e.ctrlKey&&"Enter"===e.key&&(e.preventDefault(),r())},v3:{width:320,flexShrink:0,resize:"none",background:"#1e293b",color:"#e2e8f0",border:"none",borderRight:"1px solid #334155",padding:12,fontFamily:"monospace",fontSize:13,lineHeight:1.5,outline:"none"}})},L={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h",360:"6h",480:"8h","1D":"1d",D:"1d"};function I(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class M{async getMarketData(e,t,n,r,i){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=L[t]??t;return(await o.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:i})).map(e=>({openTime:e.timestamp,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}))}async getSymbolInfo(e){const t=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),n=t.replace(/USDT$|BUSD$|USD$/,""),r=t.replace(n,"");return{ticker:t,tickerid:t,description:`${n}/${r}`,type:"crypto",basecurrency:n,currency:r||"USDT",timezone:"UTC"}}}const P=()=>t(a,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),A=()=>{const e=i.useRef(null),[r,o]=u(),[a,c]=b(),[s,d]=x(),[v,m]=h(),[p,f]=T(),[y,C]=g(),{run:D,status:S,running:w}=function(){const e=i.useRef(null),t=i.useRef(null),r=i.useRef(null),[o,a]=i.useState(""),[l,c]=i.useState(!1);function s(){if(r.current){try{r.current.stop()}catch{}r.current=null}}function u(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function d(e){a(`${n("Error")}: ${e.message}`),c(!1)}return i.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),s(),u()}},[]),{run:function({symbol:i,timeframe:o,fromDate:l,toDate:v,limit:h,code:m,containerRef:p}){if(!p.current)return;c(!0),a(n("Connecting...")),s(),u();const g=/indicator\([^)]*overlay\s*=\s*true/i.test(m);let f=!1;try{const s=l?new Date(l).getTime():void 0,u=v?new Date(v).getTime():void 0,y=new M,b=new PineTS(y,i,o,h,s,u).stream(m,{pageSize:500,live:!0,interval:3e3});r.current=b,b.on("data",l=>{var s,u;if(r.current===b)if(f)t.current&&l.plots&&t.current.updateData(l.plots),null==(u=e.current)||u.updateData([I(l.marketData[l.marketData.length-1])]);else{f=!0;const r=l.marketData.map(I);p.current.innerHTML="",e.current=new QFChart.QFChart(p.current,{title:`${i} · ${o}`,backgroundColor:"#0f172a",height:"100%",padding:.1,databox:{position:"right",triggerOn:"mousemove"},dataZoom:{visible:!0,position:"top",height:6,start:80,end:101},layout:{mainPaneHeight:"70%",gap:5},controls:{collapse:!1,maximize:!1,fullscreen:!1}}),e.current.setMarketData(r);const u=(null==(s=l.fullContext)?void 0:s.plots)??l.plots;t.current=e.current.addIndicator("indicator",u,{overlay:g,height:g?void 0:30,controls:{collapse:!1,maximize:!1}}),e.current.registerPlugin(new QFChart.MeasureTool),e.current.registerPlugin(new QFChart.LineTool),e.current.registerPlugin(new QFChart.FibonacciTool),a(`${r.length} ${n("bars loaded")}`),c(!1)}}),b.on("error",d)}catch(y){d(y)}},status:o,running:l}}();function k(){D({symbol:a,timeframe:s,fromDate:v,toDate:p,limit:y,code:r,containerRef:e})}return t(l,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(z,{symbol:a,timeframe:s,fromDate:v,toDate:p,limit:y,running:w,status:S,onSymbolChange:c,onTimeframeChange:d,onFromDateChange:m,onToDateChange:f,onLimitChange:C,onRun:k}),t("div",{style:{display:"flex",flex:1,overflow:"clip"},children:[t(E,{value:r,onChange:o,onRun:k}),t("div",{style:{flex:1},children:t("div",{ref:e,style:{width:"100%",height:"100%"},children:t("p",{style:{color:"#475569",textAlign:"center",marginTop:"20%"},children:[n("Press")," ",t("b",{children:n("▶ Run")})," ",n("or")," ",t("b",{children:"Ctrl+Enter"})," ",n("to load the chart")]})})})]}),t(P,{})]})})},N=c(e=>t(d,{children:e}),e=>t(m,{children:e}),e=>t(k,{children:e}),e=>t(f,{children:e}),e=>t(C,{children:e}),e=>t(S,{children:e})),Q=()=>N(t(A,{}));export{Q as PinePage,Q as default};
@@ -0,0 +1 @@
1
+ import{d as e,f as t,i as o,aw as a,O as n,ax as l,r as i,ay as r,q as s,T as c,t as d,Q as p,c as u,l as m,w as h,az as g,aA as f,aB as y,B as v,ao as b,aC as x,aD as C,aE as k,aF as w,aG as P,aH as S,aI as L,aJ as M,a3 as N,ag as $,I as R,ad as T,J as D,aK as j,K as B,a5 as I,$ as V,X as A,A as E,aL as O,G as z,a9 as F,V as U,W,D as H,aM as G,aN as Y,Y as _}from"./index-WrZQf7cw.js";import{I as K}from"./IconPhoto-CtWTATuX.js";import{C as J,R as X}from"./Refresh-KIrQPPBf.js";import{K as q}from"./KeyboardArrowLeft-C3lIqTl8.js";const Q=e(t("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 10V8h-2v4H8l4 4 4-4h-3z"}),"ArrowCircleDown"),Z=e(t("path",{d:"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0 2c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm-1-10v4h2v-4h3l-4-4-4 4h3z"}),"ArrowCircleUp"),ee=e(t("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixHigh"),te=e(t("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle"),oe=l(async e=>"live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),{key:([e])=>`${e}`,timeout:45e3}),ae=async(e,t)=>(await oe(t)).filter(t=>"closed"===t.status&&t.symbol===e),ne=async(e,t)=>{const o=await ae(e,t);return{total:o.length,resolvedCount:o.filter(e=>e.pnl.pnlPercentage>0).length,rejectedCount:o.filter(e=>e.pnl.pnlPercentage<=0).length}},le=async(e,t)=>{const o=await ae(e,t),a=e=>Math.abs(e.pnl.priceClose-e.priceTakeProfit)/e.priceTakeProfit<.005,n=e=>Math.abs(e.pnl.priceClose-e.priceStopLoss)/e.priceStopLoss<.005;return{resolvedTakeProfitCount:o.filter(e=>e.pnl.pnlPercentage>0&&a(e)).length,rejectedStopLossCount:o.filter(e=>e.pnl.pnlPercentage<=0&&n(e)).length,resolvedCloseCount:o.filter(e=>e.pnl.pnlPercentage>0&&!a(e)).length,rejectedCloseCount:o.filter(e=>e.pnl.pnlPercentage<=0&&!n(e)).length}},ie=async(e,t)=>{const o=await ae(e,t),l=new Map;for(const i of o){const e=a(n(i.updatedAt)),t=l.get(e)??{resolved:0,rejected:0};i.pnl.pnlPercentage>0?l.set(e,{...t,resolved:t.resolved+1}):l.set(e,{...t,rejected:t.rejected+1})}return Array.from(l.entries()).map(([e,{resolved:t,rejected:o}])=>({stamp:e,count:t+o,resolved:t,rejected:o}))},re=async(e,t)=>{const o=await ae(e,t),a="backtest"===t&&o.length?o.reduce((e,t)=>Math.max(e,t.updatedAt),0):Date.now(),l=n(a).startOf("day").valueOf(),i=l-864e5,r=l-6048e5,s=l-26784e5,c=e=>e.reduce((e,t)=>e+t.pnl.pnlCost,0),d=o.filter(e=>e.updatedAt>=l),p=o.filter(e=>e.updatedAt>=i&&e.updatedAt<l),u=o.filter(e=>e.updatedAt>=r),m=o.filter(e=>e.updatedAt>=s);return{symbol:e,todayRevenue:c(d),yesterdayRevenue:c(p),sevenDaysRevenue:c(u),thirtyOneDaysRevenue:c(m),todayCount:d.length,yesterdayCount:p.length,sevenDaysCount:u.length,thirtyOneDaysCount:m.length}};var se=(e=>(e.Red="#DD4049",e.Orange="#F3A43A",e.Green="#2EA96F",e.Blue="#2979ff",e.Violet="#d500f9",e))(se||{});const ce=i.createContext(null),de=({value:e,children:o})=>t(ce.Provider,{value:e,children:o}),pe=()=>i.useContext(ce);var ue=(e=>(e.Semi="semi",e.Solid="solid",e.Unset="unset",e))(ue||{});const me=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"stretch",whiteSpace:"nowrap",gap:"8px",overflow:"clip",padding:"10px",borderTop:`1px solid ${e.palette.divider}`,"& > *":{flex:1}},solidBackground:{color:"#fff","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}},semiBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}}})),he=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=me(),{footerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...s===ue.Solid&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},ge=(e,t=2)=>{let o=1;for(let a=0;a<t;a++)o*=10;return Math.round(e*o)/o},fe=s()({root:{position:"relative",width:"100%",height:"0px"},container:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}),ye=({caption:e})=>{const{classes:o}=fe();return t("div",{className:o.root,children:t("div",{className:o.container,children:t(c,{variant:"caption",sx:{opacity:.5,fontSize:12,textAlign:"center",padding:"0 8px"},children:e})})})},ve=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},solidBackground:{"& > :first-of-type":{color:"#fff",fontWeight:"bold"},"& > :last-of-type":{color:"#fff"}},unsetBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},semiBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},content:{display:"flex",alignItems:"baseline",flexDirection:"row",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),be=u(e=>t("div",{className:e.v0,style:e.v1,children:[t("div",{className:e.v2,children:[e.v3,e.v4]}),e.v5]}),{name:"Content_1",portals:["v3","v4","v5"]}),xe=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=ve(),{backgroundMode:l=ue.Solid,roundDigits:s=2,value:u,caption:m,valueUnit:h=d("Unit")}=pe(),g=i.useMemo(()=>({...o,...l===ue.Solid&&{backgroundColor:a}}),[a,l,o]);return t(be,{v0:r(e,n.root),v1:g,v2:r(n.content,{[n.solidBackground]:l===ue.Solid,[n.unsetBackground]:l===ue.Unset,[n.semiBackground]:l===ue.Semi}),v3:t(c,{fontWeight:"bold",children:p(ge(u,s))}),v4:t(c,{children:h}),v5:!!m&&t(ye,{caption:m})})},Ce=s()(e=>({root:{display:"flex",alignItems:"center",whiteSpace:"nowrap",fontWeight:700,fontSize:"18px",paddingLeft:"8px",gap:"8px",overflow:"clip",borderBottom:`1px solid ${e.palette.divider}`},solidBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},semiBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,padding:"10px","& svg":{fill:e.palette.text.primary}}})),ke=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=Ce(),{headerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...(s===ue.Solid||s===ue.Semi)&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},we=s()({root:{overflow:"clip",height:"100%",width:"100%",display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},click:{cursor:"pointer"},header:{minHeight:"36px"},content:{flex:1},footer:{minHeight:"32px"}}),Pe=({className:e,style:o})=>{const{classes:a}=we(),{backgroundColor:n,onClick:l,footerLabel:i}=pe();return t(m,{className:r(e,a.root,{[a.click]:!!l}),onClick:l,style:o,children:[t(ke,{backgroundColor:n}),t(xe,{backgroundColor:n,className:a.content}),!!i&&t(he,{backgroundColor:n,className:a.footer})]})},Se=i.memo(({className:e,style:o,...a})=>t(de,{value:a,children:t(Pe,{className:e,style:o})})),Le=(e,{one:t,many:o,two:a=o})=>`${(()=>{const n=Math.abs(Math.trunc(e));if(n%100>=11&&n%100<=14)return o;const l=n%10;return 1===l?t:l>=2&&l<=4?a:o})()}`,Me=i.createContext(null),Ne=({value:e,children:o})=>t(Me.Provider,{value:e,children:o}),$e=()=>i.useContext(Me),Re=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",paddingLeft:"20px",paddingRight:"20px",overflow:"clip"},container:{flex:1,display:"flex",alignItems:"stretch",justifyContent:"center",gap:"40px"},item:{gap:"4px",display:"flex",alignItems:"center",justifyContent:"center","& > span":{fontWeight:500,fontSize:"12px",color:"var(--black-6)",whiteSpace:"nowrap"}},circle:{borderRadius:"50%",height:"8px",width:"8px"}}),Te=u(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Footer_1",portals:["v3"]}),De=({className:e,style:o})=>{const{classes:a}=Re(),{items:n}=$e();return t(Te,{v0:r(e,a.root),v1:o,v2:a.container,v3:[...n].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,o)=>t("div",{className:a.item,children:[t("div",{className:a.circle,style:{background:e.color}}),t("span",{children:[e.label," ",e.value?e.value():e.maxValue]})]},o))})},je=s()(()=>({circle:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%","& > div":{borderRadius:"50%"}}})),Be=u(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{style:e.v2})}),{name:"Circle_1"}),Ie=({className:e,style:o,lineWidth:a,side:n,color:l,rotate:i})=>{const{classes:s}=je();return t(Be,{v0:r(e,s.circle),v1:{...o},v2:{borderTop:`${a}px solid ${l}`,borderLeft:`${a}px solid ${l}`,borderRight:`${a}px solid transparent`,borderBottom:`${a}px solid transparent`,transform:`rotate(${i}deg)`,height:n,width:n}})},Ve=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",background:e.palette.background.paper}})),Ae=({side:e})=>{const{classes:o}=Ve();return t("div",{className:o.dot,style:{height:e,width:e}})},Ee=s()(e=>({line:{position:"absolute",background:e.palette.background.paper,height:"100%",width:"1px",left:"50%",transformOrigin:"center bottom"}})),Oe=({angle:e})=>{const{classes:o}=Ee();return t("div",{className:o.line,style:{transform:`rotate(${e}deg)`}})},ze=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",outline:`100vmax solid ${e.palette.background.paper}`}})),Fe=({side:e})=>{const{classes:o}=ze();return t("div",{className:o.dot,style:{height:e,width:e}})},Ue=s()(e=>({pointer:{position:"absolute",left:"21%",width:"29%",bottom:"0%",zIndex:1,transformOrigin:"right center",fill:e.palette.text.primary}})),We=u(e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 87 8",className:e.v0,style:e.v1,...e.v2,children:[t("rect",{x:"0.5",y:"2.5",width:"79",height:"3"}),t("circle",{cx:"82.5",cy:"4",r:"4"})]}),{name:"Pointer_1",svg:!0}),He=({className:e,style:o,angle:a,scale:n=1,...l})=>{const{classes:i}=Ue();return t(We,{v0:r(e,i.pointer),v1:{...o,transform:`rotate(${a}deg) scale(${n}) translateX(5px)`},v2:l})},Ge=e=>e*Math.PI/180,Ye=(e,t)=>({left:t*Math.cos(Ge(e))+t,top:t*Math.sin(Ge(e))+t}),_e=s()(e=>({root:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",display:"flex",alignItems:"stretch",justifyContent:"stretch"},container:{flex:1,position:"relative"},label:{position:"absolute",transform:"translate(-50%, -50%)",color:e.palette.text.primary,zIndex:2}})),Ke=u(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Labels_1",portals:["v3"]}),Je=({items:e,side:o})=>{const{classes:a}=_e(),n=i.useMemo(()=>Math.floor(o/2),[o]);return t(Ke,{v0:a.root,v1:{height:o,width:o},v2:a.container,v3:e.slice(0,e.length-1).map(({angle:e,value:o},l)=>t("span",{className:a.label,style:{...Ye(e+180,n),...e<90&&{marginLeft:10},...e>90&&{marginLeft:-10},...e>15&&e<165&&{marginTop:5}},children:o},l))})},Xe=({width:e,side:o,chunks:a,maxValue:n,minValue:l,value:r})=>{const s=i.useMemo(()=>.5*o,[o]),c=i.useMemo(()=>.63*o,[o]),d=i.useMemo(()=>.58*o,[o]),p=i.useCallback(e=>180/(n-l)*(e.minValue-l)+45,[n,l]),u=i.useMemo(()=>Math.min(r/n*180,180),[n,r]),m=i.useMemo(()=>e>o?c/e*1.5:1,[c,e,o]),g=i.useMemo(()=>[...a].sort(({maxValue:e},{maxValue:t})=>e-t).slice(0,a.length-1).map(e=>({angle:180/n*e.maxValue,value:e.maxValue})),[a,n]),f=i.useMemo(()=>[{angle:0,value:0},...g,{angle:180,value:n}],[g,n]);return t(h,{children:[t(He,{angle:u,scale:m}),[...a].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,a)=>t(Ie,{rotate:p(e),color:e.color,side:o,lineWidth:s},`${e.color}-${a}`)),g.map(({angle:e},o)=>t(Oe,{angle:e-90},`${e}-${o}`)),t(Fe,{side:o}),t(Ae,{side:c}),t(Je,{items:f,side:d})]})},qe=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",overflow:"clip"},container:{flex:1,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},bottomCenterLabel:{position:"absolute",zIndex:2,bottom:"0",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:"4px","& > *":{fontSize:"20px",lineHeight:"24px"},"& > :first-of-type":{fontWeight:"bold"},"& > :last-of-type":{color:"var(--black-6)"}}}),Qe=({className:e,height:o,width:a})=>{const{classes:n}=qe(),{value:l,items:s}=$e(),c=Math.min(2*o,a),d=i.useMemo(()=>[...s].filter(e=>!e.hidden).sort(({maxValue:e},{maxValue:t})=>t-e).map((e,t,o)=>{const a=o[t+1],n=a?a.maxValue:0;return{...e,minValue:n,value:e.maxValue-n}}),[s]),p=i.useMemo(()=>{if(!d.length)return"#ccc";const e=d.find(({minValue:e,maxValue:t})=>l>=e&&l<=t);if(e)return e.color;const t=d[0],o=d[d.length-1];return l>t.maxValue?t.color:o.color},[d,l]),u=i.useMemo(()=>d.reduce((e,{minValue:t})=>Math.min(e,t),Number.POSITIVE_INFINITY),[d]),m=i.useMemo(()=>d.reduce((e,{maxValue:t})=>Math.max(e,t),Number.NEGATIVE_INFINITY),[d]);return t("div",{className:r(e,n.root),children:t("div",{className:n.container,children:t(Xe,{chunks:d,value:l,minValue:u,maxValue:m,side:c,width:a,color:p})})})},Ze=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",borderLeft:0,borderRight:0,borderWidth:"1px 0",borderStyle:"solid",borderColor:e.palette.divider},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row"},content:{display:"flex",alignItems:"baseline",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),et=u(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:t("div",{className:e.v3,children:[e.v4,e.v5]})})}),{name:"Note_1",portals:["v4","v5"]}),tt=({className:e,style:o})=>{const{classes:a}=Ze(),{value:n,roundDigits:l=3,valueUnit:i=d("Unit")}=$e();return t(et,{v0:r(e,a.root),v1:o,v2:a.container,v3:a.content,v4:t(c,{children:ge(n,l)}),v5:t(c,{children:i})})},ot=s()(e=>({root:{position:"relative",overflow:"clip",height:"100%",width:"100%",background:e.palette.background.paper},container:{position:"absolute",top:"0",left:"0"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},chart:{flex:1,paddingTop:"6px",paddingBottom:"6px"},footer:{minHeight:"32px"},note:{minHeight:"60px"}})),at=({className:e,style:o})=>{const{classes:a}=ot(),n=e=>{let t=e;return t-=32,t-=12,t-=60,t},l=e=>{let t=e;return t-=12,t};return t(m,{className:r(e,a.root),style:o,children:t(g,{className:a.container,children:({height:e=0,width:o=0})=>t("div",{className:a.content,style:{height:e,width:o},children:[t(Qe,{className:a.chart,height:n(e),width:l(o)}),t(tt,{className:a.note}),t(De,{className:a.footer})]})})})},nt=i.memo(({className:e,style:o,...a})=>t(Ne,{value:a,children:t(at,{className:e,style:o})})),lt=s()({root:{position:"relative",height:10,flex:1},bar:{position:"absolute !important",top:"42%",left:0,right:10}}),it=e=>{const{classes:o}=lt(),a=["done","inprogress","waiting","archive"],n=t=>{var o;return null==(o=e.data[t])?void 0:o.value},l=a.map(t=>{const o=n(t);var a,l;return`${a=t,(null==(l=e.data[a])?void 0:l.title)||t} - ${o}`}).join(" | "),i=a.map(t=>{const o=(t=>{var o;return null==(o=e.data[t])?void 0:o.color})(t);return{color:o,value:n(t),key:t}}).map(({color:e,value:t,key:o},l)=>{let i=0;if(0!==l)for(let r=l-1;r>=0;r--)i+=n(a[r]);return{value:t>0?t+i:t,key:o,color:e}}).sort(({value:e},{value:t})=>t-e),r=Math.max(...i.map(({value:e})=>e));return t(y,{title:l,arrow:!0,children:t("div",{className:o.root,children:i.map(({color:e,value:a,key:n},l)=>{const i=((e,t=100)=>Math.min(100,Math.round(Math.max(Number(e),0)/t*100)))(a,r);return t(f,{sx:{height:"10px !important",zIndex:`${l+1} !important`,backgroundColor:"transparent !important","& .MuiLinearProgress-bar":{borderTopRightRadius:5,borderBottomRightRadius:5,backgroundColor:`${e} !important`}},variant:"determinate",className:o.bar,value:i},`${l}-${n}`)})})})},rt=s()({root:{display:"flex"},work:{display:"flex",alignItems:"center"},row:{flex:1,paddingLeft:5,paddingRight:5,paddingBottom:15}}),st=({title:e,description:o,avatar:a,done:n,inprogress:l,waiting:i,archive:r})=>{const{classes:s}=rt();return t(v,{className:s.root,children:t(v,{className:s.row,children:[t(v,{className:s.work,children:[t(a,{}),t(b,{primary:e,secondary:o,sx:{flex:"none",marginLeft:"0.5em"}})]}),t(v,{flex:"1",children:t(it,{data:{done:{color:"#7FB537",title:d("Take profit"),value:n},inprogress:{color:"#4FC0E8",title:d("Resolved"),value:l},waiting:{color:"#FE9B31",title:d("Rejected"),value:i},archive:{color:"#FA5F5A",title:d("Stop loss"),value:r}}})})]})})},ct=s()({root:{position:"relative",width:"100%"},container:{position:"absolute",top:0,height:"100%",width:"100%",overflowY:"auto",overflowX:"hidden"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"}}),dt=({items:e,sx:o})=>{const{classes:a}=ct();return t(m,{className:a.root,sx:o,children:[t(x,{disableRight:!0,color:"#fff",className:a.container,children:t("div",{className:a.content,children:e.map((e,o)=>t(st,{...e},o))})}),t(v,{sx:{position:"absolute",bottom:10,right:10,zIndex:10,pointerEvents:"auto",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(10px)",borderRadius:"12px",border:"1px solid rgba(255, 255, 255, 0.2)",padding:"12px 16px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.1)",opacity:.35,transition:"opacity 0.3s ease","&:hover":{opacity:1}},children:[t(v,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#7FB537",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:d("Take profit")})]}),t(v,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#4FC0E8",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:d("Resolved")})]}),t(v,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FE9B31",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:d("Rejected")})]}),t(v,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FA5F5A",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:d("Stop loss")})]})]})]})},pt=s()({root:{position:"relative"},tooltip:{position:"absolute",color:"gray",margin:0,left:5,top:5}}),ut={layout:{textColor:"#d1d4dc",backgroundColor:"#0000"},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}},mt={color:"#90cbfa",lineWidth:2,crosshairMarkerVisible:!1,lastValueVisible:!1,priceLineVisible:!1},ht=({height:e,width:o,items:a})=>{const{classes:n}=pt(),l=i.useRef(void 0),r=i.useRef(void 0);return i.useLayoutEffect(()=>{const{current:t}=l,{current:n}=r,i=C(t,{...ut,height:e,width:o});i.addLineSeries({...mt}).setData(a);const s=({time:e})=>{if(e)try{const{day:t,month:o,year:l}=e,i=a.find(({time:e})=>e.day===t&&e.month===o&&e.year===l);if(i){const e=Math.round(Math.round(100*i.value)/100);n.innerHTML=`${d("Total")}: ${e}, ${d("Resolved")}: ${i.resolved}, ${d("Rejected")}: ${i.rejected}`}else n.innerHTML=""}catch(t){console.log(t),n.innerHTML=""}else n.innerHTML=""};return i.timeScale().fitContent(),i.subscribeCrosshairMove(s),()=>{i.unsubscribeCrosshairMove(s),i.remove()}},[e,o,a]),t("div",{ref:l,className:n.root,children:t("p",{ref:r,className:n.tooltip})})},gt=({items:e})=>t(g,{children:({height:o,width:a})=>t(ht,{height:o,width:a,items:e})}),ft=s()({root:{},container:{position:"relative",margin:0,padding:0,overflow:"clip"},editor:{position:"absolute",top:0,left:0,right:0,bottom:0}}),yt=({items:e,sx:o})=>{const{classes:a}=ft(),n=i.useMemo(()=>[...e].sort(({stamp:e},{stamp:t})=>e-t).map(({count:e,rejected:t,resolved:o,stamp:a})=>{const n=k(a);return{time:{year:n.get("year"),month:n.get("month")+1,day:n.get("date")},rejected:t,resolved:o,value:e}}),[e]);return t(m,{className:a.container,sx:o,children:t("div",{className:a.editor,children:t(gt,{items:n})})})},vt=e=>P({handler:async(t,a)=>{const n=S(t,a);for await(const l of(e=>w(async()=>{const t="live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),a=t.filter(e=>"closed"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"finished"}));return"backtest"===e?a:[...t.filter(e=>"opened"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"pending"})),...a]}))(e))if(n([l]).done)break;return n([]).rows}}),bt=[{field:"color",label:B.nbsp,minWidth:45,width:()=>45,format:({symbol:e})=>t(A,{children:async()=>{var a;try{const n=await o.symbolGlobalService.getSymbolMap();return t(te,{sx:{color:(null==(a=n[e])?void 0:a.color)||"#ccc"}})}catch(n){return t(te,{sx:{color:"#ccc"}})}}})},{field:"symbol",label:d("Symbol"),minWidth:115,width:e=>Math.max(e-45-90-145-80-90-80,45),format:({symbol:e})=>t(v,{sx:{width:"75px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})},{field:"position",label:d("Position"),minWidth:90,width:()=>90,format:({position:e})=>{const o="long"===e;return t("span",{style:{color:o?"#1976D2":"#F57C00",padding:"4px 8px",borderRadius:"4px",fontWeight:"bold",fontSize:"11px"},children:o?"🔵 LONG":"🟠 SHORT"})}},{field:"buyPrice",label:d("Entry"),minWidth:145,width:()=>145,format:({buyPrice:e})=>`${p(e)}${d("$")}`},{field:"pnlEntries",label:d("Invested"),minWidth:80,width:()=>80,format:({pnlEntries:e})=>`${p(e)}${d("$")}`},{field:"profitLossPercentage",label:d("PNL %"),minWidth:90,width:()=>90,format:({profitLossPercentage:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",e.toFixed(2),"%"]})}},{field:"pnlCost",label:d("PNL $"),minWidth:80,width:()=>80,format:({pnlCost:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",p(e),"$"]})}}],xt=[{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:d("Symbol"),readonly:!0,compute:e=>e.symbol||d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"position",title:d("Position"),readonly:!0,compute:e=>"long"===e.position?`🔵 ${d("LONG (profit on rise)")}`:`🟠 ${d("SHORT (profit on fall)")}`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"date",title:d("Date"),readonly:!0,compute:e=>e.date?n(e.date).format("DD/MM/YYYY HH:mm"):""},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"buyPrice",title:d("Entry"),readonly:!0,compute:e=>e.buyPrice?`${p(e.buyPrice)}${d("$")}`:d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalBuyPrice",title:d("Original Entry"),readonly:!0,isVisible:e=>null!=e.originalBuyPrice&&e.originalBuyPrice!==e.buyPrice,compute:e=>e.originalBuyPrice?`${p(e.originalBuyPrice)}${d("$")}`:d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"takeProfitPrice",title:d("Take Profit"),readonly:!0,compute:e=>e.takeProfitPrice?`${p(e.takeProfitPrice)}${d("$")}`:d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalTakeProfitPrice",title:d("Original Take Profit"),readonly:!0,isVisible:e=>null!=e.originalTakeProfitPrice&&e.originalTakeProfitPrice!==e.takeProfitPrice,compute:e=>e.originalTakeProfitPrice?`${p(e.originalTakeProfitPrice)}${d("$")}`:d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"stopLossPrice",title:d("Stop Loss"),readonly:!0,compute:e=>e.stopLossPrice?`${p(e.stopLossPrice)}${d("$")}`:d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalStopLossPrice",title:d("Original Stop Loss"),readonly:!0,isVisible:e=>null!=e.originalStopLossPrice&&e.originalStopLossPrice!==e.stopLossPrice,compute:e=>e.originalStopLossPrice?`${p(e.originalStopLossPrice)}${d("$")}`:d("N/A")},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlEntries",title:d("Invested"),readonly:!0,compute:e=>`${p(e.pnlEntries)}${d("$")}`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"profitLossPercentage",title:d("PNL %"),readonly:!0,trailingIcon:({data:e})=>e.profitLossPercentage<0?t(Q,{sx:{color:"red"}}):t(Z,{sx:{color:"green"}}),compute:e=>`${e.profitLossPercentage>=0?"+":""}${e.profitLossPercentage.toFixed(2)}%`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlCost",title:d("PNL $"),readonly:!0,compute:e=>`${e.pnlCost>=0?"+":""}${p(e.pnlCost)}${d("$")}`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalEntries",title:d("Total Entries"),readonly:!0,isVisible:e=>null!=e.totalEntries&&e.totalEntries>1,compute:e=>String(e.totalEntries)},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalPartials",title:d("Total Closes"),readonly:!0,isVisible:e=>null!=e.totalPartials&&e.totalPartials>0,compute:e=>String(e.totalPartials)},{type:N.Component,sx:{mt:2},element:({payload:e})=>t(I,{variant:"outlined",onClick:e.handleClose,children:d("Back")})}],Ct=[{label:d("Details"),icon:()=>t(V,{icon:ee,color:"#4caf50"}),action:"open-action"}],kt=({sx:e,mode:a})=>{const n=vt(a),[l,i]=L(null),{pickData:r,setOpen:s,render:c}=M({title:d("Info"),AfterTitle:({onClose:e})=>t(D,{direction:"row",gap:2,children:[t($,{onClick:()=>o.layoutService.pickSignal(l.current.id),variant:"outlined",children:d("Show Details")}),t(R,{size:"small",onClick:e,children:t(T,{})})]}),payload:()=>({handleClose(){s(!1)}}),fields:xt,handler:()=>l.current,withActionButton:!1});return t(h,{children:[t(m,{sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column",background:"whitesmote",overflow:"clip",...e},children:t(j,{sx:{flex:1,background:"transparent !important"},rowColor:({status:e})=>"pending"===e?"#ffc40085":"transparent",hasMore:n.hasMore,loading:n.loading,onSkip:n.onSkip,data:n.data,columns:bt,rowActions:Ct,onRowClick:e=>{i(e),r(e.id)},onRowAction:(e,t)=>{"open-action"===e&&o.layoutService.pickSignal(t.id)}})}),c()]})},wt=[{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.thirtyOneDaysRevenue)||0,a=(null==e?void 0:e.thirtyOneDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:d("USDT"),headerLabel:d("31 days"),footerLabel:d("Profit for 31 days"),caption:`${a} ${Le(a,{one:d("trade"),many:d("trades")})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.sevenDaysRevenue)||0,a=(null==e?void 0:e.sevenDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:d("USDT"),headerLabel:d("7 days"),footerLabel:d("Profit for 7 days"),caption:`${a} ${Le(a,{one:d("trade"),many:d("trades")})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.yesterdayRevenue)||0,a=(null==e?void 0:e.yesterdayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:d("USDT"),headerLabel:d("Yesterday"),footerLabel:d("Yesterday's profit"),caption:`${a} ${Le(a,{one:d("trade"),many:d("trades")})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.todayRevenue)||0,a=(null==e?void 0:e.todayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:d("USDT"),headerLabel:d("Today"),footerLabel:d("Today's profit"),caption:`${a} ${Le(a,{one:d("trade"),many:d("trades")})}`})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({tradePerfomance:e})=>{const o=[{color:"#DD4049",label:d("Failed"),maxValue:Math.max(e.rejectedCount+1,1),value:()=>e.rejectedCount},{color:"#2EA96F",label:d("Successful"),maxValue:Math.max(e.rejectedCount+e.resolvedCount+2,2),value:()=>e.resolvedCount},{color:"#F3A43A",label:d("Total"),hidden:!0,maxValue:Math.max(e.total+3,3),value:()=>e.total}];return t(nt,{style:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o,valueUnit:Le(Math.abs(e.resolvedCount),{one:d("Successful signal"),many:d("Successful signals")}),value:e.resolvedCount})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({dailyTrades:e})=>t(yt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:e})},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({successRate:e})=>{const o=e.map(({symbol:e,displayName:o,rejectedCloseCount:a,rejectedStopLossCount:n,resolvedCloseCount:l,resolvedTakeProfitCount:i})=>({title:o||e,description:e,avatar:()=>t(K,{symbol:e}),done:i,archive:n,waiting:a,inprogress:l})).filter(({done:e,archive:t,waiting:o,inprogress:a})=>{let n=!1;return n=n||!!e,n=n||!!t,n=n||!!o,n=n||!!a,n});return t(dt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:e})=>t(kt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},mode:e.mode})}],Pt={rejectedCount:0,resolvedCount:0,total:0},St=[{action:"download-action",label:d("Download"),icon:()=>t(V,{icon:H,color:"#4caf50"})},{divider:!0},{action:"live-action",label:d("Switch to LIVE"),isVisible:e=>"backtest"===e,icon:()=>t(V,{icon:G,color:"#4caf50"})},{action:"backtest-action",label:d("Switch to BACKTEST"),isVisible:e=>"live"===e,icon:()=>t(V,{icon:Y,color:"#4caf50"})},{divider:!0},{action:"update-now",label:d("Refresh manually"),icon:()=>t(V,{icon:X,color:"#4caf50"})}],Lt=[{type:W.Link,action:"back-action",label:t(q,{sx:{display:"block"}})},{type:W.Link,action:"back-action",label:d("Main")},{type:W.Link,action:"back-action",label:d("Dashboard")},{type:W.Link,action:"back-action",compute:e=>`${d("KPI")} ${String(e).toUpperCase()}`}],Mt=new F,Nt=({mode:e="backtest"})=>{const[a,{loading:n,execute:l}]=E(async()=>{const t=await(async e=>{const t=await o.symbolGlobalService.getSymbolList(),a=await oe(e),n=new Set(a.map(e=>e.symbol));return t.forEach(e=>n.delete(e)),t.concat(Array.from(n))})(e),a=await o.symbolGlobalService.getSymbolMap(),n=new Map,l=[],i={...Pt};let r={symbol:"TOTAL",todayRevenue:0,yesterdayRevenue:0,sevenDaysRevenue:0,thirtyOneDaysRevenue:0,todayCount:0,yesterdayCount:0,sevenDaysCount:0,thirtyOneDaysCount:0};await Promise.all(t.map(async t=>{var o;const[s=[],c,d,p]=await Promise.all([ie(t,e),le(t,e),ne(t,e),re(t,e)]);for(const e of s){const t=n.get(e.stamp)||{count:0,resolved:0,rejected:0};n.set(e.stamp,{count:t.count+e.count,resolved:t.resolved+e.resolved,rejected:t.rejected+e.rejected})}l.push({...c,symbol:t,displayName:(null==(o=a[t])?void 0:o.displayName)||t}),i.rejectedCount+=d.rejectedCount,i.resolvedCount+=d.resolvedCount,i.total+=d.total,r.todayRevenue+=p.todayRevenue,r.yesterdayRevenue+=p.yesterdayRevenue,r.sevenDaysRevenue+=p.sevenDaysRevenue,r.thirtyOneDaysRevenue+=p.thirtyOneDaysRevenue,r.todayCount+=p.todayCount,r.yesterdayCount+=p.yesterdayCount,r.sevenDaysCount+=p.sevenDaysCount,r.thirtyOneDaysCount+=p.thirtyOneDaysCount}));return{dailyTrades:Array.from(n).map(([e,{count:t,resolved:o,rejected:a}])=>({stamp:e,count:t,resolved:o,rejected:a})),successRate:l,tradePerfomance:i,revenueCount:r}},{onLoadStart:()=>o.layoutService.setModalLoader(!0),onLoadEnd:()=>o.layoutService.setModalLoader(!1),deps:[e]}),{execute:i}=O(async()=>{const t=await oe(e),a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(a);o.layoutService.downloadFile(n,`signals_${e}_${Date.now()}.json`)},{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});z(()=>Mt.subscribe(l));return t(J,{children:[t(U,{items:Lt,actions:St,payload:e,onAction:async e=>{"download-action"===e&&await i(),"update-now"===e&&(oe.clear(),await Mt.next()),"live-action"===e&&o.routerService.push("/dashboard/live"),"backtest-action"===e&&o.routerService.push("/dashboard/backtest"),"back-action"===e&&o.routerService.push("/")}}),a?n?null:t(_,{handler:a,payload:()=>({handleUpdate(){Mt.next()},mode:e}),fields:wt}):null]})};export{Nt as DashboardPage,Nt as default};
@@ -0,0 +1 @@
1
+ import{r as e,f as a,l as r,B as i,J as n,aa as t,T as o,O as c,a4 as s,t as l,U as d,Q as p,w as m,N as u,M as y,aO as b,aP as v,aQ as h,aR as g,ad as x,aS as k,aT as $,aU as f,aV as P,aW as w,aX as C,aY as S,aZ as _,i as A,aG as O,a9 as N,aH as E,V as D,W as F,a_ as T,a$ as L,$ as z}from"./index-WrZQf7cw.js";import{C as B,R as j}from"./Refresh-KIrQPPBf.js";import{K as R}from"./KeyboardArrowLeft-C3lIqTl8.js";const I=e=>{const r={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(_,{sx:r});case"signal.closed":case"order_sync.close":case"close_pending.commit":return a(x,{sx:r});case"signal.scheduled":return a(f,{sx:r});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:r});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(C,{sx:r});case"breakeven.available":case"breakeven.commit":return a(S,{sx:r});case"activate_scheduled.commit":return a(P,{sx:r});case"trailing_stop.commit":case"trailing_take.commit":return a(w,{sx:r});case"order_sync.open":return"schedule"===e.orderType?a(f,{sx:r}):a(P,{sx:r});case"order_sync.check":return a($,{sx:r});case"risk.rejection":return a(g,{sx:r});case"error.info":case"error.validation":case"signal.info":return a(v,{sx:r});case"error.critical":return a(h,{sx:r});default:return a(b,{sx:r})}},U=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("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"order_sync.open":return`${l("schedule"===e.orderType?"Order Sync Placed":"Order Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"order_sync.close":return`${l("Order Sync Close")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"order_sync.check":return`${l("Order Sync Check")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("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} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;default:return l("Unknown")}},W=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"order_sync.open":return"schedule"===e.orderType?l("Order Sync Placed"):l("Order Sync Open");case"order_sync.close":return l("Order Sync Close");case"order_sync.check":return l("Order Sync Check");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")}},M=e=>"symbol"in e,V=e=>"position"in e,Y=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,H=e=>"pnlPercentage"in e,K=e=>"level"in e,Q=e=>"percentToClose"in e,q=e=>"currentPrice"in e,G=e=>"duration"in e,J=e=>"closeReason"in e,X=e=>"cancelReason"in e,Z=e=>"percentShift"in e,ee=e=>("order_sync.open"===e.type||"order_sync.check"===e.type)&&!!e.orderType,ae=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),re=e=>"message"in e,ie=e=>"rejectionNote"in e,ne=e=>"activePositionCount"in e,te=e=>"effectivePriceOpen"in e,oe=e=>"totalEntries"in e&&e.totalEntries>1,ce=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),se=e=>"totalPartials"in e&&e.totalPartials>0,le=e=>"cost"in e,de=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,pe=e=>"peakProfitPriceClose"in e,me=e=>"maxDrawdownPriceClose"in e,ue=e.forwardRef(({item:e,className:b,style:v,sx:h},g)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":return"#4CAF50";case"signal.closed":case"order_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"order_sync.open":return"schedule"===e.orderType?"#FF9800":"#4CAF50";case"order_sync.check":return"#3F51B5";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:b,style:v,ref:g,children:a(r,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":A.layoutService.pickRisk(e.id);break;case"signal.opened":A.layoutService.pickSignalOpened(e.id);break;case"signal.closed":A.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":A.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":A.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":A.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":A.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":A.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":A.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":A.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":A.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":A.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":A.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":A.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":A.layoutService.pickAverageBuyCommit(e.id);break;case"order_sync.open":A.layoutService.pickOrderSyncOpen(e.id);break;case"order_sync.close":A.layoutService.pickOrderSyncClose(e.id);break;case"order_sync.check":A.layoutService.pickOrderSyncCheck(e.id);break;case"cancel_scheduled.commit":A.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":A.layoutService.pickClosePending(e.id);break;case"signal.info":A.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...h},children:a(i,{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:I(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:U(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:W(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),H(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("PnL")}: ${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")}`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),K(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),X(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ee(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"order_sync.check"===e.type?e.orderType.toUpperCase():l("schedule"===e.orderType?"Order placed":"Order filled"),variant:"outlined",color:"schedule"===e.orderType?"warning":"success"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),se(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),le(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}${l("$")}`:l("N/A")}`,variant:"outlined"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):l("N/A")}`,variant:"outlined",color:"warning"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):l("N/A")}`,variant:"outlined"})]}),Y(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[q(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):l("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)):l("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)):l("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("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):l("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)):l("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))}${l("$")}`:l("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))}${l("$")}`:l("N/A")]})]})]}),pe(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)):l("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)):l("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))}${l("$")}`:l("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))}${l("$")}`:l("N/A")]})]})]}),me(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)):l("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)):l("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))}${l("$")}`:l("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))}${l("$")}`:l("N/A")]})]})]})]})]}),ae(e)&&a(i,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(i,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(y,{content:e.note})})]}),ie(e)&&a(i,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),re(e)&&!ae(e)&&a(i,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(i,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),ye=[{action:"update-now",label:l("Refresh manually"),icon:()=>a(z,{icon:j,color:"#4caf50"})}],be=[{type:F.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:F.Link,action:"back-action",label:l("Main")},{type:F.Link,action:"back-action",label:l("Notifications")}],ve=new N,he=()=>{const{data:e,hasMore:r,loading:i,onSkip:n}=O({handler:async(e,a)=>{const r=await A.notificationViewService.getList(),i=E(e,a);for(const n of r)if(i([n]).done)break;return i().rows},onLoadStart:()=>A.layoutService.setAppbarLoader(!0),onLoadEnd:()=>A.layoutService.setAppbarLoader(!1),reloadSubject:ve});return a(B,{children:[a(D,{items:be,actions:ye,onAction:async e=>{"back-action"===e&&A.routerService.push("/"),"update-now"===e&&await ve.next()}}),a(T,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:i,onDataRequest:n,bufferSize:L,hasMore:r,children:e.map(e=>a(ue,{item:e,sx:{mb:1}},e.id))})]})};export{he as NotificationPage,he as default};
@@ -0,0 +1 @@
1
+ import{d as a,f as e,a_ as t,B as o,J as r,aa as n,T as i,O as s,a4 as c,w as l,N as d,l as h,aO as p,b0 as u,b1 as w,aG as b,a9 as f,i as x,aH as g,al as y,aL as v,V as m,W as S,b2 as L,a$ as k,D as j,$ as A,t as z}from"./index-WrZQf7cw.js";import{A as H}from"./Article-CV6sYzXB.js";import{C as R,R as C}from"./Refresh-KIrQPPBf.js";import{K as B}from"./KeyboardArrowLeft-C3lIqTl8.js";const D=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"),E=a=>{const t={color:"white",fontSize:28};switch(a.type){case"debug":return e(D,{sx:t});case"info":return e(u,{sx:t});case"warn":return e(p,{sx:t});default:return e(H,{sx:t})}},M=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:E(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:z("Download"),icon:()=>e(A,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:z("Refresh manually"),icon:()=>e(A,{icon:C,color:"#4caf50"})}],O=[{type:S.Link,action:"back-action",label:e(B,{sx:{display:"block"}})},{type:S.Link,action:"back-action",label:z("Main")},{type:S.Link,action:"back-action",label:z("Logs")},{type:S.Button,icon:L,action:"search-action",label:z("Search")}],W=new f,Y=()=>{const[a,o]=w(""),{data:r,hasMore:n,loading:i,onSkip:s}=b({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:W}),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:O,actions:F,onAction:async a=>{"back-action"===a&&x.routerService.push("/"),"download-action"===a&&l(),"update-now"===a&&(o(""),await W.next()),"search-action"===a&&(async()=>{const a=await x.layoutService.prompt(z("Search keyword"));if(a)return o(a),void W.next();o(""),W.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(M,{data:a,sx:{mb:1}},a.id))})]})};export{Y as LogPage,Y as default};
@@ -0,0 +1 @@
1
+ import{d as e,f as o,z as t,A as i,i as a,V as n,W as l,q as s,t as r,a3 as c,$ as p,T as d,b3 as m,Y as u,B as h,w as b,a4 as y,K as f,J as g,a6 as k,m as v,n as C,a5 as S,a7 as x,r as L,aD as w,bA as P,bB as T,bC as $,bD as V,bE as H,bF as z,O as M,Q as N,U as O,al as A,G as _,bl as I,b0 as E,N as F,l as R,a2 as j,az as G,bG as D,a9 as W,aI as B,aJ as U,b4 as Y,ag as J,I as K,ad as q,D as Q,aj as X}from"./index-WrZQf7cw.js";import{h as Z}from"./hasRouteMatch-B6-B9b9t.js";import{I as ee}from"./IconPhoto-CtWTATuX.js";import{C as oe,R as te}from"./Refresh-KIrQPPBf.js";import{K as ie}from"./KeyboardArrowLeft-C3lIqTl8.js";const ae=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"),ne=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"),le=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"),se="backtest-kit__groupHeader",re="backtest-kit__groupRoot",ce="backtest-kit__symbolImage",pe=s()({root:{[`& .${re}:hover .${se}`]:{opacity:"1 !important"}}});function de(e){return x(e,"#000000")>x(e,"#FFFFFF")}const me=[{type:l.Link,action:"back-action",label:o(ie,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:r("Main")},{type:l.Link,action:"back-action",label:r("Price Chart")}],ue=[{action:"update-now",label:r("Refresh"),icon:()=>o(p,{icon:te,color:"#4caf50"})}],he=(e,t)=>({type:c.Group,className:re,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:c.Component,className:se,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(g,{direction:"row",children:[o(y,{variant:"outlined",size:"small",color:"info",label:`${f.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(h,{flex:1})]})},{type:c.Group,fields:t.map(({symbol:e,label:t,color:i})=>((e,t,i)=>({type:c.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(S,{component:k,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",[`& .${ce}`]:{transition:"filter 500ms"},"&:hover":{background:()=>de(i)?v(i,.33):C(i,.33),[`& .${ce}`]:{transition:"filter 500ms",filter:de(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(ee,{className:ce,symbol:e}),children:o(h,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:t})})}))(e,t,i))}]}),be="backtest-kit__groupHeader",ye="backtest-kit__groupRoot",fe="backtest-kit__symbolImage",ge=s()({root:{[`& .${ye}:hover .${be}`]:{opacity:"1 !important"}}});function ke(e){return x(e,"#000000")>x(e,"#FFFFFF")}const ve=[{type:l.Link,action:"back-action",label:o(ie,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:r("Main")},{type:l.Link,action:"back-action",label:r("Price Chart")},{type:l.Link,action:"back-action",compute:e=>String(e).toUpperCase()}],Ce=(e,t)=>({type:c.Group,className:ye,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:c.Component,className:be,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(g,{direction:"row",children:[o(y,{variant:"outlined",size:"medium",color:"info",label:`${f.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(h,{flex:1})]})},{type:c.Group,fields:t.map(({label:e,to:t,color:i,icon:n})=>((e,t,i,n)=>({type:c.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(S,{component:k,onClick:()=>{a.routerService.push(e)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${fe}`]:{transition:"filter 500ms"},"&:hover":{background:()=>ke(i)?v(i,.33):C(i,.33),[`& .${fe}`]:{transition:"filter 500ms",filter:ke(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:fe}),children:t})}))(t,e,i,n))}]}),Se=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"}}),xe={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}},Le=({height:e,width:t,items:i,position:a,priceOpen:n,priceStopLoss:l,priceTakeProfit:s})=>{const{classes:c}=Se(),p=L.useRef(void 0),[d,m]=L.useState(null);return L.useLayoutEffect(()=>{const{current:o}=p,c=w(o,{...xe,localization:{priceFormatter:e=>N(e,O(e))},width:t,height:e,crosshair:{mode:P.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 r("Invalid date");const t=M(o.timestamp);return t.isValid()?t.format("HH:mm:ss"):r("Invalid date")}}}),d=c.addLineSeries({lastValueVisible:!1,color:T[400]}),u=i.map(e=>({time:Math.floor(e.timestamp),value:parseFloat(e.close)}));if(d.setData(u),a&&n){const e="long"===a?T[700]:V[700];d.createPriceLine({price:n,color:e,lineWidth:2,lineStyle:$.Solid,axisLabelVisible:!0,title:r("long"===a?"LONG Entry":"SHORT Entry")})}return l&&d.createPriceLine({price:l,color:H[500],lineWidth:2,lineStyle:$.Solid,axisLabelVisible:!0,title:r("SL")}),s&&d.createPriceLine({price:s,color:z[500],lineWidth:2,lineStyle:$.Solid,axisLabelVisible:!0,title:r("TP")}),c.subscribeCrosshairMove(e=>{if(e.time){const o=i.find(o=>o.timestamp===Number(e.time));if(o){const e=M(o.timestamp).format("DD/MM/YYYY HH:mm:ss"),t=N(o.close,O(o.close));m(`${e}: ${t}`)}else m(null)}else m(null)}),c.timeScale().fitContent(),()=>{c.remove()}},[e,t,i]),o("div",{ref:p,className:c.root,children:d&&o("div",{className:c.tooltip,children:d})})},we={"1m":"#2979ff","15m":"#f3a43a","1h":"#d500f9"},Pe={"1m":r("1 minute"),"15m":r("15 minutes"),"1h":r("1 hour")};const Te=({symbol:e,interval:t,reloadSubject:n,downloadSubject:l,onInfoClick:s,disableInfo:r,position:c,priceOpen:p,priceStopLoss:m,priceTakeProfit:u,sx:b})=>{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=A(f);_(()=>n.subscribe(k)),_(()=>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(R,{sx:{...b,display:"flex",flexDirection:"column",alignItems:"stretch",overflow:"clip"},children:[o(h,{sx:{background:we[t]||"#607d8b",minHeight:"48px",display:"flex",alignItems:"center",pl:2,pr:1},children:[o(d,{variant:"h6",sx:{color:"white",fontWeight:"bold",mr:1},children:Pe[t]||t}),!!c&&o(y,{variant:"filled",sx:{color:"white"},color:"short"===c?"warning":"success",label:String(c).toUpperCase()}),o(h,{sx:{flex:1}}),o(I,{disabled:r,onClick:s,children:o(E,{style:{color:"white",opacity:r?.5:1}})})]}),o(F,{}),!f||g?o(j,{sx:{height:"100%",width:"100%"}}):o(h,{sx:{position:"relative",flex:1},children:o(G,{style:{position:"absolute"},children:({height:e,width:t})=>o(Le,{items:f,height:e,width:t,position:c,priceOpen:p,priceStopLoss:m,priceTakeProfit:u})})})]})},$e=[{type:l.Link,action:"back-action",label:o(ie,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:r("Main")},{type:l.Link,action:"back-action",label:r("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:r("Download"),icon:()=>o(p,{icon:Q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:r("Refresh"),icon:()=>o(p,{icon:te,color:"#4caf50"})}],He=new W,ze=new W,Me=[{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:r("Symbol"),readonly:!0,compute:e=>e.symbol||r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"position",title:r("Position"),readonly:!0,compute:e=>"long"===e.position?r("🔵 LONG (profit on rise)"):r("🟠 SHORT (profit on fall)")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceOpen",title:r("Entry"),readonly:!0,compute:e=>e.priceOpen?`${N(e.priceOpen)}${r("$")}`:r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceOpen",title:r("Original Entry"),readonly:!0,isVisible:e=>null!=e.originalPriceOpen&&e.originalPriceOpen!==e.priceOpen,compute:e=>e.originalPriceOpen?`${N(e.originalPriceOpen)}${r("$")}`:r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceTakeProfit",title:r("Take Profit"),readonly:!0,compute:e=>e.priceTakeProfit?`${N(e.priceTakeProfit)}${r("$")}`:r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceTakeProfit",title:r("Original Take Profit"),readonly:!0,isVisible:e=>null!=e.originalPriceTakeProfit&&e.originalPriceTakeProfit!==e.priceTakeProfit,compute:e=>e.originalPriceTakeProfit?`${N(e.originalPriceTakeProfit)}${r("$")}`:r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceStopLoss",title:r("Stop Loss"),readonly:!0,compute:e=>e.priceStopLoss?`${N(e.priceStopLoss)}${r("$")}`:r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceStopLoss",title:r("Original Stop Loss"),readonly:!0,isVisible:e=>null!=e.originalPriceStopLoss&&e.originalPriceStopLoss!==e.priceStopLoss,compute:e=>e.originalPriceStopLoss?`${N(e.originalPriceStopLoss)}${r("$")}`:r("N/A")},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalEntries",title:r("Total Entries"),readonly:!0,isVisible:e=>null!=e.totalEntries&&e.totalEntries>1,compute:e=>String(e.totalEntries)},{type:c.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalPartials",title:r("Total Closes"),readonly:!0,isVisible:e=>null!=e.totalPartials&&e.totalPartials>0,compute:e=>String(e.totalPartials)},{type:c.Component,sx:{mt:2},element:({payload:e})=>o(S,{variant:"outlined",onClick:e.handleClose,children:r("Back")})}],Ne=[{id:"chart",element:({params:e})=>{const t=D(()=>({symbol:String(e.symbol).toUpperCase(),interval:e.interval})),[l,{loading:s,execute:c}]=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]});_(()=>He.subscribe(c));const p=L.useMemo(()=>l?l.priceTakeProfit:0,[l]),d=L.useMemo(()=>l?l.priceStopLoss:0,[l]),m=L.useMemo(()=>l?l.priceOpen:0,[l]),u=L.useMemo(()=>l?l.position:null,[l]),[h,b]=B(null),{pickData:y,setOpen:f,render:k}=U({title:r("Info"),AfterTitle:({onClose:e})=>o(g,{direction:"row",gap:2,children:[o(J,{onClick:()=>a.layoutService.pickSignal(h.current.id),variant:"outlined",children:r("Show Details")}),o(K,{size:"small",onClick:e,children:o(q,{})})]}),payload:()=>({handleClose(){f(!1)}}),fields:Me,handler:()=>h.current,withActionButton:!1}),v=Y(async()=>{l&&(b(l),y(l.id))});return o(oe,{children:[o(n,{items:$e,actions:Ve,payload:t,onAction:async o=>{"back-action"===o&&a.routerService.push(`/price_chart/${e.symbol}`),"update-now"===o&&await He.next(),"download-now"===o&&await ze.next()}}),s?null:o(Te,{symbol:t.symbol,interval:t.interval,disableInfo:!l,reloadSubject:He,downloadSubject:ze,onInfoClick:v,position:u,priceOpen:m,priceStopLoss:d,priceTakeProfit:p,sx:{height:"calc(100dvh - 165px)"}}),k()]})},isActive:e=>Z(["/price_chart/:symbol/:interval"],e)},{id:"coin",element:({params:e})=>{const{classes:t}=ge(),i=e.symbol,l=L.useMemo(()=>[{label:r("1 minute"),to:`/price_chart/${i}/1m`,color:"#2979ff",icon:ne},{label:r("15 minutes"),to:`/price_chart/${i}/15m`,color:"#f3a43a",icon:le},{label:r("1 hour"),to:`/price_chart/${i}/1h`,color:"#d500f9",icon:ae}],[i]),s=L.useMemo(()=>[Ce(r("Chart"),l)],[l]);return o(oe,{children:[o(n,{items:ve,payload:i,onAction:e=>{"back-action"===e&&a.routerService.push("/price_chart")}}),o(u,{className:t.root,fields:s}),o(h,{paddingBottom:"24px"})]})},isActive:e=>Z(["/price_chart/:symbol"],e)},{id:"main",element:()=>{const{classes:e}=pe(),{reloadTrigger:l,doReload:s}=t(),[p,{loading:y}]=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=he(`${r("Priority")} ${o}`,e);t%2==0&&n.push(i),t%2==1&&l.push(i),s.push(i)}),s.length?[{type:c.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:c.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:l},{type:c.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:s}]:[]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[l]});return o(oe,{children:[o(n,{items:me,actions:ue,onAction:e=>{"back-action"===e&&a.routerService.push("/"),"update-now"===e&&s()}}),y||!p?o(m,{children:o(d,{variant:"h6",sx:{opacity:.5},children:r("Loading...")})}):p.length?o(b,{children:[o(u,{className:e.root,fields:p},l),o(h,{paddingBottom:"24px"})]}):o(m,{children:o(d,{variant:"h6",sx:{opacity:.5},children:r("No symbols found")})})]})},isActive:e=>Z(["/price_chart"],e)}],Oe=({symbol:e,interval:t})=>o(X,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:Ne,params:{symbol:e,interval:t}});export{Oe as PriceChartPage,Oe as default};
@@ -0,0 +1 @@
1
+ import{d as e,f as a,r as t,bq as i,br as o,A as r,i as s,bs as n,bt as c,t as l,bu as d,I as p,ad as h,b2 as u,bv as b,q as m,ah as y,bw as f,a2 as g,T as v,b3 as x,an as w,a6 as L,bx as S,ao as k,by as A,a_ as j,Z as C,G as N,a9 as z,V as E,W as H,b8 as R,B as T,$ as V,aj as I}from"./index-WrZQf7cw.js";import{h as M}from"./hasRouteMatch-B6-B9b9t.js";import{B}from"./Background-Djt8-6Ze.js";import{A as D}from"./Article-CV6sYzXB.js";import{C as F,R as K}from"./Refresh-KIrQPPBf.js";import{K as W}from"./KeyboardArrowLeft-C3lIqTl8.js";const q=e(a("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}),"Image"),P=e(a("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"}),"InsertDriveFile"),$="65px",G=e=>e.mimeType.startsWith("image/")?a(q,{sx:{color:"#f57c00",fontSize:20}}):"application/json"===e.mimeType?a(C,{sx:{color:"#7b1fa2",fontSize:20}}):e.mimeType.startsWith("text/")?a(D,{sx:{color:"#1976d2",fontSize:20}}):a(P,{sx:{color:"#546e7a",fontSize:20}}),O=m()(e=>({root:{position:"relative",height:"100%",width:"100%",background:"#eee",overflow:"clip"},header:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"8px",paddingRight:"4px",height:$},input:{height:$,paddingRight:e.spacing(2),paddingLeft:e.spacing(1),width:"100%"},container:{position:"absolute",top:$,left:0,right:0,bottom:0,height:`calc(100% - ${$})`,width:"100%",background:"white",overflow:"clip",display:"flex",alignItems:"stretch",justifyContent:"stretch"},content:{display:"flex",flex:1},loader:{height:"100%",width:"100%"},accent:{background:y("#00c3ff",.05)}})),X=({outlinePaper:e,className:m,style:y,sx:C,nodes:N,initialSearch:z=""})=>{const{classes:E,cx:H}=O(),[R,T]=t.useState(z),V=i(R),[I,{flush:M}]=o(R,2500),[B,{loading:D}]=r(async()=>await(async(e,a)=>{const t=e.trim().toLowerCase(),i=[];let o=0;for(const r of s.explorerHelperService.deepFlat(a))if("file"!==r.type||t&&!r.path.toLowerCase().includes(t)||i.push(r),++o%1e4==0&&await f(0),i.length>25e3)break;return i})(I,N),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),deps:[I,N]}),{execute:F}=n(async e=>{await s.layoutService.pickDumpContent(e)},{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});return a(b,{outlinePaper:e,className:H(E.root,m),style:y,sx:C,children:[a("div",{className:E.header,children:a(c,{disabled:D,className:E.input,endAdornment:a(d,{position:"end",children:a(p,{disabled:D||!R,onClick:()=>{V.once(async()=>{await f(500),M()}),T("")},edge:"end",children:a(R?h:u,{})})}),placeholder:l("Search"),value:R,onBlur:()=>M(),onChange:({target:e})=>T(e.value),onKeyDown:({key:e,currentTarget:a})=>"Enter"===e&&a.blur()})}),a("div",{className:E.container,children:a("div",{className:E.content,children:B?B.length?a(j,{withScrollbar:!0,children:B.map((e,t)=>a(w,{className:H({[E.accent]:t%2==1}),component:L,onClick:()=>(async e=>{await F(e)})(e.id),children:[a(S,{children:G(e)}),a(k,{primary:e.label,secondary:e.path}),a(A,{content:e.path,label:l("Copy path")})]},e.id))}):a(x,{sx:{height:"100%",width:"100%"},children:a(v,{variant:"h6",sx:{opacity:.5},children:l("Not found")})}):a(g,{className:E.loader})})})]})},Z=[{type:H.Link,action:"back-action",label:a(W,{sx:{display:"block"}})},{type:H.Link,action:"back-action",label:l("Main")},{type:H.Link,action:"back-action",label:l("Dump Explorer")}],_=[{action:"update-now",label:l("Refresh"),icon:()=>a(V,{icon:K,color:"#4caf50"})}],J=new z,Q=({params:e})=>{const[t,{loading:i,execute:o}]=r(async()=>await s.explorerViewService.getFolderTree(),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});N(()=>J.subscribe(o));return a(F,{children:[a(E,{items:Z,actions:_,onAction:e=>{"back-action"===e&&s.routerService.push("/"),"update-now"===e&&(s.explorerViewService.clear(),J.next())}}),a(R,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(T,{pr:2,pl:2,children:i||!t?a(x,{children:a(v,{variant:"h6",sx:{opacity:.5},children:l("Loading...")})}):a(X,{nodes:t,initialSearch:e.search})})}),a(B,{})]})},U=[{id:"search",element:Q,isActive:e=>M(["/dump/:search"],e)},{id:"main",element:Q,isActive:e=>M(["/dump"],e)}],Y=({search:e=""})=>a(I,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:U,params:{search:e}});export{Y as DumpPage,Y as default};
@@ -0,0 +1 @@
1
+ import{g as e,b as t,d as a,f as o,r,u as n,_ as i,e as s,I as l,C as c,h as d,j as p,k as h,s as v,l as m,m as u,n as g,T as f,t as y,o as w,B as $,M as x,p as b,q as S,v as z,D as C,w as P,x as L,i as M,y as k,z as A,A as N,E as V,G as R,H as D,L as H,J as T,K as F,N as I,O as B,Q as W,R as E,U as O,V as j,W as Y,X 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,a8 as oe}from"./index-WrZQf7cw.js";import{r as re}from"./emitters-qnXuWOnN.js";import{C as ne,R as ie}from"./Refresh-KIrQPPBf.js";function se(t){return e("MuiAlert",t)}const le=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),ce=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"),de=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),pe=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"),he=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"),ve=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],me=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),[`& .${le.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}`,[`& .${le.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)}))}),ue=v("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ge=v("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),fe=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}),ye={success:o(ce,{fontSize:"inherit"}),warning:o(de,{fontSize:"inherit"}),error:o(pe,{fontSize:"inherit"}),info:o(he,{fontSize:"inherit"})},we=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=ye,onClose:L,role:M="alert",severity:k="success",slotProps:A={},slots:N={},variant:V="standard"}=f,R=i(f,ve),D=s({},f,{color:b,severity:k,variant:V}),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,se,r)})(D),T=null!=(a=null!=(r=N.closeButton)?r:S.CloseButton)?a:l,F=null!=(v=null!=(m=N.closeIcon)?m:S.CloseIcon)?v:c,I=null!=(u=A.closeButton)?u:z.closeButton,B=null!=(g=A.closeIcon)?g:z.closeIcon;return o(me,s({role:M,elevation:0,ownerState:D,className:d(H.root,$),ref:t},R,{children:[!1!==C?o(ue,{ownerState:D,className:H.icon,children:C||P[k]||ye[k]}):null,o(ge,{ownerState:D,className:H.message,children:w}),null!=y?o(fe,{ownerState:D,className:H.action,children:y}):null,null==y&&L?o(fe,{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]}))}),$e=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"),xe=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"),be=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"),Se=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"),ze=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"),Ce=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),Pe=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Le=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"),Me=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"),ke=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"),Ae=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"),Ne=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=S()(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="%")=>null==e||Number.isNaN(e)?"—":`${e.toFixed(2)}${t}`,De=e=>null==e||Number.isNaN(e)?"—":`${e.toFixed(1)} ${y("min")}`,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:w,portfolioAvgLossDuration:$,portfolioAnnualizedSharpeRatio:x,portfolioCertaintyRatio:b,portfolioExpectedYearlyReturns:S,portfolioTradesPerYear:z,symbols:C,backtest:P}=e,L=y(P?"Backtest":"Live"),M=t.frameName?` / ${t.frameName}`:"",k=[`## ${L}: ${t.strategyName} / ${t.exchangeName}${M}`,"",`**${y("Total PNL")}:** ${Re(a)} `,`**${y("Sharpe Ratio")}:** ${Re(o,"")} `,`**${y("Annualized Sharpe")}:** ${Re(x,"")} `,`**${y("Certainty Ratio")}:** ${Re(b,"")} `,`**${y("Expected Yearly Returns")}:** ${Re(S)} `,`**${y("Trades Per Year")}:** ${null!==z?z.toFixed(1):"—"} `,`**${y("Total trades")}:** ${r} `,`**${y("Standard Deviation Per Trade")}:** ${Re(n)} `,`**${y("Sortino Ratio")}:** ${Re(i,"")} `,`**${y("Calmar Ratio")}:** ${Re(s,"")} `,`**${y("Recovery Factor Per Equity Drawdown")}:** ${Re(l,"")} `,`**${y("Expectancy")}:** ${Re(c)} `,`**${y("Median PNL")}:** ${Re(u)} `,`**${y("Avg Peak PNL")}:** ${Re(d)} `,`**${y("Avg Drawdown PNL")}:** ${Re(p)} `,`**${y("Peak Profit PNL")}:** ${Re(h)} `,`**${y("Max Drawdown PNL")}:** ${Re(v)} `,`**${y("Avg Duration")}:** ${De(m)} `,`**${y("Avg Win Duration")}:** ${De(w)} `,`**${y("Avg Loss Duration")}:** ${De($)} `,`**${y("Avg Consecutive Win PNL")}:** ${Re(g)} `,`**${y("Avg Consecutive Loss PNL")}:** ${Re(f)}`,""];for(const A of C)k.push(`### ${A.symbol}`,"",`**${y("PNL")}:** ${Re(A.totalPnl)} `,`**${y("Avg PNL")}:** ${Re(A.avgPnl)} `,`**${y("Median PNL")}:** ${Re(A.medianPnl)} `,`**${y("Win Rate")}:** ${Re(A.winRate)} `,`**${y("Profit Factor")}:** ${Re(A.profitFactor,"")} `,`**${y("Max Drawdown")}:** ${Re(A.maxDrawdown)} `,`**${y("Expectancy")}:** ${Re(A.expectancy)} `,`**${y("Sharpe Ratio")}:** ${Re(A.sharpeRatio,"")} `,`**${y("Annualized Sharpe")}:** ${Re(A.annualizedSharpeRatio,"")} `,`**${y("Certainty Ratio")}:** ${Re(A.certaintyRatio,"")} `,`**${y("Expected Yearly Returns")}:** ${Re(A.expectedYearlyReturns)} `,`**${y("Trades Per Year")}:** ${null!==A.tradesPerYear?A.tradesPerYear.toFixed(1):"—"} `,`**${y("Sortino Ratio")}:** ${Re(A.sortinoRatio,"")} `,`**${y("Calmar Ratio")}:** ${Re(A.calmarRatio,"")} `,`**${y("Recovery Factor Per Equity Drawdown")}:** ${Re(A.recoveryFactor,"")} `,`**${y("Standard Deviation")}:** ${Re(A.stdDev)} `,`**${y("Avg Win")}:** ${Re(A.avgWin)} `,`**${y("Avg Loss")}:** ${Re(A.avgLoss)} `,`**${y("Max Win Streak")}:** ${A.maxWinStreak} `,`**${y("Max Loss Streak")}:** ${A.maxLossStreak} `,`**${y("Avg Peak PNL")}:** ${Re(A.avgPeakPnl)} `,`**${y("Avg Drawdown PNL")}:** ${Re(A.avgFallPnl)} `,`**${y("Peak Profit PNL")}:** ${Re(A.peakProfitPnl)} `,`**${y("Max Drawdown PNL")}:** ${Re(A.maxDrawdownPnl)} `,`**${y("Avg Duration")}:** ${De(A.avgDuration)} `,`**${y("Avg Win Duration")}:** ${De(A.avgWinDuration)} `,`**${y("Avg Loss Duration")}:** ${De(A.avgLossDuration)} `,`**${y("Avg Consecutive Win PNL")}:** ${Re(A.avgConsecutiveWinPnl)} `,`**${y("Avg Consecutive Loss PNL")}:** ${Re(A.avgConsecutiveLossPnl)} `,`**${y("Trades")}:** ${A.totalTrades}`,"");return k.join("\n")})(e),c=()=>{i(!n)},d=async e=>{e.stopPropagation(),await k(s)},p=async e=>{e.stopPropagation(),await L(s)&&M.alertService.notify(y("Copied!"))};return o(we,{className:a(t.root,{[t.open]:n}),action:o(P,{children:[o(l,{className:t.copyButton,onClick:p,size:"small",children:o(z,{})}),o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(C,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(n?Ce:Pe,{})})]}),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?y("Backtest"):y("Live"),": ",e.context.strategyName]}),o(w,{in:n,timeout:"auto",unmountOnExit:!0,children:[o($,{paddingBottom:"16px"}),o(x,{content:s}),o($,{paddingBottom:"32px"})]}),!n&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[b(s).slice(0,150),"..."]})]})})},Te="backtest-kit__groupHeader",Fe="backtest-kit__groupRoot",Ie="backtest-kit__symbolImage",Be=S()({root:{[`& .${Fe}:hover .${Te}`]:{opacity:"1 !important"}}});function We(e){return ae(e,"#000000")>ae(e,"#FFFFFF")}const Ee=[{type:Y.Component,element:()=>{const{reloadTrigger:e,doReload:t}=A(15e3),[a,{execute:r}]=N(async()=>{M.runtimeViewService.getRuntimeInfo.clear();const e=V(M.runtimeViewService.getRuntimeInfo,{defaultValue:null});return await e()},{onLoadStart:()=>M.layoutService.setAppbarLoader(!0),onLoadEnd:()=>M.layoutService.setAppbarLoader(!1),deps:[e]});R(()=>re.subscribe(r));return o(T,{direction:"row",alignItems:"center",children:[o(D,{"aria-label":y("breadcrumb"),children:[o(H,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:y("Main")}),o(H,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:y("Navigation")})]}),o($,{flex:1}),(()=>{if(!a)return null;const{symbol:e,when:r,currentPrice:n,backtest:i}=a;return o(E,{placement:"bottom",description:y(i?"Backtest mode":"Live mode"),children:o(T,{direction:"row",alignItems:"center",spacing:1,sx:{display:{xs:"none",sm:"flex"},cursor:"pointer",userSelect:"none"},onClick:()=>{M.runtimeViewService.getRuntimeInfo.clear(),t()},children:[o(l,{size:"small",children:o(ze,{})}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Symbol"),":",F.nbsp,o("b",{children:e})]}),o(I,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Time"),":",F.nbsp,o("b",{children:B(r).format("HH:mm DD MMM YYYY")})]}),o(I,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Price"),":",F.nbsp,o("b",{children:[W(n,O(n)),"$"]})]})]})})})(),o($,{pr:1})]})}}],Oe=[{action:"download-json",label:y("Download Heatmap JSON"),icon:()=>o(U,{icon:G,color:"#4caf50"})},{action:"download-markdown",label:y("Download Heatmap Markdown"),icon:()=>o(U,{icon:q,color:"#4caf50"})},{action:"download-pdf",label:y("Download Heatmap PDF"),icon:()=>o(U,{icon:Z,color:"#4caf50"})},{divider:!0},{action:"update-now",label:y("Refresh"),icon:()=>o(U,{icon:ie,color:"#4caf50"})}],je=(e,t)=>({type:Q.Group,className:Fe,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:Q.Component,className:Te,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(T,{direction:"row",children:[o(X,{variant:"outlined",size:"medium",color:"info",label:`${F.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o($,{flex:1})]})},{type:Q.Group,fields:t.map(({label:e,description:t,to:a,color:r,icon:n})=>((e,t,a,r,n)=>({type:Q.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(E,{description:a,children:o(ee,{component:te,onClick:()=>{M.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:y("Portfolio Overview"),description:oe.newline(y("Closed trading signals grouped by symbol for Backtest and Live modes"),y("Each card shows position type, entry price, TP/SL levels, PNL amount and percent"),y("Displays DCA entry count and partial close count where applicable"),y("Supports JSON export and manual refresh of the signal list")),to:"/overview",color:"#0033AD",icon:$e},{label:y("PNL Performance"),description:oe.newline(y("KPI dashboard with aggregated trading performance metrics per symbol"),y("Shows daily trade counts, success rates, resolved/rejected breakdowns"),y("Revenue analytics across today, yesterday, 7-day and 31-day windows"),y("Toggle between Backtest and Live modes; supports JSON export")),to:"/dashboard",color:"#E6007A",icon:Me},{label:y("System Logs"),description:oe.newline(y("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log"),y("Each entry shows topic, timestamp and raw JSON arguments in monospace"),y("Filter by keyword or regex via search prompt"),y("Supports full log export as JSON file")),to:"/logs",color:"#58BF00",icon:Ne}],Je=[{label:y("Notifications"),description:oe.newline(y("Event feed for all trading signals: opens, closes, schedules, errors"),y("Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices"),y("Infinite-scroll pagination; click any card to open a detailed modal"),y("Supports manual refresh to pull the latest activity")),to:"/notifications",color:"#F7931A",icon:Se},{label:y("Pending Status"),description:oe.newline(y("Live view of active trading signals grouped by strategy"),y("Grid of strategy buttons; click to inspect individual signal state"),y("Detail view shows entry, exit, effective price, DCA and partial counts"),y("Supports per-signal JSON export and manual refresh")),to:"/status",color:"#6F42C1",icon:Ae},{label:y("Dump Explorer"),description:oe.newline(y("Tree-structured file browser for backtest output and artifact files"),y("Icons indicate file type: image, JSON, plain text or generic"),y("Click any file to open a full-screen preview modal"),y("Supports keyword search and manual refresh of the file tree")),to:"/dump",color:"#0090FF",icon:Le}],_e=[{label:y("Markdown Reports"),description:oe.newline(y("Strategy performance reports rendered from markdown for Backtest and Live runs"),y("Grid of strategy buttons grouped by type and sorted by signal volume"),y("Download reports as markdown, PDF or raw JSON"),y("Supports manual refresh to regenerate report content")),to:"/report",color:"#009688",icon:xe},{label:y("Price Charts"),description:oe.newline(y("Interactive candlestick charts powered by TradingView Lightweight Charts"),y("Navigate by symbol then interval (1m, 15m, 1h) to view price history"),y("Overlays active signal lines: entry, take profit (green) and stop loss (red)"),y("Supports chart image export and signal detail inspection")),to:"/price_chart",color:"#1565C0",icon:be},{label:y("Heatmap"),description:oe.newline(y("Color-coded performance heatmap across all tracked symbols"),y("Cells show win rate, profit factor, Sharpe ratio and other key metrics"),y("Download heatmap as JSON, markdown report or PDF"),y("Supports manual refresh to recalculate aggregated statistics")),to:"/heat",color:"#8D6E63",icon:ke}],Ge=[je(y("Application"),Ye),je(y("Live"),Je),je(y("Other"),_e)],Ue=()=>o(K,{sx:{width:"100%",height:"75px"}}),qe=()=>{const{classes:e}=Be();return o(ne,{children:[o(j,{items:Ee,actions:Oe,onAction:async e=>{"update-now"===e&&await(async()=>{M.statusViewService.getStatusInfo.clear(),re.next()})(),"download-markdown"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);M.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatReport();await k(e)})(),"download-json"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);M.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),o(J,{Loader:Ue,reloadSubject:re,children:async()=>{const e=await M.statusViewService.getStatusInfo();return e?o(He,{data:e}):null}}),o(_,{className:e.root,fields:Ge,payload:()=>({history:history})}),o($,{paddingBottom:"24px"})]})};export{qe as MainPage,qe as default};
@@ -0,0 +1 @@
1
+ import{f as e,b8 as t,M as a,t as i,B as r,v as o,bk as n,i as l,bl as s,x as d,b4 as c,bm as w,Z as p,$ as h,a0 as m,a1 as k,b1 as g,bn as b,aI as v,bo as y,av as u,bi as f,b6 as S,ad as x,J as _,bp as N,ax as D,y as V,z as O,A as R,V as L,W as B,q as A,a3 as P,T as C,b3 as $,Y as J,w as M,a4 as j,K as G,a6 as X,m as F,n as H,a5 as I,a7 as E,aj as z}from"./index-WrZQf7cw.js";import{h as T}from"./hasRouteMatch-B6-B9b9t.js";import{I as U}from"./IconPhoto-CtWTATuX.js";import{C as K,R as W}from"./Refresh-KIrQPPBf.js";import{K as q}from"./KeyboardArrowLeft-C3lIqTl8.js";const Y=[{id:"backtest",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Z=[{id:"backtest",label:i("Backtest"),isVisible:({type:e})=>"backtest"===e},{id:"live",label:i("Live"),isVisible:({type:e})=>"live"===e},{id:"strategy",label:i("Strategy")},{id:"breakeven",label:i("Breakeven")},{id:"risk",label:i("Risk")},{id:"partial",label:i("Partial")},{id:"highest_profit",label:i("Highest Profit")},{id:"max_drawdown",label:i("Max Drawdown")},{id:"schedule",label:i("Schedule")},{id:"performance",label:i("Performance")},{id:"sync",label:i("Sync")},{id:"heat",label:i("Heat")}],Q=({disabled:t,className:a,style:r,sx:c,onClick:w,color:p})=>e(s,{className:a,style:r,sx:c,disabled:t,color:p,size:36,onClick:async e=>{const[t,{resolve:a}]=n();e.preventDefault(),e.stopPropagation(),await w(e,e=>a(e));const r=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 d(String(e))})(r),l.alertService.notify(i("Copied!"))},children:e(o,{})}),ee=[{action:"json",label:i("Download JSON"),icon:()=>e(h,{icon:p,color:"#4caf50"})},{action:"markdown",label:i("Download Markdown"),icon:()=>e(h,{icon:m,color:"#4caf50"})},{action:"pdf",label:i("Download PDF"),icon:()=>e(h,{icon:k,color:"#4caf50"})}],te=({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(w,{transparent:!0,className:a,style:i,sx:r,disabled:t,options:ee,onAction:s})},ae=u(),ie=D(async(e,t)=>{const a=("backtest"===t?await l.backtestGlobalService.list():await l.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:n}=a,[s,d,c,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?l.markdownViewService.getBacktestReport(i,r,o,n):Promise.resolve(""),"live"===t?l.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),l.markdownViewService.getBreakevenReport(i,r,o,n,"backtest"===t),l.markdownViewService.getRiskReport(i,r,o,n,"backtest"===t),l.markdownViewService.getPartialReport(i,r,o,n,"backtest"===t),l.markdownViewService.getHighestProfitReport(i,r,o,n,"backtest"===t),l.markdownViewService.getMaxDrawdownReport(i,r,o,n,"backtest"===t),l.markdownViewService.getScheduleReport(i,r,o,n,"backtest"===t),l.markdownViewService.getPerformanceReport(i,r,o,n,"backtest"===t),l.markdownViewService.getSyncReport(i,r,o,n,"backtest"===t),l.markdownViewService.getHeatReport(r,o,n,"backtest"===t),l.markdownViewService.getStrategyReport(i,r,o,n,"backtest"===t)]);return{type:t,backtest:s,live:d,breakeven:c,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}`}),re=()=>{const[t,a]=g(""),[o,n]=g("backtest"),d=b(),{push:c,pop:w}=d,[p,h]=v(ae.location.pathname),m=async()=>{const e=(await ie(t.current,o.current))[p.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},k=async()=>{const e=await ie(t.current,o.current),a=p.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);l.layoutService.downloadFile(t,`${a}_${o.current}_${Date.now()}.md`)}},u=async()=>{const e=("backtest"===o.current?await l.backtestGlobalService.list():await l.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:r,frameName:n}=e,s=p.current.replace("/markdown_report/",""),d="backtest"===o.current;let c;if("backtest"===s?c=await l.markdownViewService.getBacktestData(a,i,r,n):"live"===s?c=await l.markdownViewService.getLiveData(a,i,r):"breakeven"===s?c=await l.markdownViewService.getBreakevenData(a,i,r,n,d):"risk"===s?c=await l.markdownViewService.getRiskData(a,i,r,n,d):"partial"===s?c=await l.markdownViewService.getPartialData(a,i,r,n,d):"highest_profit"===s?c=await l.markdownViewService.getHighestProfitData(a,i,r,n,d):"max_drawdown"===s?c=await l.markdownViewService.getMaxDrawdownData(a,i,r,n,d):"schedule"===s?c=await l.markdownViewService.getScheduleData(a,i,r,n,d):"performance"===s?c=await l.markdownViewService.getPerformanceData(a,i,r,n,d):"sync"===s?c=await l.markdownViewService.getSyncData(a,i,r,n,d):"heat"===s?c=await l.markdownViewService.getHeatData(i,r,n,d):"strategy"===s&&(c=await l.markdownViewService.getStrategyData(a,i,r,n,d)),void 0!==c){const e=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);l.layoutService.downloadFile(t,`${s}_${o.current}_${Date.now()}.json`)}},{pickData:D,render:O}=y({tabs:Z,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),h(a)},animation:"none",title:i("Markdown Report"),sizeRequest:f,history:ae,routes:Y,BeforeTitle:({onClose:t})=>{const{total:a}=b();return e(r,{sx:{mr:1,display:1===a?"none":"flex"},children:e(s,{onClick:t,children:e(N,{})})})},AfterTitle:({onClose:a})=>e(_,{direction:"row",gap:1,children:[e(s,{sx:{mr:"10px"},onClick:()=>m(),children:e(S,{})}),e(Q,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await l.backtestGlobalService.list():await l.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:n,exchangeName:s,frameName:d}=r,c="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await l.markdownViewService.getBacktestData(o,n,s,d),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await l.markdownViewService.getLiveData(o,n,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await l.markdownViewService.getBreakevenData(o,n,s,d,c),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await l.markdownViewService.getRiskData(o,n,s,d,c),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await l.markdownViewService.getPartialData(o,n,s,d,c),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await l.markdownViewService.getHighestProfitData(o,n,s,d,c),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await l.markdownViewService.getMaxDrawdownData(o,n,s,d,c),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await l.markdownViewService.getScheduleData(o,n,s,d,c),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await l.markdownViewService.getPerformanceData(o,n,s,d,c),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await l.markdownViewService.getSyncData(o,n,s,d,c),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await l.markdownViewService.getHeatData(n,s,d,c),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await l.markdownViewService.getStrategyData(o,n,s,d,c),null,2))})(p.current,t.current,o.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(te,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:u,onDownloadMarkdown:k,onDownloadPdf:m}),e(s,{onClick:a,children:e(x,{})})]}),fetchState:async()=>await ie(t.current,o.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:d,sync:c,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:d,sync:c,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>l.layoutService.setAppbarLoader(!0),onLoadEnd:()=>l.layoutService.setAppbarLoader(!1),onClose:()=>{w()}});return(e,t)=>{c({id:"markdown_report_modal",render:O,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";ae.push(e),h(e)},onMount:()=>{a(e),n(t),D()}})}},oe="backtest-kit__groupHeader",ne="backtest-kit__groupRoot",le="backtest-kit__symbolImage",se=A()({root:{[`& .${ne}:hover .${oe}`]:{opacity:"1 !important"}}});function de(e){return E(e,"#000000")>E(e,"#FFFFFF")}const ce=[{type:B.Link,action:"back-action",label:e(q,{sx:{display:"block"}})},{type:B.Link,action:"back-action",label:i("Main")},{type:B.Link,action:"back-action",label:i("Markdown Report")}],we=[{action:"update-now",label:i("Refresh"),icon:()=>e(h,{icon:W,color:"#4caf50"})}],pe=(t,a)=>({type:P.Group,className:ne,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:P.Component,className:oe,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(_,{direction:"row",children:[e(j,{variant:"outlined",size:"small",color:"info",label:`${G.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(r,{flex:1})]})},{type:P.Group,fields:a.map(({symbol:t,label:a,id:i,type:o,color:n})=>((t,a,i,o,n)=>({type:P.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:l})=>e(I,{component:X,onClick:()=>{l.handleOpen(t,a)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${le}`]:{transition:"filter 500ms"},"&:hover":{background:()=>de(n)?F(n,.33):H(n,.33),[`& .${le}`]:{transition:"filter 500ms",filter:de(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(U,{className:le,symbol:i}),children:e(r,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(i,o,t,a,n))}]}),he=[{id:"main",element:()=>{const{classes:t}=se(),{reloadTrigger:a,doReload:o}=O(),[n,{loading:s}]=R(async()=>await(async()=>{const[e,t,a]=await Promise.all([l.symbolGlobalService.getSymbolMap(),l.backtestGlobalService.list(),l.liveGlobalService.list()]),r={},o={};t.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",type:"backtest",id:t.id})}),a.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",id:t.id,type:"live"})});const n=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>pe(e,t)),s=Object.entries(o).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>pe(e,t));return s.length||n.length?[{type:P.Fragment,isVisible:()=>!!n.length,fields:[{type:P.Line,title:i("Backtest")},{type:P.Group,columns:"12",fields:n}]},{type:P.Fragment,isVisible:()=>!!s.length,fields:[{type:P.Line,title:i("Live")},{type:P.Group,columns:"12",fields:s}]}]:[]})(),{onLoadStart:()=>l.layoutService.setAppbarLoader(!0),onLoadEnd:()=>l.layoutService.setAppbarLoader(!1),deps:[a]}),d=re(),c=(e,t)=>{d(e,t)};return e(K,{children:[e(L,{items:ce,actions:we,onAction:e=>{"back-action"===e&&l.routerService.push("/"),"update-now"===e&&o()}}),s||!n?e($,{children:e(C,{variant:"h6",sx:{opacity:.5},children:i("Loading...")})}):n.length?e(M,{children:[e(J,{className:t.root,fields:n,payload:()=>({handleOpen:c})},a),e(r,{paddingBottom:"24px"})]}):e($,{children:e(C,{variant:"h6",sx:{opacity:.5},children:i("No pending signals")})})]})},isActive:e=>T(["/report"],e)}],me=({id:t})=>e(z,{history:l.routerService,onLoadStart:()=>l.layoutService.setAppbarLoader(!0),onLoadEnd:()=>l.layoutService.setAppbarLoader(!1),routes:he,params:{id:t}});export{me as StatusPage,me as default};
@@ -0,0 +1 @@
1
+ import{d as e,f as a,a9 as o,W as t,V as n,D as i,$ as r,t as s,ak as l,A as c,i as d,al as p,G as h,am as m,X as u,an as b,ao as g,ap as y,B as x,T as v,aq as f,m as k,n as S,ar as w,a7 as L,as as P,ah as R,Q as F,I as $,at as z,w as N,au as D,av as T}from"./index-WrZQf7cw.js";import{R as W,C}from"./Refresh-KIrQPPBf.js";import{K as O}from"./KeyboardArrowLeft-C3lIqTl8.js";import{I as j}from"./IconPhoto-CtWTATuX.js";import{B}from"./Background-Djt8-6Ze.js";const A=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),V=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),E=new o,H=[{type:t.Link,action:"back-action",label:a(O,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:s("Main")},{type:t.Link,action:"back-action",label:s("Overview")},{type:t.Button,action:"update-now",label:s("Refresh"),icon:W}],I=[{action:"download-action",label:s("Download"),icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:s("Dashboard"),icon:()=>a(r,{icon:A,color:"#4caf50"})},{action:"logs-action",label:s("Logs"),icon:()=>a(r,{icon:V,color:"#4caf50"})},{divider:!0},{action:"update-now",label:s("Refresh"),icon:()=>a(r,{icon:W,color:"#4caf50"})}],M=()=>a(n,{items:H,actions:I,onAction:E.next});const G=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=l({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:D}]=c(async()=>{if("live"===e){return(await d.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await d.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),T=p(i),W=p(e);h(()=>E.subscribe(e=>{if("update-now"===e&&D(),"download-action"===e){const e=new Blob([JSON.stringify(T.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);d.layoutService.downloadFile(a,`signals_${W.current}_${Date.now()}.json`)}"dashboard-action"===e&&d.routerService.push(`/dashboard/${W.current}`),"logs-action"===e&&d.routerService.push("/logs"),"back-action"===e&&d.routerService.push("/main")}));const C=m.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),O=e=>{const o=C[e]||[];return o.length?a(N,{children:o.map((t,n)=>{return a(P,{sx:{background:e=>n%2==1?R(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>d.layoutService.pickSignal(t.id),children:[a(g,{primary:a(x,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:R("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",o.length-n]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===t.position?"#1976D2":"#F57C00",color:"white"},children:"long"===t.position?"LONG":"SHORT"}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("Entry"),":"]}),F(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceOpen),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("TP"),":"]}),F(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceTakeProfit),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("SL"),":"]}),F(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("Invested"),":"]}),F(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:t.pnl.pnlPercentage>=0?R("#4caf50",.15):R("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:[s("PNL"),": ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",F(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:R("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:R("#9c27b0",.15),color:"#6a1b9a"},children:[s("Partial"),"×",t.totalPartials]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?R("#4caf50",.2):"scheduled"===t.status?R("#ff9800",.2):"closed"===t.status?R("#9e9e9e",.2):R("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(v,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(i=t.createdAt,new Date(i).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a($,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(b,{children:a(g,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:s("No signals"),secondary:s("Signals will be displayed here after they appear")})})};return r?null:a(w,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(u,{deps:[C],children:async()=>{const o=Object.keys(C),t=await d.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",l=(null==(n=C[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(y,{sx:{background:(c=r,L(c,"#000000")>L(c,"#FFFFFF")?k(r,.1):S(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(x,{sx:{position:"relative",paddingRight:"8px"},children:a(j,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(x,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:f(l,{one:s("Signal"),two:s("Signals"),many:s("Signals")})})]}),a(x,{sx:{marginTop:"16px",marginBottom:"16px"},children:O(e)})]})},`section-${e}`);var c}):a(b,{children:a(g,{primary:s("No signals yet"),secondary:s("live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here")})})}})})},K=T(),U=(e,a)=>e.some(e=>e.includes(a)),X=[{id:"backtest",element:G,isActive:e=>U(["/backtest"],e)},{id:"live",element:G,isActive:e=>U(["/live"],e)}],_=[{id:"backtest",label:s("Backtest")},{id:"live",label:s("Live")}],q=()=>{h(()=>K.replace("/backtest"));return a(C,{children:[a(D,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:M,onLoadStart:()=>d.layoutService.setAppbarLoader(!0),onLoadEnd:()=>d.layoutService.setAppbarLoader(!1),routes:X,tabs:_,history:K,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(B,{})]})};export{q as OverviewPage,q as default};
@@ -0,0 +1 @@
1
+ import{f as t,T as e,K as a,bz as o,a3 as n,l as i,q as l,t as r,A as c,i as s,G as d,V as p,W as m,Z as y,$ as h,a0 as u,a1 as x,a2 as w,Y as f,b8 as b,y as g,aj as v}from"./index-WrZQf7cw.js";import{h as R}from"./hasRouteMatch-B6-B9b9t.js";import{r as S}from"./emitters-qnXuWOnN.js";import{I as F}from"./IconPhoto-CtWTATuX.js";import{P as A}from"./PictureAsPdfOutlined-B1KE8AuD.js";import{C as L,R as N}from"./Refresh-KIrQPPBf.js";import{K as j}from"./KeyboardArrowLeft-C3lIqTl8.js";const k=l()(t=>({root:{position:"relative",background:"#0001",overflow:"clip"},header:{position:"absolute",top:0,left:0,height:"48px",width:"calc(100% - 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",marginLeft:"8px",marginRight:"8px"},container:{marginTop:"48px",width:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},content:{display:"flex",width:"100%",padding:t.spacing(1),paddingBottom:t.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),D=[{type:n.Text,columns:"6",name:"totalPnl",title:r("Total PNL"),compute:t=>null!==t.totalPnl?`${t.totalPnl.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"sharpeRatio",title:r("Sharpe Ratio"),compute:t=>null!==t.sharpeRatio?`${t.sharpeRatio.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"winRate",title:r("Win Rate"),compute:t=>null!==t.winRate?`${t.winRate.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"profitFactor",title:r("Profit Factor"),compute:t=>null!==t.profitFactor?t.profitFactor.toFixed(2):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"maxDrawdown",title:r("Max Drawdown"),compute:t=>null!==t.maxDrawdown?`${t.maxDrawdown.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"expectancy",title:r("Expectancy"),compute:t=>null!==t.expectancy?`${t.expectancy.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"sortinoRatio",title:r("Sortino Ratio"),compute:t=>null!==t.sortinoRatio?t.sortinoRatio.toFixed(3):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"calmarRatio",title:r("Calmar Ratio"),compute:t=>null!==t.calmarRatio?t.calmarRatio.toFixed(3):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"recoveryFactor",title:r("Recovery Factor"),compute:t=>null!==t.recoveryFactor?t.recoveryFactor.toFixed(3):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"totalTrades",title:r("Trades"),readonly:!0}],T=({row:n})=>{const{classes:l}=k();return t(i,{className:l.root,children:[t("div",{className:l.header,children:t(e,{variant:"h6",sx:{opacity:.8},children:`${a.bullet} ${n.symbol}`})}),t("div",{className:l.container,children:t("div",{className:l.content,children:[t("div",{className:l.avatar,children:t(F,{symbol:n.symbol,sx:{width:128,height:128}})}),t(o,{handler:()=>n,fields:D,sx:{mb:2}})]})})]})},P=[{type:m.Link,action:"back-action",label:t(j,{sx:{display:"block"}})},{type:m.Link,action:"back-action",label:r("Dashboard")},{type:m.Link,action:"back-action",label:r("Heatmap")},{type:m.Button,action:"download-pdf",label:r("Download PDF"),icon:A}],C=[{action:"download-json",label:r("Download JSON"),icon:()=>t(h,{icon:y,color:"#4caf50"})},{action:"download-markdown",label:r("Download Markdown"),icon:()=>t(h,{icon:u,color:"#4caf50"})},{action:"download-pdf",label:r("Download PDF"),icon:()=>t(h,{icon:x,color:"#4caf50"})},{divider:!0},{action:"update-now",label:r("Refresh"),icon:()=>t(h,{icon:N,color:"#4caf50"})}],$=[{id:"main",element:()=>{const[e,{loading:a,execute:o}]=c(async()=>(e=>{if(!e.length)return[{type:n.Typography,typoVariant:"h6",placeholder:r("No data"),sx:{textAlign:"center",opacity:.5,mt:4}}];const a=e.map(e=>({type:n.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:n.Component,element:()=>t(T,{row:e})}}));return a.length>2?a:[{type:n.Center,sx:t=>({[t.breakpoints.up("lg")]:{"@media (min-height: 900px)":{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}}),fields:a}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>S.subscribe(o));return t(L,{children:[t(p,{items:P,actions:C,onAction:async t=>{"back-action"===t&&s.routerService.push("/"),"update-now"===t&&await S.next(),"download-markdown"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatReport(),e=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(e);s.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatReport();await g(t)})(),"download-json"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatData(),e=JSON.stringify(t,null,2),a=new Blob([e],{type:"text/plain"}),o=URL.createObjectURL(a);s.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),!e||a?t(w,{sx:{height:"calc(100dvh - 165px)"}}):t(b,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:t(f,{fields:e})})]})},isActive:t=>R(["/heat"],t)}],H=({id:e})=>t(v,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:$,params:{id:e}});export{H as HeatPage,H as default};