@backtest-kit/ui 5.9.1 → 5.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/build/index.cjs +10 -3
  2. package/build/index.mjs +11 -4
  3. package/build/modules/frontend/build/assets/{Article-DwCWbgig.js → Article-CV5Q8o6x.js} +1 -1
  4. package/build/modules/frontend/build/assets/{Background-BUWczIMa.js → Background-as5_tKS_.js} +1 -1
  5. package/build/modules/frontend/build/assets/{Container-DgcBaXwp.js → Container-bTKJUsqX.js} +1 -1
  6. package/build/modules/frontend/build/assets/{IconPhoto-Dg1OJT1g.js → IconPhoto-iHdj_K8W.js} +1 -1
  7. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-DqH7VCRG.js → KeyboardArrowLeft-sfHB1IYi.js} +1 -1
  8. package/build/modules/frontend/build/assets/{Refresh-ASwi3YWH.js → Refresh-CH0eiGLB.js} +1 -1
  9. package/build/modules/frontend/build/assets/emitters-CmNFQZWA.js +1 -0
  10. package/build/modules/frontend/build/assets/{hasRouteMatch-B_-PodjM.js → hasRouteMatch-DzWVcZWi.js} +1 -1
  11. package/build/modules/frontend/build/assets/{html2canvas-D67h2MXz.js → html2canvas-DkIH2Xet.js} +1 -1
  12. package/build/modules/frontend/build/assets/index-BneZFtKI.js +1 -0
  13. package/build/modules/frontend/build/assets/{index-BXhzoqHB.js → index-Bw-ZorFV.js} +1 -1
  14. package/build/modules/frontend/build/assets/{index-lFLkJBoZ.js → index-C3UjHQ42.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-CYVGtlJR.js → index-CFZzoSq1.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-BbMctGny.js → index-CHbdbxq4.js} +1 -1
  17. package/build/modules/frontend/build/assets/index-CMCkXfjC.js +1 -0
  18. package/build/modules/frontend/build/assets/{index-DoQ6TdNT.js → index-CkLkivGW.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-BjGW-SeZ.js → index-CpAgfFDW.js} +8 -8
  20. package/build/modules/frontend/build/assets/{index-CxqvOyvF.js → index-DBOjHCyk.js} +1 -1
  21. package/build/modules/frontend/build/assets/index-DOoEVh8-.js +1 -0
  22. package/build/modules/frontend/build/assets/index-DfJxzRHU.js +1 -0
  23. package/build/modules/frontend/build/assets/{index.es-_Mw9_y9J.js → index.es-BKZV0i2c.js} +1 -1
  24. package/build/modules/frontend/build/assets/{markdownit-DnsUyAuX.js → markdownit-Bu-L1Tz5.js} +1 -1
  25. package/build/modules/frontend/build/index.html +1 -1
  26. package/package.json +3 -3
  27. package/build/modules/frontend/build/assets/emitters-EUI31qkt.js +0 -1
  28. package/build/modules/frontend/build/assets/index-CGTWcCfJ.js +0 -1
  29. package/build/modules/frontend/build/assets/index-CQbPy5z-.js +0 -1
  30. package/build/modules/frontend/build/assets/index-Dxunm9la.js +0 -1
  31. package/build/modules/frontend/build/assets/index-nAktdNIS.js +0 -1
package/build/index.cjs CHANGED
@@ -22,6 +22,8 @@ const CC_WWWROOT_HOST = process.env.CC_WWWROOT_HOST || "0.0.0.0";
22
22
  const CC_WWWROOT_PORT = parseInt(process.env.CC_WWWROOT_PORT) || 60050;
23
23
  const CC_ENABLE_MOCK = !!parseInt(process.env.CC_ENABLE_MOCK) || false;
24
24
 
25
+ const serveSubject = new functoolsKit.Subject();
26
+
25
27
  const router$b = Router({
26
28
  params: true,
27
29
  });
