@backtest-kit/ui 8.5.0 → 9.1.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 (27) hide show
  1. package/build/modules/frontend/build/assets/{Article-Dh_vYreB.js → Article-CH17YSFr.js} +1 -1
  2. package/build/modules/frontend/build/assets/{Background-B2ldn454.js → Background-GNzR-Kab.js} +1 -1
  3. package/build/modules/frontend/build/assets/{IconPhoto-C2SEjuLJ.js → IconPhoto-BdD97QYO.js} +1 -1
  4. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-CXc4SNLm.js → KeyboardArrowLeft-Dthfoq7U.js} +1 -1
  5. package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-BHHWm0bL.js → PictureAsPdfOutlined-C57tyko8.js} +1 -1
  6. package/build/modules/frontend/build/assets/{Refresh-OHKLL7G_.js → Refresh-DAu-7wmf.js} +1 -1
  7. package/build/modules/frontend/build/assets/emitters-DvppAhaS.js +1 -0
  8. package/build/modules/frontend/build/assets/{hasRouteMatch-EVPvlDIB.js → hasRouteMatch-DWDUNfus.js} +1 -1
  9. package/build/modules/frontend/build/assets/{html2canvas-YNpy5BaY.js → html2canvas-COSj0FNh.js} +1 -1
  10. package/build/modules/frontend/build/assets/{index-D6-5rbio.js → index-BLNMuyZD.js} +1 -1
  11. package/build/modules/frontend/build/assets/{index-DA0cY5CT.js → index-C0618UQS.js} +56 -56
  12. package/build/modules/frontend/build/assets/{index-CylbBsJT.js → index-C5kAxBs3.js} +1 -1
  13. package/build/modules/frontend/build/assets/{index-B8ACWkBR.js → index-CIyWAxFi.js} +1 -1
  14. package/build/modules/frontend/build/assets/{index-B5xjPulX.js → index-CSzNtUpP.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-SfsF53Bs.js → index-CnmkGLLb.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-ZZ-3mMMq.js → index-D44E3fwH.js} +1 -1
  17. package/build/modules/frontend/build/assets/{index-CFsxiZyp.js → index-DIRIN5cH.js} +1 -1
  18. package/build/modules/frontend/build/assets/{index-CXKu4KrJ.js → index-DNu9D-5j.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-EBlc2pjc.js → index-Dk0yu8oC.js} +1 -1
  20. package/build/modules/frontend/build/assets/{index-CME9eeIW.js → index-GFDlqYrR.js} +1 -1
  21. package/build/modules/frontend/build/assets/{index-mIAPQczG.js → index-Nzp9XSEn.js} +1 -1
  22. package/build/modules/frontend/build/assets/{index-BFgNsirj.js → index-nX5Mhy39.js} +1 -1
  23. package/build/modules/frontend/build/assets/{index.es-BGETDkul.js → index.es-DG1APgva.js} +1 -1
  24. package/build/modules/frontend/build/assets/{markdownit-DBOjQC5v.js → markdownit-C7kIKjcv.js} +1 -1
  25. package/build/modules/frontend/build/index.html +1 -1
  26. package/package.json +3 -3
  27. package/build/modules/frontend/build/assets/emitters-ftFfHgfR.js +0 -1
