@backtest-kit/ui 7.0.0 → 7.2.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 (37) hide show
  1. package/build/modules/frontend/build/assets/{Article-CUKUVtNn.js → Article-673O2GAo.js} +1 -1
  2. package/build/modules/frontend/build/assets/{Background-Cm7NWjYf.js → Background-GZVl6Dd-.js} +1 -1
  3. package/build/modules/frontend/build/assets/{IconPhoto-VQJtz-we.js → IconPhoto-Dol-gfi5.js} +1 -1
  4. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-Bx3w5JlP.js → KeyboardArrowLeft-B96q9-RN.js} +1 -1
  5. package/build/modules/frontend/build/assets/{Refresh-BkaYn01m.js → Refresh-DKJv3mpD.js} +1 -1
  6. package/build/modules/frontend/build/assets/emitters-8Ddy6nda.js +1 -0
  7. package/build/modules/frontend/build/assets/{hasRouteMatch-F5OIUGjU.js → hasRouteMatch-cVt-5faK.js} +1 -1
  8. package/build/modules/frontend/build/assets/html2canvas-B_SfkTNO.js +1 -0
  9. package/build/modules/frontend/build/assets/{index-BTuorlT_.js → index-B1bEyjto.js} +1 -1
  10. package/build/modules/frontend/build/assets/index-BB1KfPr2.js +1 -0
  11. package/build/modules/frontend/build/assets/index-BY91NQhQ.js +1 -0
  12. package/build/modules/frontend/build/assets/index-Bfrag62a.js +1 -0
  13. package/build/modules/frontend/build/assets/index-CnzKZiFP.js +1 -0
  14. package/build/modules/frontend/build/assets/index-CpO55Vw3.js +1 -0
  15. package/build/modules/frontend/build/assets/index-DDUY7roZ.js +1578 -0
  16. package/build/modules/frontend/build/assets/{index-BdOvXECv.js → index-De1PN9nY.js} +1 -1
  17. package/build/modules/frontend/build/assets/index-DhUPeC3A.js +1 -0
  18. package/build/modules/frontend/build/assets/index-G-Rr8i6Z.js +1 -0
  19. package/build/modules/frontend/build/assets/{index-C6MJd2e7.js → index-tA6ppP-9.js} +1 -1
  20. package/build/modules/frontend/build/assets/index-vcDgTyUw.js +1 -0
  21. package/build/modules/frontend/build/assets/{index.es-Dy9r9ja5.js → index.es-CAJnvyqV.js} +1 -1
  22. package/build/modules/frontend/build/assets/markdownit-DjH6sN97.js +1 -0
  23. package/build/modules/frontend/build/index.html +1 -1
  24. package/package.json +4 -4
  25. package/types.d.ts +14 -5
  26. package/build/modules/frontend/build/assets/emitters-DFr8bMD1.js +0 -1
  27. package/build/modules/frontend/build/assets/html2canvas-D9EezEc_.js +0 -1
  28. package/build/modules/frontend/build/assets/index-ApVR6Ifc.js +0 -1
  29. package/build/modules/frontend/build/assets/index-Bo9eE7UW.js +0 -1
  30. package/build/modules/frontend/build/assets/index-CROpLyTo.js +0 -1
  31. package/build/modules/frontend/build/assets/index-ChbT-tDv.js +0 -17
  32. package/build/modules/frontend/build/assets/index-Cx2iXzXi.js +0 -1
  33. package/build/modules/frontend/build/assets/index-D4lcxG8i.js +0 -1
  34. package/build/modules/frontend/build/assets/index-D5q-xBp8.js +0 -1
  35. package/build/modules/frontend/build/assets/index-Mr3SEWze.js +0 -1560
  36. package/build/modules/frontend/build/assets/index-XWTSQlQH.js +0 -1
  37. package/build/modules/frontend/build/assets/markdownit-CaCiS1m5.js +0 -1
