@backtest-kit/ui 15.3.0 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/modules/frontend/build/assets/{Article-CV6sYzXB.js → Article-DL41GA0a.js} +1 -1
- package/build/modules/frontend/build/assets/{Background-Djt8-6Ze.js → Background-DhTBM0kG.js} +1 -1
- package/build/modules/frontend/build/assets/{IconPhoto-CtWTATuX.js → IconPhoto-CGT-L09K.js} +1 -1
- package/build/modules/frontend/build/assets/{KeyboardArrowLeft-C3lIqTl8.js → KeyboardArrowLeft-CF6hGzGl.js} +1 -1
- package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-B1KE8AuD.js → PictureAsPdfOutlined-C2rlUSVJ.js} +1 -1
- package/build/modules/frontend/build/assets/{Refresh-KIrQPPBf.js → Refresh-BEzkJ_ge.js} +1 -1
- package/build/modules/frontend/build/assets/emitters-Cp5Wn6Es.js +1 -0
- package/build/modules/frontend/build/assets/{hasRouteMatch-B6-B9b9t.js → hasRouteMatch-Bc6IBTG4.js} +1 -1
- package/build/modules/frontend/build/assets/{html2canvas-CdSt4VzX.js → html2canvas-BrRQKwKk.js} +1 -1
- package/build/modules/frontend/build/assets/{index-Dg5tMbmL.js → index-BQ4Egk78.js} +1 -1
- package/build/modules/frontend/build/assets/{index-BmoE1JTl.js → index-BUhmLJSw.js} +1 -1
- package/build/modules/frontend/build/assets/{index-C5m6_YJk.js → index-BZjEYFfO.js} +1 -1
- package/build/modules/frontend/build/assets/{index-1K1HGT_8.js → index-C-FMDM09.js} +1 -1
- package/build/modules/frontend/build/assets/{index-WrZQf7cw.js → index-CJlJOSPg.js} +516 -516
- package/build/modules/frontend/build/assets/{index-DkFd37tu.js → index-Cfpamomx.js} +1 -1
- package/build/modules/frontend/build/assets/{index-ZG9R-qtJ.js → index-ChUhZnIE.js} +1 -1
- package/build/modules/frontend/build/assets/{index-BFzLQzbk.js → index-ClGONTx7.js} +1 -1
- package/build/modules/frontend/build/assets/{index-OFztncO3.js → index-D5RN2bOA.js} +1 -1
- package/build/modules/frontend/build/assets/{index-CHkGhaAk.js → index-DvkcUAiy.js} +1 -1
- package/build/modules/frontend/build/assets/{index-8b7X5vYC.js → index-Loobwod7.js} +1 -1
- package/build/modules/frontend/build/assets/index-NOH2rGyk.js +1 -0
- package/build/modules/frontend/build/assets/{index-C3X0Cyxd.js → index-ffa7_jT3.js} +1 -1
- package/build/modules/frontend/build/assets/{index.es-DenpndJP.js → index.es-Drs6xcLZ.js} +1 -1
- package/build/modules/frontend/build/index.html +1 -1
- package/package.json +3 -3
- package/build/modules/frontend/build/assets/emitters-qnXuWOnN.js +0 -1
- package/build/modules/frontend/build/assets/index-0JctlSLr.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,f as a,a9 as o,W as t,V as n,D as i,$ as r,t as s,ak as l,A as c,i as d,al as p,G as h,am as m,X as u,an as b,ao as g,ap as y,B as x,T as v,aq as f,m as k,n as S,ar as w,a7 as L,as as P,ah as R,Q as F,I as $,at as z,w as N,au as D,av as T}from"./index-
|
|
1
|
+
import{d as e,f as a,a9 as o,W as t,V as n,D as i,$ as r,t as s,ak as l,A as c,i as d,al as p,G as h,am as m,X as u,an as b,ao as g,ap as y,B as x,T as v,aq as f,m as k,n as S,ar as w,a7 as L,as as P,ah as R,Q as F,I as $,at as z,w as N,au as D,av as T}from"./index-CJlJOSPg.js";import{R as W,C}from"./Refresh-BEzkJ_ge.js";import{K as O}from"./KeyboardArrowLeft-CF6hGzGl.js";import{I as j}from"./IconPhoto-CGT-L09K.js";import{B}from"./Background-DhTBM0kG.js";const A=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),V=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),E=new o,H=[{type:t.Link,action:"back-action",label:a(O,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:s("Main")},{type:t.Link,action:"back-action",label:s("Overview")},{type:t.Button,action:"update-now",label:s("Refresh"),icon:W}],I=[{action:"download-action",label:s("Download"),icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:s("Dashboard"),icon:()=>a(r,{icon:A,color:"#4caf50"})},{action:"logs-action",label:s("Logs"),icon:()=>a(r,{icon:V,color:"#4caf50"})},{divider:!0},{action:"update-now",label:s("Refresh"),icon:()=>a(r,{icon:W,color:"#4caf50"})}],M=()=>a(n,{items:H,actions:I,onAction:E.next});const G=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=l({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:D}]=c(async()=>{if("live"===e){return(await d.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await d.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),T=p(i),W=p(e);h(()=>E.subscribe(e=>{if("update-now"===e&&D(),"download-action"===e){const e=new Blob([JSON.stringify(T.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);d.layoutService.downloadFile(a,`signals_${W.current}_${Date.now()}.json`)}"dashboard-action"===e&&d.routerService.push(`/dashboard/${W.current}`),"logs-action"===e&&d.routerService.push("/logs"),"back-action"===e&&d.routerService.push("/main")}));const C=m.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),O=e=>{const o=C[e]||[];return o.length?a(N,{children:o.map((t,n)=>{return a(P,{sx:{background:e=>n%2==1?R(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>d.layoutService.pickSignal(t.id),children:[a(g,{primary:a(x,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:R("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",o.length-n]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===t.position?"#1976D2":"#F57C00",color:"white"},children:"long"===t.position?"LONG":"SHORT"}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("Entry"),":"]}),F(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceOpen),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("TP"),":"]}),F(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceTakeProfit),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("SL"),":"]}),F(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(x,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[F(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(x,{component:"span",sx:{color:"text.secondary",mr:.5},children:[s("Invested"),":"]}),F(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:t.pnl.pnlPercentage>=0?R("#4caf50",.15):R("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:[s("PNL"),": ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",F(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:R("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:R("#9c27b0",.15),color:"#6a1b9a"},children:[s("Partial"),"×",t.totalPartials]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?R("#4caf50",.2):"scheduled"===t.status?R("#ff9800",.2):"closed"===t.status?R("#9e9e9e",.2):R("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(v,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(i=t.createdAt,new Date(i).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a($,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(b,{children:a(g,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:s("No signals"),secondary:s("Signals will be displayed here after they appear")})})};return r?null:a(w,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(u,{deps:[C],children:async()=>{const o=Object.keys(C),t=await d.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",l=(null==(n=C[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(y,{sx:{background:(c=r,L(c,"#000000")>L(c,"#FFFFFF")?k(r,.1):S(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(x,{sx:{position:"relative",paddingRight:"8px"},children:a(j,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(x,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:f(l,{one:s("Signal"),two:s("Signals"),many:s("Signals")})})]}),a(x,{sx:{marginTop:"16px",marginBottom:"16px"},children:O(e)})]})},`section-${e}`);var c}):a(b,{children:a(g,{primary:s("No signals yet"),secondary:s("live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here")})})}})})},K=T(),U=(e,a)=>e.some(e=>e.includes(a)),X=[{id:"backtest",element:G,isActive:e=>U(["/backtest"],e)},{id:"live",element:G,isActive:e=>U(["/live"],e)}],_=[{id:"backtest",label:s("Backtest")},{id:"live",label:s("Live")}],q=()=>{h(()=>K.replace("/backtest"));return a(C,{children:[a(D,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:M,onLoadStart:()=>d.layoutService.setAppbarLoader(!0),onLoadEnd:()=>d.layoutService.setAppbarLoader(!1),routes:X,tabs:_,history:K,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(B,{})]})};export{q as OverviewPage,q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,b as t,r as o,u as a,_ as i,e as r,f as n,h as l,k as s,s as c,l as p,d,z as m,A as y,i as u,V as g,W as h,q as b,a3 as f,t as v,$ as x,T as C,b3 as w,Y as S,B as N,w as P,a4 as k,K as A,J as L,a6 as $,m as M,n as T,a5 as B,a7 as R,ai as V,b4 as F,b5 as z,y as I,G as E,a9 as O,b6 as D,D as j,b7 as H,b8 as W,ag as G,X as q,U,a2 as Y,b9 as _,ad as Q,ba as J,bb as K,bc as X,Q as Z,bd as ee,aZ as te,ah as oe,be as ae,aQ as ie,aO as re,b0 as ne,bf as le,bg as se,bh as ce,bi as pe,I as de,av as me,al as ye,bj as ue,aj as ge}from"./index-WrZQf7cw.js";import{h as he}from"./hasRouteMatch-B6-B9b9t.js";import{I as be}from"./IconPhoto-CtWTATuX.js";import{C as fe,R as ve}from"./Refresh-KIrQPPBf.js";import{K as xe}from"./KeyboardArrowLeft-C3lIqTl8.js";import{B as Ce}from"./Background-Djt8-6Ze.js";import{r as we}from"./emitters-qnXuWOnN.js";function Se(t){return e("MuiCard",t)}t("MuiCard",["root"]);const Ne=["className","raised"],Pe=c(p,{name:"MuiCard",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({overflow:"hidden"})),ke=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCard"}),{className:c,raised:p=!1}=o,d=i(o,Ne),m=r({},o,{raised:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},Se,t)})(m);return n(Pe,r({className:l(y.root,c),elevation:p?8:void 0,ref:t,ownerState:m},d))});function Ae(t){return e("MuiCardContent",t)}t("MuiCardContent",["root"]);const Le=["className","component"],$e=c("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}})),Me=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCardContent"}),{className:c,component:p="div"}=o,d=i(o,Le),m=r({},o,{component:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},Ae,t)})(m);return n($e,r({as:p,className:l(y.root,c),ownerState:m,ref:t},d))}),Te=d(n("path",{d:"M18.21 9.21C15.93 10.78 13.45 13.3 13 17h2v2H9v-2h2c-.5-4.5-4.37-8-9-8V7c4.39 0 8.22 2.55 10 6.3 1.13-2.43 2.99-4.25 4.78-5.52L14 5h7v7l-2.79-2.79z"}),"AirlineStops"),Be=d(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckCircle"),Re=d(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}),"CloseOutlined"),Ve=d(n("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5l-8-3zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25v4.7z"}),"ShieldOutlined"),Fe=d(n("path",{d:"m16 6 2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6h-6z"}),"TrendingUpOutlined"),ze=d(n("path",{d:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-10 7H8v3H6v-3H3v-2h3V8h2v3h3v2zm4.5 2c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4-3c-.83 0-1.5-.67-1.5-1.5S18.67 9 19.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"VideogameAsset"),Ie="backtest-kit__groupHeader",Ee="backtest-kit__groupRoot",Oe="backtest-kit__symbolImage",De=b()({root:{[`& .${Ee}:hover .${Ie}`]:{opacity:"1 !important"}}});function je(e){return R(e,"#000000")>R(e,"#FFFFFF")}const He=[{type:h.Link,action:"back-action",label:n(xe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:v("Main")},{type:h.Link,action:"back-action",label:v("Status")}],We=[{action:"update-now",label:v("Refresh"),icon:()=>n(x,{icon:ve,color:"#4caf50"})}],Ge=(e,t)=>({type:f.Group,className:Ee,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:f.Component,className:Ie,style:{transition:"opacity 500ms",opacity:.5},element:()=>n(L,{direction:"row",children:[n(k,{variant:"outlined",size:"small",color:"info",label:`${A.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),n(N,{flex:1})]})},{type:f.Group,fields:t.map(({symbol:e,label:t,to:o,color:a})=>((e,t,o,a)=>({type:f.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>n(B,{component:$,onClick:()=>{u.routerService.push(`/status/${t}`)},sx:{width:"100%",background:a,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${Oe}`]:{transition:"filter 500ms"},"&:hover":{background:()=>je(a)?M(a,.33):T(a,.33),[`& .${Oe}`]:{transition:"filter 500ms",filter:je(a)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:n(be,{className:Oe,symbol:e}),children:n(N,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(e,o,t,a))}]}),qe=[{type:h.Link,action:"back-action",label:n(xe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:v("Main")},{type:h.Link,action:"back-action",label:v("Status")},{type:h.Link,action:"back-action",compute:e=>e?`${String(e.symbol).toUpperCase()} (${e.strategyName})`:v("Live")},{type:h.Button,action:"control-action",label:v("Manual Control"),icon:ze},{type:h.Fab,action:"print-action",label:v("Print"),icon:D},{type:h.Fab,action:"update-now",label:v("Refresh"),icon:ve}],Ue=[{action:"print-action",label:v("Print"),icon:()=>n(x,{icon:D,color:"#4caf50"})},{action:"download-action",label:v("Download"),icon:()=>n(x,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:v("Refresh"),icon:()=>n(x,{icon:ve,color:"#4caf50"})}],Ye=new O,_e=new O,Qe=new O,Je=new O,Ke=new O,Xe=Y.createLoader(12),Ze=({payload:e})=>n(N,{sx:{mb:1,minHeight:48},children:n(W,{sx:{height:"100%",minHeight:48},hideOverflowY:!0,children:n(L,{direction:"row",gap:1,sx:{pointerEvents:"all"},children:[n(G,{startIcon:n(Te,{}),onClick:async()=>await _e.next(),color:"success",sx:{whiteSpace:"nowrap"},children:v("Open Position")}),n(G,{startIcon:n(Fe,{}),onClick:async()=>await Qe.next(),color:"warning",sx:{whiteSpace:"nowrap"},children:v("Commit Averaging")}),n(G,{startIcon:n(Ve,{}),onClick:async()=>await Ke.next(),sx:{whiteSpace:"nowrap"},children:v("Commit Breakeven")}),n(N,{flex:1}),n(q,{Loader:Xe,deps:[e.symbol,e.exchangeName,e.strategyName],reloadSubject:we,children:async()=>{const t=await u.controlViewService.getAveragePrice(e.symbol,{exchangeName:e.exchangeName,strategyName:e.strategyName}),o=Number(t);return n(C,{height:"100%",display:"flex",alignItems:"center",whiteSpace:"nowrap",mr:1,children:[v("Avg price")," ",e.symbol,":",A.nbsp,n("b",{children:`${o.toFixed(U(o))}${v("$")}`})]})}}),n(G,{startIcon:n(Re,{}),onClick:async()=>await Je.next(),sx:{whiteSpace:"nowrap"},color:"error",children:v("Close Position")})]})})}),et=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Open Position")},{type:f.Outline,fields:[{type:f.Combo,name:"position",title:v("Direction"),placeholder:v("Select direction"),itemList:["long","short"],validation:{required:!0},defaultValue:"long"},{type:f.Text,name:"cost",inputPattern:"[0-9]*",inputMode:"numeric",inputType:"tel",trailingIcon:Q,trailingIconClick:(e,{},{},t)=>{t("")},validation:{required:!0},title:v("Amount USDT"),placeholder:"00000",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9]/,defaultValue:"100"},{type:f.Text,outlined:!0,name:"quantity",sx:{cursor:"not-allowed","& *":{cursor:"not-allowed"}},title:v("Coin Quantity"),placeholder:"0.00",compute:(e,t)=>{const o=parseFloat(e.cost||"0"),a=parseFloat(t.averagePrice||"0");return o&&a?(o/a).toFixed(6):"0"},inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/,readonly:!0},{type:f.Text,name:"note",title:v("Note"),placeholder:v("Reason for opening the position")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the position will be opened IMMEDIATELY")}`}]}}],tt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Open Position")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin you want to open a position on. Rely on the symbol AND THE PRICE")}`}]}}],ot=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},at={success:!1,loading:!0,error:""},it=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:tt}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({position:r.position,cost:r.cost,note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(S,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:J,fields:et,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(at),{position:s,cost:c,note:p,symbol:d}=o.useMemo(()=>{const{position:t,cost:o,note:a,symbol:i}=e.data.form;return{position:t,cost:o,note:a,symbol:i}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitOpenPending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{position:s,cost:parseFloat(c||"0"),note:p||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(ot,{type:"error",title:v("Position Opening Error"),description:r.error,amount:`${Z(parseFloat(c||"0"))}${v("$")}`,symbol:d}):r.loading?n(ot,{type:"loading",title:v("Opening Position"),description:v("Please wait. Your operation is being processed..."),amount:`${Z(parseFloat(c||"0"))}${v("$")}`,symbol:d}):n(ot,{type:"success",title:v("Position Opened"),description:v("Position has been scheduled successfully. Waiting for the order to be executed on the exchange"),amount:`${Z(parseFloat(c||"0"))}${v("$")}`,symbol:d})})})},isActive:e=>!!se("/submit",e)}],rt=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Opening")}],nt="/brief",lt=me(),st=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Average Position")},{type:f.Outline,fields:[{type:f.Text,name:"cost",inputPattern:"[0-9]*",inputMode:"numeric",inputType:"tel",trailingIcon:Q,trailingIconClick:(e,{},{},t)=>{t("")},validation:{required:!0},title:v("Amount USDT"),placeholder:"00000",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9]/,defaultValue:"100"},{type:f.Text,outlined:!0,name:"quantity",sx:{cursor:"not-allowed","& *":{cursor:"not-allowed"}},title:v("Coin Quantity"),placeholder:"0.00",compute:(e,t)=>{const o=parseFloat(e.cost||"0"),a=parseFloat(t.averagePrice||"0");return o&&a?(o/a).toFixed(6):"0"},inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/,readonly:!0},{type:f.Text,name:"note",title:v("Note"),placeholder:v("Reason for averaging the position")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the averaging will be performed IMMEDIATELY")}`}]}}],ct=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Average Position")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin you want to average the position on. Rely on the symbol AND THE PRICE")}`}]}}],pt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},dt={success:!1,loading:!0,error:""},mt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:ct}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({cost:r.cost,note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(S,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:J,fields:st,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(dt),{cost:s,note:c,symbol:p}=o.useMemo(()=>{const{cost:t,note:o,symbol:a}=e.data.form;return{cost:t,note:o,symbol:a}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitAverageBuy(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{cost:parseFloat(s||"0"),note:c||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(pt,{type:"error",title:v("Averaging Error"),description:r.error,amount:`${Z(parseFloat(s||"0"))}${v("$")}`,symbol:p}):r.loading?n(pt,{type:"loading",title:v("Averaging Position"),description:v("Please wait. Your operation is being processed..."),amount:`${Z(parseFloat(s||"0"))}${v("$")}`,symbol:p}):n(pt,{type:"success",title:v("Position Averaged"),description:v("Averaging has been scheduled successfully. Waiting for the order to be executed on the exchange"),amount:`${Z(parseFloat(s||"0"))}${v("$")}`,symbol:p})})})},isActive:e=>!!se("/submit",e)}],yt=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Averaging")}],ut="/brief",gt=me(),ht=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Close Position")},{type:f.Outline,fields:[{type:f.Text,name:"note",title:v("Note"),placeholder:v("Reason for closing the position")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the closing will be performed IMMEDIATELY")}`}]}}],bt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Close Position")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin you want to close the position on. Rely on the symbol AND THE PRICE")}`}]}}],ft=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},vt={success:!1,loading:!0,error:""},xt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:bt}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(S,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:J,fields:ht,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(vt),{note:s,symbol:c}=o.useMemo(()=>{const{note:t,symbol:o}=e.data.form;return{note:t,symbol:o}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitClosePending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{note:s||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(ft,{type:"error",title:v("Position Closing Error"),description:r.error,symbol:c}):r.loading?n(ft,{type:"loading",title:v("Closing Position"),description:v("Please wait. Your operation is being processed..."),symbol:c}):n(ft,{type:"success",title:v("Position Closed"),description:v("Closing has been scheduled successfully. Waiting for the order to be executed on the exchange"),symbol:c})})})},isActive:e=>!!se("/submit",e)}],Ct=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Closing")}],wt="/brief",St=me(),Nt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Move to Breakeven")},{type:f.Outline,fields:[{type:f.Typography,typoVariant:"body1",placeholder:v("The stop-loss will be moved to the breakeven point of the current position. No additional input is required.")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the move to breakeven will be performed IMMEDIATELY")}`}]}}],Pt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Move to Breakeven")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin whose stop you want to move to breakeven. Rely on the symbol AND THE PRICE")}`}]}}],kt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},At={success:!1,loading:!0,error:""},Lt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:Pt}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:o,onChange:a})=>{const i=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{a({symbol:o.data.brief.symbol}),await i(),t.replace("/submit")}}),children:n(S,{payload:()=>({averagePrice:o.data.brief.averagePrice}),slots:J,fields:Nt,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(At),{symbol:s}=o.useMemo(()=>{const{symbol:t}=e.data.form;return{symbol:t}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitBreakeven(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(kt,{type:"error",title:v("Breakeven Error"),description:r.error,symbol:s}):r.loading?n(kt,{type:"loading",title:v("Moving to Breakeven"),description:v("Please wait. Your operation is being processed..."),symbol:s}):n(kt,{type:"success",title:v("Breakeven Set"),description:v("Breakeven has been scheduled successfully. Waiting for the order to be executed on the exchange"),symbol:s})})})},isActive:e=>!!se("/submit",e)}],$t=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Breakeven")}],Mt="/brief",Tt=me(),Bt=e=>"pnl"===e?v("P&L"):e,Rt=[{type:h.Link,action:"back-action",label:n(xe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:v("Main")},{type:h.Link,action:"back-action",label:v("Status")},{type:h.Link,action:"back-action",compute:e=>e?`${String(e.symbol).toUpperCase()} (${e.strategyName})`:v("Live")},{type:h.Link,action:"back-action",label:v("Manual Control")},{type:h.Button,action:"update-now",label:v("Refresh"),icon:ve}],Vt=[{action:"download-action",label:v("Download"),icon:()=>n(x,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:v("Refresh"),icon:()=>n(x,{icon:ve,color:"#4caf50"})}],Ft=[{id:"control",element:({params:e})=>{const[t]=y(async()=>{const t=await u.statusViewService.getStatusMap();return V.get(t,e.id,null)},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),[o,{loading:a,execute:i}]=y(async()=>t?await u.controlViewService.getStrategyStatus(t.symbol,{strategyName:t.strategyName,exchangeName:t.exchangeName}):null,{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]}),r=ye(t),{pickData:l,render:s}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:lt,animation:"none",title:v("Open Position"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:nt,sizeRequest:pe,routes:it,steps:rt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{lt.push(nt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}}),{pickData:c,render:d}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:gt,animation:"none",title:v("Average Position"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:ut,sizeRequest:pe,routes:mt,steps:yt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{gt.push(ut),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}}),{pickData:m,render:h}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:St,animation:"none",title:v("Close Position"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:wt,sizeRequest:pe,routes:xt,steps:Ct,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{St.push(wt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}}),{pickData:b,render:f}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:Tt,animation:"none",title:v("Move to Breakeven"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:Mt,sizeRequest:pe,routes:Lt,steps:$t,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{Tt.push(Mt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}});E(()=>we.subscribe(i)),E(()=>_e.subscribe(l)),E(()=>Qe.subscribe(c)),E(()=>Je.subscribe(m)),E(()=>Ke.subscribe(b));const x=F(async()=>{if(!o)return;const e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);u.layoutService.downloadFile(t,`manual_control_${Date.now()}.json`)});return n(fe,{children:[n(g,{items:Rt,actions:Vt,payload:t,onAction:async t=>{"back-action"===t&&u.routerService.push(`/status/${e.id}`),"download-action"===t&&x(),"update-now"===t&&await we.next()}}),o?a?null:n(ue,{component:p,withExpandAll:!0,sx:{p:1,minHeight:"calc(100dvh - 175px)"},payload:t,formatSearch:Bt,AfterSearch:Ze,data:o}):null,n(N,{sx:{paddingBottom:"24px"}}),n(Ce,{}),s(),d(),h(),f()]})},isActive:e=>he(["/status/:id/control"],e)},{id:"status",element:({params:e})=>{const[t]=y(async()=>{const t=await u.statusViewService.getStatusMap();return V.get(t,e.id,null)},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),[o,{loading:a,execute:i}]=y(async()=>await u.statusViewService.getStatusOne(e.id),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),r=F(async()=>{if(!o)return;const e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);u.layoutService.downloadFile(t,`status_${Date.now()}.json`)}),l=F(async()=>{if(!o)return;const e=u.markdownHelperService.buildMarkdownFromFields(z,o);await I(e)});E(()=>Ye.subscribe(i));return n(fe,{children:[n(g,{items:qe,actions:Ue,payload:t,onAction:async t=>{"back-action"===t&&(async()=>{1!==(await u.statusViewService.getStatusList()).length?u.routerService.push("/status"):u.routerService.push("/")})(),"control-action"===t&&u.routerService.push(`/status/${e.id}/control`),"update-now"===t&&await Ye.next(),"download-action"===t&&await r(),"print-action"===t&&await l()}}),a?n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("Loading...")})}):o?n(P,{children:[n(S,{handler:o,fields:H}),n(N,{paddingBottom:"24px"})]}):n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("No pending signal")})}),n(Ce,{})]})},isActive:e=>he(["/status/:id"],e)},{id:"main",element:()=>{const{classes:e}=De(),{reloadTrigger:t,doReload:o}=m();y(async()=>{const e=await u.statusViewService.getStatusList();if(1===e.length){const[{id:t}]=e;u.routerService.push(`/status/${t}`)}},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});const[a,{loading:i}]=y(async()=>await(async()=>{const[e,t]=await Promise.all([u.symbolGlobalService.getSymbolMap(),u.statusViewService.getStatusList()]);if(!t||0===t.length)return[{type:f.Typography,typoVariant:"h6",placeholder:v("Listening for a pending signal..."),sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};t.forEach(t=>{const a=e[t.symbol],i=t.strategyName;o[i]||(o[i]=[]),o[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",to:t.id})});const a=Object.entries(o).sort(([,e],[,t])=>t.length-e.length),i=[],r=[],n=[];return a.forEach(([e,t],o)=>{const a=Ge(e,t);o%2==0?i.push(a):r.push(a),n.push(a)}),[{type:f.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:i},{type:f.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:r},{type:f.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:n}]})(),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});return n(fe,{children:[n(g,{items:He,actions:We,onAction:e=>{"back-action"===e&&u.routerService.push("/"),"update-now"===e&&o()}}),i||!a?n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("Loading...")})}):a.length?n(P,{children:[n(S,{className:e.root,fields:a},t),n(N,{paddingBottom:"24px"})]}):n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("No pending signals")})})]})},isActive:e=>he(["/status"],e)}],zt=({id:e})=>n(ge,{history:u.routerService,onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),routes:Ft,params:{id:e}});export{zt as StatusPage,zt as default};
|
|
1
|
+
import{g as e,b as t,r as o,u as a,_ as i,e as r,f as n,h as l,k as s,s as c,l as p,d,z as m,A as y,i as u,V as g,W as h,q as b,a3 as f,t as v,$ as x,T as C,b3 as w,Y as S,B as N,w as P,a4 as k,K as A,J as L,a6 as $,m as M,n as T,a5 as B,a7 as R,ai as V,b4 as F,b5 as z,y as I,G as E,a9 as O,b6 as D,D as j,b7 as H,b8 as W,ag as G,X as q,U,a2 as Y,b9 as _,ad as Q,ba as J,bb as K,bc as X,Q as Z,bd as ee,aZ as te,ah as oe,be as ae,aQ as ie,aO as re,b0 as ne,bf as le,bg as se,bh as ce,bi as pe,I as de,av as me,al as ye,bj as ue,aj as ge}from"./index-CJlJOSPg.js";import{h as he}from"./hasRouteMatch-Bc6IBTG4.js";import{I as be}from"./IconPhoto-CGT-L09K.js";import{C as fe,R as ve}from"./Refresh-BEzkJ_ge.js";import{K as xe}from"./KeyboardArrowLeft-CF6hGzGl.js";import{B as Ce}from"./Background-DhTBM0kG.js";import{r as we}from"./emitters-Cp5Wn6Es.js";function Se(t){return e("MuiCard",t)}t("MuiCard",["root"]);const Ne=["className","raised"],Pe=c(p,{name:"MuiCard",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({overflow:"hidden"})),ke=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCard"}),{className:c,raised:p=!1}=o,d=i(o,Ne),m=r({},o,{raised:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},Se,t)})(m);return n(Pe,r({className:l(y.root,c),elevation:p?8:void 0,ref:t,ownerState:m},d))});function Ae(t){return e("MuiCardContent",t)}t("MuiCardContent",["root"]);const Le=["className","component"],$e=c("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(e,t)=>t.root})(()=>({padding:16,"&:last-child":{paddingBottom:24}})),Me=o.forwardRef(function(e,t){const o=a({props:e,name:"MuiCardContent"}),{className:c,component:p="div"}=o,d=i(o,Le),m=r({},o,{component:p}),y=(e=>{const{classes:t}=e;return s({root:["root"]},Ae,t)})(m);return n($e,r({as:p,className:l(y.root,c),ownerState:m,ref:t},d))}),Te=d(n("path",{d:"M18.21 9.21C15.93 10.78 13.45 13.3 13 17h2v2H9v-2h2c-.5-4.5-4.37-8-9-8V7c4.39 0 8.22 2.55 10 6.3 1.13-2.43 2.99-4.25 4.78-5.52L14 5h7v7l-2.79-2.79z"}),"AirlineStops"),Be=d(n("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckCircle"),Re=d(n("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}),"CloseOutlined"),Ve=d(n("path",{d:"M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5l-8-3zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25v4.7z"}),"ShieldOutlined"),Fe=d(n("path",{d:"m16 6 2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6h-6z"}),"TrendingUpOutlined"),ze=d(n("path",{d:"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-10 7H8v3H6v-3H3v-2h3V8h2v3h3v2zm4.5 2c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4-3c-.83 0-1.5-.67-1.5-1.5S18.67 9 19.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"}),"VideogameAsset"),Ie="backtest-kit__groupHeader",Ee="backtest-kit__groupRoot",Oe="backtest-kit__symbolImage",De=b()({root:{[`& .${Ee}:hover .${Ie}`]:{opacity:"1 !important"}}});function je(e){return R(e,"#000000")>R(e,"#FFFFFF")}const He=[{type:h.Link,action:"back-action",label:n(xe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:v("Main")},{type:h.Link,action:"back-action",label:v("Status")}],We=[{action:"update-now",label:v("Refresh"),icon:()=>n(x,{icon:ve,color:"#4caf50"})}],Ge=(e,t)=>({type:f.Group,className:Ee,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:f.Component,className:Ie,style:{transition:"opacity 500ms",opacity:.5},element:()=>n(L,{direction:"row",children:[n(k,{variant:"outlined",size:"small",color:"info",label:`${A.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),n(N,{flex:1})]})},{type:f.Group,fields:t.map(({symbol:e,label:t,to:o,color:a})=>((e,t,o,a)=>({type:f.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>n(B,{component:$,onClick:()=>{u.routerService.push(`/status/${t}`)},sx:{width:"100%",background:a,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${Oe}`]:{transition:"filter 500ms"},"&:hover":{background:()=>je(a)?M(a,.33):T(a,.33),[`& .${Oe}`]:{transition:"filter 500ms",filter:je(a)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:n(be,{className:Oe,symbol:e}),children:n(N,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(e,o,t,a))}]}),qe=[{type:h.Link,action:"back-action",label:n(xe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:v("Main")},{type:h.Link,action:"back-action",label:v("Status")},{type:h.Link,action:"back-action",compute:e=>e?`${String(e.symbol).toUpperCase()} (${e.strategyName})`:v("Live")},{type:h.Button,action:"control-action",label:v("Manual Control"),icon:ze},{type:h.Fab,action:"print-action",label:v("Print"),icon:D},{type:h.Fab,action:"update-now",label:v("Refresh"),icon:ve}],Ue=[{action:"print-action",label:v("Print"),icon:()=>n(x,{icon:D,color:"#4caf50"})},{action:"download-action",label:v("Download"),icon:()=>n(x,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:v("Refresh"),icon:()=>n(x,{icon:ve,color:"#4caf50"})}],Ye=new O,_e=new O,Qe=new O,Je=new O,Ke=new O,Xe=Y.createLoader(12),Ze=({payload:e})=>n(N,{sx:{mb:1,minHeight:48},children:n(W,{sx:{height:"100%",minHeight:48},hideOverflowY:!0,children:n(L,{direction:"row",gap:1,sx:{pointerEvents:"all"},children:[n(G,{startIcon:n(Te,{}),onClick:async()=>await _e.next(),color:"success",sx:{whiteSpace:"nowrap"},children:v("Open Position")}),n(G,{startIcon:n(Fe,{}),onClick:async()=>await Qe.next(),color:"warning",sx:{whiteSpace:"nowrap"},children:v("Commit Averaging")}),n(G,{startIcon:n(Ve,{}),onClick:async()=>await Ke.next(),sx:{whiteSpace:"nowrap"},children:v("Commit Breakeven")}),n(N,{flex:1}),n(q,{Loader:Xe,deps:[e.symbol,e.exchangeName,e.strategyName],reloadSubject:we,children:async()=>{const t=await u.controlViewService.getAveragePrice(e.symbol,{exchangeName:e.exchangeName,strategyName:e.strategyName}),o=Number(t);return n(C,{height:"100%",display:"flex",alignItems:"center",whiteSpace:"nowrap",mr:1,children:[v("Avg price")," ",e.symbol,":",A.nbsp,n("b",{children:`${o.toFixed(U(o))}${v("$")}`})]})}}),n(G,{startIcon:n(Re,{}),onClick:async()=>await Je.next(),sx:{whiteSpace:"nowrap"},color:"error",children:v("Close Position")})]})})}),et=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Open Position")},{type:f.Outline,fields:[{type:f.Combo,name:"position",title:v("Direction"),placeholder:v("Select direction"),itemList:["long","short"],validation:{required:!0},defaultValue:"long"},{type:f.Text,name:"cost",inputPattern:"[0-9]*",inputMode:"numeric",inputType:"tel",trailingIcon:Q,trailingIconClick:(e,{},{},t)=>{t("")},validation:{required:!0},title:v("Amount USDT"),placeholder:"00000",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9]/,defaultValue:"100"},{type:f.Text,outlined:!0,name:"quantity",sx:{cursor:"not-allowed","& *":{cursor:"not-allowed"}},title:v("Coin Quantity"),placeholder:"0.00",compute:(e,t)=>{const o=parseFloat(e.cost||"0"),a=parseFloat(t.averagePrice||"0");return o&&a?(o/a).toFixed(6):"0"},inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/,readonly:!0},{type:f.Text,name:"note",title:v("Note"),placeholder:v("Reason for opening the position")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the position will be opened IMMEDIATELY")}`}]}}],tt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Open Position")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin you want to open a position on. Rely on the symbol AND THE PRICE")}`}]}}],ot=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},at={success:!1,loading:!0,error:""},it=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:tt}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({position:r.position,cost:r.cost,note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(S,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:J,fields:et,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(at),{position:s,cost:c,note:p,symbol:d}=o.useMemo(()=>{const{position:t,cost:o,note:a,symbol:i}=e.data.form;return{position:t,cost:o,note:a,symbol:i}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitOpenPending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{position:s,cost:parseFloat(c||"0"),note:p||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(ot,{type:"error",title:v("Position Opening Error"),description:r.error,amount:`${Z(parseFloat(c||"0"))}${v("$")}`,symbol:d}):r.loading?n(ot,{type:"loading",title:v("Opening Position"),description:v("Please wait. Your operation is being processed..."),amount:`${Z(parseFloat(c||"0"))}${v("$")}`,symbol:d}):n(ot,{type:"success",title:v("Position Opened"),description:v("Position has been scheduled successfully. Waiting for the order to be executed on the exchange"),amount:`${Z(parseFloat(c||"0"))}${v("$")}`,symbol:d})})})},isActive:e=>!!se("/submit",e)}],rt=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Opening")}],nt="/brief",lt=me(),st=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Average Position")},{type:f.Outline,fields:[{type:f.Text,name:"cost",inputPattern:"[0-9]*",inputMode:"numeric",inputType:"tel",trailingIcon:Q,trailingIconClick:(e,{},{},t)=>{t("")},validation:{required:!0},title:v("Amount USDT"),placeholder:"00000",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9]/,defaultValue:"100"},{type:f.Text,outlined:!0,name:"quantity",sx:{cursor:"not-allowed","& *":{cursor:"not-allowed"}},title:v("Coin Quantity"),placeholder:"0.00",compute:(e,t)=>{const o=parseFloat(e.cost||"0"),a=parseFloat(t.averagePrice||"0");return o&&a?(o/a).toFixed(6):"0"},inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/,readonly:!0},{type:f.Text,name:"note",title:v("Note"),placeholder:v("Reason for averaging the position")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the averaging will be performed IMMEDIATELY")}`}]}}],ct=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Average Position")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin you want to average the position on. Rely on the symbol AND THE PRICE")}`}]}}],pt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},dt={success:!1,loading:!0,error:""},mt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:ct}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({cost:r.cost,note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(S,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:J,fields:st,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(dt),{cost:s,note:c,symbol:p}=o.useMemo(()=>{const{cost:t,note:o,symbol:a}=e.data.form;return{cost:t,note:o,symbol:a}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitAverageBuy(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{cost:parseFloat(s||"0"),note:c||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(pt,{type:"error",title:v("Averaging Error"),description:r.error,amount:`${Z(parseFloat(s||"0"))}${v("$")}`,symbol:p}):r.loading?n(pt,{type:"loading",title:v("Averaging Position"),description:v("Please wait. Your operation is being processed..."),amount:`${Z(parseFloat(s||"0"))}${v("$")}`,symbol:p}):n(pt,{type:"success",title:v("Position Averaged"),description:v("Averaging has been scheduled successfully. Waiting for the order to be executed on the exchange"),amount:`${Z(parseFloat(s||"0"))}${v("$")}`,symbol:p})})})},isActive:e=>!!se("/submit",e)}],yt=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Averaging")}],ut="/brief",gt=me(),ht=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Close Position")},{type:f.Outline,fields:[{type:f.Text,name:"note",title:v("Note"),placeholder:v("Reason for closing the position")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the closing will be performed IMMEDIATELY")}`}]}}],bt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Close Position")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin you want to close the position on. Rely on the symbol AND THE PRICE")}`}]}}],ft=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},vt={success:!1,loading:!0,error:""},xt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:bt}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:a,onChange:i})=>{const[r,l]=o.useState(e),s=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{r&&(i({note:r.note,symbol:a.data.brief.symbol}),await s(),t.replace("/submit"))}}),children:n(S,{payload:()=>({averagePrice:a.data.brief.averagePrice}),onChange:e=>l(e),slots:J,fields:ht,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(vt),{note:s,symbol:c}=o.useMemo(()=>{const{note:t,symbol:o}=e.data.form;return{note:t,symbol:o}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitClosePending(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName},{note:s||""}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(ft,{type:"error",title:v("Position Closing Error"),description:r.error,symbol:c}):r.loading?n(ft,{type:"loading",title:v("Closing Position"),description:v("Please wait. Your operation is being processed..."),symbol:c}):n(ft,{type:"success",title:v("Position Closed"),description:v("Closing has been scheduled successfully. Waiting for the order to be executed on the exchange"),symbol:c})})})},isActive:e=>!!se("/submit",e)}],Ct=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Closing")}],wt="/brief",St=me(),Nt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Move to Breakeven")},{type:f.Outline,fields:[{type:f.Typography,typoVariant:"body1",placeholder:v("The stop-loss will be moved to the breakeven point of the current position. No additional input is required.")}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("After pressing the Next button, the move to breakeven will be performed IMMEDIATELY")}`}]}}],Pt=[{type:f.Center,child:{type:f.Group,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fields:[{type:f.Typography,style:{opacity:.5},fieldBottomMargin:"3",typoVariant:"h6",placeholder:v("Move to Breakeven")},{type:f.Outline,fields:[{type:f.Text,name:"symbol",compute:({},e)=>e.symbol,title:v("Symbol")},{type:f.Text,name:"price",inputPattern:"[0-9.]*",inputMode:"decimal",inputType:"tel",compute:({},e)=>`${Z(e.averagePrice)}${v("$")}`,title:v("Coin Price"),placeholder:"000000.00",inputFormatterSymbol:"0",inputFormatterAllowed:/[0-9.]/}]},{type:f.Typography,fieldBottomMargin:"3",typoVariant:"caption",sx:{pt:2,opacity:.5,fontSize:12},placeholder:`${A.bullet} ${v("Carefully verify that this is the coin whose stop you want to move to breakeven. Rely on the symbol AND THE PRICE")}`}]}}],kt=({type:e,title:t,description:o,amount:a,price:i,symbol:r})=>{const l=ee(),s="loading"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(ae,{size:24,color:"warning"}),chipColor:"warning"}:"success"===e?{color:l.palette.success.main,bgColor:oe(l.palette.success.main,.1),icon:n(Be,{}),chipColor:"success"}:"error"===e?{color:l.palette.error.main,bgColor:oe(l.palette.error.main,.1),icon:n(ie,{}),chipColor:"error"}:"warning"===e?{color:l.palette.warning.main,bgColor:oe(l.palette.warning.main,.1),icon:n(re,{}),chipColor:"warning"}:"info"===e?{color:l.palette.info.main,bgColor:oe(l.palette.info.main,.1),icon:n(ne,{}),chipColor:"info"}:{color:l.palette.grey[500],bgColor:oe(l.palette.grey[500],.1),icon:n(ne,{}),chipColor:"default"};return n(ke,{elevation:0,sx:{backgroundColor:s.bgColor,border:`1px solid ${oe(s.color,.3)}`,borderRadius:2,transition:"all 0.3s ease"},children:n(Me,{sx:{p:3},children:[n(N,{sx:{display:"flex",alignItems:"center",gap:2,mb:2},children:[n(N,{sx:{color:s.color,display:"flex",alignItems:"center"},children:s.icon}),n(C,{variant:"h6",sx:{color:s.color,fontWeight:600,flex:1},children:t}),r&&n(k,{label:r,size:"small",color:s.chipColor,variant:"outlined",icon:n(te,{})})]}),o&&n(C,{variant:"body2",color:"text.secondary",sx:{mb:2,lineHeight:1.5},children:o}),(a||i)&&n(N,{sx:{display:"flex",gap:3,mt:2,p:2,backgroundColor:oe(l.palette.background.paper,.6),borderRadius:1,border:`1px solid ${oe(s.color,.1)}`},children:[a&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Amount")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:a})]}),i&&n(N,{children:[n(C,{variant:"caption",color:"text.secondary",children:v("Price")}),n(C,{variant:"subtitle1",sx:{fontWeight:600,color:s.color},children:i})]})]})]})})},At={success:!1,loading:!0,error:""},Lt=[{id:"brief",element:({data:e,payload:t,history:o,onChange:a,onClose:i,setLoading:r})=>{const l=_([e],50),[s,{loading:c}]=y(async()=>{const e=t.getContext();return{averagePrice:await u.controlViewService.getAveragePrice(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),symbol:e.symbol}},{onLoadStart:()=>r(!0),onLoadEnd:()=>r(!1)});return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!!s,labelPrev:v("Close"),onPrev:async()=>{await i()},onNext:async()=>{a({averagePrice:s.averagePrice,symbol:s.symbol}),await l(),o.replace("/form")}}),children:s?c?null:n(S,{payload:()=>({averagePrice:s.averagePrice,symbol:s.symbol}),slots:J,fields:Pt}):null})},isActive:e=>!!se("/brief",e)},{id:"form",element:({data:e,history:t,formState:o,onChange:a})=>{const i=_([e],50);return n(X,{Navigation:n(K,{hasPrev:!0,hasNext:!0,labelPrev:v("Back"),onPrev:async()=>{t.replace("/brief")},onNext:async()=>{a({symbol:o.data.brief.symbol}),await i(),t.replace("/submit")}}),children:n(S,{payload:()=>({averagePrice:o.data.brief.averagePrice}),slots:J,fields:Nt,sx:{pt:1}})})},isActive:e=>!!se("/form",e)},{id:"submit",element:({formState:e,payload:t,beginSave:a,setLoading:i})=>{const[r,l]=o.useState(At),{symbol:s}=o.useMemo(()=>{const{symbol:t}=e.data.form;return{symbol:t}},[e]);E(async()=>{i(!0);try{const e=t.getContext();await u.controlViewService.commitBreakeven(e.symbol,{strategyName:e.strategyName,exchangeName:e.exchangeName}),l({success:!0,loading:!1,error:""})}catch(e){l({success:!1,loading:!1,error:le(e)})}finally{i(!1)}});return n(X,{Navigation:n(K,{hasNext:r.success||!!r.error,labelNext:v("Close"),onNext:async()=>{await a()}}),children:n(N,{p:1,children:r.error?n(kt,{type:"error",title:v("Breakeven Error"),description:r.error,symbol:s}):r.loading?n(kt,{type:"loading",title:v("Moving to Breakeven"),description:v("Please wait. Your operation is being processed..."),symbol:s}):n(kt,{type:"success",title:v("Breakeven Set"),description:v("Breakeven has been scheduled successfully. Waiting for the order to be executed on the exchange"),symbol:s})})})},isActive:e=>!!se("/submit",e)}],$t=[{id:"brief",label:v("Briefing")},{id:"form",label:v("Input")},{id:"submit",label:v("Breakeven")}],Mt="/brief",Tt=me(),Bt=e=>"pnl"===e?v("P&L"):e,Rt=[{type:h.Link,action:"back-action",label:n(xe,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:v("Main")},{type:h.Link,action:"back-action",label:v("Status")},{type:h.Link,action:"back-action",compute:e=>e?`${String(e.symbol).toUpperCase()} (${e.strategyName})`:v("Live")},{type:h.Link,action:"back-action",label:v("Manual Control")},{type:h.Button,action:"update-now",label:v("Refresh"),icon:ve}],Vt=[{action:"download-action",label:v("Download"),icon:()=>n(x,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:v("Refresh"),icon:()=>n(x,{icon:ve,color:"#4caf50"})}],Ft=[{id:"control",element:({params:e})=>{const[t]=y(async()=>{const t=await u.statusViewService.getStatusMap();return V.get(t,e.id,null)},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),[o,{loading:a,execute:i}]=y(async()=>t?await u.controlViewService.getStrategyStatus(t.symbol,{strategyName:t.strategyName,exchangeName:t.exchangeName}):null,{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]}),r=ye(t),{pickData:l,render:s}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:lt,animation:"none",title:v("Open Position"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:nt,sizeRequest:pe,routes:it,steps:rt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{lt.push(nt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}}),{pickData:c,render:d}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:gt,animation:"none",title:v("Average Position"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:ut,sizeRequest:pe,routes:mt,steps:yt,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{gt.push(ut),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}}),{pickData:m,render:h}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:St,animation:"none",title:v("Close Position"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:wt,sizeRequest:pe,routes:xt,steps:Ct,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{St.push(wt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}}),{pickData:b,render:f}=(({payload:e})=>{const{pickData:t,render:o}=ce({history:Tt,animation:"none",title:v("Move to Breakeven"),AfterTitle:({onClose:e})=>n(L,{direction:"row",gap:1,children:n(de,{size:"small",onClick:e,children:n(Q,{})})}),mapPayload:()=>e,pathname:Mt,sizeRequest:pe,routes:Lt,steps:$t,onSubmit:async t=>(t&&await e.reloadSubject.next(),!0)});return{pickData:()=>{Tt.push(Mt),t()},render:o}})({payload:{getContext:()=>r.current,reloadSubject:we}});E(()=>we.subscribe(i)),E(()=>_e.subscribe(l)),E(()=>Qe.subscribe(c)),E(()=>Je.subscribe(m)),E(()=>Ke.subscribe(b));const x=F(async()=>{if(!o)return;const e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);u.layoutService.downloadFile(t,`manual_control_${Date.now()}.json`)});return n(fe,{children:[n(g,{items:Rt,actions:Vt,payload:t,onAction:async t=>{"back-action"===t&&u.routerService.push(`/status/${e.id}`),"download-action"===t&&x(),"update-now"===t&&await we.next()}}),o?a?null:n(ue,{component:p,withExpandAll:!0,sx:{p:1,minHeight:"calc(100dvh - 175px)"},payload:t,formatSearch:Bt,AfterSearch:Ze,data:o}):null,n(N,{sx:{paddingBottom:"24px"}}),n(Ce,{}),s(),d(),h(),f()]})},isActive:e=>he(["/status/:id/control"],e)},{id:"status",element:({params:e})=>{const[t]=y(async()=>{const t=await u.statusViewService.getStatusMap();return V.get(t,e.id,null)},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),[o,{loading:a,execute:i}]=y(async()=>await u.statusViewService.getStatusOne(e.id),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[e.id]}),r=F(async()=>{if(!o)return;const e=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);u.layoutService.downloadFile(t,`status_${Date.now()}.json`)}),l=F(async()=>{if(!o)return;const e=u.markdownHelperService.buildMarkdownFromFields(z,o);await I(e)});E(()=>Ye.subscribe(i));return n(fe,{children:[n(g,{items:qe,actions:Ue,payload:t,onAction:async t=>{"back-action"===t&&(async()=>{1!==(await u.statusViewService.getStatusList()).length?u.routerService.push("/status"):u.routerService.push("/")})(),"control-action"===t&&u.routerService.push(`/status/${e.id}/control`),"update-now"===t&&await Ye.next(),"download-action"===t&&await r(),"print-action"===t&&await l()}}),a?n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("Loading...")})}):o?n(P,{children:[n(S,{handler:o,fields:H}),n(N,{paddingBottom:"24px"})]}):n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("No pending signal")})}),n(Ce,{})]})},isActive:e=>he(["/status/:id"],e)},{id:"main",element:()=>{const{classes:e}=De(),{reloadTrigger:t,doReload:o}=m();y(async()=>{const e=await u.statusViewService.getStatusList();if(1===e.length){const[{id:t}]=e;u.routerService.push(`/status/${t}`)}},{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});const[a,{loading:i}]=y(async()=>await(async()=>{const[e,t]=await Promise.all([u.symbolGlobalService.getSymbolMap(),u.statusViewService.getStatusList()]);if(!t||0===t.length)return[{type:f.Typography,typoVariant:"h6",placeholder:v("Listening for a pending signal..."),sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};t.forEach(t=>{const a=e[t.symbol],i=t.strategyName;o[i]||(o[i]=[]),o[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",to:t.id})});const a=Object.entries(o).sort(([,e],[,t])=>t.length-e.length),i=[],r=[],n=[];return a.forEach(([e,t],o)=>{const a=Ge(e,t);o%2==0?i.push(a):r.push(a),n.push(a)}),[{type:f.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:i},{type:f.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:r},{type:f.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:n}]})(),{onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),deps:[t]});return n(fe,{children:[n(g,{items:He,actions:We,onAction:e=>{"back-action"===e&&u.routerService.push("/"),"update-now"===e&&o()}}),i||!a?n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("Loading...")})}):a.length?n(P,{children:[n(S,{className:e.root,fields:a},t),n(N,{paddingBottom:"24px"})]}):n(w,{children:n(C,{variant:"h6",sx:{opacity:.5},children:v("No pending signals")})})]})},isActive:e=>he(["/status"],e)}],zt=({id:e})=>n(ge,{history:u.routerService,onLoadStart:()=>u.layoutService.setAppbarLoader(!0),onLoadEnd:()=>u.layoutService.setAppbarLoader(!1),routes:Ft,params:{id:e}});export{zt as StatusPage,zt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,f as a,l as r,B as i,J as n,aa as t,T as o,O as c,a4 as s,t as l,U as d,Q as p,w as m,N as u,M as y,aO as b,aP as v,aQ as h,aR as g,ad as x,aS as k,aT as $,aU as f,aV as P,aW as w,aX as C,aY as S,aZ as _,i as A,aG as O,a9 as N,aH as E,V as D,W as F,a_ as T,a$ as L,$ as z}from"./index-WrZQf7cw.js";import{C as B,R as j}from"./Refresh-KIrQPPBf.js";import{K as R}from"./KeyboardArrowLeft-C3lIqTl8.js";const I=e=>{const r={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(_,{sx:r});case"signal.closed":case"order_sync.close":case"close_pending.commit":return a(x,{sx:r});case"signal.scheduled":return a(f,{sx:r});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:r});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(C,{sx:r});case"breakeven.available":case"breakeven.commit":return a(S,{sx:r});case"activate_scheduled.commit":return a(P,{sx:r});case"trailing_stop.commit":case"trailing_take.commit":return a(w,{sx:r});case"order_sync.open":return"schedule"===e.orderType?a(f,{sx:r}):a(P,{sx:r});case"order_sync.check":return a($,{sx:r});case"risk.rejection":return a(g,{sx:r});case"error.info":case"error.validation":case"signal.info":return a(v,{sx:r});case"error.critical":return a(h,{sx:r});default:return a(b,{sx:r})}},U=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"order_sync.open":return`${l("schedule"===e.orderType?"Order Sync Placed":"Order Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"order_sync.close":return`${l("Order Sync Close")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"order_sync.check":return`${l("Order Sync Check")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;default:return l("Unknown")}},W=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"order_sync.open":return"schedule"===e.orderType?l("Order Sync Placed"):l("Order Sync Open");case"order_sync.close":return l("Order Sync Close");case"order_sync.check":return l("Order Sync Check");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},M=e=>"symbol"in e,V=e=>"position"in e,Y=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,H=e=>"pnlPercentage"in e,K=e=>"level"in e,Q=e=>"percentToClose"in e,q=e=>"currentPrice"in e,G=e=>"duration"in e,J=e=>"closeReason"in e,X=e=>"cancelReason"in e,Z=e=>"percentShift"in e,ee=e=>("order_sync.open"===e.type||"order_sync.check"===e.type)&&!!e.orderType,ae=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),re=e=>"message"in e,ie=e=>"rejectionNote"in e,ne=e=>"activePositionCount"in e,te=e=>"effectivePriceOpen"in e,oe=e=>"totalEntries"in e&&e.totalEntries>1,ce=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),se=e=>"totalPartials"in e&&e.totalPartials>0,le=e=>"cost"in e,de=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,pe=e=>"peakProfitPriceClose"in e,me=e=>"maxDrawdownPriceClose"in e,ue=e.forwardRef(({item:e,className:b,style:v,sx:h},g)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":return"#4CAF50";case"signal.closed":case"order_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"order_sync.open":return"schedule"===e.orderType?"#FF9800":"#4CAF50";case"order_sync.check":return"#3F51B5";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:b,style:v,ref:g,children:a(r,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":A.layoutService.pickRisk(e.id);break;case"signal.opened":A.layoutService.pickSignalOpened(e.id);break;case"signal.closed":A.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":A.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":A.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":A.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":A.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":A.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":A.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":A.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":A.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":A.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":A.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":A.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":A.layoutService.pickAverageBuyCommit(e.id);break;case"order_sync.open":A.layoutService.pickOrderSyncOpen(e.id);break;case"order_sync.close":A.layoutService.pickOrderSyncClose(e.id);break;case"order_sync.check":A.layoutService.pickOrderSyncCheck(e.id);break;case"cancel_scheduled.commit":A.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":A.layoutService.pickClosePending(e.id);break;case"signal.info":A.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...h},children:a(i,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:I(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:U(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:W(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),H(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("PnL")}: ${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")}`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),K(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),X(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ee(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"order_sync.check"===e.type?e.orderType.toUpperCase():l("schedule"===e.orderType?"Order placed":"Order filled"),variant:"outlined",color:"schedule"===e.orderType?"warning":"success"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),se(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),le(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}${l("$")}`:l("N/A")}`,variant:"outlined"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):l("N/A")}`,variant:"outlined",color:"warning"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):l("N/A")}`,variant:"outlined"})]}),Y(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[q(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):l("N/A")]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}${l("$")}`:l("N/A")})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}${l("$")}`:l("N/A")]})]})]}),pe(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}${l("$")}`:l("N/A")})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}${l("$")}`:l("N/A")]})]})]}),me(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}${l("$")}`:l("N/A")})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}${l("$")}`:l("N/A")]})]})]})]})]}),ae(e)&&a(i,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(i,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(y,{content:e.note})})]}),ie(e)&&a(i,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),re(e)&&!ae(e)&&a(i,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(i,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),ye=[{action:"update-now",label:l("Refresh manually"),icon:()=>a(z,{icon:j,color:"#4caf50"})}],be=[{type:F.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:F.Link,action:"back-action",label:l("Main")},{type:F.Link,action:"back-action",label:l("Notifications")}],ve=new N,he=()=>{const{data:e,hasMore:r,loading:i,onSkip:n}=O({handler:async(e,a)=>{const r=await A.notificationViewService.getList(),i=E(e,a);for(const n of r)if(i([n]).done)break;return i().rows},onLoadStart:()=>A.layoutService.setAppbarLoader(!0),onLoadEnd:()=>A.layoutService.setAppbarLoader(!1),reloadSubject:ve});return a(B,{children:[a(D,{items:be,actions:ye,onAction:async e=>{"back-action"===e&&A.routerService.push("/"),"update-now"===e&&await ve.next()}}),a(T,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:i,onDataRequest:n,bufferSize:L,hasMore:r,children:e.map(e=>a(ue,{item:e,sx:{mb:1}},e.id))})]})};export{he as NotificationPage,he as default};
|
|
1
|
+
import{r as e,f as a,l as r,B as i,J as n,aa as t,T as o,O as c,a4 as s,t as l,U as d,Q as p,w as m,N as u,M as y,aO as b,aP as v,aQ as h,aR as g,ad as x,aS as k,aT as $,aU as f,aV as P,aW as w,aX as C,aY as S,aZ as _,i as A,aG as O,a9 as N,aH as E,V as D,W as F,a_ as T,a$ as L,$ as z}from"./index-CJlJOSPg.js";import{C as B,R as j}from"./Refresh-BEzkJ_ge.js";import{K as R}from"./KeyboardArrowLeft-CF6hGzGl.js";const I=e=>{const r={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(_,{sx:r});case"signal.closed":case"order_sync.close":case"close_pending.commit":return a(x,{sx:r});case"signal.scheduled":return a(f,{sx:r});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:r});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(C,{sx:r});case"breakeven.available":case"breakeven.commit":return a(S,{sx:r});case"activate_scheduled.commit":return a(P,{sx:r});case"trailing_stop.commit":case"trailing_take.commit":return a(w,{sx:r});case"order_sync.open":return"schedule"===e.orderType?a(f,{sx:r}):a(P,{sx:r});case"order_sync.check":return a($,{sx:r});case"risk.rejection":return a(g,{sx:r});case"error.info":case"error.validation":case"signal.info":return a(v,{sx:r});case"error.critical":return a(h,{sx:r});default:return a(b,{sx:r})}},U=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"order_sync.open":return`${l("schedule"===e.orderType?"Order Sync Placed":"Order Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"order_sync.close":return`${l("Order Sync Close")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"order_sync.check":return`${l("Order Sync Check")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")})`;default:return l("Unknown")}},W=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"order_sync.open":return"schedule"===e.orderType?l("Order Sync Placed"):l("Order Sync Open");case"order_sync.close":return l("Order Sync Close");case"order_sync.check":return l("Order Sync Check");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},M=e=>"symbol"in e,V=e=>"position"in e,Y=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,H=e=>"pnlPercentage"in e,K=e=>"level"in e,Q=e=>"percentToClose"in e,q=e=>"currentPrice"in e,G=e=>"duration"in e,J=e=>"closeReason"in e,X=e=>"cancelReason"in e,Z=e=>"percentShift"in e,ee=e=>("order_sync.open"===e.type||"order_sync.check"===e.type)&&!!e.orderType,ae=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),re=e=>"message"in e,ie=e=>"rejectionNote"in e,ne=e=>"activePositionCount"in e,te=e=>"effectivePriceOpen"in e,oe=e=>"totalEntries"in e&&e.totalEntries>1,ce=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),se=e=>"totalPartials"in e&&e.totalPartials>0,le=e=>"cost"in e,de=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,pe=e=>"peakProfitPriceClose"in e,me=e=>"maxDrawdownPriceClose"in e,ue=e.forwardRef(({item:e,className:b,style:v,sx:h},g)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":return"#4CAF50";case"signal.closed":case"order_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"order_sync.open":return"schedule"===e.orderType?"#FF9800":"#4CAF50";case"order_sync.check":return"#3F51B5";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:b,style:v,ref:g,children:a(r,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":A.layoutService.pickRisk(e.id);break;case"signal.opened":A.layoutService.pickSignalOpened(e.id);break;case"signal.closed":A.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":A.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":A.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":A.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":A.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":A.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":A.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":A.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":A.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":A.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":A.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":A.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":A.layoutService.pickAverageBuyCommit(e.id);break;case"order_sync.open":A.layoutService.pickOrderSyncOpen(e.id);break;case"order_sync.close":A.layoutService.pickOrderSyncClose(e.id);break;case"order_sync.check":A.layoutService.pickOrderSyncCheck(e.id);break;case"cancel_scheduled.commit":A.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":A.layoutService.pickClosePending(e.id);break;case"signal.info":A.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...h},children:a(i,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:I(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:U(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:W(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),H(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("PnL")}: ${null!=e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:l("N/A")}`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),K(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),X(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ee(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"order_sync.check"===e.type?e.orderType.toUpperCase():l("schedule"===e.orderType?"Order placed":"Order filled"),variant:"outlined",color:"schedule"===e.orderType?"warning":"success"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),se(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),le(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}${l("$")}`:l("N/A")}`,variant:"outlined"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):l("N/A")}`,variant:"outlined",color:"warning"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):l("N/A")}`,variant:"outlined"})]}),Y(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[q(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):l("N/A")]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}${l("$")}`:l("N/A")})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}${l("$")}`:l("N/A")]})]})]}),pe(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}${l("$")}`:l("N/A")})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}${l("$")}`:l("N/A")]})]})]}),me(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):l("N/A")]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}${l("$")}`:l("N/A")})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}${l("$")}`:l("N/A")]})]})]})]})]}),ae(e)&&a(i,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(i,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(y,{content:e.note})})]}),ie(e)&&a(i,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),re(e)&&!ae(e)&&a(i,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(i,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),ye=[{action:"update-now",label:l("Refresh manually"),icon:()=>a(z,{icon:j,color:"#4caf50"})}],be=[{type:F.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:F.Link,action:"back-action",label:l("Main")},{type:F.Link,action:"back-action",label:l("Notifications")}],ve=new N,he=()=>{const{data:e,hasMore:r,loading:i,onSkip:n}=O({handler:async(e,a)=>{const r=await A.notificationViewService.getList(),i=E(e,a);for(const n of r)if(i([n]).done)break;return i().rows},onLoadStart:()=>A.layoutService.setAppbarLoader(!0),onLoadEnd:()=>A.layoutService.setAppbarLoader(!1),reloadSubject:ve});return a(B,{children:[a(D,{items:be,actions:ye,onAction:async e=>{"back-action"===e&&A.routerService.push("/"),"update-now"===e&&await ve.next()}}),a(T,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:i,onDataRequest:n,bufferSize:L,hasMore:r,children:e.map(e=>a(ue,{item:e,sx:{mb:1}},e.id))})]})};export{he as NotificationPage,he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as t,T as e,K as a,bz as o,a3 as n,l as i,q as l,t as r,A as c,i as s,G as d,V as p,W as m,Z as y,$ as h,a0 as u,a1 as x,a2 as w,Y as f,b8 as b,y as g,aj as v}from"./index-
|
|
1
|
+
import{f as t,T as e,K as a,bz as o,a3 as n,l as i,q as l,t as r,A as c,i as s,G as d,V as p,W as m,Z as y,$ as h,a0 as u,a1 as x,a2 as w,Y as f,b8 as b,y as g,aj as v}from"./index-CJlJOSPg.js";import{h as R}from"./hasRouteMatch-Bc6IBTG4.js";import{r as S}from"./emitters-Cp5Wn6Es.js";import{I as F}from"./IconPhoto-CGT-L09K.js";import{P as A}from"./PictureAsPdfOutlined-C2rlUSVJ.js";import{C as L,R as N}from"./Refresh-BEzkJ_ge.js";import{K as j}from"./KeyboardArrowLeft-CF6hGzGl.js";const k=l()(t=>({root:{position:"relative",background:"#0001",overflow:"clip"},header:{position:"absolute",top:0,left:0,height:"48px",width:"calc(100% - 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",marginLeft:"8px",marginRight:"8px"},container:{marginTop:"48px",width:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},content:{display:"flex",width:"100%",padding:t.spacing(1),paddingBottom:t.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),D=[{type:n.Text,columns:"6",name:"totalPnl",title:r("Total PNL"),compute:t=>null!==t.totalPnl?`${t.totalPnl.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"sharpeRatio",title:r("Sharpe Ratio"),compute:t=>null!==t.sharpeRatio?`${t.sharpeRatio.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"winRate",title:r("Win Rate"),compute:t=>null!==t.winRate?`${t.winRate.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"profitFactor",title:r("Profit Factor"),compute:t=>null!==t.profitFactor?t.profitFactor.toFixed(2):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"maxDrawdown",title:r("Max Drawdown"),compute:t=>null!==t.maxDrawdown?`${t.maxDrawdown.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"expectancy",title:r("Expectancy"),compute:t=>null!==t.expectancy?`${t.expectancy.toFixed(2)}%`:r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"sortinoRatio",title:r("Sortino Ratio"),compute:t=>null!==t.sortinoRatio?t.sortinoRatio.toFixed(3):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"calmarRatio",title:r("Calmar Ratio"),compute:t=>null!==t.calmarRatio?t.calmarRatio.toFixed(3):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"recoveryFactor",title:r("Recovery Factor"),compute:t=>null!==t.recoveryFactor?t.recoveryFactor.toFixed(3):r("N/A"),readonly:!0},{type:n.Text,columns:"6",name:"totalTrades",title:r("Trades"),readonly:!0}],T=({row:n})=>{const{classes:l}=k();return t(i,{className:l.root,children:[t("div",{className:l.header,children:t(e,{variant:"h6",sx:{opacity:.8},children:`${a.bullet} ${n.symbol}`})}),t("div",{className:l.container,children:t("div",{className:l.content,children:[t("div",{className:l.avatar,children:t(F,{symbol:n.symbol,sx:{width:128,height:128}})}),t(o,{handler:()=>n,fields:D,sx:{mb:2}})]})})]})},P=[{type:m.Link,action:"back-action",label:t(j,{sx:{display:"block"}})},{type:m.Link,action:"back-action",label:r("Dashboard")},{type:m.Link,action:"back-action",label:r("Heatmap")},{type:m.Button,action:"download-pdf",label:r("Download PDF"),icon:A}],C=[{action:"download-json",label:r("Download JSON"),icon:()=>t(h,{icon:y,color:"#4caf50"})},{action:"download-markdown",label:r("Download Markdown"),icon:()=>t(h,{icon:u,color:"#4caf50"})},{action:"download-pdf",label:r("Download PDF"),icon:()=>t(h,{icon:x,color:"#4caf50"})},{divider:!0},{action:"update-now",label:r("Refresh"),icon:()=>t(h,{icon:N,color:"#4caf50"})}],$=[{id:"main",element:()=>{const[e,{loading:a,execute:o}]=c(async()=>(e=>{if(!e.length)return[{type:n.Typography,typoVariant:"h6",placeholder:r("No data"),sx:{textAlign:"center",opacity:.5,mt:4}}];const a=e.map(e=>({type:n.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:n.Component,element:()=>t(T,{row:e})}}));return a.length>2?a:[{type:n.Center,sx:t=>({[t.breakpoints.up("lg")]:{"@media (min-height: 900px)":{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}}),fields:a}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>S.subscribe(o));return t(L,{children:[t(p,{items:P,actions:C,onAction:async t=>{"back-action"===t&&s.routerService.push("/"),"update-now"===t&&await S.next(),"download-markdown"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatReport(),e=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(e);s.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatReport();await g(t)})(),"download-json"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatData(),e=JSON.stringify(t,null,2),a=new Blob([e],{type:"text/plain"}),o=URL.createObjectURL(a);s.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),!e||a?t(w,{sx:{height:"calc(100dvh - 165px)"}}):t(b,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:t(f,{fields:e})})]})},isActive:t=>R(["/heat"],t)}],H=({id:e})=>t(v,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:$,params:{id:e}});export{H as HeatPage,H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,b as t,d as a,f as o,r,u as n,_ as i,e as s,I as l,C as c,h as d,j as p,k as h,s as v,l as m,m as u,n as g,T as f,t as y,o as w,B as $,M as x,p as b,q as S,v as z,D as C,w as P,x as L,i as M,y as k,z as A,A as N,E as V,G as R,H as D,L as H,J as T,K as F,N as I,O as B,Q as W,R as E,U as O,V as j,W as Y,X as J,Y as _,Z as G,$ as U,a0 as q,a1 as Z,a2 as K,a3 as Q,a4 as X,a5 as ee,a6 as te,a7 as ae,a8 as oe}from"./index-WrZQf7cw.js";import{r as re}from"./emitters-qnXuWOnN.js";import{C as ne,R as ie}from"./Refresh-KIrQPPBf.js";function se(t){return e("MuiAlert",t)}const le=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),ce=a(o("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),de=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),pe=a(o("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),he=a(o("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),ve=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],me=v(m,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.variant],t[`${a.variant}${p(a.color||a.severity)}`]]}})(({theme:e,ownerState:t})=>{const a="light"===e.palette.mode?u:g,o="light"===e.palette.mode?g:u,r=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},r&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:o(e.palette[r].light,.9),[`& .${le.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${le.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${r}FilledColor`],backgroundColor:e.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[r].dark:e.palette[r].main,color:e.palette.getContrastText(e.palette[r].main)}))}),ue=v("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ge=v("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),fe=v("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),ye={success:o(ce,{fontSize:"inherit"}),warning:o(de,{fontSize:"inherit"}),error:o(pe,{fontSize:"inherit"}),info:o(he,{fontSize:"inherit"})},we=r.forwardRef(function(e,t){var a,r,v,m,u,g;const f=n({props:e,name:"MuiAlert"}),{action:y,children:w,className:$,closeText:x="Close",color:b,components:S={},componentsProps:z={},icon:C,iconMapping:P=ye,onClose:L,role:M="alert",severity:k="success",slotProps:A={},slots:N={},variant:V="standard"}=f,R=i(f,ve),D=s({},f,{color:b,severity:k,variant:V}),H=(e=>{const{variant:t,color:a,severity:o,classes:r}=e,n={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(n,se,r)})(D),T=null!=(a=null!=(r=N.closeButton)?r:S.CloseButton)?a:l,F=null!=(v=null!=(m=N.closeIcon)?m:S.CloseIcon)?v:c,I=null!=(u=A.closeButton)?u:z.closeButton,B=null!=(g=A.closeIcon)?g:z.closeIcon;return o(me,s({role:M,elevation:0,ownerState:D,className:d(H.root,$),ref:t},R,{children:[!1!==C?o(ue,{ownerState:D,className:H.icon,children:C||P[k]||ye[k]}):null,o(ge,{ownerState:D,className:H.message,children:w}),null!=y?o(fe,{ownerState:D,className:H.action,children:y}):null,null==y&&L?o(fe,{ownerState:D,className:H.action,children:o(T,s({size:"small","aria-label":x,title:x,color:"inherit",onClick:L},I,{children:o(F,s({fontSize:"small"},B))}))}):null]}))}),$e=a([o("path",{d:"M13 17c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h6V5H5v14h14v-2h-6z",opacity:".3"}),o("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.38-1-1.72zM20 9v6h-7V9h7zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2H5z"}),o("circle",{cx:"16",cy:"12",r:"1.5"})],"AccountBalanceWalletTwoTone"),xe=a([o("path",{d:"M8 6h8v6H8zm11 8H5c-.55 0-1 .45-1 1v3h16v-3c0-.55-.45-1-1-1zm-1 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z",opacity:".3"}),o("path",{d:"M19 12h-1V4H6v8H5c-1.66 0-3 1.34-3 3v5h20v-5c0-1.66-1.34-3-3-3zM8 6h8v6H8V6zm12 12H4v-3c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v3z"}),o("circle",{cx:"18",cy:"16",r:"1"})],"AdfScannerTwoTone"),be=a([o("path",{d:"M9 4H7v2H5v12h2v2h2v-2h2V6H9V4zm0 12H7V8h2v8z"}),o("path",{d:"M7 8h2v8H7zm8 2h2v3h-2z",opacity:".3"}),o("path",{d:"M19 8h-2V4h-2v4h-2v7h2v5h2v-5h2V8zm-2 5h-2v-3h2v3z"})],"CandlestickChartTwoTone"),Se=a([o("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm0 14.5c-.83 0-1.5-.67-1.5-1.5h3c0 .83-.67 1.5-1.5 1.5zm5-2.5H7v-2h1v-2.61C8 9.27 9.03 7.47 11 7v-.5c0-.57.43-1 1-1s1 .43 1 1V7c1.97.47 3 2.28 3 4.39V14h1v2z",opacity:".3"}),o("path",{d:"M12 18.5c.83 0 1.5-.67 1.5-1.5h-3c0 .83.67 1.5 1.5 1.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4-8.61c0-2.11-1.03-3.92-3-4.39v-.5c0-.57-.43-1-1-1s-1 .43-1 1V7c-1.97.47-3 2.27-3 4.39V14H7v2h10v-2h-1v-2.61zM14 14h-4v-3c0-1.1.9-2 2-2s2 .9 2 2v3z"})],"CircleNotificationsTwoTone"),ze=a(o("path",{d:"M21.5 14.98c-.02 0-.03 0-.05.01C21.2 13.3 19.76 12 18 12c-1.4 0-2.6.83-3.16 2.02C13.26 14.1 12 15.4 12 17c0 1.66 1.34 3 3 3l6.5-.02c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5zM10 4.26v2.09C7.67 7.18 6 9.39 6 12c0 1.77.78 3.34 2 4.44V14h2v6H4v-2h2.73C5.06 16.54 4 14.4 4 12c0-3.73 2.55-6.85 6-7.74zM20 6h-2.73c1.43 1.26 2.41 3.01 2.66 5h-2.02c-.23-1.36-.93-2.55-1.91-3.44V10h-2V4h6v2z"}),"CloudSync"),Ce=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),Pe=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Le=a([o("path",{d:"M14 4H6v16h12V8h-4V4zm2 7v4c0 2.21-1.79 4-4 4s-4-1.79-4-4V9.5C8 8.12 9.12 7 10.5 7S13 8.12 13 9.5V15h-2V9.5c0-.28-.22-.5-.5-.5s-.5.22-.5.5V15c0 1.1.9 2 2 2s2-.9 2-2v-4h2z",opacity:".3"}),o("path",{d:"M14 15c0 1.1-.9 2-2 2s-2-.9-2-2V9.5c0-.28.22-.5.5-.5s.5.22.5.5V15h2V9.5C13 8.12 11.88 7 10.5 7S8 8.12 8 9.5V15c0 2.21 1.79 4 4 4s4-1.79 4-4v-4h-2v4z"}),o("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h8v4h4v12z"})],"FilePresentTwoTone"),Me=a([o("path",{d:"M19 5H5v14h14V5zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z",opacity:".3"}),o("path",{d:"M3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2zm2 0h14v14H5V5zm2 5h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"})],"InsertChartTwoTone"),ke=a([o("path",{d:"M10 5h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z",opacity:".3"}),o("path",{d:"M16 11V3H8v6H2v12h20V11h-6zm-6-6h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z"})],"LeaderboardTwoTone"),Ae=a(o(r.Fragment,{children:[o("path",{d:"M12 20c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8zM10 7.5l6 4.5-6 4.5v-9z",opacity:".3"}),o("path",{d:"M12 22c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm0-18c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8zm-2 3.5v9l6-4.5z"})]}),"PlayCircleFilledWhiteTwoTone"),Ne=a([o("path",{d:"M4 18h16V8H4v10zm8-3h6v2h-6v-2zm-5.91-4.59L7.5 9l4 4-4 4-1.41-1.41L8.67 13l-2.58-2.59z",opacity:".3"}),o("path",{d:"M12 15h6v2h-6z"}),o("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H4V8h16v10z"}),o("path",{d:"m7.5 17 4-4-4-4-1.41 1.41L8.67 13l-2.58 2.59z"})],"TerminalTwoTone"),Ve=S()(e=>({root:{marginTop:e.spacing(1),marginBottom:e.spacing(2),marginLeft:e.spacing(2),marginRight:e.spacing(3),background:"white",transition:"opacity 500ms","&:hover":{opacity:1},opacity:.35,cursor:"pointer"},open:{opacity:1},expandButton:{cursor:"pointer !important",marginLeft:e.spacing(1)},copyButton:{cursor:"pointer !important",marginRight:e.spacing(1)},downloadButton:{cursor:"pointer !important"}})),Re=(e,t="%")=>null==e||Number.isNaN(e)?"—":`${e.toFixed(2)}${t}`,De=e=>null==e||Number.isNaN(e)?"—":`${e.toFixed(1)} ${y("min")}`,He=({data:e})=>{const{classes:t,cx:a}=Ve(),[n,i]=r.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:r,portfolioStdDev:n,portfolioSortinoRatio:i,portfolioCalmarRatio:s,portfolioRecoveryFactor:l,portfolioExpectancy:c,portfolioAvgPeakPnl:d,portfolioAvgFallPnl:p,portfolioPeakProfitPnl:h,portfolioMaxDrawdownPnl:v,portfolioAvgDuration:m,portfolioMedianPnl:u,portfolioAvgConsecutiveWinPnl:g,portfolioAvgConsecutiveLossPnl:f,portfolioAvgWinDuration:w,portfolioAvgLossDuration:$,portfolioAnnualizedSharpeRatio:x,portfolioCertaintyRatio:b,portfolioExpectedYearlyReturns:S,portfolioTradesPerYear:z,symbols:C,backtest:P}=e,L=y(P?"Backtest":"Live"),M=t.frameName?` / ${t.frameName}`:"",k=[`## ${L}: ${t.strategyName} / ${t.exchangeName}${M}`,"",`**${y("Total PNL")}:** ${Re(a)} `,`**${y("Sharpe Ratio")}:** ${Re(o,"")} `,`**${y("Annualized Sharpe")}:** ${Re(x,"")} `,`**${y("Certainty Ratio")}:** ${Re(b,"")} `,`**${y("Expected Yearly Returns")}:** ${Re(S)} `,`**${y("Trades Per Year")}:** ${null!==z?z.toFixed(1):"—"} `,`**${y("Total trades")}:** ${r} `,`**${y("Standard Deviation Per Trade")}:** ${Re(n)} `,`**${y("Sortino Ratio")}:** ${Re(i,"")} `,`**${y("Calmar Ratio")}:** ${Re(s,"")} `,`**${y("Recovery Factor Per Equity Drawdown")}:** ${Re(l,"")} `,`**${y("Expectancy")}:** ${Re(c)} `,`**${y("Median PNL")}:** ${Re(u)} `,`**${y("Avg Peak PNL")}:** ${Re(d)} `,`**${y("Avg Drawdown PNL")}:** ${Re(p)} `,`**${y("Peak Profit PNL")}:** ${Re(h)} `,`**${y("Max Drawdown PNL")}:** ${Re(v)} `,`**${y("Avg Duration")}:** ${De(m)} `,`**${y("Avg Win Duration")}:** ${De(w)} `,`**${y("Avg Loss Duration")}:** ${De($)} `,`**${y("Avg Consecutive Win PNL")}:** ${Re(g)} `,`**${y("Avg Consecutive Loss PNL")}:** ${Re(f)}`,""];for(const A of C)k.push(`### ${A.symbol}`,"",`**${y("PNL")}:** ${Re(A.totalPnl)} `,`**${y("Avg PNL")}:** ${Re(A.avgPnl)} `,`**${y("Median PNL")}:** ${Re(A.medianPnl)} `,`**${y("Win Rate")}:** ${Re(A.winRate)} `,`**${y("Profit Factor")}:** ${Re(A.profitFactor,"")} `,`**${y("Max Drawdown")}:** ${Re(A.maxDrawdown)} `,`**${y("Expectancy")}:** ${Re(A.expectancy)} `,`**${y("Sharpe Ratio")}:** ${Re(A.sharpeRatio,"")} `,`**${y("Annualized Sharpe")}:** ${Re(A.annualizedSharpeRatio,"")} `,`**${y("Certainty Ratio")}:** ${Re(A.certaintyRatio,"")} `,`**${y("Expected Yearly Returns")}:** ${Re(A.expectedYearlyReturns)} `,`**${y("Trades Per Year")}:** ${null!==A.tradesPerYear?A.tradesPerYear.toFixed(1):"—"} `,`**${y("Sortino Ratio")}:** ${Re(A.sortinoRatio,"")} `,`**${y("Calmar Ratio")}:** ${Re(A.calmarRatio,"")} `,`**${y("Recovery Factor Per Equity Drawdown")}:** ${Re(A.recoveryFactor,"")} `,`**${y("Standard Deviation")}:** ${Re(A.stdDev)} `,`**${y("Avg Win")}:** ${Re(A.avgWin)} `,`**${y("Avg Loss")}:** ${Re(A.avgLoss)} `,`**${y("Max Win Streak")}:** ${A.maxWinStreak} `,`**${y("Max Loss Streak")}:** ${A.maxLossStreak} `,`**${y("Avg Peak PNL")}:** ${Re(A.avgPeakPnl)} `,`**${y("Avg Drawdown PNL")}:** ${Re(A.avgFallPnl)} `,`**${y("Peak Profit PNL")}:** ${Re(A.peakProfitPnl)} `,`**${y("Max Drawdown PNL")}:** ${Re(A.maxDrawdownPnl)} `,`**${y("Avg Duration")}:** ${De(A.avgDuration)} `,`**${y("Avg Win Duration")}:** ${De(A.avgWinDuration)} `,`**${y("Avg Loss Duration")}:** ${De(A.avgLossDuration)} `,`**${y("Avg Consecutive Win PNL")}:** ${Re(A.avgConsecutiveWinPnl)} `,`**${y("Avg Consecutive Loss PNL")}:** ${Re(A.avgConsecutiveLossPnl)} `,`**${y("Trades")}:** ${A.totalTrades}`,"");return k.join("\n")})(e),c=()=>{i(!n)},d=async e=>{e.stopPropagation(),await k(s)},p=async e=>{e.stopPropagation(),await L(s)&&M.alertService.notify(y("Copied!"))};return o(we,{className:a(t.root,{[t.open]:n}),action:o(P,{children:[o(l,{className:t.copyButton,onClick:p,size:"small",children:o(z,{})}),o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(C,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(n?Ce:Pe,{})})]}),onClick:c,variant:"outlined",severity:"info",children:o(f,{minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",width:"100%",children:[o(f,{variant:"body2",sx:{opacity:n?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?y("Backtest"):y("Live"),": ",e.context.strategyName]}),o(w,{in:n,timeout:"auto",unmountOnExit:!0,children:[o($,{paddingBottom:"16px"}),o(x,{content:s}),o($,{paddingBottom:"32px"})]}),!n&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[b(s).slice(0,150),"..."]})]})})},Te="backtest-kit__groupHeader",Fe="backtest-kit__groupRoot",Ie="backtest-kit__symbolImage",Be=S()({root:{[`& .${Fe}:hover .${Te}`]:{opacity:"1 !important"}}});function We(e){return ae(e,"#000000")>ae(e,"#FFFFFF")}const Ee=[{type:Y.Component,element:()=>{const{reloadTrigger:e,doReload:t}=A(15e3),[a,{execute:r}]=N(async()=>{M.runtimeViewService.getRuntimeInfo.clear();const e=V(M.runtimeViewService.getRuntimeInfo,{defaultValue:null});return await e()},{onLoadStart:()=>M.layoutService.setAppbarLoader(!0),onLoadEnd:()=>M.layoutService.setAppbarLoader(!1),deps:[e]});R(()=>re.subscribe(r));return o(T,{direction:"row",alignItems:"center",children:[o(D,{"aria-label":y("breadcrumb"),children:[o(H,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:y("Main")}),o(H,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:y("Navigation")})]}),o($,{flex:1}),(()=>{if(!a)return null;const{symbol:e,when:r,currentPrice:n,backtest:i}=a;return o(E,{placement:"bottom",description:y(i?"Backtest mode":"Live mode"),children:o(T,{direction:"row",alignItems:"center",spacing:1,sx:{display:{xs:"none",sm:"flex"},cursor:"pointer",userSelect:"none"},onClick:()=>{M.runtimeViewService.getRuntimeInfo.clear(),t()},children:[o(l,{size:"small",children:o(ze,{})}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Symbol"),":",F.nbsp,o("b",{children:e})]}),o(I,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Time"),":",F.nbsp,o("b",{children:B(r).format("HH:mm DD MMM YYYY")})]}),o(I,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Price"),":",F.nbsp,o("b",{children:[W(n,O(n)),"$"]})]})]})})})(),o($,{pr:1})]})}}],Oe=[{action:"download-json",label:y("Download Heatmap JSON"),icon:()=>o(U,{icon:G,color:"#4caf50"})},{action:"download-markdown",label:y("Download Heatmap Markdown"),icon:()=>o(U,{icon:q,color:"#4caf50"})},{action:"download-pdf",label:y("Download Heatmap PDF"),icon:()=>o(U,{icon:Z,color:"#4caf50"})},{divider:!0},{action:"update-now",label:y("Refresh"),icon:()=>o(U,{icon:ie,color:"#4caf50"})}],je=(e,t)=>({type:Q.Group,className:Fe,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:Q.Component,className:Te,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(T,{direction:"row",children:[o(X,{variant:"outlined",size:"medium",color:"info",label:`${F.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o($,{flex:1})]})},{type:Q.Group,fields:t.map(({label:e,description:t,to:a,color:r,icon:n})=>((e,t,a,r,n)=>({type:Q.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(E,{description:a,children:o(ee,{component:te,onClick:()=>{M.routerService.push(e)},sx:{width:"100%",background:r,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ie}`]:{transition:"filter 500ms"},"&:hover":{background:()=>We(r)?u(r,.33):g(r,.33),[`& .${Ie}`]:{transition:"filter 500ms",filter:We(r)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:Ie}),children:t})})}))(a,e,t,r,n))}]}),Ye=[{label:y("Portfolio Overview"),description:oe.newline(y("Closed trading signals grouped by symbol for Backtest and Live modes"),y("Each card shows position type, entry price, TP/SL levels, PNL amount and percent"),y("Displays DCA entry count and partial close count where applicable"),y("Supports JSON export and manual refresh of the signal list")),to:"/overview",color:"#0033AD",icon:$e},{label:y("PNL Performance"),description:oe.newline(y("KPI dashboard with aggregated trading performance metrics per symbol"),y("Shows daily trade counts, success rates, resolved/rejected breakdowns"),y("Revenue analytics across today, yesterday, 7-day and 31-day windows"),y("Toggle between Backtest and Live modes; supports JSON export")),to:"/dashboard",color:"#E6007A",icon:Me},{label:y("System Logs"),description:oe.newline(y("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log"),y("Each entry shows topic, timestamp and raw JSON arguments in monospace"),y("Filter by keyword or regex via search prompt"),y("Supports full log export as JSON file")),to:"/logs",color:"#58BF00",icon:Ne}],Je=[{label:y("Notifications"),description:oe.newline(y("Event feed for all trading signals: opens, closes, schedules, errors"),y("Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices"),y("Infinite-scroll pagination; click any card to open a detailed modal"),y("Supports manual refresh to pull the latest activity")),to:"/notifications",color:"#F7931A",icon:Se},{label:y("Pending Status"),description:oe.newline(y("Live view of active trading signals grouped by strategy"),y("Grid of strategy buttons; click to inspect individual signal state"),y("Detail view shows entry, exit, effective price, DCA and partial counts"),y("Supports per-signal JSON export and manual refresh")),to:"/status",color:"#6F42C1",icon:Ae},{label:y("Dump Explorer"),description:oe.newline(y("Tree-structured file browser for backtest output and artifact files"),y("Icons indicate file type: image, JSON, plain text or generic"),y("Click any file to open a full-screen preview modal"),y("Supports keyword search and manual refresh of the file tree")),to:"/dump",color:"#0090FF",icon:Le}],_e=[{label:y("Markdown Reports"),description:oe.newline(y("Strategy performance reports rendered from markdown for Backtest and Live runs"),y("Grid of strategy buttons grouped by type and sorted by signal volume"),y("Download reports as markdown, PDF or raw JSON"),y("Supports manual refresh to regenerate report content")),to:"/report",color:"#009688",icon:xe},{label:y("Price Charts"),description:oe.newline(y("Interactive candlestick charts powered by TradingView Lightweight Charts"),y("Navigate by symbol then interval (1m, 15m, 1h) to view price history"),y("Overlays active signal lines: entry, take profit (green) and stop loss (red)"),y("Supports chart image export and signal detail inspection")),to:"/price_chart",color:"#1565C0",icon:be},{label:y("Heatmap"),description:oe.newline(y("Color-coded performance heatmap across all tracked symbols"),y("Cells show win rate, profit factor, Sharpe ratio and other key metrics"),y("Download heatmap as JSON, markdown report or PDF"),y("Supports manual refresh to recalculate aggregated statistics")),to:"/heat",color:"#8D6E63",icon:ke}],Ge=[je(y("Application"),Ye),je(y("Live"),Je),je(y("Other"),_e)],Ue=()=>o(K,{sx:{width:"100%",height:"75px"}}),qe=()=>{const{classes:e}=Be();return o(ne,{children:[o(j,{items:Ee,actions:Oe,onAction:async e=>{"update-now"===e&&await(async()=>{M.statusViewService.getStatusInfo.clear(),re.next()})(),"download-markdown"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);M.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatReport();await k(e)})(),"download-json"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);M.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),o(J,{Loader:Ue,reloadSubject:re,children:async()=>{const e=await M.statusViewService.getStatusInfo();return e?o(He,{data:e}):null}}),o(_,{className:e.root,fields:Ge,payload:()=>({history:history})}),o($,{paddingBottom:"24px"})]})};export{qe as MainPage,qe as default};
|
|
1
|
+
import{g as e,b as t,d as a,f as o,r,u as n,_ as i,e as s,I as l,C as c,h as d,j as p,k as h,s as v,l as m,m as u,n as g,T as f,t as y,o as w,B as $,M as x,p as b,q as S,v as z,D as C,w as P,x as L,i as M,y as k,z as A,A as N,E as V,G as R,H as D,L as H,J as T,K as F,N as I,O as B,Q as W,R as E,U as O,V as j,W as Y,X as J,Y as _,Z as G,$ as U,a0 as q,a1 as Z,a2 as K,a3 as Q,a4 as X,a5 as ee,a6 as te,a7 as ae,a8 as oe}from"./index-CJlJOSPg.js";import{r as re}from"./emitters-Cp5Wn6Es.js";import{C as ne,R as ie}from"./Refresh-BEzkJ_ge.js";function se(t){return e("MuiAlert",t)}const le=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),ce=a(o("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),de=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),pe=a(o("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),he=a(o("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),ve=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],me=v(m,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.variant],t[`${a.variant}${p(a.color||a.severity)}`]]}})(({theme:e,ownerState:t})=>{const a="light"===e.palette.mode?u:g,o="light"===e.palette.mode?g:u,r=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},r&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:o(e.palette[r].light,.9),[`& .${le.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${le.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${r}FilledColor`],backgroundColor:e.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[r].dark:e.palette[r].main,color:e.palette.getContrastText(e.palette[r].main)}))}),ue=v("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ge=v("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),fe=v("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),ye={success:o(ce,{fontSize:"inherit"}),warning:o(de,{fontSize:"inherit"}),error:o(pe,{fontSize:"inherit"}),info:o(he,{fontSize:"inherit"})},we=r.forwardRef(function(e,t){var a,r,v,m,u,g;const f=n({props:e,name:"MuiAlert"}),{action:y,children:w,className:$,closeText:x="Close",color:b,components:S={},componentsProps:z={},icon:C,iconMapping:P=ye,onClose:L,role:M="alert",severity:k="success",slotProps:A={},slots:N={},variant:V="standard"}=f,R=i(f,ve),D=s({},f,{color:b,severity:k,variant:V}),H=(e=>{const{variant:t,color:a,severity:o,classes:r}=e,n={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(n,se,r)})(D),T=null!=(a=null!=(r=N.closeButton)?r:S.CloseButton)?a:l,F=null!=(v=null!=(m=N.closeIcon)?m:S.CloseIcon)?v:c,I=null!=(u=A.closeButton)?u:z.closeButton,B=null!=(g=A.closeIcon)?g:z.closeIcon;return o(me,s({role:M,elevation:0,ownerState:D,className:d(H.root,$),ref:t},R,{children:[!1!==C?o(ue,{ownerState:D,className:H.icon,children:C||P[k]||ye[k]}):null,o(ge,{ownerState:D,className:H.message,children:w}),null!=y?o(fe,{ownerState:D,className:H.action,children:y}):null,null==y&&L?o(fe,{ownerState:D,className:H.action,children:o(T,s({size:"small","aria-label":x,title:x,color:"inherit",onClick:L},I,{children:o(F,s({fontSize:"small"},B))}))}):null]}))}),$e=a([o("path",{d:"M13 17c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h6V5H5v14h14v-2h-6z",opacity:".3"}),o("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.38-1-1.72zM20 9v6h-7V9h7zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2H5z"}),o("circle",{cx:"16",cy:"12",r:"1.5"})],"AccountBalanceWalletTwoTone"),xe=a([o("path",{d:"M8 6h8v6H8zm11 8H5c-.55 0-1 .45-1 1v3h16v-3c0-.55-.45-1-1-1zm-1 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z",opacity:".3"}),o("path",{d:"M19 12h-1V4H6v8H5c-1.66 0-3 1.34-3 3v5h20v-5c0-1.66-1.34-3-3-3zM8 6h8v6H8V6zm12 12H4v-3c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v3z"}),o("circle",{cx:"18",cy:"16",r:"1"})],"AdfScannerTwoTone"),be=a([o("path",{d:"M9 4H7v2H5v12h2v2h2v-2h2V6H9V4zm0 12H7V8h2v8z"}),o("path",{d:"M7 8h2v8H7zm8 2h2v3h-2z",opacity:".3"}),o("path",{d:"M19 8h-2V4h-2v4h-2v7h2v5h2v-5h2V8zm-2 5h-2v-3h2v3z"})],"CandlestickChartTwoTone"),Se=a([o("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm0 14.5c-.83 0-1.5-.67-1.5-1.5h3c0 .83-.67 1.5-1.5 1.5zm5-2.5H7v-2h1v-2.61C8 9.27 9.03 7.47 11 7v-.5c0-.57.43-1 1-1s1 .43 1 1V7c1.97.47 3 2.28 3 4.39V14h1v2z",opacity:".3"}),o("path",{d:"M12 18.5c.83 0 1.5-.67 1.5-1.5h-3c0 .83.67 1.5 1.5 1.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4-8.61c0-2.11-1.03-3.92-3-4.39v-.5c0-.57-.43-1-1-1s-1 .43-1 1V7c-1.97.47-3 2.27-3 4.39V14H7v2h10v-2h-1v-2.61zM14 14h-4v-3c0-1.1.9-2 2-2s2 .9 2 2v3z"})],"CircleNotificationsTwoTone"),ze=a(o("path",{d:"M21.5 14.98c-.02 0-.03 0-.05.01C21.2 13.3 19.76 12 18 12c-1.4 0-2.6.83-3.16 2.02C13.26 14.1 12 15.4 12 17c0 1.66 1.34 3 3 3l6.5-.02c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5zM10 4.26v2.09C7.67 7.18 6 9.39 6 12c0 1.77.78 3.34 2 4.44V14h2v6H4v-2h2.73C5.06 16.54 4 14.4 4 12c0-3.73 2.55-6.85 6-7.74zM20 6h-2.73c1.43 1.26 2.41 3.01 2.66 5h-2.02c-.23-1.36-.93-2.55-1.91-3.44V10h-2V4h6v2z"}),"CloudSync"),Ce=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),Pe=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Le=a([o("path",{d:"M14 4H6v16h12V8h-4V4zm2 7v4c0 2.21-1.79 4-4 4s-4-1.79-4-4V9.5C8 8.12 9.12 7 10.5 7S13 8.12 13 9.5V15h-2V9.5c0-.28-.22-.5-.5-.5s-.5.22-.5.5V15c0 1.1.9 2 2 2s2-.9 2-2v-4h2z",opacity:".3"}),o("path",{d:"M14 15c0 1.1-.9 2-2 2s-2-.9-2-2V9.5c0-.28.22-.5.5-.5s.5.22.5.5V15h2V9.5C13 8.12 11.88 7 10.5 7S8 8.12 8 9.5V15c0 2.21 1.79 4 4 4s4-1.79 4-4v-4h-2v4z"}),o("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h8v4h4v12z"})],"FilePresentTwoTone"),Me=a([o("path",{d:"M19 5H5v14h14V5zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z",opacity:".3"}),o("path",{d:"M3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2zm2 0h14v14H5V5zm2 5h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"})],"InsertChartTwoTone"),ke=a([o("path",{d:"M10 5h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z",opacity:".3"}),o("path",{d:"M16 11V3H8v6H2v12h20V11h-6zm-6-6h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z"})],"LeaderboardTwoTone"),Ae=a(o(r.Fragment,{children:[o("path",{d:"M12 20c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8zM10 7.5l6 4.5-6 4.5v-9z",opacity:".3"}),o("path",{d:"M12 22c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm0-18c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8zm-2 3.5v9l6-4.5z"})]}),"PlayCircleFilledWhiteTwoTone"),Ne=a([o("path",{d:"M4 18h16V8H4v10zm8-3h6v2h-6v-2zm-5.91-4.59L7.5 9l4 4-4 4-1.41-1.41L8.67 13l-2.58-2.59z",opacity:".3"}),o("path",{d:"M12 15h6v2h-6z"}),o("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H4V8h16v10z"}),o("path",{d:"m7.5 17 4-4-4-4-1.41 1.41L8.67 13l-2.58 2.59z"})],"TerminalTwoTone"),Ve=S()(e=>({root:{marginTop:e.spacing(1),marginBottom:e.spacing(2),marginLeft:e.spacing(2),marginRight:e.spacing(3),background:"white",transition:"opacity 500ms","&:hover":{opacity:1},opacity:.35,cursor:"pointer"},open:{opacity:1},expandButton:{cursor:"pointer !important",marginLeft:e.spacing(1)},copyButton:{cursor:"pointer !important",marginRight:e.spacing(1)},downloadButton:{cursor:"pointer !important"}})),Re=(e,t="%")=>null==e||Number.isNaN(e)?"—":`${e.toFixed(2)}${t}`,De=e=>null==e||Number.isNaN(e)?"—":`${e.toFixed(1)} ${y("min")}`,He=({data:e})=>{const{classes:t,cx:a}=Ve(),[n,i]=r.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:r,portfolioStdDev:n,portfolioSortinoRatio:i,portfolioCalmarRatio:s,portfolioRecoveryFactor:l,portfolioExpectancy:c,portfolioAvgPeakPnl:d,portfolioAvgFallPnl:p,portfolioPeakProfitPnl:h,portfolioMaxDrawdownPnl:v,portfolioAvgDuration:m,portfolioMedianPnl:u,portfolioAvgConsecutiveWinPnl:g,portfolioAvgConsecutiveLossPnl:f,portfolioAvgWinDuration:w,portfolioAvgLossDuration:$,portfolioAnnualizedSharpeRatio:x,portfolioCertaintyRatio:b,portfolioExpectedYearlyReturns:S,portfolioTradesPerYear:z,symbols:C,backtest:P}=e,L=y(P?"Backtest":"Live"),M=t.frameName?` / ${t.frameName}`:"",k=[`## ${L}: ${t.strategyName} / ${t.exchangeName}${M}`,"",`**${y("Total PNL")}:** ${Re(a)} `,`**${y("Sharpe Ratio")}:** ${Re(o,"")} `,`**${y("Annualized Sharpe")}:** ${Re(x,"")} `,`**${y("Certainty Ratio")}:** ${Re(b,"")} `,`**${y("Expected Yearly Returns")}:** ${Re(S)} `,`**${y("Trades Per Year")}:** ${null!==z?z.toFixed(1):"—"} `,`**${y("Total trades")}:** ${r} `,`**${y("Standard Deviation Per Trade")}:** ${Re(n)} `,`**${y("Sortino Ratio")}:** ${Re(i,"")} `,`**${y("Calmar Ratio")}:** ${Re(s,"")} `,`**${y("Recovery Factor Per Equity Drawdown")}:** ${Re(l,"")} `,`**${y("Expectancy")}:** ${Re(c)} `,`**${y("Median PNL")}:** ${Re(u)} `,`**${y("Avg Peak PNL")}:** ${Re(d)} `,`**${y("Avg Drawdown PNL")}:** ${Re(p)} `,`**${y("Peak Profit PNL")}:** ${Re(h)} `,`**${y("Max Drawdown PNL")}:** ${Re(v)} `,`**${y("Avg Duration")}:** ${De(m)} `,`**${y("Avg Win Duration")}:** ${De(w)} `,`**${y("Avg Loss Duration")}:** ${De($)} `,`**${y("Avg Consecutive Win PNL")}:** ${Re(g)} `,`**${y("Avg Consecutive Loss PNL")}:** ${Re(f)}`,""];for(const A of C)k.push(`### ${A.symbol}`,"",`**${y("PNL")}:** ${Re(A.totalPnl)} `,`**${y("Avg PNL")}:** ${Re(A.avgPnl)} `,`**${y("Median PNL")}:** ${Re(A.medianPnl)} `,`**${y("Win Rate")}:** ${Re(A.winRate)} `,`**${y("Profit Factor")}:** ${Re(A.profitFactor,"")} `,`**${y("Max Drawdown")}:** ${Re(A.maxDrawdown)} `,`**${y("Expectancy")}:** ${Re(A.expectancy)} `,`**${y("Sharpe Ratio")}:** ${Re(A.sharpeRatio,"")} `,`**${y("Annualized Sharpe")}:** ${Re(A.annualizedSharpeRatio,"")} `,`**${y("Certainty Ratio")}:** ${Re(A.certaintyRatio,"")} `,`**${y("Expected Yearly Returns")}:** ${Re(A.expectedYearlyReturns)} `,`**${y("Trades Per Year")}:** ${null!==A.tradesPerYear?A.tradesPerYear.toFixed(1):"—"} `,`**${y("Sortino Ratio")}:** ${Re(A.sortinoRatio,"")} `,`**${y("Calmar Ratio")}:** ${Re(A.calmarRatio,"")} `,`**${y("Recovery Factor Per Equity Drawdown")}:** ${Re(A.recoveryFactor,"")} `,`**${y("Standard Deviation")}:** ${Re(A.stdDev)} `,`**${y("Avg Win")}:** ${Re(A.avgWin)} `,`**${y("Avg Loss")}:** ${Re(A.avgLoss)} `,`**${y("Max Win Streak")}:** ${A.maxWinStreak} `,`**${y("Max Loss Streak")}:** ${A.maxLossStreak} `,`**${y("Avg Peak PNL")}:** ${Re(A.avgPeakPnl)} `,`**${y("Avg Drawdown PNL")}:** ${Re(A.avgFallPnl)} `,`**${y("Peak Profit PNL")}:** ${Re(A.peakProfitPnl)} `,`**${y("Max Drawdown PNL")}:** ${Re(A.maxDrawdownPnl)} `,`**${y("Avg Duration")}:** ${De(A.avgDuration)} `,`**${y("Avg Win Duration")}:** ${De(A.avgWinDuration)} `,`**${y("Avg Loss Duration")}:** ${De(A.avgLossDuration)} `,`**${y("Avg Consecutive Win PNL")}:** ${Re(A.avgConsecutiveWinPnl)} `,`**${y("Avg Consecutive Loss PNL")}:** ${Re(A.avgConsecutiveLossPnl)} `,`**${y("Trades")}:** ${A.totalTrades}`,"");return k.join("\n")})(e),c=()=>{i(!n)},d=async e=>{e.stopPropagation(),await k(s)},p=async e=>{e.stopPropagation(),await L(s)&&M.alertService.notify(y("Copied!"))};return o(we,{className:a(t.root,{[t.open]:n}),action:o(P,{children:[o(l,{className:t.copyButton,onClick:p,size:"small",children:o(z,{})}),o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(C,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(n?Ce:Pe,{})})]}),onClick:c,variant:"outlined",severity:"info",children:o(f,{minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",width:"100%",children:[o(f,{variant:"body2",sx:{opacity:n?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?y("Backtest"):y("Live"),": ",e.context.strategyName]}),o(w,{in:n,timeout:"auto",unmountOnExit:!0,children:[o($,{paddingBottom:"16px"}),o(x,{content:s}),o($,{paddingBottom:"32px"})]}),!n&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[b(s).slice(0,150),"..."]})]})})},Te="backtest-kit__groupHeader",Fe="backtest-kit__groupRoot",Ie="backtest-kit__symbolImage",Be=S()({root:{[`& .${Fe}:hover .${Te}`]:{opacity:"1 !important"}}});function We(e){return ae(e,"#000000")>ae(e,"#FFFFFF")}const Ee=[{type:Y.Component,element:()=>{const{reloadTrigger:e,doReload:t}=A(15e3),[a,{execute:r}]=N(async()=>{M.runtimeViewService.getRuntimeInfo.clear();const e=V(M.runtimeViewService.getRuntimeInfo,{defaultValue:null});return await e()},{onLoadStart:()=>M.layoutService.setAppbarLoader(!0),onLoadEnd:()=>M.layoutService.setAppbarLoader(!1),deps:[e]});R(()=>re.subscribe(r));return o(T,{direction:"row",alignItems:"center",children:[o(D,{"aria-label":y("breadcrumb"),children:[o(H,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:y("Main")}),o(H,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:y("Navigation")})]}),o($,{flex:1}),(()=>{if(!a)return null;const{symbol:e,when:r,currentPrice:n,backtest:i}=a;return o(E,{placement:"bottom",description:y(i?"Backtest mode":"Live mode"),children:o(T,{direction:"row",alignItems:"center",spacing:1,sx:{display:{xs:"none",sm:"flex"},cursor:"pointer",userSelect:"none"},onClick:()=>{M.runtimeViewService.getRuntimeInfo.clear(),t()},children:[o(l,{size:"small",children:o(ze,{})}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Symbol"),":",F.nbsp,o("b",{children:e})]}),o(I,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Time"),":",F.nbsp,o("b",{children:B(r).format("HH:mm DD MMM YYYY")})]}),o(I,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:[y("Price"),":",F.nbsp,o("b",{children:[W(n,O(n)),"$"]})]})]})})})(),o($,{pr:1})]})}}],Oe=[{action:"download-json",label:y("Download Heatmap JSON"),icon:()=>o(U,{icon:G,color:"#4caf50"})},{action:"download-markdown",label:y("Download Heatmap Markdown"),icon:()=>o(U,{icon:q,color:"#4caf50"})},{action:"download-pdf",label:y("Download Heatmap PDF"),icon:()=>o(U,{icon:Z,color:"#4caf50"})},{divider:!0},{action:"update-now",label:y("Refresh"),icon:()=>o(U,{icon:ie,color:"#4caf50"})}],je=(e,t)=>({type:Q.Group,className:Fe,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:Q.Component,className:Te,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(T,{direction:"row",children:[o(X,{variant:"outlined",size:"medium",color:"info",label:`${F.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o($,{flex:1})]})},{type:Q.Group,fields:t.map(({label:e,description:t,to:a,color:r,icon:n})=>((e,t,a,r,n)=>({type:Q.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(E,{description:a,children:o(ee,{component:te,onClick:()=>{M.routerService.push(e)},sx:{width:"100%",background:r,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ie}`]:{transition:"filter 500ms"},"&:hover":{background:()=>We(r)?u(r,.33):g(r,.33),[`& .${Ie}`]:{transition:"filter 500ms",filter:We(r)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:Ie}),children:t})})}))(a,e,t,r,n))}]}),Ye=[{label:y("Portfolio Overview"),description:oe.newline(y("Closed trading signals grouped by symbol for Backtest and Live modes"),y("Each card shows position type, entry price, TP/SL levels, PNL amount and percent"),y("Displays DCA entry count and partial close count where applicable"),y("Supports JSON export and manual refresh of the signal list")),to:"/overview",color:"#0033AD",icon:$e},{label:y("PNL Performance"),description:oe.newline(y("KPI dashboard with aggregated trading performance metrics per symbol"),y("Shows daily trade counts, success rates, resolved/rejected breakdowns"),y("Revenue analytics across today, yesterday, 7-day and 31-day windows"),y("Toggle between Backtest and Live modes; supports JSON export")),to:"/dashboard",color:"#E6007A",icon:Me},{label:y("System Logs"),description:oe.newline(y("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log"),y("Each entry shows topic, timestamp and raw JSON arguments in monospace"),y("Filter by keyword or regex via search prompt"),y("Supports full log export as JSON file")),to:"/logs",color:"#58BF00",icon:Ne}],Je=[{label:y("Notifications"),description:oe.newline(y("Event feed for all trading signals: opens, closes, schedules, errors"),y("Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices"),y("Infinite-scroll pagination; click any card to open a detailed modal"),y("Supports manual refresh to pull the latest activity")),to:"/notifications",color:"#F7931A",icon:Se},{label:y("Pending Status"),description:oe.newline(y("Live view of active trading signals grouped by strategy"),y("Grid of strategy buttons; click to inspect individual signal state"),y("Detail view shows entry, exit, effective price, DCA and partial counts"),y("Supports per-signal JSON export and manual refresh")),to:"/status",color:"#6F42C1",icon:Ae},{label:y("Dump Explorer"),description:oe.newline(y("Tree-structured file browser for backtest output and artifact files"),y("Icons indicate file type: image, JSON, plain text or generic"),y("Click any file to open a full-screen preview modal"),y("Supports keyword search and manual refresh of the file tree")),to:"/dump",color:"#0090FF",icon:Le}],_e=[{label:y("Markdown Reports"),description:oe.newline(y("Strategy performance reports rendered from markdown for Backtest and Live runs"),y("Grid of strategy buttons grouped by type and sorted by signal volume"),y("Download reports as markdown, PDF or raw JSON"),y("Supports manual refresh to regenerate report content")),to:"/report",color:"#009688",icon:xe},{label:y("Price Charts"),description:oe.newline(y("Interactive candlestick charts powered by TradingView Lightweight Charts"),y("Navigate by symbol then interval (1m, 15m, 1h) to view price history"),y("Overlays active signal lines: entry, take profit (green) and stop loss (red)"),y("Supports chart image export and signal detail inspection")),to:"/price_chart",color:"#1565C0",icon:be},{label:y("Heatmap"),description:oe.newline(y("Color-coded performance heatmap across all tracked symbols"),y("Cells show win rate, profit factor, Sharpe ratio and other key metrics"),y("Download heatmap as JSON, markdown report or PDF"),y("Supports manual refresh to recalculate aggregated statistics")),to:"/heat",color:"#8D6E63",icon:ke}],Ge=[je(y("Application"),Ye),je(y("Live"),Je),je(y("Other"),_e)],Ue=()=>o(K,{sx:{width:"100%",height:"75px"}}),qe=()=>{const{classes:e}=Be();return o(ne,{children:[o(j,{items:Ee,actions:Oe,onAction:async e=>{"update-now"===e&&await(async()=>{M.statusViewService.getStatusInfo.clear(),re.next()})(),"download-markdown"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);M.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatReport();await k(e)})(),"download-json"===e&&await(async()=>{const e=await M.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);M.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),o(J,{Loader:Ue,reloadSubject:re,children:async()=>{const e=await M.statusViewService.getStatusInfo();return e?o(He,{data:e}):null}}),o(_,{className:e.root,fields:Ge,payload:()=>({history:history})}),o($,{paddingBottom:"24px"})]})};export{qe as MainPage,qe as default};
|