@backtest-kit/ui 7.3.0 → 7.4.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 (25) hide show
  1. package/build/modules/frontend/build/assets/{Article-673O2GAo.js → Article-C5-2kK-h.js} +1 -1
  2. package/build/modules/frontend/build/assets/{Background-GZVl6Dd-.js → Background-Cw2iN6KJ.js} +1 -1
  3. package/build/modules/frontend/build/assets/{IconPhoto-Dol-gfi5.js → IconPhoto-B9wAeXe1.js} +1 -1
  4. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-B96q9-RN.js → KeyboardArrowLeft-C1qRm69Y.js} +1 -1
  5. package/build/modules/frontend/build/assets/{Refresh-DKJv3mpD.js → Refresh-TNgz_b0v.js} +1 -1
  6. package/build/modules/frontend/build/assets/emitters-Uy5NDw0B.js +1 -0
  7. package/build/modules/frontend/build/assets/{hasRouteMatch-cVt-5faK.js → hasRouteMatch-CYLF108Z.js} +1 -1
  8. package/build/modules/frontend/build/assets/{html2canvas-B_SfkTNO.js → html2canvas-BiE4mNf-.js} +1 -1
  9. package/build/modules/frontend/build/assets/{index-B1bEyjto.js → index-AF9AvKwr.js} +1 -1
  10. package/build/modules/frontend/build/assets/{index-DhUPeC3A.js → index-BCP4aeGv.js} +1 -1
  11. package/build/modules/frontend/build/assets/{index-Bfrag62a.js → index-C4_OGd1K.js} +1 -1
  12. package/build/modules/frontend/build/assets/{index-CpO55Vw3.js → index-C_jQT6Zw.js} +1 -1
  13. package/build/modules/frontend/build/assets/{index-vcDgTyUw.js → index-Cle4ryUi.js} +1 -1
  14. package/build/modules/frontend/build/assets/{index-De1PN9nY.js → index-Coo1fwWW.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-BB1KfPr2.js → index-DDXw0lYL.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-tA6ppP-9.js → index-D_xsPZ0X.js} +1 -1
  17. package/build/modules/frontend/build/assets/{index-DDUY7roZ.js → index-DycIUKAc.js} +56 -56
  18. package/build/modules/frontend/build/assets/{index-G-Rr8i6Z.js → index-HmxUvvMu.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-BY91NQhQ.js → index-UiRxh0X0.js} +1 -1
  20. package/build/modules/frontend/build/assets/{index-CnzKZiFP.js → index-mHMR_sVK.js} +1 -1
  21. package/build/modules/frontend/build/assets/{index.es-CAJnvyqV.js → index.es-qA9pRd9t.js} +1 -1
  22. package/build/modules/frontend/build/assets/{markdownit-DjH6sN97.js → markdownit-B5MND-Q3.js} +1 -1
  23. package/build/modules/frontend/build/index.html +1 -1
  24. package/package.json +3 -3
  25. package/build/modules/frontend/build/assets/emitters-8Ddy6nda.js +0 -1
