@backtest-kit/ui 15.2.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-BXBHQ9ZL.js → Article-DL41GA0a.js} +1 -1
- package/build/modules/frontend/build/assets/{Background-z2hZ5vrs.js → Background-DhTBM0kG.js} +1 -1
- package/build/modules/frontend/build/assets/{IconPhoto-DBNRgcFh.js → IconPhoto-CGT-L09K.js} +1 -1
- package/build/modules/frontend/build/assets/{KeyboardArrowLeft-BcNNsJIG.js → KeyboardArrowLeft-CF6hGzGl.js} +1 -1
- package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-z3cPPLwg.js → PictureAsPdfOutlined-C2rlUSVJ.js} +1 -1
- package/build/modules/frontend/build/assets/{Refresh-BIf7i5Ab.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-Bo3n95qK.js → hasRouteMatch-Bc6IBTG4.js} +1 -1
- package/build/modules/frontend/build/assets/{html2canvas-C4HtshZG.js → html2canvas-BrRQKwKk.js} +1 -1
- package/build/modules/frontend/build/assets/index-BQ4Egk78.js +1 -0
- package/build/modules/frontend/build/assets/index-BUhmLJSw.js +1 -0
- package/build/modules/frontend/build/assets/index-BZjEYFfO.js +1 -0
- package/build/modules/frontend/build/assets/index-C-FMDM09.js +1 -0
- package/build/modules/frontend/build/assets/{index-DQ0Y8Jqw.js → index-CJlJOSPg.js} +65 -65
- package/build/modules/frontend/build/assets/index-Cfpamomx.js +1 -0
- package/build/modules/frontend/build/assets/index-ChUhZnIE.js +1 -0
- package/build/modules/frontend/build/assets/index-ClGONTx7.js +1 -0
- package/build/modules/frontend/build/assets/index-D5RN2bOA.js +1 -0
- package/build/modules/frontend/build/assets/index-DvkcUAiy.js +1 -0
- package/build/modules/frontend/build/assets/index-Loobwod7.js +1 -0
- package/build/modules/frontend/build/assets/index-NOH2rGyk.js +1 -0
- package/build/modules/frontend/build/assets/index-ffa7_jT3.js +1 -0
- package/build/modules/frontend/build/assets/{index.es-CJnIp80N.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-k6IxEkD1.js +0 -1
- package/build/modules/frontend/build/assets/index-BGmWtYij.js +0 -1
- package/build/modules/frontend/build/assets/index-BJmac5su.js +0 -1
- package/build/modules/frontend/build/assets/index-CQ30d87p.js +0 -1
- package/build/modules/frontend/build/assets/index-CehzP5XN.js +0 -1
- package/build/modules/frontend/build/assets/index-ChQMz8hn.js +0 -1
- package/build/modules/frontend/build/assets/index-Ci4nukts.js +0 -1
- package/build/modules/frontend/build/assets/index-CiWEd_QA.js +0 -1
- package/build/modules/frontend/build/assets/index-DVjpvdFy.js +0 -1
- package/build/modules/frontend/build/assets/index-DlJ97jds.js +0 -1
- package/build/modules/frontend/build/assets/index-Dwx5drMf.js +0 -1
- package/build/modules/frontend/build/assets/index-ckg1rLeX.js +0 -1
- package/build/modules/frontend/build/assets/index-wK67zULN.js +0 -1
- package/build/modules/frontend/build/assets/markdownit-BafkpXSa.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as c,f as v}from"./index-
|
|
1
|
+
import{d as c,f as v}from"./index-CJlJOSPg.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};
|
package/build/modules/frontend/build/assets/{Background-z2hZ5vrs.js → Background-DhTBM0kG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as n,S as o}from"./index-
|
|
1
|
+
import{f as n,S as o}from"./index-CJlJOSPg.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e,i as t,B as r,
|
|
1
|
+
import{f as e,i as t,B as r,X as s}from"./index-CJlJOSPg.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{d as o,f as r}from"./index-
|
|
1
|
+
import{d as o,f as r}from"./index-CJlJOSPg.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{d as h,f as c}from"./index-
|
|
1
|
+
import{d as h,f as c}from"./index-CJlJOSPg.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bJ as e,e as t,r as a,_ as s,f as i,bK as n,j as o,bL as r,k as d,bM as m,g as u,u as p,s as x,d as c}from"./index-CJlJOSPg.js";const h=e(),l=["className","component","disableGutters","fixed","maxWidth","classes"],b=m(),f=h("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:b});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:c,component:h="div",disableGutters:b=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,l),k=t({},r,{component:h,disableGutters:b,fixed:f,maxWidth:g}),S=((e,t)=>{const{classes:a,fixed:s,disableGutters:i,maxWidth:n}=e,r={root:["root",n&&`maxWidth${o(String(n))}`,s&&"fixed",i&&"disableGutters"]};return d(r,e=>u(t,e),a)})(k,p);return i(x,t({as:h,ownerState:k,className:n(S.root,c),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})}),k=c(i("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{W as C,k as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a9 as o}from"./index-CJlJOSPg.js";const r=new o;export{r};
|
package/build/modules/frontend/build/assets/{hasRouteMatch-Bo3n95qK.js → hasRouteMatch-Bc6IBTG4.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as a,
|
|
1
|
+
import{i as a,bH as e,bI as t}from"./index-CJlJOSPg.js";const i=(i,o=a.routerService.location.pathname)=>!!e(t.filter(({path:a})=>i.includes(a)),o);export{i as h};
|
package/build/modules/frontend/build/assets/{html2canvas-C4HtshZG.js → html2canvas-BrRQKwKk.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bN as e,bO as t}from"./index-CJlJOSPg.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{f as e,b8 as t,M as a,t as i,B as r,v as o,bk as n,i as l,bl as s,x as d,b4 as c,bm as w,Z as p,$ as h,a0 as m,a1 as k,b1 as g,bn as b,aI as v,bo as y,av as u,bi as f,b6 as S,ad as x,J as _,bp as N,ax as D,y as V,z as O,A as R,V as L,W as B,q as A,a3 as P,T as C,b3 as $,Y as J,w as M,a4 as j,K as G,a6 as X,m as F,n as H,a5 as I,a7 as E,aj as z}from"./index-CJlJOSPg.js";import{h as T}from"./hasRouteMatch-Bc6IBTG4.js";import{I as U}from"./IconPhoto-CGT-L09K.js";import{C as K,R as W}from"./Refresh-BEzkJ_ge.js";import{K as q}from"./KeyboardArrowLeft-CF6hGzGl.js";const Y=[{id:"backtest",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:o})=>e(r,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:o||i("# No data")}),e(r,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Z=[{id:"backtest",label:i("Backtest"),isVisible:({type:e})=>"backtest"===e},{id:"live",label:i("Live"),isVisible:({type:e})=>"live"===e},{id:"strategy",label:i("Strategy")},{id:"breakeven",label:i("Breakeven")},{id:"risk",label:i("Risk")},{id:"partial",label:i("Partial")},{id:"highest_profit",label:i("Highest Profit")},{id:"max_drawdown",label:i("Max Drawdown")},{id:"schedule",label:i("Schedule")},{id:"performance",label:i("Performance")},{id:"sync",label:i("Sync")},{id:"heat",label:i("Heat")}],Q=({disabled:t,className:a,style:r,sx:c,onClick:w,color:p})=>e(s,{className:a,style:r,sx:c,disabled:t,color:p,size:36,onClick:async e=>{const[t,{resolve:a}]=n();e.preventDefault(),e.stopPropagation(),await w(e,e=>a(e));const r=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await d(String(e))})(r),l.alertService.notify(i("Copied!"))},children:e(o,{})}),ee=[{action:"json",label:i("Download JSON"),icon:()=>e(h,{icon:p,color:"#4caf50"})},{action:"markdown",label:i("Download Markdown"),icon:()=>e(h,{icon:m,color:"#4caf50"})},{action:"pdf",label:i("Download PDF"),icon:()=>e(h,{icon:k,color:"#4caf50"})}],te=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(w,{transparent:!0,className:a,style:i,sx:r,disabled:t,options:ee,onAction:s})},ae=u(),ie=D(async(e,t)=>{const a=("backtest"===t?await l.backtestGlobalService.list():await l.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:n}=a,[s,d,c,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?l.markdownViewService.getBacktestReport(i,r,o,n):Promise.resolve(""),"live"===t?l.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),l.markdownViewService.getBreakevenReport(i,r,o,n,"backtest"===t),l.markdownViewService.getRiskReport(i,r,o,n,"backtest"===t),l.markdownViewService.getPartialReport(i,r,o,n,"backtest"===t),l.markdownViewService.getHighestProfitReport(i,r,o,n,"backtest"===t),l.markdownViewService.getMaxDrawdownReport(i,r,o,n,"backtest"===t),l.markdownViewService.getScheduleReport(i,r,o,n,"backtest"===t),l.markdownViewService.getPerformanceReport(i,r,o,n,"backtest"===t),l.markdownViewService.getSyncReport(i,r,o,n,"backtest"===t),l.markdownViewService.getHeatReport(r,o,n,"backtest"===t),l.markdownViewService.getStrategyReport(i,r,o,n,"backtest"===t)]);return{type:t,backtest:s,live:d,breakeven:c,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:y}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),re=()=>{const[t,a]=g(""),[o,n]=g("backtest"),d=b(),{push:c,pop:w}=d,[p,h]=v(ae.location.pathname),m=async()=>{const e=(await ie(t.current,o.current))[p.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},k=async()=>{const e=await ie(t.current,o.current),a=p.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);l.layoutService.downloadFile(t,`${a}_${o.current}_${Date.now()}.md`)}},u=async()=>{const e=("backtest"===o.current?await l.backtestGlobalService.list():await l.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:r,frameName:n}=e,s=p.current.replace("/markdown_report/",""),d="backtest"===o.current;let c;if("backtest"===s?c=await l.markdownViewService.getBacktestData(a,i,r,n):"live"===s?c=await l.markdownViewService.getLiveData(a,i,r):"breakeven"===s?c=await l.markdownViewService.getBreakevenData(a,i,r,n,d):"risk"===s?c=await l.markdownViewService.getRiskData(a,i,r,n,d):"partial"===s?c=await l.markdownViewService.getPartialData(a,i,r,n,d):"highest_profit"===s?c=await l.markdownViewService.getHighestProfitData(a,i,r,n,d):"max_drawdown"===s?c=await l.markdownViewService.getMaxDrawdownData(a,i,r,n,d):"schedule"===s?c=await l.markdownViewService.getScheduleData(a,i,r,n,d):"performance"===s?c=await l.markdownViewService.getPerformanceData(a,i,r,n,d):"sync"===s?c=await l.markdownViewService.getSyncData(a,i,r,n,d):"heat"===s?c=await l.markdownViewService.getHeatData(i,r,n,d):"strategy"===s&&(c=await l.markdownViewService.getStrategyData(a,i,r,n,d)),void 0!==c){const e=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);l.layoutService.downloadFile(t,`${s}_${o.current}_${Date.now()}.json`)}},{pickData:D,render:O}=y({tabs:Z,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),h(a)},animation:"none",title:i("Markdown Report"),sizeRequest:f,history:ae,routes:Y,BeforeTitle:({onClose:t})=>{const{total:a}=b();return e(r,{sx:{mr:1,display:1===a?"none":"flex"},children:e(s,{onClick:t,children:e(N,{})})})},AfterTitle:({onClose:a})=>e(_,{direction:"row",gap:1,children:[e(s,{sx:{mr:"10px"},onClick:()=>m(),children:e(S,{})}),e(Q,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await l.backtestGlobalService.list():await l.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:n,exchangeName:s,frameName:d}=r,c="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await l.markdownViewService.getBacktestData(o,n,s,d),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await l.markdownViewService.getLiveData(o,n,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await l.markdownViewService.getBreakevenData(o,n,s,d,c),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await l.markdownViewService.getRiskData(o,n,s,d,c),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await l.markdownViewService.getPartialData(o,n,s,d,c),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await l.markdownViewService.getHighestProfitData(o,n,s,d,c),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await l.markdownViewService.getMaxDrawdownData(o,n,s,d,c),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await l.markdownViewService.getScheduleData(o,n,s,d,c),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await l.markdownViewService.getPerformanceData(o,n,s,d,c),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await l.markdownViewService.getSyncData(o,n,s,d,c),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await l.markdownViewService.getHeatData(n,s,d,c),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await l.markdownViewService.getStrategyData(o,n,s,d,c),null,2))})(p.current,t.current,o.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(te,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:u,onDownloadMarkdown:k,onDownloadPdf:m}),e(s,{onClick:a,children:e(x,{})})]}),fetchState:async()=>await ie(t.current,o.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:d,sync:c,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:d,sync:c,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>l.layoutService.setAppbarLoader(!0),onLoadEnd:()=>l.layoutService.setAppbarLoader(!1),onClose:()=>{w()}});return(e,t)=>{c({id:"markdown_report_modal",render:O,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";ae.push(e),h(e)},onMount:()=>{a(e),n(t),D()}})}},oe="backtest-kit__groupHeader",ne="backtest-kit__groupRoot",le="backtest-kit__symbolImage",se=A()({root:{[`& .${ne}:hover .${oe}`]:{opacity:"1 !important"}}});function de(e){return E(e,"#000000")>E(e,"#FFFFFF")}const ce=[{type:B.Link,action:"back-action",label:e(q,{sx:{display:"block"}})},{type:B.Link,action:"back-action",label:i("Main")},{type:B.Link,action:"back-action",label:i("Markdown Report")}],we=[{action:"update-now",label:i("Refresh"),icon:()=>e(h,{icon:W,color:"#4caf50"})}],pe=(t,a)=>({type:P.Group,className:ne,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:P.Component,className:oe,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(_,{direction:"row",children:[e(j,{variant:"outlined",size:"small",color:"info",label:`${G.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(r,{flex:1})]})},{type:P.Group,fields:a.map(({symbol:t,label:a,id:i,type:o,color:n})=>((t,a,i,o,n)=>({type:P.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:l})=>e(I,{component:X,onClick:()=>{l.handleOpen(t,a)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${le}`]:{transition:"filter 500ms"},"&:hover":{background:()=>de(n)?F(n,.33):H(n,.33),[`& .${le}`]:{transition:"filter 500ms",filter:de(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(U,{className:le,symbol:i}),children:e(r,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(i,o,t,a,n))}]}),he=[{id:"main",element:()=>{const{classes:t}=se(),{reloadTrigger:a,doReload:o}=O(),[n,{loading:s}]=R(async()=>await(async()=>{const[e,t,a]=await Promise.all([l.symbolGlobalService.getSymbolMap(),l.backtestGlobalService.list(),l.liveGlobalService.list()]),r={},o={};t.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.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",id:t.id,type:"live"})});const n=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>pe(e,t)),s=Object.entries(o).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>pe(e,t));return s.length||n.length?[{type:P.Fragment,isVisible:()=>!!n.length,fields:[{type:P.Line,title:i("Backtest")},{type:P.Group,columns:"12",fields:n}]},{type:P.Fragment,isVisible:()=>!!s.length,fields:[{type:P.Line,title:i("Live")},{type:P.Group,columns:"12",fields:s}]}]:[]})(),{onLoadStart:()=>l.layoutService.setAppbarLoader(!0),onLoadEnd:()=>l.layoutService.setAppbarLoader(!1),deps:[a]}),d=re(),c=(e,t)=>{d(e,t)};return e(K,{children:[e(L,{items:ce,actions:we,onAction:e=>{"back-action"===e&&l.routerService.push("/"),"update-now"===e&&o()}}),s||!n?e($,{children:e(C,{variant:"h6",sx:{opacity:.5},children:i("Loading...")})}):n.length?e(M,{children:[e(J,{className:t.root,fields:n,payload:()=>({handleOpen:c})},a),e(r,{paddingBottom:"24px"})]}):e($,{children:e(C,{variant:"h6",sx:{opacity:.5},children:i("No pending signals")})})]})},isActive:e=>T(["/report"],e)}],me=({id:t})=>e(z,{history:l.routerService,onLoadStart:()=>l.layoutService.setAppbarLoader(!0),onLoadEnd:()=>l.layoutService.setAppbarLoader(!1),routes:he,params:{id:t}});export{me as StatusPage,me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a,f as e,a_ as t,B as o,J as r,aa as n,T as i,O as s,a4 as c,w as l,N as d,l as h,aO as p,b0 as u,b1 as w,aG as b,a9 as f,i as x,aH as g,al as y,aL as v,V as m,W as S,b2 as L,a$ as k,D as j,$ as A,t as z}from"./index-CJlJOSPg.js";import{A as H}from"./Article-DL41GA0a.js";import{C as R,R as C}from"./Refresh-BEzkJ_ge.js";import{K as B}from"./KeyboardArrowLeft-CF6hGzGl.js";const D=a(e("path",{d:"M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"}),"BugReport"),E=a=>{const t={color:"white",fontSize:28};switch(a.type){case"debug":return e(D,{sx:t});case"info":return e(u,{sx:t});case"warn":return e(p,{sx:t});default:return e(H,{sx:t})}},M=t.virtualize(({data:a,sx:t})=>{const p=(a=>{switch(a.type){case"debug":default:return"#9E9E9E";case"info":return"#2196F3";case"warn":return"#FF9800";case"log":return"#4CAF50"}})(a);return e(h,{variant:"outlined",sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",...t},children:e(o,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[e(r,{direction:"row",spacing:2,sx:{p:2},children:[e(n,{sx:{width:56,height:56,background:p},children:E(a)}),e(r,{flex:1,spacing:1,children:[e(r,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[e(i,{variant:"h6",sx:{fontWeight:600,wordBreak:"break-all"},children:a.topic}),e(i,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:s(a.createdAt).format("HH:mm DD/MM/YYYY")})]}),e(r,{direction:"row",spacing:1,flexWrap:"wrap",children:e(c,{size:"small",label:a.type.toUpperCase(),sx:{background:p,color:"white",fontWeight:500}})}),a.args.length>0&&e(l,{children:[e(d,{sx:{my:1}}),e(o,{component:"pre",sx:{m:0,fontSize:"0.75rem",whiteSpace:"pre-wrap",wordBreak:"break-all",color:"text.secondary"},children:JSON.stringify(1===a.args.length?a.args[0]:a.args,null,2)})]})]})]}),e(o,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:p}})]})})}),F=[{action:"download-action",label:z("Download"),icon:()=>e(A,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:z("Refresh manually"),icon:()=>e(A,{icon:C,color:"#4caf50"})}],O=[{type:S.Link,action:"back-action",label:e(B,{sx:{display:"block"}})},{type:S.Link,action:"back-action",label:z("Main")},{type:S.Link,action:"back-action",label:z("Logs")},{type:S.Button,icon:L,action:"search-action",label:z("Search")}],W=new f,Y=()=>{const[a,o]=w(""),{data:r,hasMore:n,loading:i,onSkip:s}=b({handler:async(e,t)=>{const o=await x.logViewService.getList(),r=g(e,t);for(const n of o)if(new RegExp(a.current,"i").test(n.topic)&&r([n]).done)break;return r().rows},onLoadStart:()=>x.layoutService.setAppbarLoader(!0),onLoadEnd:()=>x.layoutService.setAppbarLoader(!1),reloadSubject:W}),c=y(r),{execute:l}=v(async()=>{const a=new Blob([JSON.stringify(c.current,null,2)],{type:"application/json"}),e=URL.createObjectURL(a);x.layoutService.downloadFile(e,`logs_${Date.now()}.json`)},{onLoadStart:()=>x.layoutService.setAppbarLoader(!0),onLoadEnd:()=>x.layoutService.setAppbarLoader(!1)});return e(R,{children:[e(m,{items:O,actions:F,onAction:async a=>{"back-action"===a&&x.routerService.push("/"),"download-action"===a&&l(),"update-now"===a&&(o(""),await W.next()),"search-action"===a&&(async()=>{const a=await x.layoutService.prompt(z("Search keyword"));if(a)return o(a),void W.next();o(""),W.next()})()}}),e(t,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:i,onDataRequest:s,bufferSize:k,hasMore:n,children:r.map(a=>e(M,{data:a,sx:{mb:1}},a.id))})]})};export{Y as LogPage,Y as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,f as a,r as t,bq as i,br as o,A as r,i as s,bs as n,bt as c,t as l,bu as d,I as p,ad as h,b2 as u,bv as b,q as m,ah as y,bw as f,a2 as g,T as v,b3 as x,an as w,a6 as L,bx as S,ao as k,by as A,a_ as j,Z as C,G as N,a9 as z,V as E,W as H,b8 as R,B as T,$ as V,aj as I}from"./index-CJlJOSPg.js";import{h as M}from"./hasRouteMatch-Bc6IBTG4.js";import{B}from"./Background-DhTBM0kG.js";import{A as D}from"./Article-DL41GA0a.js";import{C as F,R as K}from"./Refresh-BEzkJ_ge.js";import{K as W}from"./KeyboardArrowLeft-CF6hGzGl.js";const q=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"),P=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"),$="65px",G=e=>e.mimeType.startsWith("image/")?a(q,{sx:{color:"#f57c00",fontSize:20}}):"application/json"===e.mimeType?a(C,{sx:{color:"#7b1fa2",fontSize:20}}):e.mimeType.startsWith("text/")?a(D,{sx:{color:"#1976d2",fontSize:20}}):a(P,{sx:{color:"#546e7a",fontSize:20}}),O=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:$},input:{height:$,paddingRight:e.spacing(2),paddingLeft:e.spacing(1),width:"100%"},container:{position:"absolute",top:$,left:0,right:0,bottom:0,height:`calc(100% - ${$})`,width:"100%",background:"white",overflow:"clip",display:"flex",alignItems:"stretch",justifyContent:"stretch"},content:{display:"flex",flex:1},loader:{height:"100%",width:"100%"},accent:{background:y("#00c3ff",.05)}})),X=({outlinePaper:e,className:m,style:y,sx:C,nodes:N,initialSearch:z=""})=>{const{classes:E,cx:H}=O(),[R,T]=t.useState(z),V=i(R),[I,{flush:M}]=o(R,2500),[B,{loading:D}]=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})(I,N),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1),deps:[I,N]}),{execute:F}=n(async e=>{await s.layoutService.pickDumpContent(e)},{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});return a(b,{outlinePaper:e,className:H(E.root,m),style:y,sx:C,children:[a("div",{className:E.header,children:a(c,{disabled:D,className:E.input,endAdornment:a(d,{position:"end",children:a(p,{disabled:D||!R,onClick:()=>{V.once(async()=>{await f(500),M()}),T("")},edge:"end",children:a(R?h:u,{})})}),placeholder:l("Search"),value:R,onBlur:()=>M(),onChange:({target:e})=>T(e.value),onKeyDown:({key:e,currentTarget:a})=>"Enter"===e&&a.blur()})}),a("div",{className:E.container,children:a("div",{className:E.content,children:B?B.length?a(j,{withScrollbar:!0,children:B.map((e,t)=>a(w,{className:H({[E.accent]:t%2==1}),component:L,onClick:()=>(async e=>{await F(e)})(e.id),children:[a(S,{children:G(e)}),a(k,{primary:e.label,secondary:e.path}),a(A,{content:e.path,label:l("Copy path")})]},e.id))}):a(x,{sx:{height:"100%",width:"100%"},children:a(v,{variant:"h6",sx:{opacity:.5},children:l("Not found")})}):a(g,{className:E.loader})})})]})},Z=[{type:H.Link,action:"back-action",label:a(W,{sx:{display:"block"}})},{type:H.Link,action:"back-action",label:l("Main")},{type:H.Link,action:"back-action",label:l("Dump Explorer")}],_=[{action:"update-now",label:l("Refresh"),icon:()=>a(V,{icon:K,color:"#4caf50"})}],J=new z,Q=({params:e})=>{const[t,{loading:i,execute:o}]=r(async()=>await s.explorerViewService.getFolderTree(),{onLoadStart:()=>s.layoutService.setAppbarLoader(!0),onLoadEnd:()=>s.layoutService.setAppbarLoader(!1)});N(()=>J.subscribe(o));return a(F,{children:[a(E,{items:Z,actions:_,onAction:e=>{"back-action"===e&&s.routerService.push("/"),"update-now"===e&&(s.explorerViewService.clear(),J.next())}}),a(R,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"calc(100vh - 150px)"},children:a(T,{pr:2,pl:2,children:i||!t?a(x,{children:a(v,{variant:"h6",sx:{opacity:.5},children:l("Loading...")})}):a(X,{nodes:t,initialSearch:e.search})})}),a(B,{})]})},U=[{id:"search",element:Q,isActive:e=>M(["/dump/:search"],e)},{id:"main",element:Q,isActive:e=>M(["/dump"],e)}],Y=({search:e=""})=>a(I,{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{P as e,f as t,t as n,c as r,r as i,i as o,S as a,F as l,a as c}from"./index-CJlJOSPg.js";const[s,u]=e("pine-code-context"),d=e=>t(s,{initialState:'//@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)',children:e.children}),[v,h]=e("pine-from-date-context"),m=e=>t(v,{initialState:"",children:e.children}),[p,g]=e("pine-limit-context"),f=e=>t(p,{initialState:250,children:e.children}),[y,b]=e("pine-symbol-context"),C=e=>t(y,{initialState:"BTCUSDT",children:e.children}),[D,x]=e("pine-timeframe-context"),S=e=>t(D,{initialState:"1",children:e.children}),[w,T]=e("pine-to-date-context"),k=e=>t(w,{initialState:"",children:e.children}),R=r(e=>t("div",{style:e.v0,children:[t("input",{type:"text",value:e.v1,onChange:e.v2,style:e.v3,placeholder:"BTCUSDT"}),t("select",{value:e.v4,onChange:e.v5,style:e.v6,children:e.v7}),t("input",{type:"number",value:e.v8,min:100,step:100,onChange:e.v9,style:e.v10,title:e.v11}),t("input",{type:"date",value:e.v12,onChange:e.v13,style:e.v14,title:e.v15}),t("input",{type:"date",value:e.v16,onChange:e.v17,style:e.v18,title:e.v19}),t("button",{onClick:e.v20,disabled:e.v21,style:e.v22,children:e.v23}),e.v24]}),{name:"Toolbar_1",portals:["v7","v23","v24"]}),z=function({symbol:e,timeframe:r,fromDate:i,toDate:o,limit:a,running:l,status:c,onSymbolChange:s,onTimeframeChange:u,onFromDateChange:d,onToDateChange:v,onLimitChange:h,onRun:m}){return t(R,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>s(e.target.value.toUpperCase()),v3:{...B,width:100},v4:r,v5:e=>u(e.target.value),v6:B,v7:F.map(e=>t("option",{children:e},e)),v8:a,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:n("Bars limit"),v12:i,v13:e=>d(e.target.value),v14:$,v15:n("From date"),v16:o,v17:e=>v(e.target.value),v18:$,v19:n("To date"),v20:m,v21:l,v22:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v23:l?"...":n("▶ Run"),v24:c&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:c})})},F=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},$={...B,colorScheme:"dark"},U=r(e=>t("textarea",{value:e.v0,onChange:e.v1,onKeyDown:e.v2,spellCheck:!1,style:e.v3}),{name:"CodeEditor_1"}),E=function({value:e,onChange:n,onRun:r}){return t(U,{v0:e,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"}})},L={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h",360:"6h",480:"8h","1D":"1d",D:"1d"};function I(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class M{async getMarketData(e,t,n,r,i){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=L[t]??t;return(await o.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:i})).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 P=()=>t(a,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),A=()=>{const e=i.useRef(null),[r,o]=u(),[a,c]=b(),[s,d]=x(),[v,m]=h(),[p,f]=T(),[y,C]=g(),{run:D,status:S,running:w}=function(){const e=i.useRef(null),t=i.useRef(null),r=i.useRef(null),[o,a]=i.useState(""),[l,c]=i.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 d(e){a(`${n("Error")}: ${e.message}`),c(!1)}return i.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:i,timeframe:o,fromDate:l,toDate:v,limit:h,code:m,containerRef:p}){if(!p.current)return;c(!0),a(n("Connecting...")),s(),u();const g=/indicator\([^)]*overlay\s*=\s*true/i.test(m);let f=!1;try{const s=l?new Date(l).getTime():void 0,u=v?new Date(v).getTime():void 0,y=new M,b=new PineTS(y,i,o,h,s,u).stream(m,{pageSize:500,live:!0,interval:3e3});r.current=b,b.on("data",l=>{var s,u;if(r.current===b)if(f)t.current&&l.plots&&t.current.updateData(l.plots),null==(u=e.current)||u.updateData([I(l.marketData[l.marketData.length-1])]);else{f=!0;const r=l.marketData.map(I);p.current.innerHTML="",e.current=new QFChart.QFChart(p.current,{title:`${i} · ${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=l.fullContext)?void 0:s.plots)??l.plots;t.current=e.current.addIndicator("indicator",u,{overlay:g,height:g?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} ${n("bars loaded")}`),c(!1)}}),b.on("error",d)}catch(y){d(y)}},status:o,running:l}}();function k(){D({symbol:a,timeframe:s,fromDate:v,toDate:p,limit:y,code:r,containerRef:e})}return t(l,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(z,{symbol:a,timeframe:s,fromDate:v,toDate:p,limit:y,running:w,status:S,onSymbolChange:c,onTimeframeChange:d,onFromDateChange:m,onToDateChange:f,onLimitChange:C,onRun:k}),t("div",{style:{display:"flex",flex:1,overflow:"clip"},children:[t(E,{value:r,onChange:o,onRun:k}),t("div",{style:{flex:1},children:t("div",{ref:e,style:{width:"100%",height:"100%"},children:t("p",{style:{color:"#475569",textAlign:"center",marginTop:"20%"},children:[n("Press")," ",t("b",{children:n("▶ Run")})," ",n("or")," ",t("b",{children:"Ctrl+Enter"})," ",n("to load the chart")]})})})]}),t(P,{})]})})},N=c(e=>t(d,{children:e}),e=>t(m,{children:e}),e=>t(k,{children:e}),e=>t(f,{children:e}),e=>t(C,{children:e}),e=>t(S,{children:e})),Q=()=>N(t(A,{}));export{Q as PinePage,Q as default};
|