@backtest-kit/ui 6.14.0 → 6.16.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 (41) hide show
  1. package/build/index.cjs +108 -14
  2. package/build/index.mjs +109 -15
  3. package/build/modules/frontend/build/3rdparty/qfchart_0.8.7/echarts.min.js +45 -0
  4. package/build/modules/frontend/build/3rdparty/qfchart_0.8.7/pinets.js +21534 -0
  5. package/build/modules/frontend/build/3rdparty/qfchart_0.8.7/qfchart.js +3997 -0
  6. package/build/modules/frontend/build/assets/Article-DYhWfFAi.js +1 -0
  7. package/build/modules/frontend/build/assets/Background-COpkJTP-.js +1 -0
  8. package/build/modules/frontend/build/assets/{IconPhoto-CNX0t203.js → IconPhoto-DUgsqsYP.js} +1 -1
  9. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-5ogjRzwF.js → KeyboardArrowLeft-BlwcBPHn.js} +1 -1
  10. package/build/modules/frontend/build/assets/Refresh-aWduZclR.js +1 -0
  11. package/build/modules/frontend/build/assets/emitters-CSLNlyHG.js +1 -0
  12. package/build/modules/frontend/build/assets/hasRouteMatch-CImjW4Jf.js +1 -0
  13. package/build/modules/frontend/build/assets/{html2canvas-BnarC1H-.js → html2canvas-Do8zi4tS.js} +1 -1
  14. package/build/modules/frontend/build/assets/index-7wQuV9F_.js +1 -0
  15. package/build/modules/frontend/build/assets/index-B_46G-d8.js +1 -0
  16. package/build/modules/frontend/build/assets/index-BfiWEbdc.js +1 -0
  17. package/build/modules/frontend/build/assets/index-Bmqo1dsM.js +1 -0
  18. package/build/modules/frontend/build/assets/index-CETLG42q.js +1 -0
  19. package/build/modules/frontend/build/assets/index-Cb4CVVwH.js +1 -0
  20. package/build/modules/frontend/build/assets/{index-BMzg4t4L.js → index-Ce2sQITf.js} +7 -7
  21. package/build/modules/frontend/build/assets/{index-CYHbLqvS.js → index-CjymMd2D.js} +1 -1
  22. package/build/modules/frontend/build/assets/{index-DLH5bivm.js → index-D6YeBcAB.js} +1 -1
  23. package/build/modules/frontend/build/assets/index-WhalaOXd.js +1 -0
  24. package/build/modules/frontend/build/assets/{index-eYCKhqo-.js → index-kQ_oUmTQ.js} +1 -1
  25. package/build/modules/frontend/build/assets/{index-BY7xx8Qo.js → index-lZGMPvrT.js} +1 -1
  26. package/build/modules/frontend/build/assets/{index.es-XkghWdRJ.js → index.es-Cel98f_u.js} +1 -1
  27. package/build/modules/frontend/build/assets/{markdownit-CFUj-lOk.js → markdownit-22RgFULT.js} +1 -1
  28. package/build/modules/frontend/build/index.html +4 -1
  29. package/package.json +3 -3
  30. package/types.d.ts +11 -2
  31. package/build/modules/frontend/build/assets/Article-BFiJ1grS.js +0 -1
  32. package/build/modules/frontend/build/assets/Background-C4tJEFCD.js +0 -1
  33. package/build/modules/frontend/build/assets/Refresh-DPMpKmUf.js +0 -1
  34. package/build/modules/frontend/build/assets/emitters-BxM0853t.js +0 -1
  35. package/build/modules/frontend/build/assets/hasRouteMatch-DvMTRSzL.js +0 -1
  36. package/build/modules/frontend/build/assets/index-2cnF0R3L.js +0 -1
  37. package/build/modules/frontend/build/assets/index-B9jcFvZN.js +0 -1
  38. package/build/modules/frontend/build/assets/index-C-XjS3CF.js +0 -1
  39. package/build/modules/frontend/build/assets/index-C1SBiwRD.js +0 -1
  40. package/build/modules/frontend/build/assets/index-C5kEItX6.js +0 -1
  41. package/build/modules/frontend/build/assets/index-Dl9D9lt4.js +0 -1
