@backtest-kit/ui 13.3.0 → 13.5.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 (27) hide show
  1. package/build/modules/frontend/build/assets/{Article-sbYRbQe0.js → Article-C7I5Jc2B.js} +1 -1
  2. package/build/modules/frontend/build/assets/{Background-dyHMipOI.js → Background-xwzJo61H.js} +1 -1
  3. package/build/modules/frontend/build/assets/{IconPhoto-CHqApvRw.js → IconPhoto-DrGLW-rX.js} +1 -1
  4. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-CHOMu6qx.js → KeyboardArrowLeft-BpxUzr7-.js} +1 -1
  5. package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-DzknxeSi.js → PictureAsPdfOutlined-BTv5MH3G.js} +1 -1
  6. package/build/modules/frontend/build/assets/{Refresh-DmSh3yQM.js → Refresh-DixrXBVq.js} +1 -1
  7. package/build/modules/frontend/build/assets/emitters-ByKSsASU.js +1 -0
  8. package/build/modules/frontend/build/assets/{hasRouteMatch-DqwdOTLY.js → hasRouteMatch-C0K-M4jy.js} +1 -1
  9. package/build/modules/frontend/build/assets/{html2canvas-CHKh6bmw.js → html2canvas-Xo2SFHzw.js} +1 -1
  10. package/build/modules/frontend/build/assets/{index-DUb1EyrG.js → index-BO8_0_6f.js} +1 -1
  11. package/build/modules/frontend/build/assets/{index-BkciU9PY.js → index-CtY-cILX.js} +1 -1
  12. package/build/modules/frontend/build/assets/{index-DYoETulh.js → index-CwqHMGtu.js} +1 -1
  13. package/build/modules/frontend/build/assets/{index-DrklJPOF.js → index-D6fbkGDu.js} +1 -1
  14. package/build/modules/frontend/build/assets/{index-9MTo_fXC.js → index-D7cEguAr.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-BGUfC2GH.js → index-DFbdj6KX.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-C_bLqeg4.js → index-DP-GjNGC.js} +1 -1
  17. package/build/modules/frontend/build/assets/{index-COEOSThW.js → index-DeRxtBVy.js} +1 -1
  18. package/build/modules/frontend/build/assets/{index-Dq8WsVMT.js → index-Giwjzoy7.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-Bm2KpX4M.js → index-S9fsmR5b.js} +1 -1
  20. package/build/modules/frontend/build/assets/{index-0MseBgyH.js → index-kQlTYlpK.js} +6 -6
  21. package/build/modules/frontend/build/assets/{index-CkS6tnju.js → index-wMYoZqi-.js} +1 -1
  22. package/build/modules/frontend/build/assets/{index-DtlxmULa.js → index-wq7wFKoe.js} +1 -1
  23. package/build/modules/frontend/build/assets/{index.es-Bnd2KFus.js → index.es-BiwqIRwO.js} +1 -1
  24. package/build/modules/frontend/build/assets/{markdownit-CWkrj-EI.js → markdownit-By9-eJJI.js} +1 -1
  25. package/build/modules/frontend/build/index.html +1 -1
  26. package/package.json +3 -3
  27. package/build/modules/frontend/build/assets/emitters-BNMcCjB_.js +0 -1