@@ -1 +1 @@
1
- import{r as e,f as a,P as i,B as r,N as n,$ as t,T as o,al as s,K as c,a0 as l,F as d,aE as p,M as m,aF as u,aG as b,aH as v,aI as y,az as g,aJ as h,aK as x,aL as k,aM as f,aN as $,aO as P,aP as S,i as w,av as C,Z as _,aw as E,v as L,w as F,aQ as z,aR as A,z as O}from"./index-DA0cY5CT.js";import{C as D,R as j}from"./Refresh-OHKLL7G_.js";import{K as T}from"./KeyboardArrowLeft-CXc4SNLm.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(P,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(g,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(h,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(f,{sx:i});case"breakeven.available":case"breakeven.commit":return a($,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(x,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a(k,{sx:i});case"risk.rejection":return a(y,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(b,{sx:i});case"error.critical":return a(v,{sx:i});default:return a(u,{sx:i})}},R=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;default:return l("Unknown")}},I=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},N=e=>"symbol"in e,U=e=>"position"in e,W=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,M=e=>"pnlPercentage"in e,H=e=>"level"in e,K=e=>"percentToClose"in e,Y=e=>"currentPrice"in e,V=e=>"duration"in e,q=e=>"closeReason"in e,G=e=>"cancelReason"in e,J=e=>"percentShift"in e,Q=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),Z=e=>"message"in e,X=e=>"rejectionNote"in e,ee=e=>"activePositionCount"in e,ae=e=>"effectivePriceOpen"in e,ie=e=>"totalEntries"in e&&e.totalEntries>1,re=e=>"originalPriceOpen"in e&&"priceOpen"in e&&e.originalPriceOpen!==e.priceOpen,ne=e=>"totalPartials"in e&&e.totalPartials>0,te=e=>"cost"in e,oe=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,se=e=>"peakProfitPriceClose"in e,ce=e=>"maxDrawdownPriceClose"in e,le=e.forwardRef(({item:e,className:u,style:b,sx:v},y)=>{const g=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),h=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:u,style:b,ref:y,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":w.layoutService.pickRisk(e.id);break;case"signal.opened":w.layoutService.pickSignalOpened(e.id);break;case"signal.closed":w.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":w.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":w.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":w.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":w.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":w.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":w.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":w.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":w.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":w.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":w.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":w.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":w.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":w.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":w.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":w.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":w.layoutService.pickClosePending(e.id);break;case"signal.info":w.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...v},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:g},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:R(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:s(h).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(c,{size:"small",label:I(e),sx:{background:g,mt:1,mr:1,color:"white",fontWeight:500}}),N(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),U(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),M(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`PnL: ${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),H(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),K(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),V(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),G(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),J(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ee(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ie(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),ne(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),te(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost.toFixed(2)}$`,variant:"outlined"}),ae(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen}`,variant:"outlined",color:"warning"}),re(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen}`,variant:"outlined"})]}),W(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[Y(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss]})]})]}),oe(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:[e.pnlCost>=0?"+":"",e.pnlCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries.toFixed(2),"$"]})]})]}),se(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:[e.peakProfitCost>=0?"+":"",e.peakProfitCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries.toFixed(2),"$"]})]})]}),ce(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:[e.maxDrawdownCost>=0?"+":"",e.maxDrawdownCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries.toFixed(2),"$"]})]})]})]})]}),Q(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(m,{content:e.note})})]}),X(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),Z(e)&&!Q(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:g}})]})})})}),de=[{action:"update-now",label:"Refresh manually",icon:()=>a(O,{icon:j,color:"#4caf50"})}],pe=[{type:F.Link,action:"back-action",label:a(T,{sx:{display:"block"}})},{type:F.Link,action:"back-action",label:"Main"},{type:F.Link,action:"back-action",label:"Notifications"}],me=new _,ue=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=C({handler:async(e,a)=>{const i=await w.notificationViewService.getList(),r=E(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>w.layoutService.setAppbarLoader(!0),onLoadEnd:()=>w.layoutService.setAppbarLoader(!1),reloadSubject:me});return a(D,{children:[a(L,{items:pe,actions:de,onAction:async e=>{"back-action"===e&&w.routerService.push("/"),"update-now"===e&&await me.next()}}),a(z,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:A,hasMore:i,children:e.map(e=>a(le,{item:e,sx:{mb:1}},e.id))})]})};export{ue as NotificationPage,ue as default};
1
+ import{r as e,f as a,P as i,B as r,N as n,$ as t,T as o,al as s,K as c,a0 as l,F as d,aE as p,M as m,aF as u,aG as b,aH as v,aI as y,az as g,aJ as h,aK as x,aL as k,aM as f,aN as $,aO as P,aP as S,i as w,av as C,Z as _,aw as E,v as L,w as F,aQ as z,aR as A,z as O}from"./index-C0618UQS.js";import{C as D,R as j}from"./Refresh-DAu-7wmf.js";import{K as T}from"./KeyboardArrowLeft-Dthfoq7U.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(P,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(g,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(h,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(f,{sx:i});case"breakeven.available":case"breakeven.commit":return a($,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(x,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a(k,{sx:i});case"risk.rejection":return a(y,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(b,{sx:i});case"error.critical":return a(v,{sx:i});default:return a(u,{sx:i})}},R=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%)`;default:return l("Unknown")}},I=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},N=e=>"symbol"in e,U=e=>"position"in e,W=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,M=e=>"pnlPercentage"in e,H=e=>"level"in e,K=e=>"percentToClose"in e,Y=e=>"currentPrice"in e,V=e=>"duration"in e,q=e=>"closeReason"in e,G=e=>"cancelReason"in e,J=e=>"percentShift"in e,Q=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),Z=e=>"message"in e,X=e=>"rejectionNote"in e,ee=e=>"activePositionCount"in e,ae=e=>"effectivePriceOpen"in e,ie=e=>"totalEntries"in e&&e.totalEntries>1,re=e=>"originalPriceOpen"in e&&"priceOpen"in e&&e.originalPriceOpen!==e.priceOpen,ne=e=>"totalPartials"in e&&e.totalPartials>0,te=e=>"cost"in e,oe=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,se=e=>"peakProfitPriceClose"in e,ce=e=>"maxDrawdownPriceClose"in e,le=e.forwardRef(({item:e,className:u,style:b,sx:v},y)=>{const g=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),h=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:u,style:b,ref:y,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":w.layoutService.pickRisk(e.id);break;case"signal.opened":w.layoutService.pickSignalOpened(e.id);break;case"signal.closed":w.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":w.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":w.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":w.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":w.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":w.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":w.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":w.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":w.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":w.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":w.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":w.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":w.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":w.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":w.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":w.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":w.layoutService.pickClosePending(e.id);break;case"signal.info":w.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...v},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:g},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:R(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:s(h).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(c,{size:"small",label:I(e),sx:{background:g,mt:1,mr:1,color:"white",fontWeight:500}}),N(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),U(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),M(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`PnL: ${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`,color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),H(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),K(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),V(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),G(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),J(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ee(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ie(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),ne(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),te(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost.toFixed(2)}$`,variant:"outlined"}),ae(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen}`,variant:"outlined",color:"warning"}),re(e)&&a(c,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen}`,variant:"outlined"})]}),W(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[Y(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss]})]})]}),oe(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:[e.pnlCost>=0?"+":"",e.pnlCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries.toFixed(2),"$"]})]})]}),se(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:[e.peakProfitCost>=0?"+":"",e.peakProfitCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries.toFixed(2),"$"]})]})]}),ce(e)&&a(d,{children:[a(p,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:[e.maxDrawdownCost>=0?"+":"",e.maxDrawdownCost.toFixed(2),"$"]})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries.toFixed(2),"$"]})]})]})]})]}),Q(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(m,{content:e.note})})]}),X(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),Z(e)&&!Q(e)&&a(r,{sx:{px:2,pb:2},children:[a(p,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:g}})]})})})}),de=[{action:"update-now",label:"Refresh manually",icon:()=>a(O,{icon:j,color:"#4caf50"})}],pe=[{type:F.Link,action:"back-action",label:a(T,{sx:{display:"block"}})},{type:F.Link,action:"back-action",label:"Main"},{type:F.Link,action:"back-action",label:"Notifications"}],me=new _,ue=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=C({handler:async(e,a)=>{const i=await w.notificationViewService.getList(),r=E(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>w.layoutService.setAppbarLoader(!0),onLoadEnd:()=>w.layoutService.setAppbarLoader(!1),reloadSubject:me});return a(D,{children:[a(L,{items:pe,actions:de,onAction:async e=>{"back-action"===e&&w.routerService.push("/"),"update-now"===e&&await me.next()}}),a(z,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:A,hasMore:i,children:e.map(e=>a(le,{item:e,sx:{mb:1}},e.id))})]})};export{ue as NotificationPage,ue as default};
@@ -1 +1 @@
1
- import{b as e,f as t,i as o,ak as a,al as n,am as l,r as i,an as r,p as s,T as c,ag as d,c as p,P as u,F as m,ao as h,ap as g,aq as y,B as f,ab as v,ar as b,as as x,a0 as C,at as k,au as w,av as P,aw as S,ax as L,ay as M,H as N,a4 as R,I as $,az as T,N as D,aA as j,L as B,O as I,z as V,J as A,X as E,aB as O,Y as z,Z as F,v as U,w as W,D as H,aC as G,aD as Y,x as _}from"./index-DA0cY5CT.js";import{I as K}from"./IconPhoto-C2SEjuLJ.js";import{C as X,R as J}from"./Refresh-OHKLL7G_.js";import{K as q}from"./KeyboardArrowLeft-CXc4SNLm.js";const Z=e(t("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 10V8h-2v4H8l4 4 4-4h-3z"}),"ArrowCircleDown"),Q=e(t("path",{d:"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0 2c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm-1-10v4h2v-4h3l-4-4-4 4h3z"}),"ArrowCircleUp"),ee=e(t("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixHigh"),te=e(t("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle"),oe=l(async e=>"live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),{key:([e])=>`${e}`,timeout:45e3}),ae=async(e,t)=>(await oe(t)).filter(t=>"closed"===t.status&&t.symbol===e),ne=async(e,t)=>{const o=await ae(e,t);return{total:o.length,resolvedCount:o.filter(e=>e.pnl.pnlPercentage>0).length,rejectedCount:o.filter(e=>e.pnl.pnlPercentage<=0).length}},le=async(e,t)=>{const o=await ae(e,t),a=e=>Math.abs(e.pnl.priceClose-e.priceTakeProfit)/e.priceTakeProfit<.005,n=e=>Math.abs(e.pnl.priceClose-e.priceStopLoss)/e.priceStopLoss<.005;return{resolvedTakeProfitCount:o.filter(e=>e.pnl.pnlPercentage>0&&a(e)).length,rejectedStopLossCount:o.filter(e=>e.pnl.pnlPercentage<=0&&n(e)).length,resolvedCloseCount:o.filter(e=>e.pnl.pnlPercentage>0&&!a(e)).length,rejectedCloseCount:o.filter(e=>e.pnl.pnlPercentage<=0&&!n(e)).length}},ie=async(e,t)=>{const o=await ae(e,t),l=new Map;for(const i of o){const e=a(n(i.updatedAt)),t=l.get(e)??{resolved:0,rejected:0};i.pnl.pnlPercentage>0?l.set(e,{...t,resolved:t.resolved+1}):l.set(e,{...t,rejected:t.rejected+1})}return Array.from(l.entries()).map(([e,{resolved:t,rejected:o}])=>({stamp:e,count:t+o,resolved:t,rejected:o}))},re=async(e,t)=>{const o=await ae(e,t),a="backtest"===t&&o.length?o.reduce((e,t)=>Math.max(e,t.updatedAt),0):Date.now(),l=n(a).startOf("day").valueOf(),i=l-864e5,r=l-6048e5,s=l-26784e5,c=e=>e.reduce((e,t)=>e+t.pnl.pnlCost,0),d=o.filter(e=>e.updatedAt>=l),p=o.filter(e=>e.updatedAt>=i&&e.updatedAt<l),u=o.filter(e=>e.updatedAt>=r),m=o.filter(e=>e.updatedAt>=s);return{symbol:e,todayRevenue:c(d),yesterdayRevenue:c(p),sevenDaysRevenue:c(u),thirtyOneDaysRevenue:c(m),todayCount:d.length,yesterdayCount:p.length,sevenDaysCount:u.length,thirtyOneDaysCount:m.length}};var se=(e=>(e.Red="#DD4049",e.Orange="#F3A43A",e.Green="#2EA96F",e.Blue="#2979ff",e.Violet="#d500f9",e))(se||{});const ce=i.createContext(null),de=({value:e,children:o})=>t(ce.Provider,{value:e,children:o}),pe=()=>i.useContext(ce);var ue=(e=>(e.Semi="semi",e.Solid="solid",e.Unset="unset",e))(ue||{});const me=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"stretch",whiteSpace:"nowrap",gap:"8px",overflow:"clip",padding:"10px",borderTop:`1px solid ${e.palette.divider}`,"& > *":{flex:1}},solidBackground:{color:"#fff","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}},semiBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}}})),he=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=me(),{footerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...s===ue.Solid&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},ge=(e,t=2)=>{let o=1;for(let a=0;a<t;a++)o*=10;return Math.round(e*o)/o},ye=s()({root:{position:"relative",width:"100%",height:"0px"},container:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}),fe=({caption:e})=>{const{classes:o}=ye();return t("div",{className:o.root,children:t("div",{className:o.container,children:t(c,{variant:"caption",sx:{opacity:.5,fontSize:12,textAlign:"center",padding:"0 8px"},children:e})})})},ve=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},solidBackground:{"& > :first-of-type":{color:"#fff",fontWeight:"bold"},"& > :last-of-type":{color:"#fff"}},unsetBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},semiBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},content:{display:"flex",alignItems:"baseline",flexDirection:"row",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),be=p(e=>t("div",{className:e.v0,style:e.v1,children:[t("div",{className:e.v2,children:[e.v3,e.v4]}),e.v5]}),{name:"Content_1",portals:["v3","v4","v5"]}),xe=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=ve(),{backgroundMode:l=ue.Solid,roundDigits:s=2,value:p,caption:u,valueUnit:m="Unit"}=pe(),h=i.useMemo(()=>({...o,...l===ue.Solid&&{backgroundColor:a}}),[a,l,o]);return t(be,{v0:r(e,n.root),v1:h,v2:r(n.content,{[n.solidBackground]:l===ue.Solid,[n.unsetBackground]:l===ue.Unset,[n.semiBackground]:l===ue.Semi}),v3:t(c,{fontWeight:"bold",children:d(ge(p,s))}),v4:t(c,{children:m}),v5:!!u&&t(fe,{caption:u})})},Ce=s()(e=>({root:{display:"flex",alignItems:"center",whiteSpace:"nowrap",fontWeight:700,fontSize:"18px",paddingLeft:"8px",gap:"8px",overflow:"clip",borderBottom:`1px solid ${e.palette.divider}`},solidBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},semiBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,padding:"10px","& svg":{fill:e.palette.text.primary}}})),ke=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=Ce(),{headerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...(s===ue.Solid||s===ue.Semi)&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},we=s()({root:{overflow:"clip",height:"100%",width:"100%",display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},click:{cursor:"pointer"},header:{minHeight:"36px"},content:{flex:1},footer:{minHeight:"32px"}}),Pe=({className:e,style:o})=>{const{classes:a}=we(),{backgroundColor:n,onClick:l,footerLabel:i}=pe();return t(u,{className:r(e,a.root,{[a.click]:!!l}),onClick:l,style:o,children:[t(ke,{backgroundColor:n}),t(xe,{backgroundColor:n,className:a.content}),!!i&&t(he,{backgroundColor:n,className:a.footer})]})},Se=i.memo(({className:e,style:o,...a})=>t(de,{value:a,children:t(Pe,{className:e,style:o})})),Le=(e,{one:t,many:o,two:a=o})=>`${(()=>{if(0===e||e>=11&&e<20)return o;let n=e%10;return 0===n?o:1===n?t:n<5?a:o})()}`,Me=i.createContext(null),Ne=({value:e,children:o})=>t(Me.Provider,{value:e,children:o}),Re=()=>i.useContext(Me),$e=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",paddingLeft:"20px",paddingRight:"20px",overflow:"clip"},container:{flex:1,display:"flex",alignItems:"stretch",justifyContent:"center",gap:"40px"},item:{gap:"4px",display:"flex",alignItems:"center",justifyContent:"center","& > span":{fontWeight:500,fontSize:"12px",color:"var(--black-6)",whiteSpace:"nowrap"}},circle:{borderRadius:"50%",height:"8px",width:"8px"}}),Te=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Footer_1",portals:["v3"]}),De=({className:e,style:o})=>{const{classes:a}=$e(),{items:n}=Re();return t(Te,{v0:r(e,a.root),v1:o,v2:a.container,v3:[...n].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,o)=>t("div",{className:a.item,children:[t("div",{className:a.circle,style:{background:e.color}}),t("span",{children:[e.label," ",e.value?e.value():e.maxValue]})]},o))})},je=s()(()=>({circle:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%","& > div":{borderRadius:"50%"}}})),Be=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{style:e.v2})}),{name:"Circle_1"}),Ie=({className:e,style:o,lineWidth:a,side:n,color:l,rotate:i})=>{const{classes:s}=je();return t(Be,{v0:r(e,s.circle),v1:{...o},v2:{borderTop:`${a}px solid ${l}`,borderLeft:`${a}px solid ${l}`,borderRight:`${a}px solid transparent`,borderBottom:`${a}px solid transparent`,transform:`rotate(${i}deg)`,height:n,width:n}})},Ve=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",background:e.palette.background.paper}})),Ae=({side:e})=>{const{classes:o}=Ve();return t("div",{className:o.dot,style:{height:e,width:e}})},Ee=s()(e=>({line:{position:"absolute",background:e.palette.background.paper,height:"100%",width:"1px",left:"50%",transformOrigin:"center bottom"}})),Oe=({angle:e})=>{const{classes:o}=Ee();return t("div",{className:o.line,style:{transform:`rotate(${e}deg)`}})},ze=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",outline:`100vmax solid ${e.palette.background.paper}`}})),Fe=({side:e})=>{const{classes:o}=ze();return t("div",{className:o.dot,style:{height:e,width:e}})},Ue=s()(e=>({pointer:{position:"absolute",left:"21%",width:"29%",bottom:"0%",zIndex:1,transformOrigin:"right center",fill:e.palette.text.primary}})),We=p(e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 87 8",className:e.v0,style:e.v1,...e.v2,children:[t("rect",{x:"0.5",y:"2.5",width:"79",height:"3"}),t("circle",{cx:"82.5",cy:"4",r:"4"})]}),{name:"Pointer_1",svg:!0}),He=({className:e,style:o,angle:a,scale:n=1,...l})=>{const{classes:i}=Ue();return t(We,{v0:r(e,i.pointer),v1:{...o,transform:`rotate(${a}deg) scale(${n}) translateX(5px)`},v2:l})},Ge=e=>e*Math.PI/180,Ye=(e,t)=>({left:t*Math.cos(Ge(e))+t,top:t*Math.sin(Ge(e))+t}),_e=s()(e=>({root:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",display:"flex",alignItems:"stretch",justifyContent:"stretch"},container:{flex:1,position:"relative"},label:{position:"absolute",transform:"translate(-50%, -50%)",color:e.palette.text.primary,zIndex:2}})),Ke=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Labels_1",portals:["v3"]}),Xe=({items:e,side:o})=>{const{classes:a}=_e(),n=i.useMemo(()=>Math.floor(o/2),[o]);return t(Ke,{v0:a.root,v1:{height:o,width:o},v2:a.container,v3:e.slice(0,e.length-1).map(({angle:e,value:o},l)=>t("span",{className:a.label,style:{...Ye(e+180,n),...e<90&&{marginLeft:10},...e>90&&{marginLeft:-10},...e>15&&e<165&&{marginTop:5}},children:o},l))})},Je=({width:e,side:o,chunks:a,maxValue:n,minValue:l,value:r})=>{const s=i.useMemo(()=>.5*o,[o]),c=i.useMemo(()=>.63*o,[o]),d=i.useMemo(()=>.58*o,[o]),p=i.useCallback(e=>180/(n-l)*(e.minValue-l)+45,[n,l]),u=i.useMemo(()=>Math.min(r/n*180,180),[n,r]),h=i.useMemo(()=>e>o?c/e*1.5:1,[c,e,o]),g=i.useMemo(()=>[...a].sort(({maxValue:e},{maxValue:t})=>e-t).slice(0,a.length-1).map(e=>({angle:180/n*e.maxValue,value:e.maxValue})),[a,n]),y=i.useMemo(()=>[{angle:0,value:0},...g,{angle:180,value:n}],[g,n]);return t(m,{children:[t(He,{angle:u,scale:h}),[...a].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,a)=>t(Ie,{rotate:p(e),color:e.color,side:o,lineWidth:s},`${e.color}-${a}`)),g.map(({angle:e},o)=>t(Oe,{angle:e-90},`${e}-${o}`)),t(Fe,{side:o}),t(Ae,{side:c}),t(Xe,{items:y,side:d})]})},qe=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",overflow:"clip"},container:{flex:1,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},bottomCenterLabel:{position:"absolute",zIndex:2,bottom:"0",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:"4px","& > *":{fontSize:"20px",lineHeight:"24px"},"& > :first-of-type":{fontWeight:"bold"},"& > :last-of-type":{color:"var(--black-6)"}}}),Ze=({className:e,height:o,width:a})=>{const{classes:n}=qe(),{value:l,items:s}=Re(),c=Math.min(2*o,a),d=i.useMemo(()=>[...s].filter(e=>!e.hidden).sort(({maxValue:e},{maxValue:t})=>t-e).map((e,t,o)=>{const a=o[t+1],n=a?a.maxValue:0;return{...e,minValue:n,value:e.maxValue-n}}),[s]),p=i.useMemo(()=>{const e=d.find(({minValue:e,maxValue:t})=>l>=e&&l<=t);if(e)return e.color;return d.reduce((e,t)=>t.minValue>=e.minValue?t:e).color},[d,l]),u=i.useMemo(()=>d.reduce((e,{minValue:t})=>Math.min(e,t),Number.POSITIVE_INFINITY),[d]),m=i.useMemo(()=>d.reduce((e,{maxValue:t})=>Math.max(e,t),Number.NEGATIVE_INFINITY),[d]);return t("div",{className:r(e,n.root),children:t("div",{className:n.container,children:t(Je,{chunks:d,value:l,minValue:u,maxValue:m,side:c,width:a,color:p})})})},Qe=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",borderLeft:0,borderRight:0,borderWidth:"1px 0",borderStyle:"solid",borderColor:e.palette.divider},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row"},content:{display:"flex",alignItems:"baseline",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),et=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:t("div",{className:e.v3,children:[e.v4,e.v5]})})}),{name:"Note_1",portals:["v4","v5"]}),tt=({className:e,style:o})=>{const{classes:a}=Qe(),{value:n,roundDigits:l=3,valueUnit:i="Unit"}=Re();return t(et,{v0:r(e,a.root),v1:o,v2:a.container,v3:a.content,v4:t(c,{children:ge(n,l)}),v5:t(c,{children:i})})},ot=s()(e=>({root:{position:"relative",overflow:"clip",height:"100%",width:"100%",background:e.palette.background.paper},container:{position:"absolute",top:"0",left:"0"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},chart:{flex:1,paddingTop:"6px",paddingBottom:"6px"},footer:{minHeight:"32px"},note:{minHeight:"60px"}})),at=({className:e,style:o})=>{const{classes:a}=ot(),n=e=>{let t=e;return t-=32,t-=12,t-=60,t},l=e=>{let t=e;return t-=12,t};return t(u,{className:r(e,a.root),style:o,children:t(h,{className:a.container,children:({height:e=0,width:o=0})=>t("div",{className:a.content,style:{height:e,width:o},children:[t(Ze,{className:a.chart,height:n(e),width:l(o)}),t(tt,{className:a.note}),t(De,{className:a.footer})]})})})},nt=i.memo(({className:e,style:o,...a})=>t(Ne,{value:a,children:t(at,{className:e,style:o})})),lt=s()({root:{position:"relative",height:10,flex:1},bar:{position:"absolute !important",top:"42%",left:0,right:10}}),it=e=>{const{classes:o}=lt(),a=["done","inprogress","waiting","archive"],n=t=>{var o;return null==(o=e.data[t])?void 0:o.value},l=a.map(t=>{const o=n(t);var a,l;return`${a=t,(null==(l=e.data[a])?void 0:l.title)||t} - ${o}`}).join(" | "),i=a.map(t=>{const o=(t=>{var o;return null==(o=e.data[t])?void 0:o.color})(t);return{color:o,value:n(t),key:t}}).map(({color:e,value:t,key:o},l)=>{let i=0;if(0!==l)for(let r=l-1;r>=0;r--)i+=n(a[r]);return{value:t>0?t+i:t,key:o,color:e}}).sort(({value:e},{value:t})=>t-e),r=Math.max(...i.map(({value:e})=>e));return t(y,{title:l,arrow:!0,children:t("div",{className:o.root,children:i.map(({color:e,value:a,key:n},l)=>{const i=((e,t=100)=>Math.min(100,Math.round(Math.max(Number(e),0)/t*100)))(a,r);return t(g,{sx:{height:"10px !important",zIndex:`${l+1} !important`,backgroundColor:"transparent !important","& .MuiLinearProgress-bar":{borderTopRightRadius:5,borderBottomRightRadius:5,backgroundColor:`${e} !important`}},variant:"determinate",className:o.bar,value:i},`${l}-${n}`)})})})},rt=s()({root:{display:"flex"},work:{display:"flex",alignItems:"center"},row:{flex:1,paddingLeft:5,paddingRight:5,paddingBottom:15}}),st=({title:e,description:o,avatar:a,done:n,inprogress:l,waiting:i,archive:r})=>{const{classes:s}=rt();return t(f,{className:s.root,children:t(f,{className:s.row,children:[t(f,{className:s.work,children:[t(a,{}),t(v,{primary:e,secondary:o,sx:{flex:"none",marginLeft:"0.5em"}})]}),t(f,{flex:"1",children:t(it,{data:{done:{color:"#7FB537",title:"Take profit",value:n},inprogress:{color:"#4FC0E8",title:"Resolved",value:l},waiting:{color:"#FE9B31",title:"Rejected",value:i},archive:{color:"#FA5F5A",title:"Stop loss",value:r}}})})]})})},ct=s()({root:{position:"relative",width:"100%"},container:{position:"absolute",top:0,height:"100%",width:"100%",overflowY:"auto",overflowX:"hidden"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"}}),dt=({items:e,sx:o})=>{const{classes:a}=ct();return t(u,{className:a.root,sx:o,children:[t(b,{disableRight:!0,color:"#fff",className:a.container,children:t("div",{className:a.content,children:e.map((e,o)=>t(st,{...e},o))})}),t(f,{sx:{position:"absolute",bottom:10,right:10,zIndex:10,pointerEvents:"auto",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(10px)",borderRadius:"12px",border:"1px solid rgba(255, 255, 255, 0.2)",padding:"12px 16px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.1)",opacity:.35,transition:"opacity 0.3s ease","&:hover":{opacity:1}},children:[t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#7FB537",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Take profit"})]}),t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#4FC0E8",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Resolved"})]}),t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FE9B31",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Rejected"})]}),t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FA5F5A",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Stop loss"})]})]})]})},pt=s()({root:{position:"relative"},tooltip:{position:"absolute",color:"gray",margin:0,left:5,top:5}}),ut={layout:{textColor:"#d1d4dc",backgroundColor:"#0000"},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}},mt={color:"#90cbfa",lineWidth:2,crosshairMarkerVisible:!1,lastValueVisible:!1,priceLineVisible:!1},ht=({height:e,width:o,items:a})=>{const{classes:n}=pt(),l=i.useRef(void 0),r=i.useRef(void 0);return i.useLayoutEffect(()=>{const{current:t}=l,{current:n}=r,i=x(t,{...ut,height:e,width:o});i.addLineSeries({...mt}).setData(a);const s=({time:e})=>{if(e)try{const{day:t,month:o,year:l}=e,i=a.find(({time:e})=>e.day===t&&e.month===o&&e.year===l);if(i){const e=Math.round(Math.round(100*i.value)/100);n.innerHTML=`${C("Total")}: ${e}, ${C("Resolved")}: ${i.resolved}, ${C("Rejected")}: ${i.rejected}`}else n.innerHTML=""}catch(t){console.log(t),n.innerHTML=""}else n.innerHTML=""};return i.timeScale().fitContent(),i.subscribeCrosshairMove(s),()=>{i.unsubscribeCrosshairMove(s),i.remove()}},[e,o,a]),t("div",{ref:l,className:n.root,children:t("p",{ref:r,className:n.tooltip})})},gt=({items:e})=>t(h,{children:({height:o,width:a})=>t(ht,{height:o,width:a,items:e})}),yt=s()({root:{},container:{position:"relative",margin:0,padding:0,overflow:"clip"},editor:{position:"absolute",top:0,left:0,right:0,bottom:0}}),ft=({items:e,sx:o})=>{const{classes:a}=yt(),n=i.useMemo(()=>[...e].sort(({stamp:e},{stamp:t})=>e-t).map(({count:e,rejected:t,resolved:o,stamp:a})=>{const n=k(a);return{time:{year:n.get("year"),month:n.get("month")+1,day:n.get("date")},rejected:t,resolved:o,value:e}}),[e]);return t(u,{className:a.container,sx:o,children:t("div",{className:a.editor,children:t(gt,{items:n})})})},vt=e=>P({handler:async(t,a)=>{const n=S(t,a);for await(const l of(e=>w(async()=>{const t="live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),a=t.filter(e=>"closed"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"finished"}));return"backtest"===e?a:[...t.filter(e=>"opened"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"pending"})),...a]}))(e))if(n([l]).done)break;return n([]).rows}}),bt=[{field:"color",label:B.nbsp,minWidth:45,width:()=>45,format:({symbol:e})=>t(A,{children:async()=>{var a;try{const n=await o.symbolGlobalService.getSymbolMap();return t(te,{sx:{color:(null==(a=n[e])?void 0:a.color)||"#ccc"}})}catch(n){return t(te,{sx:{color:"#ccc"}})}}})},{field:"symbol",label:"Symbol",minWidth:115,width:e=>Math.max(e-45-90-145-80-90-80,45),format:({symbol:e})=>e},{field:"position",label:"Position",minWidth:90,width:()=>90,format:({position:e})=>{const o="long"===e;return t("span",{style:{color:o?"#1976D2":"#F57C00",padding:"4px 8px",borderRadius:"4px",fontWeight:"bold",fontSize:"11px"},children:o?"🔵 LONG":"🟠 SHORT"})}},{field:"buyPrice",label:"Entry",minWidth:145,width:()=>145,format:({buyPrice:e})=>`${d(e)}$`},{field:"pnlEntries",label:"Invested",minWidth:80,width:()=>80,format:({pnlEntries:e})=>`${d(e)}$`},{field:"profitLossPercentage",label:"PNL %",minWidth:90,width:()=>90,format:({profitLossPercentage:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",e.toFixed(2),"%"]})}},{field:"pnlCost",label:"PNL $",minWidth:80,width:()=>80,format:({pnlCost:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",d(e),"$"]})}}],xt=[{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:N.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:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"date",title:"Date",readonly:!0,compute:e=>e.date?n(e.date).format("DD/MM/YYYY HH:mm"):""},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"buyPrice",title:"Entry",readonly:!0,compute:e=>e.buyPrice?`${d(e.buyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalBuyPrice",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalBuyPrice&&e.originalBuyPrice!==e.buyPrice,compute:e=>e.originalBuyPrice?`${d(e.originalBuyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"takeProfitPrice",title:"Take Profit",readonly:!0,compute:e=>e.takeProfitPrice?`${d(e.takeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalTakeProfitPrice",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalTakeProfitPrice&&e.originalTakeProfitPrice!==e.takeProfitPrice,compute:e=>e.originalTakeProfitPrice?`${d(e.originalTakeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"stopLossPrice",title:"Stop Loss",readonly:!0,compute:e=>e.stopLossPrice?`${d(e.stopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalStopLossPrice",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalStopLossPrice&&e.originalStopLossPrice!==e.stopLossPrice,compute:e=>e.originalStopLossPrice?`${d(e.originalStopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlEntries",title:"Invested",readonly:!0,compute:e=>`${d(e.pnlEntries)}$`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"profitLossPercentage",title:"PNL %",readonly:!0,trailingIcon:({data:e})=>e.profitLossPercentage<0?t(Z,{sx:{color:"red"}}):t(Q,{sx:{color:"green"}}),compute:e=>`${e.profitLossPercentage>=0?"+":""}${e.profitLossPercentage.toFixed(2)}%`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlCost",title:"PNL $",readonly:!0,compute:e=>`${e.pnlCost>=0?"+":""}${d(e.pnlCost)}$`},{type:N.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:N.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:N.Component,sx:{mt:2},element:({payload:e})=>t(I,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],Ct=[{label:"Details",icon:()=>t(V,{icon:ee,color:"#4caf50"}),action:"open-action"}],kt=({sx:e,mode:a})=>{const n=vt(a),[l,i]=L(null),{pickData:r,setOpen:s,render:c}=M({title:"Info",AfterTitle:({onClose:e})=>t(D,{direction:"row",gap:2,children:[t(R,{onClick:()=>o.layoutService.pickSignal(l.current.id),variant:"outlined",children:"Show Details"}),t($,{size:"small",onClick:e,children:t(T,{})})]}),payload:()=>({handleClose(){s(!1)}}),fields:xt,handler:()=>l.current,withActionButton:!1});return t(m,{children:[t(u,{sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column",background:"whitesmote",overflow:"clip",...e},children:t(j,{sx:{flex:1,background:"transparent !important"},rowColor:({status:e})=>"pending"===e?"#ffc40085":"transparent",hasMore:n.hasMore,loading:n.loading,onSkip:n.onSkip,data:n.data,columns:bt,rowActions:Ct,onRowClick:e=>{i(e),r(e.id)},onRowAction:(e,t)=>{"open-action"===e&&o.layoutService.pickSignal(t.id)}})}),c()]})},wt=[{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.thirtyOneDaysRevenue)||0,a=(null==e?void 0:e.thirtyOneDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"31 days",footerLabel:"Profit for 31 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.sevenDaysRevenue)||0,a=(null==e?void 0:e.sevenDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"7 days",footerLabel:"Profit for 7 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.yesterdayRevenue)||0,a=(null==e?void 0:e.yesterdayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Yesterday",footerLabel:"Yesterday's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.todayRevenue)||0,a=(null==e?void 0:e.todayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Today",footerLabel:"Today's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({tradePerfomance:e})=>{const o=[{color:"#DD4049",label:"Failed",maxValue:Math.max(e.rejectedCount+1,1),value:()=>e.rejectedCount},{color:"#2EA96F",label:"Successful",maxValue:Math.max(e.rejectedCount+e.resolvedCount+2,2),value:()=>e.resolvedCount},{color:"#F3A43A",label:"Total",hidden:!0,maxValue:Math.max(e.total+3,3),value:()=>e.total}];return t(nt,{style:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o,valueUnit:Le(Math.abs(e.resolvedCount),{one:"Successful signal",many:"Successful signals"}),value:e.resolvedCount})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({dailyTrades:e})=>t(ft,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:e})},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({successRate:e})=>{const o=e.map(({symbol:e,displayName:o,rejectedCloseCount:a,rejectedStopLossCount:n,resolvedCloseCount:l,resolvedTakeProfitCount:i})=>({title:o||e,description:e,avatar:()=>t(K,{symbol:e}),done:i,archive:n,waiting:a,inprogress:l})).filter(({done:e,archive:t,waiting:o,inprogress:a})=>{let n=!1;return n=n||!!e,n=n||!!t,n=n||!!o,n=n||!!a,n});return t(dt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:e})=>t(kt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},mode:e.mode})}],Pt={rejectedCount:0,resolvedCount:0,total:0},St=[{action:"download-action",label:"Download",icon:()=>t(V,{icon:H,color:"#4caf50"})},{divider:!0},{action:"live-action",label:"Switch to LIVE",isVisible:e=>"backtest"===e,icon:()=>t(V,{icon:G,color:"#4caf50"})},{action:"backtest-action",label:"Switch to BACKTEST",isVisible:e=>"live"===e,icon:()=>t(V,{icon:Y,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh manually",icon:()=>t(V,{icon:J,color:"#4caf50"})}],Lt=[{type:W.Link,action:"back-action",label:t(q,{sx:{display:"block"}})},{type:W.Link,action:"back-action",label:"Main"},{type:W.Link,action:"back-action",label:"Dashboard"},{type:W.Link,action:"back-action",compute:e=>`KPI ${String(e).toUpperCase()}`}],Mt=new F,Nt=({mode:e="backtest"})=>{const[a,{loading:n,execute:l}]=E(async()=>{const t=await o.symbolGlobalService.getSymbolList(),a=await o.symbolGlobalService.getSymbolMap(),n=new Map,l=[],i={...Pt};let r={symbol:"TOTAL",todayRevenue:0,yesterdayRevenue:0,sevenDaysRevenue:0,thirtyOneDaysRevenue:0,todayCount:0,yesterdayCount:0,sevenDaysCount:0,thirtyOneDaysCount:0};await Promise.all(t.map(async t=>{var o;const[s=[],c,d,p]=await Promise.all([ie(t,e),le(t,e),ne(t,e),re(t,e)]);for(const e of s){const t=n.get(e.stamp)||{count:0,resolved:0,rejected:0};n.set(e.stamp,{count:t.count+e.count,resolved:t.resolved+e.resolved,rejected:t.rejected+e.rejected})}l.push({...c,symbol:t,displayName:(null==(o=a[t])?void 0:o.displayName)||t}),i.rejectedCount+=d.rejectedCount,i.resolvedCount+=d.resolvedCount,i.total+=d.total,r.todayRevenue+=p.todayRevenue,r.yesterdayRevenue+=p.yesterdayRevenue,r.sevenDaysRevenue+=p.sevenDaysRevenue,r.thirtyOneDaysRevenue+=p.thirtyOneDaysRevenue,r.todayCount+=p.todayCount,r.yesterdayCount+=p.yesterdayCount,r.sevenDaysCount+=p.sevenDaysCount,r.thirtyOneDaysCount+=p.thirtyOneDaysCount}));return{dailyTrades:Array.from(n).map(([e,{count:t,resolved:o,rejected:a}])=>({stamp:e,count:t,resolved:o,rejected:a})),successRate:l,tradePerfomance:i,revenueCount:r}},{onLoadStart:()=>o.layoutService.setModalLoader(!0),onLoadEnd:()=>o.layoutService.setModalLoader(!1),deps:[e]}),{execute:i}=O(async()=>{const t=await oe(e),a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(a);o.layoutService.downloadFile(n,`signals_${e}_${Date.now()}.json`)},{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});z(()=>Mt.subscribe(l));return t(X,{children:[t(U,{items:Lt,actions:St,payload:e,onAction:async e=>{"download-action"===e&&await i(),"update-now"===e&&(oe.clear(),await Mt.next()),"live-action"===e&&o.routerService.push("/dashboard/live"),"backtest-action"===e&&o.routerService.push("/dashboard/backtest"),"back-action"===e&&o.routerService.push("/")}}),a?n?null:t(_,{handler:a,payload:()=>({handleUpdate(){Mt.next()},mode:e}),fields:wt}):null]})};export{Nt as DashboardPage,Nt as default};
1
+ import{b as e,f as t,i as o,ak as a,al as n,am as l,r as i,an as r,p as s,T as c,ag as d,c as p,P as u,F as m,ao as h,ap as g,aq as y,B as f,ab as v,ar as b,as as x,a0 as C,at as k,au as w,av as P,aw as S,ax as L,ay as M,H as N,a4 as R,I as $,az as T,N as D,aA as j,L as B,O as I,z as V,J as A,X as E,aB as O,Y as z,Z as F,v as U,w as W,D as H,aC as G,aD as Y,x as _}from"./index-C0618UQS.js";import{I as K}from"./IconPhoto-BdD97QYO.js";import{C as X,R as J}from"./Refresh-DAu-7wmf.js";import{K as q}from"./KeyboardArrowLeft-Dthfoq7U.js";const Z=e(t("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 10V8h-2v4H8l4 4 4-4h-3z"}),"ArrowCircleDown"),Q=e(t("path",{d:"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0 2c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm-1-10v4h2v-4h3l-4-4-4 4h3z"}),"ArrowCircleUp"),ee=e(t("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z"}),"AutoFixHigh"),te=e(t("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle"),oe=l(async e=>"live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),{key:([e])=>`${e}`,timeout:45e3}),ae=async(e,t)=>(await oe(t)).filter(t=>"closed"===t.status&&t.symbol===e),ne=async(e,t)=>{const o=await ae(e,t);return{total:o.length,resolvedCount:o.filter(e=>e.pnl.pnlPercentage>0).length,rejectedCount:o.filter(e=>e.pnl.pnlPercentage<=0).length}},le=async(e,t)=>{const o=await ae(e,t),a=e=>Math.abs(e.pnl.priceClose-e.priceTakeProfit)/e.priceTakeProfit<.005,n=e=>Math.abs(e.pnl.priceClose-e.priceStopLoss)/e.priceStopLoss<.005;return{resolvedTakeProfitCount:o.filter(e=>e.pnl.pnlPercentage>0&&a(e)).length,rejectedStopLossCount:o.filter(e=>e.pnl.pnlPercentage<=0&&n(e)).length,resolvedCloseCount:o.filter(e=>e.pnl.pnlPercentage>0&&!a(e)).length,rejectedCloseCount:o.filter(e=>e.pnl.pnlPercentage<=0&&!n(e)).length}},ie=async(e,t)=>{const o=await ae(e,t),l=new Map;for(const i of o){const e=a(n(i.updatedAt)),t=l.get(e)??{resolved:0,rejected:0};i.pnl.pnlPercentage>0?l.set(e,{...t,resolved:t.resolved+1}):l.set(e,{...t,rejected:t.rejected+1})}return Array.from(l.entries()).map(([e,{resolved:t,rejected:o}])=>({stamp:e,count:t+o,resolved:t,rejected:o}))},re=async(e,t)=>{const o=await ae(e,t),a="backtest"===t&&o.length?o.reduce((e,t)=>Math.max(e,t.updatedAt),0):Date.now(),l=n(a).startOf("day").valueOf(),i=l-864e5,r=l-6048e5,s=l-26784e5,c=e=>e.reduce((e,t)=>e+t.pnl.pnlCost,0),d=o.filter(e=>e.updatedAt>=l),p=o.filter(e=>e.updatedAt>=i&&e.updatedAt<l),u=o.filter(e=>e.updatedAt>=r),m=o.filter(e=>e.updatedAt>=s);return{symbol:e,todayRevenue:c(d),yesterdayRevenue:c(p),sevenDaysRevenue:c(u),thirtyOneDaysRevenue:c(m),todayCount:d.length,yesterdayCount:p.length,sevenDaysCount:u.length,thirtyOneDaysCount:m.length}};var se=(e=>(e.Red="#DD4049",e.Orange="#F3A43A",e.Green="#2EA96F",e.Blue="#2979ff",e.Violet="#d500f9",e))(se||{});const ce=i.createContext(null),de=({value:e,children:o})=>t(ce.Provider,{value:e,children:o}),pe=()=>i.useContext(ce);var ue=(e=>(e.Semi="semi",e.Solid="solid",e.Unset="unset",e))(ue||{});const me=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"stretch",whiteSpace:"nowrap",gap:"8px",overflow:"clip",padding:"10px",borderTop:`1px solid ${e.palette.divider}`,"& > *":{flex:1}},solidBackground:{color:"#fff","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}},semiBackground:{color:e.palette.text.primary,"& svg":{fill:e.palette.text.primary}}})),he=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=me(),{footerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...s===ue.Solid&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},ge=(e,t=2)=>{let o=1;for(let a=0;a<t;a++)o*=10;return Math.round(e*o)/o},ye=s()({root:{position:"relative",width:"100%",height:"0px"},container:{position:"absolute",top:0,left:0,width:"100%",display:"flex",alignItems:"center",justifyContent:"center"}}),fe=({caption:e})=>{const{classes:o}=ye();return t("div",{className:o.root,children:t("div",{className:o.container,children:t(c,{variant:"caption",sx:{opacity:.5,fontSize:12,textAlign:"center",padding:"0 8px"},children:e})})})},ve=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},solidBackground:{"& > :first-of-type":{color:"#fff",fontWeight:"bold"},"& > :last-of-type":{color:"#fff"}},unsetBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},semiBackground:{"& > :first-of-type":{color:e.palette.text.primary,fontWeight:"bold"},"& > :last-of-type":{color:e.palette.text.primary}},content:{display:"flex",alignItems:"baseline",flexDirection:"row",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),be=p(e=>t("div",{className:e.v0,style:e.v1,children:[t("div",{className:e.v2,children:[e.v3,e.v4]}),e.v5]}),{name:"Content_1",portals:["v3","v4","v5"]}),xe=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=ve(),{backgroundMode:l=ue.Solid,roundDigits:s=2,value:p,caption:u,valueUnit:m="Unit"}=pe(),h=i.useMemo(()=>({...o,...l===ue.Solid&&{backgroundColor:a}}),[a,l,o]);return t(be,{v0:r(e,n.root),v1:h,v2:r(n.content,{[n.solidBackground]:l===ue.Solid,[n.unsetBackground]:l===ue.Unset,[n.semiBackground]:l===ue.Semi}),v3:t(c,{fontWeight:"bold",children:d(ge(p,s))}),v4:t(c,{children:m}),v5:!!u&&t(fe,{caption:u})})},Ce=s()(e=>({root:{display:"flex",alignItems:"center",whiteSpace:"nowrap",fontWeight:700,fontSize:"18px",paddingLeft:"8px",gap:"8px",overflow:"clip",borderBottom:`1px solid ${e.palette.divider}`},solidBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},semiBackground:{color:"#fff",padding:"10px","& svg":{fill:"#fff"}},unsetBackground:{color:e.palette.text.primary,padding:"10px","& svg":{fill:e.palette.text.primary}}})),ke=({className:e,style:o,backgroundColor:a})=>{const{classes:n}=Ce(),{headerLabel:l,backgroundMode:s=ue.Solid}=pe(),c=i.useMemo(()=>({...o,...(s===ue.Solid||s===ue.Semi)&&{backgroundColor:a}}),[a,s,o]);return t("div",{className:r(e,n.root,{[n.solidBackground]:s===ue.Solid,[n.unsetBackground]:s===ue.Unset,[n.semiBackground]:s===ue.Semi}),style:c,children:l})},we=s()({root:{overflow:"clip",height:"100%",width:"100%",display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},click:{cursor:"pointer"},header:{minHeight:"36px"},content:{flex:1},footer:{minHeight:"32px"}}),Pe=({className:e,style:o})=>{const{classes:a}=we(),{backgroundColor:n,onClick:l,footerLabel:i}=pe();return t(u,{className:r(e,a.root,{[a.click]:!!l}),onClick:l,style:o,children:[t(ke,{backgroundColor:n}),t(xe,{backgroundColor:n,className:a.content}),!!i&&t(he,{backgroundColor:n,className:a.footer})]})},Se=i.memo(({className:e,style:o,...a})=>t(de,{value:a,children:t(Pe,{className:e,style:o})})),Le=(e,{one:t,many:o,two:a=o})=>`${(()=>{if(0===e||e>=11&&e<20)return o;let n=e%10;return 0===n?o:1===n?t:n<5?a:o})()}`,Me=i.createContext(null),Ne=({value:e,children:o})=>t(Me.Provider,{value:e,children:o}),Re=()=>i.useContext(Me),$e=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",paddingLeft:"20px",paddingRight:"20px",overflow:"clip"},container:{flex:1,display:"flex",alignItems:"stretch",justifyContent:"center",gap:"40px"},item:{gap:"4px",display:"flex",alignItems:"center",justifyContent:"center","& > span":{fontWeight:500,fontSize:"12px",color:"var(--black-6)",whiteSpace:"nowrap"}},circle:{borderRadius:"50%",height:"8px",width:"8px"}}),Te=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Footer_1",portals:["v3"]}),De=({className:e,style:o})=>{const{classes:a}=$e(),{items:n}=Re();return t(Te,{v0:r(e,a.root),v1:o,v2:a.container,v3:[...n].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,o)=>t("div",{className:a.item,children:[t("div",{className:a.circle,style:{background:e.color}}),t("span",{children:[e.label," ",e.value?e.value():e.maxValue]})]},o))})},je=s()(()=>({circle:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%","& > div":{borderRadius:"50%"}}})),Be=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{style:e.v2})}),{name:"Circle_1"}),Ie=({className:e,style:o,lineWidth:a,side:n,color:l,rotate:i})=>{const{classes:s}=je();return t(Be,{v0:r(e,s.circle),v1:{...o},v2:{borderTop:`${a}px solid ${l}`,borderLeft:`${a}px solid ${l}`,borderRight:`${a}px solid transparent`,borderBottom:`${a}px solid transparent`,transform:`rotate(${i}deg)`,height:n,width:n}})},Ve=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",background:e.palette.background.paper}})),Ae=({side:e})=>{const{classes:o}=Ve();return t("div",{className:o.dot,style:{height:e,width:e}})},Ee=s()(e=>({line:{position:"absolute",background:e.palette.background.paper,height:"100%",width:"1px",left:"50%",transformOrigin:"center bottom"}})),Oe=({angle:e})=>{const{classes:o}=Ee();return t("div",{className:o.line,style:{transform:`rotate(${e}deg)`}})},ze=s()(e=>({dot:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",borderRadius:"50%",outline:`100vmax solid ${e.palette.background.paper}`}})),Fe=({side:e})=>{const{classes:o}=ze();return t("div",{className:o.dot,style:{height:e,width:e}})},Ue=s()(e=>({pointer:{position:"absolute",left:"21%",width:"29%",bottom:"0%",zIndex:1,transformOrigin:"right center",fill:e.palette.text.primary}})),We=p(e=>t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 87 8",className:e.v0,style:e.v1,...e.v2,children:[t("rect",{x:"0.5",y:"2.5",width:"79",height:"3"}),t("circle",{cx:"82.5",cy:"4",r:"4"})]}),{name:"Pointer_1",svg:!0}),He=({className:e,style:o,angle:a,scale:n=1,...l})=>{const{classes:i}=Ue();return t(We,{v0:r(e,i.pointer),v1:{...o,transform:`rotate(${a}deg) scale(${n}) translateX(5px)`},v2:l})},Ge=e=>e*Math.PI/180,Ye=(e,t)=>({left:t*Math.cos(Ge(e))+t,top:t*Math.sin(Ge(e))+t}),_e=s()(e=>({root:{position:"absolute",transform:"translate(-50%, 50%)",bottom:"0",left:"50%",display:"flex",alignItems:"stretch",justifyContent:"stretch"},container:{flex:1,position:"relative"},label:{position:"absolute",transform:"translate(-50%, -50%)",color:e.palette.text.primary,zIndex:2}})),Ke=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:e.v3})}),{name:"Labels_1",portals:["v3"]}),Xe=({items:e,side:o})=>{const{classes:a}=_e(),n=i.useMemo(()=>Math.floor(o/2),[o]);return t(Ke,{v0:a.root,v1:{height:o,width:o},v2:a.container,v3:e.slice(0,e.length-1).map(({angle:e,value:o},l)=>t("span",{className:a.label,style:{...Ye(e+180,n),...e<90&&{marginLeft:10},...e>90&&{marginLeft:-10},...e>15&&e<165&&{marginTop:5}},children:o},l))})},Je=({width:e,side:o,chunks:a,maxValue:n,minValue:l,value:r})=>{const s=i.useMemo(()=>.5*o,[o]),c=i.useMemo(()=>.63*o,[o]),d=i.useMemo(()=>.58*o,[o]),p=i.useCallback(e=>180/(n-l)*(e.minValue-l)+45,[n,l]),u=i.useMemo(()=>Math.min(r/n*180,180),[n,r]),h=i.useMemo(()=>e>o?c/e*1.5:1,[c,e,o]),g=i.useMemo(()=>[...a].sort(({maxValue:e},{maxValue:t})=>e-t).slice(0,a.length-1).map(e=>({angle:180/n*e.maxValue,value:e.maxValue})),[a,n]),y=i.useMemo(()=>[{angle:0,value:0},...g,{angle:180,value:n}],[g,n]);return t(m,{children:[t(He,{angle:u,scale:h}),[...a].sort(({maxValue:e},{maxValue:t})=>e-t).map((e,a)=>t(Ie,{rotate:p(e),color:e.color,side:o,lineWidth:s},`${e.color}-${a}`)),g.map(({angle:e},o)=>t(Oe,{angle:e-90},`${e}-${o}`)),t(Fe,{side:o}),t(Ae,{side:c}),t(Xe,{items:y,side:d})]})},qe=s()({root:{display:"flex",alignItems:"stretch",justifyContent:"stretch",overflow:"clip"},container:{flex:1,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},bottomCenterLabel:{position:"absolute",zIndex:2,bottom:"0",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row",gap:"4px","& > *":{fontSize:"20px",lineHeight:"24px"},"& > :first-of-type":{fontWeight:"bold"},"& > :last-of-type":{color:"var(--black-6)"}}}),Ze=({className:e,height:o,width:a})=>{const{classes:n}=qe(),{value:l,items:s}=Re(),c=Math.min(2*o,a),d=i.useMemo(()=>[...s].filter(e=>!e.hidden).sort(({maxValue:e},{maxValue:t})=>t-e).map((e,t,o)=>{const a=o[t+1],n=a?a.maxValue:0;return{...e,minValue:n,value:e.maxValue-n}}),[s]),p=i.useMemo(()=>{const e=d.find(({minValue:e,maxValue:t})=>l>=e&&l<=t);if(e)return e.color;return d.reduce((e,t)=>t.minValue>=e.minValue?t:e).color},[d,l]),u=i.useMemo(()=>d.reduce((e,{minValue:t})=>Math.min(e,t),Number.POSITIVE_INFINITY),[d]),m=i.useMemo(()=>d.reduce((e,{maxValue:t})=>Math.max(e,t),Number.NEGATIVE_INFINITY),[d]);return t("div",{className:r(e,n.root),children:t("div",{className:n.container,children:t(Je,{chunks:d,value:l,minValue:u,maxValue:m,side:c,width:a,color:p})})})},Qe=s()(e=>({root:{display:"flex",alignItems:"center",justifyContent:"center",borderLeft:0,borderRight:0,borderWidth:"1px 0",borderStyle:"solid",borderColor:e.palette.divider},container:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"row"},content:{display:"flex",alignItems:"baseline",gap:"2.5px","& > *":{fontWeight:"bold"},"& > :first-of-type":{fontSize:"22px"},"& > :last-of-type":{fontSize:"16px",opacity:.85}}})),et=p(e=>t("div",{className:e.v0,style:e.v1,children:t("div",{className:e.v2,children:t("div",{className:e.v3,children:[e.v4,e.v5]})})}),{name:"Note_1",portals:["v4","v5"]}),tt=({className:e,style:o})=>{const{classes:a}=Qe(),{value:n,roundDigits:l=3,valueUnit:i="Unit"}=Re();return t(et,{v0:r(e,a.root),v1:o,v2:a.container,v3:a.content,v4:t(c,{children:ge(n,l)}),v5:t(c,{children:i})})},ot=s()(e=>({root:{position:"relative",overflow:"clip",height:"100%",width:"100%",background:e.palette.background.paper},container:{position:"absolute",top:"0",left:"0"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"},chart:{flex:1,paddingTop:"6px",paddingBottom:"6px"},footer:{minHeight:"32px"},note:{minHeight:"60px"}})),at=({className:e,style:o})=>{const{classes:a}=ot(),n=e=>{let t=e;return t-=32,t-=12,t-=60,t},l=e=>{let t=e;return t-=12,t};return t(u,{className:r(e,a.root),style:o,children:t(h,{className:a.container,children:({height:e=0,width:o=0})=>t("div",{className:a.content,style:{height:e,width:o},children:[t(Ze,{className:a.chart,height:n(e),width:l(o)}),t(tt,{className:a.note}),t(De,{className:a.footer})]})})})},nt=i.memo(({className:e,style:o,...a})=>t(Ne,{value:a,children:t(at,{className:e,style:o})})),lt=s()({root:{position:"relative",height:10,flex:1},bar:{position:"absolute !important",top:"42%",left:0,right:10}}),it=e=>{const{classes:o}=lt(),a=["done","inprogress","waiting","archive"],n=t=>{var o;return null==(o=e.data[t])?void 0:o.value},l=a.map(t=>{const o=n(t);var a,l;return`${a=t,(null==(l=e.data[a])?void 0:l.title)||t} - ${o}`}).join(" | "),i=a.map(t=>{const o=(t=>{var o;return null==(o=e.data[t])?void 0:o.color})(t);return{color:o,value:n(t),key:t}}).map(({color:e,value:t,key:o},l)=>{let i=0;if(0!==l)for(let r=l-1;r>=0;r--)i+=n(a[r]);return{value:t>0?t+i:t,key:o,color:e}}).sort(({value:e},{value:t})=>t-e),r=Math.max(...i.map(({value:e})=>e));return t(y,{title:l,arrow:!0,children:t("div",{className:o.root,children:i.map(({color:e,value:a,key:n},l)=>{const i=((e,t=100)=>Math.min(100,Math.round(Math.max(Number(e),0)/t*100)))(a,r);return t(g,{sx:{height:"10px !important",zIndex:`${l+1} !important`,backgroundColor:"transparent !important","& .MuiLinearProgress-bar":{borderTopRightRadius:5,borderBottomRightRadius:5,backgroundColor:`${e} !important`}},variant:"determinate",className:o.bar,value:i},`${l}-${n}`)})})})},rt=s()({root:{display:"flex"},work:{display:"flex",alignItems:"center"},row:{flex:1,paddingLeft:5,paddingRight:5,paddingBottom:15}}),st=({title:e,description:o,avatar:a,done:n,inprogress:l,waiting:i,archive:r})=>{const{classes:s}=rt();return t(f,{className:s.root,children:t(f,{className:s.row,children:[t(f,{className:s.work,children:[t(a,{}),t(v,{primary:e,secondary:o,sx:{flex:"none",marginLeft:"0.5em"}})]}),t(f,{flex:"1",children:t(it,{data:{done:{color:"#7FB537",title:"Take profit",value:n},inprogress:{color:"#4FC0E8",title:"Resolved",value:l},waiting:{color:"#FE9B31",title:"Rejected",value:i},archive:{color:"#FA5F5A",title:"Stop loss",value:r}}})})]})})},ct=s()({root:{position:"relative",width:"100%"},container:{position:"absolute",top:0,height:"100%",width:"100%",overflowY:"auto",overflowX:"hidden"},content:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column"}}),dt=({items:e,sx:o})=>{const{classes:a}=ct();return t(u,{className:a.root,sx:o,children:[t(b,{disableRight:!0,color:"#fff",className:a.container,children:t("div",{className:a.content,children:e.map((e,o)=>t(st,{...e},o))})}),t(f,{sx:{position:"absolute",bottom:10,right:10,zIndex:10,pointerEvents:"auto",background:"rgba(255, 255, 255, 0.1)",backdropFilter:"blur(10px)",borderRadius:"12px",border:"1px solid rgba(255, 255, 255, 0.2)",padding:"12px 16px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.1)",opacity:.35,transition:"opacity 0.3s ease","&:hover":{opacity:1}},children:[t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#7FB537",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Take profit"})]}),t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#4FC0E8",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Resolved"})]}),t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FE9B31",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Rejected"})]}),t(f,{sx:{display:"flex",alignItems:"center"},children:[t("div",{style:{background:"#FA5F5A",width:15,height:15,borderRadius:"3px",marginRight:"5px"}}),t("span",{children:"Stop loss"})]})]})]})},pt=s()({root:{position:"relative"},tooltip:{position:"absolute",color:"gray",margin:0,left:5,top:5}}),ut={layout:{textColor:"#d1d4dc",backgroundColor:"#0000"},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}},mt={color:"#90cbfa",lineWidth:2,crosshairMarkerVisible:!1,lastValueVisible:!1,priceLineVisible:!1},ht=({height:e,width:o,items:a})=>{const{classes:n}=pt(),l=i.useRef(void 0),r=i.useRef(void 0);return i.useLayoutEffect(()=>{const{current:t}=l,{current:n}=r,i=x(t,{...ut,height:e,width:o});i.addLineSeries({...mt}).setData(a);const s=({time:e})=>{if(e)try{const{day:t,month:o,year:l}=e,i=a.find(({time:e})=>e.day===t&&e.month===o&&e.year===l);if(i){const e=Math.round(Math.round(100*i.value)/100);n.innerHTML=`${C("Total")}: ${e}, ${C("Resolved")}: ${i.resolved}, ${C("Rejected")}: ${i.rejected}`}else n.innerHTML=""}catch(t){console.log(t),n.innerHTML=""}else n.innerHTML=""};return i.timeScale().fitContent(),i.subscribeCrosshairMove(s),()=>{i.unsubscribeCrosshairMove(s),i.remove()}},[e,o,a]),t("div",{ref:l,className:n.root,children:t("p",{ref:r,className:n.tooltip})})},gt=({items:e})=>t(h,{children:({height:o,width:a})=>t(ht,{height:o,width:a,items:e})}),yt=s()({root:{},container:{position:"relative",margin:0,padding:0,overflow:"clip"},editor:{position:"absolute",top:0,left:0,right:0,bottom:0}}),ft=({items:e,sx:o})=>{const{classes:a}=yt(),n=i.useMemo(()=>[...e].sort(({stamp:e},{stamp:t})=>e-t).map(({count:e,rejected:t,resolved:o,stamp:a})=>{const n=k(a);return{time:{year:n.get("year"),month:n.get("month")+1,day:n.get("date")},rejected:t,resolved:o,value:e}}),[e]);return t(u,{className:a.container,sx:o,children:t("div",{className:a.editor,children:t(gt,{items:n})})})},vt=e=>P({handler:async(t,a)=>{const n=S(t,a);for await(const l of(e=>w(async()=>{const t="live"===e?await o.storageViewService.listSignalLive():await o.storageViewService.listSignalBacktest(),a=t.filter(e=>"closed"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"finished"}));return"backtest"===e?a:[...t.filter(e=>"opened"===e.status).map(e=>({id:e.id,symbol:e.symbol,position:e.position,takeProfitPrice:e.priceTakeProfit,originalTakeProfitPrice:e.originalPriceTakeProfit,stopLossPrice:e.priceStopLoss,originalStopLossPrice:e.originalPriceStopLoss,profitLossPercentage:e.pnl.pnlPercentage,pnlCost:e.pnl.pnlCost,pnlEntries:e.pnl.pnlEntries,buyPrice:e.priceOpen,originalBuyPrice:e.originalPriceOpen,cost:e.cost,totalEntries:e.totalEntries,totalPartials:e.totalPartials,partialExecuted:e.partialExecuted,date:new Date(e.createdAt).toISOString(),status:"pending"})),...a]}))(e))if(n([l]).done)break;return n([]).rows}}),bt=[{field:"color",label:B.nbsp,minWidth:45,width:()=>45,format:({symbol:e})=>t(A,{children:async()=>{var a;try{const n=await o.symbolGlobalService.getSymbolMap();return t(te,{sx:{color:(null==(a=n[e])?void 0:a.color)||"#ccc"}})}catch(n){return t(te,{sx:{color:"#ccc"}})}}})},{field:"symbol",label:"Symbol",minWidth:115,width:e=>Math.max(e-45-90-145-80-90-80,45),format:({symbol:e})=>e},{field:"position",label:"Position",minWidth:90,width:()=>90,format:({position:e})=>{const o="long"===e;return t("span",{style:{color:o?"#1976D2":"#F57C00",padding:"4px 8px",borderRadius:"4px",fontWeight:"bold",fontSize:"11px"},children:o?"🔵 LONG":"🟠 SHORT"})}},{field:"buyPrice",label:"Entry",minWidth:145,width:()=>145,format:({buyPrice:e})=>`${d(e)}$`},{field:"pnlEntries",label:"Invested",minWidth:80,width:()=>80,format:({pnlEntries:e})=>`${d(e)}$`},{field:"profitLossPercentage",label:"PNL %",minWidth:90,width:()=>90,format:({profitLossPercentage:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",e.toFixed(2),"%"]})}},{field:"pnlCost",label:"PNL $",minWidth:80,width:()=>80,format:({pnlCost:e})=>{const o=e>=0;return t("span",{style:{color:o?"green":"red"},children:[o?"+":"",d(e),"$"]})}}],xt=[{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:N.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:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"date",title:"Date",readonly:!0,compute:e=>e.date?n(e.date).format("DD/MM/YYYY HH:mm"):""},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"buyPrice",title:"Entry",readonly:!0,compute:e=>e.buyPrice?`${d(e.buyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalBuyPrice",title:"Original Entry",readonly:!0,isVisible:e=>null!=e.originalBuyPrice&&e.originalBuyPrice!==e.buyPrice,compute:e=>e.originalBuyPrice?`${d(e.originalBuyPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"takeProfitPrice",title:"Take Profit",readonly:!0,compute:e=>e.takeProfitPrice?`${d(e.takeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalTakeProfitPrice",title:"Original Take Profit",readonly:!0,isVisible:e=>null!=e.originalTakeProfitPrice&&e.originalTakeProfitPrice!==e.takeProfitPrice,compute:e=>e.originalTakeProfitPrice?`${d(e.originalTakeProfitPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"stopLossPrice",title:"Stop Loss",readonly:!0,compute:e=>e.stopLossPrice?`${d(e.stopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"originalStopLossPrice",title:"Original Stop Loss",readonly:!0,isVisible:e=>null!=e.originalStopLossPrice&&e.originalStopLossPrice!==e.stopLossPrice,compute:e=>e.originalStopLossPrice?`${d(e.originalStopLossPrice)}$`:"N/A"},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlEntries",title:"Invested",readonly:!0,compute:e=>`${d(e.pnlEntries)}$`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"profitLossPercentage",title:"PNL %",readonly:!0,trailingIcon:({data:e})=>e.profitLossPercentage<0?t(Z,{sx:{color:"red"}}):t(Q,{sx:{color:"green"}}),compute:e=>`${e.profitLossPercentage>=0?"+":""}${e.profitLossPercentage.toFixed(2)}%`},{type:N.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"pnlCost",title:"PNL $",readonly:!0,compute:e=>`${e.pnlCost>=0?"+":""}${d(e.pnlCost)}$`},{type:N.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:N.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:N.Component,sx:{mt:2},element:({payload:e})=>t(I,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],Ct=[{label:"Details",icon:()=>t(V,{icon:ee,color:"#4caf50"}),action:"open-action"}],kt=({sx:e,mode:a})=>{const n=vt(a),[l,i]=L(null),{pickData:r,setOpen:s,render:c}=M({title:"Info",AfterTitle:({onClose:e})=>t(D,{direction:"row",gap:2,children:[t(R,{onClick:()=>o.layoutService.pickSignal(l.current.id),variant:"outlined",children:"Show Details"}),t($,{size:"small",onClick:e,children:t(T,{})})]}),payload:()=>({handleClose(){s(!1)}}),fields:xt,handler:()=>l.current,withActionButton:!1});return t(m,{children:[t(u,{sx:{display:"flex",alignItems:"stretch",justifyContent:"stretch",flexDirection:"column",background:"whitesmote",overflow:"clip",...e},children:t(j,{sx:{flex:1,background:"transparent !important"},rowColor:({status:e})=>"pending"===e?"#ffc40085":"transparent",hasMore:n.hasMore,loading:n.loading,onSkip:n.onSkip,data:n.data,columns:bt,rowActions:Ct,onRowClick:e=>{i(e),r(e.id)},onRowAction:(e,t)=>{"open-action"===e&&o.layoutService.pickSignal(t.id)}})}),c()]})},wt=[{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.thirtyOneDaysRevenue)||0,a=(null==e?void 0:e.thirtyOneDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"31 days",footerLabel:"Profit for 31 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.sevenDaysRevenue)||0,a=(null==e?void 0:e.sevenDaysCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"7 days",footerLabel:"Profit for 7 days",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.yesterdayRevenue)||0,a=(null==e?void 0:e.yesterdayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Yesterday",footerLabel:"Yesterday's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"3",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({revenueCount:e})=>{const o=(null==e?void 0:e.todayRevenue)||0,a=(null==e?void 0:e.todayCount)||0,n=o<0?se.Red:o>0?se.Green:se.Orange;return t(Se,{style:{height:"max(calc((100dvh - 100px) / 3), 275px)"},value:o,backgroundColor:n,backgroundMode:ue.Semi,valueUnit:"USDT",headerLabel:"Today",footerLabel:"Today's profit",caption:`${a} ${Le(a,{one:"trade",many:"trades"})}`})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({tradePerfomance:e})=>{const o=[{color:"#DD4049",label:"Failed",maxValue:Math.max(e.rejectedCount+1,1),value:()=>e.rejectedCount},{color:"#2EA96F",label:"Successful",maxValue:Math.max(e.rejectedCount+e.resolvedCount+2,2),value:()=>e.resolvedCount},{color:"#F3A43A",label:"Total",hidden:!0,maxValue:Math.max(e.total+3,3),value:()=>e.total}];return t(nt,{style:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o,valueUnit:Le(Math.abs(e.resolvedCount),{one:"Successful signal",many:"Successful signals"}),value:e.resolvedCount})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({dailyTrades:e})=>t(ft,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:e})},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({successRate:e})=>{const o=e.map(({symbol:e,displayName:o,rejectedCloseCount:a,rejectedStopLossCount:n,resolvedCloseCount:l,resolvedTakeProfitCount:i})=>({title:o||e,description:e,avatar:()=>t(K,{symbol:e}),done:i,archive:n,waiting:a,inprogress:l})).filter(({done:e,archive:t,waiting:o,inprogress:a})=>{let n=!1;return n=n||!!e,n=n||!!t,n=n||!!o,n=n||!!a,n});return t(dt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},items:o})}},{type:N.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:e})=>t(kt,{sx:{height:"max(calc((100dvh - 100px) / 2), 450px)"},mode:e.mode})}],Pt={rejectedCount:0,resolvedCount:0,total:0},St=[{action:"download-action",label:"Download",icon:()=>t(V,{icon:H,color:"#4caf50"})},{divider:!0},{action:"live-action",label:"Switch to LIVE",isVisible:e=>"backtest"===e,icon:()=>t(V,{icon:G,color:"#4caf50"})},{action:"backtest-action",label:"Switch to BACKTEST",isVisible:e=>"live"===e,icon:()=>t(V,{icon:Y,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh manually",icon:()=>t(V,{icon:J,color:"#4caf50"})}],Lt=[{type:W.Link,action:"back-action",label:t(q,{sx:{display:"block"}})},{type:W.Link,action:"back-action",label:"Main"},{type:W.Link,action:"back-action",label:"Dashboard"},{type:W.Link,action:"back-action",compute:e=>`KPI ${String(e).toUpperCase()}`}],Mt=new F,Nt=({mode:e="backtest"})=>{const[a,{loading:n,execute:l}]=E(async()=>{const t=await o.symbolGlobalService.getSymbolList(),a=await o.symbolGlobalService.getSymbolMap(),n=new Map,l=[],i={...Pt};let r={symbol:"TOTAL",todayRevenue:0,yesterdayRevenue:0,sevenDaysRevenue:0,thirtyOneDaysRevenue:0,todayCount:0,yesterdayCount:0,sevenDaysCount:0,thirtyOneDaysCount:0};await Promise.all(t.map(async t=>{var o;const[s=[],c,d,p]=await Promise.all([ie(t,e),le(t,e),ne(t,e),re(t,e)]);for(const e of s){const t=n.get(e.stamp)||{count:0,resolved:0,rejected:0};n.set(e.stamp,{count:t.count+e.count,resolved:t.resolved+e.resolved,rejected:t.rejected+e.rejected})}l.push({...c,symbol:t,displayName:(null==(o=a[t])?void 0:o.displayName)||t}),i.rejectedCount+=d.rejectedCount,i.resolvedCount+=d.resolvedCount,i.total+=d.total,r.todayRevenue+=p.todayRevenue,r.yesterdayRevenue+=p.yesterdayRevenue,r.sevenDaysRevenue+=p.sevenDaysRevenue,r.thirtyOneDaysRevenue+=p.thirtyOneDaysRevenue,r.todayCount+=p.todayCount,r.yesterdayCount+=p.yesterdayCount,r.sevenDaysCount+=p.sevenDaysCount,r.thirtyOneDaysCount+=p.thirtyOneDaysCount}));return{dailyTrades:Array.from(n).map(([e,{count:t,resolved:o,rejected:a}])=>({stamp:e,count:t,resolved:o,rejected:a})),successRate:l,tradePerfomance:i,revenueCount:r}},{onLoadStart:()=>o.layoutService.setModalLoader(!0),onLoadEnd:()=>o.layoutService.setModalLoader(!1),deps:[e]}),{execute:i}=O(async()=>{const t=await oe(e),a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),n=URL.createObjectURL(a);o.layoutService.downloadFile(n,`signals_${e}_${Date.now()}.json`)},{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});z(()=>Mt.subscribe(l));return t(X,{children:[t(U,{items:Lt,actions:St,payload:e,onAction:async e=>{"download-action"===e&&await i(),"update-now"===e&&(oe.clear(),await Mt.next()),"live-action"===e&&o.routerService.push("/dashboard/live"),"backtest-action"===e&&o.routerService.push("/dashboard/backtest"),"back-action"===e&&o.routerService.push("/")}}),a?n?null:t(_,{handler:a,payload:()=>({handleUpdate(){Mt.next()},mode:e}),fields:wt}):null]})};export{Nt as DashboardPage,Nt as default};
@@ -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-DA0cY5CT.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-C0618UQS.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 +1 @@
1
- import{aV as t,X as a,i as e,f as o,v as i,w as n,p as s,H as r,z as c,T as l,aW as d,x as p,B as u,F as m,K as b,L as y,N as h,Q as g,l as f,n as S,O as v,V as L,aX as k,aY as w,aZ as x,q as A,Y as N,Z as C,a_ as $,D as j,a$ as R,a6 as F}from"./index-DA0cY5CT.js";import{h as H}from"./hasRouteMatch-EVPvlDIB.js";import{I as B}from"./IconPhoto-C2SEjuLJ.js";import{C as M,R as V}from"./Refresh-OHKLL7G_.js";import{K as _}from"./KeyboardArrowLeft-CXc4SNLm.js";import{B as E}from"./Background-B2ldn454.js";const G="backtest-kit__groupHeader",O="backtest-kit__groupRoot",z="backtest-kit__symbolImage",I=s()({root:{[`& .${O}:hover .${G}`]:{opacity:"1 !important"}}});function P(t){return L(t,"#000000")>L(t,"#FFFFFF")}const D=[{type:n.Link,action:"back-action",label:o(_,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"}],K=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],T=(t,a)=>({type:r.Group,className:O,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:G,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:i,color:n})=>((t,a,i,n)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(v,{component:g,onClick:()=>{e.routerService.push(`/status/${a}`)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${z}`]:{transition:"filter 500ms"},"&:hover":{background:()=>P(n)?f(n,.33):S(n,.33),[`& .${z}`]:{transition:"filter 500ms",filter:P(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(B,{className:z,symbol:t}),children:i})}))(t,i,a,n))}]}),U=[{type:n.Link,action:"back-action",label:o(_,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"},{type:n.Link,action:"back-action",compute:t=>t?`${String(t.symbol).toUpperCase()} (${t.strategyName})`:"Live"},{type:n.Button,action:"print-action",label:"Print",icon:$}],W=[{action:"print-action",label:"Print",icon:()=>o(c,{icon:$,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>o(c,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],X=new C,Y=[{id:"status",element:({params:t})=>{const[n]=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]}),[s,{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(!s)return;const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=URL.createObjectURL(t);e.layoutService.downloadFile(a,`status_${Date.now()}.json`)}),y=w(async()=>{if(!s)return;const t=e.markdownHelperService.buildMarkdownFromFields(x,s);await A(t)});N(()=>X.subscribe(c));return o(M,{children:[o(i,{items:U,actions:W,payload:n,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 X.next(),"download-action"===t&&await b(),"print-action"===t&&await y()}}),r?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):s?o(m,{children:[o(p,{handler:s,fields:R}),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),o(E,{})]})},isActive:t=>H(["/status/:id"],t)},{id:"main",element:()=>{const{classes:n}=I(),{reloadTrigger:s,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:[s]});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],i=a.strategyName;o[i]||(o[i]=[]),o[i].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 i=Object.entries(o).sort(([,t],[,a])=>a.length-t.length),n=[],s=[],c=[];return i.forEach(([t,a],e)=>{const o=T(t,a);e%2==0?n.push(o):s.push(o),c.push(o)}),[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:s},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:c}]})(),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});return o(M,{children:[o(i,{items:D,actions:K,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:n.root,fields:b},s),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:t=>H(["/status"],t)}],Z=({id:t})=>o(F,{history:e.routerService,onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),routes:Y,params:{id:t}});export{Z as StatusPage,Z as default};
1
+ import{aV as t,X as a,i as e,f as o,v as i,w as n,p as s,H as r,z as c,T as l,aW as d,x as p,B as u,F as m,K as b,L as y,N as h,Q as g,l as f,n as S,O as v,V as L,aX as k,aY as w,aZ as x,q as A,Y as N,Z as C,a_ as $,D as j,a$ as R,a6 as F}from"./index-C0618UQS.js";import{h as H}from"./hasRouteMatch-DWDUNfus.js";import{I as B}from"./IconPhoto-BdD97QYO.js";import{C as M,R as V}from"./Refresh-DAu-7wmf.js";import{K as _}from"./KeyboardArrowLeft-Dthfoq7U.js";import{B as E}from"./Background-GNzR-Kab.js";const G="backtest-kit__groupHeader",O="backtest-kit__groupRoot",z="backtest-kit__symbolImage",I=s()({root:{[`& .${O}:hover .${G}`]:{opacity:"1 !important"}}});function P(t){return L(t,"#000000")>L(t,"#FFFFFF")}const D=[{type:n.Link,action:"back-action",label:o(_,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"}],K=[{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],T=(t,a)=>({type:r.Group,className:O,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.Component,className:G,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:i,color:n})=>((t,a,i,n)=>({type:r.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(v,{component:g,onClick:()=>{e.routerService.push(`/status/${a}`)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${z}`]:{transition:"filter 500ms"},"&:hover":{background:()=>P(n)?f(n,.33):S(n,.33),[`& .${z}`]:{transition:"filter 500ms",filter:P(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(B,{className:z,symbol:t}),children:i})}))(t,i,a,n))}]}),U=[{type:n.Link,action:"back-action",label:o(_,{sx:{display:"block"}})},{type:n.Link,action:"back-action",label:"Main"},{type:n.Link,action:"back-action",label:"Status"},{type:n.Link,action:"back-action",compute:t=>t?`${String(t.symbol).toUpperCase()} (${t.strategyName})`:"Live"},{type:n.Button,action:"print-action",label:"Print",icon:$}],W=[{action:"print-action",label:"Print",icon:()=>o(c,{icon:$,color:"#4caf50"})},{action:"download-action",label:"Download",icon:()=>o(c,{icon:j,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:V,color:"#4caf50"})}],X=new C,Y=[{id:"status",element:({params:t})=>{const[n]=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]}),[s,{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(!s)return;const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=URL.createObjectURL(t);e.layoutService.downloadFile(a,`status_${Date.now()}.json`)}),y=w(async()=>{if(!s)return;const t=e.markdownHelperService.buildMarkdownFromFields(x,s);await A(t)});N(()=>X.subscribe(c));return o(M,{children:[o(i,{items:U,actions:W,payload:n,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 X.next(),"download-action"===t&&await b(),"print-action"===t&&await y()}}),r?o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):s?o(m,{children:[o(p,{handler:s,fields:R}),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signal"})}),o(E,{})]})},isActive:t=>H(["/status/:id"],t)},{id:"main",element:()=>{const{classes:n}=I(),{reloadTrigger:s,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:[s]});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],i=a.strategyName;o[i]||(o[i]=[]),o[i].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 i=Object.entries(o).sort(([,t],[,a])=>a.length-t.length),n=[],s=[],c=[];return i.forEach(([t,a],e)=>{const o=T(t,a);e%2==0?n.push(o):s.push(o),c.push(o)}),[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:s},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:c}]})(),{onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),deps:[s]});return o(M,{children:[o(i,{items:D,actions:K,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:n.root,fields:b},s),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(l,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:t=>H(["/status"],t)}],Z=({id:t})=>o(F,{history:e.routerService,onLoadStart:()=>e.layoutService.setAppbarLoader(!0),onLoadEnd:()=>e.layoutService.setAppbarLoader(!1),routes:Y,params:{id:t}});export{Z as StatusPage,Z as default};
@@ -1 +1 @@
1
- import{b as e,f as t,X as a,i as o,Y as i,Z as n,v as l,w as r,z as d,y as p,A as c,E as s,H as y,x as g,q as m,$ as h,T as u,l as f,B as b,a0 as x,P as w,a1 as v,a2 as k,O as B,a3 as M,a4 as S,a5 as L,a6 as R}from"./index-DA0cY5CT.js";import{h as V}from"./hasRouteMatch-EVPvlDIB.js";import{P as D}from"./PictureAsPdfOutlined-BHHWm0bL.js";import{C as T,R as C}from"./Refresh-OHKLL7G_.js";import{K as A}from"./KeyboardArrowLeft-CXc4SNLm.js";const P=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),_=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),E=144,O=[{type:r.Link,action:"back-action",label:t(A,{sx:{display:"block"}})},{type:r.Link,action:"back-action",label:"Dashboard"},{type:r.Link,action:"back-action",label:"Performance"},{type:r.Button,action:"download-pdf",label:"Download PDF",icon:D},{type:r.Fab,action:"setup-action",label:"Settings",icon:P}],j=[{action:"setup-action",label:"Settings",icon:()=>t(d,{icon:P,color:"#4caf50"})},{divider:!0},{action:"download-json",label:"Download JSON",icon:()=>t(d,{icon:p,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(d,{icon:c,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(d,{icon:s,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(d,{icon:C,color:"#4caf50"})}],U=({name:e,title:t})=>({type:y.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:y.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:y.Div},{type:y.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${x("ms")}`:t:"-",name:e}]}),F=({name:e,title:a})=>({type:y.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:y.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:a},{type:y.Div},{type:y.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:a})=>{const o="github"===e,i=o?"#6A1B9A":"#24A1DE";return t(B,{size:"medium",disabled:!a,startIcon:t(h,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(o?k:_,{sx:{color:i,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:i,"&:hover":{background:"white",color:i}},onClick:()=>{if(o)v(String(a));else{const e=String(a).replaceAll("@","");v(`https://t.me/${e}`)}},children:x(a?"Open":"Not configured")})},name:e}]}),I=[{type:y.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:y.Layout,customLayout:({children:e})=>t(w,{sx:{width:"335px"},children:e}),fields:[{type:y.Component,element:()=>t(b,{sx:{background:e=>f(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(h,{sx:{height:E,width:E,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(u,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:y.Layout,customLayout:({children:e})=>t(b,{p:1,children:e}),fields:[{type:y.Div,style:{height:"2px"}},{type:y.Div,style:{height:"12px"}},U({name:"totalEvents",title:x("Total events")}),U({name:"totalDuration",title:x("Total time")}),U({name:"avgDuration",title:x("Average time")}),F({name:"channel",title:x("Channel")}),F({name:"github",title:"GitHub"})]}]}}],H=new n,N=[{type:y.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Running mode"},{type:y.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:"Historical data processing"},{type:y.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:"Real-time exchange integration"},{type:y.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:"UI only"},{type:y.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:"Historical data"},{type:y.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:"Real-time"},{type:y.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:"Frontend only"}]},{type:y.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:y.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:y.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Log mode"},{type:y.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:"Logs take up disk space but are needed for debugging"}]},...[{title:"JSONL files",description:"Files processed by Claude Code, HuggingFace, Parquet",name:"recent_enabled"},{title:"Markdown files",description:"Human-readable files. Useful when running without a GUI",name:"markdown_enabled"},{title:"Dump files",description:"Conversation dump with the AI agent used for trading signals",name:"dump_enabled"}].map(({name:e,title:t,description:a},o)=>(({title:e,description:t,name:a,idx:o})=>({type:y.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>o%2==0?L(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:y.Box,fields:[{type:y.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:y.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:a}]}))({name:e,title:t,description:a,idx:o}))]},{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"User interface"},{type:y.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save notifications",name:"notification_enabled"},{type:y.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:"Event history is saved to disk"},{type:y.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save signals",name:"storage_enabled"},{type:y.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:"Latest signal state is saved to disk"}]}]},{type:y.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Strategy"},{type:y.Typography,placeholder:"Broker"},{type:y.Outline,fieldBottomMargin:"3",fields:[{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Connected to mainnet (production)",name:"broker_enabled"}]},{type:y.Typography,placeholder:"Market signals"},{type:y.Outline,fieldBottomMargin:"4",fields:[{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use BM25 for RAG",name:"memory_enabled"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use stateful strategies",name:"state_enabled"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Save previous signal",name:"recent_enabled"}]}]},{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:"Risk management"},{type:y.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:"Use LONG or SHORT positions depending on market conditions"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Enable LONG",name:"enable_long"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"1",title:"Enable SHORT",name:"enable_short"}]}]},{type:y.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const a=M();return t(S,{variant:"contained",size:"large",startIcon:t(C,{}),onClick:async()=>{await e.handleReload(),a()},children:"Refresh"})}}],z=[{type:r.Link,action:"back-action",label:t(A,{sx:{display:"block"}})},{type:r.Link,action:"back-action",label:"Dashboard"},{type:r.Link,action:"back-action",label:"Performance"},{type:r.Link,action:"back-action",label:"Settings"},{type:r.Button,action:"update-now",label:"Refresh",icon:C}],G=[{action:"update-now",label:"Refresh",icon:()=>t(d,{icon:C,color:"#4caf50"})}],$=new n,J=async()=>{o.setupViewService.getSetupData.clear(),await $.next()},K=[{id:"search",element:()=>{const[e,{execute:n,loading:r}]=a(async()=>await o.performanceViewService.getPerformanceData(),{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});i(()=>H.subscribe(n));const[d,{execute:p,loading:c}]=a(async()=>await o.environmentViewService.getEnvironmentData());i(()=>H.subscribe(p));return t(T,{children:[t(l,{items:O,actions:j,onAction:async e=>{"back-action"===e&&o.routerService.push("/main"),"setup-action"===e&&o.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{o.performanceViewService.getPerformanceData.clear(),o.performanceViewService.getPerformanceReport.clear(),o.environmentViewService.getEnvironmentData.clear(),await H.next()})(),"download-markdown"===e&&await(async()=>{const e=await o.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);o.layoutService.downloadFile(a,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await o.performanceViewService.getPerformanceReport();await m(e)})(),"download-json"===e&&await(async()=>{const e=await o.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),i=URL.createObjectURL(a);o.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})()}}),e&&d?r||c?null:t(g,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:d.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:I}):null]})},isActive:e=>V(["/about"],e)},{id:"main",element:()=>{const[e,{execute:n,loading:r}]=a(async()=>await o.setupViewService.getSetupData(),{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});i(()=>$.subscribe(n));return t(T,{children:[t(l,{items:z,actions:G,onAction:async e=>{"back-action"===e&&o.routerService.push("/about"),"update-now"===e&&await J()}}),e?r?null:t(g,{handler:e,payload:()=>({handleReload:J}),fields:N}):null]})},isActive:e=>V(["/about/setup"],e)}],q=()=>t(R,{history:o.routerService,onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1),routes:K});export{q as AboutPage,q as default};
1
+ import{b as e,f as t,X as a,i as o,Y as i,Z as n,v as l,w as r,z as d,y as p,A as c,E as s,H as y,x as g,q as m,$ as h,T as u,l as f,B as b,a0 as x,P as w,a1 as v,a2 as k,O as B,a3 as M,a4 as S,a5 as L,a6 as R}from"./index-C0618UQS.js";import{h as V}from"./hasRouteMatch-DWDUNfus.js";import{P as D}from"./PictureAsPdfOutlined-C57tyko8.js";import{C as T,R as C}from"./Refresh-DAu-7wmf.js";import{K as A}from"./KeyboardArrowLeft-Dthfoq7U.js";const P=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),_=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),E=144,O=[{type:r.Link,action:"back-action",label:t(A,{sx:{display:"block"}})},{type:r.Link,action:"back-action",label:"Dashboard"},{type:r.Link,action:"back-action",label:"Performance"},{type:r.Button,action:"download-pdf",label:"Download PDF",icon:D},{type:r.Fab,action:"setup-action",label:"Settings",icon:P}],j=[{action:"setup-action",label:"Settings",icon:()=>t(d,{icon:P,color:"#4caf50"})},{divider:!0},{action:"download-json",label:"Download JSON",icon:()=>t(d,{icon:p,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(d,{icon:c,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(d,{icon:s,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(d,{icon:C,color:"#4caf50"})}],U=({name:e,title:t})=>({type:y.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:y.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:y.Div},{type:y.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${x("ms")}`:t:"-",name:e}]}),F=({name:e,title:a})=>({type:y.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:y.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:a},{type:y.Div},{type:y.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:a})=>{const o="github"===e,i=o?"#6A1B9A":"#24A1DE";return t(B,{size:"medium",disabled:!a,startIcon:t(h,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(o?k:_,{sx:{color:i,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:i,"&:hover":{background:"white",color:i}},onClick:()=>{if(o)v(String(a));else{const e=String(a).replaceAll("@","");v(`https://t.me/${e}`)}},children:x(a?"Open":"Not configured")})},name:e}]}),I=[{type:y.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:y.Layout,customLayout:({children:e})=>t(w,{sx:{width:"335px"},children:e}),fields:[{type:y.Component,element:()=>t(b,{sx:{background:e=>f(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(h,{sx:{height:E,width:E,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(u,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:y.Layout,customLayout:({children:e})=>t(b,{p:1,children:e}),fields:[{type:y.Div,style:{height:"2px"}},{type:y.Div,style:{height:"12px"}},U({name:"totalEvents",title:x("Total events")}),U({name:"totalDuration",title:x("Total time")}),U({name:"avgDuration",title:x("Average time")}),F({name:"channel",title:x("Channel")}),F({name:"github",title:"GitHub"})]}]}}],H=new n,N=[{type:y.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Running mode"},{type:y.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:"Historical data processing"},{type:y.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:"Real-time exchange integration"},{type:y.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:"UI only"},{type:y.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:"Historical data"},{type:y.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:"Real-time"},{type:y.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:"Frontend only"}]},{type:y.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:y.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:y.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Log mode"},{type:y.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:"Logs take up disk space but are needed for debugging"}]},...[{title:"JSONL files",description:"Files processed by Claude Code, HuggingFace, Parquet",name:"recent_enabled"},{title:"Markdown files",description:"Human-readable files. Useful when running without a GUI",name:"markdown_enabled"},{title:"Dump files",description:"Conversation dump with the AI agent used for trading signals",name:"dump_enabled"}].map(({name:e,title:t,description:a},o)=>(({title:e,description:t,name:a,idx:o})=>({type:y.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>o%2==0?L(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:y.Box,fields:[{type:y.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:y.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:a}]}))({name:e,title:t,description:a,idx:o}))]},{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"User interface"},{type:y.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save notifications",name:"notification_enabled"},{type:y.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:"Event history is saved to disk"},{type:y.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save signals",name:"storage_enabled"},{type:y.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:"Latest signal state is saved to disk"}]}]},{type:y.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Strategy"},{type:y.Typography,placeholder:"Broker"},{type:y.Outline,fieldBottomMargin:"3",fields:[{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Connected to mainnet (production)",name:"broker_enabled"}]},{type:y.Typography,placeholder:"Market signals"},{type:y.Outline,fieldBottomMargin:"4",fields:[{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use BM25 for RAG",name:"memory_enabled"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use stateful strategies",name:"state_enabled"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Save previous signal",name:"recent_enabled"}]}]},{type:y.Paper,fieldBottomMargin:"1",fields:[{type:y.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:"Risk management"},{type:y.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:"Use LONG or SHORT positions depending on market conditions"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Enable LONG",name:"enable_long"},{type:y.Checkbox,readonly:!0,fieldBottomMargin:"1",title:"Enable SHORT",name:"enable_short"}]}]},{type:y.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const a=M();return t(S,{variant:"contained",size:"large",startIcon:t(C,{}),onClick:async()=>{await e.handleReload(),a()},children:"Refresh"})}}],z=[{type:r.Link,action:"back-action",label:t(A,{sx:{display:"block"}})},{type:r.Link,action:"back-action",label:"Dashboard"},{type:r.Link,action:"back-action",label:"Performance"},{type:r.Link,action:"back-action",label:"Settings"},{type:r.Button,action:"update-now",label:"Refresh",icon:C}],G=[{action:"update-now",label:"Refresh",icon:()=>t(d,{icon:C,color:"#4caf50"})}],$=new n,J=async()=>{o.setupViewService.getSetupData.clear(),await $.next()},K=[{id:"search",element:()=>{const[e,{execute:n,loading:r}]=a(async()=>await o.performanceViewService.getPerformanceData(),{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});i(()=>H.subscribe(n));const[d,{execute:p,loading:c}]=a(async()=>await o.environmentViewService.getEnvironmentData());i(()=>H.subscribe(p));return t(T,{children:[t(l,{items:O,actions:j,onAction:async e=>{"back-action"===e&&o.routerService.push("/main"),"setup-action"===e&&o.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{o.performanceViewService.getPerformanceData.clear(),o.performanceViewService.getPerformanceReport.clear(),o.environmentViewService.getEnvironmentData.clear(),await H.next()})(),"download-markdown"===e&&await(async()=>{const e=await o.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);o.layoutService.downloadFile(a,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await o.performanceViewService.getPerformanceReport();await m(e)})(),"download-json"===e&&await(async()=>{const e=await o.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),i=URL.createObjectURL(a);o.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})()}}),e&&d?r||c?null:t(g,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:d.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:I}):null]})},isActive:e=>V(["/about"],e)},{id:"main",element:()=>{const[e,{execute:n,loading:r}]=a(async()=>await o.setupViewService.getSetupData(),{onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1)});i(()=>$.subscribe(n));return t(T,{children:[t(l,{items:z,actions:G,onAction:async e=>{"back-action"===e&&o.routerService.push("/about"),"update-now"===e&&await J()}}),e?r?null:t(g,{handler:e,payload:()=>({handleReload:J}),fields:N}):null]})},isActive:e=>V(["/about/setup"],e)}],q=()=>t(R,{history:o.routerService,onLoadStart:()=>o.layoutService.setAppbarLoader(!0),onLoadEnd:()=>o.layoutService.setAppbarLoader(!1),routes:K});export{q as AboutPage,q as default};
@@ -1 +1 @@
1
- import{f as t,T as e,L as a,bj as o,H as n,P as i,p as l,X as r,i as c,Y as s,v as d,w as p,y as m,z as y,A as u,E as h,G as w,x,b0 as f,q as b,a6 as g}from"./index-DA0cY5CT.js";import{h as v}from"./hasRouteMatch-EVPvlDIB.js";import{r as R}from"./emitters-ftFfHgfR.js";import{I as S}from"./IconPhoto-C2SEjuLJ.js";import{P as F}from"./PictureAsPdfOutlined-BHHWm0bL.js";import{C as L,R as A}from"./Refresh-OHKLL7G_.js";import{K as N}from"./KeyboardArrowLeft-CXc4SNLm.js";const j=l()(t=>({root:{position:"relative",background:"#0001",overflow:"clip"},header:{position:"absolute",top:0,left:0,height:"48px",width:"calc(100% - 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",marginLeft:"8px",marginRight:"8px"},container:{marginTop:"48px",width:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},content:{display:"flex",width:"100%",padding:t.spacing(1),paddingBottom:t.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),k=[{type:n.Text,name:"totalPnl",title:"Total PNL",compute:t=>null!==t.totalPnl?`${t.totalPnl.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"winRate",title:"Win Rate",compute:t=>null!==t.winRate?`${t.winRate.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"profitFactor",title:"Profit Factor",compute:t=>null!==t.profitFactor?t.profitFactor.toFixed(2):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"maxDrawdown",title:"Max Drawdown",compute:t=>null!==t.maxDrawdown?`${t.maxDrawdown.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"expectancy",title:"Expectancy",compute:t=>null!==t.expectancy?`${t.expectancy.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"sortinoRatio",title:"Sortino Ratio",compute:t=>null!==t.sortinoRatio?t.sortinoRatio.toFixed(3):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"calmarRatio",title:"Calmar Ratio",compute:t=>null!==t.calmarRatio?t.calmarRatio.toFixed(3):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"recoveryFactor",title:"Recovery Factor",compute:t=>null!==t.recoveryFactor?t.recoveryFactor.toFixed(3):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"totalTrades",title:"Trades",readonly:!0}],D=({row:n})=>{const{classes:l}=j();return t(i,{className:l.root,children:[t("div",{className:l.header,children:t(e,{variant:"h6",sx:{opacity:.8},children:`${a.bullet} ${n.symbol}`})}),t("div",{className:l.container,children:t("div",{className:l.content,children:[t("div",{className:l.avatar,children:t(S,{symbol:n.symbol,sx:{width:128,height:128}})}),t(o,{handler:()=>n,fields:k,sx:{mb:2}})]})})]})},T=[{type:p.Link,action:"back-action",label:t(N,{sx:{display:"block"}})},{type:p.Link,action:"back-action",label:"Dashboard"},{type:p.Link,action:"back-action",label:"Heatmap"},{type:p.Button,action:"download-pdf",label:"Download PDF",icon:F}],P=[{action:"download-json",label:"Download JSON",icon:()=>t(y,{icon:m,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(y,{icon:u,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(y,{icon:h,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(y,{icon:A,color:"#4caf50"})}],C=[{id:"main",element:()=>{const[e,{loading:a,execute:o}]=r(async()=>(e=>{if(!e.length)return[{type:n.Typography,typoVariant:"h6",placeholder:"No data",sx:{textAlign:"center",opacity:.5,mt:4}}];const a=e.map(e=>({type:n.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:n.Component,element:()=>t(D,{row:e})}}));return a.length>2?a:[{type:n.Center,sx:t=>({[t.breakpoints.up("lg")]:{"@media (min-height: 900px)":{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}}),fields:a}]})((await c.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1)});s(()=>R.subscribe(o));return t(L,{children:[t(d,{items:T,actions:P,onAction:async t=>{"back-action"===t&&c.routerService.push("/"),"update-now"===t&&await R.next(),"download-markdown"===t&&await(async()=>{const t=await c.heatViewService.getStrategyHeatReport(),e=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===t&&await(async()=>{const t=await c.heatViewService.getStrategyHeatReport();await b(t)})(),"download-json"===t&&await(async()=>{const t=await c.heatViewService.getStrategyHeatData(),e=JSON.stringify(t,null,2),a=new Blob([e],{type:"text/plain"}),o=URL.createObjectURL(a);c.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!e||a?t(w,{sx:{height:"calc(100dvh - 165px)"}}):t(f,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:t(x,{fields:e})})]})},isActive:t=>v(["/heat"],t)}],$=({id:e})=>t(g,{history:c.routerService,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:C,params:{id:e}});export{$ as HeatPage,$ as default};
1
+ import{f as t,T as e,L as a,bj as o,H as n,P as i,p as l,X as r,i as c,Y as s,v as d,w as p,y as m,z as y,A as u,E as h,G as w,x,b0 as f,q as b,a6 as g}from"./index-C0618UQS.js";import{h as v}from"./hasRouteMatch-DWDUNfus.js";import{r as R}from"./emitters-DvppAhaS.js";import{I as S}from"./IconPhoto-BdD97QYO.js";import{P as F}from"./PictureAsPdfOutlined-C57tyko8.js";import{C as L,R as A}from"./Refresh-DAu-7wmf.js";import{K as N}from"./KeyboardArrowLeft-Dthfoq7U.js";const j=l()(t=>({root:{position:"relative",background:"#0001",overflow:"clip"},header:{position:"absolute",top:0,left:0,height:"48px",width:"calc(100% - 16px)",display:"flex",alignItems:"center",justifyContent:"space-between",marginLeft:"8px",marginRight:"8px"},container:{marginTop:"48px",width:"100%",background:"#fff",display:"flex",alignItems:"center",justifyContent:"center"},content:{display:"flex",width:"100%",padding:t.spacing(1),paddingBottom:t.spacing(2),gap:10,flexDirection:"column"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"128px",minWidth:"128px"}})),k=[{type:n.Text,name:"totalPnl",title:"Total PNL",compute:t=>null!==t.totalPnl?`${t.totalPnl.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"winRate",title:"Win Rate",compute:t=>null!==t.winRate?`${t.winRate.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"profitFactor",title:"Profit Factor",compute:t=>null!==t.profitFactor?t.profitFactor.toFixed(2):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"maxDrawdown",title:"Max Drawdown",compute:t=>null!==t.maxDrawdown?`${t.maxDrawdown.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"expectancy",title:"Expectancy",compute:t=>null!==t.expectancy?`${t.expectancy.toFixed(2)}%`:"N/A",readonly:!0},{type:n.Text,columns:"6",name:"sortinoRatio",title:"Sortino Ratio",compute:t=>null!==t.sortinoRatio?t.sortinoRatio.toFixed(3):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"calmarRatio",title:"Calmar Ratio",compute:t=>null!==t.calmarRatio?t.calmarRatio.toFixed(3):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"recoveryFactor",title:"Recovery Factor",compute:t=>null!==t.recoveryFactor?t.recoveryFactor.toFixed(3):"N/A",readonly:!0},{type:n.Text,columns:"6",name:"totalTrades",title:"Trades",readonly:!0}],D=({row:n})=>{const{classes:l}=j();return t(i,{className:l.root,children:[t("div",{className:l.header,children:t(e,{variant:"h6",sx:{opacity:.8},children:`${a.bullet} ${n.symbol}`})}),t("div",{className:l.container,children:t("div",{className:l.content,children:[t("div",{className:l.avatar,children:t(S,{symbol:n.symbol,sx:{width:128,height:128}})}),t(o,{handler:()=>n,fields:k,sx:{mb:2}})]})})]})},T=[{type:p.Link,action:"back-action",label:t(N,{sx:{display:"block"}})},{type:p.Link,action:"back-action",label:"Dashboard"},{type:p.Link,action:"back-action",label:"Heatmap"},{type:p.Button,action:"download-pdf",label:"Download PDF",icon:F}],P=[{action:"download-json",label:"Download JSON",icon:()=>t(y,{icon:m,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(y,{icon:u,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(y,{icon:h,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(y,{icon:A,color:"#4caf50"})}],C=[{id:"main",element:()=>{const[e,{loading:a,execute:o}]=r(async()=>(e=>{if(!e.length)return[{type:n.Typography,typoVariant:"h6",placeholder:"No data",sx:{textAlign:"center",opacity:.5,mt:4}}];const a=e.map(e=>({type:n.Group,desktopColumns:"4",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",child:{type:n.Component,element:()=>t(D,{row:e})}}));return a.length>2?a:[{type:n.Center,sx:t=>({[t.breakpoints.up("lg")]:{"@media (min-height: 900px)":{height:"calc(100dvh - 165px)","& > *":{transform:"translateY(-56px)"}}}}),fields:a}]})((await c.heatViewService.getStrategyHeatData()).symbols),{onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1)});s(()=>R.subscribe(o));return t(L,{children:[t(d,{items:T,actions:P,onAction:async t=>{"back-action"===t&&c.routerService.push("/"),"update-now"===t&&await R.next(),"download-markdown"===t&&await(async()=>{const t=await c.heatViewService.getStrategyHeatReport(),e=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===t&&await(async()=>{const t=await c.heatViewService.getStrategyHeatReport();await b(t)})(),"download-json"===t&&await(async()=>{const t=await c.heatViewService.getStrategyHeatData(),e=JSON.stringify(t,null,2),a=new Blob([e],{type:"text/plain"}),o=URL.createObjectURL(a);c.layoutService.downloadFile(o,`heat_${Date.now()}.md`)})()}}),!e||a?t(w,{sx:{height:"calc(100dvh - 165px)"}}):t(f,{withScrollbar:!0,sx:{height:"calc(100dvh - 165px)"},hideOverflowX:!0,children:t(x,{fields:e})})]})},isActive:t=>v(["/heat"],t)}],$=({id:e})=>t(g,{history:c.routerService,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:C,params:{id:e}});export{$ as HeatPage,$ as default};
@@ -1 +1 @@
1
- import{b as e,f as o,aV as t,X as i,i as a,v as n,w as l,p as s,H as r,z as c,T as p,aW as d,x as m,B as u,F as h,K as b,L as y,N as f,Q as g,l as k,n as v,O as S,V as C,r as L,as as x,bk as w,bl as P,bm as T,bn as V,bo as $,bp as H,al as z,ag as M,a8 as N,Y as O,b3 as A,aS as _,aE as E,P as I,G as F,ao as R,bq as j,Z as G,ax as W,ay as D,aY as B,a4 as U,I as Y,az as K,D as q,a6 as J}from"./index-DA0cY5CT.js";import{h as Q}from"./hasRouteMatch-EVPvlDIB.js";import{I as X}from"./IconPhoto-C2SEjuLJ.js";import{C as Z,R as ee}from"./Refresh-OHKLL7G_.js";import{K as oe}from"./KeyboardArrowLeft-CXc4SNLm.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(c,{icon:ee,color:"#4caf50"})}],me=(e,t)=>({type:r.Group,className:le,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.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} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:t.map(({symbol:e,label:t,color:i})=>((e,t,i)=>({type:r.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(X,{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:r.Group,className:he,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:r.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(u,{flex:1})]})},{type:r.Group,fields:t.map(({label:e,to:t,color:i,icon:n})=>((e,t,i,n)=>({type:r.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=z(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:H[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=z(o.timestamp).format("DD/MM/YYYY HH:mm:ss"),t=M(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:c,priceOpen:d,priceStopLoss:m,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=N(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(I,{sx:{...y,display:"flex",flexDirection:"column",alignItems:"stretch",overflow:"clip"},children:[o(u,{sx:{background:Le[t]||"#607d8b",minHeight:"48px",display:"flex",alignItems:"center",pl:2,pr:1},children:[o(p,{variant:"h6",sx:{color:"white",fontWeight:"bold",mr:1},children:xe[t]||t}),!!c&&o(b,{variant:"filled",sx:{color:"white"},color:"short"===c?"warning":"success",label:String(c).toUpperCase()}),o(u,{sx:{flex:1}}),o(A,{disabled:r,onClick:s,children:o(_,{style:{color:"white",opacity:r?.5:1}})})]}),o(E,{}),!f||g?o(F,{sx:{height:"100%",width:"100%"}}):o(u,{sx:{position:"relative",flex:1},children:o(R,{style:{position:"absolute"},children:({height:e,width:t})=>o(Ce,{items:f,height:e,width:t,position:c,priceOpen:d,priceStopLoss:m,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(c,{icon:q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:ee,color:"#4caf50"})}],Ve=new G,$e=new G,He=[{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:r.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:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceOpen",title:"Entry",readonly:!0,compute:e=>e.priceOpen?`${M(e.priceOpen)}$`:"N/A"},{type:r.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?`${M(e.originalPriceOpen)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceTakeProfit",title:"Take Profit",readonly:!0,compute:e=>e.priceTakeProfit?`${M(e.priceTakeProfit)}$`:"N/A"},{type:r.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?`${M(e.originalPriceTakeProfit)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceStopLoss",title:"Stop Loss",readonly:!0,compute:e=>e.priceStopLoss?`${M(e.priceStopLoss)}$`:"N/A"},{type:r.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?`${M(e.originalPriceStopLoss)}$`:"N/A"},{type:r.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:r.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:r.Component,sx:{mt:2},element:({payload:e})=>o(S,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],ze=[{id:"chart",element:({params:e})=>{const t=j(()=>({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]=W(null),{pickData:b,setOpen:y,render:g}=D({title:"Info",AfterTitle:({onClose:e})=>o(f,{direction:"row",gap:2,children:[o(U,{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:He,handler:()=>u.current,withActionButton:!1}),k=B(async()=>{l&&(h(l),b(l.id))});return o(Z,{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=>Q(["/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(Z,{children:[o(n,{items:ge,payload:i,onAction:e=>{"back-action"===e&&a.routerService.push("/price_chart")}}),o(m,{className:t.root,fields:s}),o(u,{paddingBottom:"24px"})]})},isActive:e=>Q(["/price_chart/:symbol"],e)},{id:"main",element:()=>{const{classes:e}=re(),{reloadTrigger:l,doReload:s}=t(),[c,{loading:b}]=i(async()=>await(async()=>{const[e,o]=await Promise.all([a.symbolGlobalService.getSymbolList(),a.symbolGlobalService.getSymbolMap()]),t={};e.forEach((e,i)=>{const a=o[e],n=i+1,l=(null==a?void 0:a.priority)||n;t[l]||(t[l]=[]),t[l].push({symbol:e,label:(null==a?void 0:a.displayName)||e,color:(null==a?void 0:a.color)||"#ccc"})});const i=Object.entries(t).map(([e,o])=>({priority:parseInt(e),routes:o})).sort(({priority:e,routes:{length:o}},{priority:t,routes:{length:i}})=>i-o||t-e),n=[],l=[],s=[];return i.forEach(({routes:e,priority:o},t)=>{const i=me(`Priority ${o}`,e);t%2==0&&n.push(i),t%2==1&&l.push(i),s.push(i)}),s.length?[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:l},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:s}]:[]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[l]});return o(Z,{children:[o(n,{items:pe,actions:de,onAction:e=>{"back-action"===e&&a.routerService.push("/"),"update-now"===e&&s()}}),b||!c?o(d,{children:o(p,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):c.length?o(h,{children:[o(m,{className:e.root,fields:c},l),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(p,{variant:"h6",sx:{opacity:.5},children:"No symbols found"})})]})},isActive:e=>Q(["/price_chart"],e)}],Me=({symbol:e,interval:t})=>o(J,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:ze,params:{symbol:e,interval:t}});export{Me as PriceChartPage,Me as default};
1
+ import{b as e,f as o,aV as t,X as i,i as a,v as n,w as l,p as s,H as r,z as c,T as p,aW as d,x as m,B as u,F as h,K as b,L as y,N as f,Q as g,l as k,n as v,O as S,V as C,r as L,as as x,bk as w,bl as P,bm as T,bn as V,bo as $,bp as H,al as z,ag as M,a8 as N,Y as O,b3 as A,aS as _,aE as E,P as I,G as F,ao as R,bq as j,Z as G,ax as W,ay as D,aY as B,a4 as U,I as Y,az as K,D as q,a6 as J}from"./index-C0618UQS.js";import{h as Q}from"./hasRouteMatch-DWDUNfus.js";import{I as X}from"./IconPhoto-BdD97QYO.js";import{C as Z,R as ee}from"./Refresh-DAu-7wmf.js";import{K as oe}from"./KeyboardArrowLeft-Dthfoq7U.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(c,{icon:ee,color:"#4caf50"})}],me=(e,t)=>({type:r.Group,className:le,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:r.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} ${e}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),o(u,{flex:1})]})},{type:r.Group,fields:t.map(({symbol:e,label:t,color:i})=>((e,t,i)=>({type:r.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(X,{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:r.Group,className:he,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:r.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(u,{flex:1})]})},{type:r.Group,fields:t.map(({label:e,to:t,color:i,icon:n})=>((e,t,i,n)=>({type:r.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=z(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:H[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=z(o.timestamp).format("DD/MM/YYYY HH:mm:ss"),t=M(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:c,priceOpen:d,priceStopLoss:m,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=N(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(I,{sx:{...y,display:"flex",flexDirection:"column",alignItems:"stretch",overflow:"clip"},children:[o(u,{sx:{background:Le[t]||"#607d8b",minHeight:"48px",display:"flex",alignItems:"center",pl:2,pr:1},children:[o(p,{variant:"h6",sx:{color:"white",fontWeight:"bold",mr:1},children:xe[t]||t}),!!c&&o(b,{variant:"filled",sx:{color:"white"},color:"short"===c?"warning":"success",label:String(c).toUpperCase()}),o(u,{sx:{flex:1}}),o(A,{disabled:r,onClick:s,children:o(_,{style:{color:"white",opacity:r?.5:1}})})]}),o(E,{}),!f||g?o(F,{sx:{height:"100%",width:"100%"}}):o(u,{sx:{position:"relative",flex:1},children:o(R,{style:{position:"absolute"},children:({height:e,width:t})=>o(Ce,{items:f,height:e,width:t,position:c,priceOpen:d,priceStopLoss:m,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(c,{icon:q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(c,{icon:ee,color:"#4caf50"})}],Ve=new G,$e=new G,He=[{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"symbol",title:"Symbol",readonly:!0,compute:e=>e.symbol||"N/A"},{type:r.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:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceOpen",title:"Entry",readonly:!0,compute:e=>e.priceOpen?`${M(e.priceOpen)}$`:"N/A"},{type:r.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?`${M(e.originalPriceOpen)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceTakeProfit",title:"Take Profit",readonly:!0,compute:e=>e.priceTakeProfit?`${M(e.priceTakeProfit)}$`:"N/A"},{type:r.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?`${M(e.originalPriceTakeProfit)}$`:"N/A"},{type:r.Text,outlined:!1,desktopColumns:"12",tabletColumns:"12",phoneColumns:"12",name:"priceStopLoss",title:"Stop Loss",readonly:!0,compute:e=>e.priceStopLoss?`${M(e.priceStopLoss)}$`:"N/A"},{type:r.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?`${M(e.originalPriceStopLoss)}$`:"N/A"},{type:r.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:r.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:r.Component,sx:{mt:2},element:({payload:e})=>o(S,{variant:"outlined",onClick:e.handleClose,children:"Back"})}],ze=[{id:"chart",element:({params:e})=>{const t=j(()=>({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]=W(null),{pickData:b,setOpen:y,render:g}=D({title:"Info",AfterTitle:({onClose:e})=>o(f,{direction:"row",gap:2,children:[o(U,{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:He,handler:()=>u.current,withActionButton:!1}),k=B(async()=>{l&&(h(l),b(l.id))});return o(Z,{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=>Q(["/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(Z,{children:[o(n,{items:ge,payload:i,onAction:e=>{"back-action"===e&&a.routerService.push("/price_chart")}}),o(m,{className:t.root,fields:s}),o(u,{paddingBottom:"24px"})]})},isActive:e=>Q(["/price_chart/:symbol"],e)},{id:"main",element:()=>{const{classes:e}=re(),{reloadTrigger:l,doReload:s}=t(),[c,{loading:b}]=i(async()=>await(async()=>{const[e,o]=await Promise.all([a.symbolGlobalService.getSymbolList(),a.symbolGlobalService.getSymbolMap()]),t={};e.forEach((e,i)=>{const a=o[e],n=i+1,l=(null==a?void 0:a.priority)||n;t[l]||(t[l]=[]),t[l].push({symbol:e,label:(null==a?void 0:a.displayName)||e,color:(null==a?void 0:a.color)||"#ccc"})});const i=Object.entries(t).map(([e,o])=>({priority:parseInt(e),routes:o})).sort(({priority:e,routes:{length:o}},{priority:t,routes:{length:i}})=>i-o||t-e),n=[],l=[],s=[];return i.forEach(({routes:e,priority:o},t)=>{const i=me(`Priority ${o}`,e);t%2==0&&n.push(i),t%2==1&&l.push(i),s.push(i)}),s.length?[{type:r.Group,columns:"6",className:"tabletLeftColumn",phoneHidden:!0,desktopHidden:!0,fields:n},{type:r.Group,columns:"6",className:"tabletRightColumn",phoneHidden:!0,desktopHidden:!0,fields:l},{type:r.Group,columns:"12",className:"wideColumn",tabletHidden:!0,fields:s}]:[]})(),{onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),deps:[l]});return o(Z,{children:[o(n,{items:pe,actions:de,onAction:e=>{"back-action"===e&&a.routerService.push("/"),"update-now"===e&&s()}}),b||!c?o(d,{children:o(p,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):c.length?o(h,{children:[o(m,{className:e.root,fields:c},l),o(u,{paddingBottom:"24px"})]}):o(d,{children:o(p,{variant:"h6",sx:{opacity:.5},children:"No symbols found"})})]})},isActive:e=>Q(["/price_chart"],e)}],Me=({symbol:e,interval:t})=>o(J,{history:a.routerService,onLoadStart:()=>a.layoutService.setAppbarLoader(!0),onLoadEnd:()=>a.layoutService.setAppbarLoader(!1),routes:ze,params:{symbol:e,interval:t}});export{Me as PriceChartPage,Me as default};