1!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};t.SENTRY_RELEASE={id:"btse@5f19a485"};var e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="859a1317-5367-49ba-af08-e382c2756ab4",t._sentryDebugIdIdentifier="sentry-dbid-859a1317-5367-49ba-af08-e382c2756ab4")}catch(i){}}();import{aL as t,ar as e,a8 as i,a9 as a,aa as o,aK as s,ae as r,af as n,ac as l,ab as d,aX as c,ag as u,ad as p,aU as g,ak as h,am as b,ai as m,ah as f,b9 as y,bw as v,a2 as P,ck as C,cj as S,B as $,aq as D,bi as T,aY as k,a7 as I,a6 as O,as as B,r as w,bJ as R,aW as A,aZ as L,al as M}from"./PmfENnFs.js";import{dy as _,bd as H,b$ as x,bY as E,mH as N,bX as F,aK as z,U,dR as G,cm as q,bD as K,mx as j,Y as V,bg as W,cn as Y,mw as Q,b_ as X,K as Z,dS as J,bR as tt,p as et,ce as it,R as at,lU as ot,a0 as st,af as rt,cA as nt,cr as lt,lK as dt,lv as ct,B as ut,aI as pt,dz as gt,lJ as ht,cx as bt,cF as mt,lt as ft,ca as yt,gO as vt,ch as Pt,gN as Ct,j as St,cy as $t,N as Dt,ad as Tt,mI as kt,gl as It,ab as Ot,ac as Bt,c1 as wt,c3 as Rt,c9 as At,lT as Lt,P as Mt,my as _t,az as Ht,dQ as xt}from"./BhKTELSe.js";import{F as Et,I as Nt,D as Ft,E as zt,C as Ut,u as Gt,a as qt,R as Kt,b as jt,A as Vt,T as Wt,c as Yt,S as Qt,d as Xt,e as Zt,f as Jt,g as te,h as ee,B as ie,i as ae,j as oe,k as se}from"./BLBkQ53j.js";import{_ as re}from"./CRPzHAml.js";import{T as ne,S as le,A as de,g as ce,w as ue,s as pe,l as ge,k as he,j as be,v as me,C as fe,t as ye}from"./cvxruSMo.js";import{aT as ve}from"../../app.DuROpXuw.js";import{L as Pe,i as Ce,u as Se,a as $e,l as De,b as Te,c as ke,d as Ie,e as Oe,j as Be}from"./chunk-echarts.AHWYl6Ef.js";import{c as we}from"./chunk-sentry.q36DUBwH.js";const Re={name:"BackRow",components:{IconChevronLeft:_},computed:{...t(["lang"])}},Ae={class:"back-row"};const Le=re(Re,[["render",function(t,l,d,c,u,p){const g=e("IconChevronLeft");return a(),i("div",Ae,[o("div",{class:"back",onClick:l[0]||(l[0]=e=>t.$router.back())},[s(g),r(" "+n(t.$t("t.back")),1)])])}],["__scopeId","data-v-b04e7874"]]),Me={class:"bot-detail"},_e={class:"container"},He={class:"content"},xe={class:"overview-section"},Ee={class:"bot-info-section"},Ne={key:0,class:"mobile-buttons-section"},Fe={class:"order-info-section"};const ze=re({name:"BotDetailContainer",components:{BackRow:Le}},[["render",function(t,r,n,c,u,p){const g=e("BackRow");return a(),i("div",Me,[o("div",_e,[s(g),o("div",He,[o("section",xe,[l(t.$slots,"overviewSection",{},void 0,!0)]),o("section",Ee,[l(t.$slots,"botInfoSection",{},void 0,!0)]),t.$slots.mobileButtonsSection?(a(),i("section",Ne,[l(t.$slots,"mobileButtonsSection",{},void 0,!0)])):d("",!0),o("section",Fe,[l(t.$slots,"orderInfoSection",{},void 0,!0)])])]),l(t.$slots,"dialogs",{},void 0,!0)])}],["__scopeId","data-v-94143456"]]),Ue={name:"BotDetailHeaderBlock",components:{FlashingBall:Et,IconShare:x,IconNotification:H},props:{title:{type:String,default:""},data:{type:Object,default:()=>({})},isPositionHeldStatus:{type:Boolean,default:!1}},emits:["clickShareBot","clickCloseBot","clickClosePosition"],computed:{...c("futures",["isMarketOffHours"]),isRunningStatus(){return this.data.state===F.RUNNING},isStopStatus(){return[F.CLOSED,F.DEACTIVATED].includes(this.data.state)},isDeactivatedStatus(){return this.data.state===F.DEACTIVATED},timeRows(){const t={label:this.$t("t.timeCreated"),value:this.$filters.formatDate(this.data.createdAt)},e={label:this.$t("t.timeClosed"),value:this.$filters.formatDate(this.data.closedAt),isDanger:this.isDeactivatedStatus||this.isPositionHeldStatus},i={label:this.$t("t.duration"),value:this.data.duration};return this.isPositionHeldStatus?[t,e,i]:this.isRunningStatus?[t,i]:this.isStopStatus?[t,e]:[t]},isLong(){return this.data.direction===E.LONG.value},deactivateReason(){const{exitReason:t}=this.data;if("TOP_PRICE_EXIT_CONDITION_REACHED"===t||"BOTTOM_PRICE_EXIT_CONDITION_REACHED"===t){let e="";switch(this.data.direction){case E.NEUTRAL.value:return this.$t(N[t]);case E.LONG.value:case E.SHORT.value:return e="TOP_PRICE_EXIT_CONDITION_REACHED"===t?this.isLong?this.$t("trading.bot.takeProfitPrice"):this.$t("trading.bot.stopLossPrice"):this.isLong?this.$t("trading.bot.stopLossPrice"):this.$t("trading.bot.takeProfitPrice"),this.$t("trading.bot.grid.closeReason.priceReached.detail",{price:e.toLowerCase()})}}return this.$t(N[t])}}},Ge={class:"header-section"},qe={class:"header-wrap"},Ke={class:"header-left"},je={key:0,class:"share-icon-wrap"},Ve={key:0,class:"error-wrap"},We={class:"header-right"},Ye={class:"time-wrap"},Qe={class:"label"},Xe={class:"time-value"},Ze={key:2,class:"duration-wrap"},Je={class:"label"},ti={class:"time-value"},ei={key:0,class:"error-wrap"};const ii=re(Ue,[["render",function(t,l,c,m,f,y){const v=e("FlashingBall"),P=e("IconShare"),C=e("IconNotification"),S=e("BaseButton"),$=e("Tooltip");return a(),i("div",Ge,[o("div",qe,[o("div",Ke,[s(v,{active:y.isRunningStatus,warning:c.isPositionHeldStatus},null,8,["active","warning"]),o("div",{class:u(["title-text",{"not-running":!y.isRunningStatus&&!c.isPositionHeldStatus}])},n(c.title),3),t.isDesktop?(a(),i("div",je,[s(P,{class:"share-icon",onClick:l[0]||(l[0]=e=>t.$emit("clickShareBot"))})])):d("",!0)]),t.isNotDesktop&&y.isDeactivatedStatus?(a(),i("div",Ve,[s(C),o("div",null,n(y.deactivateReason),1)])):d("",!0),o("div",We,[o("div",Ye,[(a(!0),i(p,null,g(y.timeRows,(t=>(a(),i("div",{key:t.label,class:u(["time",{deactivated:t.isDanger}])}
1,[o("span",Qe,n(t.label),1),o("span",Xe,n(t.value),1)],2)))),128))]),t.isDesktop?(a(),i(p,{key:0},[l[3]||(l[3]=o("div",{class:"vertical-divider"},null,-1)),y.isRunningStatus?(a(),h($,{key:0,placement:"bottom-end",disable:!t.isMarketOffHours},{content:b((()=>[s(S,{class:"outline-red end-bot-btn",size:"small",disabled:t.isMarketOffHours,onClick:l[1]||(l[1]=e=>t.$emit("clickCloseBot"))},{default:b((()=>[r(n(t.$t("trading.bot.closeBot")),1)])),_:1},8,["disabled"])])),tooltip:b((()=>[r(n(t.$t("t.postOnlyCloseBotDisabled")),1)])),_:1},8,["disable"])):c.isPositionHeldStatus?(a(),h(S,{key:1,class:"outline-red end-bot-btn",size:"small",onClick:l[2]||(l[2]=e=>t.$emit("clickClosePosition"))},{default:b((()=>[r(n(t.$t("futuresMain.openPosition.closePosition")),1)])),_:1})):(a(),i("div",Ze,[o("span",Je,n(t.$t("t.duration")),1),o("span",ti,n(c.data.duration),1)]))],64)):d("",!0)])]),t.isDesktop&&y.isDeactivatedStatus?(a(),i("div",ei,[s(C),o("div",null,n(y.deactivateReason),1)])):d("",!0)])}],["__scopeId","data-v-64e57dc8"]]),ai={name:"BotDetailSymbolPriceBlock",components:{CurrencyIcon:U,IconNotificationHollow:z},props:{symbol:{type:String,default:""},baseCurrency:{type:String,default:""},lastPrice:{type:String,default:""},lastPriceGains:{type:Number,default:0},isOutOfRange:{type:Boolean,default:!1},isInsufficient:{type:Boolean,default:!1}},emits:["openEditBotMargin","openModifyGridParamsDialog"],data:()=>({IconType:G}),computed:{...c(["isEnableTradingBotUpdateParameter","isUnifiedWallet"]),showIconNotification(){return this.isOutOfRange||this.isInsufficient},alertToolTip(){return this.isInsufficient?this.$t("trading.bot.grid.insufficientBalance"):this.$t("trading.bot.grid.priceOutOfRange")},symbolTipBottomAction(){return this.isInsufficient?{text:`${this.$t("trading.increaseMargin")} >`,action:()=>this.$emit("openEditBotMargin")}:this.isOutOfRange&&this.isEnableTradingBotUpdateParameter&&this.isUnifiedWallet?{text:`${this.$t("trading.bot.modifyPriceRange")} >`,action:()=>this.$emit("openModifyGridParamsDialog")}:null}}},oi={class:"symbol-price-block"},si={class:"symbol-wrap"},ri={class:"symbol"},ni={class:"last-price"},li={class:"price-change"};const di=re(ai,[["render",function(t,r,l,c,p,g){const m=e("CurrencyIcon"),f=e("IconNotificationHollow"),y=e("ToolTip");return a(),i("div",oi,[o("div",si,[s(m,{size:"20",class:"currency-info",type:p.IconType.COIN,name:l.baseCurrency},{default:b((()=>[o("div",ri,n(t.$filters.digitalCurrency(l.symbol)),1)])),_:1},8,["type","name"])]),o("div",{class:u(["price-wrap",{"brand-color-positive":l.lastPriceGains>0,"brand-color-negative":l.lastPriceGains<0}])},[o("div",ni,n(t.$filters.formatNumber(l.lastPrice,{preserveDecimals:!0})),1),o("div",li," ("+n(t.$filters.formatNumber(l.lastPriceGains,{formatKey:2,signed:!0,postfix:"%"}))+") ",1),s(y,{class:"tip",placement:"bottom",tooltip:g.alertToolTip,tipBottomAction:g.symbolTipBottomAction,popover:"",onlyShowOneInPage:""},{content:b((()=>[g.showIconNotification?(a(),h(f,{key:0,class:"notification-icon",width:"20",height:"20"})):d("",!0)])),_:1},8,["tooltip","tipBottomAction"])],2)])}],["__scopeId","data-v-270b1913"]]),ci={class:"summary-card"},ui={class:"card-title"},pi=re(m({__name:"SummaryCard",props:{title:{type:String,default:""},tooltip:{type:String,default:null}},setup(t){const e=t;return(t,s)=>(a(),i("div",ci,[o("div",ui,[e.tooltip?(a(),h(q,{key:0,tooltip:e.tooltip,class:"dashed-underline"},{content:b((()=>[r(n(e.title),1)])),_:1},8,["tooltip"])):(a(),i(p,{key:1},[r(n(e.title),1)],64))]),l(t.$slots,"default",{},void 0,!0)]))}}),[["__scopeId","data-v-666bb8e4"]]);Se([$e,De,Te,ke,Ie,Oe,Be]);const gi="rgba(16, 186, 104, 0.3)",hi="rgba(16, 186, 104, 0)",bi="rgba(255, 91, 90, 0)",mi="rgba(255, 91, 90, 0.3)",fi={name:"RoiChart",props:{roiPointList:{type:Array,default:()=>[]},quoteCurrency:{type:String,default:""},priceFilter:{type:Number,default:2}},data(){return this.chart=null,{}},computed:{...t(["lang"]),...c(["isNightTheme"]),roiPointFormatted(){return this.roiPointList.map((t=>[1e3*t[0],t[1],t[2]]))}},watch:{roiPointList:{handler:function(t){(null==t?void 0:t.length)&&this.updateChartData()}},lang(){this.setChartOption()}},mounted(){this.$nextTick((()=>{this.initChart()}))},beforeUnmount(){this.chart&&(window.removeEventListener("resize",this.resizeChart),this.chart=null)},methods:{initChart(){const{chart:t,chartWrap:e}=this.$refs;this.chart=Ce(t,null,{width:e.offsetWidth}),this.setChartOption(),window.addEventListener("resize",this.resizeChart)},updateChartData(){this.chart.setOption({dataset:{source:this.roiPointFormatted},series:[{areaStyle:{color:new Pe(0,0,0,1,this.calculateLinearGradient())}}]})},setChartOption(){const{formatDate:t,formatNumber:e}=this.$filters,i={title:{text:this.$t("t.roi"),left:"3%",top:"3%",textStyle:{color:this.isNightTheme?"white":"#4C5763",fontSize:16,lineHeight:24,fontWeight:500}},dataset:{dimensions:[{name:"date",type:"time"},{name:"roi",type:"number"},{name:"pnl",type:"number"}],sourceHeader:!1,source:this.roiPointFormatted},grid:[{containLabel:!0,left:"5%",right:"5%",bottom:"10%",top:"15%"}],xAxis:{type:"time",axisLabel:{color:"#7E8F9F",formatter:function(e){return t(e,"MM-dd")}}
1,axisLine:{lineStyle:{color:this.isNightTheme?"#1E3059":"#E3EAF0"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:"#7E8F9F",formatter:function(t){return`${t}%`}},splitLine:{lineStyle:{color:this.isNightTheme?"#1E3059":"#E3EAF0"}}},series:[{type:"line",smooth:!0,symbol:"none",encode:{x:"date",y:"roi"},areaStyle:{color:new Pe(0,0,0,1,this.calculateLinearGradient())}}],visualMap:{type:"piecewise",show:!1,dimension:1,pieces:[{gte:0,lte:99999999999999,color:"#00B15D"},{lt:0,color:"#FF5B5A"}]},tooltip:{trigger:"axis",axisPointer:{type:"cross",snap:!0,label:{show:!1},crossStyle:{color:"#7E8F9F"}},className:"chart-tooltip",backgroundColor:this.isNightTheme?"rgba(30, 48, 89, 0.9)":"rgba(247, 249, 251, 0.9)",borderColor:this.isNightTheme?"rgba(30, 48, 89, 0.9)":"transparent",padding:0,formatter:i=>{const{data:[a,o,s]}=i[0],r=null!==s?`\n <div class="pnl-wrap">\n <span class="pnl-label">${this.$t("t.pnl")}: </span>\n ${e(s,{formatKey:this.priceFilter,postfix:` ${this.quoteCurrency}`,currency:this.quoteCurrency})}\n </div>`:"";return`\n <div class="inner-wrap">\n <div class="date-wrap">${t(a,"yyyy-MM-dd HH:mm")}\n </div>\n ${r}\n <div class="roi-wrap">\n <span class="roi-label">${this.$t("t.roi")}</span>\n ${e(o,{formatKey:this.priceFilter,signed:!0,postfix:"%"})}\n </div>\n </div>\n `}}};this.chart.setOption(i)},calculateLinearGradient(){const t=this.roiPointList.map((t=>t[1])),e=Math.max(...t),i=Math.min(...t);if(i>=0)return[{offset:0,color:gi},{offset:1,color:hi}];if(e<=0)return[{offset:0,color:bi},{offset:1,color:mi}];const a=(e/(e-i)).toFixed(2);return[{offset:0,color:gi},{offset:a,color:hi},{offset:a,color:bi},{offset:1,color:mi}]},resizeChart(){const{chartWrap:t}=this.$refs;this.chart.resize({width:t.offsetWidth})}}},yi={ref:"chartWrap",class:"chart-wrap"},vi={ref:"chart",class:"chart"};const Pi=re(fi,[["render",function(t,e,s,r,n,l){return a(),i("div",yi,[o("div",vi,null,512)],512)}],["__scopeId","data-v-35542432"]]),Ci={name:"BotInfoBlock",components:{IconEdit2:K,IconEditLite:Nt},props:{title:{type:String,default:""},infoList:{type:Array,default:()=>[]},showEditIcon:{type:Boolean,default:!1}},emits:["clickEdit","openEditBotMargin"]},Si={class:"bot-info"},$i={class:"bot-info-title block-title"},Di={key:0,class:"edit-icon-wrap"},Ti={class:"bot-info-list"},ki={key:0,class:"item"},Ii={class:"item-label"},Oi={key:2,class:"item-edit"};const Bi=re(Ci,[["render",function(t,l,c,u,m,y){const v=e("IconEdit2"),P=e("ToolTip"),C=e("IconEditLite");return a(),i("div",Si,[o("div",$i,[r(n(c.title)+" ",1),c.showEditIcon?(a(),i("div",Di,[s(v,{onClick:l[0]||(l[0]=e=>t.$emit("clickEdit"))})])):d("",!0)]),o("div",Ti,[(a(!0),i(p,null,g(c.infoList,(t=>(a(),i(p,{key:t.label},[t.hide?d("",!0):(a(),i("div",ki,[o("div",Ii,n(t.label)+":",1),o("div",null,[t.tooltip?(a(),h(P,{key:0,placement:"bottom",tooltip:t.tooltip,tipBottomAction:t.tipBottomAction,popover:!!t.tipBottomAction,onlyShowOneInPage:""},{content:b((()=>[o("span",{class:"item-value",style:f(t.valueStyle)},n(t.value),5)])),_:2},1032,["tooltip","tipBottomAction","popover"])):(a(),i("span",{key:1,class:"item-value",style:f(t.valueStyle)},n(t.value),5)),t.editable?(a(),i("span",Oi,[s(C,{onClick:t.onEdit},null,8,["onClick"])])):d("",!0)])]))],64)))),128))])])}],["__scopeId","data-v-c5433e69"]]),wi={class:"next-order-block"},Ri={class:"block-title"},Ai={class:"block-content"},Li={class:"order-time-wrap"},Mi={class:"item-label"},_i={class:"item-value"},Hi={class:"order-value-wrap"},xi={class:"item-label"},Ei={class:"item-value"},Ni={class:"item-label"};const Fi=re({name:"SpotDcaNextOrderBlock",components:{DirectionTag:Ft},props:{data:{type:Object,default:()=>({})},investmentUnit:{type:String,default:""}},computed:{isLong(){var t;return"LONG"===(null==(t=this.data)?void 0:t.direction)},nextOrderTime(){var t;const{cycle:{period:e,executeAt:i,weekday:a,date:o}={},nextExecutionTimestamp:s}=(null==(t=this.data)?void 0:t.detail)||{},r=new Date;if(!e)return r;const n=y(j({hour:i,day:a,date:o,timezone:-(new Date).getTimezoneOffset()/60},!1));return v(n,r)?n:"MINS_15"===e||"MINS_30"===e||"HOURLY"===e?s:"DAILY"===e?P(n,1):"WEEKLY"===e?C(n,1):"MONTHLY"===e?S(n,1):r},nextOrderValue(){var t,e;return Number(null==(e=null==(t=this.data)?void 0:t.detail)?void 0:e.investmentPerPeriod)||0}}},[["render",function(t,l,d,c,u,p){const g=e("DirectionTag");return a(),i("div",wi,[o("div",Ri,n(t.$t("t.nextOrder")),1),o("div",Ai,[o("div",Li,[o("span",Mi,n(t.$t("t.orderTime"))+":",1),o("div",_i,[r(n(t.$filters.formatDate(p.nextOrderTime,"yyyy-MM-dd HH:mm"))+" ",1),s(g,{direction:d.data.direction,displayText:p.isLong?t.$t("t.buy"):t.$t("t.sell")},null,8,["direction","displayText"])])]),o("div",Hi,[o("span",xi,n(t.$t("futuresMain.trade.total"))+":",1),o("div",Ei,[r(n(p.nextOrderValue)+" ",1),o("span",Ni,n(d.investmentUnit),1)])])])])}],["__scopeId","data-v-15b28bd2"]]);const zi={key:0,class:"error-side"},Ui={class:"unit"},Gi={class:"unit"},qi={class:"unit"},Ki={class:"unit"};const ji={class:"order-history-block"},Vi={class:"block-title-wrap"},Wi={class:"block-title"},Yi={class:"order-history-list"};const Qi=re({name:"SpotDcaOrderHistoryBlock",components:{OrderHistoryHeaderRow:re({name:"SpotDcaOrderHistoryHeaderRow",computed:{headerList(){return[{id:"createTime",lang:this.$t("t.time"),textAlign:"left"},{id:"side",lang:this.$t("t.side"),textAlign:"left"},{id:"avgPrice",lang:this.$t("t.avgPrice"),textAlign:"right"},{id:"fillSize",lang:this.$t("trading.fillSize"),textAlign:"right"},{id:"totalValue",lang:this.$t("t.totalValue"),textAlign:"right"},{id:"fee",lang:this.$t("t.fee"),textAlign:"right"},{id:"status",lang:this.$t("t.status"),textAlign:"left"},{id:"reason",lang:this.$t("t.reason"),textAlign:"left"}]}}},[["render",function(t,o,s,l,d,c){const u=e("Cell"),m=e("HeaderRow");return a(),h(m,null,{default:b((()=>[(a(!0),i(p,null,g(c.headerList,(t=>(a(),h(u,{key:t.id,textAlign:t.textAlign},{default:b((()=>[r(n(t.lang),1)])),_:2},1032,["textAlign"])))),128))])),_:1})}],["__scopeId","data-v-c2503b2c"]]),OrderHistoryListRow:re({name:"SpotDcaOrderHistoryListRow",components:{DirectionTag:Ft},props:{data:{type:Object,required:!0},index:{type:Number,required:!0},baseCurrency:{type:String,default:""},quoteCurrency:{type:String,default:""},sizeFilter:{type:Number,default:2}},computed:{isError(){return"FAILED"===this.data.status},totalValue(){const{avgPrice:t,filledSize:e}=this.data;return $(t).times(e).toNumber()},status(){const{status:t}=this.data;return"FILLED"===t?this.$t("t.success"):"FAILED"===t?this.$t("t.failed"):"-"},reason(){const{reason:t}=this.data;return"INSUFFICIENT_BALANCE"===t?this.$t("trading.insufficientBalance"):"EXCEED_SLIPPAGE"===t?this.$t("trading.exceedSlippage"):"-"},priceFormat(){return{preserveDecimals:!0,currency:this.quoteCurrency}}},methods:{capitalizeFirst:V}},[["render",function(t,l,d,c,g,m){const f=e("Cell"),y=e("DirectionTag"),v=e("Row");return a(),h(v,{index:d.index,class:u({"error-row":m.isError})},{default:b((()=>[s(f,{textAlign:"left",class:u({"error-cell":m.isError})},{default:b((()=>[r(n(t.$filters.formatDate(d.data.createdAt)),1)])),_:1},8,["class"]),s(f,{textAlign:"left"},{default:b((()=>[m.isError?(a(),i("span",zi,n(m.capitalizeFirst(d.data.side)),1)):(a(),h(y,{key:1,direction:d.data.side,displayText:m.capitalizeFirst(d.data.side)},null,8,["direction","displayText"]))])),_:1}),s(f,{textAlign:"right"},{default:b((()=>[m.isError?(a(),i(p,{key:0},[r("-Â ")],64)):(a(),i(p,{key:1}
1,[r(n(t.$filters.formatNumber(d.data.avgPrice,m.priceFormat)),1)],64)),o("span",Ui,n(d.quoteCurrency),1)])),_:1}),s(f,{textAlign:"right"},{default:b((()=>[m.isError?(a(),i(p,{key:0},[r("-Â ")],64)):(a(),i(p,{key:1},[r(n(t.$filters.formatNumber(d.data.filledSize,d.sizeFilter)),1)],64)),o("span",Gi,n(d.baseCurrency),1)])),_:1}),s(f,{textAlign:"right"},{default:b((()=>[m.isError?(a(),i(p,{key:0},[r("-Â ")],64)):(a(),i(p,{key:1},[r(n(t.$filters.formatNumber(m.totalValue,m.priceFormat)),1)],64)),o("span",qi,n(d.quoteCurrency),1)])),_:1}),s(f,{textAlign:"right"},{default:b((()=>[m.isError?(a(),i(p,{key:0},[r("-Â ")],64)):(a(),i(p,{key:1},[r(n(d.data.fee),1)],64)),o("span",Ki,n(d.data.feeCurrency),1)])),_:1}),s(f,{textAlign:"left",class:u({"error-cell":m.isError})},{default:b((()=>[r(n(m.status),1)])),_:1},8,["class"]),s(f,{textAlign:"left",class:u({"error-cell":m.isError})},{default:b((()=>[r(n(m.reason),1)])),_:1},8,["class"])])),_:1},8,["index","class"])}],["__scopeId","data-v-da0f27ed"]]),LoadMoreObserver:W},props:{orderHistory:{type:Object,default:()=>({})}},emits:["loadMoreHistory"]},[["render",function(t,r,l,d,c,u){const m=e("OrderHistoryHeaderRow"),f=e("OrderHistoryListRow"),y=e("DataTable"),v=e("LoadMoreObserver");return a(),i("div",ji,[o("div",Vi,[o("div",Wi,n(`${t.$t("futuresMain.activeOrders.orderHistory")} (${l.orderHistory.totalOrderCount})`),1),r[1]||(r[1]=o("div",{class:"divider"},null,-1))]),o("div",Yi,[s(y,{class:"order-history-table"},{header:b((()=>[s(m)])),body:b((()=>[(a(!0),i(p,null,g(l.orderHistory.orders,((e,i)=>(a(),h(f,D({ref_for:!0},t.$attrs,{key:e.createdAt,data:e,index:i}),null,16,["data","index"])))),128))])),_:1}),s(v,{onLoadMore:r[0]||(r[0]=e=>t.$emit("loadMoreHistory"))})])])}],["__scopeId","data-v-92730d3a"]]),Xi={name:"SpotDcaEditAdvancedSettingDialog",components:{EditDialog:zt,TradingInput:ne,Icon:U},props:{visible:{type:Boolean,required:!0},data:{type:Object,default:()=>({})},baseCurrency:{type:String,default:""},earnRate:{type:Number,default:0}},emits:["update:visible","clickConfirm"],data:()=>({slippage:"",enableDepositInToEarn:!1}),computed:{isShow:{get(){return this.visible},set(t){this.$emit("update:visible",t)}}},watch:{isShow(t){t&&this.updateSettingData()}},methods:{updateSettingData(){const{detail:{slippage:t,flexibleEarn:e}}=this.data;this.slippage=t,this.enableDepositInToEarn=e},handleClickConfirm(){this.$emit("clickConfirm",{slippage:""!==this.slippage?this.slippage:null,flexibleEarn:this.enableDepositInToEarn})}}},Zi={class:"slippage-input-wrap"},Ji={class:"notice-wrap"},ta={class:"apy-wrap"},ea={class:"yesterday-apy"},ia={class:"apy-text"};const aa=re(Xi,[["render",function(t,i,l,d,c,u){const p=e("Tooltip"),g=e("TradingInput"),m=e("Checkbox"),f=e("Icon"),y=e("EditDialog");return a(),h(y,{visible:u.isShow,"onUpdate:visible":i[3]||(i[3]=t=>u.isShow=t),title:t.$t("trading.bot.editAdvancedSettings"),onClickConfirm:u.handleClickConfirm},{content:b((()=>[o("div",Zi,[s(g,{value:c.slippage,"onUpdate:value":i[0]||(i[0]=t=>c.slippage=t),class:"slippage-input",label:"slippage",placeholder:"0.1-99.9",type:"number",max:99.9,min:.1,step:.1,maxDecimalPlaces:1},{prepend:b((()=>[s(p,{content:t.$t("t.slippage")},{tooltip:b((()=>[o("p",null,n(t.$t("trading.spot.dca.slippage.tip")),1)])),_:1},8,["content"])])),append:b((()=>i[4]||(i[4]=[r("%")]))),_:1},8,["value"]),o("div",{class:"clear-btn",onClick:i[1]||(i[1]=t=>c.slippage="")},n(t.$t("t.clear")),1)]),o("div",Ji,n(t.$t("t.notice"))+": "+n(t.$t("trading.spot.dca.slippageWarning")),1),s(p,{tooltip:t.$t("trading.spot.dca.deposit.tip"),class:"deposit-earn-tooltip-wrap"},{content:b((()=>[s(m,{value:c.enableDepositInToEarn,"onUpdate:value":i[2]||(i[2]=t=>c.enableDepositInToEarn=t)},{default:b((()=>[r(n(t.$t("t.trading.bot.dca.depositIntoEarn")),1)])),_:1},8,["value"]),o("div",ta,[o("span",ea,n(t.$t("earn.yesterdayApy"))+" :",1),s(f,{name:l.baseCurrency,showName:!1,size:"12"},null,8,["name"]),o("span",ia,n(l.baseCurrency)+" "+n(l.earnRate)+"%",1)])])),_:1},8,["tooltip"])])),_:1}
1,8,["visible","title","onClickConfirm"])}],["__scopeId","data-v-371534b1"]]),{enableEarn:oa}=et,sa={name:"SpotDcaBotDetail",components:{Container:ze,HeaderBlock:ii,SymbolPriceBlock:di,SummaryCard:pi,RoiChart:Pi,BotInfoBlock:Bi,IconShare:x,NextOrderBlock:Fi,OrderHistoryBlock:Qi,SharePnlDialog:le,ConfirmCloseDialog:Ut,EditAdvancedSettingDialog:aa},beforeRouteLeave:t=>(t.name===at.TRADING_BOT_HISTORY&&history.replaceState({tradingBotType:ot.SPOT_DCA},null,t.fullPath),!0),setup(){const{convertToDisplaySymbol:t}=it();return{convertToDisplaySymbol:t}},data:()=>({enableEarn:oa,BotStatus:F,botDetail:{},showShareDialog:!1,showConfirmCloseDialog:!1,showEditAdvancedSettingDialog:!1,botOrderHistory:{totalOrderCount:0,orders:[]},orderHistoryPagination:{currentPage:1,pageSize:15,totalPages:1,totalRows:0},shareInfo:{},earnList:[]}),computed:{...t(["lang"]),...t("orderBook",["lastPrice"]),...T(J,["marketStatsMap"]),...T(tt,["currentSpotMarketBaseCurrency","marketQuoteCurrency","getExchangeInfoBySymbol","getMarketSymbolFromBaseCurrency"]),botId(){return this.$route.params.botId},roundedLastPrice(){var t;return $(this.lastPrice).toFixed(null==(t=this.getExchangeInfoBySymbol(this.querySymbol))?void 0:t.priceDecimal,$.ROUND_DOWN)},lastPriceGains:()=>J().lastPriceGains,isRunning(){return this.botDetail.state===F.RUNNING},isLong(){var t;return"LONG"===(null==(t=this.botDetail)?void 0:t.direction)},displaySymbol(){return this.botDetail.symbol?`${this.convertToDisplaySymbol(this.botDetail.symbol)}/${this.botDetail.quoteCurrency}`:""},hasLimit(){var t,e;return(null==(e=null==(t=this.botDetail)?void 0:t.detail)?void 0:e.numberOfInvestment)>0},botDetailList(){const{detail:{cycle:t={},investmentPerPeriod:e,numberOfInvestment:i}={},tradingBotId:a}=this.botDetail||{};return[{label:this.$t("futuresMain.tradeHistory.marketName"),value:this.displaySymbol},{label:this.$t("t.cycle"),value:this.getCycleDetail(t)},{label:this.$t("trading.bot.dca.investmentPerPeriod"),value:`${this.formatInvestment(e)} ${this.investmentUnit}`},{label:this.$t("trading.bot.dca.investmentCount"),value:this.hasLimit?i:this.$t("t.continuously")},{label:`${this.$t("trading.bot.totalInvestment")}`,value:this.hasLimit?`${this.estimatedTotalInvestment} ${this.investmentUnit}`:"-"},{label:this.$t("trading.bot.id"),value:a}]},advancedSettingsList(){const{detail:{slippage:t,flexibleEarn:e}={}}=this.botDetail||{};return[{label:this.$t("t.slippage"),value:t?`${t} %`:"-"},{label:this.$t("trading.bot.dca.depositEarn"),value:e?this.$t("t.enable"):this.$t("t.disabled")}]},executedFraction(){const{detail:{investmentCount:t=0,numberOfInvestment:e=0}={}}=this.botDetail;return{numerator:t,denominator:e}},executedInvestment(){var t,e;return this.formatInvestment((null==(e=null==(t=this.botDetail)?void 0:t.detail)?void 0:e.totalInvestment)||0)},estimatedTotalInvestment(){const{detail:{investmentPerPeriod:t=0,numberOfInvestment:e=0}={}}=this.botDetail;return $(t).times(e).toNumber()},progressPercentage(){const{detail:{investmentCount:t=0,numberOfInvestment:e=0}={}}=this.botDetail;return e?$(t).div(e).times(100).toFixed(0):0},progressBarStyle(){return{width:`${this.progressPercentage}%`}},investmentUnit(){return this.isLong?this.marketQuoteCurrency:this.getMarketSymbolFromBaseCurrency(this.currentSpotMarketBaseCurrency)},earnRate(){const t=this.earnList.find((t=>t.currency===this.currentSpotMarketBaseCurrency));return(null==t?void 0:t.rate)||0},priceFormat(){var t;return{formatKey:(null==(t=this.getExchangeInfoBySymbol(this.querySymbol))?void 0:t.priceDecimal)??0,currency:this.botDetail.quoteCurrency}},investmentFormat(){return{formatKey:this.isLong?this.priceFilter:this.sizeFilter,currency:this.investmentUnit}},querySymbol(){return this.botDetail.symbol?`${this.botDetail.symbol}-${this.botDetail.quoteCurrency}`:""},priceFilter(){return this.priceFormat.formatKey},sizeFilter(){var t;return(null==(t=this.getExchangeInfoBySymbol(this.querySymbol))?void 0:t.sizeDecimal)||0}},async created(){this.intervalId=setInterval((async()=>{this.fetchBotDetail()}),5e3),this.initFetch()},beforeUnmount(){clearInterval(this.intervalId)},methods:{initFetch(){this.fetchBotDetail(),this.fetchBotOrderHistory(),this.fetchEarnList()},async fetchBotDetail(){const{data:t}=await Y.getTradingBotDetail(this.botId,{hideCode:!0});this.botDetail=t.tradingBot},async fetchBotOrderHistory(){const{data:t}=await Y.getTradingBotOrderHistory({id:this.botId,page:this.orderHistoryPagination.currentPage,pageSize:20,sorting:"createdAt:DESC"}),{currentPage:e,pageSize:i,totalPages:a,totalRows:o,orderHistory:s}=t;this.orderHistoryPagination={currentPage:e,pageSize:i,totalPages:a,totalRows:o},this.botOrderHistory.totalOrderCount=s.totalOrderCount,this.botOrderHistory.orders.push(...s.orders)},handleLoadMoreHistory(){const{currentPage:t,totalPages:e}=this.orderHistoryPagination;t!==e&&(this.orderHistoryPagination.currentPage=t+1,this.fetchBotOrderHistory())},getCycleDetail(t){const e=this.isLong?this.$t("t.buy"):this.$t("t.sell");let i="",{period:a,executeAt:o,weekday:s,date:r}=t;const n=j({hour:o,day:s,date:r,timezone:-(new Date).getTimezoneOffset()/60},!1);switch(a){case X.MINS_15:return`${e} ${this.$t("t.every").toLowerCase()} 15 ${this.$t("t.min_time")}`;case X.MINS_30:return`${e} ${this.$t("t.every").toLowerCase()} 30 ${this.$t("t.min_time")}`;case X.HOURLY:return`${e} ${this.$t("t.every").toLowerCase()} ${this.$t("t.hour_time")}`;case X.DAILY:i=this.$t("t.daily");break;case X.WEEKLY:{const t=Z[this.lang](n,"eeee");i=`${this.$t("t.weekly")}(${t})`;break}case X.MONTHLY:{const t=Z[this.lang](n,"do");i=`${this.$t("t.monthly")}(${t})`;break}}return this.$t("trading.bot.dca.cycle.detail",{side:e,period:i,orderTime:`${n.getHours()}:00`})},async fetchEarnList(){if(oa)try{const t=await ve();this.earnList=t.filter((({type:t})=>t===Q.FLEXIBLE))}catch(t){this.earnList=[]}},async handleUpdateSettingsConfirm(t){await Y.updateTradingBot(this.botId,{config:t}),this.fetchBotDetail(),this.showEditAdvancedSettingDialog=!1},async handleConfirmCloseBot(){await Y.closeBot(this.botId),this.fetchBotDetail(),this.showConfirmCloseDialog=!1},handleClickShare(){const{symbol:t,quoteCurrency:e,direction:i,detail:{totalInvestment:a,totalIncome:o},totalRoi:s}=this.botDetail,r=de({isLong:"LONG"===i,totalInvestment:a,totalIncome:o});this.shareInfo={...this.botDetail,percentage:s,symbolText:`${t}-${e}`,averageEntryPrice:r},this.showShareDialog=!0},formatInvestment(t){return this.$filters.formatNumber(t,this.investmentFormat)}}},ra={class:"summary-wrap"},na={class:"summary-cards-wrap"},la={class:"investment-content"},da={class:"investment-item"},ca={class:"item-title"},ua={class:"executed-fraction"},pa={class:"primary-light"},ga={class:"item-value primary-light"},ha={class:"unit"},ba={class:"investment-item"},ma={class:"item-title"},fa={class:"item-value"},ya={class:"unit"},va={key:0,class:"progress-wrap"},Pa={class:"progress-bar-container"},Ca={class:"progress-percentage primary-light"},Sa={class:"unit"},$a={key:0,class:"buttons-wrap"};const Da=re(sa,[["render",function(t,l,c,p,g,m){const y=e("HeaderBlock"),v=e("SymbolPriceBlock"),P=e("SummaryCard"),C=e("RoiChart"),S=e("BotInfoBlock"),$=e("IconShare"),D=e("BaseButton"),T=e("NextOrderBlock"),k=e("OrderHistoryBlock"),I=e("SharePnlDialog"),O=e("ConfirmCloseDialog"),B=e("EditAdvancedSettingDialog"),w=e("Container");return a(),h(w,null,{overviewSection:b((()=>[s(y,{title:`${t.$t("trading.bot.spot.dca")} ${t.$t("trading.bot.detail")}`,data:{state:g.botDetail.state,createdAt:g.botDetail.createdAt,duration:g.botDetail.duration,closedAt:g.botDetail.closedAt,exitReason:g.botDetail.exitReason},onClickShareBot:m.handleClickShare,onClickCloseBot:l[0]||(l[0]=t=>g.showConfirmCloseDialog=!0)},null,8,["title","data","onClickShareBot"]),s(v,{symbol:m.displaySymbol,baseCurrency:t.currentSpotMarketBaseCurrency,lastPrice:m.roundedLastPrice,lastPriceGains:m.lastPriceGains},null,8,["symbol","baseCurrency","lastPrice","lastPriceGains"]),o("div",ra,[o("div",na,[s(P,{title:t.$t("trading.bot.investment")},{default:b((()=>[o("div",la,[o("div",da,[o("div",ca,[r(n(t.$t("t.executed"))+" ",1),o("span",ua,[l[6]||(l[6]=r(" ( ")),o("span",pa,n(m.executed
1Fraction.numerator),1),r(" / "+n(m.hasLimit?m.executedFraction.denominator:"-")+") ",1)])]),o("div",ga,[r(n(m.executedInvestment)+" ",1),o("span",ha,n(m.investmentUnit),1)])]),o("div",ba,[o("div",ma,n(t.$t("t.total")),1),o("div",fa,[r(n(m.hasLimit?m.estimatedTotalInvestment:m.executedInvestment)+" ",1),o("span",ya,n(m.investmentUnit),1)])]),m.hasLimit?(a(),i("div",va,[o("div",Pa,[o("div",{class:"progress-bar",style:f(m.progressBarStyle)},null,4)]),o("span",Ca,n(m.progressPercentage)+"% ",1)])):d("",!0)])])),_:1},8,["title"]),s(P,{title:t.$t("futuresMain.marginBalanace.unrealizedPNL")},{default:b((()=>[o("div",{class:u(["unrealized-pnl",{"brand-color-positive":g.botDetail.unrealizedProfit>0,"brand-color-negative":g.botDetail.unrealizedProfit<0}])},[r(n(t.$filters.formatNumber(g.botDetail.unrealizedProfit,{formatKey:2,signed:!0,currency:t.marketQuoteCurrency}))+" ",1),o("span",Sa,n(t.marketQuoteCurrency)+" ("+n(t.$filters.formatNumber(g.botDetail.unrealizedRoi,{formatKey:2,signed:!0}))+") ",1)],2)])),_:1},8,["title"])]),s(C,{quoteCurrency:t.marketQuoteCurrency,roiPointList:g.botDetail.roiPoint,priceFilter:m.priceFilter},null,8,["quoteCurrency","roiPointList","priceFilter"])])])),botInfoSection:b((()=>[s(S,{title:t.$t("trading.bot.detail"),infoList:m.botDetailList},null,8,["title","infoList"]),g.enableEarn?(a(),h(S,{key:0,title:t.$t("trading.bot.advancedSettings"),infoList:m.advancedSettingsList,showEditIcon:m.isRunning,onClickEdit:l[1]||(l[1]=t=>g.showEditAdvancedSettingDialog=!0)},null,8,["title","infoList","showEditIcon"])):d("",!0)])),mobileButtonsSection:b((()=>[t.isNotDesktop?(a(),i("div",$a,[s(D,{class:"primary",size:"small",onClick:m.handleClickShare},{default:b((()=>[s($,{class:"icon-share"}),r(" "+n(t.$t("trading.bot.shareBot")),1)])),_:1},8,["onClick"]),m.isRunning?(a(),h(D,{key:0,class:"close-bot",size:"small",onClick:l[2]||(l[2]=t=>g.showConfirmCloseDialog=!0)},{default:b((()=>[r(n(t.$t("trading.bot.closeBot")),1)])),_:1})):d("",!0)])):d("",!0)])),orderInfoSection:b((()=>[m.isRunning?(a(),h(T,{key:0,data:{detail:g.botDetail.detail,direction:g.botDetail.direction},investmentUnit:m.investmentUnit},null,8,["data","investmentUnit"])):d("",!0),s(k,{orderHistory:g.botOrderHistory,baseCurrency:t.currentSpotMarketBaseCurrency,quoteCurrency:t.marketQuoteCurrency,priceFilter:m.priceFilter,sizeFilter:m.sizeFilter,onLoadMoreHistory:m.handleLoadMoreHistory},null,8,["orderHistory","baseCurrency","quoteCurrency","priceFilter","sizeFilter","onLoadMoreHistory"])])),dialogs:b((()=>[g.showShareDialog?(a(),h(I,{key:0,show:g.showShareDialog,"onUpdate:show":l[3]||(l[3]=t=>g.showShareDialog=t),position:g.shareInfo,isBotSharing:""},null,8,["show","position"])):d("",!0),s(O,{visible:g.showConfirmCloseDialog,"onUpdate:visible":l[4]||(l[4]=t=>g.showConfirmCloseDialog=t),title:t.$t("trading.bot.stopConfirm.title"),description:t.$t("trading.bot.stopConfirm.desc",{symbol:g.botDetail.symbol}),closeBtnText:t.$t("trading.bot.closeBot"),onConfirmClose:m.handleConfirmCloseBot}
1,null,8,["visible","title","description","closeBtnText","onConfirmClose"]),s(B,{visible:g.showEditAdvancedSettingDialog,"onUpdate:visible":l[5]||(l[5]=t=>g.showEditAdvancedSettingDialog=t),data:{detail:g.botDetail.detail},baseCurrency:t.currentSpotMarketBaseCurrency,earnRate:m.earnRate,onClickConfirm:m.handleUpdateSettingsConfirm},null,8,["visible","data","baseCurrency","earnRate","onClickConfirm"])])),_:1})}],["__scopeId","data-v-4fd085d2"]]),Ta=Object.freeze(Object.defineProperty({__proto__:null,default:Da},Symbol.toStringTag,{value:"Module"})),ka={class:"title-section"},Ia={class:"title"},Oa=re(m({__name:"AdvancedSettingsTitle",props:{title:{},isEmpty:{type:Boolean},editable:{type:Boolean,default:!1}},emits:["edit"],setup(t,{emit:e}){const s=e;return(t,e)=>(a(),i("div",ka,[o("h6",Ia,[r(n(t.title)+" ",1),l(t.$slots,"title-suffix",{},void 0,!0)]),o("div",{class:u(["edit-section",{active:t.editable}]),onClick:e[0]||(e[0]=e=>t.editable&&s("edit"))},[t.isEmpty?(a(),i("span",{key:0,class:u({inactive:!t.editable})},n(t.$t("t.notSet")),3)):d("",!0),t.editable?(a(),h(K,{key:1})):d("",!0)],2)]))}}),[["__scopeId","data-v-486c921a"]]),Ba={class:"item"},wa={class:"label"},Ra={class:"item-value"},Aa={class:"item"},La={class:"label"},Ma={class:"item-value"},_a={key:0,class:"price-type"},Ha={class:"item"},xa={class:"label"},Ea={class:"item-value"},Na=m({__name:"TrailingStopSettings",props:{detail:{},direction:{},symbol:{},isRunning:{type:Boolean}},setup(t){const e={MARK_PRICE:"trading.mark",LAST_PRICE:"trading.last"},{t:l}=k(),c=I(),g=O((()=>c.state.futures.marketMap)),h=O((()=>t.detail.exitCondition)),b=O((()=>t.detail.trailingStopActivationDirection)),m=O((()=>t.detail.trailingStopEstPrice)),{arrowClass:f,formattedActivationPrice:y,formattedTrailingStopWithEstPrice:v,activationPrice:P}=Gt({exitCondition:h,direction:t.direction,formatPrice:e=>{var i;const a=(null==(i=g.value[t.symbol])?void 0:i.priceFilter)??2;return rt(e,a)},trailingStopActivationDirection:b,trailingStopEstPrice:m}),C=O((()=>!P.value)),S=O((()=>{const{trailingStop:i,trailingStopType:a,trailingStopActivation:o}=h.value;if(!i||!a)return{trailingTypeLabel:"-",priceType:"",statusText:l("t.inactive")};const s=l("PERCENTAGE"===a?"futuresMain.trade.percentage":"t.distance"),r=null==o?void 0:o.type,n=r?l(e[r]):"",d=t.isRunning?l("debitCard.activated"):l("t.active");return{trailingTypeLabel:s,priceType:n,statusText:t.detail.isTrailingStopActive?d:l("t.inactive")}}));return(t,e)=>(a(),i(p,null,[o("div",Ba,[o("div",wa,n(S.value.trailingTypeLabel),1),o("div",Ra,[s(st,{class:u(B(f))},null,8,["class"]),r(" "+n(B(v)),1)])]),o("div",Aa,[o("div",La,n(t.$t("t.activationPrice")),1),o("div",Ma,[r(n(B(y))+" ",1),C.value?d("",!0):(a(),i("span",_a," ("+n(S.value.priceType)+") ",1))])]),o("div",Ha,[o("div",xa,n(t.$t("t.status")),1),o("div",Ea,[s(Et,{active:t.detail.isTrailingStopActive},null,8,["active"]),o("span",{class:u({active:t.detail.isTrailingStopActive})},n(S.value.statusText),3)])])],64))}}),Fa={MARK_PRICE:"trading.mark",LAST_PRICE:"trading.last"},za={name:"BotInfoSection",components:{BotInfoBlock:Bi,Tooltip:q,AdvancedSettingsTitle:Oa,TrailingStopSettings:re(Na,[["__scopeId","data-v-e6872b9f"]]),IconAlertCircle:nt},props:{data:{type:Object,required:!0},leverage:{type:Number,default:0},priceFilter:{type:Number,default:2},quoteCurrency:{type:String,default:""},isInsufficient:{type:Boolean,default:!1},isOutOfRange:{type:Boolean,default:!1},isRunning:{type:Boolean,default:!0},isPositionHeldStatus:{type:Boolean,default:!1}},emits:["clickEdit","clickEditTrailingStop","openEditBotMargin","openModifyGridParamsDialog"],setup(){const t=ct();return{makerFee:t.makerFee,takerFee:t.takerFee}},data:()=>({GRID_SIDES:E,BotStatus:F,PriceTypeI18nKeyMap:Fa}
1),computed:{...t("futures",["marketDetailMap","openPositionMap"]),...c(["isUnifiedWallet","isEnableTradingBotUpdateParameter"]),...c("futures",["marginMode"]),symbol(){return this.data.symbol},editableAdvancedSettings(){return this.isRunning||this.isPositionHeldStatus},editableGridParams(){return this.isEnableTradingBotUpdateParameter&&this.isUnifiedWallet&&me(this.data.state)},openPosition(){var t;return null==(t=this.openPositionMap[this.symbol])?void 0:t[0]},feeDetail(){return{[dt.MAKER]:{displayType:this.$t("t.makerFee"),value:this.makerFee},[dt.TAKER]:{displayType:this.$t("t.takerFee"),value:this.takerFee}}},fee(){const{detail:{feeType:t}}=this.data;return this.feeDetail[t]},stepPrice(){const{detail:{upperPrice:t,lowerPrice:e,gridNumber:i}}=this.data;return be({upperPrice:t,lowerPrice:e,gridNumber:i,priceFilter:this.priceFilter})},lowerProfitPercentage(){var t;const{detail:{upperPrice:e}}=this.data;return he({stepPrice:this.stepPrice,upperPrice:e,fee:null==(t=this.fee)?void 0:t.value})},higherProfitPercentage(){var t;const{detail:{lowerPrice:e}}=this.data;return ge({stepPrice:this.stepPrice,lowerPrice:e,fee:null==(t=this.fee)?void 0:t.value})},displayMarginMode(){return this.marginMode===lt.ISOLATED?this.$t("t.isolated"):this.$t("futuresMain.trade.cross")},detailList(){var t,e;const{detail:{lowerPrice:i,upperPrice:a,gridNumber:o,initialMargin:s,initialLeverage:r,initialLastPrice:n,botMargin:l,walletName:d},tradingBotId:c,direction:u}=this.data;return[{label:this.$t("trading.bot.gridDirection"),value:ce(u)},{label:this.$t("strategy.priceRange"),value:`${this.formatPrice(i,{preserveDecimals:!0})} - ${this.formatPrice(a,{preserveDecimals:!0})} ${this.quoteCurrency}`,editable:this.editableGridParams,onEdit:()=>this.$emit("openModifyGridParamsDialog"),valueStyle:this.isOutOfRange?"color: var(--app--color--accent-red);":"",tooltip:this.isOutOfRange?this.$t("trading.bot.grid.priceOutOfRange"):null,tipBottomAction:this.isOutOfRange?{text:`${this.$t("trading.bot.modifyPriceRange")} >`,action:()=>this.$emit("openModifyGridParamsDialog")}:null},{label:this.$t("trading.bot.numberOfGrids"),value:o,editable:this.editableGridParams,onEdit:()=>this.$emit("openModifyGridParamsDialog")},{label:this.$t("trading.bot.grid.profitPerGrid"),value:`${this.lowerProfitPercentage}% - ${this.higherProfitPercentage}%`},{label:this.$t("trading.bot.grid.fee.base"),value:`${null==(t=this.fee)?void 0:t.displayType} ${100*(null==(e=this.fee)?void 0:e.value)}%`},{label:this.$t("futuresMain.marginMode"),value:this.displayMarginMode,hide:this.isUnifiedWallet},{label:this.$t("t.initialMargin"),value:`${this.$filters.formatNumber(s,2)} ${this.quoteCurrency}`},{label:this.$t("trading.botMargin"),value:`${this.$filters.formatNumber(l||0,2)} ${this.quoteCurrency}`,hide:!this.isUnifiedWallet,editable:this.isUnifiedWallet&&d&&ue(this.data.state),onEdit:this.handleOpenEditBotMargin,valueStyle:this.isInsufficient?"color: var(--app--color--accent-red);":"",tooltip:this.isInsufficient?this.$t("trading.bot.grid.insufficientBalance"):""},{label:this.$t("trading.bot.iniLeverage"),value:`${r}x`},{label:this.$t("trading.currentLeverage"),value:`${this.leverage}x`},{label:this.$t("trading.bot.startPriceCapital"),value:this.formatPrice(n,{preserveDecimals:!0})},{label:this.$t("trading.bot.status"),value:pe(this.data.state)},{label:this.$t("trading.bot.id"),value:c}]},stopLossPriceSetting(){const{detail:{exitCondition:t}}=this.data,{top:e={},bottom:i={}}=t||{},a=(t,e)=>t?{price:`${this.formatPrice(t)} ${this.quoteCurrency}`,type:this.$t(Fa[e])}:{price:"-",type:""};return this.data.direction===E.SHORT.value?{topPrice:a(i.price,i.type),bottomPrice:a(e.price,e.type)}:{topPrice:a(e.price,e.type),bottomPrice:a(i.price,i.type)}},isNeutral(){return this.data.direction===this.GRID_SIDES.NEUTRAL.value},topPriceLabel(){return this.isNeutral?this.$t("trading.bot.stopTopPrice"):this.$t("trading.bot.takeProfitPrice")},bottomPriceLabel(){return this.isNeutral?this.$t("trading.bot.stopBottomPrice"):this.$t("trading.bot.stopLossPrice")},stopLossPriceSettingEmpty(){const{topPrice:t,bottomPrice:e}=this.stopLossPriceSetting;return"-"===t.price&&"-"===e.price},trailingStopSettingEmpty(){var t,e;return!(null==(e=null==(t=this.data.detail)?void 0:t.exitCondition)?void 0:e.trailingStop)},trailingStopTooltipDescription(){return this.isRunning?this.$t("trading.bot.trailingStop.detail.description"):this.$t("trading.bot.trailingStop.history.description")}},methods:{formatPrice(t,e={}){var i;const a=null==(i=this.marketDetailMap[this.symbol])?void 0:i.priceFilter;return this.$filters.formatNumber(t,void 0===a||e.preserveDecimals?{preserveDecimals:!0}:a)},handleOpenEditBotMargin(){this.$emit("openEditBotMargin")}}},Ua={class:"bot-info advanced-settings"},Ga={class:"bot-info-title"},qa={class:"bot-info-list"},Ka={class:"highlight"},ja={class:"item"},Va={class:"label"},Wa={class:"item-value"},Ya={key:0,class:"price-type"},Qa={class:"item"}
1,Xa={class:"label"},Za={class:"item-value"},Ja={key:0,class:"price-type"},to={key:0,class:"highlight"},eo={key:1,class:"item"},io={class:"label"},ao={class:"item-value"},oo={key:2,class:"item"},so={class:"label"},ro={class:"item-value"},no={key:3,class:"item"},lo={class:"label"};const co=re(za,[["render",function(t,l,c,u,g,m){var f;const y=e("BotInfoBlock"),v=e("AdvancedSettingsTitle"),P=e("IconAlertCircle"),C=e("Tooltip"),S=e("TrailingStopSettings");return a(),i(p,null,[s(y,{title:t.$t("trading.bot.detail"),infoList:m.detailList},null,8,["title","infoList"]),o("div",Ua,[o("div",Ga,n(t.$t("trading.bot.advancedSettings")),1),o("div",qa,[o("div",Ka,[s(v,{title:t.$t("trading.bot.stopConditionPor"),isEmpty:m.stopLossPriceSettingEmpty,editable:m.editableAdvancedSettings,onEdit:l[0]||(l[0]=e=>t.$emit("clickEdit"))},null,8,["title","isEmpty","editable"]),m.stopLossPriceSettingEmpty?d("",!0):(a(),i(p,{key:0},[o("div",ja,[o("div",Va,n(m.topPriceLabel),1),o("div",Wa,[r(n(m.stopLossPriceSetting.topPrice.price)+" ",1),m.stopLossPriceSetting.topPrice.type?(a(),i("span",Ya," ("+n(m.stopLossPriceSetting.topPrice.type)+") ",1)):d("",!0)])]),o("div",Qa,[o("div",Xa,n(m.bottomPriceLabel),1),o("div",Za,[r(n(m.stopLossPriceSetting.bottomPrice.price)+" ",1),m.stopLossPriceSetting.bottomPrice.type?(a(),i("span",Ja," ("+n(m.stopLossPriceSetting.bottomPrice.type)+") ",1)):d("",!0)])])],64))]),m.isNeutral?d("",!0):(a(),i("div",to,[s(v,{title:t.$t("futuresMain.trade.trailingStop"),isEmpty:m.trailingStopSettingEmpty,editable:m.editableAdvancedSettings,onEdit:l[1]||(l[1]=e=>t.$emit("clickEditTrailingStop"))},{"title-suffix":b((()=>[s(C,{tooltip:m.trailingStopTooltipDescription},{content:b((()=>[s(P,{class:"icon-alert"})])),_:1},8,["tooltip"])])),_:1},8,["title","isEmpty","editable"]),(null==(f=c.data.detail.exitCondition)?void 0:f.trailingStop)?(a(),h(S,{key:0,detail:c.data.detail,direction:c.data.direction,symbol:c.data.symbol,isRunning:c.isRunning},null,8,["detail","direction","symbol","isRunning"])):d("",!0)])),t.isUnifiedWallet?d("",!0):(a(),i("div",eo,[s(C,{tooltip:t.$t("trading.bot.grid.closeAndCancelTooltip")},{content:b((()=>[o("div",io,n(t.$t("trading.bot.cancelOrderOnStop")),1)])),_:1},8,["tooltip"]),o("div",ao,n(c.data.detail.botStopAction.cancelAllOrders?t.$t("t.enabled"):t.$t("t.disabled")),1)])),t.isUnifiedWallet?d("",!0):(a(),i("div",oo,[s(C,{tooltip:t.$t("trading.bot.grid.closeAndCancelTooltip")},{content:b((()=>[o("div",so,n(t.$t("trading.bot.cancelPositionOnStop")),1)])),_:1},8,["tooltip"]),o("div",ro,n(c.data.detail.botStopAction.closeAllPositions?t.$t("t.enabled"):t.$t("t.disabled")),1)])),t.isUnifiedWallet?(a(),i("div",no,[o("div",lo,n(t.$t("trading.bot.grid.confirmClose.bothClose.description",{symbol:m.symbol})),1)])):d("",!0)])])],64)}],["__scopeId","data-v-8d117be0"]]),uo={class:"estimated-pnl"},po={class:"label"},go=re(m({__name:"EstimatedPnl",props:{estPnl:{},estReturn:{}},setup:t=>(t,e)=>(a(),i("div",uo,[o("span",po,n(t.$t("trading.bot.grid.closePosition.estimatedPnl.label")),1),o("span",{class:u(["value",{"brand-color-positive":t.estPnl>=0,"brand-color-negative":t.estPnl<0}])},[r(n(t.$filters.formatNumber(t.estPnl,{formatKey:2,signed:!0}))+" ",1),null!==t.estReturn?(a(),i(p,{key:0},[r(" ("+n(t.$filters.formatNumber(t.estReturn,{formatKey:2,signed:!0,postfix:"%"}))+") ",1)],64)):d("",!0)],2)]))}),[["__scopeId","data-v-a207ccf9"]]),ho={class:"close-position-input"},bo={class:"price-input-wrap"},mo={name:"ActivePositionBlock",components:{RiskLimitLabel:Kt,ClosePositionInput:re(m({__name:"ClosePositionInput",props:{symbol:{},isBuySide:{type:Boolean},entryPrice:{},cryptoSize:{},positionMargin:{},minPriceIncrement:{default:0}},emits:["clickClosePosition"],setup(t,{expose:e,emit:l}){const c=t,g=pt(),m=l,f=w(""),y=O((()=>g.isMobile?ut.L:ut.XS)),v=O((()=>!Number(f.value))),P=O((()=>f.value?fe({inputPrice:f.value,entryPrice:c.entryPrice,cryptoSize:c.cryptoSize,positionMargin:c.positionMargin,isLong:c.isBuySide}):null));function C(){v.value||m("clickClosePosition",{orderType:ht.LIMIT,price:f.value.replaceAll(",","")})}return e({resetPrice:function(){f.value=""}}),(t,e)=>(a(),i(p,null,[o("div",ho,[o("div",bo,[s(ne,{value:f.value,"onUpdate:value":e[0]||(e[0]=t=>f.value=t),class:"limit-price-input",enableThousandSeparator:"",step:t.minPriceIncrement,desktopStyle:""},{prepend:b((()=>[r(n(t.$t("t.price")),1)])),_:1},8,["value","step"]),P.value&&t.isDesktop?(a(),h(go,{key:0,estPnl:P.value.estPnl,estReturn:P.value.estReturn},null,8,["estPnl","estReturn"])):d("",!0)]),s(gt,{class:u(["close-btn primary",{disabled:v.value}]),size:y.value,onClick:C},{default:b((()=>[r(n(t.$t("futuresMain.trade.limit")),1)])),_:1},8,["class","size"]),s(gt,{class:"close-btn primary",size:y.value,onClick:e[1]||(e[1]=t=>m("clickClosePosition",{orderType:B(ht).MARKET}))},{default:b((()=>[r(n(t.$t("futuresMain.trade.market")),1)])),_:1},8,["size"])]),P.value&&t.isMobile?(a(),h(go,{key:0,estPnl:P.value.estPnl,estReturn:P.value.estReturn},null,8,["estPnl","estReturn"])):d("",!0)],64))}}),[["__scopeId","data-v-2c5db8c0"]]),CloseGridBotPositionDialog:qt}
1,props:{symbol:{type:String,default:""},markPrice:{type:Number,default:0},quoteCurrency:{type:String,default:""},baseCurrency:{type:String,default:""},priceFilter:{type:Number,default:2},sizeFilter:{type:Number,default:0},minPriceIncrement:{type:Number,default:0},botDetail:{type:Object,default:()=>({})},isPositionHeldStatus:{type:Boolean,default:!1},direction:{type:String,default:""},botId:{type:String,default:""}},emits:["closePositionConfirmed"],setup(){const{checkPriceProtection:t}=jt();return{BigNumber:$,checkPriceProtection:t}},data:()=>({FuturesSizeType:Ct,isLoading:!0,position:{},closeGridBotPositionDialogInfo:{visible:!1,orderType:ht.MARKET,price:void 0}}),computed:{...t("futures",["walletMap"]),...T(Pt,["isContractSizeType"]),...c("futures",["openPosition","initialMarginPercentage"]),...c(["isUnifiedWallet"]),headers(){return[{id:"frontBar"},{id:"symbol",text:this.$t("futuresMain.symbol")},{id:"size",text:this.$t("t.positionSize"),textAlignRight:!0},{id:"entryPrice",text:this.$t("futuresMain.openPosition.entryPrice"),textAlignRight:!0},{id:"markPrice",text:this.$t("futuresMain.openPosition.markPrice"),textAlignRight:!0},{id:"liqPrice",text:this.$t("futuresMain.openPosition.liqPrice"),textAlignRight:!0},{id:"unrealizedPNL",text:this.$t("futuresMain.openPosition.unrealizedPNL"),textAlignRight:!0},{id:"positionMargin",text:this.$t("futuresMain.openPosition.margin")}]},isBuySide(){var t;return"MODE_BUY"===(null==(t=this.position)?void 0:t.orderModeName)},positionSize(){if(this.isContractSizeType)return this.position.totalContracts||0;const t=vt(this.position.totalContracts||0,this.symbol);return`${this.$filters.formatNumber(t,this.sizeFilter)} ${this.baseCurrency}`},cryptoSize(){return vt(this.position.totalContracts||0,this.symbol)},positionLeverage(){const{isolatedLeverage:t}=this.position;return`${yt(t,this.initialMarginPercentage(this.symbol),2)}x`},hasActivePosition(){return this.position&&this.position.totalContracts},getPositionPnlColor(){let t;return t=this.isUnifiedWallet?this.position.unrealizedProfitLoss>0:this.position.unrealizedPnlInSettleAsset>0,t?"brand-color-positive":"brand-color-negative"},getPositionPnl(){return this.isUnifiedWallet?this.$filters.formatNumber(this.position.unrealizedProfitLoss||0,{formatKey:"default"}):this.$filters.formatNumber(this.position.unrealizedPnlInSettleAsset||0,{formatKey:this.position.unrealizedPnlFilter||0})},getPositionRoe(){if(this.isUnifiedWallet){const t=ft({formula:"positionRoe",position:this.position,markIndex:{price:this.markPrice},leverage:this.position.isolatedLeverage});return`(${this.$filters.formatNumber(t||0)}%)`}return`(${this.$filters.formatNumber(this.position.positionRoe||0)}%)`},isolatePositionMargin(){var t,e,i;const a=null==(e=null==(t=this.position)?void 0:t.activeWalletName)?void 0:e.replace("-USDT","-USD");return(null==(i=this.walletMap[a])?void 0:i.marginBalance)||0},getTopics(){return`all-position-isolated-wallet:${this.symbol}-${mt}:${this.botDetail.walletName}`},canSubscribe(){var t;return this.isUnifiedWallet&&!!(null==(t=this.botDetail)?void 0:t.walletName)},subscribeKey(){return this.canSubscribe?this.getTopics:""}},watch:{subscribeKey:{handler(t){t&&this.subscribePositionTopic()},immediate:!0},openPosition(){var t;this.isUnifiedWallet||(this.position=null==(t=this.openPosition)?void 0:t[0])}},created(){this.openIo()},async mounted(){if(!this.isUnifiedWallet)try{await this.getOpenPositionList()}finally{this.isLoading=!1}},beforeUnmount(){this.unSubscribeTopics({topics:[this.getTopics]})},methods:{...A("futures",["getOpenPositionList"]),...R(bt,["openIo","extraSubscribe","unSubscribeTopics"]),subscribePositionTopic(){const t=this.getTopics;this.extraSubscribe({topics:[t],callbacks:{[t]:t=>{this.position=t[0],this.isLoading=!1}}})},handleClickClosePosition({orderType:t,price:e}){this.closeGridBotPositionDialogInfo={visible:!0,orderType:t,price:e}},async handleConfirmClosePosition(){var t;const{orderType:e,price:i}=this.closeGridBotPositionDialogInfo;if(e===ht.LIMIT){if(!(await this.checkPriceProtection({isSpot:!1,isBuyAction:!this.isBuySide,symbol
1:this.symbol,orderPrice:i,priceFilter:this.priceFilter,quoteCurrency:this.quoteCurrency})).ok)return}await Y.closePosition(this.botId,{price:i}),this.closeGridBotPositionDialogInfo.visible=!1,null==(t=this.$refs.closePositionInput)||t.resetPrice(),this.$emit("closePositionConfirmed")}}},fo={class:"active-position-block"},yo={class:"section-title"},vo={class:"title"},Po={key:0,class:"section-content"},Co={key:0,class:"position-wrap"},So={class:"position-field"},$o={class:"position-label symbol-wrap"},Do={key:0,class:"front-bar-wrap"},To={key:0,class:"front-bar-wrap"},ko={class:"position-field items-end"},Io={class:"position-label"},Oo={key:0,class:"tx-align--right"},Bo={key:0},wo={class:"size-unit"},Ro={key:1},Ao={class:"position-field items-end"},Lo={class:"position-label"},Mo={class:"position-value"},_o={class:"position-field items-end"},Ho={class:"position-label"},xo={class:"position-value"},Eo={class:"position-field items-end"},No={class:"position-label"},Fo={class:"position-value"},zo={class:"position-field items-end"},Uo={class:"position-label"},Go={class:"position-field items-end"},qo={class:"position-label"},Ko={class:"position-value"},jo={key:0},Vo={key:1};const Wo=re(mo,[["render",function(t,l,c,g,m,f){const y=e("RiskLimitLabel"),v=e("ToolTip"),P=e("ClosePositionInput"),C=e("CloseGridBotPositionDialog");return a(),i("div",fo,[o("div",yo,[o("div",vo,n(t.$t("trading.activePosition")),1),s(y,{class:"items-center g-8",level:Number(c.botDetail.riskLimitLevel)+1,symbol:c.symbol},null,8,["level","symbol"])]),f.hasActivePosition?(a(),i("div",Po,[m.isLoading?d("",!0):(a(),i("div",Co,[o("div",So,[o("div",$o,[t.isDesktop?(a(),i("div",Do,l[1]||(l[1]=[o("span",{class:"front-bar"},"Â ",-1)]))):d("",!0),r(" "+n(t.$t("futuresMain.symbol")),1)]),o("div",{class:u(["position-value symbol-wrap",{"brand-color-positive":f.isBuySide,"brand-color-negative":!f.isBuySide}])},[t.isDesktop?(a(),i("div",To,[o("span",{class:u(["front-bar",{"buy-side":f.isBuySide,"sell-side":!f.isBuySide}])},null,2)])):d("",!0),r(" "+n(c.symbol),1)],2)]),o("div",ko,[o("div",Io,[s(v,{tooltip:t.$t("futuresMain.openPosition.size.tip")},{content:b((()=>[t.isContractSizeType?(a(),i("div",Oo,[r(n(t.$t("t.positionSize"))+" ",1),t.isDesktop?(a(),i("br",Bo)):d("",!0),o("span",wo," ("+n(t.$t("futuresMain.contracts"))+") ",1)])):(a(),i("span",Ro,n(t.$t("t.positionSize")),1))])),_:1},8,["tooltip"])]),o("div",{class:u(["position-value",{"brand-color-positive":f.isBuySide,"brand-color-negative":!f.isBuySide}])},[f.isBuySide?(a(),i(p,{key:0},[r("+")],64)):(a(),i(p,{key:1},[r("-")],64)),r(" "+n(f.positionSize),1)],2)]),o("div",Ao,[o("div",Lo,[s(v,{content:t.$t("futuresMain.openPosition.entryPrice"),tooltip:t.$t("futuresMain.openPosition.entryPrice.tip")},null,8,["content","tooltip"])]),o("div",Mo,n(t.$filters.formatNumber(m.position.entryPrice||0,{formatKey:c.priceFilter+1,roundMode:f.isBuySide?g.BigNumber.ROUND_UP:g.BigNumber.ROUND_DOWN})),1)]),o("div",_o,[o("div",Ho,[s(v,{content:t.$t("futuresMain.openPosition.markPrice"),tooltip:t.$t("futuresMain.openPosition.markPrice.tip")},null,8,["content","tooltip"])]),o("div",xo,n(t.$filters.formatNumber(c.markPrice,c.priceFilter)),1)]),o("div",Eo,[o("div",No,[s(v,{content:t.$t("futuresMain.openPosition.liqPrice"),tooltip:t.$t("futuresMain.openPosition.liqPrice.tip.v2")},null,8,["content","tooltip"])]),o("div",Fo,n(t.$filters.formatNumber(m.position.liquidationPrice||0,{formatKey:c.priceFilter,roundMode:f.isBuySide?g.BigNumber.ROUND_DOWN:g.BigNumber.ROUND_HALF_UP})),1)]),o("div",zo,[o("div",Uo,[s(v,{content:t.$t("futuresMain.openPosition.unrealizedPNL"),tooltip:t.$t("futuresMain.openPosition.unrealizedPNL.tip")},null,8,["content","tooltip"])]),o("div",{class:u(["position-value",[f.getPositionPnlColor]])},n(f.getPositionPnl)+" "+n(m.position.settleWithNonUSDAsset)+" "+n(f.getPositionRoe),3)]),o("div",Go,[o("div",qo,[s(v,{content:t.$t("futuresMain.openPosition.margin"),tooltip:t.$t("futuresMain.openPosition.margin.tip")},null,8,["content","tooltip"])]),o("div",Ko,[t.isUnifiedWallet?(a(),i("span",jo,n(t.$filters.formatNumber(f.isolatePositionMargin||0)),1)):(a(),i("span",Vo,n(t.$filters.formatNumber(m.position.positionMargin||0)),1)),r(" "+n(c.quoteCurrency)+" ("+n(f.positionLeverage)+") ",1)])])])),c.isPositionHeldStatus?(a(),h(P,{key:1,ref:"closePositionInput",symbol
1:c.symbol,isBuySide:f.isBuySide,entryPrice:m.position.entryPrice,cryptoSize:f.cryptoSize,positionMargin:f.isolatePositionMargin,minPriceIncrement:c.minPriceIncrement,onClickClosePosition:f.handleClickClosePosition},null,8,["symbol","isBuySide","entryPrice","cryptoSize","positionMargin","minPriceIncrement","onClickClosePosition"])):d("",!0)])):d("",!0),s(C,{visible:m.closeGridBotPositionDialogInfo.visible,"onUpdate:visible":l[0]||(l[0]=t=>m.closeGridBotPositionDialogInfo.visible=t),symbol:c.symbol,baseCurrency:c.baseCurrency,direction:c.direction,orderType:m.closeGridBotPositionDialogInfo.orderType,price:m.closeGridBotPositionDialogInfo.price,size:f.cryptoSize,onConfirm:f.handleConfirmClosePosition},null,8,["visible","symbol","baseCurrency","direction","orderType","price","size","onConfirm"])])}],["__scopeId","data-v-11009bbe"]]);const Yo={class:"grid-modification-item-wrap"},Qo={class:"time"},Xo={class:"content"},Zo={class:"item"},Jo={class:"title"},ts={class:"item"},es={class:"name"},is={class:"item"},as={class:"name"},os={class:"item"},ss={class:"name"},rs={class:"value highlight"},ns={key:1,class:"position-held-open-order-table"},ls={key:0,class:"order-row header-row"},ds={class:"header-cell tx-align--left"},cs={class:"header-cell tx-align--right"},us={class:"header-cell tx-align--right"},ps={class:"header-cell tx-align--right"},gs={class:"header-cell tx-align--left side"},hs={class:"header-cell tx-align--right"},bs={class:"header-cell tx-align--left time"},ms={class:"header-cell tx-align--left"},fs={class:"cell"},ys={class:"label"},vs={class:"value symbol"},Ps={class:"cell tx-align--right"},Cs={class:"label"},Ss={class:"value"},$s={class:"unit"},Ds={class:"cell tx-align--right"},Ts={class:"label"},ks={class:"value"},Is={class:"unit"},Os={class:"cell tx-align--right"},Bs={class:"label"},ws={class:"value"},Rs={class:"unit"},As={class:"cell side"},Ls={class:"label"},Ms={class:"cell tx-align--right"},_s={class:"label"},Hs={class:"value"},xs={class:"unit"},Es={class:"cell time"},Ns={class:"label"},Fs={class:"value time tx-align--left"},zs={key:0,class:"cell action-cell tx-align--left"},Us={key:1,class:"cancel-btn-mobile"},Gs={OPEN_ORDERS:"open_orders",ORDER_HISTORY:"order_history",GRID_MODIFICATIONS:"grid_modifications"},qs={ALL:"all",MATCHED:"matched",UNMATCHED:"unmatched"},Ks={name:"OrderInfoSection",components:{Switcher:Tt,LoadMoreObserver:W,IconCredit2:re({name:"IconCredit",components:{Icon:St}},[["render",function(t,i,s,r,n,l){const d=e("Icon");return a(),h(d,{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor"},{default:b((()=>i[0]||(i[0]=[o("path",{d:"M15.4998 8.80039C14.9246 8.31452 14.0732 8.37039 13.5645 8.91652L12.1868 10.3955C12.0203 9.86039 11.5422 9.46164 10.9658 9.41177C11.2127 9.23901 11.4445 9.04548 11.6584 8.8333C12.6443 7.8563 13.1873 6.56148 13.1873 5.18742C13.1873 2.34588 10.8515 0 7.99992 0C5.15585 0 2.84376 2.33938 2.84376 5.18742C2.84376 6.47379 3.31944 7.69386 4.16891 8.63517C3.9376 8.75253 3.72111 8.89706 3.52404 9.0657C3.26923 8.70489 2.84929 8.46861 2.375 8.46861H0.468751C0.209875 8.46861 0 8.67849 0 8.93736V15.531C0 15.7899 0.209875 15.9998 0.468751 15.9998H2.37497C2.98866 15.9998 3.51144 15.6045 3.70294 15.0552C3.72879 15.0597 3.75496 15.0621 3.78119 15.0623H10.8436C11.8708 15.0623 12.8521 14.5716 13.4699 13.748L15.7189 10.7181C16.1657 10.1226 16.0706 9.28261 15.4998 8.80039ZM2.84372 14.5936C2.84372 14.852 2.63344 15.0623 2.37497 15.0623H0.937502V9.40614H2.37497C2.63344 9.40614 2.84372 9.61642 2.84372 9.87489V14.5936ZM3.78119 5.18745C3.78119 2.84401 5.6737 0.937502 7.99989 0.937502C10.3433 0.937502 12.2498 2.84401 12.2498 5.18745C12.2498 7.42505 10.4857 9.26102 8.26561 9.39767C8.18338 9.38201 8.10686 9.34458 8.04402 9.2893L7.82386 9.09555C7.07726 8.43855 6.10154 8.17917 5.17348 8.31602C4.28623 7.51455 3.78119 6.38595 3.78119 5.18745ZM14.9676 10.1574L12.7186 13.1874C12.2783 13.7744 11.5774 14.1249 10.8436 14.1249H3.78119V10.0868L4.10785 9.79933C4.99054 9.02255 6.32186 9.02255 7.20448 9.79933C7.36386 9.93958 7.79605 10.3436 7.99989 10.3436H10.8436C11.1021 10.3436 11.3124 10.5539 11.3124 10.8124C11.3124 11.0708 11.1021 11.2811 10.8436 11.2811H7.48098C7.22211 11.2811 7.01223 11.491 7.01223 11.7499C7.01223 12.0087 7.22211 12.2186 7.48098 12.2186H11.1578C11.5466 12.2186 11.9217 12.0554 12.1867 11.7709L14.2504 9.55552C14.4182 9.37542 14.6878 9.35939 14.8748 9.50008C14.9241 9.53706 14.9657 9.58343 14.9971 9.63653C15.0285 9.68962 15.0491 9.74839 15.0577 9.80947C15.0664 9.87055 15.0628 9.93273 15.0474 9.99244C15.0319 10.0522 15.0048 10.1082 14.9676 10.1574Z"}
1,null,-1),o("path",{d:"M7.99997 4.71869C7.7415 4.71869 7.53122 4.50841 7.53122 4.24994C7.53122 4.0535 7.65513 3.87638 7.83953 3.80922C8.08028 3.72157 8.3606 3.84047 8.60847 4.13563C8.77497 4.33385 9.07066 4.3596 9.26888 4.1931C9.4671 4.0266 9.49285 3.73091 9.32635 3.53269C9.07294 3.23094 8.778 3.02353 8.46869 2.91941V2.375C8.46869 2.11613 8.25882 1.90625 7.99994 1.90625C7.74106 1.90625 7.53119 2.11613 7.53119 2.375V2.92413C7.527 2.9256 7.52281 2.92688 7.51866 2.92841C6.96544 3.12991 6.59375 3.66103 6.59375 4.24997C6.59375 5.02538 7.2246 5.65619 7.99997 5.65619C8.25844 5.65619 8.46872 5.86648 8.46872 6.12495C8.46883 6.21713 8.44172 6.3073 8.39081 6.38415C8.33989 6.46101 8.26743 6.52112 8.1825 6.55698C7.97257 6.64582 7.72138 6.57001 7.49316 6.34888C7.30722 6.16876 7.01047 6.17345 6.83034 6.35935C6.65019 6.54529 6.65491 6.84204 6.84081 7.02217C7.05244 7.2272 7.28772 7.37207 7.53122 7.45382V7.99992C7.53122 8.25879 7.7411 8.46867 7.99997 8.46867C8.25885 8.46867 8.46872 8.25879 8.46872 7.99992V7.45082C8.49548 7.44142 8.52195 7.4312 8.5481 7.4202C8.80273 7.31272 9.01998 7.13248 9.17263 6.90208C9.32528 6.67167 9.40654 6.40133 9.40622 6.12495C9.40619 5.34954 8.77538 4.71869 7.99997 4.71869Z"},null,-1)]))),_:1,__:[0]})}]]),Tooltip:q,GridModificationItem:re({__name:"GridModificationItem",props:{data:{type:Object,default:()=>({})}},setup(t){const e=t,{t:s}=k(),r=O((()=>{const t=[];e.data.priceRange&&t.push(s("strategy.priceRange")),e.data.gridNumber&&t.push(s("trading.bot.noOfGrids"));const i=t.join(" & ");return`${s("msg.modify")} ${i}`})),l=O((()=>{var t,i,a,o;return e.data.priceRange?`${rt(null==(t=e.data.priceRange)?void 0:t[0])}~${rt(null==(i=e.data.priceRange)?void 0:i[1])}`:`${rt(null==(a=e.data.originalPriceRange)?void 0:a[0])}~${rt(null==(o=e.data.originalPriceRange)?void 0:o[1])}`})),d=O((()=>e.data.gridNumber?rt(e.data.gridNumber):rt(e.data.originalGridNumber)));return(e,s)=>(a(),i("div",Yo,[o("div",Qo,n(B($t)(t.data.createdAt)),1),o("div",Xo,[o("div",Zo,[o("div",Jo,n(r.value),1)]),o("div",ts,[o("div",es,n(e.$t("strategy.priceRange")),1),o("div",{class:u(["value",{highlight:t.data.priceRange}])},n(l.value),3)]),o("div",is,[o("div",as,n(e.$t("trading.bot.numberOfGrids")),1),o("div",{class:u(["value",{highlight:t.data.gridNumber}])},n(d.value),3)]),o("div",os,[o("div",ss,n(e.$t("trading.bot.adjustedInvestment"))+"("+n(B(mt))+") ",1),o("div",rs,n(B(rt)(t.data.adjustmentInvestment,{signed:!0})),1)])])]))}},[["__scopeId","data-v-edd2d2ae"]]),PositionHeldOpenOrderTable:re(m({__name:"PositionHeldOpenOrderTable",props:{orderList:{},direction:{},symbol:{},baseCurrency:{},quoteCurrency:{},priceFilter:{default:2},sizeFilter:{default:0}},emits:["cancelOrder"],setup(t,{emit:e}){const l=t,c=e,m=I(),f=O((()=>l.direction===E.LONG.value)),y=O((()=>m.getters.isNightTheme)),v=t=>rt(vt(t,l.symbol),l.sizeFilter),P=t=>{const e=vt(t.originalAmount,l.symbol);return rt($(t.price).times(e).toNumber(),2)};return(t,e)=>t.orderList.length?(a(),i("div",ns,[t.isDesktop?(a(),i("div",ls,[o("span",ds,n(t.$t("futuresMain.symbol")),1),o("span",cs,n(t.$t("trading.fillSize")),1),o("span",us,n(t.$t("trading.orders.totalSize")),1),o("span",ps,n(t.$t("t.orderPrice")),1),o("span",gs,n(t.$t("t.side")),1),o("span",hs,n(t.$t("futuresMain.trade.total")),1),o("span",bs,n(t.$t("t.time")),1),o("span",ms,n(t.$t("t.action")),1)])):d("",!0),(a(!0),i(p,null,g(t.orderList,(e=>(a(),i("div",{key:e.orderID,class:"order-row"},[o("div",fs,[o("span",ys,n(t.$t("futuresMain.symbol")),1),o("span",vs,n(t.symbol),1)]),o("div",Ps,[o("span",Cs,n(t.$t("trading.fillSize")),1),o("div",null,[o("span",Ss,n(v(e.filledSize)),1),o("span",$s,n(t.baseCurrency),1)])]),o("div",Ds,[o("span",Ts,n(t.$t("trading.orders.totalSize")),1),o("div",null,[o("span",ks,n(v(e.originalAmount)),1),o("span",Is,n(t.baseCurrency),1)])]),o("div",Os,[o("span",Bs,n(t.$t("t.orderPrice")),1),o("div",null,[o("span",ws,n(t.$filters.formatNumber(e.price,t.priceFilter)),1),o("span",Rs,n(t.quoteCurrency),1)])]),o("div",As,[o("span",Ls,n(t.$t("t.side")),1),o("span",{class:u(["value",f.value?"brand-color-negative":"brand-color-positive"])}
1,n(f.value?t.$t("t.sell"):t.$t("t.buy")),3)]),o("div",Ms,[o("span",_s,n(t.$t("futuresMain.trade.total")),1),o("div",null,[o("span",Hs,n(P(e)),1),o("span",xs,n(t.quoteCurrency),1)])]),o("div",Es,[o("span",Ns,n(t.$t("t.time")),1),o("span",Fs,n(t.$filters.formatDate(e.createTimestamp)),1)]),t.isDesktop?(a(),i("div",zs,[s(gt,{class:"cancel-btn primary extra-small",size:B(ut).S,onClick:t=>c("cancelOrder",e.orderID)},{default:b((()=>[r(n(t.$t("t.cancel")),1)])),_:2},1032,["size","onClick"])])):(a(),i("div",Us,[s(gt,{class:"primary block",size:B(ut).L,onClick:t=>c("cancelOrder",e.orderID)},{default:b((()=>[r(n(t.$t("t.cancel")),1)])),_:2},1032,["size","onClick"])]))])))),128))])):(a(),h(Dt,{key:0,class:"no-data",isIconDark:y.value,emptyText:t.$t("trading.bot.grid.positionHeldOpenOrder.emptyText")},null,8,["isIconDark","emptyText"]))}}),[["__scopeId","data-v-55ed32de"]])},props:{symbol:{type:String,default:""},baseCurrency:{type:String,default:""},quoteCurrency:{type:String,default:""},contractPerStep:{type:String,default:"0"},lastPrice:{type:Number,default:0},openOrderList:{type:Array,default:()=>[]},orderHistory:{type:Object,default:()=>{}},isRunning:{type:Boolean,default:!1},priceFilter:{type:Number,default:2},sizeFilter:{type:Number,default:0},botDetail:{type:Object,default:()=>({})},futuresHistoryTab:{type:String,default:qs.ALL},gridModificationList:{type:Array,default:()=>[]},isPositionHeldStatus:{type:Boolean,default:!1},direction:{type:String,default:""},botId:{type:String,default:""}},emits:["loadMoreHistory","loadMoreGridModifications","tabChange","update:futuresHistoryTab"],setup:()=>({BigNumber:$}),data:()=>({OrderHistoryTabType:qs,SWITCHER_TYPE:Bt,FUTURES_BASE_CURRENCY:mt,theme:Ot,OrderInfoType:Gs,selectedType:Gs.OPEN_ORDERS,isolatedBotOrder:[]}),computed:{...t("futures",["marketDetailMap","futuresMarkPriceMap"]),...c(["isUnifiedWallet","isEnableTradingBotUpdateParameter"]),markPrice(){return this.futuresMarkPriceMap[this.symbol]||0},botOrder(){return this.isUnifiedWallet?this.isolatedBotOrder:this.openOrderList},qtyPerOrder(){return $(this.contractPerStep).times(this.contractSize).toNumber()},qtyPerOrderEst(){return $(this.qtyPerOrder).times(this.markPrice).toNumber()},buyOrderList(){return this.botOrder.filter((t=>t.orderMode===It.BUY)).sort(((t,e)=>e.price-t.price))},sellOrderList(){return this.botOrder.filter((t=>t.orderMode===It.SELL)).sort(((t,e)=>t.price-e.price))},switcherList(){var t;const e=[{id:Gs.ORDER_HISTORY,title:`${this.$t("t.tradeHistory")} (${(null==(t=this.orderHistory)?void 0:t.totalOrderCount)||0})`}];return(this.isRunning||this.isPositionHeldStatus)&&e.unshift({id:Gs.OPEN_ORDERS,title:this.$t("trading.orders.title.order")}),this.isUnifiedWallet&&e.push({id:Gs.GRID_MODIFICATIONS,title:this.$t("trading.bot.gridModifications")}),e},displayHistoryList(){return this.orderHistory.pairs.filter((t=>this.isValidPair(t)))},contractSize(){var t;return(null==(t=this.marketDetailMap[this.symbol])?void 0:t.contractSize)??0},getTopics(){return`open-order-isolated-wallet:${this.symbol}-${mt}:${this.botDetail.walletName}`},canSubscribe(){var t;return this.isUnifiedWallet&&!!(null==(t=this.botDetail)?void 0:t.walletName)},subscribeKey(){return this.canSubscribe?this.getTopics:""},orderHistoryTabs(){return[{id:qs.ALL,title:this.$t("trading.bot.grid.tab.allTrades"),count:this.orderHistory.allTradesCount||0},{id:qs.MATCHED,title:this.$t("t.matched"),count:this.orderHistory.matchedTradeCount||0},{id:qs.UNMATCHED,title:this.$t("t.unmatched"),count:this.orderHistory.unmatchedTradeCount||0}]}},watch:{isRunning:{handler(t){this.selectedType=t?Gs.OPEN_ORDERS:Gs.ORDER_HISTORY},immediate:!0},isPositionHeldStatus:{handler(t){t&&(this.selectedType=Gs.OPEN_ORDERS)},immediate:!0},subscribeKey:{handler(t){t&&this.subscribeIsolatedBotOrderTopic()},immediate:!0}},created(){this.openIo()},beforeUnmount(){this.unSubscribeTopics({topics:[this.getTopics]})},methods:{...R(bt,["openIo","extraSubscribe","unSubscribeTopics"]),isPositionAdjustmentType:t=>"POSITION_ADJUSTMENT"===t,subscribeIsolatedBotOrderTopic(){const t=this.getTopics;this.extraSubscribe({topics:[t],callbacks:{[t]:(t,{type:e})=>
1{if(e===kt.SNAPSHOT)this.isolatedBotOrder=t;else if(e===kt.UPDATE){const e=[...this.isolatedBotOrder],i=[];t.forEach((t=>{const a=e.findIndex((e=>e.orderID===t.orderID));-1===a?t.amount>0&&i.push(t):t.amount>0?e[a]=t:e.splice(a,1)})),this.isolatedBotOrder=i.concat(e)}}}})},onTabClick(t){this.$emit("update:futuresHistoryTab",t)},async handleCancelOrder(t){await Y.cancelOrder(this.botId,t),this.isolatedBotOrder=this.isolatedBotOrder.filter((e=>e.orderID!==t))},onSwitcherSelect(t){this.selectedType=t,this.isRunning&&this.$emit("tabChange",t)},isValidPair(t){const{buy:e,sell:i}=t;return(null==e?void 0:e.filledAt)||(null==i?void 0:i.filledAt)},getLatestOrderTime(t,e){const{formatDate:i}=this.$filters;if(!(null==t?void 0:t.filledAt)&&e.filledAt)return i(e.filledAt);if(!(null==e?void 0:e.filledAt)&&t.filledAt)return i(t.filledAt);const a=new Date(t.filledAt),o=new Date(e.filledAt);return i(Math.max(a,o))},formatValue(t,e){return t?this.$filters.formatNumber(t,e):"-"},formatFilledAt(t){return t?this.$filters.formatDate(t):"-"},convertContractToCryptoAmount(t){return t?$(t).times(this.contractSize).toNumber():""}}},js={class:"order-info-section"},Vs={class:"tab-content"},Ws={class:"qty-wrap"},Ys={class:"qty-label"},Qs={class:"qty-value"},Xs={class:"qty-est-value"},Zs={class:"open-orders"},Js={class:"sell-orders"},tr={class:"column-headers"},er={class:"order-list"},ir={class:"order-index"},ar={class:"brand-color-negative"},or={class:"last-price"},sr={class:"label"},rr={class:"price"},nr={class:"buy-orders"},lr={class:"order-list"},dr={class:"order-index"},cr={class:"brand-color-positive"},ur={class:"column-headers"},pr={class:"order-history-tabs"},gr=["onClick"],hr={class:"order-history-summary"},br={class:"profit-list"},mr={key:0,class:"total-profit-wrap"},fr={class:"label dashed-underline"},yr={key:1,class:"total-profit-wrap"},vr={class:"label dashed-underline"},Pr={class:"history-list"},Cr={class:"history-item-top"},Sr={colspan:"7"},$r={class:"history-item-top-content"},Dr={class:"time"},Tr={class:"profits-wrap"},kr={class:"label"},Ir={class:"history-item-header"},Or={class:"header-cell tx-align--left"},Br={class:"header-cell tx-align--left"},wr={class:"header-cell tx-align--left"},Rr={class:"header-cell tx-align--right"},Ar={class:"header-cell tx-align--right"},Lr={class:"header-cell tx-align--right"},Mr={class:"header-cell tx-align--right"},_r={class:"tx-align--left"},Hr={class:"brand-color-positive tx-align--left"},xr={class:"tx-align--left"},Er={class:"tx-align--right price"},Nr={class:"unit"},Fr={class:"tx-align--right price"},zr={class:"unit"},Ur={class:"tx-align--right price"},Gr={class:"unit"},qr={class:"tx-align--right price"},Kr={class:"unit"},jr={class:"tx-align--left"},Vr={class:"brand-color-negative tx-align--left"},Wr={class:"tx-align--left"},Yr={class:"tx-align--right price"},Qr={class:"unit"},Xr={class:"tx-align--right price"},Zr={class:"unit"},Jr={class:"tx-align--right price"},tn={class:"unit"},en={class:"tx-align--right price"},an={class:"unit"};const on={name:"FuturesGridBotDetail",components:{Container:ze,HeaderBlock:ii,SymbolPriceBlock:di,SummaryCard:pi,RoiChart:Pi,BotInfoSection:co,ActivePositionBlock:Wo,OrderInfoSection:re(Ks,[["render",function(t,l,c,m,f,y){const v=e("Switcher"),P=e("PositionHeldOpenOrderTable"),C=e("IconCredit2"),S=e("Tooltip"),$=e("LoadMoreObserver"),D=e("GridModificationItem");return a(),i("section",js,[o("div",null,[s(v,{barHeight:2,type:f.SWITCHER_TYPE.BOTTOM_BAR_NARROW,itemList:y.switcherList,selected:f.selectedType,isDefaultSelectedKey:!1,onSelect:y.onSwitcherSelect},null,8,["type","itemList","selected","onSelect"]),l[2]||(l[2]=o("div",{class:"divider"},null,-1))]),o("div",Vs,[f.selectedType===f.OrderInfoType.OPEN_ORDERS?(a(),i(p,{key:0},[c.isPositionHeldStatus?(a(),h(P,{key:0,orderList:y.botOrder,direction:c.direction,symbol:c.symbol,baseCurrency:c.baseCurrency,quoteCurrency:c.quoteCurrency,priceFilter:c.priceFilter,sizeFilter:c.sizeFilter,botId:c.botId,onCancelOrder:y.handleCancelOrder},null,8,["orderList","direction","symbol","baseCurrency","quoteCurrency","priceFilter","sizeFilter","botId","onCancelOrder"])):(a(),i(p,{key:1},[o("div",Ws,[o("span",Ys,n(t.$t("trading.bot.grid.qtyPerOrder")),1),o("span",Qs,n(t.$filters.formatNumber(y.qtyPerOrder,c.sizeFilter))+" "+n(c.baseCurrency),1),o("span",Xs," â "+n(t.$filters.formatNumber(y.qtyPerOrderEst,{formatKey:2,roundMode:m.BigNumber.ROUND_UP}))+" "+n(f.FUTURES_BASE_CURRENCY),1)]),o("div",Zs,[o("div",Js,[o("div",tr,[o("span",null,n(`${t.$t("t.sell")} (${y.sellOrderList.length})`),1),o("span",null,n(t.$t("t.price"))+" ("+n(c.quoteCurrency)+")",1)]),o("div",er,[(a(!0),i(p,null,g(y.sellOrderList,((e,s)=>(a(),i("div",{key:`${e.price}_${s}`,class:"order"},[o("div",ir,n(s+1),1),o("div",ar,n(t.$filters.formatNumber(e.price,c.priceFilter)),1)])))),128))])]),o("div",or,[o("span",sr,
1n(t.$t("msg.lastPrice")),1),o("span",rr,n(t.$filters.formatNumber(c.lastPrice,c.priceFilter)),1)]),o("div",nr,[o("div",lr,[(a(!0),i(p,null,g(y.buyOrderList,((e,s)=>(a(),i("div",{key:`${e.price}_${s}`,class:"order"},[o("div",dr,n(s+1),1),o("div",cr,n(t.$filters.formatNumber(e.price,c.priceFilter)),1)])))),128))]),o("div",ur,[o("span",null,n(`${t.$t("t.buy")} (${y.buyOrderList.length})`),1),o("span",null,n(t.$t("t.price"))+" ("+n(c.quoteCurrency)+")",1)])])])],64))],64)):f.selectedType===f.OrderInfoType.ORDER_HISTORY?(a(),i(p,{key:1},[o("div",pr,[(a(!0),i(p,null,g(y.orderHistoryTabs,(t=>(a(),i("div",{key:t.id,class:u(["tab",{active:c.futuresHistoryTab===t.id}]),onClick:e=>y.onTabClick(t.id)},n(t.title)+" ("+n(t.count)+") ",11,gr)))),128))]),o("div",hr,[s(C,{class:"icon-credit"}),o("div",br,[c.futuresHistoryTab!==f.OrderHistoryTabType.UNMATCHED?(a(),i("div",mr,[s(S,{tooltip:t.$t("trading.bot.tooltip.matchedProfit"),hasCursorQuestion:""},{content:b((()=>[o("span",fr,n(t.$t("trading.bot.grid.totalMatchedProfits")),1)])),_:1},8,["tooltip"]),o("span",{class:u({"brand-color-positive":c.orderHistory.matchedProfit>0,"brand-color-negative":c.orderHistory.matchedProfit<0})},n(t.$filters.formatNumber(c.orderHistory.matchedProfit,{formatKey:2,signed:!0,postfix:` ${c.quoteCurrency}`})),3)])):d("",!0),c.futuresHistoryTab===f.OrderHistoryTabType.ALL||c.futuresHistoryTab===f.OrderHistoryTabType.UNMATCHED?(a(),i("div",yr,[s(S,{tooltip:t.$t("trading.bot.tooltip.unmatchedProfit"),hasCursorQuestion:""},{content:b((()=>[o("span",vr,n(t.$t("trading.bot.grid.totalUnmatchedMatchedPnl")),1)])),_:1},8,["tooltip"]),o("span",{class:u({"brand-color-positive":c.orderHistory.unmatchedProfit>0,"brand-color-negative":c.orderHistory.unmatchedProfit<0})},n(t.$filters.formatNumber(c.orderHistory.unmatchedProfit,{formatKey:2,signed:!0,postfix:` ${c.quoteCurrency}`})),3)])):d("",!0)])]),o("table",Pr,[(a(!0),i(p,null,g(y.displayHistoryList,(({matchedProfit:e,buy:l,sell:p,tradeType:g},h)=>(a(),i("tbody",{key:h,class:"history-item"},[o("tr",Cr,[o("td",Sr,[o("div",$r,[o("div",Dr,n(y.getLatestOrderTime(l,p)),1),o("div",Tr,[s(S,{disable:!y.isPositionAdjustmentType(g),tooltip:t.$t("trading.bot.tooltip.positionAdjustment")},{content:b((()=>[o("div",kr,n(y.isPositionAdjustmentType(g)?t.$t("trading.bot.grid.positionAdjustment"):t.$t("trading.bot.grid.matchedProfits")),1)])),_:2},1032,["disable","tooltip"]),y.isPositionAdjustmentType(g)?d("",!0):(a(),i("div",{key:0,class:u({"brand-color-positive":e>0,"brand-color-negative":e<0})},n(t.$filters.formatNumber(e,{formatKey:2,signed:!0,postfix:` ${c.quoteCurrency}`})),3))])])])]),o("tr",Ir,[o("th",Or,n(t.$t("t.time")),1),o("th",Br,n(t.$t("t.side")),1),o("th",wr,n(t.$t("trading.orders.type")),1),o("th",Rr,n(t.$t("futuresMain.summaryHistory.avg")),1),o("th",Ar,n(t.$t("trading.fillSize")),1),o("th",Lr,n(t.$t("t.totalValue")),1),o("th",Mr,n(t.$t("t.fee")),1)]),l&&l.filledAt?(a(),i("tr",{key:0,class:u(["history-item-content",{"system-close":!l.orderType}])},[o("td",_r,n(y.formatFilledAt(l.filledAt)),1),o("td",Hr,n(t.$t("t.buy")),1),o("td",xr,n(l.orderType?l.orderType:"-"),1),o("td",Er,[r(n(y.formatValue(l.avgPrice,{preserveDecimals:!0}))+" ",1),o("span",Nr,n(c.quoteCurrency),1)]),o("td",Fr,[r(n(y.formatValue(y.convertContractToCryptoAmount(l.filledSize),c.sizeFilter))+" ",1),o("span",zr,n(c.baseCurrency),1)]),o("td",Ur,[r(n(y.formatValue(l.totalValue,2))+" ",1),o("span",Gr,n(c.quoteCurrency),1)]),o("td",qr,[r(n(l.fee?l.fee:"-")+" ",1),o("span",Kr,n(c.quoteCurrency),1)])],2)):d("",!0),p&&p.filledAt?(a(),i("tr",{key:1,class:u(["history-item-content",{"system-close":!p.orderType}])},[o("td",jr,n(y.formatFilledAt(p.filledAt)),1),o("td",Vr,n(t.$t("t.sell")),1),o("td",Wr,n(p.orderType?p.orderType:"-"),1),o("td",Yr,[r(n(y.formatValue(p.avgPrice,{preserveDecimals:!0}))+" ",1),o("span",Qr,n(c.quoteCurrency),1)]),o("td",Xr,[r(n(y.formatValue(y.convertContractToCryptoAmount(p.filledSize),c.sizeFilter))+" ",1),o("span",Zr,n(c.baseCurrency),1)]),o("td",Jr,[r(n(y.formatValue(p.totalValue,2))+" ",1),o("span",tn,n(c.quoteCurrency),1)]),o("td",en,[r(n(p.fee?p.fee:"-")+" ",1),o("span",an,n(c.quoteCurrency),1)])],2)):d("",!0)])))),128))]),s($,{onLoadMore:l[0]||(l[0]=e=>t.$emit("loadMoreHistory"))})],64)):f.selectedType===f.OrderInfoType.GRID_MODIFICATIONS?(a(),i(p,{key:2},[(a(!0),i(p,null,g(c.gridModificationList,(t=>(a(),h(D,{key:t.createAt,data:t},null,8,["data"])))),128)),s($,{onLoadMore:l[1]||(l[1]=e=>t.$emit("loadMoreGridModifications"))})],64)):d("",!0)])])}],["__scopeId","data-v-0075cc55"]]),IconShare:x,IconNotification:H,ConfirmCloseBotDialog:Xt,StopGridBotDialog:Qt,CloseGridBotPositionDialog:qt,EditAdvancedSettingDialog:Yt,TrailingStopDialog:Wt,SharePnlDialog:le,Tooltip:q,AdjustBotMarginDialog:Vt},beforeRouteLeave:t=>(t.name===at.TRADING_BOT_HISTORY&&history.replaceState({tradingBotType:ot.FUTURES_GRID}
1,null,t.fullPath),!0),setup(){const t=w({symbol:"",state:F.CLOSED,detail:{botStopAction:{closeAllPositions:!1,cancelAllOrders:!1},walletName:""},exitCondition:{top:{price:"",type:""},bottom:{price:"",type:""}}}),{openModifyGridParamsDialog:e,isModifiedCount:i}=ee(t);return{botDetail:t,openModifyGridParamsDialog:e,isModifiedCount:i}},data:()=>({showConfirmCloseDialog:!1,showStopGridBotDialog:!1,showCloseGridBotPositionDialog:!1,showShareDialog:!1,shareInfo:{},showEditAdvancedSettingDialog:!1,showTrailingStopDialog:!1,showAdjustBotMarginDialog:!1,botOrderHistory:{totalOrderCount:0,matchedTradeCount:0,unmatchedTradeCount:0,matchedProfit:"0",unmatchedProfit:"0",pairs:[]},orderHistoryPagination:{currentPage:1,pageSize:15,totalPages:1,totalRows:0},gridModificationPagination:{currentPage:1,pageSize:20,totalPages:1,totalRows:0},intervalId:null,OrderHistoryTabType:qs,futuresHistoryTab:qs.ALL,gridModificationList:[],CloseOrderType:ht}),computed:{...t("orderBook",["lastPrice"]),...c("orderBook",["lastPriceGains"]),...t("futures",["openOrderList","marketMap","marketDetailMap","futuresMarkPriceMap"]),...c("futures",["walletLeverage","isMarketOffHours"]),...c(["isUnifiedWallet","isEnableFuturesGridKeepPosition"]),isRunning(){return this.botDetail.state===F.RUNNING},isPositionHeldStatus(){return ye(this.botDetail.state)},defaultIsKeepPosition(){return!this.botDetail.detail.botStopAction.closeAllPositions},positionTotalContracts(){var t;return null==(t=this.botDetail.detail.position)?void 0:t.totalContracts},hasPosition(){return!!this.positionTotalContracts},positionSize(){return this.positionTotalContracts?vt(this.positionTotalContracts,this.botDetail.symbol):0},isInsufficient(){return this.botDetail.detail.nonFatalErrorReason===Lt.INSUFFICIENT_BALANCE},roundedLastPrice(){return $(this.lastPrice).toFixed(this.priceFilter,$.ROUND_DOWN)},markPrice(){const{symbol:t}=this.botDetail;return t&&this.futuresMarkPriceMap[t]||0},baseCurrency(){var t;const{symbol:e}=this.botDetail;return(null==(t=this.marketMap[e])?void 0:t.baseCurrency)||""},quoteCurrency(){return At(this.botDetail.symbol)},stopLossPriceSetting(){const{exitCondition:t}=this.data,{top:e={},bottom:i={}}=t||{};return{topPrice:e.price?this.getPriceText(e.price,e.type):"-",bottomPrice:i.price?this.getPriceText(i.price,i.type):"-"}},botOpenOrderList(){const{botId:t}=this.$route.params;return this.openOrderList.filter((e=>e.botID===t))},priceFormat(){var t;return{formatKey:(null==(t=this.marketMap[this.botDetail.symbol])?void 0:t.priceFilter)??0,currency:this.quoteCurrency}},priceFilter(){return this.priceFormat.formatKey},sizeFilter(){var t;return(null==(t=this.marketDetailMap[this.botDetail.symbol])?void 0:t.sizeFilter)||0},minPriceIncrement(){var t;return(null==(t=this.marketDetailMap[this.botDetail.symbol])?void 0:t.minPriceIncrement)||0},isOutOfRange(){var t;if(!this.isRunning)return!1;const{symbol:e,detail:{upperPrice:i,lowerPrice:a}}=this.botDetail,o=(null==(t=this.marketMap[e])?void 0:t.priceFilter)??0;return $(this.lastPrice).dp(o,$.ROUND_DOWN).gt(i)||$(this.lastPrice).dp(o,$.ROUND_DOWN).lt(a)},trailingStopPercentageValue(){const t=this.botDetail.detail.exitCondition;return te(null==t?void 0:t.trailingStop,null==t?void 0:t.trailingStopType)}},watch:{futuresHistoryTab:{handler(){this.initOrderHistory()}},isModifiedCount(t){t&&(this.fetchBotDetail(),this.gridModificationList=[],this.gridModificationPagination.currentPage=1,this.fetchGridModifications())}},async created(){this.intervalId=setInterval((async()=>{this.fetchBotDetail()}),5e3),this.fetchBotDetail(),this.fetchBotOrderHistory(),this.fetchGridModifications()},beforeUnmount(){clearInterval(this.intervalId)},methods:{async fetchBotDetail(){const{botId:t}=this.$route.params,{data:e}=await Y.getTradingBotDetail(t,{hideCode:!0});this.botDetail=e.tradingBot},async fetchBotOrderHistory(){const{botId:t}=this.$route.params,{data:e}=await Y.getTradingBotOrderHistory({id:t,page:this.orderHistoryPagination.currentPage,pageSize:20,sorting:"lastFilledAt:DESC",type:this.futuresHistoryTab,includePositionAdjustment:!0}),{currentPage:i,pageSize:a,totalPages:o,totalRows:s,orderHistory:r}=e;this.orderHistoryPagination={currentPage:i,pageSize:a,totalPages:o,totalRows:s},this.botOrderHistory={allTradesCount:r.allTradesCount,totalOrderCount:r.totalOrderCount,matchedTradeCount:r.matchedTradeCount,unmatchedTradeCount:r.unmatchedTradeCount,matchedProfit:r.matchedProfit,unmatchedProfit:r.unmatchedProfit,pairs:[...this.botOrderHistory.pairs,...r.pairs]}},async fetchGridModifications(t){const{botId:e}=this.$route.params,i=await Y.getGridModifications(e,{page:this.gridModificationPagination.currentPage,pageSize:this.gridModificationPagination.pageSize});this.gridModificationList=t?[...this.gridModificationList,...i.gridModifications]:i.gridModifications,this.gridModificationPagination.totalPages=i.totalPages,this.gridModificationPagination.totalRows=i.totalRows},handleLoadMoreHistory(){const{currentPage:t,totalPages:e}=this.orderHistoryPagination;t!==e&&(this.orderHistoryPagination.currentPage=t+1,this.fetchBotOrderHistory())},handleLoadMoreGridModifications(){const{currentPage:t,totalPages:e}=this.gridModificationPagination;t!==e&&(this.gridModificationPagination.currentPage=t+1,this.fetchGridModifications(!0))},handleClickCloseBot(){this.isEnableFuturesGridKeepPosition&&this.isUnifiedWallet?this.showStopGridBotDialog=!0:this.showConfirmCloseDialog=!0},handleClickClosePosition(){this.showCloseGridBotPositionDialog=!0},async handleConfirmCloseBot({isKeepPosition:t=!1}={}){const{symbol:e,direction:i="NEUTRAL"}=this.botDetail,{botId:a}=this.$route.params;await Y.closeBot(a,{isKeepPosition:t}),this.fetchBotDetail(),t||wt(Rt.TRADING_BOT_GRID_BOT_CLOSED,{s1:i.toLowerCase(),s2:"futures",s3:e})},async handleConfirmClosePosition(){const{botId:t}=this.$route.params;await Y.closePosition(t),this.fetchBotDetail()},async handleConfirmUpdateSettings(t){const{botId:e}=this.$route.params,{top:i,bottom:a,closeAllPositions:o,cancelAllOrders:s}=t,r={exitCondition:Jt({top:i,bottom:a},this.botDetail.detail.exitCondition),botStopAction:{closeAllPositions:o,cancelAllOrders:s}};await Y.updateTradingBot(e,{config:r}),this.fetchBotDetail()},async handleConfirmUpdateTrailingStop(t){if(!t)return;const e=Zt(t),i={exitCondition:Jt(e,this.botDetail.detail.exitCondition),botStopAction:this.botDetail.detail.botStopAction},{botId:a}=this.$route.params;try{await Y.updateTradingBot(a,{config:i}),this.fetchBotDetail()}finally{this.showTrailingStopDialog=!1}}
1,handleClickShare(){const{totalRoi:t,detail:{initialLeverage:e}}=this.botDetail;this.shareInfo={...this.botDetail,leverage:e,percentage:t},this.showShareDialog=!0},async initOrderHistory(){this.orderHistoryPagination.currentPage=1,this.botOrderHistory.pairs=[],await this.fetchBotOrderHistory(),this.$nextTick((()=>{var t;(null==(t=this.$refs.orderInfoSection)?void 0:t.$el)&&this.$refs.orderInfoSection.$el.scrollIntoView({behavior:"smooth",block:"nearest"})}))},handleTabChange(t){t===Gs.ORDER_HISTORY&&this.initOrderHistory()},clickProfitTitle(t){var e;if(t!==qs.UNMATCHED)this.$refs.orderInfoSection&&(this.futuresHistoryTab=t,this.$refs.orderInfoSection.onSwitcherSelect(Gs.ORDER_HISTORY));else if(null==(e=this.$refs.activePositionBlock)?void 0:e.$el){const t=60,e=this.$refs.activePositionBlock.$el.getBoundingClientRect().top+window.pageYOffset-t;window.scrollTo({top:e,behavior:"smooth"})}}}},sn={key:0,class:"warning-wrap"},rn={class:"content"},nn={class:"summary-wrap"},ln={class:"summary-cards-wrap"},dn={class:"card-value investment-text"},cn={class:"value-subtitle"},un={class:"pnl-info"},pn={class:"value-subtitle"},gn={class:"profit-wrap"},hn={class:"profit"},bn={class:"value-subtitle"},mn={class:"profit"},fn={class:"value-subtitle"},yn={class:"profit"},vn={class:"profit-title no-underline cursor-unset"},Pn={class:"profit-value fee-value"},Cn={class:"value-subtitle"},Sn={key:0,class:"buttons-wrap"};const $n=re(on,[["render",function(t,l,c,p,g,m){const f=e("HeaderBlock"),y=e("IconNotification"),v=e("SymbolPriceBlock"),P=e("SummaryCard"),C=e("Tooltip"),S=e("RoiChart"),$=e("BotInfoSection"),D=e("IconShare"),T=e("BaseButton"),k=e("ConfirmCloseBotDialog"),I=e("StopGridBotDialog"),O=e("CloseGridBotPositionDialog"),B=e("EditAdvancedSettingDialog"),w=e("TrailingStopDialog"),R=e("SharePnlDialog"),A=e("AdjustBotMarginDialog"),L=e("ActivePositionBlock"),M=e("OrderInfoSection"),_=e("Container");return a(),h(_,null,{overviewSection:b((()=>[s(f,{title:t.$t("trading.bot.grid.detail.title"),data:{state:p.botDetail.state,createdAt:p.botDetail.createdAt,duration:p.botDetail.duration,closedAt:p.botDetail.closedAt,exitReason:p.botDetail.exitReason,direction:p.botDetail.direction},isPositionHeldStatus:m.isPositionHeldStatus,onClickCloseBot:m.handleClickCloseBot,onClickShareBot:m.handleClickShare,onClickClosePosition:m.handleClickClosePosition},null,8,["title","data","isPositionHeldStatus","onClickCloseBot","onClickShareBot","onClickClosePosition"]),m.isInsufficient?(a(),i("div",sn,[s(y,{class:"icon"}),o("div",rn,n(t.$t("trading.bot.grid.insufficientBalance")),1),o("div",{class:"bold",onClick:l[0]||(l[0]=t=>g.showAdjustBotMarginDialog=!0)},n(t.$t("trading.increaseMargin")),1)])):d("",!0),s(v,{symbol:p.botDetail.symbol,baseCurrency:m.baseCurrency,lastPrice:m.roundedLastPrice,lastPriceGains:t.lastPriceGains,isOutOfRange:m.isOutOfRange,isInsufficient:m.isInsufficient,onOpenEditBotMargin:l[1]||(l[1]=t=>g.showAdjustBotMarginDialog=!0),onOpenModifyGridParamsDialog:p.openModifyGridParamsDialog},null,8,["symbol","baseCurrency","lastPrice","lastPriceGains","isOutOfRange","isInsufficient","onOpenModifyGridParamsDialog"]),o("div",nn,[o("div",ln,[s(P,{title:t.$t("t.initialMargin")},{default:b((()=>{var e;return[o("div",dn,[r(n(t.$filters.formatNumber(null==(e=p.botDetail)?void 0:e.detail.initialMargin,{formatKey:2}))+" ",1),o("span",cn,n(m.quoteCurrency),1)])]})),_:1},8,["title"]),s(P,{title:t.$t("trading.bot.grid.totalPnl"),tooltip:t.$t("trading.bot.tooltip.totalPnl")},{default:b((()=>{var e,i;return[o("div",un,[o("div",{class:u(["card-value",{"brand-color-positive":p.botDetail.totalProfit>0,"brand-color-negative":p.botDetail.totalProfit<0}])},[r(n(t.$filters.formatNumber(p.botDetail.totalProfit,{formatKey:2,signed:!0}))+" ",1),o("span",pn,n(m.quoteCurrency)+"("+n(t.$filters.formatNumber(p.botDetail.totalRoi,{formatKey:2,signed:!0,postfix:"%"}))+") ",1)],2),o("div",gn,[o("div",hn,[s(C,{tooltip:t.$t("trading.bot.tooltip.realizedPnl")},{content:b((()=>[o("span",{class:"profit-title",onClick:l[2]||(l[2]=t=>m.clickProfitTitle(g.OrderHistoryTabType.MATCHED))},n(t.$t("futuresMain.tradeHistory.realizedPNL")),1)])),_:1},8,["tooltip"]),o("span",{class:u(["profit-value",{"brand-color-positive":p.botDetail.realizedProfit>0,"brand-color-negative":p.botDetail.realizedProfit<0}])},[r(n(t.$filters.formatNumber(p.botDetail.realizedProfit,{formatKey:2,signed:!0}))+" ",1),o("span",bn,n(m.quoteCurrency)+"("+n(t.$filters.formatNumber(p.botDetail.realizedRoi,{formatKey:2,signed:!0,postfix:"%"}))+") ",1)],2)]),o("div",mn,[s(C,{tooltip:t.$t("trading.bot.tooltip.unrealizedPnl")},{content:b((()=>[o("span",{class:u(["profit-title",{"cursor-unset":!m.isRunning}]),onClick:l[3]||(l[3]=t=>m.clickProfitTitle(g.OrderHistoryTabType.UNMATCHED))},n(t.$t("futuresMain.marginBalanace.unrealizedPNL")),3)])),_:1},8,["tooltip"]),o("span",{class:u(["profit-value",{"brand-color-positive":p.botDetail.unrealizedProfit>0,"brand-color-negative":p.botDetail.unrealizedProfit<0}])},[r(n(t.$filters.formatNumber(p.botDetail.unrealizedProfit,{formatKey:2,signed:!0}))+" ",1),o("span",fn,n(m.quoteCurrency)+"("+n(t.$filters.formatNumber(p.botDetail.unrealizedRoi,{formatKey:2,signed:!0,postfix:"%"}))+") ",1)],2)]),o("div",yn,[o("span",vn,n(t.$t("history.order.fundingFee")),1),o("span",Pn,[r(n(t.$filters.formatNumber((null==(i=null==(e=p.botDetail)?void 0:e.detail)?void 0:i.fundingFee)||0,{formatKey:2,signed:!0}))+" ",1),o("span",Cn,n(m.quoteCurrency),1)])])])])]})),_:1},8,["title","tooltip"])]),s(S,{quoteCurrency:"USDT",roiPointList:p.botDetail.roiPoint,priceFilter:m.priceFilter},null,8,["roiPointList","priceFilter"])])])),botInfoSection:b((()=>[s($,{data:p.botDetail,leverage:t.walletLeverage,priceFilter:m.priceFilter,quoteCurrency:m.quoteCurrency,isOutOfRange:m.isOutOfRange,isRunning:m.isRunning,isPositionHeldStatus:m.isPositionHeldStatus,isInsufficient:m.isInsufficient,onClickEdit:l[4]||(l[4]=t=>g.showEditAdvancedSettingDialog=!0),onClickEditTrailingStop:l[5]||(l[5]=t=>g.showTrailingStopDialog=!0),onOpenEditBotMargin:l[6]||(l[6]=t=>g.showAdjustBotMarginDialog=!0),onOpenModifyGridParamsDialog:p.openModifyGridParamsDialog},null,8,["data","leverage","priceFilter","quoteCurrency","isOutOfRange","isRunning","isPositionHeldStatus","isInsufficient","onOpenModifyGridParamsDialog"])])),mobileButtonsSection:b((()=>[t.isNotDesktop?(a(),i("div",Sn,[s(T,{class:"primary",size:"small",onClick:m.handleClickShare},{default:b((()=>[s(D,{class:"icon-share"}),r(" "+n(t.$t("trading.bot.shareBot")),1)])),_:1},8,["onClick"]),m.isRunning?(a(),h(C,{key:0,placement:"top",class:"close-bot-wrap",disable:!t.isMarketOffHours},{content:b((()=>[s(T,{class:"close-bot",size:"small",disabled:t.isMarketOffHours,onClick:m.handleClickCloseBot},{default:b((()=>[r(n(t.$t("trading.bot.closeBot")),1)])),_:1},8,["disabled","onClick"])])),tooltip:b((()=>[r(n(t.$t("t.postOnlyCloseBotDisabled")),1)])),_:1},8,["disable"])):m.isPositionHeldStatus?(a(),h(T,{key:1,class:"close-bot",size:"small",onClick:m.handleClickClosePosition},{default:b((()=>[r(n(t.$t("futuresMain.openPosition.closePosition")),1)])),_:1},8,["onClick"])):d("",!0)])):d("",!0)])),dialogs:b((()=>{var e,i,o,r,n,c,u;return[s(k,{visible:g.showConfirmCloseDialog,"onUpdate:visible":l[7]||
1(l[7]=t=>g.showConfirmCloseDialog=t),symbol:p.botDetail.symbol,cancelAllOrders:p.botDetail.detail.botStopAction.cancelAllOrders,closeAllPositions:p.botDetail.detail.botStopAction.closeAllPositions,onConfirmCloseBot:m.handleConfirmCloseBot},null,8,["visible","symbol","cancelAllOrders","closeAllPositions","onConfirmCloseBot"]),t.isEnableFuturesGridKeepPosition&&t.isUnifiedWallet?(a(),h(I,{key:0,visible:g.showStopGridBotDialog,"onUpdate:visible":l[8]||(l[8]=t=>g.showStopGridBotDialog=t),symbol:p.botDetail.symbol,baseCurrency:m.baseCurrency,hasPosition:m.hasPosition,positionSize:m.positionSize,defaultIsKeepPosition:m.defaultIsKeepPosition,onConfirm:m.handleConfirmCloseBot},null,8,["visible","symbol","baseCurrency","hasPosition","positionSize","defaultIsKeepPosition","onConfirm"])):d("",!0),m.hasPosition?(a(),h(O,{key:1,visible:g.showCloseGridBotPositionDialog,"onUpdate:visible":l[9]||(l[9]=t=>g.showCloseGridBotPositionDialog=t),symbol:p.botDetail.symbol,baseCurrency:m.baseCurrency,direction:p.botDetail.direction,orderType:g.CloseOrderType.MARKET,size:m.positionSize,onConfirm:m.handleConfirmClosePosition},null,8,["visible","symbol","baseCurrency","direction","orderType","size","onConfirm"])):d("",!0),s(B,{visible:g.showEditAdvancedSettingDialog,"onUpdate:visible":l[10]||(l[10]=t=>g.showEditAdvancedSettingDialog=t),botDetail:p.botDetail,onConfirmUpdateSettings:m.handleConfirmUpdateSettings},null,8,["visible","botDetail","onConfirmUpdateSettings"]),g.showTrailingStopDialog?(a(),h(w,{key:2,visible:g.showTrailingStopDialog,"onUpdate:visible":l[11]||(l[11]=t=>g.showTrailingStopDialog=t),symbol:p.botDetail.symbol,direction:p.botDetail.direction,upperPrice:p.botDetail.detail.upperPrice,lowerPrice:p.botDetail.detail.lowerPrice,entryPrice:p.botDetail.detail.entryPrice,trailingStop:m.trailingStopPercentageValue,trailingStopType:null==(e=p.botDetail.detail.exitCondition)?void 0:e.trailingStopType,trailingStopActivationPriceChecked:!!(null==(i=p.botDetail.detail.exitCondition)?void 0:i.trailingStopActivation),trailingStopActivationPrice:null==(r=null==(o=p.botDetail.detail.exitCondition)?void 0:o.trailingStopActivation)?void 0:r.price,trailingStopActivationType:null==(c=null==(n=p.botDetail.detail.exitCondition)?void 0:n.trailingStopActivation)?void 0:c.type,"onDialog:closed":m.handleConfirmUpdateTrailingStop},null,8,["visible","symbol","direction","upperPrice","lowerPrice","entryPrice","trailingStop","trailingStopType","trailingStopActivationPriceChecked","trailingStopActivationPrice","trailingStopActivationType","onDialog:closed"])):d("",!0),g.showShareDialog?(a(),h(R,{key:3,show:g.showShareDialog,"onUpdate:show":l[12]||(l[12]=t=>g.showShareDialog=t),position:g.shareInfo,isBotSharing:""},null,8,["show","position"])):d("",!0),g.showAdjustBotMarginDialog?(a(),h(A,{key:4,visible:g.showAdjustBotMarginDialog,"onUpdate:visible":l[13]||(l[13]=t=>g.showAdjustBotMarginDialog=t),currentMarginProp:p.botDetail.botMargin,botSymbol:p.botDetail.symbol,botData:p.botDetail,position:null==(u=t.$refs.activePositionBlock)?void 0:u.position},null,8,["visible","currentMarginProp","botSymbol","botData","position"])):d("",!0)]})),orderInfoSection:b((()=>[(m.isRunning||m.isPositionHeldStatus)&&p.botDetail.symbol?(a(),h(L,{key:0,ref:"activePositionBlock",symbol:p.botDetail.symbol,markPrice:m.markPrice,priceFilter:m.priceFilter,sizeFilter:m.sizeFilter,minPriceIncrement:m.minPriceIncrement,baseCurrency:m.baseCurrency,quoteCurrency:m.quoteCurrency,botDetail:p.botDetail.detail,isPositionHeldStatus:m.isPositionHeldStatus,direction:p.botDetail.direction,botId:t.$route.params.botId,onClosePositionConfirmed:m.fetchBotDetail},null,8,["symbol","markPrice","priceFilter","sizeFilter","minPriceIncrement","baseCurrency","quoteCurrency","botDetail","isPositionHeldStatus","direction","botId","onClosePositionConfirmed"])):d("",!0),s(M,{ref:"orderInfoSection",futuresHistoryTab:g.futuresHistoryTab,"onUpdate:futuresHistoryTab":l[14]||(l[14]=t=>g.futuresHistoryTab=t),symbol:p.botDetail.symbol,contractPerStep:p.botDetail.detail.contractPerStep,baseCurrency:m.baseCurrency,quoteCurrency:m.quoteCurrency,lastPrice:t.lastPrice,orderHistory:g.botOrderHistory,openOrderList:m.botOpenOrderList,isRunning:m.isRunning,priceFilter:m.priceFilter,sizeFilter:m.sizeFilter,botDetail:p.botDetail.detail,gridModificationList:g.gridModificationList,isPositionHeldStatus:m.isPositionHeldStatus,direction:p.botDetail.direction,botId:t.$route.params.botId,onTabChange:m.handleTabChange,onLoadMoreHistory:m.handleLoadMoreHistory,onLoadMoreGridModifications:m.handleLoadMoreGridModifications},null,8,["futuresHistoryTab","symbol","contractPerStep","baseCurrency","quoteCurrency","lastPrice","orderHistory","openOrderList","isRunning","priceFilter","sizeFilter","botDetail","gridModificationList","isPositionHeldStatus","direction","botId","onTabChange","onLoadMoreHistory","onLoadMoreGridModifications"])])),_:1})}],["__scopeId","data-v-d34f91d3"]]),Dn=Object.freeze(Object.defineProperty({__proto__:null,default:$n},Symbol.toStringTag,{value:"Module"})),Tn={class:"tabs-wrap"},kn=["onClick"];const In=re({name:"TradingBotTabSwitcher",props:{modelValue:{type:[String,Number],required:!0},list:{type:Array,required:!0}},emits:["update:modelValue"]},[["render",function(t,e,o,s,r,l){return a(),i("div",Tn,[(a(!0),i(p,null,g(o.list,(e=>(a(),i("div",{key:e.value,class:u(["tab",{active:o.modelValue===e.value}]),onClick:i=>t.$emit("update:modelValue",e.value)},n(e.label),11,kn)))),128))])}],["__scopeId","data-v-af5adddf"]]);const On=re({name:"TradingBotHistoryHeaderRow",components:{Tooltip:q},props:{headerList:{type:Array,default:()=>[]}}},[["render",function(t,o,s,l,d,c){const m=e("Tooltip"),f=e("Cell"),y=e("HeaderRow",!0);return a(),h(y,null,{default:b((()=>[(a(!0),i(p,null,g(s.headerList,(t=>(a(),h(f,{key:t.id,textAlign:t.textAlign,class:u(t.class)},{default:b((()=>[t.tooltip?(a(),h(m,{key:0,tooltip:t.tooltip},{content:b((()=>[r(n(t.lang),1)])),_:2},1032,["tooltip"])):(a(),i(p,{key:1},[r(n(t.lang),1)],64))])),_:2},1032,["textAlign","class"])))),128))])),_:1})}],["__scopeId","data-v-1166f4c6"]]),{enableSpotDcaBot:Bn,enableFuturesTradingBot:wn,enableEarn:Rn}=et,An={class:"trading-bot-history"},Ln={class:"title-row"};const Mn=re({name:"TradingBotHistory",components:{BackRow:Le,TabSwitcher:In,HeaderRow:On,SpotDcaListRow:se,FuturesGridListRow:oe,Pagination:Mt,SharePnlDialog:le,TableWithActionsPanel:ae,BotActionsPanel:ie},data(){var t;return{currentTab:(null==(t=history.state)?void 0:t.tradingBotType)||ot.SPOT_DCA,botHistoryList:[],pagination:{currentPage:1,pageSize:15,totalPages:1,totalRows:0},intervalId:null,showShareDialog:!1,shareInfo:{},currentHoverRow:""}}
1,computed:{tabList(){const t=[];return wn&&t.push({value:ot.FUTURES_GRID,label:this.$t("trading.bot.futures.grid")}),Bn&&t.push({value:ot.SPOT_DCA,label:this.$t("trading.bot.spot.dca")}),t},isSpotDca(){return this.currentTab===ot.SPOT_DCA},listRowComponent(){switch(this.currentTab){case ot.SPOT_DCA:return se;case ot.FUTURES_GRID:return oe;default:return null}},headerList(){return this.isSpotDca?this.spotDcaHeaderList:this.futuresGridHeaderList},filterParams(){return this.isSpotDca?{marketType:"SPOT",botType:_t.DCA}:{marketType:"FUTURES",botType:_t.GRID}},spotDcaHeaderList(){return[{id:"frontBar",textAlign:"left",class:"front-bar-header-cell"},{id:"symbol",lang:this.$t("futuresMain.symbol"),textAlign:"left"},{id:"cycle",lang:this.$t("t.cycle"),textAlign:"left"},{id:"executedInvestment",lang:this.$t("trading.bot.executedInvestment"),textAlign:"right"},{id:"executedTimes",lang:this.$t("trading.bot.executedTimes"),textAlign:"right"},{id:"unrealizedPNL",lang:this.$t("futuresMain.marginBalanace.unrealizedPNL"),textAlign:"right"},{id:"duration",lang:this.$t("t.duration"),textAlign:"left"},{id:"timeClosed",lang:this.$t("t.timeClosed"),textAlign:"left"},{id:"subscribeEarn",lang:this.$t("trading.bot.dca.subscribeEarn"),textAlign:"left",isDisabled:!Rn},{id:"status",lang:this.$t("t.status"),textAlign:"left"},{id:"reason",lang:this.$t("t.reason"),textAlign:"left"}].filter((t=>!t.isDisabled))},futuresGridHeaderList(){return[{id:"frontBar",textAlign:"left",class:"front-bar-header-cell"},{id:"symbol",lang:this.$t("futuresMain.symbol"),textAlign:"left"},{id:"initialMargin",lang:this.$t("futuresMain.changeRiskLimit.initialMargin"),textAlign:"left"},{id:"totalPnL",lang:this.$t("trading.bot.grid.totalPnl"),textAlign:"left",tooltip:this.$t("trading.bot.tooltip.totalPnl")},{id:"priceRange",lang:this.$t("strategy.priceRange"),textAlign:"left"},{id:"noOfGrids",lang:this.$t("trading.bot.noOfGrids"),textAlign:"left"},{id:"qtyOrder",lang:this.$t("trading.bot.grid.qtyOrder"),textAlign:"left"},{id:"tpsl",lang:this.$t("t.tpsl"),textAlign:"left"},{id:"trailingStop",lang:this.$t("futuresMain.trade.trailingStop"),textAlign:"left"},{id:"timeClosed",lang:this.$t("t.timeClosed"),textAlign:"left"},{id:"duration",lang:this.$t("t.duration"),textAlign:"left"},{id:"status",lang:this.$t("t.status"),textAlign:"left"},{id:"reason",lang:this.$t("t.reason"),textAlign:"left"}]}},watch:{currentTab:{handler(){this.startIntervalFetch()},immediate:!0}},created(){const{query:{tab:t}}=this.$route;Object.values(ot).includes(t)&&(this.currentTab=t)},beforeUnmount(){clearInterval(this.intervalId)},errorCaptured:(t,e,i)=>(we(t),!1),methods:{startIntervalFetch(){this.intervalId&&clearInterval(this.intervalId),this.intervalId=setInterval((()=>{this.fetchData()}),1e4),this.fetchData()},async fetchData(){try{const{data:t}=await Y.getTradingBotHistory({page:this.pagination.currentPage,pageSize:this.pagination.pageSize,...this.filterParams,hideCode:!0}),{tradingBots:e,currentPage:i,pageSize:a,totalPages:o,totalRows:s}=t;this.botHistoryList=e,this.pagination={currentPage:i,pageSize:a,totalPages:o,totalRows:s}}catch(t){this.botHistoryList=[]}},handleClickShare(t){this.shareInfo=this.isSpotDca?this.getSpotDcaShareInfo(t):this.getFuturesGridShareInfo(t),this.showShareDialog=!0},getSpotDcaShareInfo(t){const{symbol:e,quoteCurrency:i,direction:a,detail:{totalInvestment:o,totalIncome:s},totalRoi:r}=t,n=de({isLong:"LONG"===a,totalInvestment:o,totalIncome:s});return{...t,percentage:r,symbolText:`${e}-${i}`,averageEntryPrice:n}},getFuturesGridShareInfo(t){const{totalRoi:e,detail:{initialLeverage:i}}=t;return{...t,leverage:i,percentage:e}},handlePageChange(t){this.pagination.currentPage=t,this.fetchData()},setCurrentHoverRow(t){this.currentHoverRow=t}}},[["render",function(t,r,l,c,m,f){const y=e("BackRow"),v=e("TabSwitcher"),P=e("HeaderRow"),C=e("DataTable"),S=e("BotActionsPanel"),$=e("Pagination"),D=e("SharePnlDialog");return a(),i("div",An,[s(y),o("div",Ln,n(t.$t("trading.bot.history")),1),s(v,{modelValue:m.currentTab,"onUpdate:modelValue":r[0]||(r[0]=t=>m.currentTab=t),class:"tab-switcher",list:f.tabList},null,8,["modelValue","list"]),(a(),h(M(f.isSpotDca?"div":"TableWithActionsPanel"),{class:u({"table-wrap":f.isSpotDca}),style:{"--bot-panel-night-bg-color":"var(--app--theme-trading-form-button-bg)"}},L({default:b((()=>[s(C,{class:u(f.isSpotDca?"history-table":"")},{header:b((()=>[s(P,{headerList:f.headerList},null,8,["headerList"])])),body:b((()=>[(a(!0),i(p,null,g(m.botHistoryList,((t,e)=>(a(),h(M(f.listRowComponent),{key:t.tradingBotId,data:t,index:e,isHistory:"",onMouseover:e=>f.setCurrentHoverRow(t.tradingBotId),onMouseleave:r[1]||(r[1]=t=>f.setCurrentHoverRow("")),onClickShareBot:f.handleClickShare},null,40,["data","index","onMouseover","onClickShareBot"])))),128))])),_:1},8,["class"])])),_:2},[f.isSpotDca?void 0:{name:"actions",fn:b((()=>[s(S,{dataList:m.botHistoryList,currentHoverRow:m.currentHoverRow,isHistory:!0,onClickShareBot:f.handleClickShare},null,8,["dataList","currentHoverRow","onClickShareBot"])])),key:"0"}]),1032,["class"])),s($,{class:"pagination",layout:"prev, pager, next, jumper",background:!1,currentPage:m.pagination.currentPage,pageSize:m.pagination.pageSize,totalPages:m.pagination.totalPages,total:m.pagination.totalRows,pagerCount:5,onHandleCurrentChangeP:f.handlePageChange},null,8,["currentPage","pageSize","totalPages","total","onHandleCurrentChangeP"]),m.showShareDialog?(a(),h(D,{key:0,show:m.showShareDialog,"onUpdate:show":r[2]||(r[2]=t=>m.showShareDialog=t),position:m.shareInfo,isBotSharing:""},null,8,["show","position"])):d("",!0)])}],["__scopeId","data-v-13750442"]]),_n=Object.freeze(Object.defineProperty({__proto__:null,default:Mn},Symbol.toStringTag,{value:"Module"})),Hn=xt("videos/trading-bot/promotion.mp4"),xn=xt("videos/trading-bot/tutorial.mp4"),En={PROMOTION:"PROMOTION",TUTORIAL:"TUTORIAL"},Nn={name:"LandingPage",components:{IconChevronRight:Ht},data:()=>({promotionVideoUrl:Hn,tutorialVideoUrl:xn,VideoType:En,imgShine:"/static/img/DFw97vRK.png",imgBlockchain:"/static/img/Dui_4ZXU.png",imgBitcoins:"/static/img/BbX8miHl.png"}),computed:{...t(["lang"]),whyUseList(){return[{id:"easy2use",img:"/static/img/ZozuY_Kp.png",title:this.$t("trading.bot.landingPage.whyUse.easyToUse.title"),desc:this.$t("trading.bot.landingPage.whyUse.easyToUse.desc")},{id:"riskfree",img:"/static/img/CsHdVQuo.png",title:this.$t("trading.bot.landingPage.whyUse.riskfree.title"),desc:this.$t("trading.bot.landingPage.whyUse.riskfree.desc")},{id:"rapid",img:"/static/img/B2zB-c1r.png",title:this.$t("trading.bot.landingPage.whyUse.rapid.title"),desc:this.$t("trading.bot.landingPage.whyUse.rapid.desc")}
1,{id:"tech",img:"/static/img/DGvw-zxv.png",title:this.$t("trading.bot.landingPage.whyUse.tech.title"),desc:this.$t("trading.bot.landingPage.whyUse.tech.desc")},{id:"callcenter",img:"/static/img/COV8hh-7.png",title:this.$t("trading.bot.landingPage.whyUse.callcenter.title"),desc:this.$t("trading.bot.landingPage.whyUse.callcenter.desc")}]},strategies(){return[{id:"quickStartBot",title:this.$t("trading.bot.landingPage.strategies.quickStartBot.title"),desc:this.$t("trading.bot.landingPage.strategies.quickStartBot.desc"),url:"https://docs.tradingboteco.com/quick-start-bots"},{id:"dcaBot",title:this.$t("trading.bot.landingPage.strategies.dcaBot.title"),desc:this.$t("trading.bot.landingPage.strategies.dcaBot.desc"),url:"https://docs.tradingboteco.com/bot-settings/dca-bots"},{id:"gridBot",title:this.$t("trading.bot.landingPage.strategies.gridBot.title"),desc:this.$t("trading.bot.landingPage.strategies.gridBot.desc"),url:"https://docs.tradingboteco.com/bot-settings/grid-bot"},{id:"otherBots",title:this.$t("trading.bot.landingPage.strategies.otherBots.title"),desc:this.$t("trading.bot.landingPage.strategies.otherBots.desc"),url:"https://docs.tradingboteco.com/"}]}},methods:{goToTradingBot(){this.$router.push({name:at.TRADING_BOT,params:{lang:this.lang}})},handleClick(t){let e=t===En.PROMOTION?this.$refs.promotionVideo:this.$refs.tutorialVideo;e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}}},Fn={class:"trading-bot-landing-page"},zn={class:"masthead"},Un={class:"text-wrap"},Gn={class:"title"},qn={class:"desc"},Kn={class:"video-wrap"},jn={class:"promotion-video-container"},Vn=["src"],Wn=["src"],Yn={class:"why-use"},Qn={class:"title"},Xn={class:"cards-wrap"},Zn=["src"],Jn={class:"card-title"},tl={class:"card-desc"},el=["src"],il=["src"],al={class:"strategies"},ol={class:"title"},sl={class:"subtitle"},rl={class:"cards-wrap"},nl={class:"card-text"},ll={class:"card-title"},dl={class:"card-desc"},cl={class:"card-actions"},ul=["href"],pl={class:"try-our-bots"},gl={class:"title"},hl={class:"how-to-set-up"},bl={class:"title"},ml=["src"];const fl=re(Nn,[["render",function(t,l,d,c,u,h){const m=e("BaseButton"),f=e("IconChevronRight");return a(),i("div",Fn,[o("section",zn,[o("div",Un,[o("span",Gn,n(t.$t("trading.bot.landingPage.masthead.title")),1),o("p",qn,n(t.$t("trading.bot.landingPage.masthead.desc")),1),s(m,{class:"button green",size:"large",onClick:h.goToTradingBot},{default:b((()=>[r(n(t.$t("trading.bot.landingPage.masthead.button")),1)])),_:1},8,["onClick"])]),o("div",Kn,[o("div",jn,[o("video",{ref:"promotionVideo",class:"promotion-video",controls:"",onClick:l[0]||(l[0]=t=>h.handleClick(u.VideoType.PROMOTION))},[o("source",{src:u.promotionVideoUrl,type:"video/mp4"},null,8,Vn),l[2]||(l[2]=r(" Your browser does not support the video tag. "))],512)]),o("img",{class:"img-shine",src:u.imgShine},null,8,Wn)])]),o("section",Yn,[o("span",Qn,n(t.$t("trading.bot.landingPage.whyUse.title")),1),o("div",Xn,[(a(!0),i(p,null,g(h.whyUseList,(t=>(a(),i("div",{key:t.id,class:"card"},[o("img",{class:"card-img",src:t.img},null,8,Zn),o("span",Jn,n(t.title),1),o("p",tl,n(t.desc),1)])))),128))]),o("img",{class:"img-blockchain",src:u.imgBlockchain},null,8,el),o("img",{class:"img-bitcoins",src:u.imgBitcoins},null,8,il)]),o("section",al,[o("span",ol,n(t.$t("trading.bot.landingPage.strategies.title")),1),o("p",sl,n(t.$t("trading.bot.landingPage.strategies.subtitle")),1),o("div",rl,[(a(!0),i(p,null,g(h.strategies,(e=>(a(),i("div",{key:e.id,class:"card"}
1,[o("div",nl,[o("span",ll,n(e.title),1),o("p",dl,n(e.desc),1)]),o("div",cl,[o("a",{class:"learn-more",target:"_blank",href:e.url},[r(n(t.$t("t.learnMore"))+" ",1),s(f,{class:"chevron-right"})],8,ul)])])))),128))])]),o("section",pl,[o("span",gl,n(t.$t("trading.bot.landingPage.tryOurBots.title")),1),s(m,{class:"button green",size:"large",onClick:h.goToTradingBot},{default:b((()=>[r(n(t.$t("trading.bot.landingPage.tryOurBots.button")),1)])),_:1},8,["onClick"])]),o("section",hl,[o("span",bl,n(t.$t("trading.bot.landingPage.howToSetup.title")),1),o("video",{ref:"tutorialVideo",class:"tutorial-video",src:u.tutorialVideoUrl,controls:"",onClick:l[1]||(l[1]=t=>h.handleClick(u.VideoType.TUTORIAL))},null,8,ml)])])}],["__scopeId","data-v-8012a4cc"]]),yl=Object.freeze(Object.defineProperty({__proto__:null,default:fl},Symbol.toStringTag,{value:"Module"}));export{Ta as D,_n as H,yl as L,Dn as a}; 2//# sourceMappingURL=DATXytxh.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.