@backtest-kit/ui 9.0.0 → 9.2.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 (35) hide show
  1. package/README.md +254 -254
  2. package/build/modules/frontend/build/3rdparty/ace_1.4.12/ace.js +21337 -21337
  3. package/build/modules/frontend/build/3rdparty/ace_1.4.12/mode-javascript.js +797 -797
  4. package/build/modules/frontend/build/3rdparty/ace_1.4.12/theme-chrome.js +137 -137
  5. package/build/modules/frontend/build/3rdparty/ace_1.4.12/theme-twilight.js +115 -115
  6. package/build/modules/frontend/build/3rdparty/ace_1.4.12/worker-javascript.js +15012 -15012
  7. package/build/modules/frontend/build/3rdparty/qfchart_0.8.7/echarts.min.js +45 -45
  8. package/build/modules/frontend/build/assets/{Article-DDKZjbkz.js → Article-CPvMAlis.js} +1 -1
  9. package/build/modules/frontend/build/assets/{Background-5Pc2kls4.js → Background-BcBJxoQM.js} +1 -1
  10. package/build/modules/frontend/build/assets/{IconPhoto-2KIaDXXx.js → IconPhoto-C_ikll5b.js} +1 -1
  11. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-nUGbVivG.js → KeyboardArrowLeft-wo8yIkQt.js} +1 -1
  12. package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-BKzXxbqU.js → PictureAsPdfOutlined-B2Y3DrmN.js} +1 -1
  13. package/build/modules/frontend/build/assets/{Refresh-6IBmzTpL.js → Refresh-DWwANC2C.js} +1 -1
  14. package/build/modules/frontend/build/assets/emitters-Dr0rm1Id.js +1 -0
  15. package/build/modules/frontend/build/assets/{hasRouteMatch-Bw2df_bl.js → hasRouteMatch-DxP9EIea.js} +1 -1
  16. package/build/modules/frontend/build/assets/{html2canvas-731slHaR.js → html2canvas-BEYpPxnI.js} +1 -1
  17. package/build/modules/frontend/build/assets/{index-BgpdZ4rO.js → index-5Dtu864w.js} +1 -1
  18. package/build/modules/frontend/build/assets/{index-is6UARFt.js → index-BLgqZVUW.js} +56 -56
  19. package/build/modules/frontend/build/assets/{index-BFZbztqX.js → index-BW6mJqS7.js} +1 -1
  20. package/build/modules/frontend/build/assets/{index-Cpcp7B0Y.js → index-Bd51gA9H.js} +1 -1
  21. package/build/modules/frontend/build/assets/{index-CZUmXlNR.js → index-BqQhlvLk.js} +1 -1
  22. package/build/modules/frontend/build/assets/{index-DbkxgA90.js → index-C2FRNjrR.js} +1 -1
  23. package/build/modules/frontend/build/assets/{index-GZdKxtUQ.js → index-Csk3lyh_.js} +1 -1
  24. package/build/modules/frontend/build/assets/{index-CljWW6CQ.js → index-Ct4kOSwZ.js} +1 -1
  25. package/build/modules/frontend/build/assets/{index-Di2oEk8q.js → index-DYIV_QwZ.js} +1 -1
  26. package/build/modules/frontend/build/assets/{index-DVsJHggN.js → index-Q1e8Guut.js} +1 -1
  27. package/build/modules/frontend/build/assets/{index-DtUu3BzB.js → index-U9wO0mPn.js} +1 -1
  28. package/build/modules/frontend/build/assets/{index-DywLUAcD.js → index-nQBp5LZR.js} +1 -1
  29. package/build/modules/frontend/build/assets/{index-Dbf0lzpr.js → index-xcEpTc6J.js} +1 -1
  30. package/build/modules/frontend/build/assets/{index.es-CShnY6Uk.js → index.es-FwYn4ntA.js} +1 -1
  31. package/build/modules/frontend/build/assets/{markdownit-DnS0ASYl.js → markdownit-DifHDTjI.js} +1 -1
  32. package/build/modules/frontend/build/index.html +87 -87
  33. package/build/modules/frontend/build/manifest.json +23 -23
  34. package/package.json +118 -118
  35. package/build/modules/frontend/build/assets/emitters-1aP5uqiT.js +0 -1