@@ -1 +1 @@
1
- import{b as c,f as v}from"./index-Mr3SEWze.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-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 +1 @@
1
- import{f as n,S as o}from"./index-Mr3SEWze.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-DDUY7roZ.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-Mr3SEWze.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-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 +1 @@
1
- import{b as o,f as r}from"./index-Mr3SEWze.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-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 +1 @@
1
- import{bp as e,d as t,r as a,_ as s,f as i,bq as n,h as o,br as r,j as d,bs as m,g as u,u as p,s as x,b as h}from"./index-Mr3SEWze.js";const c=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),f=c("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:h,component:c="div",disableGutters:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:c,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:c,ownerState:k,className:n(S.root,h),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=h(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-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};
@@ -0,0 +1 @@
1
+ import{X as o}from"./index-DDUY7roZ.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{i as a,bn as e,bo as o}from"./index-Mr3SEWze.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-DDUY7roZ.js";const t=(t,i=a.routerService.location.pathname)=>!!e(o.filter(({path:a})=>t.includes(a)),i);export{t as h};
@@ -0,0 +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 +1 @@
1
- import{b as a,f as t,T as e,N as o,bf as n,K as i,P as l,t as r,Z as c,i as s,a0 as d,w as p,x as h,z as m,A as y,E as w,G as u,H as x,y as f,aX as b,v as g,aW as v}from"./index-Mr3SEWze.js";import{h as S}from"./hasRouteMatch-F5OIUGjU.js";import{r as L}from"./emitters-DFr8bMD1.js";import{I as k}from"./IconPhoto-VQJtz-we.js";import{C as D,R}from"./Refresh-BkaYn01m.js";import{K as A}from"./KeyboardArrowLeft-Bx3w5JlP.js";const N=a(t("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"),j=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}=j();return t(l,{className:i.root,children:[t("div",{className:i.header,children:t(e,{variant:"h6",sx:{opacity:.8},children:`${o.bullet} ${a.symbol}`})}),t("div",{className:i.container,children:t("div",{className:i.content,children:[t("div",{className:i.avatar,children:t(k,{symbol:a.symbol,sx:{width:128,height:128}})}),t(n,{handler:()=>a,fields:V,sx:{mb:2}})]})})]})},H=[{type:h.Link,action:"back-action",label:t(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:N}],T=[{action:"download-json",label:"Download JSON",icon:()=>t(y,{icon:m,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(y,{icon:w,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(y,{icon:u,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(y,{icon:R,color:"#4caf50"})}],P=[{id:"main",element:()=>{const[a,{loading:e,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 e=a.map(a=>({type:i.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:i.Component,element:()=>t(F,{row:a})}}));return e.length>2?e:[{type:i.Center,sx:a=>({[a.breakpoints.up("lg")]:{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}),fields:e}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>L.subscribe(o));return t(D,{children:[t(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(),t=new Blob([a],{type:"text/plain"}),e=URL.createObjectURL(t);s.layoutService.downloadFile(e,`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(),t=JSON.stringify(a,null,2),e=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(e);s.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!a||e?t(x,{sx:{height:"calc(100dvh - 165px)"}}):t(b,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:t(f,{fields:a})})]})},isActive:a=>S(["/heat"],a)}],z=({id:a})=>t(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-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};
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ import{b as e,f as o,aR as t,Z as i,i as a,v as n,w as l,p as s,z as r,T as c,aS as p,x as d,B as m,F as u,H as h,K as b,L as y,N as f,Q as g,l as k,n as v,O as S,V as C,r as L,al as x,bh as w,bi as P,bj as T,bk as V,bl as $,bm as M,ae as z,a9 as H,$ as O,a0 as A,b0 as N,aO as _,aA as F,P as I,G as R,ah as j,bn as E,X as D,ar as G,as as U,aU as W,at as B,I as Y,au as K,D as J,aY as Q}from"./index-DDUY7roZ.js";import{h as X}from"./hasRouteMatch-cVt-5faK.js";import{I as Z}from"./IconPhoto-Dol-gfi5.js";import{C as q,R as ee}from"./Refresh-DKJv3mpD.js";import{K as oe}from"./KeyboardArrowLeft-B96q9-RN.js";const te=e([o("path",{d:"M5 19h14V5H5v14zm4-4h4v-2h-2v-2h2V9H9V7h4c1.1 0 2 .89 2 2v1.5c0 .83-.67 1.5-1.5 1.5.83 0 1.5.67 1.5 1.5V15c0 1.11-.9 2-2 2H9v-2z",opacity:".3"}),o("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})],"Looks3TwoTone"),ie=e([o("path",{d:"M19 5H5v14h14V5zm-5 12h-2V9h-2V7h4v10z",opacity:".3"}),o("path",{d:"M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm5 4h2v8h2V7h-4z"})],"LooksOneTwoTone"),ae=e([o("path",{d:"M19 5H5v14h14V5zm-4 6c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2v2z",opacity:".3"}),o("path",{d:"M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm8 2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2z"})],"LooksTwoTwoTone"),ne="backtest-kit__groupHeader",le="backtest-kit__groupRoot",se="backtest-kit__symbolImage",re=s()({root:{[`& .${le}:hover .${ne}`]:{opacity:"1 !important"}}});function ce(e){return C(e,"#000000")>C(e,"#FFFFFF")}const pe=[{type:l.Link,action:"back-action",label:o(oe,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"}],de=[{action:"update-now",label:"Refresh",icon:()=>o(r,{icon:ee,color:"#4caf50"})}],me=e=>({type:h.Group,className:le,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:h.Component,className:ne,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(f,{direction:"row",children:[o(b,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} Symbols`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(m,{flex:1})]})},{type:h.Group,fields:e.map(({symbol:e,label:t,color:i})=>((e,t,i)=>({type:h.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(S,{component:g,onClick:()=>{a.routerService.push(`/price_chart/${e.toLowerCase()}`)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${se}`]:{transition:"filter 500ms"},"&:hover":{background:()=>ce(i)?k(i,.33):v(i,.33),[`& .${se}`]:{transition:"filter 500ms",filter:ce(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(Z,{className:se,symbol:e}),children:t})}))(e,t,i))}]}),ue="backtest-kit__groupHeader",he="backtest-kit__groupRoot",be="backtest-kit__symbolImage",ye=s()({root:{[`& .${he}:hover .${ue}`]:{opacity:"1 !important"}}});function fe(e){return C(e,"#000000")>C(e,"#FFFFFF")}const ge=[{type:l.Link,action:"back-action",label:o(oe,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"},{type:l.Link,action:"back-action",compute:e=>String(e).toUpperCase()}],ke=(e,t)=>({type:h.Group,className:he,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:h.Component,className:ue,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(f,{direction:"row",children:[o(b,{variant:"outlined",size:"medium",color:"info",label:`${y.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(m,{flex:1})]})},{type:h.Group,fields:t.map(({label:e,to:t,color:i,icon:n})=>((e,t,i,n)=>({type:h.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(S,{component:g,onClick:()=>{a.routerService.push(e)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${be}`]:{transition:"filter 500ms"},"&:hover":{background:()=>fe(i)?k(i,.33):v(i,.33),[`& .${be}`]:{transition:"filter 500ms",filter:fe(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:be}),children:t})}))(t,e,i,n))}]}),ve=s()({root:{position:"relative"},tooltip:{position:"absolute",margin:0,left:5,top:5,backgroundColor:"#343434",zIndex:999,color:"white",fontWeight:"bold",padding:"5px 10px",borderRadius:3,fontSize:"12px",pointerEvents:"none",touchAction:"none"}}),Se={layout:{textColor:"#d4d4d8",backgroundColor:"#ffffff"},rightPriceScale:{scaleMargins:{top:.3,bottom:.25}},crosshair:{vertLine:{width:4,color:"#ebe0e301",style:0},horzLine:{visible:!1,labelVisible:!1}},grid:{vertLines:{color:"#f8b3"},horzLines:{color:"#f8b3"}},handleScroll:{vertTouchDrag:!1}},Ce=({height:e,width:t,items:i,position:a,priceOpen:n,priceStopLoss:l,priceTakeProfit:s})=>{const{classes:r}=ve(),c=L.useRef(void 0),[p,d]=L.useState(null);return L.useLayoutEffect(()=>{const{current:o}=c,r=x(o,{...Se,width:t,height:e,crosshair:{mode:w.Normal,vertLine:{labelVisible:!1},horzLine:{visible:!1,labelVisible:!0}},timeScale:{timeVisible:!0,secondsVisible:!0,tickMarkFormatter:e=>{const o=i.find(o=>o.timestamp===Number(e))||i[0];if(!o||!o.timestamp)return"Invalid date";const t=z(o.timestamp);return t.isValid()?t.format("HH:mm:ss"):"Invalid date"}}}),p=r.addLineSeries({lastValueVisible:!1,color:P[400]}),m=i.map(e=>({time:Math.floor(e.timestamp),value:parseFloat(e.close)}));if(p.setData(m),a&&n){const e="long"===a?P[700]:V[700];p.createPriceLine({price:n,color:e,lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"long"===a?"LONG Entry":"SHORT Entry"})}return l&&p.createPriceLine({price:l,color:$[500],lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"SL"}),s&&p.createPriceLine({price:s,color:M[500],lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"TP"}),r.subscribeCrosshairMove(e=>{if(e.time){const o=i.find(o=>o.timestamp===Number(e.time));if(o){const e=z(o.timestamp).format("DD/MM/YYYY HH:mm:ss"),t=H(o.close.toFixed(6));d(`${e}: ${t}`)}else d(null)}else d(null)}),r.timeScale().fitContent(),()=>{r.remove()}},[e,t,i]),o("div",{ref:c,className:r.root,children:p&&o("div",{className:r.tooltip,children:p})})},Le={"1m":"#2979ff","15m":"#f3a43a","1h":"#d500f9"},xe={"1m":"1 minute","15m":"15 minutes","1h":"1 hour"};const we=({symbol:e,interval:t,reloadSubject:n,downloadSubject:l,onInfoClick:s,disableInfo:r,position:p,priceOpen:d,priceStopLoss:u,priceTakeProfit:h,sx:y})=>{const[f,{loading:g,execute:k}]=i(async()=>await a.exchangeViewService.getLastCandles(e,t),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e,t]}),v=O(f);A(()=>n.subscribe(k)),A(()=>l.subscribe(()=>{const{current:o}=v;!function(e,o="data.json"){const t=new Blob([e],{type:"application/json"}),i=window.URL.createObjectURL(t);a.layoutService.downloadFile(i,o)}(JSON.stringify(o,null,2),`${e}-${t}.json`)}));return o(I,{sx:{...y,display:"flex",flexDirection:"column",alignItems:"stretch",overflow:"clip"},children:[o(m,{sx:{background:Le[t]||"#607d8b",minHeight:"48px",display:"flex",alignItems:"center",pl:2,pr:1},children:[o(c,{variant:"h6",sx:{color:"white",fontWeight:"bold",mr:1},children:xe[t]||t}),!!p&&o(b,{variant:"filled",sx:{color:"white"},color:"short"===p?"warning":"success",label:String(p).toUpperCase()}),o(m,{sx:{flex:1}}),o(N,{disabled:r,onClick:s,children:o(_,{style:{color:"white",opacity:r?.5:1}})})]}),o(F,{}),!f||g?o(R,{sx:{height:"100%",width:"100%"}}):o(m,{sx:{position:"relative",flex:1},children:o(j,{style:{position:"absolute"},children:({height:e,width:t})=>o(Ce,{items:f,height:e,width:t,position:p,priceOpen:d,priceStopLoss:u,priceTakeProfit:h})})})]})},Pe=[{type:l.Link,action:"back-action",label:o(oe,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"},{type:l.Link,action:"back-action",compute:({symbol:e})=>String(e).toUpperCase()},{type:l.Link,action:"back-action",compute:({interval:e})=>String(e).toUpperCase()}],Te=[{action:"download-now",label:"Download",icon:()=>o(r,{icon:J,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(r,{icon:ee,color:"#4caf50"})}],Ve=new D,$e=new D,Me=[{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"position",title:"Position",readonly:!0,compute:e=>"long"===e.position?"🔵 LONG (profit on rise)":"🟠 SHORT (profit on fall)"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceOpen",title:"Entry",readonly:!0,compute:e=>e.priceOpen?`${H(e.priceOpen)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceOpen",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalPriceOpen&&e.originalPriceOpen!==e.priceOpen,compute:e=>e.originalPriceOpen?`${H(e.originalPriceOpen)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceTakeProfit",title:"Take Profit",readonly:!0,compute:e=>e.priceTakeProfit?`${H(e.priceTakeProfit)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceTakeProfit",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalPriceTakeProfit&&e.originalPriceTakeProfit!==e.priceTakeProfit,compute:e=>e.originalPriceTakeProfit?`${H(e.originalPriceTakeProfit)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceStopLoss",title:"Stop Loss",readonly:!0,compute:e=>e.priceStopLoss?`${H(e.priceStopLoss)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceStopLoss",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalPriceStopLoss&&e.originalPriceStopLoss!==e.priceStopLoss,compute:e=>e.originalPriceStopLoss?`${H(e.originalPriceStopLoss)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalEntries",title:"Total Entries",readonly:!0,isVisible:e=>null!=e.totalEntries&&e.totalEntries>1,compute:e=>String(e.totalEntries)},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalPartials",title:"Total Closes",readonly:!0,isVisible:e=>null!=e.totalPartials&&e.totalPartials>0,compute:e=>String(e.totalPartials)},{type:h.Component,sx:{mt:2},element:({payload:e})=>o(S,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],ze=[{id:"chart",element:({params:e})=>{const t=E(()=>({symbol:String(e.symbol).toUpperCase(),interval:e.interval})),[l,{loading:s,execute:r}]=i(async()=>{const o=String(e.symbol).toUpperCase();return await a.signalViewService.getPendingSignal(o)},{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e.symbol]});A(()=>Ve.subscribe(r));const c=L.useMemo(()=>l?l.priceTakeProfit:0,[l]),p=L.useMemo(()=>l?l.priceStopLoss:0,[l]),d=L.useMemo(()=>l?l.priceOpen:0,[l]),m=L.useMemo(()=>l?l.position:null,[l]),[u,h]=G(null),{pickData:b,setOpen:y,render:g}=U({title:"Info",AfterTitle:({onClose:e})=>o(f,{direction:"row",gap:2,children:[o(B,{onClick:()=>a.layoutService.pickSignal(u.current.id),variant:"outlined",children:"Show Details"}),o(Y,{size:"small",onClick:e,children:o(K,{})})]}),payload:()=>({handleClose(){y(!1)}}),fields:Me,handler:()=>u.current,withActionButton:!1}),k=W(async()=>{l&&(h(l),b(l.id))});return o(q,{children:[o(n,{items:Pe,actions:Te,payload:t,onAction:async o=>{"back-action"===o&&a.routerService.push(`/price_chart/${e.symbol}`),"update-now"===o&&await Ve.next(),"download-now"===o&&await $e.next()}}),s?null:o(we,{symbol:t.symbol,interval:t.interval,disableInfo:!l,reloadSubject:Ve,downloadSubject:$e,onInfoClick:k,position:m,priceOpen:d,priceStopLoss:p,priceTakeProfit:c,sx:{height:"calc(100dvh - 165px)"}}),g()]})},isActive:e=>X(["/price_chart/:symbol/:interval"],e)},{id:"coin",element:({params:e})=>{const{classes:t}=ye(),i=e.symbol,l=L.useMemo(()=>[{label:"1 minute",to:`/price_chart/${i}/1m`,color:"#2979ff",icon:ie},{label:"15 minutes",to:`/price_chart/${i}/15m`,color:"#f3a43a",icon:ae},{label:"1 hour",to:`/price_chart/${i}/1h`,color:"#d500f9",icon:te}],[i]),s=L.useMemo(()=>[ke("Chart",l)],[l]);return o(q,{children:[o(n,{items:ge,payload:i,onAction:e=>{"back-action"===e&&a.routerService.push("/price_chart")}}),o(d,{className:t.root,fields:s}),o(m,{paddingBottom:"24px"})]})},isActive:e=>X(["/price_chart/:symbol"],e)},{id:"main",element:()=>{const{classes:e}=re(),{reloadTrigger:l,doReload:s}=t(),[r,{loading:h}]=i(async()=>await(async()=>{const[e,o]=await Promise.all([a.symbolGlobalService.getSymbolList(),a.symbolGlobalService.getSymbolMap()]),t=e.map(e=>{const t=o[e];return{symbol:e,label:(null==t?void 0:t.displayName)||e,color:(null==t?void 0:t.color)||"#ccc"}});return t.length?[me(t)]:[]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[l]});return o(q,{children:[o(n,{items:pe,actions:de,onAction:e=>{"back-action"===e&&a.routerService.push("/"),"update-now"===e&&s()}}),h||!r?o(p,{children:o(c,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):r.length?o(u,{children:[o(d,{className:e.root,fields:r},l),o(m,{paddingBottom:"24px"})]}):o(p,{children:o(c,{variant:"h6",sx:{opacity:.5},children:"No symbols found"})})]})},isActive:e=>X(["/price_chart"],e)}],He=({symbol:e,interval:t})=>o(Q,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:ze,params:{symbol:e,interval:t}});export{He as PriceChartPage,He as default};
@@ -0,0 +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};
@@ -0,0 +1 @@
1
+ import{r as e,f as a,P as i,B as r,N as n,az as t,T as o,ae as s,K as c,am as l,F as d,aA as p,M as m,aB as u,aC as b,aD as v,aE as y,au as g,aF as h,aG as x,aH as k,aI as f,aJ as $,aK as S,aL as P,i as w,ap as C,X as _,aq as E,v as L,w as A,aM as F,aN as z,z as D}from"./index-DDUY7roZ.js";import{C as O,R as j}from"./Refresh-DKJv3mpD.js";import{K as B}from"./KeyboardArrowLeft-B96q9-RN.js";const T=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(S,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(g,{sx:i});case"signal.scheduled":return a(P,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(h,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(f,{sx:i});case"breakeven.available":case"breakeven.commit":return a($,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(x,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a(k,{sx:i});case"risk.rejection":return a(y,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(b,{sx:i});case"error.critical":return a(v,{sx:i});default:return a(u,{sx:i})}},I=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;default:return l("Unknown")}},R=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},N=e=>"symbol"in e,U=e=>"position"in e,W=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,M=e=>"pnlPercentage"in e,H=e=>"level"in e,K=e=>"percentToClose"in e,Y=e=>"currentPrice"in e,V=e=>"duration"in e,q=e=>"closeReason"in e,G=e=>"cancelReason"in e,J=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),Q=e=>"message"in e,Z=e=>"rejectionNote"in e,ee=e=>"activePositionCount"in e,ae=e=>"effectivePriceOpen"in e,ie=e=>"totalEntries"in e&&e.totalEntries>1,re=e=>"originalPriceOpen"in e&&"priceOpen"in e&&e.originalPriceOpen!==e.priceOpen,ne=e=>"totalPartials"in e&&e.totalPartials>0,te=e=>"cost"in e,oe=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,se=e=>"peakProfitPriceClose"in e,ce=e=>"maxDrawdownPriceClose"in e,le=e.forwardRef(({item:e,className:u,style:b,sx:v},y)=>{const g=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),h=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:u,style:b,ref:y,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":w.layoutService.pickRisk(e.id);break;case"signal.opened":w.layoutService.pickSignalOpened(e.id);break;case"signal.closed":w.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":w.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":w.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":w.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":w.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":w.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":w.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":w.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":w.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":w.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":w.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":w.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":w.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":w.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":w.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":w.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":w.layoutService.pickClosePending(e.id);break;case"signal.info":w.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...v},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:g},children:T(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:I(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:s(h).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(c,{size:"small",label:R(e),sx:{background:g,mt:1,mr:1,color:"white",fontWeight:500}}),N(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),U(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),M(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`PnL: ${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),H(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),K(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),V(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),G(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),J(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ee(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ie(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),ne(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),te(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost.toFixed(2)}$`,variant:"outlined"}),ae(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen}`,variant:"outlined",color:"warning"}),re(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen}`,variant:"outlined"})]}),W(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[Y(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss]})]})]}),oe(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:[e.pnlCost>=0?"+":"",e.pnlCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries.toFixed(2),"$"]})]})]}),se(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:[e.peakProfitCost>=0?"+":"",e.peakProfitCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries.toFixed(2),"$"]})]})]}),ce(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:[e.maxDrawdownCost>=0?"+":"",e.maxDrawdownCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries.toFixed(2),"$"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(m,{content:e.note})})]}),Z(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),Q(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:g}})]})})})}),de=[{action:"update-now",label:"Refresh manually",icon:()=>a(D,{icon:j,color:"#4caf50"})}],pe=[{type:A.Link,action:"back-action",label:a(B,{sx:{display:"block"}})},{type:A.Link,action:"back-action",label:"Main"},{type:A.Link,action:"back-action",label:"Notifications"}],me=new _,ue=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=C({handler:async(e,a)=>{const i=await w.notificationViewService.getList(),r=E(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>w.layoutService.setAppbarLoader(!0),onLoadEnd:()=>w.layoutService.setAppbarLoader(!1),reloadSubject:me});return a(O,{children:[a(L,{items:pe,actions:de,onAction:async e=>{"back-action"===e&&w.routerService.push("/"),"update-now"===e&&await me.next()}}),a(F,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:z,hasMore:i,children:e.map(e=>a(le,{item:e,sx:{mb:1}},e.id))})]})};export{ue as NotificationPage,ue as default};
@@ -0,0 +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};