@backtest-kit/ui 3.3.0 → 3.3.2

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.
@@ -1 +1 @@
1
- import{c as e,f as a,a as n,Z as t,q as o,I as i,D as s,b as r,k as l,i as c,z as d,X as p,R as h,J as u,L as b,d as m,e as g,B as y,T as v,v as x,g as f,l as k,h as w,j as S,m as L,n as R,o as F,p as D,r as P,F as W,S as $,x as j,s as C}from"./index-Dg0J2j7u.js";import{R as T,I as z,C as A}from"./IconPhoto-BImfiU3f.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),I=new n,M=[{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Dashboard"}],N=[{action:"dashboard-action",label:"Dashboard",icon:()=>a(i,{icon:B,color:"#4caf50"})},{divider:!0},{action:"download-action",label:"Download",icon:()=>a(i,{icon:s,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(i,{icon:T,color:"#4caf50"})}],O=()=>a(o,{items:M,actions:N,onAction:I.next});const V=({data:{type:e},setLoading:n})=>{const{elementRef:t,size:o}=r({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:s,execute:$}]=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:()=>n(!0),onLoadEnd:()=>n(!1),deps:[e]}),j=d(i),C=d(e);p(()=>I.subscribe(e=>{if("update-now"===e&&$(),"download-action"===e){const e=new Blob([JSON.stringify(j.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${C.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${C.current}`)}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),A=e=>{const n=T[e]||[];return n.length?a(W,{children:n.map((n,t)=>{return a(L,{sx:{background:e=>t%2==1?F(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(n.id),children:[a(m,{primary:a(y,{sx:{display:"flex",gap:2,flexWrap:"wrap",alignItems:"center"},children:[a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===n.position?"#1976D2":"#F57C00",color:"white"},children:"long"===n.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(n.priceOpen),"$"]}),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(n.priceTakeProfit),"$"]}),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(n.priceStopLoss),"$"]}),"pnl"in n&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:n.pnl.pnlPercentage>=0?F("#4caf50",.15):F("#f44336",.15),color:n.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",n.pnl.pnlPercentage>=0?"+":"",n.pnl.pnlPercentage.toFixed(2),"%"]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===n.status?F("#4caf50",.2):"scheduled"===n.status?F("#ff9800",.2):"closed"===n.status?F("#9e9e9e",.2):F("#f44336",.2),color:"opened"===n.status?"#2e7d32":"scheduled"===n.status?"#e65100":"closed"===n.status?"#616161":"#c62828"},children:n.status})]}),secondary:a(v,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(o=n.createdAt||n.pendingAt,new Date(o).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a(D,{disableRipple:!0,children:a(P,{})})]},`item-${e}-${n.id}`);var o})}):a(b,{children:a(m,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return s?null:a(w,{ref:t,sx:{width:"100%",maxHeight:o.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(u,{deps:[T],children:async()=>{const n=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return n.length?n.map(e=>{var n,o,i;const s=null==(n=t[e])?void 0:n.color,r=(null==(o=T[e])?void 0:o.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=s,S(l,"#000000")>S(l,"#FFFFFF")?f(s,.1):k(s,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(z,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:x(r,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:A(e)})]})},`section-${e}`);var l}):a(b,{children:a(m,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},H=()=>a($,{children:"\n body {\n background-color: #ddd !important;\n }\n "}),E=C(),G=(e,a)=>e.some(e=>e.includes(a)),J=[{id:"backtest",element:V,isActive:e=>G(["/backtest"],e)},{id:"live",element:V,isActive:e=>G(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=({symbol:e})=>{p(()=>E.replace("/backtest"));return a(A,{children:[a(j,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:O,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:J,tabs:U,history:E,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),payload:()=>({symbol:e}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(H,{})]})};export{X as MainPage,X as default};
1
+ import{c as e,f as a,a as n,Z as t,q as o,I as i,D as s,b as r,k as l,i as c,z as d,X as p,R as h,J as u,L as b,d as m,e as g,B as y,T as v,v as x,g as f,l as k,h as w,j as S,m as L,n as R,o as F,p as D,r as P,F as W,S as $,x as j,s as C}from"./index-Cbq2maCt.js";import{R as T,I as z,C as A}from"./IconPhoto-CHjzSKw5.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),I=new n,M=[{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Dashboard"}],N=[{action:"dashboard-action",label:"Dashboard",icon:()=>a(i,{icon:B,color:"#4caf50"})},{divider:!0},{action:"download-action",label:"Download",icon:()=>a(i,{icon:s,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(i,{icon:T,color:"#4caf50"})}],O=()=>a(o,{items:M,actions:N,onAction:I.next});const V=({data:{type:e},setLoading:n})=>{const{elementRef:t,size:o}=r({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:s,execute:$}]=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:()=>n(!0),onLoadEnd:()=>n(!1),deps:[e]}),j=d(i),C=d(e);p(()=>I.subscribe(e=>{if("update-now"===e&&$(),"download-action"===e){const e=new Blob([JSON.stringify(j.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${C.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${C.current}`)}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),A=e=>{const n=T[e]||[];return n.length?a(W,{children:n.map((n,t)=>{return a(L,{sx:{background:e=>t%2==1?F(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(n.id),children:[a(m,{primary:a(y,{sx:{display:"flex",gap:2,flexWrap:"wrap",alignItems:"center"},children:[a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===n.position?"#1976D2":"#F57C00",color:"white"},children:"long"===n.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(n.priceOpen),"$"]}),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(n.priceTakeProfit),"$"]}),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(n.priceStopLoss),"$"]}),"pnl"in n&&a(v,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:n.pnl.pnlPercentage>=0?F("#4caf50",.15):F("#f44336",.15),color:n.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",n.pnl.pnlPercentage>=0?"+":"",n.pnl.pnlPercentage.toFixed(2),"%"]}),a(v,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===n.status?F("#4caf50",.2):"scheduled"===n.status?F("#ff9800",.2):"closed"===n.status?F("#9e9e9e",.2):F("#f44336",.2),color:"opened"===n.status?"#2e7d32":"scheduled"===n.status?"#e65100":"closed"===n.status?"#616161":"#c62828"},children:n.status})]}),secondary:a(v,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(o=n.createdAt||n.pendingAt,new Date(o).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a(D,{disableRipple:!0,children:a(P,{})})]},`item-${e}-${n.id}`);var o})}):a(b,{children:a(m,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return s?null:a(w,{ref:t,sx:{width:"100%",maxHeight:o.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(u,{deps:[T],children:async()=>{const n=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return n.length?n.map(e=>{var n,o,i;const s=null==(n=t[e])?void 0:n.color,r=(null==(o=T[e])?void 0:o.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=s,S(l,"#000000")>S(l,"#FFFFFF")?f(s,.1):k(s,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(z,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(v,{variant:"body2",sx:{fontWeight:"medium"},children:x(r,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:A(e)})]})},`section-${e}`);var l}):a(b,{children:a(m,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},H=()=>a($,{children:"\n body {\n background-color: #ddd !important;\n }\n "}),E=C(),G=(e,a)=>e.some(e=>e.includes(a)),J=[{id:"backtest",element:V,isActive:e=>G(["/backtest"],e)},{id:"live",element:V,isActive:e=>G(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=({symbol:e})=>{p(()=>E.replace("/backtest"));return a(A,{children:[a(j,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:O,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:J,tabs:U,history:E,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),payload:()=>({symbol:e}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(H,{})]})};export{X as MainPage,X as default};
@@ -1 +1 @@
1
- import{ai as e,aj as t}from"./index-Dg0J2j7u.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 m};
1
+ import{ai as e,aj as t}from"./index-Cbq2maCt.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 m};
@@ -140,7 +140,7 @@
140
140
  href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
141
141
  rel="stylesheet"
142
142
  />
143
- <script type="module" crossorigin src="/assets/index-Dg0J2j7u.js"></script>
143
+ <script type="module" crossorigin src="/assets/index-Cbq2maCt.js"></script>
144
144
  <link rel="stylesheet" crossorigin href="/assets/index-DrRm3Jka.css">
145
145
  </head>
146
146
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backtest-kit/ui",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "Full-stack UI framework for visualizing cryptocurrency trading signals, backtests, and real-time market data. React dashboard with candlestick charts, signal tracking, and risk analysis.",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
@@ -92,11 +92,11 @@
92
92
  "ccxt": "4.5.24",
93
93
  "touch": "3.1.1",
94
94
  "worker-testbed": "1.0.12",
95
- "backtest-kit": "3.3.0",
95
+ "backtest-kit": "3.3.2",
96
96
  "markdown-it": "14.1.0"
97
97
  },
98
98
  "peerDependencies": {
99
- "backtest-kit": "^3.3.0",
99
+ "backtest-kit": "^3.3.2",
100
100
  "markdown-it": "^14.1.0",
101
101
  "ccxt": "^4.5.24",
102
102
  "typescript": "^5.0.0"