@@ -108,6 +110,8 @@ const INTERVAL_MINUTES = {
108
110
  "4h": 240,
109
111
  "6h": 360,
110
112
  "8h": 480,
113
+ "1d": 1440,
114
+ "1w": 10080,
111
115
  };
112
116
  const STEP_TICKS = {
113
117
  "1m": 960,
@@ -120,6 +124,8 @@ const STEP_TICKS = {
120
124
  "4h": 960,
121
125
  "6h": 960,
122
126
  "8h": 960,
127
+ "1d": 960,
128
+ "1w": 960,
123
129
  };
124
130
  class ExchangeService {
125
131
  constructor() {
@@ -1577,14 +1583,14 @@ class HeatViewService {
1577
1583
  strategyName: backtestItem.strategyName,
1578
1584
  exchangeName: backtestItem.exchangeName,
1579
1585
  frameName: backtestItem.frameName,
1580
- });
1586
+ }, true);
1581
1587
  }
1582
1588
  if (liveItem) {
1583
1589
  return await backtestKit.Heat.getReport({
1584
1590
  strategyName: liveItem.strategyName,
1585
1591
  exchangeName: liveItem.exchangeName,
1586
1592
  frameName: "",
1587
- });
1593
+ }, false);
1588
1594
  }
1589
1595
  return null;
1590
1596
  };
@@ -1680,7 +1686,7 @@ class SymbolConnectionService {
1680
1686
  });
1681
1687
  this.init = functoolsKit.singleshot(async () => {
1682
1688
  this.loggerService.log("symbolConnectionService init");
1683
- getSymbolList();
1689
+ serveSubject.once(getSymbolList);
1684
1690
  });
1685
1691
  }
1686
1692
  }
@@ -4064,6 +4070,7 @@ function serve(host, port) {
4064
4070
  host,
4065
4071
  port,
4066
4072
  });
4073
+ serveSubject.next();
4067
4074
  return serveInternal(host, port);
4068
4075
  }
4069
4076
  function getRouter() {
package/build/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import http from 'http';
2
- import { isObject, singleshot, pickDocuments, str, memoize, errorData, getErrorMessage } from 'functools-kit';
2
+ import { Subject, isObject, singleshot, pickDocuments, str, memoize, errorData, getErrorMessage } from 'functools-kit';
3
3
  import micro from 'micro';
4
4
  import Router from 'router';
5
5
  import finalhandler from 'finalhandler';
@@ -19,6 +19,8 @@ const CC_WWWROOT_HOST = process.env.CC_WWWROOT_HOST || "0.0.0.0";
19
19
  const CC_WWWROOT_PORT = parseInt(process.env.CC_WWWROOT_PORT) || 60050;
20
20
  const CC_ENABLE_MOCK = !!parseInt(process.env.CC_ENABLE_MOCK) || false;
21
21
 
22
+ const serveSubject = new Subject();
23
+
22
24
  const router$b = Router({
23
25
  params: true,
24
26
  });
@@ -105,6 +107,8 @@ const INTERVAL_MINUTES = {
105
107
  "4h": 240,
106
108
  "6h": 360,
107
109
  "8h": 480,
110
+ "1d": 1440,
111
+ "1w": 10080,
108
112
  };
109
113
  const STEP_TICKS = {
110
114
  "1m": 960,
@@ -117,6 +121,8 @@ const STEP_TICKS = {
117
121
  "4h": 960,
118
122
  "6h": 960,
119
123
  "8h": 960,
124
+ "1d": 960,
125
+ "1w": 960,
120
126
  };
121
127
  class ExchangeService {
122
128
  constructor() {
@@ -1574,14 +1580,14 @@ class HeatViewService {
1574
1580
  strategyName: backtestItem.strategyName,
1575
1581
  exchangeName: backtestItem.exchangeName,
1576
1582
  frameName: backtestItem.frameName,
1577
- });
1583
+ }, true);
1578
1584
  }