@@ -1 +1 @@
1
- import{b as c,f as v}from"./index-0MseBgyH.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-kQlTYlpK.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-0MseBgyH.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-kQlTYlpK.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,V as s}from"./index-0MseBgyH.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,V as s}from"./index-kQlTYlpK.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-0MseBgyH.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-kQlTYlpK.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{b as h,f as c}from"./index-0MseBgyH.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
1
+ import{b as h,f as c}from"./index-kQlTYlpK.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
@@ -1 +1 @@
1
- import{bI as e,d as t,r as a,_ as s,f as i,bJ as n,j as o,bK as r,k as d,bL as m,g as u,u as p,s as x,b as c}from"./index-0MseBgyH.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{bI as e,d as t,r as a,_ as s,f as i,bJ as n,j as o,bK as r,k as d,bL as m,g as u,u as p,s as x,b as c}from"./index-kQlTYlpK.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{a8 as o}from"./index-kQlTYlpK.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{i as a,bG as e,bH as t}from"./index-0MseBgyH.js";const i=(i,o=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>i.includes(a)),o);export{i as h};
1
+ import{i as a,bG as e,bH as t}from"./index-kQlTYlpK.js";const i=(i,o=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>i.includes(a)),o);export{i as h};
@@ -1 +1 @@
1
- import{bM as e,bO as t}from"./index-0MseBgyH.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
1
+ import{bM as e,bO as t}from"./index-kQlTYlpK.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{r as e,f as a,P as i,B as r,A as n,a9 as t,T as o,H as c,a3 as s,aa as l,N as d,J as p,F as m,G as u,M as b,aO as v,aP as y,aQ as g,aR as h,ad as x,aS as k,aT as f,aU as $,aV as P,aW as w,aX as C,aY as S,i as _,aG as A,a8 as O,aH as N,O as E,R as D,aZ as L,a_ as F,Z as z}from"./index-0MseBgyH.js";import{C as T,R as j}from"./Refresh-DmSh3yQM.js";import{K as R}from"./KeyboardArrowLeft-CHOMu6qx.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(C,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(x,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(P,{sx:i});case"breakeven.available":case"breakeven.commit":return a(w,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(f,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(h,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(y,{sx:i});case"error.critical":return a(g,{sx:i});default:return a(v,{sx:i})}},I=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;default:return l("Unknown")}},U=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},W=e=>"symbol"in e,M=e=>"position"in e,H=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,Y=e=>"pnlPercentage"in e,V=e=>"level"in e,G=e=>"percentToClose"in e,K=e=>"currentPrice"in e,Z=e=>"duration"in e,q=e=>"closeReason"in e,J=e=>"cancelReason"in e,Q=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),ee=e=>"message"in e,ae=e=>"rejectionNote"in e,ie=e=>"activePositionCount"in e,re=e=>"effectivePriceOpen"in e,ne=e=>"totalEntries"in e&&e.totalEntries>1,te=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),oe=e=>"totalPartials"in e&&e.totalPartials>0,ce=e=>"cost"in e,se=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,le=e=>"peakProfitPriceClose"in e,de=e=>"maxDrawdownPriceClose"in e,pe=e.forwardRef(({item:e,className:v,style:y,sx:g},h)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:v,style:y,ref:h,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":_.layoutService.pickRisk(e.id);break;case"signal.opened":_.layoutService.pickSignalOpened(e.id);break;case"signal.closed":_.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":_.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":_.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":_.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":_.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":_.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":_.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":_.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":_.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":_.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":_.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":_.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":_.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":_.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":_.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":_.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":_.layoutService.pickClosePending(e.id);break;case"signal.info":_.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...g},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:I(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:U(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),W(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),Y(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"PnL: "+(e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"),color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ie(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}$`:"N/A"}`,variant:"outlined"}),re(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):"N/A"}`,variant:"outlined",color:"warning"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):"N/A"}`,variant:"outlined"})]}),H(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[K(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):"N/A"]})]})]}),se(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}$`:"N/A"]})]})]}),le(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}$`:"N/A"]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}$`:"N/A"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(b,{content:e.note})})]}),ae(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),ee(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),me=[{action:"update-now",label:"Refresh manually",icon:()=>a(z,{icon:j,color:"#4caf50"})}],ue=[{type:D.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:D.Link,action:"back-action",label:"Main"},{type:D.Link,action:"back-action",label:"Notifications"}],be=new O,ve=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=A({handler:async(e,a)=>{const i=await _.notificationViewService.getList(),r=N(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>_.layoutService.setAppbarLoader(!0),onLoadEnd:()=>_.layoutService.setAppbarLoader(!1),reloadSubject:be});return a(T,{children:[a(E,{items:ue,actions:me,onAction:async e=>{"back-action"===e&&_.routerService.push("/"),"update-now"===e&&await be.next()}}),a(L,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:F,hasMore:i,children:e.map(e=>a(pe,{item:e,sx:{mb:1}},e.id))})]})};export{ve as NotificationPage,ve as default};
1
+ import{r as e,f as a,P as i,B as r,A as n,a9 as t,T as o,H as c,a3 as s,aa as l,N as d,J as p,F as m,G as u,M as b,aO as v,aP as y,aQ as g,aR as h,ad as x,aS as k,aT as f,aU as $,aV as P,aW as w,aX as C,aY as S,i as _,aG as A,a8 as O,aH as N,O as E,R as D,aZ as L,a_ as F,Z as z}from"./index-kQlTYlpK.js";import{C as T,R as j}from"./Refresh-DixrXBVq.js";import{K as R}from"./KeyboardArrowLeft-BpxUzr7-.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(C,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(x,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(P,{sx:i});case"breakeven.available":case"breakeven.commit":return a(w,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(f,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(h,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(y,{sx:i});case"error.critical":return a(g,{sx:i});default:return a(v,{sx:i})}},I=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;default:return l("Unknown")}},U=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},W=e=>"symbol"in e,M=e=>"position"in e,H=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,Y=e=>"pnlPercentage"in e,V=e=>"level"in e,G=e=>"percentToClose"in e,K=e=>"currentPrice"in e,Z=e=>"duration"in e,q=e=>"closeReason"in e,J=e=>"cancelReason"in e,Q=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),ee=e=>"message"in e,ae=e=>"rejectionNote"in e,ie=e=>"activePositionCount"in e,re=e=>"effectivePriceOpen"in e,ne=e=>"totalEntries"in e&&e.totalEntries>1,te=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),oe=e=>"totalPartials"in e&&e.totalPartials>0,ce=e=>"cost"in e,se=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,le=e=>"peakProfitPriceClose"in e,de=e=>"maxDrawdownPriceClose"in e,pe=e.forwardRef(({item:e,className:v,style:y,sx:g},h)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:v,style:y,ref:h,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":_.layoutService.pickRisk(e.id);break;case"signal.opened":_.layoutService.pickSignalOpened(e.id);break;case"signal.closed":_.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":_.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":_.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":_.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":_.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":_.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":_.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":_.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":_.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":_.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":_.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":_.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":_.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":_.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":_.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":_.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":_.layoutService.pickClosePending(e.id);break;case"signal.info":_.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...g},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:I(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:U(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),W(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),Y(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"PnL: "+(e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"),color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ie(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}$`:"N/A"}`,variant:"outlined"}),re(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):"N/A"}`,variant:"outlined",color:"warning"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):"N/A"}`,variant:"outlined"})]}),H(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[K(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):"N/A"]})]})]}),se(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}$`:"N/A"]})]})]}),le(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}$`:"N/A"]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}$`:"N/A"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(b,{content:e.note})})]}),ae(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),ee(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),me=[{action:"update-now",label:"Refresh manually",icon:()=>a(z,{icon:j,color:"#4caf50"})}],ue=[{type:D.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:D.Link,action:"back-action",label:"Main"},{type:D.Link,action:"back-action",label:"Notifications"}],be=new O,ve=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=A({handler:async(e,a)=>{const i=await _.notificationViewService.getList(),r=N(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>_.layoutService.setAppbarLoader(!0),onLoadEnd:()=>_.layoutService.setAppbarLoader(!1),reloadSubject:be});return a(T,{children:[a(E,{items:ue,actions:me,onAction:async e=>{"back-action"===e&&_.routerService.push("/"),"update-now"===e&&await be.next()}}),a(L,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:F,hasMore:i,children:e.map(e=>a(pe,{item:e,sx:{mb:1}},e.id))})]})};export{ve as NotificationPage,ve as default};
@@ -1 +1 @@
1
- import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as y,T as x,aq as v,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as R,I as F,at as z,F as $,au as N,av as D}from"./index-0MseBgyH.js";import{R as O,C as T}from"./Refresh-DmSh3yQM.js";import{K as j}from"./KeyboardArrowLeft-CHOMu6qx.js";import{I as C}from"./IconPhoto-CHqApvRw.js";import{B as W}from"./Background-dyHMipOI.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),A=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),V=new o,E=[{type:t.Link,action:"back-action",label:a(j,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"},{type:t.Button,action:"update-now",label:"Refresh",icon:O}],H=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:B,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:A,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:O,color:"#4caf50"})}],I=()=>a(n,{items:E,actions:H,onAction:V.next});const M=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:N}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),D=d(i),O=d(e);p(()=>V.subscribe(e=>{if("update-now"===e&&N(),"download-action"===e){const e=new Blob([JSON.stringify(D.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${O.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${O.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),j=e=>{const o=T[e]||[];return o.length?a($,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(b,{primary:a(y,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(x,{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(x,{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(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),R(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceOpen),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),R(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceTakeProfit),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),R(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),R(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(x,{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?"+":"",R(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(x,{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(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(x,{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(x,{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(F,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(u,{children:a(b,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[T],children:async()=>{const o=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",s=(null==(n=T[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(C,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(x,{variant:"body2",sx:{fontWeight:"medium"},children:v(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:j(e)})]})},`section-${e}`);var l}):a(u,{children:a(b,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=D(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:M,isActive:e=>J(["/backtest"],e)},{id:"live",element:M,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(T,{children:[a(N,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:I,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(W,{})]})};export{X as OverviewPage,X as default};
1
+ import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as y,T as x,aq as v,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as R,I as F,at as z,F as $,au as N,av as D}from"./index-kQlTYlpK.js";import{R as O,C as T}from"./Refresh-DixrXBVq.js";import{K as j}from"./KeyboardArrowLeft-BpxUzr7-.js";import{I as C}from"./IconPhoto-DrGLW-rX.js";import{B as W}from"./Background-xwzJo61H.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),A=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),V=new o,E=[{type:t.Link,action:"back-action",label:a(j,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"},{type:t.Button,action:"update-now",label:"Refresh",icon:O}],H=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:B,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:A,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:O,color:"#4caf50"})}],I=()=>a(n,{items:E,actions:H,onAction:V.next});const M=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:N}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),D=d(i),O=d(e);p(()=>V.subscribe(e=>{if("update-now"===e&&N(),"download-action"===e){const e=new Blob([JSON.stringify(D.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${O.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${O.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),j=e=>{const o=T[e]||[];return o.length?a($,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(b,{primary:a(y,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(x,{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(x,{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(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),R(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceOpen),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),R(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceTakeProfit),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),R(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),R(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(x,{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?"+":"",R(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(x,{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(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(x,{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(x,{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(F,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(u,{children:a(b,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[T],children:async()=>{const o=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",s=(null==(n=T[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(C,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(x,{variant:"body2",sx:{fontWeight:"medium"},children:v(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:j(e)})]})},`section-${e}`);var l}):a(u,{children:a(b,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=D(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:M,isActive:e=>J(["/backtest"],e)},{id:"live",element:M,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(T,{children:[a(N,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:I,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(W,{})]})};export{X as OverviewPage,X as default};
@@ -1 +1 @@
1
- import{b as e,f as t,x as i,i as n,X as a,a8 as o,O as r,R as l,Z as s,Y as d,$ as c,a0 as p,a2 as m,W as g,w as f,a9 as u,T as _,l as h,B as y,aa as C,P as E,ab as A,ac as x,a4 as b,D as w,ad as S,ae as M,af as R,ag as v,a7 as T,ah as O,ai as D,aj as N}from"./index-0MseBgyH.js";import{h as L}from"./hasRouteMatch-DqwdOTLY.js";import{P as k}from"./PictureAsPdfOutlined-DzknxeSi.js";import{C as I,R as B}from"./Refresh-DmSh3yQM.js";import{K as P}from"./KeyboardArrowLeft-CHOMu6qx.js";const W=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),F=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),V=144,G=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Button,action:"download-pdf",label:"Download PDF",icon:k},{type:l.Fab,action:"setup-action",label:"Settings",icon:W}],K=[{action:"setup-action",label:"Settings",icon:()=>t(s,{icon:W,color:"#4caf50"})},{divider:!0},{action:"download-json",label:"Download JSON",icon:()=>t(s,{icon:d,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(s,{icon:c,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(s,{icon:p,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],X=({name:e,title:t})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:m.Div},{type:m.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${C("ms")}`:t:"-",name:e}]}),H=({name:e,title:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:i},{type:m.Div},{type:m.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:i})=>{const n="github"===e,a=n?"#6A1B9A":"#24A1DE";return t(b,{size:"medium",disabled:!i,startIcon:t(u,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(n?x:F,{sx:{color:a,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:a,"&:hover":{background:"white",color:a}},onClick:()=>{if(n)A(String(i));else{const e=String(i).replaceAll("@","");A(`https://t.me/${e}`)}},children:C(i?"Open":"Not configured")})},name:e}]}),U=[{type:m.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:m.Layout,customLayout:({children:e})=>t(E,{sx:{width:"335px"},children:e}),fields:[{type:m.Component,element:()=>t(y,{sx:{background:e=>h(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(u,{sx:{height:V,width:V,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(_,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:m.Layout,customLayout:({children:e})=>t(y,{p:1,children:e}),fields:[{type:m.Div,style:{height:"2px"}},{type:m.Div,style:{height:"12px"}},X({name:"totalEvents",title:C("Total events")}),X({name:"totalDuration",title:C("Total time")}),X({name:"avgDuration",title:C("Average time")}),H({name:"channel",title:C("Channel")}),H({name:"github",title:"GitHub"})]}]}}],Y=new o,j=new o,z=({title:e,name:t,idx:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr 125px",pointerEvents:"none",alignItems:"center",background:e=>i%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent",padding:"8px",paddingLeft:"8px",paddingRight:"8px"},fields:[{type:m.Typography,style:{fontSize:"12px"},typoVariant:"subtitle2",fieldBottomMargin:"0",placeholder:e},{type:m.Box,sx:{minWidth:"8px"}},{type:m.Text,readonly:!0,outlined:i%2==0,name:t,compute(e){const i=D.get(e,t);return String(i)},title:"",fieldBottomMargin:"0",fieldRightMargin:"0"}]}),$=[{type:m.Box,sx:{maxWidth:420,minWidth:340},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto auto",alignItems:"center",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"4px"},fields:[{type:m.Typography,style:{opacity:.5},fieldBottomMargin:"0",typoVariant:"subtitle2",placeholder:"Runtime Configuration"},{type:m.Box},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:w,async click(e,t,i,n){await j.next(),await n.handleDownloadConfig()}},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:S,click:()=>j.next()}]},{type:m.Layout,customLayout:({children:e})=>t(y,{sx:{overflow:"clip",overflowY:"auto",marginBottom:"16px",maxHeight:{xs:"min(365px, 80vh - 235px)",sm:"min(475px, 80vh - 235px)"},width:"100%"},children:e}),fields:[z({idx:0,title:"CC_SCHEDULE_AWAIT_MINUTES",name:"config.CC_SCHEDULE_AWAIT_MINUTES",description:T.newline("Time to wait for scheduled signal to activate (in minutes).","If signal does not activate within this time, it will be cancelled.")}),z({idx:1,title:"CC_AVG_PRICE_CANDLES_COUNT",name:"config.CC_AVG_PRICE_CANDLES_COUNT",description:T.newline("Number of candles to use for average price calculation (VWAP).","Default: 5 candles (last 5 minutes when using 1m interval).")}),z({idx:2,title:"CC_PERCENT_SLIPPAGE",name:"config.CC_PERCENT_SLIPPAGE",description:T.newline("Slippage percentage applied to entry and exit prices.","Simulates market impact and order book depth.","Applied twice (entry and exit) for realistic execution simulation.","Default: 0.1% per transaction.")}),z({idx:3,title:"CC_PERCENT_FEE",name:"config.CC_PERCENT_FEE",description:T.newline("Fee percentage charged per transaction.","Applied twice (entry and exit) for total fee calculation.","Default: 0.1% per transaction (total 0.2%).")}),z({idx:4,title:"CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",name:"config.CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",description:T.newline("Minimum TakeProfit distance from priceOpen (percentage).","Must be greater than (slippage + fees) to ensure profitable trades.","Default: 0.5% (covers all costs + minimum profit margin).")}),z({idx:5,title:"CC_MIN_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MIN_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Minimum StopLoss distance from priceOpen (percentage).","Prevents signals from being immediately stopped out due to price volatility.","Default: 0.5% (buffer to avoid instant stop loss on normal market fluctuations).")}),z({idx:6,title:"CC_MAX_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MAX_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Maximum StopLoss distance from priceOpen (percentage).","Prevents catastrophic losses from extreme StopLoss values.","Default: 20% (one signal cannot lose more than 20% of position).")}),z({idx:7,title:"CC_MAX_SIGNAL_LIFETIME_MINUTES",name:"config.CC_MAX_SIGNAL_LIFETIME_MINUTES",description:T.newline("Maximum signal lifetime in minutes.","Also used as the default when minuteEstimatedTime is not provided in ISignalDto.","Prevents eternal signals that block risk limits for weeks/months.","Use Infinity to allow signals to live indefinitely (until TP/SL or explicit close).","Default: 1440 minutes (1 day).")}),z({idx:8,title:"CC_MAX_SIGNAL_GENERATION_SECONDS",name:"config.CC_MAX_SIGNAL_GENERATION_SECONDS",description:T.newline("Maximum time allowed for signal generation (in seconds).","Prevents long-running or stuck signal generation routines from blocking execution or consuming resources indefinitely.","If generation exceeds this threshold the attempt should be aborted, logged and optionally retried.","Default: 180 seconds (3 minutes).")}),z({idx:9,title:"CC_GET_CANDLES_RETRY_COUNT",name:"config.CC_GET_CANDLES_RETRY_COUNT",description:T.newline("Number of retries for getCandles function.","Default: 3 retries.")}),z({idx:10,title:"CC_GET_CANDLES_RETRY_DELAY_MS",name:"config.CC_GET_CANDLES_RETRY_DELAY_MS",description:T.newline("Delay between retries for getCandles function (in milliseconds).","Default: 5000 ms (5 seconds).")}),z({idx:11,title:"CC_MAX_CANDLES_PER_REQUEST",name:"config.CC_MAX_CANDLES_PER_REQUEST",description:T.newline("Maximum number of candles to request per single API call.","If a request exceeds this limit, data will be fetched using pagination.","Default: 1000 candles per request.")}),z({idx:12,title:"CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",name:"config.CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",description:T.newline("Maximum allowed deviation factor for price anomaly detection.","Price should not be more than this factor lower than reference price.","Example: BTC at $50,000 median → threshold $50 (catches $0.01-1 anomalies).")}),z({idx:13,title:"CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",name:"config.CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",description:T.newline("Minimum number of candles required for reliable median calculation.","Below this threshold, use simple average instead of median.","Example: 3 candles = 12 points (use average), 5 candles = 20 points (use median).")}),z({idx:14,title:"CC_REPORT_SHOW_SIGNAL_NOTE",name:"config.CC_REPORT_SHOW_SIGNAL_NOTE",description:T.newline("Controls visibility of signal notes in markdown report tables.",'When enabled, the "Note" column will be displayed in all markdown reports (backtest, live, schedule, risk, etc.)',"Default: false (notes are hidden to reduce table width and improve readability).")}),z({idx:15,title:"CC_BREAKEVEN_THRESHOLD",name:"config.CC_BREAKEVEN_THRESHOLD",description:T.newline("Breakeven threshold percentage - minimum profit distance from entry to enable breakeven.","When price moves this percentage in profit direction, stop-loss can be moved to entry (breakeven).","Default: 0.2% (additional buffer above costs to ensure no loss when moving to breakeven).")}),z({idx:16,title:"CC_ORDER_BOOK_TIME_OFFSET_MINUTES",name:"config.CC_ORDER_BOOK_TIME_OFFSET_MINUTES",description:T.newline("Time offset in minutes for order book fetching.","Subtracts this amount from the current time when fetching order book data.","This helps get a more stable snapshot of the order book by avoiding real-time volatility.","Default: 10 minutes.")}),z({idx:17,title:"CC_ORDER_BOOK_MAX_DEPTH_LEVELS",name:"config.CC_ORDER_BOOK_MAX_DEPTH_LEVELS",description:T.newline("Maximum depth levels for order book fetching.","Specifies how many price levels to fetch from both bids and asks.","Default: 20 levels.")}),z({idx:18,title:"CC_AGGREGATED_TRADES_MAX_MINUTES",name:"config.CC_AGGREGATED_TRADES_MAX_MINUTES",description:T.newline("Maximum minutes of aggregated trades to fetch when no limit is provided.","If limit is not specified, the system will fetch aggregated trades for this many minutes starting from the current time minus the offset.","Binance requirement.")}),z({idx:19,title:"CC_MAX_BACKTEST_MARKDOWN_ROWS",name:"config.CC_MAX_BACKTEST_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in backtest markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:20,title:"CC_MAX_BREAKEVEN_MARKDOWN_ROWS",name:"config.CC_MAX_BREAKEVEN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in breakeven markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:21,title:"CC_MAX_HEATMAP_MARKDOWN_ROWS",name:"config.CC_MAX_HEATMAP_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in heatmap markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:22,title:"CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",name:"config.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in highest profit markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:23,title:"CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",name:"config.CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in max drawdown markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:24,title:"CC_MAX_LIVE_MARKDOWN_ROWS",name:"config.CC_MAX_LIVE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in live markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:25,title:"CC_MAX_PARTIAL_MARKDOWN_ROWS",name:"config.CC_MAX_PARTIAL_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in partial markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:26,title:"CC_MAX_RISK_MARKDOWN_ROWS",name:"config.CC_MAX_RISK_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in risk markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:27,title:"CC_MAX_SCHEDULE_MARKDOWN_ROWS",name:"config.CC_MAX_SCHEDULE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in schedule markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:28,title:"CC_MAX_STRATEGY_MARKDOWN_ROWS",name:"config.CC_MAX_STRATEGY_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in strategy markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:29,title:"CC_MAX_SYNC_MARKDOWN_ROWS",name:"config.CC_MAX_SYNC_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in sync markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:30,title:"CC_WALKER_MARKDOWN_TOP_N",name:"config.CC_WALKER_MARKDOWN_TOP_N",description:T.newline("Number of top strategies to include in the walker comparison table.","Default: 10 strategies.")}),z({idx:31,title:"CC_MAX_PERFORMANCE_MARKDOWN_ROWS",name:"config.CC_MAX_PERFORMANCE_MARKDOWN_ROWS",description:T.newline("Maximum number of performance metric events to keep in storage.","Older events are removed when this limit is exceeded.","Higher than other report event limits because performance metrics are lightweight and benefit from larger sample sizes for accurate statistical analysis.","Default: 10000 events.")}),z({idx:32,title:"CC_MAX_NOTIFICATIONS",name:"config.CC_MAX_NOTIFICATIONS",description:T.newline("Maximum number of notifications to keep in storage.","Older notifications are removed when this limit is exceeded.","Default: 500 notifications.")}),z({idx:33,title:"CC_MAX_SIGNALS",name:"config.CC_MAX_SIGNALS",description:T.newline("Maximum number of signals to keep in storage.","Older signals are removed when this limit is exceeded.","Default: 50 signals.")}),z({idx:34,title:"CC_MAX_LOG_LINES",name:"config.CC_MAX_LOG_LINES",description:T.newline("Maximum number of log lines to keep in storage.","Older log lines are removed when this limit is exceeded.","This helps prevent unbounded log growth which can consume memory and degrade performance over time.","Default: 1000 log lines.")}),z({idx:35,title:"CC_ENABLE_CANDLE_FETCH_MUTEX",name:"config.CC_ENABLE_CANDLE_FETCH_MUTEX",description:T.newline("Enables mutex locking for candle fetching to prevent concurrent fetches of the same candles.","This can help avoid redundant API calls and ensure data consistency when multiple processes/threads attempt to fetch candles simultaneously.","Default: true (mutex locking enabled for candle fetching).")}),z({idx:36,title:"CC_ENABLE_BACKTEST_PARALLEL_SPIN",name:"config.CC_ENABLE_BACKTEST_PARALLEL_SPIN",description:T.newline("Enables cooperative interleaving of concurrently running backtests after each candle fetch.","Hands the event loop to a peer backtest waiting on the same mutex, so multiple parallel Backtest.run / Walker workloads progress in round-robin fashion instead of one monopolizing the event loop until completion.","Default: true (parallel backtests are interleaved on each candle fetch boundary).")}),z({idx:37,title:"CC_ENABLE_DCA_EVERYWHERE",name:"config.CC_ENABLE_DCA_EVERYWHERE",description:T.newline("Enables DCA (Dollar-Cost Averaging) logic even if antirecord is not broken.","Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.","Default: false (DCA logic enabled only when antirecord is broken).")}),z({idx:38,title:"CC_ENABLE_PPPL_EVERYWHERE",name:"config.CC_ENABLE_PPPL_EVERYWHERE",description:T.newline("Enables PPPL (Partial Profit, Partial Loss) logic even if this breaks a direction of exits.","Allows to take partial profit or loss on a position even if it results in a mix of profit and loss exits.","Default: false (PPPL logic is only applied when it does not break the direction of exits, ensuring clearer profit/loss outcomes).")}),z({idx:39,title:"CC_ENABLE_LONG_SIGNAL",name:"config.CC_ENABLE_LONG_SIGNAL",description:T.newline("Enables long signals in strategies that are primarily designed for short signals.","This allows the strategy to generate and manage long signals in addition to short signals, even if the original design was focused on short trading.","Default: false (long signals are only enabled in strategies that are designed for them, ensuring strategy logic is aligned with signal types).")}),z({idx:40,title:"CC_ENABLE_SHORT_SIGNAL",name:"config.CC_ENABLE_SHORT_SIGNAL",description:T.newline("Enables short signals in strategies that are primarily designed for long signals.","This allows the strategy to generate and manage short signals in addition to long signals, even if the original design was focused on long trading.")}),z({idx:41,title:"CC_ENABLE_TRAILING_EVERYWHERE",name:"config.CC_ENABLE_TRAILING_EVERYWHERE",description:T.newline("Enables trailing logic (Trailing Take / Trailing Stop) without requiring absorption conditions.","Allows trailing mechanisms to be activated regardless of whether absorption has been detected.","Default: false (trailing logic is applied only when absorption conditions are met).")}),z({idx:42,title:"CC_POSITION_ENTRY_COST",name:"config.CC_POSITION_ENTRY_COST",description:T.newline("Cost of entering a position (in USD).","This is used as a default value for calculating position size and risk management when cost data is not provided by the strategy.","Default: $100 per position.")})]},{type:m.Box,sx:{p:1},child:{type:m.Button,fieldBottomMargin:"0",fieldRightMargin:"0",buttonVariant:"contained",title:"Download",click:async(e,t,i,n)=>{await j.next(),await n.handleDownloadConfig()},icon:w}}]}],q=[{type:m.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"center"},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"1fr"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Running mode"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:"Historical data processing"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:"Real-time exchange integration"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:"UI only"}]},{type:m.Box},{type:m.Component,fieldBottomMargin:"0",element:({_fieldData:e,payload:i})=>t(M,{noBadge:!0,size:"small",sx:{transform:"translate(10px, -28px)",opacity:"0.5",transition:"opacity 500ms","&:hover":{opacity:"1.0"}},oneSx:{padding:"0 !important"},fields:$,closeSubject:j,payload:i,handler:()=>e,children:t(W,{})})}]},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:"Historical data"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:"Real-time"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:"Frontend only"}]},{type:m.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:m.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Log mode"},{type:m.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:"Logs take up disk space but are needed for debugging"}]},...[{title:"JSONL files",description:"Files processed by Claude Code, HuggingFace, Parquet",name:"recent_enabled"},{title:"Markdown files",description:"Human-readable files. Useful when running without a GUI",name:"markdown_enabled"},{title:"Dump files",description:"Conversation dump with the AI agent used for trading signals",name:"dump_enabled"}].map(({name:e,title:t,description:i},n)=>(({title:e,description:t,name:i,idx:n})=>({type:m.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>n%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:m.Box,fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:i}]}))({name:e,title:t,description:i,idx:n}))]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"User interface"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save notifications",name:"notification_enabled"},{type:m.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:"Event history is saved to disk"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save signals",name:"storage_enabled"},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:"Latest signal state is saved to disk"}]}]},{type:m.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Strategy"},{type:m.Typography,placeholder:"Broker"},{type:m.Outline,fieldBottomMargin:"3",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Connected to mainnet (production)",name:"broker_enabled"}]},{type:m.Typography,placeholder:"Market signals"},{type:m.Outline,fieldBottomMargin:"4",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use BM25 for RAG",name:"memory_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use stateful strategies",name:"state_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Save previous signal",name:"recent_enabled"}]}]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:"Risk management"},{type:m.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:"Use LONG or SHORT positions depending on market conditions"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Enable LONG",name:"enable_long"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"1",title:"Enable SHORT",name:"enable_short"}]}]},{type:m.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const i=R();return t(v,{variant:"contained",size:"large",startIcon:t(B,{}),onClick:async()=>{await e.handleReload(),i()},children:"Refresh"})}}],J=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Link,action:"back-action",label:"Settings"},{type:l.Button,action:"update-now",label:"Refresh",icon:B}],Q=[{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],Z=new o,ee=async()=>{n.setupViewService.getSetupData.clear(),await Z.next()},te=async()=>{const{config:e}=await n.setupViewService.getSetupData(),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`config_${Date.now()}.json`)},ie=[{id:"search",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.performanceViewService.getPerformanceData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Y.subscribe(o));const[s,{execute:d,loading:c}]=i(async()=>await n.environmentViewService.getEnvironmentData());a(()=>Y.subscribe(d));return t(I,{children:[t(r,{items:G,actions:K,onAction:async e=>{"back-action"===e&&n.routerService.push("/main"),"setup-action"===e&&n.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{n.performanceViewService.getPerformanceData.clear(),n.performanceViewService.getPerformanceReport.clear(),n.environmentViewService.getEnvironmentData.clear(),await Y.next()})(),"download-markdown"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport();await f(e)})(),"download-json"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),i=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(i);n.layoutService.downloadFile(a,`performance_${Date.now()}.json`)})()}}),e&&s?l||c?null:t(g,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:s.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:U}):null]})},isActive:e=>L(["/about"],e)},{id:"main",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.setupViewService.getSetupData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Z.subscribe(o));return t(I,{children:[t(r,{items:J,actions:Q,onAction:async e=>{"back-action"===e&&n.routerService.push("/about"),"update-now"===e&&await ee()}}),e?l?null:t(g,{handler:e,payload:()=>({handleReload:ee,handleDownloadConfig:te}),fields:q}):null]})},isActive:e=>L(["/about/setup"],e)}],ne=()=>t(N,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:ie});export{ne as AboutPage,ne as default};
1
+ import{b as e,f as t,x as i,i as n,X as a,a8 as o,O as r,R as l,Z as s,Y as d,$ as c,a0 as p,a2 as m,W as g,w as f,a9 as u,T as _,l as h,B as y,aa as C,P as E,ab as A,ac as x,a4 as b,D as w,ad as S,ae as M,af as R,ag as v,a7 as T,ah as O,ai as D,aj as N}from"./index-kQlTYlpK.js";import{h as L}from"./hasRouteMatch-C0K-M4jy.js";import{P as k}from"./PictureAsPdfOutlined-BTv5MH3G.js";import{C as I,R as B}from"./Refresh-DixrXBVq.js";import{K as P}from"./KeyboardArrowLeft-BpxUzr7-.js";const W=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),F=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),V=144,G=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Button,action:"download-pdf",label:"Download PDF",icon:k},{type:l.Fab,action:"setup-action",label:"Settings",icon:W}],K=[{action:"setup-action",label:"Settings",icon:()=>t(s,{icon:W,color:"#4caf50"})},{divider:!0},{action:"download-json",label:"Download JSON",icon:()=>t(s,{icon:d,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(s,{icon:c,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(s,{icon:p,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],X=({name:e,title:t})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:m.Div},{type:m.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${C("ms")}`:t:"-",name:e}]}),H=({name:e,title:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:i},{type:m.Div},{type:m.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:i})=>{const n="github"===e,a=n?"#6A1B9A":"#24A1DE";return t(b,{size:"medium",disabled:!i,startIcon:t(u,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(n?x:F,{sx:{color:a,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:a,"&:hover":{background:"white",color:a}},onClick:()=>{if(n)A(String(i));else{const e=String(i).replaceAll("@","");A(`https://t.me/${e}`)}},children:C(i?"Open":"Not configured")})},name:e}]}),U=[{type:m.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:m.Layout,customLayout:({children:e})=>t(E,{sx:{width:"335px"},children:e}),fields:[{type:m.Component,element:()=>t(y,{sx:{background:e=>h(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(u,{sx:{height:V,width:V,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(_,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:m.Layout,customLayout:({children:e})=>t(y,{p:1,children:e}),fields:[{type:m.Div,style:{height:"2px"}},{type:m.Div,style:{height:"12px"}},X({name:"totalEvents",title:C("Total events")}),X({name:"totalDuration",title:C("Total time")}),X({name:"avgDuration",title:C("Average time")}),H({name:"channel",title:C("Channel")}),H({name:"github",title:"GitHub"})]}]}}],Y=new o,j=new o,z=({title:e,name:t,idx:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr 125px",pointerEvents:"none",alignItems:"center",background:e=>i%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent",padding:"8px",paddingLeft:"8px",paddingRight:"8px"},fields:[{type:m.Typography,style:{fontSize:"12px"},typoVariant:"subtitle2",fieldBottomMargin:"0",placeholder:e},{type:m.Box,sx:{minWidth:"8px"}},{type:m.Text,readonly:!0,outlined:i%2==0,name:t,compute(e){const i=D.get(e,t);return String(i)},title:"",fieldBottomMargin:"0",fieldRightMargin:"0"}]}),$=[{type:m.Box,sx:{maxWidth:420,minWidth:340},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto auto",alignItems:"center",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"4px"},fields:[{type:m.Typography,style:{opacity:.5},fieldBottomMargin:"0",typoVariant:"subtitle2",placeholder:"Runtime Configuration"},{type:m.Box},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:w,async click(e,t,i,n){await j.next(),await n.handleDownloadConfig()}},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:S,click:()=>j.next()}]},{type:m.Layout,customLayout:({children:e})=>t(y,{sx:{overflow:"clip",overflowY:"auto",marginBottom:"16px",maxHeight:{xs:"min(365px, 80vh - 235px)",sm:"min(475px, 80vh - 235px)"},width:"100%"},children:e}),fields:[z({idx:0,title:"CC_SCHEDULE_AWAIT_MINUTES",name:"config.CC_SCHEDULE_AWAIT_MINUTES",description:T.newline("Time to wait for scheduled signal to activate (in minutes).","If signal does not activate within this time, it will be cancelled.")}),z({idx:1,title:"CC_AVG_PRICE_CANDLES_COUNT",name:"config.CC_AVG_PRICE_CANDLES_COUNT",description:T.newline("Number of candles to use for average price calculation (VWAP).","Default: 5 candles (last 5 minutes when using 1m interval).")}),z({idx:2,title:"CC_PERCENT_SLIPPAGE",name:"config.CC_PERCENT_SLIPPAGE",description:T.newline("Slippage percentage applied to entry and exit prices.","Simulates market impact and order book depth.","Applied twice (entry and exit) for realistic execution simulation.","Default: 0.1% per transaction.")}),z({idx:3,title:"CC_PERCENT_FEE",name:"config.CC_PERCENT_FEE",description:T.newline("Fee percentage charged per transaction.","Applied twice (entry and exit) for total fee calculation.","Default: 0.1% per transaction (total 0.2%).")}),z({idx:4,title:"CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",name:"config.CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",description:T.newline("Minimum TakeProfit distance from priceOpen (percentage).","Must be greater than (slippage + fees) to ensure profitable trades.","Default: 0.5% (covers all costs + minimum profit margin).")}),z({idx:5,title:"CC_MIN_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MIN_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Minimum StopLoss distance from priceOpen (percentage).","Prevents signals from being immediately stopped out due to price volatility.","Default: 0.5% (buffer to avoid instant stop loss on normal market fluctuations).")}),z({idx:6,title:"CC_MAX_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MAX_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Maximum StopLoss distance from priceOpen (percentage).","Prevents catastrophic losses from extreme StopLoss values.","Default: 20% (one signal cannot lose more than 20% of position).")}),z({idx:7,title:"CC_MAX_SIGNAL_LIFETIME_MINUTES",name:"config.CC_MAX_SIGNAL_LIFETIME_MINUTES",description:T.newline("Maximum signal lifetime in minutes.","Also used as the default when minuteEstimatedTime is not provided in ISignalDto.","Prevents eternal signals that block risk limits for weeks/months.","Use Infinity to allow signals to live indefinitely (until TP/SL or explicit close).","Default: 1440 minutes (1 day).")}),z({idx:8,title:"CC_MAX_SIGNAL_GENERATION_SECONDS",name:"config.CC_MAX_SIGNAL_GENERATION_SECONDS",description:T.newline("Maximum time allowed for signal generation (in seconds).","Prevents long-running or stuck signal generation routines from blocking execution or consuming resources indefinitely.","If generation exceeds this threshold the attempt should be aborted, logged and optionally retried.","Default: 180 seconds (3 minutes).")}),z({idx:9,title:"CC_GET_CANDLES_RETRY_COUNT",name:"config.CC_GET_CANDLES_RETRY_COUNT",description:T.newline("Number of retries for getCandles function.","Default: 3 retries.")}),z({idx:10,title:"CC_GET_CANDLES_RETRY_DELAY_MS",name:"config.CC_GET_CANDLES_RETRY_DELAY_MS",description:T.newline("Delay between retries for getCandles function (in milliseconds).","Default: 5000 ms (5 seconds).")}),z({idx:11,title:"CC_MAX_CANDLES_PER_REQUEST",name:"config.CC_MAX_CANDLES_PER_REQUEST",description:T.newline("Maximum number of candles to request per single API call.","If a request exceeds this limit, data will be fetched using pagination.","Default: 1000 candles per request.")}),z({idx:12,title:"CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",name:"config.CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",description:T.newline("Maximum allowed deviation factor for price anomaly detection.","Price should not be more than this factor lower than reference price.","Example: BTC at $50,000 median → threshold $50 (catches $0.01-1 anomalies).")}),z({idx:13,title:"CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",name:"config.CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",description:T.newline("Minimum number of candles required for reliable median calculation.","Below this threshold, use simple average instead of median.","Example: 3 candles = 12 points (use average), 5 candles = 20 points (use median).")}),z({idx:14,title:"CC_REPORT_SHOW_SIGNAL_NOTE",name:"config.CC_REPORT_SHOW_SIGNAL_NOTE",description:T.newline("Controls visibility of signal notes in markdown report tables.",'When enabled, the "Note" column will be displayed in all markdown reports (backtest, live, schedule, risk, etc.)',"Default: false (notes are hidden to reduce table width and improve readability).")}),z({idx:15,title:"CC_BREAKEVEN_THRESHOLD",name:"config.CC_BREAKEVEN_THRESHOLD",description:T.newline("Breakeven threshold percentage - minimum profit distance from entry to enable breakeven.","When price moves this percentage in profit direction, stop-loss can be moved to entry (breakeven).","Default: 0.2% (additional buffer above costs to ensure no loss when moving to breakeven).")}),z({idx:16,title:"CC_ORDER_BOOK_TIME_OFFSET_MINUTES",name:"config.CC_ORDER_BOOK_TIME_OFFSET_MINUTES",description:T.newline("Time offset in minutes for order book fetching.","Subtracts this amount from the current time when fetching order book data.","This helps get a more stable snapshot of the order book by avoiding real-time volatility.","Default: 10 minutes.")}),z({idx:17,title:"CC_ORDER_BOOK_MAX_DEPTH_LEVELS",name:"config.CC_ORDER_BOOK_MAX_DEPTH_LEVELS",description:T.newline("Maximum depth levels for order book fetching.","Specifies how many price levels to fetch from both bids and asks.","Default: 20 levels.")}),z({idx:18,title:"CC_AGGREGATED_TRADES_MAX_MINUTES",name:"config.CC_AGGREGATED_TRADES_MAX_MINUTES",description:T.newline("Maximum minutes of aggregated trades to fetch when no limit is provided.","If limit is not specified, the system will fetch aggregated trades for this many minutes starting from the current time minus the offset.","Binance requirement.")}),z({idx:19,title:"CC_MAX_BACKTEST_MARKDOWN_ROWS",name:"config.CC_MAX_BACKTEST_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in backtest markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:20,title:"CC_MAX_BREAKEVEN_MARKDOWN_ROWS",name:"config.CC_MAX_BREAKEVEN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in breakeven markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:21,title:"CC_MAX_HEATMAP_MARKDOWN_ROWS",name:"config.CC_MAX_HEATMAP_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in heatmap markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:22,title:"CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",name:"config.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in highest profit markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:23,title:"CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",name:"config.CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in max drawdown markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:24,title:"CC_MAX_LIVE_MARKDOWN_ROWS",name:"config.CC_MAX_LIVE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in live markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:25,title:"CC_MAX_PARTIAL_MARKDOWN_ROWS",name:"config.CC_MAX_PARTIAL_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in partial markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:26,title:"CC_MAX_RISK_MARKDOWN_ROWS",name:"config.CC_MAX_RISK_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in risk markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:27,title:"CC_MAX_SCHEDULE_MARKDOWN_ROWS",name:"config.CC_MAX_SCHEDULE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in schedule markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:28,title:"CC_MAX_STRATEGY_MARKDOWN_ROWS",name:"config.CC_MAX_STRATEGY_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in strategy markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:29,title:"CC_MAX_SYNC_MARKDOWN_ROWS",name:"config.CC_MAX_SYNC_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in sync markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:30,title:"CC_WALKER_MARKDOWN_TOP_N",name:"config.CC_WALKER_MARKDOWN_TOP_N",description:T.newline("Number of top strategies to include in the walker comparison table.","Default: 10 strategies.")}),z({idx:31,title:"CC_MAX_PERFORMANCE_MARKDOWN_ROWS",name:"config.CC_MAX_PERFORMANCE_MARKDOWN_ROWS",description:T.newline("Maximum number of performance metric events to keep in storage.","Older events are removed when this limit is exceeded.","Higher than other report event limits because performance metrics are lightweight and benefit from larger sample sizes for accurate statistical analysis.","Default: 10000 events.")}),z({idx:32,title:"CC_MAX_NOTIFICATIONS",name:"config.CC_MAX_NOTIFICATIONS",description:T.newline("Maximum number of notifications to keep in storage.","Older notifications are removed when this limit is exceeded.","Default: 500 notifications.")}),z({idx:33,title:"CC_MAX_SIGNALS",name:"config.CC_MAX_SIGNALS",description:T.newline("Maximum number of signals to keep in storage.","Older signals are removed when this limit is exceeded.","Default: 50 signals.")}),z({idx:34,title:"CC_MAX_LOG_LINES",name:"config.CC_MAX_LOG_LINES",description:T.newline("Maximum number of log lines to keep in storage.","Older log lines are removed when this limit is exceeded.","This helps prevent unbounded log growth which can consume memory and degrade performance over time.","Default: 1000 log lines.")}),z({idx:35,title:"CC_ENABLE_CANDLE_FETCH_MUTEX",name:"config.CC_ENABLE_CANDLE_FETCH_MUTEX",description:T.newline("Enables mutex locking for candle fetching to prevent concurrent fetches of the same candles.","This can help avoid redundant API calls and ensure data consistency when multiple processes/threads attempt to fetch candles simultaneously.","Default: true (mutex locking enabled for candle fetching).")}),z({idx:36,title:"CC_ENABLE_BACKTEST_PARALLEL_SPIN",name:"config.CC_ENABLE_BACKTEST_PARALLEL_SPIN",description:T.newline("Enables cooperative interleaving of concurrently running backtests after each candle fetch.","Hands the event loop to a peer backtest waiting on the same mutex, so multiple parallel Backtest.run / Walker workloads progress in round-robin fashion instead of one monopolizing the event loop until completion.","Default: true (parallel backtests are interleaved on each candle fetch boundary).")}),z({idx:37,title:"CC_ENABLE_DCA_EVERYWHERE",name:"config.CC_ENABLE_DCA_EVERYWHERE",description:T.newline("Enables DCA (Dollar-Cost Averaging) logic even if antirecord is not broken.","Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.","Default: false (DCA logic enabled only when antirecord is broken).")}),z({idx:38,title:"CC_ENABLE_PPPL_EVERYWHERE",name:"config.CC_ENABLE_PPPL_EVERYWHERE",description:T.newline("Enables PPPL (Partial Profit, Partial Loss) logic even if this breaks a direction of exits.","Allows to take partial profit or loss on a position even if it results in a mix of profit and loss exits.","Default: false (PPPL logic is only applied when it does not break the direction of exits, ensuring clearer profit/loss outcomes).")}),z({idx:39,title:"CC_ENABLE_LONG_SIGNAL",name:"config.CC_ENABLE_LONG_SIGNAL",description:T.newline("Enables long signals in strategies that are primarily designed for short signals.","This allows the strategy to generate and manage long signals in addition to short signals, even if the original design was focused on short trading.","Default: false (long signals are only enabled in strategies that are designed for them, ensuring strategy logic is aligned with signal types).")}),z({idx:40,title:"CC_ENABLE_SHORT_SIGNAL",name:"config.CC_ENABLE_SHORT_SIGNAL",description:T.newline("Enables short signals in strategies that are primarily designed for long signals.","This allows the strategy to generate and manage short signals in addition to long signals, even if the original design was focused on long trading.")}),z({idx:41,title:"CC_ENABLE_TRAILING_EVERYWHERE",name:"config.CC_ENABLE_TRAILING_EVERYWHERE",description:T.newline("Enables trailing logic (Trailing Take / Trailing Stop) without requiring absorption conditions.","Allows trailing mechanisms to be activated regardless of whether absorption has been detected.","Default: false (trailing logic is applied only when absorption conditions are met).")}),z({idx:42,title:"CC_POSITION_ENTRY_COST",name:"config.CC_POSITION_ENTRY_COST",description:T.newline("Cost of entering a position (in USD).","This is used as a default value for calculating position size and risk management when cost data is not provided by the strategy.","Default: $100 per position.")})]},{type:m.Box,sx:{p:1},child:{type:m.Button,fieldBottomMargin:"0",fieldRightMargin:"0",buttonVariant:"contained",title:"Download",click:async(e,t,i,n)=>{await j.next(),await n.handleDownloadConfig()},icon:w}}]}],q=[{type:m.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"center"},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"1fr"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Running mode"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:"Historical data processing"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:"Real-time exchange integration"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:"UI only"}]},{type:m.Box},{type:m.Component,fieldBottomMargin:"0",element:({_fieldData:e,payload:i})=>t(M,{noBadge:!0,size:"small",sx:{transform:"translate(10px, -28px)",opacity:"0.5",transition:"opacity 500ms","&:hover":{opacity:"1.0"}},oneSx:{padding:"0 !important"},fields:$,closeSubject:j,payload:i,handler:()=>e,children:t(W,{})})}]},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:"Historical data"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:"Real-time"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:"Frontend only"}]},{type:m.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:m.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Log mode"},{type:m.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:"Logs take up disk space but are needed for debugging"}]},...[{title:"JSONL files",description:"Files processed by Claude Code, HuggingFace, Parquet",name:"recent_enabled"},{title:"Markdown files",description:"Human-readable files. Useful when running without a GUI",name:"markdown_enabled"},{title:"Dump files",description:"Conversation dump with the AI agent used for trading signals",name:"dump_enabled"}].map(({name:e,title:t,description:i},n)=>(({title:e,description:t,name:i,idx:n})=>({type:m.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>n%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:m.Box,fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:i}]}))({name:e,title:t,description:i,idx:n}))]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"User interface"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save notifications",name:"notification_enabled"},{type:m.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:"Event history is saved to disk"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save signals",name:"storage_enabled"},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:"Latest signal state is saved to disk"}]}]},{type:m.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Strategy"},{type:m.Typography,placeholder:"Broker"},{type:m.Outline,fieldBottomMargin:"3",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Connected to mainnet (production)",name:"broker_enabled"}]},{type:m.Typography,placeholder:"Market signals"},{type:m.Outline,fieldBottomMargin:"4",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use BM25 for RAG",name:"memory_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use stateful strategies",name:"state_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Save previous signal",name:"recent_enabled"}]}]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:"Risk management"},{type:m.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:"Use LONG or SHORT positions depending on market conditions"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Enable LONG",name:"enable_long"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"1",title:"Enable SHORT",name:"enable_short"}]}]},{type:m.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const i=R();return t(v,{variant:"contained",size:"large",startIcon:t(B,{}),onClick:async()=>{await e.handleReload(),i()},children:"Refresh"})}}],J=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Link,action:"back-action",label:"Settings"},{type:l.Button,action:"update-now",label:"Refresh",icon:B}],Q=[{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],Z=new o,ee=async()=>{n.setupViewService.getSetupData.clear(),await Z.next()},te=async()=>{const{config:e}=await n.setupViewService.getSetupData(),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`config_${Date.now()}.json`)},ie=[{id:"search",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.performanceViewService.getPerformanceData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Y.subscribe(o));const[s,{execute:d,loading:c}]=i(async()=>await n.environmentViewService.getEnvironmentData());a(()=>Y.subscribe(d));return t(I,{children:[t(r,{items:G,actions:K,onAction:async e=>{"back-action"===e&&n.routerService.push("/main"),"setup-action"===e&&n.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{n.performanceViewService.getPerformanceData.clear(),n.performanceViewService.getPerformanceReport.clear(),n.environmentViewService.getEnvironmentData.clear(),await Y.next()})(),"download-markdown"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport();await f(e)})(),"download-json"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),i=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(i);n.layoutService.downloadFile(a,`performance_${Date.now()}.json`)})()}}),e&&s?l||c?null:t(g,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:s.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:U}):null]})},isActive:e=>L(["/about"],e)},{id:"main",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.setupViewService.getSetupData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Z.subscribe(o));return t(I,{children:[t(r,{items:J,actions:Q,onAction:async e=>{"back-action"===e&&n.routerService.push("/about"),"update-now"===e&&await ee()}}),e?l?null:t(g,{handler:e,payload:()=>({handleReload:ee,handleDownloadConfig:te}),fields:q}):null]})},isActive:e=>L(["/about/setup"],e)}],ne=()=>t(N,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:ie});export{ne as AboutPage,ne as default};
@@ -1 +1 @@
1
- import{b as e,f as t,i as o,aw as a,H as n,ax as l,r as i,ay as r,p as s,T as c,J as d,c as p,P as u,F as m,az as h,aA as g,aB as f,B as y,ao as v,aC as b,aD as x,aa as C,aE as k,aF as w,aG as P,aH as S,aI as L,aJ as M,a2 as N,ag as R,I as $,ad as T,A as D,aK as j,E as B,a4 as I,Z as V,V as A,x as E,aL as O,X as z,a8 as F,O as U,R as W,D as H,aM as G,aN as _,W as Y}from"./index-0MseBgyH.js";import{I as K}from"./IconPhoto-CHqApvRw.js";import{C as J,R as X}from"./Refresh-DmSh3yQM.js";import{K as Z}from"./KeyboardArrowLeft-CHOMu6qx.js";const q=e(t("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 10V8h-2v4H8l4 4 4-4h-3z"}),"ArrowCircleDown"),Q=e(t("path",{d:"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0 2c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm-1-10v4h2v-4h3l-4-4-4 4h3z"}),"ArrowCircleUp"),ee=e(t("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixHigh"),te=e(t("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle"),oe=l(async e=>"live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),{key:([e])=>`${e}`,timeout:45e3}),ae=async(e,t)=>(await oe(t)).filter(t=>"closed"===t.status&&t.symbol===e),ne=async(e,t)=>{const o=await ae(e,t);return{total:o.length,resolvedCount:o.filter(e=>e.pnl.pnlPercentage>0).length,rejectedCount:o.filter(e=>e.pnl.pnlPercentage<=0).length}},le=async(e,t)=>{const o=await ae(e,t),a=e=>Math.abs(e.pnl.priceClose-e.priceTakeProfit)/e.priceTakeProfit<.005,n=e=>Math.abs(e.pnl.priceClose-e.priceStopLoss)/e.priceStopLoss<.005;return{resolvedTakeProfitCount:o.filter(e=>e.pnl.pnlPercentage>0&&a(e)).length,rejectedStopLossCount:o.filter(e=>e.pnl.pnlPercentage<=0&&n(e)).length,resolvedCloseCount:o.filter(e=>e.pnl.pnlPercentage>0&&!a(e)).length,rejectedCloseCount:o.filter(e=>e.pnl.pnlPercentage<=0&&!n(e)).length}},ie=async(e,t)=>{const o=await ae(e,t),l=new Map;for(const i of o){const e=a(n(i.updatedAt)),t=l.get(e)??{resolved:0,rejected:0};i.pnl.pnlPercentage>0?l.set(e,{...t,resolved:t.resolved+1}):l.set(e,{...t,rejected:t.rejected+1})}return Array.from(l.entries()).map(([e,{resolved:t,rejected:o}])=>({stamp:e,count:t+o,resolved:t,rejected:o}))},re=async(e,t)=>{const o=await ae(e,t),a="backtest"===t&&o.length?o.reduce((e,t)=>Math.max(e,t.updatedAt),0):Date.now(),l=n(a).startOf("day").valueOf(),i=l-864e5,r=l-6048e5,s=l-26784e5,c=e=>e.reduce((e,t)=>e+t.pnl.pnlCost,0),d=o.filter(e=>e.updatedAt>=l),p=o.filter(e=>e.updatedAt>=i&&e.updatedAt<l),u=o.filter(e=>e.updatedAt>=r),m=o.filter(e=>e.updatedAt>=s);return{symbol:e,todayRevenue:c(d),yesterdayRevenue:c(p),sevenDaysRevenue:c(u),thirtyOneDaysRevenue:c(m),todayCount:d.length,yesterdayCount:p.length,sevenDaysCount:u.length,thirtyOneDaysCount:m.length}};var se=(e=>(e.Red="#DD4049",e.Orange="#F3A43A",e.Green="#2EA96F",e.Blue="#2979ff",e.Violet="#d500f9",e))(se||{});const ce=i.createContext(null),de=({value:e,children:o})=>t(ce.Provider,{value:e,children:o}),pe=()=>i.useContext(ce);var ue=(e=>(e.Semi="semi",e.Solid="solid",e.Unset="unset",e))(ue||{});const me=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"stretch",whiteSpace:"nowrap",gap:"8px",overflow:"clip",padding:"10px",borderTop:`1px solid ${e.palette.divider}`,"& > *":{flex:1}},solidBackground:{color:"#fff","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}},semiBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}}})),he=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=me(),{footerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...s===ue.Solid&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},ge=(e,t=2)=>{let o=1;for(let a=0;a<t;a++)o*=10;return Math.round(e*o)/o},fe=s()({root:{position:"relative",width:"100%",height:"0px"},container:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}),ye=({caption:e})=>{const{classes:o}=fe();return t("div",{className:o.root,children:t("div",{className:o.container,children:t(c,{variant:"caption",sx:{opacity:.5,fontSize:12,textAlign:"center",padding:"0 8px"},children:e})})})},ve=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},solidBackground:{"& > :first-of-type":{color:"#fff",fontWeight:"bold"},"& > :last-of-type":{color:"#fff"}},unsetBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},semiBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},content:{display:"flex",alignItems:"baseline",flexDirection:"row",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),be=p(e=>t("div",{className:e.v0,style:e.v1,children:[t("div",{className:e.v2,children:[e.v3,e.v4]}),e.v5]}),{name:"Content_1",portals:["v3","v4","v5"]}),xe=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=ve(),{backgroundMode:l=ue.Solid,roundDigits:s=2,value:p,caption:u,valueUnit:m="Unit"}=pe(),h=i.useMemo(()=>({...o,...l===ue.Solid&&{backgroundColor:a}}),[a,l,o]);return t(be,{v0:r(e,n.root),v1:h,v2:r(n.content,{[n.solidBackground]:l===ue.Solid,[n.unsetBackground]:l===ue.Unset,[n.semiBackground]:l===ue.Semi}),v3:t(c,{fontWeight:"bold",children:d(ge(p,s))}),v4:t(c,{children:m}),v5:!!u&&t(ye,{caption:u})})},Ce=s()(e=>({root:{display:"flex",alignItems:"center",whiteSpace:"nowrap",fontWeight:700,fontSize:"18px",paddingLeft:"8px",gap:"8px",overflow:"clip",borderBottom:`1px solid ${e.palette.divider}`},solidBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},semiBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,padding:"10px","& svg":{fill:e.palette.text.primary}}})),ke=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=Ce(),{headerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...(s===ue.Solid||s===ue.Semi)&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},we=s()({root:{overflow:"clip",height:"100%",width:"100%",display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},click:{cursor:"pointer"},header:{minHeight:"36px"},content:{flex:1},footer:{minHeight:"32px"}}),Pe=({className:e,style:o})=>{const{classes:a}=we(),{backgroundColor:n,onClick:l,footerLabel:i}=pe();return t(u,{className:r(e,a.root,{[a.click]:!!l}),onClick:l,style:o,children:[t(ke,{backgroundColor:n}),t(xe,{backgroundColor:n,className:a.content}),!!i&&t(he,{backgroundColor:n,className:a.footer})]})},Se=i.memo(({className:e,style:o,...a})=>t(de,{value:a,children:t(Pe,{className:e,style:o})})),Le=(e,{one:t,many:o,two:a=o})=>`${(()=>{if(0===e||e>=11&&e<20)return o;let n=e%10;return 0===n?o:1===n?t:n<5?a:o})()}`,Me=i.createContext(null),Ne=({value:e,children:o})=>t(Me.Provider,{value:e,children:o}),Re=()=>i.useContext(Me),$e=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",paddingLeft:"20px",paddingRight:"20px",overflow:"clip"},container:{flex:1,display:"flex",alignItems:"stretch",justifyContent:"center",gap:"40px"},item:{gap:"4px",display:"flex",alignItems:"center",justifyContent:"center","& > span":{fontWeight:500,fontSize:"12px",color:"var(--black-6)",whiteSpace:"nowrap"}},circle:{borderRadius:"50%",height:"8px",width:"8px"}}),Te=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Footer_1",portals:["v3"]}),De=({className:e,style:o})=>{const{classes:a}=$e(),{items:n}=Re();return t(Te,{v0:r(e,a.root),v1:o,v2:a.container,v3:[...n].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,o)=>t("div",{className:a.item,children:[t("div",{className:a.circle,style:{background:e.color}}),t("span",{children:[e.label," ",e.value?e.value():e.maxValue]})]},o))})},je=s()(()=>({circle:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%","& > div":{borderRadius:"50%"}}})),Be=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{style:e.v2})}),{name:"Circle_1"}),Ie=({className:e,style:o,lineWidth:a,side:n,color:l,rotate:i})=>{const{classes:s}=je();return t(Be,{v0:r(e,s.circle),v1:{...o},v2:{borderTop:`${a}px solid ${l}`,borderLeft:`${a}px solid ${l}`,borderRight:`${a}px solid transparent`,borderBottom:`${a}px solid transparent`,transform:`rotate(${i}deg)`,height:n,width:n}})},Ve=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",background:e.palette.background.paper}})),Ae=({side:e})=>{const{classes:o}=Ve();return t("div",{className:o.dot,style:{height:e,width:e}})},Ee=s()(e=>({line:{position:"absolute",background:e.palette.background.paper,height:"100%",width:"1px",left:"50%",transformOrigin:"center bottom"}})),Oe=({angle:e})=>{const{classes:o}=Ee();return t("div",{className:o.line,style:{transform:`rotate(${e}deg)`}})},ze=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",outline:`100vmax solid ${e.palette.background.paper}`}})),Fe=({side:e})=>{const{classes:o}=ze();return t("div",{className:o.dot,style:{height:e,width:e}})},Ue=s()(e=>({pointer:{position:"absolute",left:"21%",width:"29%",bottom:"0%",zIndex:1,transformOrigin:"right center",fill:e.palette.text.primary}})),We=p(e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 87 8",className:e.v0,style:e.v1,...e.v2,children:[t("rect",{x:"0.5",y:"2.5",width:"79",height:"3"}),t("circle",{cx:"82.5",cy:"4",r:"4"})]}),{name:"Pointer_1",svg:!0}),He=({className:e,style:o,angle:a,scale:n=1,...l})=>{const{classes:i}=Ue();return t(We,{v0:r(e,i.pointer),v1:{...o,transform:`rotate(${a}deg) scale(${n}) translateX(5px)`},v2:l})},Ge=e=>e*Math.PI/180,_e=(e,t)=>({left:t*Math.cos(Ge(e))+t,top:t*Math.sin(Ge(e))+t}),Ye=s()(e=>({root:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",display:"flex",alignItems:"stretch",justifyContent:"stretch"},container:{flex:1,position:"relative"},label:{position:"absolute",transform:"translate(-50%, -50%)",color:e.palette.text.primary,zIndex:2}})),Ke=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Labels_1",portals:["v3"]}),Je=({items:e,side:o})=>{const{classes:a}=Ye(),n=i.useMemo(()=>Math.floor(o/2),[o]);return t(Ke,{v0:a.root,v1:{height:o,width:o},v2:a.container,v3:e.slice(0,e.length-1).map(({angle:e,value:o},l)=>t("span",{className:a.label,style:{..._e(e+180,n),...e<90&&{marginLeft:10},...e>90&&{marginLeft:-10},...e>15&&e<165&&{marginTop:5}},children:o},l))})},Xe=({width:e,side:o,chunks:a,maxValue:n,minValue:l,value:r})=>{const s=i.useMemo(()=>.5*o,[o]),c=i.useMemo(()=>.63*o,[o]),d=i.useMemo(()=>.58*o,[o]),p=i.useCallback(e=>180/(n-l)*(e.minValue-l)+45,[n,l]),u=i.useMemo(()=>Math.min(r/n*180,180),[n,r]),h=i.useMemo(()=>e>o?c/e*1.5:1,[c,e,o]),g=i.useMemo(()=>[...a].sort(({maxValue:e},{maxValue:t})=>e-t).slice(0,a.length-1).map(e=>({angle:180/n*e.maxValue,value:e.maxValue})),[a,n]),f=i.useMemo(()=>[{angle:0,value:0},...g,{angle:180,value:n}],[g,n]);return t(m,{children:[t(He,{angle:u,scale:h}),[...a].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,a)=>t(Ie,{rotate:p(e),color:e.color,side:o,lineWidth:s},`${e.color}-${a}`)),g.map(({angle:e},o)=>t(Oe,{angle:e-90},`${e}-${o}`)),t(Fe,{side:o}),t(Ae,{side:c}),t(Je,{items:f,side:d})]})},Ze=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",overflow:"clip"},container:{flex:1,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},bottomCenterLabel:{position:"absolute",zIndex:2,bottom:"0",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:"4px","& > *":{fontSize:"20px",lineHeight:"24px"},"& > :first-of-type":{fontWeight:"bold"},"& > :last-of-type":{color:"var(--black-6)"}}}),qe=({className:e,height:o,width:a})=>{const{classes:n}=Ze(),{value:l,items:s}=Re(),c=Math.min(2*o,a),d=i.useMemo(()=>[...s].filter(e=>!e.hidden).sort(({maxValue:e},{maxValue:t})=>t-e).map((e,t,o)=>{const a=o[t+1],n=a?a.maxValue:0;return{...e,minValue:n,value:e.maxValue-n}}),[s]),p=i.useMemo(()=>{const e=d.find(({minValue:e,maxValue:t})=>l>=e&&l<=t);if(e)return e.color;return d.reduce((e,t)=>t.minValue>=e.minValue?t:e).color},[d,l]),u=i.useMemo(()=>d.reduce((e,{minValue:t})=>Math.min(e,t),Number.POSITIVE_INFINITY),[d]),m=i.useMemo(()=>d.reduce((e,{maxValue:t})=>Math.max(e,t),Number.NEGATIVE_INFINITY),[d]);return t("div",{className:r(e,n.root),children:t("div",{className:n.container,children:t(Xe,{chunks:d,value:l,minValue:u,maxValue:m,side:c,width:a,color:p})})})},Qe=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",borderLeft:0,borderRight:0,borderWidth:"1px 0",borderStyle:"solid",borderColor:e.palette.divider},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row"},content:{display:"flex",alignItems:"baseline",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),et=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:t("div",{className:e.v3,children:[e.v4,e.v5]})})}),{name:"Note_1",portals:["v4","v5"]}),tt=({className:e,style:o})=>{const{classes:a}=Qe(),{value:n,roundDigits:l=3,valueUnit:i="Unit"}=Re();return t(et,{v0:r(e,a.root),v1:o,v2:a.container,v3:a.content,v4:t(c,{children:ge(n,l)}),v5:t(c,{children:i})})},ot=s()(e=>({root:{position:"relative",overflow:"clip",height:"100%",width:"100%",background:e.palette.background.paper},container:{position:"absolute",top:"0",left:"0"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},chart:{flex:1,paddingTop:"6px",paddingBottom:"6px"},footer:{minHeight:"32px"},note:{minHeight:"60px"}})),at=({className:e,style:o})=>{const{classes:a}=ot(),n=e=>{let t=e;return t-=32,t-=12,t-=60,t},l=e=>{let t=e;return t-=12,t};return t(u,{className:r(e,a.root),style:o,children:t(h,{className:a.container,children:({height:e=0,width:o=0})=>t("div",{className:a.content,style:{height:e,width:o},children:[t(qe,{className:a.chart,height:n(e),width:l(o)}),t(tt,{className:a.note}),t(De,{className:a.footer})]})})})},nt=i.memo(({className:e,style:o,...a})=>t(Ne,{value:a,children:t(at,{className:e,style:o})})),lt=s()({root:{position:"relative",height:10,flex:1},bar:{position:"absolute !important",top:"42%",left:0,right:10}}),it=e=>{const{classes:o}=lt(),a=["done","inprogress","waiting","archive"],n=t=>{var o;return null==(o=e.data[t])?void 0:o.value},l=a.map(t=>{const o=n(t);var a,l;return`${a=t,(null==(l=e.data[a])?void 0:l.title)||t} - ${o}`}).join(" | "),i=a.map(t=>{const o=(t=>{var o;return null==(o=e.data[t])?void 0:o.color})(t);return{color:o,value:n(t),key:t}}).map(({color:e,value:t,key:o},l)=>{let i=0;if(0!==l)for(let r=l-1;r>=0;r--)i+=n(a[r]);return{value:t>0?t+i:t,key:o,color:e}}).sort(({value:e},{value:t})=>t-e),r=Math.max(...i.map(({value:e})=>e));return t(f,{title:l,arrow:!0,children:t("div",{className:o.root,children:i.map(({color:e,value:a,key:n},l)=>{const i=((e,t=100)=>Math.min(100,Math.round(Math.max(Number(e),0)/t*100)))(a,r);return t(g,{sx:{height:"10px !important",zIndex:`${l+1} !important`,backgroundColor:"transparent !important","& .MuiLinearProgress-bar":{borderTopRightRadius:5,borderBottomRightRadius:5,backgroundColor:`${e} !important`}},variant:"determinate",className:o.bar,value:i},`${l}-${n}`)})})})},rt=s()({root:{display:"flex"},work:{display:"flex",alignItems:"center"},row:{flex:1,paddingLeft:5,paddingRight:5,paddingBottom:15}}),st=({title:e,description:o,avatar:a,done:n,inprogress:l,waiting:i,archive:r})=>{const{classes:s}=rt();return t(y,{className:s.root,children:t(y,{className:s.row,children:[t(y,{className:s.work,children:[t(a,{}),t(v,{primary:e,secondary:o,sx:{flex:"none",marginLeft:"0.5em"}})]}),t(y,{flex:"1",children:t(it,{data:{done:{color:"#7FB537",title:"Take profit",value:n},inprogress:{color:"#4FC0E8",title:"Resolved",value:l},waiting:{color:"#FE9B31",title:"Rejected",value:i},archive:{color:"#FA5F5A",title:"Stop loss",value:r}}})})]})})},ct=s()({root:{position:"relative",width:"100%"},container:{position:"absolute",top:0,height:"100%",width:"100%",overflowY:"auto",overflowX:"hidden"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"}}),dt=({items:e,sx:o})=>{const{classes:a}=ct();return t(u,{className:a.root,sx:o,children:[t(b,{disableRight:!0,color:"#fff",className:a.container,children:t("div",{className:a.content,children:e.map((e,o)=>t(st,{...e},o))})}),t(y,{sx:{position:"absolute",bottom:10,right:10,zIndex:10,pointerEvents:"auto",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(10px)",borderRadius:"12px",border:"1px solid rgba(255, 255, 255, 0.2)",padding:"12px 16px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.1)",opacity:.35,transition:"opacity 0.3s ease","&:hover":{opacity:1}},children:[t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#7FB537",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Take profit"})]}),t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#4FC0E8",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Resolved"})]}),t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FE9B31",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Rejected"})]}),t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FA5F5A",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Stop loss"})]})]})]})},pt=s()({root:{position:"relative"},tooltip:{position:"absolute",color:"gray",margin:0,left:5,top:5}}),ut={layout:{textColor:"#d1d4dc",backgroundColor:"#0000"},rightPriceScale:{scaleMargins:{top:.3,bottom:.25}},crosshair:{vertLine:{width:4,color:"#ebe0e301",style:0},horzLine:{visible:!1,labelVisible:!1}},grid:{vertLines:{color:"#f8b3"},horzLines:{color:"#f8b3"}},handleScroll:{vertTouchDrag:!1}},mt={color:"#90cbfa",lineWidth:2,crosshairMarkerVisible:!1,lastValueVisible:!1,priceLineVisible:!1},ht=({height:e,width:o,items:a})=>{const{classes:n}=pt(),l=i.useRef(void 0),r=i.useRef(void 0);return i.useLayoutEffect(()=>{const{current:t}=l,{current:n}=r,i=x(t,{...ut,height:e,width:o});i.addLineSeries({...mt}).setData(a);const s=({time:e})=>{if(e)try{const{day:t,month:o,year:l}=e,i=a.find(({time:e})=>e.day===t&&e.month===o&&e.year===l);if(i){const e=Math.round(Math.round(100*i.value)/100);n.innerHTML=`${C("Total")}: ${e}, ${C("Resolved")}: ${i.resolved}, ${C("Rejected")}: ${i.rejected}`}else n.innerHTML=""}catch(t){console.log(t),n.innerHTML=""}else n.innerHTML=""};return i.timeScale().fitContent(),i.subscribeCrosshairMove(s),()=>{i.unsubscribeCrosshairMove(s),i.remove()}},[e,o,a]),t("div",{ref:l,className:n.root,children:t("p",{ref:r,className:n.tooltip})})},gt=({items:e})=>t(h,{children:({height:o,width:a})=>t(ht,{height:o,width:a,items:e})}),ft=s()({root:{},container:{position:"relative",margin:0,padding:0,overflow:"clip"},editor:{position:"absolute",top:0,left:0,right:0,bottom:0}}),yt=({items:e,sx:o})=>{const{classes:a}=ft(),n=i.useMemo(()=>[...e].sort(({stamp:e},{stamp:t})=>e-t).map(({count:e,rejected:t,resolved:o,stamp:a})=>{const n=k(a);return{time:{year:n.get("year"),month:n.get("month")+1,day:n.get("date")},rejected:t,resolved:o,value:e}}),[e]);return t(u,{className:a.container,sx:o,children:t("div",{className:a.editor,children:t(gt,{items:n})})})},vt=e=>P({handler:async(t,a)=>{const n=S(t,a);for await(const l of(e=>w(async()=>{const t="live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),a=t.filter(e=>"closed"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"finished"}));return"backtest"===e?a:[...t.filter(e=>"opened"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"pending"})),...a]}))(e))if(n([l]).done)break;return n([]).rows}}),bt=[{field:"color",label:B.nbsp,minWidth:45,width:()=>45,format:({symbol:e})=>t(A,{children:async()=>{var a;try{const n=await o.symbolGlobalService.getSymbolMap();return t(te,{sx:{color:(null==(a=n[e])?void 0:a.color)||"#ccc"}})}catch(n){return t(te,{sx:{color:"#ccc"}})}}})},{field:"symbol",label:"Symbol",minWidth:115,width:e=>Math.max(e-45-90-145-80-90-80,45),format:({symbol:e})=>t(y,{sx:{width:"75px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})},{field:"position",label:"Position",minWidth:90,width:()=>90,format:({position:e})=>{const o="long"===e;return t("span",{style:{color:o?"#1976D2":"#F57C00",padding:"4px 8px",borderRadius:"4px",fontWeight:"bold",fontSize:"11px"},children:o?"🔵 LONG":"🟠 SHORT"})}},{field:"buyPrice",label:"Entry",minWidth:145,width:()=>145,format:({buyPrice:e})=>`${d(e)}$`},{field:"pnlEntries",label:"Invested",minWidth:80,width:()=>80,format:({pnlEntries:e})=>`${d(e)}$`},{field:"profitLossPercentage",label:"PNL %",minWidth:90,width:()=>90,format:({profitLossPercentage:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",e.toFixed(2),"%"]})}},{field:"pnlCost",label:"PNL $",minWidth:80,width:()=>80,format:({pnlCost:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",d(e),"$"]})}}],xt=[{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:N.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:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"date",title:"Date",readonly:!0,compute:e=>e.date?n(e.date).format("DD/MM/YYYY HH:mm"):""},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"buyPrice",title:"Entry",readonly:!0,compute:e=>e.buyPrice?`${d(e.buyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalBuyPrice",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalBuyPrice&&e.originalBuyPrice!==e.buyPrice,compute:e=>e.originalBuyPrice?`${d(e.originalBuyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"takeProfitPrice",title:"Take Profit",readonly:!0,compute:e=>e.takeProfitPrice?`${d(e.takeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalTakeProfitPrice",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalTakeProfitPrice&&e.originalTakeProfitPrice!==e.takeProfitPrice,compute:e=>e.originalTakeProfitPrice?`${d(e.originalTakeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"stopLossPrice",title:"Stop Loss",readonly:!0,compute:e=>e.stopLossPrice?`${d(e.stopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalStopLossPrice",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalStopLossPrice&&e.originalStopLossPrice!==e.stopLossPrice,compute:e=>e.originalStopLossPrice?`${d(e.originalStopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlEntries",title:"Invested",readonly:!0,compute:e=>`${d(e.pnlEntries)}$`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"profitLossPercentage",title:"PNL %",readonly:!0,trailingIcon:({data:e})=>e.profitLossPercentage<0?t(q,{sx:{color:"red"}}):t(Q,{sx:{color:"green"}}),compute:e=>`${e.profitLossPercentage>=0?"+":""}${e.profitLossPercentage.toFixed(2)}%`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlCost",title:"PNL $",readonly:!0,compute:e=>`${e.pnlCost>=0?"+":""}${d(e.pnlCost)}$`},{type:N.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:N.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:N.Component,sx:{mt:2},element:({payload:e})=>t(I,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],Ct=[{label:"Details",icon:()=>t(V,{icon:ee,color:"#4caf50"}),action:"open-action"}],kt=({sx:e,mode:a})=>{const n=vt(a),[l,i]=L(null),{pickData:r,setOpen:s,render:c}=M({title:"Info",AfterTitle:({onClose:e})=>t(D,{direction:"row",gap:2,children:[t(R,{onClick:()=>o.layoutService.pickSignal(l.current.id),variant:"outlined",children:"Show Details"}),t($,{size:"small",onClick:e,children:t(T,{})})]}),payload:()=>({handleClose(){s(!1)}}),fields:xt,handler:()=>l.current,withActionButton:!1});return t(m,{children:[t(u,{sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column",background:"whitesmote",overflow:"clip",...e},children:t(j,{sx:{flex:1,background:"transparent !important"},rowColor:({status:e})=>"pending"===e?"#ffc40085":"transparent",hasMore:n.hasMore,loading:n.loading,onSkip:n.onSkip,data:n.data,columns:bt,rowActions:Ct,onRowClick:e=>{i(e),r(e.id)},onRowAction:(e,t)=>{"open-action"===e&&o.layoutService.pickSignal(t.id)}})}),c()]})},wt=[{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.thirtyOneDaysRevenue)||0,a=(null==e?void 0:e.thirtyOneDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"31 days",footerLabel:"Profit for 31 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.sevenDaysRevenue)||0,a=(null==e?void 0:e.sevenDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"7 days",footerLabel:"Profit for 7 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.yesterdayRevenue)||0,a=(null==e?void 0:e.yesterdayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Yesterday",footerLabel:"Yesterday's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.todayRevenue)||0,a=(null==e?void 0:e.todayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Today",footerLabel:"Today's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({tradePerfomance:e})=>{const o=[{color:"#DD4049",label:"Failed",maxValue:Math.max(e.rejectedCount+1,1),value:()=>e.rejectedCount},{color:"#2EA96F",label:"Successful",maxValue:Math.max(e.rejectedCount+e.resolvedCount+2,2),value:()=>e.resolvedCount},{color:"#F3A43A",label:"Total",hidden:!0,maxValue:Math.max(e.total+3,3),value:()=>e.total}];return t(nt,{style:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o,valueUnit:Le(Math.abs(e.resolvedCount),{one:"Successful signal",many:"Successful signals"}),value:e.resolvedCount})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({dailyTrades:e})=>t(yt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:e})},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({successRate:e})=>{const o=e.map(({symbol:e,displayName:o,rejectedCloseCount:a,rejectedStopLossCount:n,resolvedCloseCount:l,resolvedTakeProfitCount:i})=>({title:o||e,description:e,avatar:()=>t(K,{symbol:e}),done:i,archive:n,waiting:a,inprogress:l})).filter(({done:e,archive:t,waiting:o,inprogress:a})=>{let n=!1;return n=n||!!e,n=n||!!t,n=n||!!o,n=n||!!a,n});return t(dt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:e})=>t(kt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},mode:e.mode})}],Pt={rejectedCount:0,resolvedCount:0,total:0},St=[{action:"download-action",label:"Download",icon:()=>t(V,{icon:H,color:"#4caf50"})},{divider:!0},{action:"live-action",label:"Switch to LIVE",isVisible:e=>"backtest"===e,icon:()=>t(V,{icon:G,color:"#4caf50"})},{action:"backtest-action",label:"Switch to BACKTEST",isVisible:e=>"live"===e,icon:()=>t(V,{icon:_,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh manually",icon:()=>t(V,{icon:X,color:"#4caf50"})}],Lt=[{type:W.Link,action:"back-action",label:t(Z,{sx:{display:"block"}})},{type:W.Link,action:"back-action",label:"Main"},{type:W.Link,action:"back-action",label:"Dashboard"},{type:W.Link,action:"back-action",compute:e=>`KPI ${String(e).toUpperCase()}`}],Mt=new F,Nt=({mode:e="backtest"})=>{const[a,{loading:n,execute:l}]=E(async()=>{const t=await(async e=>{const t=await o.symbolGlobalService.getSymbolList(),a=await oe(e),n=new Set(a.map(e=>e.symbol));return t.forEach(e=>n.delete(e)),t.concat(Array.from(n))})(e),a=await o.symbolGlobalService.getSymbolMap(),n=new Map,l=[],i={...Pt};let r={symbol:"TOTAL",todayRevenue:0,yesterdayRevenue:0,sevenDaysRevenue:0,thirtyOneDaysRevenue:0,todayCount:0,yesterdayCount:0,sevenDaysCount:0,thirtyOneDaysCount:0};await Promise.all(t.map(async t=>{var o;const[s=[],c,d,p]=await Promise.all([ie(t,e),le(t,e),ne(t,e),re(t,e)]);for(const e of s){const t=n.get(e.stamp)||{count:0,resolved:0,rejected:0};n.set(e.stamp,{count:t.count+e.count,resolved:t.resolved+e.resolved,rejected:t.rejected+e.rejected})}l.push({...c,symbol:t,displayName:(null==(o=a[t])?void 0:o.displayName)||t}),i.rejectedCount+=d.rejectedCount,i.resolvedCount+=d.resolvedCount,i.total+=d.total,r.todayRevenue+=p.todayRevenue,r.yesterdayRevenue+=p.yesterdayRevenue,r.sevenDaysRevenue+=p.sevenDaysRevenue,r.thirtyOneDaysRevenue+=p.thirtyOneDaysRevenue,r.todayCount+=p.todayCount,r.yesterdayCount+=p.yesterdayCount,r.sevenDaysCount+=p.sevenDaysCount,r.thirtyOneDaysCount+=p.thirtyOneDaysCount}));return{dailyTrades:Array.from(n).map(([e,{count:t,resolved:o,rejected:a}])=>({stamp:e,count:t,resolved:o,rejected:a})),successRate:l,tradePerfomance:i,revenueCount:r}},{onLoadStart:()=>o.layoutService.setModalLoader(!0),onLoadEnd:()=>o.layoutService.setModalLoader(!1),deps:[e]}),{execute:i}=O(async()=>{const t=await oe(e),a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(a);o.layoutService.downloadFile(n,`signals_${e}_${Date.now()}.json`)},{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});z(()=>Mt.subscribe(l));return t(J,{children:[t(U,{items:Lt,actions:St,payload:e,onAction:async e=>{"download-action"===e&&await i(),"update-now"===e&&(oe.clear(),await Mt.next()),"live-action"===e&&o.routerService.push("/dashboard/live"),"backtest-action"===e&&o.routerService.push("/dashboard/backtest"),"back-action"===e&&o.routerService.push("/")}}),a?n?null:t(Y,{handler:a,payload:()=>({handleUpdate(){Mt.next()},mode:e}),fields:wt}):null]})};export{Nt as DashboardPage,Nt as default};
1
+ import{b as e,f as t,i as o,aw as a,H as n,ax as l,r as i,ay as r,p as s,T as c,J as d,c as p,P as u,F as m,az as h,aA as g,aB as f,B as y,ao as v,aC as b,aD as x,aa as C,aE as k,aF as w,aG as P,aH as S,aI as L,aJ as M,a2 as N,ag as R,I as $,ad as T,A as D,aK as j,E as B,a4 as I,Z as V,V as A,x as E,aL as O,X as z,a8 as F,O as U,R as W,D as H,aM as G,aN as _,W as Y}from"./index-kQlTYlpK.js";import{I as K}from"./IconPhoto-DrGLW-rX.js";import{C as J,R as X}from"./Refresh-DixrXBVq.js";import{K as Z}from"./KeyboardArrowLeft-BpxUzr7-.js";const q=e(t("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 10V8h-2v4H8l4 4 4-4h-3z"}),"ArrowCircleDown"),Q=e(t("path",{d:"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0 2c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm-1-10v4h2v-4h3l-4-4-4 4h3z"}),"ArrowCircleUp"),ee=e(t("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixHigh"),te=e(t("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle"),oe=l(async e=>"live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),{key:([e])=>`${e}`,timeout:45e3}),ae=async(e,t)=>(await oe(t)).filter(t=>"closed"===t.status&&t.symbol===e),ne=async(e,t)=>{const o=await ae(e,t);return{total:o.length,resolvedCount:o.filter(e=>e.pnl.pnlPercentage>0).length,rejectedCount:o.filter(e=>e.pnl.pnlPercentage<=0).length}},le=async(e,t)=>{const o=await ae(e,t),a=e=>Math.abs(e.pnl.priceClose-e.priceTakeProfit)/e.priceTakeProfit<.005,n=e=>Math.abs(e.pnl.priceClose-e.priceStopLoss)/e.priceStopLoss<.005;return{resolvedTakeProfitCount:o.filter(e=>e.pnl.pnlPercentage>0&&a(e)).length,rejectedStopLossCount:o.filter(e=>e.pnl.pnlPercentage<=0&&n(e)).length,resolvedCloseCount:o.filter(e=>e.pnl.pnlPercentage>0&&!a(e)).length,rejectedCloseCount:o.filter(e=>e.pnl.pnlPercentage<=0&&!n(e)).length}},ie=async(e,t)=>{const o=await ae(e,t),l=new Map;for(const i of o){const e=a(n(i.updatedAt)),t=l.get(e)??{resolved:0,rejected:0};i.pnl.pnlPercentage>0?l.set(e,{...t,resolved:t.resolved+1}):l.set(e,{...t,rejected:t.rejected+1})}return Array.from(l.entries()).map(([e,{resolved:t,rejected:o}])=>({stamp:e,count:t+o,resolved:t,rejected:o}))},re=async(e,t)=>{const o=await ae(e,t),a="backtest"===t&&o.length?o.reduce((e,t)=>Math.max(e,t.updatedAt),0):Date.now(),l=n(a).startOf("day").valueOf(),i=l-864e5,r=l-6048e5,s=l-26784e5,c=e=>e.reduce((e,t)=>e+t.pnl.pnlCost,0),d=o.filter(e=>e.updatedAt>=l),p=o.filter(e=>e.updatedAt>=i&&e.updatedAt<l),u=o.filter(e=>e.updatedAt>=r),m=o.filter(e=>e.updatedAt>=s);return{symbol:e,todayRevenue:c(d),yesterdayRevenue:c(p),sevenDaysRevenue:c(u),thirtyOneDaysRevenue:c(m),todayCount:d.length,yesterdayCount:p.length,sevenDaysCount:u.length,thirtyOneDaysCount:m.length}};var se=(e=>(e.Red="#DD4049",e.Orange="#F3A43A",e.Green="#2EA96F",e.Blue="#2979ff",e.Violet="#d500f9",e))(se||{});const ce=i.createContext(null),de=({value:e,children:o})=>t(ce.Provider,{value:e,children:o}),pe=()=>i.useContext(ce);var ue=(e=>(e.Semi="semi",e.Solid="solid",e.Unset="unset",e))(ue||{});const me=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"stretch",whiteSpace:"nowrap",gap:"8px",overflow:"clip",padding:"10px",borderTop:`1px solid ${e.palette.divider}`,"& > *":{flex:1}},solidBackground:{color:"#fff","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}},semiBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}}})),he=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=me(),{footerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...s===ue.Solid&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},ge=(e,t=2)=>{let o=1;for(let a=0;a<t;a++)o*=10;return Math.round(e*o)/o},fe=s()({root:{position:"relative",width:"100%",height:"0px"},container:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}),ye=({caption:e})=>{const{classes:o}=fe();return t("div",{className:o.root,children:t("div",{className:o.container,children:t(c,{variant:"caption",sx:{opacity:.5,fontSize:12,textAlign:"center",padding:"0 8px"},children:e})})})},ve=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},solidBackground:{"& > :first-of-type":{color:"#fff",fontWeight:"bold"},"& > :last-of-type":{color:"#fff"}},unsetBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},semiBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},content:{display:"flex",alignItems:"baseline",flexDirection:"row",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),be=p(e=>t("div",{className:e.v0,style:e.v1,children:[t("div",{className:e.v2,children:[e.v3,e.v4]}),e.v5]}),{name:"Content_1",portals:["v3","v4","v5"]}),xe=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=ve(),{backgroundMode:l=ue.Solid,roundDigits:s=2,value:p,caption:u,valueUnit:m="Unit"}=pe(),h=i.useMemo(()=>({...o,...l===ue.Solid&&{backgroundColor:a}}),[a,l,o]);return t(be,{v0:r(e,n.root),v1:h,v2:r(n.content,{[n.solidBackground]:l===ue.Solid,[n.unsetBackground]:l===ue.Unset,[n.semiBackground]:l===ue.Semi}),v3:t(c,{fontWeight:"bold",children:d(ge(p,s))}),v4:t(c,{children:m}),v5:!!u&&t(ye,{caption:u})})},Ce=s()(e=>({root:{display:"flex",alignItems:"center",whiteSpace:"nowrap",fontWeight:700,fontSize:"18px",paddingLeft:"8px",gap:"8px",overflow:"clip",borderBottom:`1px solid ${e.palette.divider}`},solidBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},semiBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,padding:"10px","& svg":{fill:e.palette.text.primary}}})),ke=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=Ce(),{headerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...(s===ue.Solid||s===ue.Semi)&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},we=s()({root:{overflow:"clip",height:"100%",width:"100%",display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},click:{cursor:"pointer"},header:{minHeight:"36px"},content:{flex:1},footer:{minHeight:"32px"}}),Pe=({className:e,style:o})=>{const{classes:a}=we(),{backgroundColor:n,onClick:l,footerLabel:i}=pe();return t(u,{className:r(e,a.root,{[a.click]:!!l}),onClick:l,style:o,children:[t(ke,{backgroundColor:n}),t(xe,{backgroundColor:n,className:a.content}),!!i&&t(he,{backgroundColor:n,className:a.footer})]})},Se=i.memo(({className:e,style:o,...a})=>t(de,{value:a,children:t(Pe,{className:e,style:o})})),Le=(e,{one:t,many:o,two:a=o})=>`${(()=>{if(0===e||e>=11&&e<20)return o;let n=e%10;return 0===n?o:1===n?t:n<5?a:o})()}`,Me=i.createContext(null),Ne=({value:e,children:o})=>t(Me.Provider,{value:e,children:o}),Re=()=>i.useContext(Me),$e=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",paddingLeft:"20px",paddingRight:"20px",overflow:"clip"},container:{flex:1,display:"flex",alignItems:"stretch",justifyContent:"center",gap:"40px"},item:{gap:"4px",display:"flex",alignItems:"center",justifyContent:"center","& > span":{fontWeight:500,fontSize:"12px",color:"var(--black-6)",whiteSpace:"nowrap"}},circle:{borderRadius:"50%",height:"8px",width:"8px"}}),Te=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Footer_1",portals:["v3"]}),De=({className:e,style:o})=>{const{classes:a}=$e(),{items:n}=Re();return t(Te,{v0:r(e,a.root),v1:o,v2:a.container,v3:[...n].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,o)=>t("div",{className:a.item,children:[t("div",{className:a.circle,style:{background:e.color}}),t("span",{children:[e.label," ",e.value?e.value():e.maxValue]})]},o))})},je=s()(()=>({circle:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%","& > div":{borderRadius:"50%"}}})),Be=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{style:e.v2})}),{name:"Circle_1"}),Ie=({className:e,style:o,lineWidth:a,side:n,color:l,rotate:i})=>{const{classes:s}=je();return t(Be,{v0:r(e,s.circle),v1:{...o},v2:{borderTop:`${a}px solid ${l}`,borderLeft:`${a}px solid ${l}`,borderRight:`${a}px solid transparent`,borderBottom:`${a}px solid transparent`,transform:`rotate(${i}deg)`,height:n,width:n}})},Ve=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",background:e.palette.background.paper}})),Ae=({side:e})=>{const{classes:o}=Ve();return t("div",{className:o.dot,style:{height:e,width:e}})},Ee=s()(e=>({line:{position:"absolute",background:e.palette.background.paper,height:"100%",width:"1px",left:"50%",transformOrigin:"center bottom"}})),Oe=({angle:e})=>{const{classes:o}=Ee();return t("div",{className:o.line,style:{transform:`rotate(${e}deg)`}})},ze=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",outline:`100vmax solid ${e.palette.background.paper}`}})),Fe=({side:e})=>{const{classes:o}=ze();return t("div",{className:o.dot,style:{height:e,width:e}})},Ue=s()(e=>({pointer:{position:"absolute",left:"21%",width:"29%",bottom:"0%",zIndex:1,transformOrigin:"right center",fill:e.palette.text.primary}})),We=p(e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 87 8",className:e.v0,style:e.v1,...e.v2,children:[t("rect",{x:"0.5",y:"2.5",width:"79",height:"3"}),t("circle",{cx:"82.5",cy:"4",r:"4"})]}),{name:"Pointer_1",svg:!0}),He=({className:e,style:o,angle:a,scale:n=1,...l})=>{const{classes:i}=Ue();return t(We,{v0:r(e,i.pointer),v1:{...o,transform:`rotate(${a}deg) scale(${n}) translateX(5px)`},v2:l})},Ge=e=>e*Math.PI/180,_e=(e,t)=>({left:t*Math.cos(Ge(e))+t,top:t*Math.sin(Ge(e))+t}),Ye=s()(e=>({root:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",display:"flex",alignItems:"stretch",justifyContent:"stretch"},container:{flex:1,position:"relative"},label:{position:"absolute",transform:"translate(-50%, -50%)",color:e.palette.text.primary,zIndex:2}})),Ke=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Labels_1",portals:["v3"]}),Je=({items:e,side:o})=>{const{classes:a}=Ye(),n=i.useMemo(()=>Math.floor(o/2),[o]);return t(Ke,{v0:a.root,v1:{height:o,width:o},v2:a.container,v3:e.slice(0,e.length-1).map(({angle:e,value:o},l)=>t("span",{className:a.label,style:{..._e(e+180,n),...e<90&&{marginLeft:10},...e>90&&{marginLeft:-10},...e>15&&e<165&&{marginTop:5}},children:o},l))})},Xe=({width:e,side:o,chunks:a,maxValue:n,minValue:l,value:r})=>{const s=i.useMemo(()=>.5*o,[o]),c=i.useMemo(()=>.63*o,[o]),d=i.useMemo(()=>.58*o,[o]),p=i.useCallback(e=>180/(n-l)*(e.minValue-l)+45,[n,l]),u=i.useMemo(()=>Math.min(r/n*180,180),[n,r]),h=i.useMemo(()=>e>o?c/e*1.5:1,[c,e,o]),g=i.useMemo(()=>[...a].sort(({maxValue:e},{maxValue:t})=>e-t).slice(0,a.length-1).map(e=>({angle:180/n*e.maxValue,value:e.maxValue})),[a,n]),f=i.useMemo(()=>[{angle:0,value:0},...g,{angle:180,value:n}],[g,n]);return t(m,{children:[t(He,{angle:u,scale:h}),[...a].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,a)=>t(Ie,{rotate:p(e),color:e.color,side:o,lineWidth:s},`${e.color}-${a}`)),g.map(({angle:e},o)=>t(Oe,{angle:e-90},`${e}-${o}`)),t(Fe,{side:o}),t(Ae,{side:c}),t(Je,{items:f,side:d})]})},Ze=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",overflow:"clip"},container:{flex:1,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},bottomCenterLabel:{position:"absolute",zIndex:2,bottom:"0",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:"4px","& > *":{fontSize:"20px",lineHeight:"24px"},"& > :first-of-type":{fontWeight:"bold"},"& > :last-of-type":{color:"var(--black-6)"}}}),qe=({className:e,height:o,width:a})=>{const{classes:n}=Ze(),{value:l,items:s}=Re(),c=Math.min(2*o,a),d=i.useMemo(()=>[...s].filter(e=>!e.hidden).sort(({maxValue:e},{maxValue:t})=>t-e).map((e,t,o)=>{const a=o[t+1],n=a?a.maxValue:0;return{...e,minValue:n,value:e.maxValue-n}}),[s]),p=i.useMemo(()=>{const e=d.find(({minValue:e,maxValue:t})=>l>=e&&l<=t);if(e)return e.color;return d.reduce((e,t)=>t.minValue>=e.minValue?t:e).color},[d,l]),u=i.useMemo(()=>d.reduce((e,{minValue:t})=>Math.min(e,t),Number.POSITIVE_INFINITY),[d]),m=i.useMemo(()=>d.reduce((e,{maxValue:t})=>Math.max(e,t),Number.NEGATIVE_INFINITY),[d]);return t("div",{className:r(e,n.root),children:t("div",{className:n.container,children:t(Xe,{chunks:d,value:l,minValue:u,maxValue:m,side:c,width:a,color:p})})})},Qe=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",borderLeft:0,borderRight:0,borderWidth:"1px 0",borderStyle:"solid",borderColor:e.palette.divider},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row"},content:{display:"flex",alignItems:"baseline",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),et=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:t("div",{className:e.v3,children:[e.v4,e.v5]})})}),{name:"Note_1",portals:["v4","v5"]}),tt=({className:e,style:o})=>{const{classes:a}=Qe(),{value:n,roundDigits:l=3,valueUnit:i="Unit"}=Re();return t(et,{v0:r(e,a.root),v1:o,v2:a.container,v3:a.content,v4:t(c,{children:ge(n,l)}),v5:t(c,{children:i})})},ot=s()(e=>({root:{position:"relative",overflow:"clip",height:"100%",width:"100%",background:e.palette.background.paper},container:{position:"absolute",top:"0",left:"0"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},chart:{flex:1,paddingTop:"6px",paddingBottom:"6px"},footer:{minHeight:"32px"},note:{minHeight:"60px"}})),at=({className:e,style:o})=>{const{classes:a}=ot(),n=e=>{let t=e;return t-=32,t-=12,t-=60,t},l=e=>{let t=e;return t-=12,t};return t(u,{className:r(e,a.root),style:o,children:t(h,{className:a.container,children:({height:e=0,width:o=0})=>t("div",{className:a.content,style:{height:e,width:o},children:[t(qe,{className:a.chart,height:n(e),width:l(o)}),t(tt,{className:a.note}),t(De,{className:a.footer})]})})})},nt=i.memo(({className:e,style:o,...a})=>t(Ne,{value:a,children:t(at,{className:e,style:o})})),lt=s()({root:{position:"relative",height:10,flex:1},bar:{position:"absolute !important",top:"42%",left:0,right:10}}),it=e=>{const{classes:o}=lt(),a=["done","inprogress","waiting","archive"],n=t=>{var o;return null==(o=e.data[t])?void 0:o.value},l=a.map(t=>{const o=n(t);var a,l;return`${a=t,(null==(l=e.data[a])?void 0:l.title)||t} - ${o}`}).join(" | "),i=a.map(t=>{const o=(t=>{var o;return null==(o=e.data[t])?void 0:o.color})(t);return{color:o,value:n(t),key:t}}).map(({color:e,value:t,key:o},l)=>{let i=0;if(0!==l)for(let r=l-1;r>=0;r--)i+=n(a[r]);return{value:t>0?t+i:t,key:o,color:e}}).sort(({value:e},{value:t})=>t-e),r=Math.max(...i.map(({value:e})=>e));return t(f,{title:l,arrow:!0,children:t("div",{className:o.root,children:i.map(({color:e,value:a,key:n},l)=>{const i=((e,t=100)=>Math.min(100,Math.round(Math.max(Number(e),0)/t*100)))(a,r);return t(g,{sx:{height:"10px !important",zIndex:`${l+1} !important`,backgroundColor:"transparent !important","& .MuiLinearProgress-bar":{borderTopRightRadius:5,borderBottomRightRadius:5,backgroundColor:`${e} !important`}},variant:"determinate",className:o.bar,value:i},`${l}-${n}`)})})})},rt=s()({root:{display:"flex"},work:{display:"flex",alignItems:"center"},row:{flex:1,paddingLeft:5,paddingRight:5,paddingBottom:15}}),st=({title:e,description:o,avatar:a,done:n,inprogress:l,waiting:i,archive:r})=>{const{classes:s}=rt();return t(y,{className:s.root,children:t(y,{className:s.row,children:[t(y,{className:s.work,children:[t(a,{}),t(v,{primary:e,secondary:o,sx:{flex:"none",marginLeft:"0.5em"}})]}),t(y,{flex:"1",children:t(it,{data:{done:{color:"#7FB537",title:"Take profit",value:n},inprogress:{color:"#4FC0E8",title:"Resolved",value:l},waiting:{color:"#FE9B31",title:"Rejected",value:i},archive:{color:"#FA5F5A",title:"Stop loss",value:r}}})})]})})},ct=s()({root:{position:"relative",width:"100%"},container:{position:"absolute",top:0,height:"100%",width:"100%",overflowY:"auto",overflowX:"hidden"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"}}),dt=({items:e,sx:o})=>{const{classes:a}=ct();return t(u,{className:a.root,sx:o,children:[t(b,{disableRight:!0,color:"#fff",className:a.container,children:t("div",{className:a.content,children:e.map((e,o)=>t(st,{...e},o))})}),t(y,{sx:{position:"absolute",bottom:10,right:10,zIndex:10,pointerEvents:"auto",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(10px)",borderRadius:"12px",border:"1px solid rgba(255, 255, 255, 0.2)",padding:"12px 16px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.1)",opacity:.35,transition:"opacity 0.3s ease","&:hover":{opacity:1}},children:[t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#7FB537",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Take profit"})]}),t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#4FC0E8",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Resolved"})]}),t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FE9B31",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Rejected"})]}),t(y,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FA5F5A",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Stop loss"})]})]})]})},pt=s()({root:{position:"relative"},tooltip:{position:"absolute",color:"gray",margin:0,left:5,top:5}}),ut={layout:{textColor:"#d1d4dc",backgroundColor:"#0000"},rightPriceScale:{scaleMargins:{top:.3,bottom:.25}},crosshair:{vertLine:{width:4,color:"#ebe0e301",style:0},horzLine:{visible:!1,labelVisible:!1}},grid:{vertLines:{color:"#f8b3"},horzLines:{color:"#f8b3"}},handleScroll:{vertTouchDrag:!1}},mt={color:"#90cbfa",lineWidth:2,crosshairMarkerVisible:!1,lastValueVisible:!1,priceLineVisible:!1},ht=({height:e,width:o,items:a})=>{const{classes:n}=pt(),l=i.useRef(void 0),r=i.useRef(void 0);return i.useLayoutEffect(()=>{const{current:t}=l,{current:n}=r,i=x(t,{...ut,height:e,width:o});i.addLineSeries({...mt}).setData(a);const s=({time:e})=>{if(e)try{const{day:t,month:o,year:l}=e,i=a.find(({time:e})=>e.day===t&&e.month===o&&e.year===l);if(i){const e=Math.round(Math.round(100*i.value)/100);n.innerHTML=`${C("Total")}: ${e}, ${C("Resolved")}: ${i.resolved}, ${C("Rejected")}: ${i.rejected}`}else n.innerHTML=""}catch(t){console.log(t),n.innerHTML=""}else n.innerHTML=""};return i.timeScale().fitContent(),i.subscribeCrosshairMove(s),()=>{i.unsubscribeCrosshairMove(s),i.remove()}},[e,o,a]),t("div",{ref:l,className:n.root,children:t("p",{ref:r,className:n.tooltip})})},gt=({items:e})=>t(h,{children:({height:o,width:a})=>t(ht,{height:o,width:a,items:e})}),ft=s()({root:{},container:{position:"relative",margin:0,padding:0,overflow:"clip"},editor:{position:"absolute",top:0,left:0,right:0,bottom:0}}),yt=({items:e,sx:o})=>{const{classes:a}=ft(),n=i.useMemo(()=>[...e].sort(({stamp:e},{stamp:t})=>e-t).map(({count:e,rejected:t,resolved:o,stamp:a})=>{const n=k(a);return{time:{year:n.get("year"),month:n.get("month")+1,day:n.get("date")},rejected:t,resolved:o,value:e}}),[e]);return t(u,{className:a.container,sx:o,children:t("div",{className:a.editor,children:t(gt,{items:n})})})},vt=e=>P({handler:async(t,a)=>{const n=S(t,a);for await(const l of(e=>w(async()=>{const t="live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),a=t.filter(e=>"closed"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"finished"}));return"backtest"===e?a:[...t.filter(e=>"opened"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"pending"})),...a]}))(e))if(n([l]).done)break;return n([]).rows}}),bt=[{field:"color",label:B.nbsp,minWidth:45,width:()=>45,format:({symbol:e})=>t(A,{children:async()=>{var a;try{const n=await o.symbolGlobalService.getSymbolMap();return t(te,{sx:{color:(null==(a=n[e])?void 0:a.color)||"#ccc"}})}catch(n){return t(te,{sx:{color:"#ccc"}})}}})},{field:"symbol",label:"Symbol",minWidth:115,width:e=>Math.max(e-45-90-145-80-90-80,45),format:({symbol:e})=>t(y,{sx:{width:"75px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})},{field:"position",label:"Position",minWidth:90,width:()=>90,format:({position:e})=>{const o="long"===e;return t("span",{style:{color:o?"#1976D2":"#F57C00",padding:"4px 8px",borderRadius:"4px",fontWeight:"bold",fontSize:"11px"},children:o?"🔵 LONG":"🟠 SHORT"})}},{field:"buyPrice",label:"Entry",minWidth:145,width:()=>145,format:({buyPrice:e})=>`${d(e)}$`},{field:"pnlEntries",label:"Invested",minWidth:80,width:()=>80,format:({pnlEntries:e})=>`${d(e)}$`},{field:"profitLossPercentage",label:"PNL %",minWidth:90,width:()=>90,format:({profitLossPercentage:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",e.toFixed(2),"%"]})}},{field:"pnlCost",label:"PNL $",minWidth:80,width:()=>80,format:({pnlCost:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",d(e),"$"]})}}],xt=[{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:N.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:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"date",title:"Date",readonly:!0,compute:e=>e.date?n(e.date).format("DD/MM/YYYY HH:mm"):""},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"buyPrice",title:"Entry",readonly:!0,compute:e=>e.buyPrice?`${d(e.buyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalBuyPrice",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalBuyPrice&&e.originalBuyPrice!==e.buyPrice,compute:e=>e.originalBuyPrice?`${d(e.originalBuyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"takeProfitPrice",title:"Take Profit",readonly:!0,compute:e=>e.takeProfitPrice?`${d(e.takeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalTakeProfitPrice",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalTakeProfitPrice&&e.originalTakeProfitPrice!==e.takeProfitPrice,compute:e=>e.originalTakeProfitPrice?`${d(e.originalTakeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"stopLossPrice",title:"Stop Loss",readonly:!0,compute:e=>e.stopLossPrice?`${d(e.stopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalStopLossPrice",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalStopLossPrice&&e.originalStopLossPrice!==e.stopLossPrice,compute:e=>e.originalStopLossPrice?`${d(e.originalStopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlEntries",title:"Invested",readonly:!0,compute:e=>`${d(e.pnlEntries)}$`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"profitLossPercentage",title:"PNL %",readonly:!0,trailingIcon:({data:e})=>e.profitLossPercentage<0?t(q,{sx:{color:"red"}}):t(Q,{sx:{color:"green"}}),compute:e=>`${e.profitLossPercentage>=0?"+":""}${e.profitLossPercentage.toFixed(2)}%`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlCost",title:"PNL $",readonly:!0,compute:e=>`${e.pnlCost>=0?"+":""}${d(e.pnlCost)}$`},{type:N.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:N.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:N.Component,sx:{mt:2},element:({payload:e})=>t(I,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],Ct=[{label:"Details",icon:()=>t(V,{icon:ee,color:"#4caf50"}),action:"open-action"}],kt=({sx:e,mode:a})=>{const n=vt(a),[l,i]=L(null),{pickData:r,setOpen:s,render:c}=M({title:"Info",AfterTitle:({onClose:e})=>t(D,{direction:"row",gap:2,children:[t(R,{onClick:()=>o.layoutService.pickSignal(l.current.id),variant:"outlined",children:"Show Details"}),t($,{size:"small",onClick:e,children:t(T,{})})]}),payload:()=>({handleClose(){s(!1)}}),fields:xt,handler:()=>l.current,withActionButton:!1});return t(m,{children:[t(u,{sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column",background:"whitesmote",overflow:"clip",...e},children:t(j,{sx:{flex:1,background:"transparent !important"},rowColor:({status:e})=>"pending"===e?"#ffc40085":"transparent",hasMore:n.hasMore,loading:n.loading,onSkip:n.onSkip,data:n.data,columns:bt,rowActions:Ct,onRowClick:e=>{i(e),r(e.id)},onRowAction:(e,t)=>{"open-action"===e&&o.layoutService.pickSignal(t.id)}})}),c()]})},wt=[{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.thirtyOneDaysRevenue)||0,a=(null==e?void 0:e.thirtyOneDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"31 days",footerLabel:"Profit for 31 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.sevenDaysRevenue)||0,a=(null==e?void 0:e.sevenDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"7 days",footerLabel:"Profit for 7 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.yesterdayRevenue)||0,a=(null==e?void 0:e.yesterdayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Yesterday",footerLabel:"Yesterday's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.todayRevenue)||0,a=(null==e?void 0:e.todayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Today",footerLabel:"Today's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({tradePerfomance:e})=>{const o=[{color:"#DD4049",label:"Failed",maxValue:Math.max(e.rejectedCount+1,1),value:()=>e.rejectedCount},{color:"#2EA96F",label:"Successful",maxValue:Math.max(e.rejectedCount+e.resolvedCount+2,2),value:()=>e.resolvedCount},{color:"#F3A43A",label:"Total",hidden:!0,maxValue:Math.max(e.total+3,3),value:()=>e.total}];return t(nt,{style:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o,valueUnit:Le(Math.abs(e.resolvedCount),{one:"Successful signal",many:"Successful signals"}),value:e.resolvedCount})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({dailyTrades:e})=>t(yt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:e})},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({successRate:e})=>{const o=e.map(({symbol:e,displayName:o,rejectedCloseCount:a,rejectedStopLossCount:n,resolvedCloseCount:l,resolvedTakeProfitCount:i})=>({title:o||e,description:e,avatar:()=>t(K,{symbol:e}),done:i,archive:n,waiting:a,inprogress:l})).filter(({done:e,archive:t,waiting:o,inprogress:a})=>{let n=!1;return n=n||!!e,n=n||!!t,n=n||!!o,n=n||!!a,n});return t(dt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:e})=>t(kt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},mode:e.mode})}],Pt={rejectedCount:0,resolvedCount:0,total:0},St=[{action:"download-action",label:"Download",icon:()=>t(V,{icon:H,color:"#4caf50"})},{divider:!0},{action:"live-action",label:"Switch to LIVE",isVisible:e=>"backtest"===e,icon:()=>t(V,{icon:G,color:"#4caf50"})},{action:"backtest-action",label:"Switch to BACKTEST",isVisible:e=>"live"===e,icon:()=>t(V,{icon:_,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh manually",icon:()=>t(V,{icon:X,color:"#4caf50"})}],Lt=[{type:W.Link,action:"back-action",label:t(Z,{sx:{display:"block"}})},{type:W.Link,action:"back-action",label:"Main"},{type:W.Link,action:"back-action",label:"Dashboard"},{type:W.Link,action:"back-action",compute:e=>`KPI ${String(e).toUpperCase()}`}],Mt=new F,Nt=({mode:e="backtest"})=>{const[a,{loading:n,execute:l}]=E(async()=>{const t=await(async e=>{const t=await o.symbolGlobalService.getSymbolList(),a=await oe(e),n=new Set(a.map(e=>e.symbol));return t.forEach(e=>n.delete(e)),t.concat(Array.from(n))})(e),a=await o.symbolGlobalService.getSymbolMap(),n=new Map,l=[],i={...Pt};let r={symbol:"TOTAL",todayRevenue:0,yesterdayRevenue:0,sevenDaysRevenue:0,thirtyOneDaysRevenue:0,todayCount:0,yesterdayCount:0,sevenDaysCount:0,thirtyOneDaysCount:0};await Promise.all(t.map(async t=>{var o;const[s=[],c,d,p]=await Promise.all([ie(t,e),le(t,e),ne(t,e),re(t,e)]);for(const e of s){const t=n.get(e.stamp)||{count:0,resolved:0,rejected:0};n.set(e.stamp,{count:t.count+e.count,resolved:t.resolved+e.resolved,rejected:t.rejected+e.rejected})}l.push({...c,symbol:t,displayName:(null==(o=a[t])?void 0:o.displayName)||t}),i.rejectedCount+=d.rejectedCount,i.resolvedCount+=d.resolvedCount,i.total+=d.total,r.todayRevenue+=p.todayRevenue,r.yesterdayRevenue+=p.yesterdayRevenue,r.sevenDaysRevenue+=p.sevenDaysRevenue,r.thirtyOneDaysRevenue+=p.thirtyOneDaysRevenue,r.todayCount+=p.todayCount,r.yesterdayCount+=p.yesterdayCount,r.sevenDaysCount+=p.sevenDaysCount,r.thirtyOneDaysCount+=p.thirtyOneDaysCount}));return{dailyTrades:Array.from(n).map(([e,{count:t,resolved:o,rejected:a}])=>({stamp:e,count:t,resolved:o,rejected:a})),successRate:l,tradePerfomance:i,revenueCount:r}},{onLoadStart:()=>o.layoutService.setModalLoader(!0),onLoadEnd:()=>o.layoutService.setModalLoader(!1),deps:[e]}),{execute:i}=O(async()=>{const t=await oe(e),a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(a);o.layoutService.downloadFile(n,`signals_${e}_${Date.now()}.json`)},{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});z(()=>Mt.subscribe(l));return t(J,{children:[t(U,{items:Lt,actions:St,payload:e,onAction:async e=>{"download-action"===e&&await i(),"update-now"===e&&(oe.clear(),await Mt.next()),"live-action"===e&&o.routerService.push("/dashboard/live"),"backtest-action"===e&&o.routerService.push("/dashboard/backtest"),"back-action"===e&&o.routerService.push("/")}}),a?n?null:t(Y,{handler:a,payload:()=>({handleUpdate(){Mt.next()},mode:e}),fields:wt}):null]})};export{Nt as DashboardPage,Nt as default};