@@ -1 +1 @@
1
- import{b as c,f as v}from"./index-is6UARFt.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
1
+ import{b as c,f as v}from"./index-BLgqZVUW.js";const h=c(v("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"}),"Article");export{h as A};
@@ -1 +1 @@
1
- import{f as n,S as o}from"./index-is6UARFt.js";const d=()=>n(o,{children:"\n body {\n background-color: #ddd !important;\n }\n "});export{d as B};
1
+ import{f as n,S as o}from"./index-BLgqZVUW.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,J as s}from"./index-is6UARFt.js";const o=({className:o,symbol:i,style:a,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[i],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:a,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:i,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:a,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
1
+ import{f as e,i as t,B as r,J as s}from"./index-BLgqZVUW.js";const o=({className:o,symbol:i,style:a,sx:n})=>e(s,{children:async()=>{try{const s=(await t.symbolGlobalService.getSymbolMap())[i],l=(null==s?void 0:s.logo)||(null==s?void 0:s.icon),c=(null==s?void 0:s.color)||"#ccc";return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:l?"transparent":c,...n},style:a,children:l?e("img",{loading:"lazy",crossOrigin:"anonymous",src:l,alt:i,style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"contain"},onError:e=>{const t=e.target,r=t.parentElement;r&&(r.style.background=c,t.style.display="none")}}):e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}catch(s){return e(r,{className:o,sx:{position:"relative",width:24,height:24,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"#ccc",...n},style:a,children:e(r,{sx:{width:"60%",height:"60%",borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.2)"}})})}}});export{o as I};
@@ -1 +1 @@
1
- import{b as o,f as r}from"./index-is6UARFt.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-BLgqZVUW.js";const a=o(r("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"KeyboardArrowLeft");export{a as K};
@@ -1 +1 @@
1
- import{b as h,f as c}from"./index-is6UARFt.js";const v=h(c("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1zm-2-3h1v3h-1V9zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1v-2zm0-2h1v1h-1V9z"}),"PictureAsPdfOutlined");export{v as P};
1
+ import{b as h,f as c}from"./index-BLgqZVUW.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{bt as e,d as t,r as a,_ as s,f as i,bu as n,j as o,bv as r,k as d,bw as m,g as u,u as p,s as x,b as c}from"./index-is6UARFt.js";const h=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),f=h("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:c,component:h="div",disableGutters:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:h,disableGutters:l,fixed:f,maxWidth:g}),v=((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(v.root,c),ref:a},W))})}({createStyledComponent:x("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>p({props:e,name:"MuiContainer"})}),k=c(i("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),"Refresh");export{W as C,k as R};
1
+ import{bt as e,d as t,r as a,_ as s,f as i,bu as n,j as o,bv as r,k as d,bw as m,g as u,u as p,s as x,b as c}from"./index-BLgqZVUW.js";const h=e(),b=["className","component","disableGutters","fixed","maxWidth","classes"],l=m(),f=h("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${o(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),g=e=>r({props:e,name:"MuiContainer",defaultTheme:l});const W=function(e={}){const{createStyledComponent:r=f,useThemeProps:m=g,componentName:p="MuiContainer"}=e,x=r(({theme:e,ownerState:a})=>t({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!a.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}),({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce((t,a)=>{const s=a,i=e.breakpoints.values[s];return 0!==i&&(t[e.breakpoints.up(s)]={maxWidth:`${i}${e.breakpoints.unit}`}),t},{}),({theme:e,ownerState:a})=>t({},"xs"===a.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},a.maxWidth&&"xs"!==a.maxWidth&&{[e.breakpoints.up(a.maxWidth)]:{maxWidth:`${e.breakpoints.values[a.maxWidth]}${e.breakpoints.unit}`}}));return a.forwardRef(function(e,a){const r=m(e),{className:c,component:h="div",disableGutters:l=!1,fixed:f=!1,maxWidth:g="lg"}=r,W=s(r,b),k=t({},r,{component:h,disableGutters:l,fixed:f,maxWidth:g}),v=((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(v.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{Z as o}from"./index-BLgqZVUW.js";const r=new o;export{r};
@@ -1 +1 @@
1
- import{i as a,br as e,bs as r}from"./index-is6UARFt.js";const s=(s,t=a.routerService.location.pathname)=>!!e(r.filter(({path:a})=>s.includes(a)),t);export{s as h};
1
+ import{i as a,br as e,bs as r}from"./index-BLgqZVUW.js";const s=(s,t=a.routerService.location.pathname)=>!!e(r.filter(({path:a})=>s.includes(a)),t);export{s as h};
@@ -1 +1 @@
1
- import{bx as e,bz as t}from"./index-is6UARFt.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{bx as e,bz as t}from"./index-BLgqZVUW.js";function r(e,t){for(var r=0;r<t.length;r++){const o=t[r];if("string"!=typeof o&&!Array.isArray(o))for(const t in o)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(o,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>o[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var o=t();const n=r({__proto__:null,default:e(o)},[o]);export{n as h};
@@ -1 +1 @@
1
- import{h as e,f as t,c as n,r,i,S as o,m as a,U as l}from"./index-is6UARFt.js";const[c,s]=e("pine-code-context"),u=e=>t(c,{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}),[d,h]=e("pine-from-date-context"),v=e=>t(d,{initialState:"",children:e.children}),[m,p]=e("pine-limit-context"),g=e=>t(m,{initialState:250,children:e.children}),[f,y]=e("pine-symbol-context"),b=e=>t(f,{initialState:"BTCUSDT",children:e.children}),[C,D]=e("pine-timeframe-context"),x=e=>t(C,{initialState:"1",children:e.children}),[S,w]=e("pine-to-date-context"),T=e=>t(S,{initialState:"",children:e.children}),k=n(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:"Bars limit"}),t("input",{type:"date",value:e.v11,onChange:e.v12,style:e.v13,title:"From date"}),t("input",{type:"date",value:e.v14,onChange:e.v15,style:e.v16,title:"To date"}),t("button",{onClick:e.v17,disabled:e.v18,style:e.v19,children:e.v20}),e.v21]}),{name:"Toolbar_1",portals:["v7","v20","v21"]}),R=function({symbol:e,timeframe:n,fromDate:r,toDate:i,limit:o,running:a,status:l,onSymbolChange:c,onTimeframeChange:s,onFromDateChange:u,onToDateChange:d,onLimitChange:h,onRun:v}){return t(k,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>c(e.target.value.toUpperCase()),v3:{...B,width:100},v4:n,v5:e=>s(e.target.value),v6:B,v7:z.map(e=>t("option",{children:e},e)),v8:o,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:r,v12:e=>u(e.target.value),v13:F,v14:i,v15:e=>d(e.target.value),v16:F,v17:v,v18:a,v19:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v20:a?"...":"▶ Run",v21:l&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:l})})},z=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},F={...B,colorScheme:"dark"},U=n(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"}})},$={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 L(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class I{async getMarketData(e,t,n,r,o){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=$[t]??t;return(await i.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:o})).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=()=>t(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),P=()=>{const e=r.useRef(null),[n,i]=s(),[o,l]=y(),[c,u]=D(),[d,v]=h(),[m,g]=w(),[f,b]=p(),{run:C,status:x,running:S}=function(){const e=r.useRef(null),t=r.useRef(null),n=r.useRef(null),[i,o]=r.useState(""),[a,l]=r.useState(!1);function c(){if(n.current){try{n.current.stop()}catch{}n.current=null}}function s(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function u(e){o(`Error: ${e.message}`),l(!1)}return r.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),c(),s()}},[]),{run:function({symbol:r,timeframe:i,fromDate:a,toDate:d,limit:h,code:v,containerRef:m}){if(!m.current)return;l(!0),o("Connecting..."),c(),s();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(v);let g=!1;try{const c=a?new Date(a).getTime():void 0,s=d?new Date(d).getTime():void 0,f=new I,y=new PineTS(f,r,i,h,c,s).stream(v,{pageSize:500,live:!0,interval:3e3});n.current=y,y.on("data",a=>{var c,s;if(n.current===y)if(g)t.current&&a.plots&&t.current.updateData(a.plots),null==(s=e.current)||s.updateData([L(a.marketData[a.marketData.length-1])]);else{g=!0;const n=a.marketData.map(L);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${r} · ${i}`,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(n);const s=(null==(c=a.fullContext)?void 0:c.plots)??a.plots;t.current=e.current.addIndicator("indicator",s,{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),o(`${n.length} bars loaded`),l(!1)}}),y.on("error",u)}catch(f){u(f)}},status:i,running:a}}();function T(){C({symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,code:n,containerRef:e})}return t(a,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(R,{symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,running:S,status:x,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:v,onToDateChange:g,onLimitChange:b,onRun:T}),t("div",{style:{display:"flex",flex:1,overflow:"clip"},children:[t(E,{value:n,onChange:i,onRun:T}),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:["Press ",t("b",{children:"▶ Run"})," or ",t("b",{children:"Ctrl+Enter"})," to load the chart"]})})})]}),t(M,{})]})})},A=l(e=>t(u,{children:e}),e=>t(v,{children:e}),e=>t(T,{children:e}),e=>t(g,{children:e}),e=>t(b,{children:e}),e=>t(x,{children:e})),N=()=>A(t(P,{}));export{N as PinePage,N as default};
1
+ import{h as e,f as t,c as n,r,i,S as o,m as a,U as l}from"./index-BLgqZVUW.js";const[c,s]=e("pine-code-context"),u=e=>t(c,{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}),[d,h]=e("pine-from-date-context"),v=e=>t(d,{initialState:"",children:e.children}),[m,p]=e("pine-limit-context"),g=e=>t(m,{initialState:250,children:e.children}),[f,y]=e("pine-symbol-context"),b=e=>t(f,{initialState:"BTCUSDT",children:e.children}),[C,D]=e("pine-timeframe-context"),x=e=>t(C,{initialState:"1",children:e.children}),[S,w]=e("pine-to-date-context"),T=e=>t(S,{initialState:"",children:e.children}),k=n(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:"Bars limit"}),t("input",{type:"date",value:e.v11,onChange:e.v12,style:e.v13,title:"From date"}),t("input",{type:"date",value:e.v14,onChange:e.v15,style:e.v16,title:"To date"}),t("button",{onClick:e.v17,disabled:e.v18,style:e.v19,children:e.v20}),e.v21]}),{name:"Toolbar_1",portals:["v7","v20","v21"]}),R=function({symbol:e,timeframe:n,fromDate:r,toDate:i,limit:o,running:a,status:l,onSymbolChange:c,onTimeframeChange:s,onFromDateChange:u,onToDateChange:d,onLimitChange:h,onRun:v}){return t(k,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>c(e.target.value.toUpperCase()),v3:{...B,width:100},v4:n,v5:e=>s(e.target.value),v6:B,v7:z.map(e=>t("option",{children:e},e)),v8:o,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:r,v12:e=>u(e.target.value),v13:F,v14:i,v15:e=>d(e.target.value),v16:F,v17:v,v18:a,v19:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v20:a?"...":"▶ Run",v21:l&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:l})})},z=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},F={...B,colorScheme:"dark"},U=n(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"}})},$={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 L(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class I{async getMarketData(e,t,n,r,o){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=$[t]??t;return(await i.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:o})).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=()=>t(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),P=()=>{const e=r.useRef(null),[n,i]=s(),[o,l]=y(),[c,u]=D(),[d,v]=h(),[m,g]=w(),[f,b]=p(),{run:C,status:x,running:S}=function(){const e=r.useRef(null),t=r.useRef(null),n=r.useRef(null),[i,o]=r.useState(""),[a,l]=r.useState(!1);function c(){if(n.current){try{n.current.stop()}catch{}n.current=null}}function s(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function u(e){o(`Error: ${e.message}`),l(!1)}return r.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),c(),s()}},[]),{run:function({symbol:r,timeframe:i,fromDate:a,toDate:d,limit:h,code:v,containerRef:m}){if(!m.current)return;l(!0),o("Connecting..."),c(),s();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(v);let g=!1;try{const c=a?new Date(a).getTime():void 0,s=d?new Date(d).getTime():void 0,f=new I,y=new PineTS(f,r,i,h,c,s).stream(v,{pageSize:500,live:!0,interval:3e3});n.current=y,y.on("data",a=>{var c,s;if(n.current===y)if(g)t.current&&a.plots&&t.current.updateData(a.plots),null==(s=e.current)||s.updateData([L(a.marketData[a.marketData.length-1])]);else{g=!0;const n=a.marketData.map(L);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${r} · ${i}`,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(n);const s=(null==(c=a.fullContext)?void 0:c.plots)??a.plots;t.current=e.current.addIndicator("indicator",s,{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),o(`${n.length} bars loaded`),l(!1)}}),y.on("error",u)}catch(f){u(f)}},status:i,running:a}}();function T(){C({symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,code:n,containerRef:e})}return t(a,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(R,{symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,running:S,status:x,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:v,onToDateChange:g,onLimitChange:b,onRun:T}),t("div",{style:{display:"flex",flex:1,overflow:"clip"},children:[t(E,{value:n,onChange:i,onRun:T}),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:["Press ",t("b",{children:"▶ Run"})," or ",t("b",{children:"Ctrl+Enter"})," to load the chart"]})})})]}),t(M,{})]})})},A=l(e=>t(u,{children:e}),e=>t(v,{children:e}),e=>t(T,{children:e}),e=>t(g,{children:e}),e=>t(b,{children:e}),e=>t(x,{children:e})),N=()=>A(t(P,{}));export{N as PinePage,N as default};