1579
1585
  if (liveItem) {
1580
1586
  return await Heat.getReport({
1581
1587
  strategyName: liveItem.strategyName,
1582
1588
  exchangeName: liveItem.exchangeName,
1583
1589
  frameName: "",
1584
- });
1590
+ }, false);
1585
1591
  }
1586
1592
  return null;
1587
1593
  };
@@ -1677,7 +1683,7 @@ class SymbolConnectionService {
1677
1683
  });
1678
1684
  this.init = singleshot(async () => {
1679
1685
  this.loggerService.log("symbolConnectionService init");
1680
- getSymbolList();
1686
+ serveSubject.once(getSymbolList);
1681
1687
  });
1682
1688
  }
1683
1689
  }
@@ -4061,6 +4067,7 @@ function serve(host, port) {
4061
4067
  host,
4062
4068
  port,
4063
4069
  });
4070
+ serveSubject.next();
4064
4071
  return serveInternal(host, port);
4065
4072
  }
4066
4073
  function getRouter() {
@@ -1 +1 @@
1
- import{c,f as v}from"./index-BjGW-SeZ.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
1
+ import{c,f as v}from"./index-CpAgfFDW.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
@@ -1 +1 @@
1
- import{f as n,b8 as o}from"./index-BjGW-SeZ.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
1
+ import{f as n,b8 as o}from"./index-CpAgfFDW.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
@@ -1 +1 @@
1
- import{bh as e,b as t,r as a,_ as s,f as i,bi as n,e as o,bj as r,h as d,bk as m,g as u,u as p,s as x}from"./index-BjGW-SeZ.js";const b=e(),h=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),c=b("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),f=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const g=function(e={}){const{createStyledComponent:r=c,useThemeProps:m=f,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:b,component:l="div",disableGutters:c=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,h),k=t({},r,{component:l,disableGutters:c,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:l,ownerState:k,className:n(S.root,b),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})});export{g as C};
1
+ import{bh as e,b as t,r as a,_ as s,f as i,bi as n,e as o,bj as r,h as d,bk as m,g as u,u as p,s as x}from"./index-CpAgfFDW.js";const b=e(),h=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),c=b("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),f=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const g=function(e={}){const{createStyledComponent:r=c,useThemeProps:m=f,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:b,component:l="div",disableGutters:c=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,h),k=t({},r,{component:l,disableGutters:c,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:l,ownerState:k,className:n(S.root,b),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})});export{g as C};
@@ -1 +1 @@
1
- import{f as e,v as t,B as r,J as s}from"./index-BjGW-SeZ.js";const o=({className:o,symbol:a,style:i,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[a],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:i,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:a,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:i,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
1
+ import{f as e,v as t,B as r,J as s}from"./index-CpAgfFDW.js";const o=({className:o,symbol:a,style:i,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[a],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:i,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:a,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:i,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
@@ -1 +1 @@
1
- import{c as o,f as r}from"./index-BjGW-SeZ.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
1
+ import{c as o,f as r}from"./index-CpAgfFDW.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
@@ -1 +1 @@
1
- import{c as s,f as c}from"./index-BjGW-SeZ.js";const a=s(c("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{a as R};
1
+ import{c as s,f as c}from"./index-CpAgfFDW.js";const a=s(c("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{a as R};
@@ -0,0 +1 @@
1
+ import{U as o}from"./index-CpAgfFDW.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{v as a,bl as e,bm as t}from"./index-BjGW-SeZ.js";const o=(o,r=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>o.includes(a)),r);export{o as h};
1
+ import{v as a,bl as e,bm as t}from"./index-CpAgfFDW.js";const o=(o,r=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>o.includes(a)),r);export{o as h};
@@ -1 +1 @@
1
- import{m as e,bo as t}from"./index-BjGW-SeZ.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
1
+ import{m as e,bo as t}from"./index-CpAgfFDW.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
@@ -0,0 +1 @@
1
+ import{c as t,f as a,T as e,K as o,b9 as n,G as i,P as l,o as r,W as c,v as s,Y as d,t as p,Z as m,x as h,y,z as w,A as u,E as x,w as f,aY as g,q as b,aX as v}from"./index-CpAgfFDW.js";import{h as S}from"./hasRouteMatch-DzWVcZWi.js";import{r as L}from"./emitters-CmNFQZWA.js";import{I as k}from"./IconPhoto-iHdj_K8W.js";import{C as D}from"./Container-bTKJUsqX.js";import{R}from"./Refresh-CH0eiGLB.js";import{K as j}from"./KeyboardArrowLeft-sfHB1IYi.js";const A=t(a("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined"),N=r()(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"}})),V=[{type:i.Text,name:"totalPnl",title:"Total PNL",compute:t=>null!==t.totalPnl?`${t.totalPnl.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"winRate",title:"Win Rate",compute:t=>null!==t.winRate?`${t.winRate.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"profitFactor",title:"Profit Factor",compute:t=>null!==t.profitFactor?t.profitFactor.toFixed(2):"N/A",readonly:!0},{type:i.Text,columns:"6",name:"maxDrawdown",title:"Max Drawdown",compute:t=>null!==t.maxDrawdown?`${t.maxDrawdown.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"expectancy",title:"Expectancy",compute:t=>null!==t.expectancy?`${t.expectancy.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,fieldBottomMargin:"0",name:"totalTrades",title:"Trades",readonly:!0}],F=({row:t})=>{const{classes:i}=N();return a(l,{className:i.root,children:[a("div",{className:i.header,children:a(e,{variant:"h6",sx:{opacity:.8},children:`${o.bullet} ${t.symbol}`})}),a("div",{className:i.container,children:a("div",{className:i.content,children:[a("div",{className:i.avatar,children:a(k,{symbol:t.symbol,sx:{width:128,height:128}})}),a(n,{handler:()=>t,fields:V,sx:{mb:2}})]})})]})},T=[{type:m.Link,action:"back-action",label:a(j,{sx:{display:"block"}})},{type:m.Link,action:"back-action",label:"Dashboard"},{type:m.Link,action:"back-action",label:"Heatmap"},{type:m.Button,action:"download-pdf",label:"Download PDF",icon:A}],H=[{action:"download-json",label:"Download JSON",icon:()=>a(y,{icon:h,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>a(y,{icon:w,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>a(y,{icon:u,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(y,{icon:R,color:"#4caf50"})}],P=[{id:"main",element:()=>{const[t,{loading:e,execute:o}]=c(async()=>(t=>{if(!t.length)return[{type:i.Typography,typoVariant:"h6",placeholder:"No data",sx:{textAlign:"center",opacity:.5,mt:4}}];const e=t.map(t=>({type:i.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:i.Component,element:()=>a(F,{row:t})}}));return e.length>2?e:[{type:i.Center,sx:t=>({[t.breakpoints.up("lg")]:{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}),fields:e}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>L.subscribe(o));return a(D,{children:[a(p,{items:T,actions:H,onAction:async t=>{"back-action"===t&&s.routerService.push("/"),"update-now"===t&&await L.next(),"download-markdown"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatReport(),a=new Blob([t],{type:"text/plain"}),e=URL.createObjectURL(a);s.layoutService.downloadFile(e,`heat_${Date.now()}.md`)})(),"download-pdf"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatReport();await b(t)})(),"download-json"===t&&await(async()=>{const t=await s.heatViewService.getStrategyHeatData(),a=JSON.stringify(t,null,2),e=new Blob([a],{type:"text/plain"}),o=URL.createObjectURL(e);s.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!t||e?a(x,{sx:{height:"calc(100dvh - 165px)"}}):a(g,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:a(f,{fields:t})})]})},isActive:t=>S(["/heat"],t)}],C=({id:t})=>a(v,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:P,params:{id:t}});export{C as HeatPage,C as default};