@@ -0,0 +1 @@
1
+ import{b as c,f as v}from"./index-Ce2sQITf.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};
@@ -0,0 +1 @@
1
+ import{f as n,S as o}from"./index-Ce2sQITf.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
@@ -1 +1 @@
1
- import{f as e,w as t,B as r,J as s}from"./index-BMzg4t4L.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,i as t,B as r,J as s}from"./index-Ce2sQITf.js";const o=({className:o,symbol:i,style:a,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[i],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:a,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:i,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:a,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
@@ -1 +1 @@
1
- import{c as o,f as r}from"./index-BMzg4t4L.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
1
+ import{b as o,f as r}from"./index-Ce2sQITf.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};
@@ -0,0 +1 @@
1
+ import{bp as e,d as t,r as a,_ as s,f as i,bq as n,h as o,br as r,j as d,bs as m,g as u,u as p,s as x,b as h}from"./index-Ce2sQITf.js";const c=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),f=c("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:h,component:c="div",disableGutters:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:c,disableGutters:l,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:c,ownerState:k,className:n(S.root,h),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})}),k=h(i("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{W as C,k as R};
@@ -0,0 +1 @@
1
+ import{X as o}from"./index-Ce2sQITf.js";const r=new o;export{r};
@@ -0,0 +1 @@
1
+ import{i as a,bn as e,bo as o}from"./index-Ce2sQITf.js";const t=(t,i=a.routerService.location.pathname)=>!!e(o.filter(({path:a})=>t.includes(a)),i);export{t as h};
@@ -1 +1 @@
1
- import{m as e,bu as t}from"./index-BMzg4t4L.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{o as e,bu as t}from"./index-Ce2sQITf.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{aR as t,Z as a,i as e,f as o,w as s,x as i,t as n,K as r,A as c,T as l,aS as d,y as p,B as u,F as m,L as b,N as y,O as h,R as g,k as S,l as f,Q as L,V as v,aT as k,aU as w,a0 as x,X as A,D as N,aV as C,aW as R}from"./index-Ce2sQITf.js";import{h as j}from"./hasRouteMatch-CImjW4Jf.js";import{I as $}from"./IconPhoto-DUgsqsYP.js";import{C as F,R as V}from"./Refresh-aWduZclR.js";import{K as B}from"./KeyboardArrowLeft-BlwcBPHn.js";import{B as E}from"./Background-COpkJTP-.js";const H="backtest-kit__groupHeader",M="backtest-kit__groupRoot",_="backtest-kit__symbolImage",G=n()({root:{[`& .${M}:hover .${H}`]:{opacity:"1 !important"}}});function O(t){return v(t,"#000000")>v(t,"#FFFFFF")}const I=[{type:i.Link,action:"back-action",label:o(B,{sx:{display:"block"}})},{type:i.Link,action:"back-action",label:"Main"},{type:i.Link,action:"back-action",label:"Status"}],T=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],U=(t,a)=>({type:r.Group,className:M,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:H,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(h,{direction:"row",children:[o(b,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:a.map(({symbol:t,label:a,to:s,color:i})=>((t,a,s,i)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(L,{component:g,onClick:()=>{e.routerService.push(`/status/${a}`)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${_}`]:{transition:"filter 500ms"},"&:hover":{background:()=>O(i)?S(i,.33):f(i,.33),[`& .${_}`]:{transition:"filter 500ms",filter:O(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o($,{className:_,symbol:t}),children:s})}))(t,s,a,i))}]}),z=[{type:i.Link,action:"back-action",label:o(B,{sx:{display:"block"}})},{type:i.Link,action:"back-action",label:"Main"},{type:i.Link,action:"back-action",label:"Status"},{type:i.Link,action:"back-action",compute:t=>t?`${String(t.symbol).toUpperCase()} (${t.strategyName})`:"Live"}],D=[{action:"download-action",label:"Download",icon:()=>o(c,{icon:N,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],K=new A,W=[{id:"status",element:({params:t})=>{const[i]=a(async()=>{const a=await e.statusViewService.getStatusMap();return k.get(a,t.id,null)},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[t.id]}),[n,{loading:r,execute:c}]=a(async()=>await e.statusViewService.getStatusOne(t.id),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[t.id]}),b=w(async()=>{if(!n)return;const t=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),a=URL.createObjectURL(t);e.layoutService.downloadFile(a,`status_${Date.now()}.json`)});x(()=>K.subscribe(c));return o(F,{children:[o(s,{items:z,actions:D,payload:i,onAction:async t=>{"back-action"===t&&((async()=>{1!==(await e.statusViewService.getStatusList()).length?e.routerService.push("/status"):e.routerService.push("/")})(),e.routerService.push("/")),"update-now"===t&&await K.next(),"download-action"===t&&await b()}}),r?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):n?o(m,{children:[o(p,{handler:n,fields:C}),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),o(E,{})]})},isActive:t=>j(["/status/:id"],t)},{id:"main",element:()=>{const{classes:i}=G(),{reloadTrigger:n,doReload:c}=t();a(async()=>{const t=await e.statusViewService.getStatusList();if(1===t.length){const[{id:a}]=t;e.routerService.push(`/status/${a}`)}},{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[n]});const[b,{loading:y}]=a(async()=>await(async()=>{const[t,a]=await Promise.all([e.symbolGlobalService.getSymbolMap(),e.statusViewService.getStatusList()]);if(!a||0===a.length)return[{type:r.Typography,typoVariant:"h6",placeholder:"Listening for a pending signal...",sx:{textAlign:"center",opacity:.5,mt:4}}];const o={};a.forEach(a=>{const e=t[a.symbol],s=a.strategyName;o[s]||(o[s]=[]),o[s].push({symbol:a.symbol,label:(null==e?void 0:e.displayName)||a.symbol,color:(null==e?void 0:e.color)||"#ccc",to:a.id})});const s=Object.entries(o).sort(([,t],[,a])=>a.length-t.length),i=[],n=[],c=[];return s.forEach(([t,a],e)=>{const o=U(t,a);e%2==0?i.push(o):n.push(o),c.push(o)}),[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:i},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:c}]})(),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[n]});return o(F,{children:[o(s,{items:I,actions:T,onAction:t=>{"back-action"===t&&e.routerService.push("/"),"update-now"===t&&c()}}),y||!b?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):b.length?o(m,{children:[o(p,{className:i.root,fields:b},n),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:t=>j(["/status"],t)}],P=({id:t})=>o(R,{history:e.routerService,onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),routes:W,params:{id:t}});export{P as StatusPage,P as default};
@@ -0,0 +1 @@
1
+ import{f as e,c as t,r as n,i as r,S as o}from"./index-Ce2sQITf.js";const a=t(t=>e("div",{style:t.v0,children:[e("input",{type:"text",value:t.v1,onChange:t.v2,style:t.v3,placeholder:"BTCUSDT"}),e("select",{value:t.v4,onChange:t.v5,style:t.v6,children:t.v7}),e("input",{type:"date",value:t.v8,onChange:t.v9,style:t.v10,title:"From date"}),e("input",{type:"date",value:t.v11,onChange:t.v12,style:t.v13,title:"To date"}),e("button",{onClick:t.v14,disabled:t.v15,style:t.v16,children:t.v17}),t.v18]}),{name:"Toolbar_1",portals:["v7","v17","v18"]}),i=function({symbol:t,timeframe:n,fromDate:r,toDate:o,running:i,status:c,onSymbolChange:v,onTimeframeChange:d,onFromDateChange:h,onToDateChange:g,onRun:m}){return e(a,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:t,v2:e=>v(e.target.value.toUpperCase()),v3:{...s,width:100},v4:n,v5:e=>d(e.target.value),v6:s,v7:l.map(t=>e("option",{children:t},t)),v8:r,v9:e=>h(e.target.value),v10:u,v11:o,v12:e=>g(e.target.value),v13:u,v14:m,v15:i,v16:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v17:i?"...":"▶ Run",v18:c&&e("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:c})})},l=["1","5","15","60","D","W"],s={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},u={...s,colorScheme:"dark"},c=t(t=>e("textarea",{value:t.v0,onChange:t.v1,onKeyDown:t.v2,spellCheck:!1,style:t.v3}),{name:"CodeEditor_1"}),v=function({value:t,onChange:n,onRun:r}){return e(c,{v0:t,v1:e=>n(e.target.value),v2:e=>{e.ctrlKey&&"Enter"===e.key&&(e.preventDefault(),r())},v3:{width:320,flexShrink:0,resize:"none",background:"#1e293b",color:"#e2e8f0",border:"none",borderRight:"1px solid #334155",padding:12,fontFamily:"monospace",fontSize:13,lineHeight:1.5,outline:"none"}})},d={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h",360:"6h",480:"8h","1D":"1d",D:"1d","1W":"1w",W:"1w"};function h(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class g{async getMarketData(e,t,n,o,a){const i=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=d[t]??t;return(await r.exchangeViewService.getRangeCandles({symbol:i,interval:l,limit:n,sDate:o,eDate:a})).map(e=>({openTime:e.timestamp,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}))}async getSymbolInfo(e){const t=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),n=t.replace(/USDT$|BUSD$|USD$/,""),r=t.replace(n,"");return{ticker:t,tickerid:t,description:`${n}/${r}`,type:"crypto",basecurrency:n,currency:r||"USDT",timezone:"UTC"}}}const m=()=>e(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),p=t(t=>e("div",{style:t.v0,children:[t.v1,e("div",{style:t.v2,children:[t.v3,e("div",{style:t.v4,children:t.v5})]}),t.v6]}),{name:"PinePage_1",portals:["v1","v3","v5","v6"]}),f=()=>{const t=n.useRef(null),[r,o]=n.useState('//@version=5\nindicator("Simple MA", overlay=true)\n\nlength = input.int(20, "Length")\nsma = ta.sma(close, length)\n\nplot(sma, "SMA", color.blue, linewidth=2)'),[a,l]=n.useState("BTCUSDC"),[s,u]=n.useState("1"),[c,d]=n.useState(""),[f,y]=n.useState(""),{run:C,status:b,running:D}=function(){const e=n.useRef(null),t=n.useRef(null),r=n.useRef(null),[o,a]=n.useState(""),[i,l]=n.useState(!1);function s(){if(r.current){try{r.current.stop()}catch{}r.current=null}}function u(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function c(e){a(`Error: ${e.message}`),l(!1)}return n.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),s(),u()}},[]),{run:function({symbol:n,timeframe:o,fromDate:i,toDate:v,code:d,containerRef:m}){if(!m.current)return;l(!0),a("Connecting..."),s(),u();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(d);let f=!1;try{const s=i?new Date(i).getTime():void 0,u=v?new Date(v).getTime():void 0,y=new g,C=new PineTS(y,n,o,1e3,s,u).stream(d,{pageSize:500,live:!0,interval:3e3});r.current=C,C.on("data",i=>{var s,u;if(r.current===C)if(f)t.current&&i.plots&&t.current.updateData(i.plots),null==(u=e.current)||u.updateData([h(i.marketData[i.marketData.length-1])]);else{f=!0;const r=i.marketData.map(h);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${n} · ${o}`,backgroundColor:"#0f172a",height:"100%",padding:.1,databox:{position:"right",triggerOn:"mousemove"},dataZoom:{visible:!0,position:"top",height:6,start:80,end:101},layout:{mainPaneHeight:"70%",gap:5},controls:{collapse:!1,maximize:!1,fullscreen:!1}}),e.current.setMarketData(r);const u=(null==(s=i.fullContext)?void 0:s.plots)??i.plots;t.current=e.current.addIndicator("indicator",u,{overlay:p,height:p?void 0:30,controls:{collapse:!1,maximize:!1}}),e.current.registerPlugin(new QFChart.MeasureTool),e.current.registerPlugin(new QFChart.LineTool),e.current.registerPlugin(new QFChart.FibonacciTool),a(`${r.length} bars loaded`),l(!1)}}),C.on("error",c)}catch(y){c(y)}},status:o,running:i}}();function S(){C({symbol:a,timeframe:s,fromDate:c,toDate:f,code:r,containerRef:t})}return e(p,{v0:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},v1:e(i,{symbol:a,timeframe:s,fromDate:c,toDate:f,running:D,status:b,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:d,onToDateChange:y,onRun:S}),v2:{display:"flex",flex:1,overflow:"hidden"},v3:e(v,{value:r,onChange:o,onRun:S}),v4:{flex:1},v5:e("div",{ref:t,style:{width:"100%",height:"100%"},children:e("p",{style:{color:"#475569",textAlign:"center",marginTop:"20%"},children:["Press ",e("b",{children:"▶ Run"})," or ",e("b",{children:"Ctrl+Enter"})," to load the chart"]})}),v6:e(m,{})})};export{f as PinePage,f as default};
@@ -0,0 +1 @@
1
+ import{b as e,f as o,aR as t,Z as i,i as a,w as n,x as l,t as s,A as r,T as c,aS as p,y as d,B as m,F as u,K as h,L as b,N as y,O as f,R as g,k,l as v,Q as S,V as C,r as L,al as x,bg as w,bh as P,bi as T,bj as V,bk as $,bl as M,ae as H,a9 as z,$ as A,a0 as O,a_ as N,aO as _,aA as R,P as F,H as I,ah as j,bm as E,X as W,ar as D,as as U,aU as B,at as G,I as Y,au as K,D as J,aW as Q}from"./index-Ce2sQITf.js";import{h as X}from"./hasRouteMatch-CImjW4Jf.js";import{I as Z}from"./IconPhoto-DUgsqsYP.js";import{C as q,R as ee}from"./Refresh-aWduZclR.js";import{K as oe}from"./KeyboardArrowLeft-BlwcBPHn.js";const te=e([o("path",{d:"M5 19h14V5H5v14zm4-4h4v-2h-2v-2h2V9H9V7h4c1.1 0 2 .89 2 2v1.5c0 .83-.67 1.5-1.5 1.5.83 0 1.5.67 1.5 1.5V15c0 1.11-.9 2-2 2H9v-2z",opacity:".3"}),o("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z"})],"Looks3TwoTone"),ie=e([o("path",{d:"M19 5H5v14h14V5zm-5 12h-2V9h-2V7h4v10z",opacity:".3"}),o("path",{d:"M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm5 4h2v8h2V7h-4z"})],"LooksOneTwoTone"),ae=e([o("path",{d:"M19 5H5v14h14V5zm-4 6c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2v2z",opacity:".3"}),o("path",{d:"M5 21h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2zM5 5h14v14H5V5zm8 2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2z"})],"LooksTwoTwoTone"),ne="backtest-kit__groupHeader",le="backtest-kit__groupRoot",se="backtest-kit__symbolImage",re=s()({root:{[`& .${le}:hover .${ne}`]:{opacity:"1 !important"}}});function ce(e){return C(e,"#000000")>C(e,"#FFFFFF")}const pe=[{type:l.Link,action:"back-action",label:o(oe,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"}],de=[{action:"update-now",label:"Refresh",icon:()=>o(r,{icon:ee,color:"#4caf50"})}],me=e=>({type:h.Group,className:le,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:h.Component,className:ne,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(f,{direction:"row",children:[o(b,{variant:"outlined",size:"small",color:"info",label:`${y.bullet} Symbols`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(m,{flex:1})]})},{type:h.Group,fields:e.map(({symbol:e,label:t,color:i})=>((e,t,i)=>({type:h.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(S,{component:g,onClick:()=>{a.routerService.push(`/price_chart/${e.toLowerCase()}`)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${se}`]:{transition:"filter 500ms"},"&:hover":{background:()=>ce(i)?k(i,.33):v(i,.33),[`& .${se}`]:{transition:"filter 500ms",filter:ce(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(Z,{className:se,symbol:e}),children:t})}))(e,t,i))}]}),ue="backtest-kit__groupHeader",he="backtest-kit__groupRoot",be="backtest-kit__symbolImage",ye=s()({root:{[`& .${he}:hover .${ue}`]:{opacity:"1 !important"}}});function fe(e){return C(e,"#000000")>C(e,"#FFFFFF")}const ge=[{type:l.Link,action:"back-action",label:o(oe,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"},{type:l.Link,action:"back-action",compute:e=>String(e).toUpperCase()}],ke=(e,t)=>({type:h.Group,className:he,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:h.Component,className:ue,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(f,{direction:"row",children:[o(b,{variant:"outlined",size:"medium",color:"info",label:`${y.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(m,{flex:1})]})},{type:h.Group,fields:t.map(({label:e,to:t,color:i,icon:n})=>((e,t,i,n)=>({type:h.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(S,{component:g,onClick:()=>{a.routerService.push(e)},sx:{width:"100%",background:i,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${be}`]:{transition:"filter 500ms"},"&:hover":{background:()=>fe(i)?k(i,.33):v(i,.33),[`& .${be}`]:{transition:"filter 500ms",filter:fe(i)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:be}),children:t})}))(t,e,i,n))}]}),ve=s()({root:{position:"relative"},tooltip:{position:"absolute",margin:0,left:5,top:5,backgroundColor:"#343434",zIndex:999,color:"white",fontWeight:"bold",padding:"5px 10px",borderRadius:3,fontSize:"12px",pointerEvents:"none",touchAction:"none"}}),Se={layout:{textColor:"#d4d4d8",backgroundColor:"#ffffff"},rightPriceScale:{scaleMargins:{top:.3,bottom:.25}},crosshair:{vertLine:{width:4,color:"#ebe0e301",style:0},horzLine:{visible:!1,labelVisible:!1}},grid:{vertLines:{color:"#f8b3"},horzLines:{color:"#f8b3"}},handleScroll:{vertTouchDrag:!1}},Ce=({height:e,width:t,items:i,position:a,priceOpen:n,priceStopLoss:l,priceTakeProfit:s})=>{const{classes:r}=ve(),c=L.useRef(void 0),[p,d]=L.useState(null);return L.useLayoutEffect(()=>{const{current:o}=c,r=x(o,{...Se,width:t,height:e,crosshair:{mode:w.Normal,vertLine:{labelVisible:!1},horzLine:{visible:!1,labelVisible:!0}},timeScale:{timeVisible:!0,secondsVisible:!0,tickMarkFormatter:e=>{const o=i.find(o=>o.timestamp===Number(e))||i[0];if(!o||!o.timestamp)return"Invalid date";const t=H(o.timestamp);return t.isValid()?t.format("HH:mm:ss"):"Invalid date"}}}),p=r.addLineSeries({lastValueVisible:!1,color:P[400]}),m=i.map(e=>({time:Math.floor(e.timestamp),value:parseFloat(e.close)}));if(p.setData(m),a&&n){const e="long"===a?P[700]:V[700];p.createPriceLine({price:n,color:e,lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"long"===a?"LONG Entry":"SHORT Entry"})}return l&&p.createPriceLine({price:l,color:$[500],lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"SL"}),s&&p.createPriceLine({price:s,color:M[500],lineWidth:2,lineStyle:T.Solid,axisLabelVisible:!0,title:"TP"}),r.subscribeCrosshairMove(e=>{if(e.time){const o=i.find(o=>o.timestamp===Number(e.time));if(o){const e=H(o.timestamp).format("DD/MM/YYYY HH:mm:ss"),t=z(o.close.toFixed(6));d(`${e}: ${t}`)}else d(null)}else d(null)}),r.timeScale().fitContent(),()=>{r.remove()}},[e,t,i]),o("div",{ref:c,className:r.root,children:p&&o("div",{className:r.tooltip,children:p})})},Le={"1m":"#2979ff","15m":"#f3a43a","1h":"#d500f9"},xe={"1m":"1 minute","15m":"15 minutes","1h":"1 hour"};const we=({symbol:e,interval:t,reloadSubject:n,downloadSubject:l,onInfoClick:s,disableInfo:r,position:p,priceOpen:d,priceStopLoss:u,priceTakeProfit:h,sx:y})=>{const[f,{loading:g,execute:k}]=i(async()=>await a.exchangeViewService.getLastCandles(e,t),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e,t]}),v=A(f);O(()=>n.subscribe(k)),O(()=>l.subscribe(()=>{const{current:o}=v;!function(e,o="data.json"){const t=new Blob([e],{type:"application/json"}),i=window.URL.createObjectURL(t);a.layoutService.downloadFile(i,o)}(JSON.stringify(o,null,2),`${e}-${t}.json`)}));return o(F,{sx:{...y,display:"flex",flexDirection:"column",alignItems:"stretch",overflow:"clip"},children:[o(m,{sx:{background:Le[t]||"#607d8b",minHeight:"48px",display:"flex",alignItems:"center",pl:2,pr:1},children:[o(c,{variant:"h6",sx:{color:"white",fontWeight:"bold",mr:1},children:xe[t]||t}),!!p&&o(b,{variant:"filled",sx:{color:"white"},color:"short"===p?"warning":"success",label:String(p).toUpperCase()}),o(m,{sx:{flex:1}}),o(N,{disabled:r,onClick:s,children:o(_,{style:{color:"white",opacity:r?.5:1}})})]}),o(R,{}),!f||g?o(I,{sx:{height:"100%",width:"100%"}}):o(m,{sx:{position:"relative",flex:1},children:o(j,{style:{position:"absolute"},children:({height:e,width:t})=>o(Ce,{items:f,height:e,width:t,position:p,priceOpen:d,priceStopLoss:u,priceTakeProfit:h})})})]})},Pe=[{type:l.Link,action:"back-action",label:o(oe,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Main"},{type:l.Link,action:"back-action",label:"Price Chart"},{type:l.Link,action:"back-action",compute:({symbol:e})=>String(e).toUpperCase()},{type:l.Link,action:"back-action",compute:({interval:e})=>String(e).toUpperCase()}],Te=[{action:"download-now",label:"Download",icon:()=>o(r,{icon:J,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(r,{icon:ee,color:"#4caf50"})}],Ve=new W,$e=new W,Me=[{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"position",title:"Position",readonly:!0,compute:e=>"long"===e.position?"🔵 LONG (profit on rise)":"🟠 SHORT (profit on fall)"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceOpen",title:"Entry",readonly:!0,compute:e=>e.priceOpen?`${z(e.priceOpen)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceOpen",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalPriceOpen&&e.originalPriceOpen!==e.priceOpen,compute:e=>e.originalPriceOpen?`${z(e.originalPriceOpen)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceTakeProfit",title:"Take Profit",readonly:!0,compute:e=>e.priceTakeProfit?`${z(e.priceTakeProfit)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceTakeProfit",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalPriceTakeProfit&&e.originalPriceTakeProfit!==e.priceTakeProfit,compute:e=>e.originalPriceTakeProfit?`${z(e.originalPriceTakeProfit)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceStopLoss",title:"Stop Loss",readonly:!0,compute:e=>e.priceStopLoss?`${z(e.priceStopLoss)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalPriceStopLoss",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalPriceStopLoss&&e.originalPriceStopLoss!==e.priceStopLoss,compute:e=>e.originalPriceStopLoss?`${z(e.originalPriceStopLoss)}$`:"N/A"},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalEntries",title:"Total Entries",readonly:!0,isVisible:e=>null!=e.totalEntries&&e.totalEntries>1,compute:e=>String(e.totalEntries)},{type:h.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"totalPartials",title:"Total Closes",readonly:!0,isVisible:e=>null!=e.totalPartials&&e.totalPartials>0,compute:e=>String(e.totalPartials)},{type:h.Component,sx:{mt:2},element:({payload:e})=>o(S,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],He=[{id:"chart",element:({params:e})=>{const t=E(()=>({symbol:String(e.symbol).toUpperCase(),interval:e.interval})),[l,{loading:s,execute:r}]=i(async()=>{const o=String(e.symbol).toUpperCase();return await a.signalViewService.getPendingSignal(o)},{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[e.symbol]});O(()=>Ve.subscribe(r));const c=L.useMemo(()=>l?l.priceTakeProfit:0,[l]),p=L.useMemo(()=>l?l.priceStopLoss:0,[l]),d=L.useMemo(()=>l?l.priceOpen:0,[l]),m=L.useMemo(()=>l?l.position:null,[l]),[u,h]=D(null),{pickData:b,setOpen:y,render:g}=U({title:"Info",AfterTitle:({onClose:e})=>o(f,{direction:"row",gap:2,children:[o(G,{onClick:()=>a.layoutService.pickSignal(u.current.id),variant:"outlined",children:"Show Details"}),o(Y,{size:"small",onClick:e,children:o(K,{})})]}),payload:()=>({handleClose(){y(!1)}}),fields:Me,handler:()=>u.current,withActionButton:!1}),k=B(async()=>{l&&(h(l),b(l.id))});return o(q,{children:[o(n,{items:Pe,actions:Te,payload:t,onAction:async o=>{"back-action"===o&&a.routerService.push(`/price_chart/${e.symbol}`),"update-now"===o&&await Ve.next(),"download-now"===o&&await $e.next()}}),s?null:o(we,{symbol:t.symbol,interval:t.interval,disableInfo:!l,reloadSubject:Ve,downloadSubject:$e,onInfoClick:k,position:m,priceOpen:d,priceStopLoss:p,priceTakeProfit:c,sx:{height:"calc(100dvh - 165px)"}}),g()]})},isActive:e=>X(["/price_chart/:symbol/:interval"],e)},{id:"coin",element:({params:e})=>{const{classes:t}=ye(),i=e.symbol,l=L.useMemo(()=>[{label:"1 minute",to:`/price_chart/${i}/1m`,color:"#2979ff",icon:ie},{label:"15 minutes",to:`/price_chart/${i}/15m`,color:"#f3a43a",icon:ae},{label:"1 hour",to:`/price_chart/${i}/1h`,color:"#d500f9",icon:te}],[i]),s=L.useMemo(()=>[ke("Chart",l)],[l]);return o(q,{children:[o(n,{items:ge,payload:i,onAction:e=>{"back-action"===e&&a.routerService.push("/price_chart")}}),o(d,{className:t.root,fields:s}),o(m,{paddingBottom:"24px"})]})},isActive:e=>X(["/price_chart/:symbol"],e)},{id:"main",element:()=>{const{classes:e}=re(),{reloadTrigger:l,doReload:s}=t(),[r,{loading:h}]=i(async()=>await(async()=>{const[e,o]=await Promise.all([a.symbolGlobalService.getSymbolList(),a.symbolGlobalService.getSymbolMap()]),t=e.map(e=>{const t=o[e];return{symbol:e,label:(null==t?void 0:t.displayName)||e,color:(null==t?void 0:t.color)||"#ccc"}});return t.length?[me(t)]:[]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[l]});return o(q,{children:[o(n,{items:pe,actions:de,onAction:e=>{"back-action"===e&&a.routerService.push("/"),"update-now"===e&&s()}}),h||!r?o(p,{children:o(c,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):r.length?o(u,{children:[o(d,{className:e.root,fields:r},l),o(m,{paddingBottom:"24px"})]}):o(p,{children:o(c,{variant:"h6",sx:{opacity:.5},children:"No symbols found"})})]})},isActive:e=>X(["/price_chart"],e)}],ze=({symbol:e,interval:t})=>o(Q,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:He,params:{symbol:e,interval:t}});export{ze as PriceChartPage,ze as default};
@@ -0,0 +1 @@
1
+ import{b as e,f as a,X as o,x as t,w as n,D as i,A as r,Y as s,Z as l,i as c,$ as d,a0 as p,a1 as h,J as m,a2 as b,a3 as u,a4 as g,B as y,T as v,a5 as x,k as f,l as k,a6 as S,V as w,a7 as L,a8 as P,a9 as R,I as $,aa as z,F as D,ab as j,ac as C}from"./index-Ce2sQITf.js";import{R as T,C as W}from"./Refresh-aWduZclR.js";import{K as F}from"./KeyboardArrowLeft-BlwcBPHn.js";import{I as O}from"./IconPhoto-DUgsqsYP.js";import{B as A}from"./Background-COpkJTP-.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),V=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),E=new o,H=[{type:t.Link,action:"back-action",label:a(F,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"}],I=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:B,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:V,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:T,color:"#4caf50"})}],M=()=>a(n,{items:H,actions:I,onAction:E.next});const N=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:j}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),C=d(i),T=d(e);p(()=>E.subscribe(e=>{if("update-now"===e&&j(),"download-action"===e){const e=new Blob([JSON.stringify(C.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${T.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${T.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const W=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),F=e=>{const o=W[e]||[];return o.length?a(D,{children:o.map((o,t)=>{return a(L,{sx:{background:e=>t%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(o.id),children:[a(u,{primary:a(y,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:P("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",t+1]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===o.position?"#1976D2":"#F57C00",color:"white"},children:"long"===o.position?"LONG":"SHORT"}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),R(o.priceOpen),"$",o.originalPriceOpen!==o.priceOpen&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(o.originalPriceOpen),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),R(o.priceTakeProfit),"$",o.originalPriceTakeProfit!==o.priceTakeProfit&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(o.originalPriceTakeProfit),"$"]})]}),a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),R(o.priceStopLoss),"$",o.originalPriceStopLoss!==o.priceStopLoss&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(o.originalPriceStopLoss),"$"]})]}),"pnl"in o&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),R(o.pnl.pnlEntries),"$"]}),"pnl"in o&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:o.pnl.pnlPercentage>=0?P("#4caf50",.15):P("#f44336",.15),color:o.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",o.pnl.pnlPercentage>=0?"+":"",o.pnl.pnlPercentage.toFixed(2),"%"," / ",o.pnl.pnlCost>=0?"+":"",R(o.pnl.pnlCost),"$"]}),o.totalEntries>1&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",o.totalEntries]}),o.totalPartials>0&&a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",o.totalPartials]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===o.status?P("#4caf50",.2):"scheduled"===o.status?P("#ff9800",.2):"closed"===o.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===o.status?"#2e7d32":"scheduled"===o.status?"#e65100":"closed"===o.status?"#616161":"#c62828"},children:o.status})]}),secondary:a(v,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(n=o.createdAt,new Date(n).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}-${o.id}`);var n})}):a(b,{children:a(u,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[W],children:async()=>{const o=Object.keys(W),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=null==(o=t[e])?void 0:o.color,s=(null==(n=W[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(O,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:x(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:F(e)})]})},`section-${e}`);var l}):a(b,{children:a(u,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=C(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:N,isActive:e=>J(["/backtest"],e)},{id:"live",element:N,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(W,{children:[a(j,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:M,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(A,{})]})};export{X as OverviewPage,X as default};
@@ -0,0 +1 @@
1
+ import{b as e,f as a,r as t,b6 as i,b7 as o,Z as r,i as s,b8 as n,b9 as c,ba as l,I as d,au as p,aQ as h,bb as u,t as m,a8 as b,bc as f,H as y,T as g,aS as x,a2 as v,R as w,bd as S,a3 as L,be as k,aM as A,z as j,a0 as C,X as z,w as N,x as H,aX as R,B as E,A as M,aW as T}from"./index-Ce2sQITf.js";import{h as I}from"./hasRouteMatch-CImjW4Jf.js";import{B as V}from"./Background-COpkJTP-.js";import{A as B}from"./Article-DYhWfFAi.js";import{C as D,R as F}from"./Refresh-aWduZclR.js";import{K}from"./KeyboardArrowLeft-BlwcBPHn.js";const W=e(a("path",{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}),"Image"),X=e(a("path",{d:"M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"}),"InsertDriveFile"),P="65px",O=e=>e.mimeType.startsWith("image/")?a(W,{sx:{color:"#f57c00",fontSize:20}}):"application/json"===e.mimeType?a(j,{sx:{color:"#7b1fa2",fontSize:20}}):e.mimeType.startsWith("text/")?a(B,{sx:{color:"#1976d2",fontSize:20}}):a(X,{sx:{color:"#546e7a",fontSize:20}}),Q=m()(e=>({root:{position:"relative",height:"100%",width:"100%",background:"#eee",overflow:"clip"},header:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",paddingLeft:"8px",paddingRight:"4px",height:P},input:{height:P,paddingRight:e.spacing(2),paddingLeft:e.spacing(1),width:"100%"},container:{position:"absolute",top:P,left:0,right:0,bottom:0,height:`calc(100% - ${P})`,width:"100%",background:"white",overflow:"clip",display:"flex",alignItems:"stretch",justifyContent:"stretch"},content:{display:"flex",flex:1},loader:{height:"100%",width:"100%"},accent:{background:b("#00c3ff",.05)}})),Z=({outlinePaper:e,className:m,style:b,sx:j,nodes:C,initialSearch:z=""})=>{const{classes:N,cx:H}=Q(),[R,E]=t.useState(z),M=i(R),[T,{flush:I}]=o(R,2500),[V,{loading:B}]=r(async()=>await(async(e,a)=>{const t=e.trim().toLowerCase(),i=[];let o=0;for(const r of s.explorerHelperService.deepFlat(a))if("file"!==r.type||t&&!r.path.toLowerCase().includes(t)||i.push(r),++o%1e4==0&&await f(0),i.length>25e3)break;return i})(T,C),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),deps:[T,C]}),{execute:D}=n(async e=>{await s.layoutService.pickDumpContent(e)},{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});return a(u,{outlinePaper:e,className:H(N.root,m),style:b,sx:j,children:[a("div",{className:N.header,children:a(c,{disabled:B,className:N.input,endAdornment:a(l,{position:"end",children:a(d,{disabled:B||!R,onClick:()=>{M.once(async()=>{await f(500),I()}),E("")},edge:"end",children:a(R?p:h,{})})}),placeholder:"Search",value:R,onBlur:()=>I(),onChange:({target:e})=>E(e.value),onKeyDown:({key:e,currentTarget:a})=>"Enter"===e&&a.blur()})}),a("div",{className:N.container,children:a("div",{className:N.content,children:V?V.length?a(A,{withScrollbar:!0,children:V.map((e,t)=>a(v,{className:H({[N.accent]:t%2==1}),component:w,onClick:()=>(async e=>{await D(e)})(e.id),children:[a(S,{children:O(e)}),a(L,{primary:e.label,secondary:e.path}),a(k,{content:e.path,label:"Copy path"})]},e.id))}):a(x,{sx:{height:"100%",width:"100%"},children:a(g,{variant:"h6",sx:{opacity:.5},children:"Not found"})}):a(y,{className:N.loader})})})]})},$=[{type:H.Link,action:"back-action",label:a(K,{sx:{display:"block"}})},{type:H.Link,action:"back-action",label:"Main"},{type:H.Link,action:"back-action",label:"Dump Explorer"}],q=[{action:"update-now",label:"Refresh",icon:()=>a(M,{icon:F,color:"#4caf50"})}],G=new z,J=({params:e})=>{const[t,{loading:i,execute:o}]=r(async()=>await s.explorerViewService.getFolderTree(),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});C(()=>G.subscribe(o));return a(D,{children:[a(N,{items:$,actions:q,onAction:e=>{"back-action"===e&&s.routerService.push("/"),"update-now"===e&&(s.explorerViewService.clear(),G.next())}}),a(R,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(E,{pr:2,pl:2,children:i||!t?a(x,{children:a(g,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):a(Z,{nodes:t,initialSearch:e.search})})}),a(V,{})]})},U=[{id:"search",element:J,isActive:e=>I(["/dump/:search"],e)},{id:"main",element:J,isActive:e=>I(["/dump"],e)}],Y=({search:e=""})=>a(T,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:U,params:{search:e}});export{Y as DumpPage,Y as default};
@@ -0,0 +1 @@
1
+ import{b as a,f as t,T as e,N as o,bf as n,K as i,P as l,t as r,Z as c,i as s,a0 as d,w as p,x as h,z as m,A as y,E as w,G as u,H as x,y as f,aX as b,v as g,aW as v}from"./index-Ce2sQITf.js";import{h as S}from"./hasRouteMatch-CImjW4Jf.js";import{r as L}from"./emitters-CSLNlyHG.js";import{I as k}from"./IconPhoto-DUgsqsYP.js";import{C as D,R}from"./Refresh-aWduZclR.js";import{K as A}from"./KeyboardArrowLeft-BlwcBPHn.js";const N=a(t("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined"),j=r()(a=>({root:{position:"relative",background:"#0001",overflow:"clip"},header:{position:"absolute",top:0,left:0,height:"48px",width:"calc(100% - 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",marginLeft:"8px",marginRight:"8px"},container:{marginTop:"48px",width:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},content:{display:"flex",width:"100%",padding:a.spacing(1),paddingBottom:a.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),V=[{type:i.Text,name:"totalPnl",title:"Total PNL",compute:a=>null!==a.totalPnl?`${a.totalPnl.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"winRate",title:"Win Rate",compute:a=>null!==a.winRate?`${a.winRate.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"profitFactor",title:"Profit Factor",compute:a=>null!==a.profitFactor?a.profitFactor.toFixed(2):"N/A",readonly:!0},{type:i.Text,columns:"6",name:"maxDrawdown",title:"Max Drawdown",compute:a=>null!==a.maxDrawdown?`${a.maxDrawdown.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,columns:"6",name:"expectancy",title:"Expectancy",compute:a=>null!==a.expectancy?`${a.expectancy.toFixed(2)}%`:"N/A",readonly:!0},{type:i.Text,fieldBottomMargin:"0",name:"totalTrades",title:"Trades",readonly:!0}],F=({row:a})=>{const{classes:i}=j();return t(l,{className:i.root,children:[t("div",{className:i.header,children:t(e,{variant:"h6",sx:{opacity:.8},children:`${o.bullet} ${a.symbol}`})}),t("div",{className:i.container,children:t("div",{className:i.content,children:[t("div",{className:i.avatar,children:t(k,{symbol:a.symbol,sx:{width:128,height:128}})}),t(n,{handler:()=>a,fields:V,sx:{mb:2}})]})})]})},H=[{type:h.Link,action:"back-action",label:t(A,{sx:{display:"block"}})},{type:h.Link,action:"back-action",label:"Dashboard"},{type:h.Link,action:"back-action",label:"Heatmap"},{type:h.Button,action:"download-pdf",label:"Download PDF",icon:N}],T=[{action:"download-json",label:"Download JSON",icon:()=>t(y,{icon:m,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(y,{icon:w,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(y,{icon:u,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(y,{icon:R,color:"#4caf50"})}],P=[{id:"main",element:()=>{const[a,{loading:e,execute:o}]=c(async()=>(a=>{if(!a.length)return[{type:i.Typography,typoVariant:"h6",placeholder:"No data",sx:{textAlign:"center",opacity:.5,mt:4}}];const e=a.map(a=>({type:i.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:i.Component,element:()=>t(F,{row:a})}}));return e.length>2?e:[{type:i.Center,sx:a=>({[a.breakpoints.up("lg")]:{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}),fields:e}]})((await s.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});d(()=>L.subscribe(o));return t(D,{children:[t(p,{items:H,actions:T,onAction:async a=>{"back-action"===a&&s.routerService.push("/"),"update-now"===a&&await L.next(),"download-markdown"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatReport(),t=new Blob([a],{type:"text/plain"}),e=URL.createObjectURL(t);s.layoutService.downloadFile(e,`heat_${Date.now()}.md`)})(),"download-pdf"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatReport();await g(a)})(),"download-json"===a&&await(async()=>{const a=await s.heatViewService.getStrategyHeatData(),t=JSON.stringify(a,null,2),e=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(e);s.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!a||e?t(x,{sx:{height:"calc(100dvh - 165px)"}}):t(b,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:t(f,{fields:a})})]})},isActive:a=>S(["/heat"],a)}],z=({id:a})=>t(v,{history:s.routerService,onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),routes:P,params:{id:a}});export{z as HeatPage,z as default};