@@ -1 +1 @@
1
- import{b as c,f as v}from"./index-DDUY7roZ.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{b as c,f as v}from"./index-DycIUKAc.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-DDUY7roZ.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-DycIUKAc.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,J as s}from"./index-DDUY7roZ.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,J as s}from"./index-DycIUKAc.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{b as o,f as r}from"./index-DDUY7roZ.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{b as o,f as r}from"./index-DycIUKAc.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{bq as e,d as t,r as a,_ as s,f as i,br as n,j as o,bs as r,k as d,bt as m,g as u,u as p,s as x,b as c}from"./index-DDUY7roZ.js";const h=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=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:l});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:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:h,disableGutters:l,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{bq as e,d as t,r as a,_ as s,f as i,br as n,j as o,bs as r,k as d,bt as m,g as u,u as p,s as x,b as c}from"./index-DycIUKAc.js";const h=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=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:l});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:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:h,disableGutters:l,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{X as o}from"./index-DycIUKAc.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{i as a,bo as e,bp as o}from"./index-DDUY7roZ.js";const t=(t,i=a.routerService.location.pathname)=>!!e(o.filter(({path:a})=>t.includes(a)),i);export{t as h};
1
+ import{i as a,bo as e,bp as o}from"./index-DycIUKAc.js";const t=(t,i=a.routerService.location.pathname)=>!!e(o.filter(({path:a})=>t.includes(a)),i);export{t as h};
@@ -1 +1 @@
1
- import{bu as e,bw as t}from"./index-DDUY7roZ.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{bu as e,bw as t}from"./index-DycIUKAc.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 +1 @@
1
- import{b as a,f as e,T as t,L as o,bg as n,H as i,P as l,p as r,Z as c,i as s,a0 as d,v as p,w as h,y as m,z as y,A as w,E as u,G as x,x as f,aZ as b,q as g,aY as v}from"./index-DDUY7roZ.js";import{h as S}from"./hasRouteMatch-cVt-5faK.js";import{r as L}from"./emitters-8Ddy6nda.js";import{I as k}from"./IconPhoto-Dol-gfi5.js";import{C as D,R}from"./Refresh-DKJv3mpD.js";import{K as A}from"./KeyboardArrowLeft-B96q9-RN.js";const j=a(e("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"),N=r()(a=>({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:a.spacing(1),paddingBottom:a.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),V=[{type:i.Text,name:"totalPnl",title:"Total PNL",compute:a=>null!==a.totalPnl?`${a.totalPnl.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"winRate",title:"Win Rate",compute:a=>null!==a.winRate?`${a.winRate.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"profitFactor",title:"Profit Factor",compute:a=>null!==a.profitFactor?a.profitFactor.toFixed(2):"N/A",readonly:!0},{type:i.Text,columns:"6",name:"maxDrawdown",title:"Max Drawdown",compute:a=>null!==a.maxDrawdown?`${a.maxDrawdown.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"expectancy",title:"Expectancy",compute:a=>null!==a.expectancy?`${a.expectancy.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,fieldBottomMargin:"0",name:"totalTrades",title:"Trades",readonly:!0}],F=({row:a})=>{const{classes:i}=N();return e(l,{className:i.root,children:[e("div",{className:i.header,children:e(t,{variant:"h6",sx:{opacity:.8},children:`${o.bullet} ${a.symbol}`})}),e("div",{className:i.container,children:e("div",{className:i.content,children:[e("div",{className:i.avatar,children:e(k,{symbol:a.symbol,sx:{width:128,height:128}})}),e(n,{handler:()=>a,fields:V,sx:{mb:2}})]})})]})},H=[{type:h.Link,action:"back-action",label:e(A,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Dashboard"},{type:h.Link,action:"back-action",label:"Heatmap"},{type:h.Button,action:"download-pdf",label:"Download PDF",icon:j}],T=[{action:"download-json",label:"Download JSON",icon:()=>e(y,{icon:m,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>e(y,{icon:w,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>e(y,{icon:u,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>e(y,{icon:R,color:"#4caf50"})}],P=[{id:"main",element:()=>{const[a,{loading:t,execute:o}]=c(async()=>(a=>{if(!a.length)return[{type:i.Typography,typoVariant:"h6",placeholder:"No data",sx:{textAlign:"center",opacity:.5,mt:4}}];const t=a.map(a=>({type:i.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:i.Component,element:()=>e(F,{row:a})}}));return t.length>2?t:[{type:i.Center,sx:a=>({[a.breakpoints.up("lg")]:{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}),fields:t}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>L.subscribe(o));return e(D,{children:[e(p,{items:H,actions:T,onAction:async a=>{"back-action"===a&&s.routerService.push("/"),"update-now"===a&&await L.next(),"download-markdown"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatReport(),e=new Blob([a],{type:"text/plain"}),t=URL.createObjectURL(e);s.layoutService.downloadFile(t,`heat_${Date.now()}.md`)})(),"download-pdf"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatReport();await g(a)})(),"download-json"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatData(),e=JSON.stringify(a,null,2),t=new Blob([e],{type:"text/plain"}),o=URL.createObjectURL(t);s.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!a||t?e(x,{sx:{height:"calc(100dvh - 165px)"}}):e(b,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:e(f,{fields:a})})]})},isActive:a=>S(["/heat"],a)}],z=({id:a})=>e(v,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:P,params:{id:a}});export{z as HeatPage,z as default};
1
+ import{b as a,f as e,T as t,L as o,bg as n,H as i,P as l,p as r,Z as c,i as s,a0 as d,v as p,w as h,y as m,z as y,A as w,E as u,G as x,x as f,aZ as b,q as g,aY as v}from"./index-DycIUKAc.js";import{h as S}from"./hasRouteMatch-CYLF108Z.js";import{r as L}from"./emitters-Uy5NDw0B.js";import{I as k}from"./IconPhoto-B9wAeXe1.js";import{C as D,R}from"./Refresh-TNgz_b0v.js";import{K as A}from"./KeyboardArrowLeft-C1qRm69Y.js";const j=a(e("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"),N=r()(a=>({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:a.spacing(1),paddingBottom:a.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),V=[{type:i.Text,name:"totalPnl",title:"Total PNL",compute:a=>null!==a.totalPnl?`${a.totalPnl.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"winRate",title:"Win Rate",compute:a=>null!==a.winRate?`${a.winRate.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"profitFactor",title:"Profit Factor",compute:a=>null!==a.profitFactor?a.profitFactor.toFixed(2):"N/A",readonly:!0},{type:i.Text,columns:"6",name:"maxDrawdown",title:"Max Drawdown",compute:a=>null!==a.maxDrawdown?`${a.maxDrawdown.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"expectancy",title:"Expectancy",compute:a=>null!==a.expectancy?`${a.expectancy.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,fieldBottomMargin:"0",name:"totalTrades",title:"Trades",readonly:!0}],F=({row:a})=>{const{classes:i}=N();return e(l,{className:i.root,children:[e("div",{className:i.header,children:e(t,{variant:"h6",sx:{opacity:.8},children:`${o.bullet} ${a.symbol}`})}),e("div",{className:i.container,children:e("div",{className:i.content,children:[e("div",{className:i.avatar,children:e(k,{symbol:a.symbol,sx:{width:128,height:128}})}),e(n,{handler:()=>a,fields:V,sx:{mb:2}})]})})]})},H=[{type:h.Link,action:"back-action",label:e(A,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Dashboard"},{type:h.Link,action:"back-action",label:"Heatmap"},{type:h.Button,action:"download-pdf",label:"Download PDF",icon:j}],T=[{action:"download-json",label:"Download JSON",icon:()=>e(y,{icon:m,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>e(y,{icon:w,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>e(y,{icon:u,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>e(y,{icon:R,color:"#4caf50"})}],P=[{id:"main",element:()=>{const[a,{loading:t,execute:o}]=c(async()=>(a=>{if(!a.length)return[{type:i.Typography,typoVariant:"h6",placeholder:"No data",sx:{textAlign:"center",opacity:.5,mt:4}}];const t=a.map(a=>({type:i.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:i.Component,element:()=>e(F,{row:a})}}));return t.length>2?t:[{type:i.Center,sx:a=>({[a.breakpoints.up("lg")]:{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}),fields:t}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>L.subscribe(o));return e(D,{children:[e(p,{items:H,actions:T,onAction:async a=>{"back-action"===a&&s.routerService.push("/"),"update-now"===a&&await L.next(),"download-markdown"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatReport(),e=new Blob([a],{type:"text/plain"}),t=URL.createObjectURL(e);s.layoutService.downloadFile(t,`heat_${Date.now()}.md`)})(),"download-pdf"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatReport();await g(a)})(),"download-json"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatData(),e=JSON.stringify(a,null,2),t=new Blob([e],{type:"text/plain"}),o=URL.createObjectURL(t);s.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!a||t?e(x,{sx:{height:"calc(100dvh - 165px)"}}):e(b,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:e(f,{fields:a})})]})},isActive:a=>S(["/heat"],a)}],z=({id:a})=>e(v,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:P,params:{id:a}});export{z as HeatPage,z as default};
@@ -1 +1 @@
1
- import{h as e,f as t,c as n,r,i,S as o,m as a,U as l}from"./index-DDUY7roZ.js";const[c,s]=e("pine-code-context"),u=e=>t(c,{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}),[d,h]=e("pine-from-date-context"),v=e=>t(d,{initialState:"",children:e.children}),[m,p]=e("pine-limit-context"),g=e=>t(m,{initialState:250,children:e.children}),[f,y]=e("pine-symbol-context"),b=e=>t(f,{initialState:"BTCUSDT",children:e.children}),[C,D]=e("pine-timeframe-context"),x=e=>t(C,{initialState:"1",children:e.children}),[S,w]=e("pine-to-date-context"),T=e=>t(S,{initialState:"",children:e.children}),k=n(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:"Bars limit"}),t("input",{type:"date",value:e.v11,onChange:e.v12,style:e.v13,title:"From date"}),t("input",{type:"date",value:e.v14,onChange:e.v15,style:e.v16,title:"To date"}),t("button",{onClick:e.v17,disabled:e.v18,style:e.v19,children:e.v20}),e.v21]}),{name:"Toolbar_1",portals:["v7","v20","v21"]}),R=function({symbol:e,timeframe:n,fromDate:r,toDate:i,limit:o,running:a,status:l,onSymbolChange:c,onTimeframeChange:s,onFromDateChange:u,onToDateChange:d,onLimitChange:h,onRun:v}){return t(k,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>c(e.target.value.toUpperCase()),v3:{...B,width:100},v4:n,v5:e=>s(e.target.value),v6:B,v7:z.map(e=>t("option",{children:e},e)),v8:o,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:r,v12:e=>u(e.target.value),v13:F,v14:i,v15:e=>d(e.target.value),v16:F,v17:v,v18:a,v19:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v20:a?"...":"▶ Run",v21:l&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:l})})},z=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},F={...B,colorScheme:"dark"},U=n(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"}})},$={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 L(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class I{async getMarketData(e,t,n,r,o){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=$[t]??t;return(await i.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:o})).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 M=()=>t(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),P=()=>{const e=r.useRef(null),[n,i]=s(),[o,l]=y(),[c,u]=D(),[d,v]=h(),[m,g]=w(),[f,b]=p(),{run:C,status:x,running:S}=function(){const e=r.useRef(null),t=r.useRef(null),n=r.useRef(null),[i,o]=r.useState(""),[a,l]=r.useState(!1);function c(){if(n.current){try{n.current.stop()}catch{}n.current=null}}function s(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function u(e){o(`Error: ${e.message}`),l(!1)}return r.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),c(),s()}},[]),{run:function({symbol:r,timeframe:i,fromDate:a,toDate:d,limit:h,code:v,containerRef:m}){if(!m.current)return;l(!0),o("Connecting..."),c(),s();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(v);let g=!1;try{const c=a?new Date(a).getTime():void 0,s=d?new Date(d).getTime():void 0,f=new I,y=new PineTS(f,r,i,h,c,s).stream(v,{pageSize:500,live:!0,interval:3e3});n.current=y,y.on("data",a=>{var c,s;if(n.current===y)if(g)t.current&&a.plots&&t.current.updateData(a.plots),null==(s=e.current)||s.updateData([L(a.marketData[a.marketData.length-1])]);else{g=!0;const n=a.marketData.map(L);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${r} · ${i}`,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(n);const s=(null==(c=a.fullContext)?void 0:c.plots)??a.plots;t.current=e.current.addIndicator("indicator",s,{overlay:p,height:p?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),o(`${n.length} bars loaded`),l(!1)}}),y.on("error",u)}catch(f){u(f)}},status:i,running:a}}();function T(){C({symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,code:n,containerRef:e})}return t(a,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(R,{symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,running:S,status:x,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:v,onToDateChange:g,onLimitChange:b,onRun:T}),t("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[t(E,{value:n,onChange:i,onRun:T}),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:["Press ",t("b",{children:"▶ Run"})," or ",t("b",{children:"Ctrl+Enter"})," to load the chart"]})})})]}),t(M,{})]})})},A=l(e=>t(u,{children:e}),e=>t(v,{children:e}),e=>t(T,{children:e}),e=>t(g,{children:e}),e=>t(b,{children:e}),e=>t(x,{children:e})),N=()=>A(t(P,{}));export{N as PinePage,N as default};
1
+ import{h as e,f as t,c as n,r,i,S as o,m as a,U as l}from"./index-DycIUKAc.js";const[c,s]=e("pine-code-context"),u=e=>t(c,{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}),[d,h]=e("pine-from-date-context"),v=e=>t(d,{initialState:"",children:e.children}),[m,p]=e("pine-limit-context"),g=e=>t(m,{initialState:250,children:e.children}),[f,y]=e("pine-symbol-context"),b=e=>t(f,{initialState:"BTCUSDT",children:e.children}),[C,D]=e("pine-timeframe-context"),x=e=>t(C,{initialState:"1",children:e.children}),[S,w]=e("pine-to-date-context"),T=e=>t(S,{initialState:"",children:e.children}),k=n(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:"Bars limit"}),t("input",{type:"date",value:e.v11,onChange:e.v12,style:e.v13,title:"From date"}),t("input",{type:"date",value:e.v14,onChange:e.v15,style:e.v16,title:"To date"}),t("button",{onClick:e.v17,disabled:e.v18,style:e.v19,children:e.v20}),e.v21]}),{name:"Toolbar_1",portals:["v7","v20","v21"]}),R=function({symbol:e,timeframe:n,fromDate:r,toDate:i,limit:o,running:a,status:l,onSymbolChange:c,onTimeframeChange:s,onFromDateChange:u,onToDateChange:d,onLimitChange:h,onRun:v}){return t(k,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>c(e.target.value.toUpperCase()),v3:{...B,width:100},v4:n,v5:e=>s(e.target.value),v6:B,v7:z.map(e=>t("option",{children:e},e)),v8:o,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:r,v12:e=>u(e.target.value),v13:F,v14:i,v15:e=>d(e.target.value),v16:F,v17:v,v18:a,v19:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v20:a?"...":"▶ Run",v21:l&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:l})})},z=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},F={...B,colorScheme:"dark"},U=n(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"}})},$={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 L(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class I{async getMarketData(e,t,n,r,o){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=$[t]??t;return(await i.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:o})).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 M=()=>t(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),P=()=>{const e=r.useRef(null),[n,i]=s(),[o,l]=y(),[c,u]=D(),[d,v]=h(),[m,g]=w(),[f,b]=p(),{run:C,status:x,running:S}=function(){const e=r.useRef(null),t=r.useRef(null),n=r.useRef(null),[i,o]=r.useState(""),[a,l]=r.useState(!1);function c(){if(n.current){try{n.current.stop()}catch{}n.current=null}}function s(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function u(e){o(`Error: ${e.message}`),l(!1)}return r.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),c(),s()}},[]),{run:function({symbol:r,timeframe:i,fromDate:a,toDate:d,limit:h,code:v,containerRef:m}){if(!m.current)return;l(!0),o("Connecting..."),c(),s();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(v);let g=!1;try{const c=a?new Date(a).getTime():void 0,s=d?new Date(d).getTime():void 0,f=new I,y=new PineTS(f,r,i,h,c,s).stream(v,{pageSize:500,live:!0,interval:3e3});n.current=y,y.on("data",a=>{var c,s;if(n.current===y)if(g)t.current&&a.plots&&t.current.updateData(a.plots),null==(s=e.current)||s.updateData([L(a.marketData[a.marketData.length-1])]);else{g=!0;const n=a.marketData.map(L);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${r} · ${i}`,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(n);const s=(null==(c=a.fullContext)?void 0:c.plots)??a.plots;t.current=e.current.addIndicator("indicator",s,{overlay:p,height:p?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),o(`${n.length} bars loaded`),l(!1)}}),y.on("error",u)}catch(f){u(f)}},status:i,running:a}}();function T(){C({symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,code:n,containerRef:e})}return t(a,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(R,{symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,running:S,status:x,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:v,onToDateChange:g,onLimitChange:b,onRun:T}),t("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[t(E,{value:n,onChange:i,onRun:T}),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:["Press ",t("b",{children:"▶ Run"})," or ",t("b",{children:"Ctrl+Enter"})," to load the chart"]})})})]}),t(M,{})]})})},A=l(e=>t(u,{children:e}),e=>t(v,{children:e}),e=>t(T,{children:e}),e=>t(g,{children:e}),e=>t(b,{children:e}),e=>t(x,{children:e})),N=()=>A(t(P,{}));export{N as PinePage,N as default};
@@ -1 +1 @@
1
- import{b as e,f as a,r as t,b7 as i,b8 as o,Z as r,i as s,b9 as n,ba as c,bb as l,I as d,au as p,aQ as h,bc as u,p as m,a8 as b,bd as f,G as y,T as g,aS as v,a2 as x,Q as w,be as S,a3 as L,bf as k,aM as A,y as j,a0 as C,X as z,v as N,w as E,aZ as H,B as M,z as R,aY as T}from"./index-DDUY7roZ.js";import{h as I}from"./hasRouteMatch-cVt-5faK.js";import{B as V}from"./Background-GZVl6Dd-.js";import{A as B}from"./Article-673O2GAo.js";import{C as D,R as F}from"./Refresh-DKJv3mpD.js";import{K}from"./KeyboardArrowLeft-B96q9-RN.js";const P=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"),Q=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"),W="65px",X=e=>e.mimeType.startsWith("image/")?a(P,{sx:{color:"#f57c00",fontSize:20}}):"application/json"===e.mimeType?a(j,{sx:{color:"#7b1fa2",fontSize:20}}):e.mimeType.startsWith("text/")?a(B,{sx:{color:"#1976d2",fontSize:20}}):a(Q,{sx:{color:"#546e7a",fontSize:20}}),Z=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:W},input:{height:W,paddingRight:e.spacing(2),paddingLeft:e.spacing(1),width:"100%"},container:{position:"absolute",top:W,left:0,right:0,bottom:0,height:`calc(100% - ${W})`,width:"100%",background:"white",overflow:"clip",display:"flex",alignItems:"stretch",justifyContent:"stretch"},content:{display:"flex",flex:1},loader:{height:"100%",width:"100%"},accent:{background:b("#00c3ff",.05)}})),G=({outlinePaper:e,className:m,style:b,sx:j,nodes:C,initialSearch:z=""})=>{const{classes:N,cx:E}=Z(),[H,M]=t.useState(z),R=i(H),[T,{flush:I}]=o(H,2500),[V,{loading:B}]=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})(T,C),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),deps:[T,C]}),{execute:D}=n(async e=>{await s.layoutService.pickDumpContent(e)},{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});return a(u,{outlinePaper:e,className:E(N.root,m),style:b,sx:j,children:[a("div",{className:N.header,children:a(c,{disabled:B,className:N.input,endAdornment:a(l,{position:"end",children:a(d,{disabled:B||!H,onClick:()=>{R.once(async()=>{await f(500),I()}),M("")},edge:"end",children:a(H?p:h,{})})}),placeholder:"Search",value:H,onBlur:()=>I(),onChange:({target:e})=>M(e.value),onKeyDown:({key:e,currentTarget:a})=>"Enter"===e&&a.blur()})}),a("div",{className:N.container,children:a("div",{className:N.content,children:V?V.length?a(A,{withScrollbar:!0,children:V.map((e,t)=>a(x,{className:E({[N.accent]:t%2==1}),component:w,onClick:()=>(async e=>{await D(e)})(e.id),children:[a(S,{children:X(e)}),a(L,{primary:e.label,secondary:e.path}),a(k,{content:e.path,label:"Copy path"})]},e.id))}):a(v,{sx:{height:"100%",width:"100%"},children:a(g,{variant:"h6",sx:{opacity:.5},children:"Not found"})}):a(y,{className:N.loader})})})]})},O=[{type:E.Link,action:"back-action",label:a(K,{sx:{display:"block"}})},{type:E.Link,action:"back-action",label:"Main"},{type:E.Link,action:"back-action",label:"Dump Explorer"}],Y=[{action:"update-now",label:"Refresh",icon:()=>a(R,{icon:F,color:"#4caf50"})}],$=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)});C(()=>$.subscribe(o));return a(D,{children:[a(N,{items:O,actions:Y,onAction:e=>{"back-action"===e&&s.routerService.push("/"),"update-now"===e&&(s.explorerViewService.clear(),$.next())}}),a(H,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(M,{pr:2,pl:2,children:i||!t?a(v,{children:a(g,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a(G,{nodes:t,initialSearch:e.search})})}),a(V,{})]})},J=[{id:"search",element:q,isActive:e=>I(["/dump/:search"],e)},{id:"main",element:q,isActive:e=>I(["/dump"],e)}],U=({search:e=""})=>a(T,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:J,params:{search:e}});export{U as DumpPage,U as default};
1
+ import{b as e,f as a,r as t,b7 as i,b8 as o,Z as r,i as s,b9 as n,ba as c,bb as l,I as d,au as p,aQ as h,bc as u,p as m,a8 as b,bd as f,G as y,T as g,aS as v,a2 as x,Q as w,be as S,a3 as L,bf as k,aM as A,y as j,a0 as C,X as z,v as N,w as E,aZ as H,B as M,z as R,aY as T}from"./index-DycIUKAc.js";import{h as I}from"./hasRouteMatch-CYLF108Z.js";import{B as V}from"./Background-Cw2iN6KJ.js";import{A as B}from"./Article-C5-2kK-h.js";import{C as D,R as F}from"./Refresh-TNgz_b0v.js";import{K}from"./KeyboardArrowLeft-C1qRm69Y.js";const P=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"),Q=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"),W="65px",X=e=>e.mimeType.startsWith("image/")?a(P,{sx:{color:"#f57c00",fontSize:20}}):"application/json"===e.mimeType?a(j,{sx:{color:"#7b1fa2",fontSize:20}}):e.mimeType.startsWith("text/")?a(B,{sx:{color:"#1976d2",fontSize:20}}):a(Q,{sx:{color:"#546e7a",fontSize:20}}),Z=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:W},input:{height:W,paddingRight:e.spacing(2),paddingLeft:e.spacing(1),width:"100%"},container:{position:"absolute",top:W,left:0,right:0,bottom:0,height:`calc(100% - ${W})`,width:"100%",background:"white",overflow:"clip",display:"flex",alignItems:"stretch",justifyContent:"stretch"},content:{display:"flex",flex:1},loader:{height:"100%",width:"100%"},accent:{background:b("#00c3ff",.05)}})),G=({outlinePaper:e,className:m,style:b,sx:j,nodes:C,initialSearch:z=""})=>{const{classes:N,cx:E}=Z(),[H,M]=t.useState(z),R=i(H),[T,{flush:I}]=o(H,2500),[V,{loading:B}]=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})(T,C),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),deps:[T,C]}),{execute:D}=n(async e=>{await s.layoutService.pickDumpContent(e)},{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});return a(u,{outlinePaper:e,className:E(N.root,m),style:b,sx:j,children:[a("div",{className:N.header,children:a(c,{disabled:B,className:N.input,endAdornment:a(l,{position:"end",children:a(d,{disabled:B||!H,onClick:()=>{R.once(async()=>{await f(500),I()}),M("")},edge:"end",children:a(H?p:h,{})})}),placeholder:"Search",value:H,onBlur:()=>I(),onChange:({target:e})=>M(e.value),onKeyDown:({key:e,currentTarget:a})=>"Enter"===e&&a.blur()})}),a("div",{className:N.container,children:a("div",{className:N.content,children:V?V.length?a(A,{withScrollbar:!0,children:V.map((e,t)=>a(x,{className:E({[N.accent]:t%2==1}),component:w,onClick:()=>(async e=>{await D(e)})(e.id),children:[a(S,{children:X(e)}),a(L,{primary:e.label,secondary:e.path}),a(k,{content:e.path,label:"Copy path"})]},e.id))}):a(v,{sx:{height:"100%",width:"100%"},children:a(g,{variant:"h6",sx:{opacity:.5},children:"Not found"})}):a(y,{className:N.loader})})})]})},O=[{type:E.Link,action:"back-action",label:a(K,{sx:{display:"block"}})},{type:E.Link,action:"back-action",label:"Main"},{type:E.Link,action:"back-action",label:"Dump Explorer"}],Y=[{action:"update-now",label:"Refresh",icon:()=>a(R,{icon:F,color:"#4caf50"})}],$=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)});C(()=>$.subscribe(o));return a(D,{children:[a(N,{items:O,actions:Y,onAction:e=>{"back-action"===e&&s.routerService.push("/"),"update-now"===e&&(s.explorerViewService.clear(),$.next())}}),a(H,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(M,{pr:2,pl:2,children:i||!t?a(v,{children:a(g,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a(G,{nodes:t,initialSearch:e.search})})}),a(V,{})]})},J=[{id:"search",element:q,isActive:e=>I(["/dump/:search"],e)},{id:"main",element:q,isActive:e=>I(["/dump"],e)}],U=({search:e=""})=>a(T,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:J,params:{search:e}});export{U as DumpPage,U as default};
@@ -1 +1 @@
1
- import{aR as a,Z as t,i as e,f as o,v as i,w as n,p as s,H as r,z as c,T as l,aS as d,x as p,B as u,F as m,K as b,L as y,N as h,Q as g,l as f,n as S,O as v,V as L,aT as k,aU as w,aV as x,q as A,a0 as N,X as C,aW as R,D as j,aX as $,aY as F}from"./index-DDUY7roZ.js";import{h as H}from"./hasRouteMatch-cVt-5faK.js";import{I as B}from"./IconPhoto-Dol-gfi5.js";import{C as M,R as V}from"./Refresh-DKJv3mpD.js";import{K as E}from"./KeyboardArrowLeft-B96q9-RN.js";import{B as _}from"./Background-GZVl6Dd-.js";const G="backtest-kit__groupHeader",O="backtest-kit__groupRoot",z="backtest-kit__symbolImage",I=s()({root:{[`& .${O}:hover .${G}`]:{opacity:"1 !important"}}});function P(a){return L(a,"#000000")>L(a,"#FFFFFF")}const T=[{type:n.Link,action:"back-action",label:o(E,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"}],U=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],D=(a,t)=>({type:r.Group,className:O,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:G,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(h,{direction:"row",children:[o(b,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} ${a}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:t.map(({symbol:a,label:t,to:i,color:n})=>((a,t,i,n)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(v,{component:g,onClick:()=>{e.routerService.push(`/status/${t}`)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${z}`]:{transition:"filter 500ms"},"&:hover":{background:()=>P(n)?f(n,.33):S(n,.33),[`& .${z}`]:{transition:"filter 500ms",filter:P(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(B,{className:z,symbol:a}),children:i})}))(a,i,t,n))}]}),K=[{type:n.Link,action:"back-action",label:o(E,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"},{type:n.Link,action:"back-action",compute:a=>a?`${String(a.symbol).toUpperCase()} (${a.strategyName})`:"Live"},{type:n.Button,action:"print-action",label:"Print",icon:R}],W=[{action:"print-action",label:"Print",icon:()=>o(c,{icon:R,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>o(c,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],X=new C,q=[{id:"status",element:({params:a})=>{const[n]=t(async()=>{const t=await e.statusViewService.getStatusMap();return k.get(t,a.id,null)},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[a.id]}),[s,{loading:r,execute:c}]=t(async()=>await e.statusViewService.getStatusOne(a.id),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[a.id]}),b=w(async()=>{if(!s)return;const a=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),t=URL.createObjectURL(a);e.layoutService.downloadFile(t,`status_${Date.now()}.json`)}),y=w(async()=>{if(!s)return;const a=e.markdownHelperService.buildMarkdownFromFields(x,s);await A(a)});N(()=>X.subscribe(c));return o(M,{children:[o(i,{items:K,actions:W,payload:n,onAction:async a=>{"back-action"===a&&((async()=>{1!==(await e.statusViewService.getStatusList()).length?e.routerService.push("/status"):e.routerService.push("/")})(),e.routerService.push("/")),"update-now"===a&&await X.next(),"download-action"===a&&await b(),"print-action"===a&&await y()}}),r?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):s?o(m,{children:[o(p,{handler:s,fields:$}),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),o(_,{})]})},isActive:a=>H(["/status/:id"],a)},{id:"main",element:()=>{const{classes:n}=I(),{reloadTrigger:s,doReload:c}=a();t(async()=>{const a=await e.statusViewService.getStatusList();if(1===a.length){const[{id:t}]=a;e.routerService.push(`/status/${t}`)}},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});const[b,{loading:y}]=t(async()=>await(async()=>{const[a,t]=await Promise.all([e.symbolGlobalService.getSymbolMap(),e.statusViewService.getStatusList()]);if(!t||0===t.length)return[{type:r.Typography,typoVariant:"h6",placeholder:"Listening for a pending signal...",sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};t.forEach(t=>{const e=a[t.symbol],i=t.strategyName;o[i]||(o[i]=[]),o[i].push({symbol:t.symbol,label:(null==e?void 0:e.displayName)||t.symbol,color:(null==e?void 0:e.color)||"#ccc",to:t.id})});const i=Object.entries(o).sort(([,a],[,t])=>t.length-a.length),n=[],s=[],c=[];return i.forEach(([a,t],e)=>{const o=D(a,t);e%2==0?n.push(o):s.push(o),c.push(o)}),[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:s},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:c}]})(),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});return o(M,{children:[o(i,{items:T,actions:U,onAction:a=>{"back-action"===a&&e.routerService.push("/"),"update-now"===a&&c()}}),y||!b?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):b.length?o(m,{children:[o(p,{className:n.root,fields:b},s),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:a=>H(["/status"],a)}],J=({id:a})=>o(F,{history:e.routerService,onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),routes:q,params:{id:a}});export{J as StatusPage,J as default};
1
+ import{aR as a,Z as t,i as e,f as o,v as i,w as n,p as s,H as r,z as c,T as l,aS as d,x as p,B as u,F as m,K as b,L as y,N as h,Q as g,l as f,n as S,O as v,V as L,aT as k,aU as w,aV as x,q as A,a0 as N,X as C,aW as R,D as j,aX as $,aY as F}from"./index-DycIUKAc.js";import{h as H}from"./hasRouteMatch-CYLF108Z.js";import{I as B}from"./IconPhoto-B9wAeXe1.js";import{C as M,R as V}from"./Refresh-TNgz_b0v.js";import{K as E}from"./KeyboardArrowLeft-C1qRm69Y.js";import{B as _}from"./Background-Cw2iN6KJ.js";const G="backtest-kit__groupHeader",O="backtest-kit__groupRoot",z="backtest-kit__symbolImage",I=s()({root:{[`& .${O}:hover .${G}`]:{opacity:"1 !important"}}});function P(a){return L(a,"#000000")>L(a,"#FFFFFF")}const T=[{type:n.Link,action:"back-action",label:o(E,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"}],U=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],D=(a,t)=>({type:r.Group,className:O,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:G,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(h,{direction:"row",children:[o(b,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} ${a}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:t.map(({symbol:a,label:t,to:i,color:n})=>((a,t,i,n)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(v,{component:g,onClick:()=>{e.routerService.push(`/status/${t}`)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${z}`]:{transition:"filter 500ms"},"&:hover":{background:()=>P(n)?f(n,.33):S(n,.33),[`& .${z}`]:{transition:"filter 500ms",filter:P(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(B,{className:z,symbol:a}),children:i})}))(a,i,t,n))}]}),K=[{type:n.Link,action:"back-action",label:o(E,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"},{type:n.Link,action:"back-action",compute:a=>a?`${String(a.symbol).toUpperCase()} (${a.strategyName})`:"Live"},{type:n.Button,action:"print-action",label:"Print",icon:R}],W=[{action:"print-action",label:"Print",icon:()=>o(c,{icon:R,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>o(c,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],X=new C,q=[{id:"status",element:({params:a})=>{const[n]=t(async()=>{const t=await e.statusViewService.getStatusMap();return k.get(t,a.id,null)},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[a.id]}),[s,{loading:r,execute:c}]=t(async()=>await e.statusViewService.getStatusOne(a.id),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[a.id]}),b=w(async()=>{if(!s)return;const a=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),t=URL.createObjectURL(a);e.layoutService.downloadFile(t,`status_${Date.now()}.json`)}),y=w(async()=>{if(!s)return;const a=e.markdownHelperService.buildMarkdownFromFields(x,s);await A(a)});N(()=>X.subscribe(c));return o(M,{children:[o(i,{items:K,actions:W,payload:n,onAction:async a=>{"back-action"===a&&((async()=>{1!==(await e.statusViewService.getStatusList()).length?e.routerService.push("/status"):e.routerService.push("/")})(),e.routerService.push("/")),"update-now"===a&&await X.next(),"download-action"===a&&await b(),"print-action"===a&&await y()}}),r?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):s?o(m,{children:[o(p,{handler:s,fields:$}),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),o(_,{})]})},isActive:a=>H(["/status/:id"],a)},{id:"main",element:()=>{const{classes:n}=I(),{reloadTrigger:s,doReload:c}=a();t(async()=>{const a=await e.statusViewService.getStatusList();if(1===a.length){const[{id:t}]=a;e.routerService.push(`/status/${t}`)}},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});const[b,{loading:y}]=t(async()=>await(async()=>{const[a,t]=await Promise.all([e.symbolGlobalService.getSymbolMap(),e.statusViewService.getStatusList()]);if(!t||0===t.length)return[{type:r.Typography,typoVariant:"h6",placeholder:"Listening for a pending signal...",sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};t.forEach(t=>{const e=a[t.symbol],i=t.strategyName;o[i]||(o[i]=[]),o[i].push({symbol:t.symbol,label:(null==e?void 0:e.displayName)||t.symbol,color:(null==e?void 0:e.color)||"#ccc",to:t.id})});const i=Object.entries(o).sort(([,a],[,t])=>t.length-a.length),n=[],s=[],c=[];return i.forEach(([a,t],e)=>{const o=D(a,t);e%2==0?n.push(o):s.push(o),c.push(o)}),[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:s},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:c}]})(),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});return o(M,{children:[o(i,{items:T,actions:U,onAction:a=>{"back-action"===a&&e.routerService.push("/"),"update-now"===a&&c()}}),y||!b?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):b.length?o(m,{children:[o(p,{className:n.root,fields:b},s),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:a=>H(["/status"],a)}],J=({id:a})=>o(F,{history:e.routerService,onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),routes:q,params:{id:a}});export{J as StatusPage,J as default};
@@ -1 +1 @@
1
- import{g as e,a as t,b as a,f as o,r as n,u as r,_ as i,d as s,I as l,C as c,e as d,j as p,k as h,s as m,P as v,l as u,n as g,T as f,o as y,B as w,M as z,t as b,p as x,D as S,F as C,q as M,v as k,w as V,J as H,i as L,x as $,y as N,z as T,A,E as R,G as P,H as F,K as B,L as I,N as D,O,Q as E,R as j,V as W,W as J}from"./index-DDUY7roZ.js";import{r as _}from"./emitters-8Ddy6nda.js";import{C as G,R as U}from"./Refresh-DKJv3mpD.js";function K(t){return e("MuiAlert",t)}const Z=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),q=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"),Q=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),X=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"),Y=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"),ee=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],te=m(v,{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,n=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},n&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${n}Color`]:a(e.palette[n].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${n}StandardBg`]:o(e.palette[n].light,.9),[`& .${Z.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}},n&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${n}Color`]:a(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Z.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}},n&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${n}FilledColor`],backgroundColor:e.vars.palette.Alert[`${n}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[n].dark:e.palette[n].main,color:e.palette.getContrastText(e.palette[n].main)}))}),ae=m("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),oe=m("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ne=m("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),re={success:o(q,{fontSize:"inherit"}),warning:o(Q,{fontSize:"inherit"}),error:o(X,{fontSize:"inherit"}),info:o(Y,{fontSize:"inherit"})},ie=n.forwardRef(function(e,t){var a,n,m,v,u,g;const f=r({props:e,name:"MuiAlert"}),{action:y,children:w,className:z,closeText:b="Close",color:x,components:S={},componentsProps:C={},icon:M,iconMapping:k=re,onClose:V,role:H="alert",severity:L="success",slotProps:$={},slots:N={},variant:T="standard"}=f,A=i(f,ee),R=s({},f,{color:x,severity:L,variant:T}),P=(e=>{const{variant:t,color:a,severity:o,classes:n}=e,r={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(r,K,n)})(R),F=null!=(a=null!=(n=N.closeButton)?n:S.CloseButton)?a:l,B=null!=(m=null!=(v=N.closeIcon)?v:S.CloseIcon)?m:c,I=null!=(u=$.closeButton)?u:C.closeButton,D=null!=(g=$.closeIcon)?g:C.closeIcon;return o(te,s({role:H,elevation:0,ownerState:R,className:d(P.root,z),ref:t},A,{children:[!1!==M?o(ae,{ownerState:R,className:P.icon,children:M||k[L]||re[L]}):null,o(oe,{ownerState:R,className:P.message,children:w}),null!=y?o(ne,{ownerState:R,className:P.action,children:y}):null,null==y&&V?o(ne,{ownerState:R,className:P.action,children:o(F,s({size:"small","aria-label":b,title:b,color:"inherit",onClick:V},I,{children:o(B,s({fontSize:"small"},D))}))}):null]}))}),se=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"),le=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"),ce=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"),de=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"),pe=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),he=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),me=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"),ve=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"),ue=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"),ge=a(o(n.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"),fe=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"),ye=x()(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)},downloadButton:{cursor:"pointer !important"}})),we=(e,t="%")=>null===e?"—":`${e.toFixed(2)}${t}`,ze=e=>window.Translate?window.Translate.translateText(e):e,be=({data:e})=>{const{classes:t,cx:a}=ye(),[r,i]=n.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:n,symbols:r,backtest:i}=e,s=ze(i?"Backtest":"Live"),l=t.frameName?` / ${t.frameName}`:"",c=[`## ${s}: ${t.strategyName} / ${t.exchangeName}${l}`,"",`**${ze("Total PNL")}:** ${we(a)} `,`**Sharpe Ratio:** ${we(o,"")} `,`**${ze("Total trades")}:** ${n}`,""];for(const d of r)c.push(`### ${d.symbol}`,"",`**PNL:** ${we(d.totalPnl)} `,`**Win Rate:** ${we(d.winRate)} `,`**Profit Factor:** ${we(d.profitFactor,"")} `,`**Max Drawdown:** ${we(d.maxDrawdown)} `,`**Expectancy:** ${we(d.expectancy)} `,`**${ze("Trades")}:** ${d.totalTrades}`,"");return c.join("\n")})(e),c=()=>{i(!r)},d=async e=>{e.stopPropagation(),await M(s)};return o(ie,{className:a(t.root,{[t.open]:r}),action:o(C,{children:[o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(S,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(r?pe:he,{})})]}),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:r?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?"Backtest":"Live",": ",e.context.strategyName]}),o(y,{in:r,timeout:"auto",unmountOnExit:!0,children:[o(w,{paddingBottom:"16px"}),o(z,{content:s}),o(w,{paddingBottom:"32px"})]}),!r&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[b(s).slice(0,150),"..."]})]})})},xe="backtest-kit__groupHeader",Se="backtest-kit__groupRoot",Ce="backtest-kit__symbolImage",Me=x()({root:{[`& .${Se}:hover .${xe}`]:{opacity:"1 !important"}}});function ke(e){return W(e,"#000000")>W(e,"#FFFFFF")}const Ve=[{type:V.Link,action:"back-action",label:"Main"},{type:V.Link,action:"back-action",label:"Navigation"}],He=[{action:"download-json",label:"Download Heatmap JSON",icon:()=>o(T,{icon:N,color:"#4caf50"})},{action:"download-markdown",label:"Download Heatmap Markdown",icon:()=>o(T,{icon:A,color:"#4caf50"})},{action:"download-pdf",label:"Download Heatmap PDF",icon:()=>o(T,{icon:R,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(T,{icon:U,color:"#4caf50"})}],Le=(e,t)=>({type:F.Group,className:Se,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:F.Component,className:xe,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(D,{direction:"row",children:[o(B,{variant:"outlined",size:"medium",color:"info",label:`${I.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(w,{flex:1})]})},{type:F.Group,fields:t.map(({label:e,description:t,to:a,color:n,icon:r})=>((e,t,a,n,r)=>({type:F.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(j,{description:a,children:o(O,{component:E,onClick:()=>{L.routerService.push(e)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ce}`]:{transition:"filter 500ms"},"&:hover":{background:()=>ke(n)?u(n,.33):g(n,.33),[`& .${Ce}`]:{transition:"filter 500ms",filter:ke(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(r,{className:Ce}),children:t})})}))(a,e,t,n,r))}]}),$e=[{label:"Portfolio Overview",description:J.newline("Closed trading signals grouped by symbol for Backtest and Live modes","Each card shows position type, entry price, TP/SL levels, PNL amount and percent","Displays DCA entry count and partial close count where applicable","Supports JSON export and manual refresh of the signal list"),to:"/overview",color:"#0033AD",icon:se},{label:"PNL Performance",description:J.newline("KPI dashboard with aggregated trading performance metrics per symbol","Shows daily trade counts, success rates, resolved/rejected breakdowns","Revenue analytics across today, yesterday, 7-day and 31-day windows","Toggle between Backtest and Live modes; supports JSON export"),to:"/dashboard",color:"#E6007A",icon:ve},{label:"System Logs",description:J.newline("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log","Each entry shows topic, timestamp and raw JSON arguments in monospace","Filter by keyword or regex via search prompt","Supports full log export as JSON file"),to:"/logs",color:"#58BF00",icon:fe}],Ne=[{label:"Notifications",description:J.newline("Event feed for all trading signals: opens, closes, schedules, errors","Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices","Infinite-scroll pagination; click any card to open a detailed modal","Supports manual refresh to pull the latest activity"),to:"/notifications",color:"#F7931A",icon:de},{label:"Pending Status",description:J.newline("Live view of active trading signals grouped by strategy","Grid of strategy buttons; click to inspect individual signal state","Detail view shows entry, exit, effective price, DCA and partial counts","Supports per-signal JSON export and manual refresh"),to:"/status",color:"#6F42C1",icon:ge},{label:"Dump Explorer",description:J.newline("Tree-structured file browser for backtest output and artifact files","Icons indicate file type: image, JSON, plain text or generic","Click any file to open a full-screen preview modal","Supports keyword search and manual refresh of the file tree"),to:"/dump",color:"#0090FF",icon:me}],Te=[{label:"Markdown Reports",description:J.newline("Strategy performance reports rendered from markdown for Backtest and Live runs","Grid of strategy buttons grouped by type and sorted by signal volume","Download reports as markdown, PDF or raw JSON","Supports manual refresh to regenerate report content"),to:"/report",color:"#009688",icon:le},{label:"Price Charts",description:J.newline("Interactive candlestick charts powered by TradingView Lightweight Charts","Navigate by symbol then interval (1m, 15m, 1h) to view price history","Overlays active signal lines: entry, take profit (green) and stop loss (red)","Supports chart image export and signal detail inspection"),to:"/price_chart",color:"#1565C0",icon:ce},{label:"Heatmap",description:J.newline("Color-coded performance heatmap across all tracked symbols","Cells show win rate, profit factor, Sharpe ratio and other key metrics","Download heatmap as JSON, markdown report or PDF","Supports manual refresh to recalculate aggregated statistics"),to:"/heat",color:"#8D6E63",icon:ue}],Ae=[Le("Application",$e),Le("Live",Ne),Le("Other",Te)],Re=()=>o(P,{sx:{width:"100%",height:"75px"}}),Pe=()=>{const{classes:e}=Me();return o(G,{children:[o(k,{items:Ve,actions:He,onAction:async e=>{"update-now"===e&&await(async()=>{L.statusViewService.getStatusInfo.clear(),_.next()})(),"download-markdown"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);L.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport();await M(e)})(),"download-json"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);L.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),o(H,{Loader:Re,reloadSubject:_,children:async()=>{const e=await L.statusViewService.getStatusInfo();return e?o(be,{data:e}):null}}),o($,{className:e.root,fields:Ae,payload:()=>({history:history})}),o(w,{paddingBottom:"24px"})]})};export{Pe as MainPage,Pe as default};
1
+ import{g as e,a as t,b as a,f as o,r as n,u as r,_ as i,d as s,I as l,C as c,e as d,j as p,k as h,s as m,P as v,l as u,n as g,T as f,o as y,B as w,M as z,t as b,p as x,D as S,F as C,q as M,v as k,w as V,J as H,i as L,x as $,y as N,z as T,A,E as R,G as P,H as F,K as B,L as I,N as D,O,Q as E,R as j,V as W,W as J}from"./index-DycIUKAc.js";import{r as _}from"./emitters-Uy5NDw0B.js";import{C as G,R as U}from"./Refresh-TNgz_b0v.js";function K(t){return e("MuiAlert",t)}const Z=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),q=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"),Q=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),X=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"),Y=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"),ee=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],te=m(v,{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,n=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},n&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${n}Color`]:a(e.palette[n].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${n}StandardBg`]:o(e.palette[n].light,.9),[`& .${Z.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}},n&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${n}Color`]:a(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${Z.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}},n&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${n}FilledColor`],backgroundColor:e.vars.palette.Alert[`${n}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[n].dark:e.palette[n].main,color:e.palette.getContrastText(e.palette[n].main)}))}),ae=m("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),oe=m("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ne=m("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),re={success:o(q,{fontSize:"inherit"}),warning:o(Q,{fontSize:"inherit"}),error:o(X,{fontSize:"inherit"}),info:o(Y,{fontSize:"inherit"})},ie=n.forwardRef(function(e,t){var a,n,m,v,u,g;const f=r({props:e,name:"MuiAlert"}),{action:y,children:w,className:z,closeText:b="Close",color:x,components:S={},componentsProps:C={},icon:M,iconMapping:k=re,onClose:V,role:H="alert",severity:L="success",slotProps:$={},slots:N={},variant:T="standard"}=f,A=i(f,ee),R=s({},f,{color:x,severity:L,variant:T}),P=(e=>{const{variant:t,color:a,severity:o,classes:n}=e,r={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(r,K,n)})(R),F=null!=(a=null!=(n=N.closeButton)?n:S.CloseButton)?a:l,B=null!=(m=null!=(v=N.closeIcon)?v:S.CloseIcon)?m:c,I=null!=(u=$.closeButton)?u:C.closeButton,D=null!=(g=$.closeIcon)?g:C.closeIcon;return o(te,s({role:H,elevation:0,ownerState:R,className:d(P.root,z),ref:t},A,{children:[!1!==M?o(ae,{ownerState:R,className:P.icon,children:M||k[L]||re[L]}):null,o(oe,{ownerState:R,className:P.message,children:w}),null!=y?o(ne,{ownerState:R,className:P.action,children:y}):null,null==y&&V?o(ne,{ownerState:R,className:P.action,children:o(F,s({size:"small","aria-label":b,title:b,color:"inherit",onClick:V},I,{children:o(B,s({fontSize:"small"},D))}))}):null]}))}),se=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"),le=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"),ce=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"),de=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"),pe=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),he=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),me=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"),ve=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"),ue=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"),ge=a(o(n.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"),fe=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"),ye=x()(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)},downloadButton:{cursor:"pointer !important"}})),we=(e,t="%")=>null===e?"—":`${e.toFixed(2)}${t}`,ze=e=>window.Translate?window.Translate.translateText(e):e,be=({data:e})=>{const{classes:t,cx:a}=ye(),[r,i]=n.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:n,symbols:r,backtest:i}=e,s=ze(i?"Backtest":"Live"),l=t.frameName?` / ${t.frameName}`:"",c=[`## ${s}: ${t.strategyName} / ${t.exchangeName}${l}`,"",`**${ze("Total PNL")}:** ${we(a)} `,`**Sharpe Ratio:** ${we(o,"")} `,`**${ze("Total trades")}:** ${n}`,""];for(const d of r)c.push(`### ${d.symbol}`,"",`**PNL:** ${we(d.totalPnl)} `,`**Win Rate:** ${we(d.winRate)} `,`**Profit Factor:** ${we(d.profitFactor,"")} `,`**Max Drawdown:** ${we(d.maxDrawdown)} `,`**Expectancy:** ${we(d.expectancy)} `,`**${ze("Trades")}:** ${d.totalTrades}`,"");return c.join("\n")})(e),c=()=>{i(!r)},d=async e=>{e.stopPropagation(),await M(s)};return o(ie,{className:a(t.root,{[t.open]:r}),action:o(C,{children:[o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(S,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(r?pe:he,{})})]}),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:r?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?"Backtest":"Live",": ",e.context.strategyName]}),o(y,{in:r,timeout:"auto",unmountOnExit:!0,children:[o(w,{paddingBottom:"16px"}),o(z,{content:s}),o(w,{paddingBottom:"32px"})]}),!r&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[b(s).slice(0,150),"..."]})]})})},xe="backtest-kit__groupHeader",Se="backtest-kit__groupRoot",Ce="backtest-kit__symbolImage",Me=x()({root:{[`& .${Se}:hover .${xe}`]:{opacity:"1 !important"}}});function ke(e){return W(e,"#000000")>W(e,"#FFFFFF")}const Ve=[{type:V.Link,action:"back-action",label:"Main"},{type:V.Link,action:"back-action",label:"Navigation"}],He=[{action:"download-json",label:"Download Heatmap JSON",icon:()=>o(T,{icon:N,color:"#4caf50"})},{action:"download-markdown",label:"Download Heatmap Markdown",icon:()=>o(T,{icon:A,color:"#4caf50"})},{action:"download-pdf",label:"Download Heatmap PDF",icon:()=>o(T,{icon:R,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(T,{icon:U,color:"#4caf50"})}],Le=(e,t)=>({type:F.Group,className:Se,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:F.Component,className:xe,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(D,{direction:"row",children:[o(B,{variant:"outlined",size:"medium",color:"info",label:`${I.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(w,{flex:1})]})},{type:F.Group,fields:t.map(({label:e,description:t,to:a,color:n,icon:r})=>((e,t,a,n,r)=>({type:F.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(j,{description:a,children:o(O,{component:E,onClick:()=>{L.routerService.push(e)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ce}`]:{transition:"filter 500ms"},"&:hover":{background:()=>ke(n)?u(n,.33):g(n,.33),[`& .${Ce}`]:{transition:"filter 500ms",filter:ke(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(r,{className:Ce}),children:t})})}))(a,e,t,n,r))}]}),$e=[{label:"Portfolio Overview",description:J.newline("Closed trading signals grouped by symbol for Backtest and Live modes","Each card shows position type, entry price, TP/SL levels, PNL amount and percent","Displays DCA entry count and partial close count where applicable","Supports JSON export and manual refresh of the signal list"),to:"/overview",color:"#0033AD",icon:se},{label:"PNL Performance",description:J.newline("KPI dashboard with aggregated trading performance metrics per symbol","Shows daily trade counts, success rates, resolved/rejected breakdowns","Revenue analytics across today, yesterday, 7-day and 31-day windows","Toggle between Backtest and Live modes; supports JSON export"),to:"/dashboard",color:"#E6007A",icon:ve},{label:"System Logs",description:J.newline("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log","Each entry shows topic, timestamp and raw JSON arguments in monospace","Filter by keyword or regex via search prompt","Supports full log export as JSON file"),to:"/logs",color:"#58BF00",icon:fe}],Ne=[{label:"Notifications",description:J.newline("Event feed for all trading signals: opens, closes, schedules, errors","Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices","Infinite-scroll pagination; click any card to open a detailed modal","Supports manual refresh to pull the latest activity"),to:"/notifications",color:"#F7931A",icon:de},{label:"Pending Status",description:J.newline("Live view of active trading signals grouped by strategy","Grid of strategy buttons; click to inspect individual signal state","Detail view shows entry, exit, effective price, DCA and partial counts","Supports per-signal JSON export and manual refresh"),to:"/status",color:"#6F42C1",icon:ge},{label:"Dump Explorer",description:J.newline("Tree-structured file browser for backtest output and artifact files","Icons indicate file type: image, JSON, plain text or generic","Click any file to open a full-screen preview modal","Supports keyword search and manual refresh of the file tree"),to:"/dump",color:"#0090FF",icon:me}],Te=[{label:"Markdown Reports",description:J.newline("Strategy performance reports rendered from markdown for Backtest and Live runs","Grid of strategy buttons grouped by type and sorted by signal volume","Download reports as markdown, PDF or raw JSON","Supports manual refresh to regenerate report content"),to:"/report",color:"#009688",icon:le},{label:"Price Charts",description:J.newline("Interactive candlestick charts powered by TradingView Lightweight Charts","Navigate by symbol then interval (1m, 15m, 1h) to view price history","Overlays active signal lines: entry, take profit (green) and stop loss (red)","Supports chart image export and signal detail inspection"),to:"/price_chart",color:"#1565C0",icon:ce},{label:"Heatmap",description:J.newline("Color-coded performance heatmap across all tracked symbols","Cells show win rate, profit factor, Sharpe ratio and other key metrics","Download heatmap as JSON, markdown report or PDF","Supports manual refresh to recalculate aggregated statistics"),to:"/heat",color:"#8D6E63",icon:ue}],Ae=[Le("Application",$e),Le("Live",Ne),Le("Other",Te)],Re=()=>o(P,{sx:{width:"100%",height:"75px"}}),Pe=()=>{const{classes:e}=Me();return o(G,{children:[o(k,{items:Ve,actions:He,onAction:async e=>{"update-now"===e&&await(async()=>{L.statusViewService.getStatusInfo.clear(),_.next()})(),"download-markdown"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);L.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport();await M(e)})(),"download-json"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);L.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),o(H,{Loader:Re,reloadSubject:_,children:async()=>{const e=await L.statusViewService.getStatusInfo();return e?o(be,{data:e}):null}}),o($,{className:e.root,fields:Ae,payload:()=>({history:history})}),o(w,{paddingBottom:"24px"})]})};export{Pe as MainPage,Pe as default};
@@ -1 +1 @@
1
- import{f as e,aZ as t,M as a,B as i,a_ as r,a$ as o,i as n,b0 as l,b1 as s,aU as c,b2 as d,y as w,z as p,A as h,E as m,aP as k,b3 as g,ar as b,b4 as v,ac as u,b5 as y,aW as f,au as S,N as x,b6 as _,af as D,q as V,aR as N,Z as O,v as R,w as L,p as B,H as A,T as P,aS as C,x as $,F as M,K as J,L as j,Q as G,l as F,n as X,O as H,V as E,aY as I}from"./index-DDUY7roZ.js";import{h as z}from"./hasRouteMatch-cVt-5faK.js";import{I as T}from"./IconPhoto-Dol-gfi5.js";import{C as U,R as K}from"./Refresh-DKJv3mpD.js";import{K as W}from"./KeyboardArrowLeft-B96q9-RN.js";const q=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Z=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Q=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Y=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,keepMounted:!0,className:a,style:i,sx:r,disabled:t,options:Y,onAction:s})},te=u(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,u]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:u}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},u=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Z,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:y,history:te,routes:q,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Q,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:u,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return E(e,"#000000")>E(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(W,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:K,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${j.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:i,type:r,color:o})=>((t,a,i,r,o)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:n})=>e(H,{component:G,onClick:()=>{n.handleOpen(t,a)},sx:{width:"100%",background:o,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(o)?F(o,.33):X(o,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(o)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:i}),children:r})}))(i,r,t,a,o))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(M,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(I,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
1
+ import{f as e,aZ as t,M as a,B as i,a_ as r,a$ as o,i as n,b0 as l,b1 as s,aU as c,b2 as d,y as w,z as p,A as h,E as m,aP as k,b3 as g,ar as b,b4 as v,ac as u,b5 as y,aW as f,au as S,N as x,b6 as _,af as D,q as V,aR as N,Z as O,v as R,w as L,p as B,H as A,T as P,aS as C,x as $,F as M,K as J,L as j,Q as G,l as F,n as X,O as H,V as E,aY as I}from"./index-DycIUKAc.js";import{h as z}from"./hasRouteMatch-CYLF108Z.js";import{I as T}from"./IconPhoto-B9wAeXe1.js";import{C as U,R as K}from"./Refresh-TNgz_b0v.js";import{K as W}from"./KeyboardArrowLeft-C1qRm69Y.js";const q=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Z=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Q=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Y=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,keepMounted:!0,className:a,style:i,sx:r,disabled:t,options:Y,onAction:s})},te=u(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,u]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:u}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},u=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Z,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:y,history:te,routes:q,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Q,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:u,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return E(e,"#000000")>E(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(W,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:K,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${j.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:i,type:r,color:o})=>((t,a,i,r,o)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:n})=>e(H,{component:G,onClick:()=>{n.handleOpen(t,a)},sx:{width:"100%",background:o,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(o)?F(o,.33):X(o,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(o)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:i}),children:r})}))(i,r,t,a,o))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(M,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(I,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
@@ -1 +1 @@
1
- import{b as e,f as a,X as o,w as t,v as n,D as i,z as r,Y as s,Z as l,i as c,$ as d,a0 as p,a1 as h,J as m,a2 as b,a3 as u,a4 as g,B as y,T as v,a5 as x,l as f,n as k,a6 as S,V as w,a7 as L,a8 as P,a9 as z,I as R,aa as $,F as D,ab as j,ac as C}from"./index-DDUY7roZ.js";import{R as T,C as W}from"./Refresh-DKJv3mpD.js";import{K as F}from"./KeyboardArrowLeft-B96q9-RN.js";import{I as O}from"./IconPhoto-Dol-gfi5.js";import{B}from"./Background-GZVl6Dd-.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(F,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"}],I=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:A,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:V,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:T,color:"#4caf50"})}],M=()=>a(n,{items:H,actions:I,onAction:E.next});const N=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:j}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),C=d(i),T=d(e);p(()=>E.subscribe(e=>{if("update-now"===e&&j(),"download-action"===e){const e=new Blob([JSON.stringify(C.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${T.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${T.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const W=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),F=e=>{const o=W[e]||[];return o.length?a(D,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(u,{primary:a(y,{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:P("#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(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),z(t.priceOpen),"$",t.originalPriceOpen!==t.priceOpen&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[z(t.originalPriceOpen),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),z(t.priceTakeProfit),"$",t.originalPriceTakeProfit!==t.priceTakeProfit&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[z(t.originalPriceTakeProfit),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),z(t.priceStopLoss),"$",t.originalPriceStopLoss!==t.priceStopLoss&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[z(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),z(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?P("#4caf50",.15):P("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",z(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?P("#4caf50",.2):"scheduled"===t.status?P("#ff9800",.2):"closed"===t.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(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(R,{disableRipple:!0,children:a($,{})})]},`item-${e}-${t.id}`);var i})}):a(b,{children:a(u,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[W],children:async()=>{const o=Object.keys(W),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=null==(o=t[e])?void 0:o.color,s=(null==(n=W[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(O,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:x(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:F(e)})]})},`section-${e}`);var l}):a(b,{children:a(u,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=C(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:N,isActive:e=>J(["/backtest"],e)},{id:"live",element:N,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(W,{children:[a(j,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:M,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(B,{})]})};export{X as OverviewPage,X as default};
1
+ import{b as e,f as a,X as o,w as t,v as n,D as i,z as r,Y as s,Z as l,i as c,$ as d,a0 as p,a1 as h,J as m,a2 as b,a3 as u,a4 as g,B as y,T as v,a5 as x,l as f,n as k,a6 as S,V as w,a7 as L,a8 as P,a9 as z,I as R,aa as $,F as D,ab as j,ac as C}from"./index-DycIUKAc.js";import{R as T,C as W}from"./Refresh-TNgz_b0v.js";import{K as F}from"./KeyboardArrowLeft-C1qRm69Y.js";import{I as O}from"./IconPhoto-B9wAeXe1.js";import{B}from"./Background-Cw2iN6KJ.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(F,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"}],I=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:A,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:V,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:T,color:"#4caf50"})}],M=()=>a(n,{items:H,actions:I,onAction:E.next});const N=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:j}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),C=d(i),T=d(e);p(()=>E.subscribe(e=>{if("update-now"===e&&j(),"download-action"===e){const e=new Blob([JSON.stringify(C.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${T.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${T.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const W=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),F=e=>{const o=W[e]||[];return o.length?a(D,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(u,{primary:a(y,{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:P("#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(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),z(t.priceOpen),"$",t.originalPriceOpen!==t.priceOpen&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[z(t.originalPriceOpen),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),z(t.priceTakeProfit),"$",t.originalPriceTakeProfit!==t.priceTakeProfit&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[z(t.originalPriceTakeProfit),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),z(t.priceStopLoss),"$",t.originalPriceStopLoss!==t.priceStopLoss&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[z(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),z(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?P("#4caf50",.15):P("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",z(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?P("#4caf50",.2):"scheduled"===t.status?P("#ff9800",.2):"closed"===t.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(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(R,{disableRipple:!0,children:a($,{})})]},`item-${e}-${t.id}`);var i})}):a(b,{children:a(u,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[W],children:async()=>{const o=Object.keys(W),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=null==(o=t[e])?void 0:o.color,s=(null==(n=W[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(O,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:x(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:F(e)})]})},`section-${e}`);var l}):a(b,{children:a(u,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=C(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:N,isActive:e=>J(["/backtest"],e)},{id:"live",element:N,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(W,{children:[a(j,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:M,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(B,{})]})};export{X as OverviewPage,X as default};