1"use strict";(self.webpackChunkFinalytics=self.webpackChunkFinalytics||[]).push([["default-src_app_trading_tradingShared_tradingShared_service_ts"],{6345:(W,B,u)=>{u.d(B,{F:()=>Y});var i=u(8022),U=u(6371),t=u(1705),M=u(8407),g=u(5607),s=u(9473),r=u(2282),y=u(8732),Q=u(4381),V=u(2741),w=u(1767);let Y=(()=>{class k{constructor(e,a,h,S){this.httpService=e,this.logService=a,this.pubsubService=h,this.awsappsync=S,this.edisPostProcessing=!1,this.dicColumnTemplatesDetails=new t.aM,this.dicProfileScripsResp=new t.aM,this.arrLTPPriceBandMaster=[]}getScripDetails(e,a,h=!0,S="",T){return i.y.create(o=>{var C={UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",MktSegId:h?e:M.X.GetMappedMarketSegmentId(e),ScripTkn:a,PageSource:null==S||""==S?"T":S,Symbol:T};this.httpService.postData(t.xB.AnalyticUrl,"GetScripDetails",C).subscribe(D=>{var n=new g.u;if(D.ResponseStatus&&D.ResponseObject.length>0){var c=D.ResponseObject[0];n.ScripDet.MktSegId=M.X.GetMarketSegmentID(parseInt(c.nMarketSegmentId)),n.ScripDet.Token=c.nToken,n.AssetToken=c.nAssetToken,n.Symbol=c.sSymbol,n.Series=c.sSeries,n.DecimalLocator=c.DecimalLocator,n.InstrumentName=c.sInstrumentName,n.ExchangeName=M.X.GetExchangeName(n.ScripDet.MktSegId),n.ExpiryDate=c.nExpiryDate1,n.OptionType=c.sOptionType,n.StrikePrice=c.nStrikePrice,n.PriceTick=c.nPriceTick,n.MWSecurityDesc=M.X.FormatScripDescForMW(n),n.IsGlobal=c.sGlobalNormalFlag,n.ISIN=c.sISINCode,n.SPOS=c.nSPOS,n.POS=c.nPOS,n.Spread=c.nSpread,n.FIILimit=c.nFIILimit,n.NRILimit=c.nNRILimit,n.MarketLot=c.nRegularLot,n.FIIFlag=c.nFIIFlag,n.MarginTypeIndicator=c.nMarginTypeIndicator,n.PriceNumerator=c.nPriceNum,n.PriceDenominator=c.nPriceDen,n.GenNumerator=c.nAVMBuyMargin,n.GenDenominator=c.nAVMSellMargin,n.IsAsset=c.nIsAsset,n.IntrinsicValue=c.nIntrinsicValue,n.IsIndex=c.nIsIndex,n.nExpiryMonth=c.nExpiryMonth,n.IsSpread=1==c.nSpread?1:0,n.SecurityDesc=c.sSecurityDesc,(c.nMarketSegmentId==t.gT.C_V_MAPPED_NSE_CASH||c.nMarketSegmentId==t.gT.C_V_MAPPED_BSE_CASH)&&(n.IsSIP=c.nIsSIP),n.nScripInstrument=c.nScripInstrument,n.sSurvMeasureDescription=c.sSurvMeasureDescription}o.next(n),o.complete()})})}getProfileScrips(e,a,h,S,T,o){if("300"==e){var c="COMBINED$";if(t.xB.User.ExchangeAllowedVal.length>0)for(var l=t.xB.User.ExchangeAllowedVal.split("$"),E=0;E<l.length;E++)c=c+M.X.GetExchangeName(parseInt(l[E]))+"$";var I={UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",ProfId:e,ProfNm:a,ColProfId:h,ExchAllowed:c};return i.y.create(_=>{this.httpService.postData(t.xB.netNetAPIUrl,"GetMyHoldingScript",I).subscribe(N=>{this.dicProfileScripsResp.add(e,N),_.next(N),_.complete()})})}if(S){var C={UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",ProfId:e,ProfNm:a,ColProfId:h.toString(),Sector:a,MktSegId:T,Top50:o.id};return i.y.create(_=>{this.httpService.postData(t.xB.AnalyticUrl,"GetIndexScrips",C).subscribe(N=>{_.next(N),_.complete()})})}if(t.xB.dConfigMaster.FINALYTICS_PROFILE_DATA==t.gT.C_S_FINALYTICS_PROFILE_DATA_DATABASE){var D={UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",ProfId:e,ProfNm:a,ColProfId:h.toString()};return i.y.create(_=>{this.httpService.postData(t.xB.tradingAPIUrl,"GetProfileScrips",D).subscribe(N=>{this.dicProfileScripsResp.add(e,N),_.next(N),_.complete()})})}if(t.xB.dConfigMaster.FINALYTICS_PROFILE_DATA==t.gT.C_S_FINALYTICS_PROFILE_DATA_AWSAPPSYNC)return i.y.create(_=>{this.awsappsync.getWatchListScrips(e).then(N=>{N.length>0?this.httpService.postData(t.xB.tradingAPIUrl,"GetAPPSYNCProfileScrips",{UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",ProfId:e,ProfNm:a,AWSAPPSYNCScrip:N}).subscribe(P=>{this.dicProfileScripsResp.add(e,P),_.next(P),_.complete()}):(_.next({ResponseStatus:!1,ResponseObject:[],ResponseCode:1,ErrorMessages:t.gT.C_S_NOOFRECORDS_MSG}),_.complete())})})}parseProfileScrips(e,a){let h=[],S=[];for(var T=t.xB.ExchManager.ExchangeAllowed,o=0,C=e.length;o<C;o++){var D=new r.A;D.MktSegId=parseInt(e[o].mktSegId);var n=D.MapMktSegId;switch(n){case t.gT.C_V_MAPPED_MCX_SPOT:n=t.gT.C_V_MAPPED_MCX_DERIVATIVES;break;case t.gT.C_V_MAPPED_NCDEX_SPOT:n=t.gT.C_V_MAPPED_NCDEX_DERIVATIVES;break;case t.gT.C_V_MAPPED_NSEL_SPOT:n=t.gT.C_V_MAPPED_NSEL_DERIVATIVES;break;case t.gT.C_V_MAPPED_MSX_SPOT:n=t.gT.C_V_MAPPED_MSX_DERIVATIVES;break;case t.gT.C_V_MAPPED_NSX_SPOT:n=t.gT.C_V_MAPPED_NSX_DERIVATIVES;break;case t.gT.C_V_MAPPED_NSECOMM_SPOT:n=t.gT.C_V_MAPPED_NSECOMM_DERIVATIVES;break;case t.gT.C_V_MAPPED_DGCX_SPOT:n=t.gT.C_V_MAPPED_DGCX_DERIVATIVES;break;case t.gT.C_V_MAPPED_BFX_SPOT:n=t.gT.C_V_MAPPED_BFX_DERIVATIVES;break;case t.gT.C_V_MAPPED_BSECDX_SPOT:n=t.gT.C_V_MAPPED_BSECDX_DERIVATIVES;break;case t.gT.C_V_MAPPED_BSECOMM_SPOT:n=t.gT.C_V_MAPPED_BSECOMM_DERIVATIVES}var c=M.X.GetMarketSegmentID(n);if(T.containsKey(c))if(T[c]==t.gT.C_S_ON){var l=new y.N;l.ScripDetail=new g.u,a&&(l.PPWData=new s.V),D.Token=e[o].scripToken,l.ScripDetail.Token=e[o].scripToken,l.ScripDetail.AssetToken=e[o].assetToken,l.ScripDetail.ScripDet=D,S.push(D),l.ScripDetail.ExchangeName=D.MktSegId.toString(),l.ScripDetail.Symbol=e[o].symbol,l.ScripDetail.Series=e[o].series,l.ScripDetail.InstrumentName=e[o].instruName,l.ScripDetail.ExpiryDate=e[o].instruId==t.gT.C_S_INSTRUMENT_NCDEXCOMDTY_TEXT?"NA":e[o].expiryDate,l.ScripDetail.DecimalLocator="0"==e[o].decLoc?"100":e[o].decLoc.toString(),l.ScripDetail.StrikePrice=e[o].strikePrice,l.ScripDetail.OptionType=e[o].optionType,l.ScripDetail.MarketLot=e[o].marketLot,l.ScripDetail.PriceTick=e[o].priceTick,l.ScripDetail.ISIN=e[o].isinNo,l.ScripDetail.SPOS=e[o].sposFlag,l.ScripDetail.IsGlobal=e[o].globalScrip,l.ScripDetail.Spread=e[o].spread,l.ScripDetail.FIILimit=e[o].fiiLimit,l.ScripDetail.N
1RILimit=e[o].nriLimit,l.ScripDetail.POS=null==e[o].pos?e[o].pos:e[o].pos.toString(),l.ScripDetail.PriceNumerator=e[o].priceNum,l.ScripDetail.PriceDenominator=e[o].priceDen,l.ScripDetail.GenNumerator=e[o].genNum,l.ScripDetail.GenDenominator=e[o].genDen,l.ScripDetail.nExpiryMonth=e[o].ctrlType,l.ScripDetail.MWSecurityDesc=M.X.FormatScripDescForMW(l.ScripDetail),l.ScripDetail.MWSecurityDescShort=M.X.FormatScripDescForMW(l.ScripDetail),l.ScripDetail.IsSpread=1==e[o].spread?1:0,l.rowExpanded=!1,h.push(l)}else D=null;else D=null}return{tempMWList:h,scripKey:S}}saveProfile(e,a,h,S,T,o="",C=[]){if(t.xB.dConfigMaster.FINALYTICS_PROFILE_DATA==t.gT.C_S_FINALYTICS_PROFILE_DATA_DATABASE){var D={UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",ProfId:e,ProfNm:a,MktDet:h};return i.y.create(n=>{this.httpService.postData(t.xB.tradingAPIUrl,"SaveMarketWatchProfile",D).subscribe(c=>{this.dicProfileScripsResp.remove(e),n.next(c),n.complete()})})}if(t.xB.dConfigMaster.FINALYTICS_PROFILE_DATA==t.gT.C_S_FINALYTICS_PROFILE_DATA_AWSAPPSYNC){if("-1"==e){let n={nWatchListId:e=Math.floor(2147483547*Math.random()+101),sWatchListName:a,bIsPrivate:!0,bIsDefault:!1};return i.y.create(c=>{this.awsappsync.saveWatchListProfile(n).then(l=>{e=l.ResponseObject.watchListId?l.ResponseObject.watchListId:e;let E=[];for(let I=0;I<h.length;I++){const _=h[I];E.push({nWatchListId:e,sWatchlistName:l.ResponseObject.watchlistName,nMarketSegmentId:_.MapMktSegId,nToken:_.Token,nSequenceNo:I+1})}this.dicProfileScripsResp.remove(e),this.awsappsync.saveWatchListProfileScrips(E,E),c.next(l),c.complete()})})}{let n={nWatchListId:e,sWatchListName:a,bIsPrivate:!0,bIsDefault:!1,sCreatedBy:t.xB.User.APPSyncID,nTenantId:t.xB.dConfigMaster.TENANTID};return i.y.create(c=>{let l=[];for(let E=0;E<h.length;E++){const I=h[E];l.push({nWatchListId:e,sWatchlistName:a,nMarketSegmentId:parseInt(I.MapMktSegId),nToken:parseInt(I.Token),nSequenceNo:E+1})}this.awsappsync.updateWatchListProfileScrips(n,l,o,C).then(E=>{this.dicProfileScripsResp.remove(e),c.next(E),c.complete()})})}}}sendBest5Request(e,a){try{var h={Scrip:new g.u,OperationType:1,ByPassRequestStore:!0};h.Scrip=e,h.OperationType=a,this.pubsubService.publish("B5REQ",h)}catch(S){this.logService.WriteLog("Exception: "+S.message,"sendBest5Request()","tradingShared.service.ts","")}}sendTouchLineRequest(e,a){try{if(null!=e&&e.length>0){var h=new Q.U;h.OperationType=a;for(var S=[],T=e.length;T--;)S[T]={},S[T].IsGlobal=e[T].IsGlobal,S[T].Token=e[T].Token,S[T].MapMktSegId=e[T].MapMktSegId,S[T].MktSegId=e[T].MktSegId;h.ScripList=S,this.pubsubService.publish("MTLREQ",h)}}catch(o){this.logService.WriteLog("Exception: "+o.message,"sendTouchLineRequest()","tradingShared.service.ts","")}}createAndSendMultiTouchLineRequest(e,a,h){try{var S=[],T=new r.A;T.MktSegId=e,T.Token=a,T.MTM=0,S.push(T),this.sendTouchLineRequest(S,h)}catch(o){this.logService.WriteLog("Exception: "+o.message,"createAndSendMultiTouchLineRequest","tradingShared.service.ts","")}}getInteropConfiguration(){try{return 0===t.xB.objInteropSetting.arrInteropConfig.length?i.y.create(e=>{this.httpService.postData(t.xB.tradingAPIUrl,"InteropSettings",{UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:""}).subscribe(h=>{this.setInteropConfiguration(h),e.next(t.xB.objInteropSetting),e.complete()},h=>{e.next(!1),e.complete()})}):(0,U.of)(t.xB.objInteropSetting)}catch(e){this.logService.WriteLog("Exception: "+e.message,"getInteropConfiguration()","tradingShared.service.ts","")}}setInteropConfiguration(e){try{1==e.ResponseStatus&&null!=e.ResponseObject&&(t.xB.objInteropSetting.arrInteropConfig=[],e.ResponseObject.forEach(h=>{-1!=h.nInteropPreferredCCL&&t.xB.objInteropSetting.arrInteropConfig.push({nCombinedSegmentId:h.nCombinedSegmentId,nInteropPreferredCCL:h.nInteropPreferredCCL,nPreferredExchangeforBroadcast:h.nPreferredExchangeforBroadcast,nPreferredExchangeforSquareOff:h.nPreferredExchangeforSquareOff,sdisplayText:M.X.GetExchangeName(parseInt(h.nCombinedSegmentId)),value:h.nCombinedSegmentId==t.gT.C_V_COMBINED_CASH?2:h.nCombinedSegmentId==t.gT.C_V_COMBINED_FNO?3:4})}),t.xB.objInteropSetting.arrInteropConfig.length>
10&&(t.xB.objInteropSetting.arrInteropConfig.unshift({nCombinedSegmentId:-1,nInteropPreferredCCL:-1,nPreferredExchangeforBroadcast:-1,nPreferredExchangeforSquareOff:-1,sdisplayText:t.gT.C_S_ALL_COMBINED,value:1}),t.xB.objInteropSetting.arrInteropConfig.unshift({nCombinedSegmentId:-1,nInteropPreferredCCL:-1,nPreferredExchangeforBroadcast:-1,nPreferredExchangeforSquareOff:-1,sdisplayText:t.gT.C_S_ALL_TEXT,value:0}),t.xB.objInteropSetting.isInteropAllowed=!0))}catch(a){this.logService.WriteLog("Exception: "+a.message,"setInteropConfiguration()","tradingShared.service.ts","")}}getNewsDetails(e){try{var a;return i.y.create(h=>{null!=e&&null!=e&&this.httpService.getCMOTSData("Market.svc/newsdetails/"+e).subscribe(S=>{a=this.setNewsDetails(S),h.next(a),h.complete()},S=>{h.next(!1),h.complete()})})}catch(h){this.logService.WriteLog("Exception: "+h.message,"getNewsDetails()","tradingShared.service.ts","")}}setNewsDetails(e){try{var a,h;if("error"!=e.response.type){if(null!=(h=e.response.data.news)&&null!=h){var S=new Date(h.date).format("dd-mmm-yyyy",null);a={ResponseStatus:!0,cmotsCode:h.co_code,date:S+" ",time:h.time,caption:h.heading+". "+(null!=h.caption?h.caption:""),heading:h.heading,description:h.arttext}}}else"error"==e.response.type&&(a={ResponseStatus:!1,Error:e.response.error.message})}catch(T){this.logService.WriteLog("Exception: "+T.message,"setNewsDetails()","tradingShared.service.ts","")}return a}saveEDISRecords(e,a){return new Promise((h,S)=>{this.httpService.postData(t.xB.tradingAPIUrl,"SaveEDISRecord",{UserID:t.xB.User.UserId,UserCode:t.xB.User.UserCode,GroupCode:t.xB.User.GroupCode,DealerCode:t.xB.User.UserCode,GroupID:t.xB.User.GroupId,OTP:e,EDISRecords:a}).subscribe(o=>{h(o)},o=>{S(o)})})}FetchEDISQuantityDetails(e,a,h){return null==h&&(h=t.gT.C_S_PRODUCTTYPE_DELIVERY_VALUE),new Promise((S,T)=>{this.httpService.postData(t.xB.tradingAPIUrl,"FetchEDISQuantityDetails",{UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,MktSegId:e,Token:a,ProductType:h}).subscribe(C=>{S(C)},C=>{T(C)})})}GetProductTypeForEDIS(e){let a;return e==t.gT.C_S_PRODUCTTYPE_DELIVERY_TEXT||e==t.gT.C_S_PRODUCTTYPE_AMO_DELIVERY_TEXT?a=t.gT.C_S_PRODUCTTYPE_DELIVERY_VALUE:e==t.gT.C_S_PRODUCTTYPE_MTF_TEXT&&(a=t.gT.C_S_PRODUCTTYPE_MTF_VALUE),a}GoForEDISOnline(e,a=[],h=!1){return new Promise((S,T)=>{try{if(e.eDISMode==t.gT.C_S_EDIS_MODE_ONLINE){const _=e.scrip.instrument==t.gT.C_S_INSTRUMENT_EQUITIES_TEXT?"Equity":e.scrip.instrument,N=e.exchange;let P=t.xB.User.BeneficiaryId.substring(0,t.xB.User.BeneficiaryId.indexOf("#")),f=t.xB.User.BeneficiaryId.substring(t.xB.User.BeneficiaryId.indexOf("#")+1);var o=e.settlmtCycle;null==e.settlmtCycle&&a.forEach(m=>o=1==m.settlmtCycle?"T1":"T2");let d=t.xB.NetNetEDISUrl;if(t.xB.User.Depository==t.gT.C_S_EDIS_MODE_CDSL){if(P.length>6)P=P.substring(P.length-6);else if(P.length<6){var C;P=(C=C.padStart(6-P.length,"0")).concat(P)}f=t.xB.User.BeneficiaryId.replace(/[^\w\s]/gi,"")}var D="";if(e.eDISMode==t.gT.C_S_EDIS_MODE_ONLINE){var n="";a.forEach((m,R)=>{var F=1==m.settlmtCycle?"T1":"T2";n+=0==R?"":",",n+=`{ISIN:"${m.ISIN}",Quantity:${m.Quantity},ISINName:"${m.ISINName.replace("&","$")}",SettlmtCycle:"${F}"}`}),D="["+n+"]"}let O="";t.xB.User.Depository==t.gT.C_S_EDIS_MODE_NSDL&&(O=t.xB.User.UserId+"-"+(new Date).toString("ddMMyyHHmmss"));const p=null!=e.scrip.ProductType?e.scrip.ProductType:t.gT.C_S_PRODUCTTYPE_DELIVERY_VALUE;e.amo=""!=e.amo&&null!=e.amo&&null!=e.amo?e.amo:"N";var c=document.createElement("form"),l={depository:t.xB.User.Depository,userCode:t.xB.User.UserCode,userId:t.xB.User.UserId,groupId:t.xB.User.GroupId,managerIP:t.xB.User.ManagerIP,sessionID:t.xB.User.OCToken,channel:"WEB",isin:e.scrip.isin,isinName:e.scrip.securityDesc,exchangeCd:N,product:1,instrument:_,quantity:null==e.scrip.quantity?0:e.scrip.quantity,dpId:P,clientId:f,productcode:"ODINAERO",ScripDetails:D,ProductType:p,ReqId:O,amo:e.amo,SettlmtCycle:o,theme:"LIGHT"==t.xB.CurrentTheme.Id?"L":"D"};for(var E in c.setAttribute("name","edisForm"),c.setAttribute("method","post"),c.setAttribute("action",d),l)if(l.hasOwnProperty(E)){var I=document.createElement("input");I.type="hidden",I.name=E,I.value=l[E],c.appendChild(I)}let x=null;if(t.xB.User.Depository==t.gT.C_S_EDIS_MODE_NSDL&&""!=t.xB.dConfigMaster.EDIS_NSDL_MULTI_ISIN_SERVICE_URL.toString())c.setAttribute("target","iframeMultiISIN"),document.body.appendChild(c),document.forms.edisForm.submit(),x=document.getElementsByName("iframeMultiISIN")[0].contentWindow,document.forms.edisForm.remove();else if(x=window.open("","_blank","width=1000,height=800,location=no,toolbar=no,menubar=no,resizable=no"),x.document.body.appendChild(c),x.document.forms[0].submit(),x){this.edisPostProcessing=!1;const m=setInterval(()=>{x.closed&&(clearInterval(m),T("popup closed."))},1e3)}else T("popup not created.");window.addEventListener("message",m=>{if("EDISResp"==m.data.messageCode&&null!=x.parent){const R=JSON.parse(m.data.respdata);if("Success"==R.Status||t.xB.User.Depository==t.gT.C_S_EDIS_MODE_CDSL||t.xB.User.Depository==t.gT.C_S_EDIS_MODE_NSDL&&""!=t.xB.dConfigMaster.EDIS_NSDL_MULTI_ISIN_SERVICE_URL.toString())if(!R.ScripDetails||t.xB.User.Depository!=t.gT.C_S_EDIS_MODE_CDSL&&t.xB.User.Depository!=t.gT.C_S_EDIS_MODE_NSDL)"ERR047"==R.StatusCode||"Failure"==R.Status?T("User has pressed cancel button or Transaction Failed at "+t.xB.User.Depository):S({refTxnNo:R.RefNum,TotalAvailableQty:R.BlkQty}),x.close();else{const F=JSON.parse(R.ScripDetails);let L,X=!1,b="";a.forEach(v=>{const H=F.find(J=>J.ISIN==v.ISIN);H&&(v.Status=H.Status,v.Quantity=H.Qty,v.ISIN==e.scrip.isin&&(X="Success"==v.Status,b=H.RefNo,L=v))});const A=a.filter(v=>"Success"==v.Status);A.length>0?h?(S({status:!0,eDISRespDetails:A}),x.close()):(X?S({refTxnNo:b,ApprovedQuantity:L.Quantity,TotalAvailableQty:L.TotalFreeQty}):T("scrip transaction failed."),x.close()):(T("EDIS Transaction failed."),x.close())}else T("transaction failed -> NSDL"),x.close()}},{once:!0})}else S("")}catch(_){this.logService.WriteLog("tradingShared.service.ts","GoForEDISOnline()",_.message),T(_.message)}})}FetchColumnTemplateDetails(e,a=!1){return new Promise((h,S)=>{try{const T=e.TmpltColProfId,o="Y"==e.ResetUser;!a&&o&&this.dicColumnTemplatesDetails.containsKey(T)?h(this.dicColumnTemplatesDetails[T]):this.httpService.postData(t.xB.tradingAPIUrl,"GetColumnTemplateDetails",e).subscribe(C=>{o&&this.dicColumnTemplatesDetails.add(T,C),h(C)},C=>{S(C)})}catch(T){this.logService.WriteLog("tradingShared.service.ts","FetchColumnTemplateDetails()",T.message),S(T)}})}SubmitTradingOrder(e){return new Promise((a,h)=>{var S={status:!1,message:"An error occurred while placing order. Kindl
1y try after some time.",orderId:""};try{var l,E,I,T="",o=0,D="0",n="0",N="",f=!1;e.ProductType==t.gT.C_S_PRODUCTTYPE_BRACKET_VALUE?(T=t.gT.C_V_MSGCODES_BRACKETORDER_ORDER_REQUEST,o=e.LegIndicator):(T=t.gT.C_V_MSGCODES_ORDERENTRYMODIFYCANCEL_REQUEST,o=e.IsSpread?3:0),e.ModifyFlag&&e.ProductType==t.gT.C_S_PRODUCTTYPE_MP_VALUE&&(e.OrderSide=e.OrderSide===t.gT.C_S_ORDER_BUY_TEXT?t.gT.C_S_ORDER_SELL_TEXT:t.gT.C_S_ORDER_BUY_TEXT),(e.Validity==t.gT.C_V_ORDER_GTD||e.Validity==t.gT.C_V_ORDER_EOTODY)&&(D=e.MarketSegID==t.gT.C_V_BSE_CASH?"0":e.Days),(e.ModifyFlag||e.CancelFlag)&&(n=e.ExchangeOrderNo),l=e.Instrument==t.gT.C_S_INSTRUMENT_EQUITIES_TEXT?"":e.Instrument,E=e.StrikePrice.length>0?M.X.CalculateFinalPrice(e.StrikePrice,e.DecimalLocator).toString():"0",I=e.ModifyFlag||e.CancelFlag?e.OrderTime:"0",!e.ModifyFlag&&!e.CancelFlag||(N=e.GatewayOrderNo),""!=e.CancelFlag&&(f=!0);var G={MsgCode:T,UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,IsSpread:e.IsSpread,ModifyFlag:e.ModifyFlag,CancelFlag:f,IsSpreadScrip:o,OrderSide:e.OrderSide,MKtSegId:e.MarketSegID,ScripTkn:e.TokenNo,OrdType:e.OrderType,BuyOrSell:e.OrderSide==t.gT.C_S_ORDER_BUY_TEXT?t.gT.C_V_ORDER_BUY:t.gT.C_V_ORDER_SELL,OrgQty:e.Qty,DiscQty:e.DiscQty,OrdPrice:M.X.CalculateFinalPrice(e.Price,e.DecimalLocator),TrigPrice:M.X.CalculateFinalPrice(e.TriggerPrice,e.DecimalLocator),Validity:e.Validity,Days:e.Days,Instrument:e.Instrument,OrdGTD:D,ExchOrdNo:n,ProdType:e.ProductType,InstrumentId:l,Symbol:e.Symbol.toUpperCase(),Series:e.Series.toUpperCase(),ExpDt:e.ExpDate.toUpperCase(),StrkPrc:E,OptType:e.OptionType.toUpperCase(),MktLot:e.MarketLot,PrcTick:e.PriceTick,OrdTime:I,ParticipantId:e.ParticipantID,ClientOrdNo:e.ClientOrderNumber,GatewayOrdNo:N,MPExpVal:e.MPExpiryValue,MPStrkPrcVal:e.MPStrikePriceValue,MPBasePrice:M.X.CalculateFinalPrice(e.MPBasePrice,e.DecimalLocator),MPMFFlag:e.MPMFFlag,MPFirstLegPrice:M.X.CalculateFinalPrice(e.MPFirstLegPrice,e.DecimalLocator),BOSLOrderType:e.SLOrderType,SLOrderPrice:M.X.CalculateFinalPrice(e.SLOrderPrice,e.DecimalLocator),SLTriggerPrice:M.X.CalculateFinalPrice(e.SLTriggerPrice,e.DecimalLocator),ProfitOrderPrice:M.X.CalculateFinalPrice(e.ProfitOrderPrice,e.DecimalLocator),SLJumpPrice:M.X.CalculateFinalPrice(e.SLJumpPrice,e.DecimalLocator),LTPJumpPrice:M.X.CalculateFinalPrice(e.LTPJumpPrice,e.DecimalLocator),BracketOrderId:e.BracketOrderId,LegIndicator:e.LegIndicator,BOModifyTerms:e.BOModifyTerms,SPOSType:e.SPOSType,"FIILimit ":e.FIILimit,NRILimit:e.NRILimit,IsSOR:e.isSOR,DualLUT:e.DualLUT,SORId:e.SORID,MktProt:M.X.CalculateFinalProtPerc(e.ProtPerc),COL:e.COL,OFSMargin:e.SelMargin,RecoId:e.RecoId,ParticipantIDTag:e.ParticipantIDTag,LastTradedQty:e.LastTradedQty,BOGatewayOrderNo:e.BOGatewayOrderNo,EDISTxnRefNo:e.EDISTransactionRefNo};this.httpService.postData(t.xB.tradingAPIUrl,"ProcessCommRequest",G).subscribe(d=>{d&&(S.status=d.ResponseStatus,d.ResponseCode==t.gT.C_S_MSGCODE_LOGOFF_RESPONSE||d.ResponseCode==t.gT.C_V_MSGCODES_SSO_TOKEN_NOT_FOUND?S.message=t.xB.dMsgMaster.OCTR2:d.ResponseObject&&d.ResponseObject.objJSONData&&(S.message=d.ResponseObject.objJSONData.Status,S.orderId=d.ResponseObject.objJSONData.OrderId)),a(S)},d=>{this.logService.WriteLog("tradingShared.service.ts","SubmitTradingOrder http req failed",d),h(S)})}catch(d){this.logService.WriteLog("tradingShared.service.ts","SubmitTradingOrder catch",d.message),h(S)}})}removeProfileToReloadProfileScrip(e){this.dicProfileScripsResp.containsKey(e)&&this.dicProfileScripsResp.remove(e)}reloadProfileScrip(e,a){this.dicProfileScripsResp.containsKey(e)&&(this.dicProfileScripsResp.remove(e),this.dicProfileScripsResp.add(e,a))}loadLTPPriceBandMaster(){try{this.arrLTPPriceBandMaster&&0==this.arrLTPPriceBandMaster.length&&this.httpService.postData(t.xB.tradingAPIUrl,"FetchLTPPriceBandMaster",{UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId}).subscribe(a=>{a.ResponseStatus&&(this.arrLTPPriceBandMaster=a.ResponseObject)})}catch(e){this.logService.WriteLog("tradingShared.service.ts","loadLTPPriceBandMaster",e)}}validateLTPPriceBand(e,a,h,S,T,o,C,D,n,c,l,E,I=null){const _={valid:!0,isRestrictive:!1,errorMsg:""};try{let N=[t.gT.C_S_INSTRUMENT_FUTCOM_TEXT,t.gT.C_S_INSTRUMENT_FUTSTK_TEXT,t.gT.C_S_INSTRUMENT_FUTIRF_TEXT,t.gT.C_S_INSTRUMENT_FUTIRD_TEXT,t.gT.C_S_INSTRUMENT_FUTIRC_TEXT,t.gT.C_S_INSTRUMENT_FUTIRT_TEXT,t.gT.C_S_INSTRUMENT_FUTCUR_TEXT,t.gT.C_S_INSTRUMENT_OPTFUT_TEXT,t.gT.C_S_INSTRUMENT_FUTIDX_TEXT];n=parseFloat(n)*l,I=null!=I&&""!=I?parseFloat(I)*l:0;let P=C;if(e==t.gT.C_V_MCX_SPOT||e==t.gT.C_V_BSECOMM_SPOT||e==t.gT.C_V_NSECOMM_SPOT?(null==C||c<=0)&&(P=D):(P<=0&&3!=h||0==P&&3==h&&N.Contains(S)&&(null==C||c<=0))&&(P=D),P<=0&&3!=h&&e==t.gT.C_V_MCX_SPOT||e==t.gT.C_V_BSECOMM_SPOT||e==t.gT.C_V_NSECOMM_SPOT)return _;const f=t.xB.ExchManager.ReturnPrecisionForPrice(e,l.toString().length-1);P*=l;const G=S==t.gT.C_S_INSTRUMENT_EQUITIES_TEXT;if(this.arrLTPPriceBandMaster.length>0){let d=this.arrLTPPriceBandMaster.filter(O=>O.nMarketSegmentId==e&&(G||S.startsWith(O.sInstType)));d=d.find(O=>O.sSymbol==a)?d.filter(O=>O.sSymbol==a):d.filter(O=>0==O.nSymbolWise);for(let O=0;O<d.length;O++){const p=d[O];if(p.nLowerLTP<=P&&p.nHigherLTP>=P){const x=p.nAdditionalValidationFor.split(",");if(T==t.gT.C_S_ORDER_REGULARLOT_MARKET_TEXT&&x.includes("1")||T==t.gT.C_S_ORDER_STOPLOSS_MARKET_TEXT&&x.includes("1")||T==t.gT.C_S_ORDER_REGULARLOT_TEXT||T==t.gT.C_S_ORDER_STOPLOSS_TEXT){let m=0,R=0;1==p.nValidationType?o==t.gT.C_S_ORDER_BUY_TEXT?(m=P+p.nWorstPriceRange/100*P/100,R=P-p.nFavourablePriceRange/100*P/100):(m=P+P*(p.nFavourablePriceRange/100)/100,R=P-P*(p.nWorstPriceRange/100)/100):2==p.nValidationType&&(o==t.gT.C_S_ORDER_BUY_TEXT?(m=P+p.nWorstPriceRange,R=P-p.nFavourablePriceRange):(m=P+p.nFavourablePriceRange,R=P-p.nWorstPriceRange));const F=m,X=R;if((o==t.gT.C_S_ORDER_BUY_TEXT&&(n>F||0!=p.nFavourablePriceRange&&n<X)||o==t.gT.C_S_ORDER_SELL_TEXT&&(0!=p.nFavourablePriceRange&&n>F||n<X))&&(_.valid=!1,1==p.nAlertType?(_.isRestrictive=!1,_.errorMsg=n>F?t.xB.dMsgMaster.OE123.replace("{0}",(F/l).toFixed(f)):t.xB.dMsgMaster.OE124.replace("{0}",(X/l).toFixed(f))):(_.isRestrictive=!0,_.errorMsg=n>F?t.xB.dMsgMaster.OE125.replace("{0}",(F/l).toFixed(f)):t.xB.dMsgMaster.OE126.replace("{0}",(X/l).toFixed(f)))),x.includes("2")&&(E==t.gT.C_S_PRODUCTTYPE_MP_TEXT||E==t.gT.C_S_PRODUCTTYPE_BRACKET_ORDER_TXT)){let b=0,L=0;1==p.nValidationType?o==t.gT.C_S_ORDER_SELL_TEXT?(b=P+p.nWorstPriceRange/100*P/100,L=P-p.nFavourablePriceRange/100*P/100):(b=P+P*(p.nFavourablePriceRange/100)/100,L=P-P*(p.nWorstPriceRange/100)/100):2==p.nValidationType&&(o==t.gT.C_S_ORDER_SELL_TEXT?(b=P+p.nWorstPriceRange,L=P-p.nFavourablePriceRange):(b=P+p.nFavourablePriceRange,L=P-p.nWorstPriceRange));const A=b,v=L;(o==t.gT.C_S_ORDER_SELL_TEXT&&(I>A||0!=p.nFavourablePriceRange&&I<v)||o==t.gT.C_S_ORDER_BUY_TEXT&&(0!=p.nFavourablePriceRange&&I>A||I<v))&&(_.valid=!1,1==p.nAlertType?(_.isRestrictive=!1,_.errorMsg+=(""!=_.errorMsg?"<br />":"")+(I>A?"SL "+t.xB.dMsgMaster.OE123.replace("{0}",(A/l).toFixed(f)):"SL "+t.xB.dMsgMaster.OE124.replace("{0}",(v/l).toFixed(f)))):(_.isRestrictive=!0,_.errorMsg+=(""!=_.errorMsg?"<br />":"")+(I>A?"SL "+t.xB.dMsgMaster.OE125.replace("{0}",(A/l).toFixed(f)):"SL "+t.xB.dMsgMaster.OE126.replace("{0}",(v/l).toFixed(f)))))}break}}}}}catch(N){this.logService.WriteLog("tradingShared.service.ts","validateLTPPriceBand",N)}return _}getOrderCartInfo(e){return new Promise((a,h)=>{try{""!=e&&this.httpService.postData(t.xB.tradingAPIUrl,"getOrderCartInfo",{UserID:t.xB.User.
1UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",CartID:e}).subscribe(T=>{if(T.ResponseStatus){var C=T.ResponseObject;const D=[];for(let n=0;n<C.length;n++)D.push(this.setScripData(C[n].scripDetail));a(D)}})}catch(S){this.logService.WriteLog("tradingShared.service.ts","getOrderCartInfo",S),h()}})}setScripData(e){let a={};try{a.ExchangeName=e._ExchangeName?e._ExchangeName:M.X.GetExchangeName(e.scripDet._MktSegId),a._ExchangeName=a.ExchangeName,a.InstrumentName=e._InstrumentName,a.Symbol=e.symbol,a.Series=e._Series,a.ExpiryDate=e.ExpDate?e.ExpDate:"",a.StrikePrice=e.StrikePrice?e.StrikePrice:"",a.OptionType=e.OptionType?e.OptionType:"",a.MarketLot=e.MarketLot,a.PriceTick=e.PriceTick,a.DecimalLocator=e.DecimalLocator,a.ScripDet={MapMktSegId:e.scripDet._MapMktSegId,MktSegId:e.scripDet._MktSegId,Token:e.scripDet.token},a.OrderSide=e.TransactionType,a.Quantity=e.Quantity,a.Price=e.Price,a.ProductType=e.ProductType.toUpperCase(),a.OrderType=e.OrderType.replace("-"," "),a.MWSecurityDesc=e.SecurityDesc}catch(h){}return{scrip:a}}insertScripSurveillanceDetails(e,a){try{this.httpService.postData(t.xB.tradingAPIUrl,"InsertScripSurvDetails",{UserID:t.xB.User.UserId,GroupID:t.xB.User.GroupId,UCCClientID:"",UCCGroupID:"",ProductName:t.gT.C_S_PRODUCTNAME_ODINAERO,Action:1==e?"1":"0",ScripDetails:a}).subscribe(S=>{})}catch(S){this.logService.WriteLog("Exception: "+S.message,"insertScripSurveillanceDetails()","tradingShared.service.ts","")}}}return k.\u0275fac=function(e){return new(e||k)(V.\u0275\u0275inject(t.OE),V.\u0275\u0275inject(t.mQ),V.\u0275\u0275inject(t.hC),V.\u0275\u0275inject(w.Y))},k.\u0275prov=V.\u0275\u0275defineInjectable({token:k,factory:k.\u0275fac,providedIn:"root"}),k})()},4381:(W,B,u)=>{u.d(B,{U:()=>i});class i{constructor(){this.OperationType=0,this.ScripList=[],this.By
1passRequestStore=!1}}},8732:(W,B,u)=>{u.d(B,{N:()=>M});var i=u(1705),U=u(5607),t=u(8407);class M{constructor(){this.lstLTPHistory=[0,0,0,0,0],this.SymbolTrend="tc5 tkr_nochg scripname",this.ScripDetail=new U.u,this.PPWData=null,this.PercOpenInt="",this.OptionsChainData=null,this.LTPSparkLine=[],this.SVBUYVAl="NA",this.SVBODQT="NA",this.SVCURVAl="",this.News=i.gT.C_S_NEWS_NONEWS,this.AlertColor="AlertClass-gray",this.ScripNewsIndicatorColor=i.gT.C_S_NEWS_CSS_DEFAULT,this.ScripRecoIndicatorColor=i.gT.C_S_RECO_CSS_DEFAULT,this.intHistorySize=0,this.MarketSegmentId="",this.Token="",this.CorpAction=[],this.CAFetched=!1,this.FiftyTwoWeekLow="",this.FiftyTwoWeekHigh="",this.OneWeekHigh="",this.OneWeekLow="",this.OneMonthHigh="",this.OneMonthLow="",this.ThreeMonthsHigh="",this.ThreeMonthsLow="",this.SixMonthsHigh="",this.SixMonthsLow="",this.OneWeekPerChange="",this.OneMonthPerChange="",this.ThreeMonthsPerChange="",this.SixMonthsPerChange="",this.PerAbove52WeekLow="",this.PerBelow52WeekHigh="",this.YesterdayHigh="",this.YesterdayLow="",this.FiveDaysAverageVolume="",this.ThreeMonthsAverageVolume="",this.SixMonthsAverageVolume="",this.Premium="",this.Discount="",this.PrevDayOpen="",this.PrevDayClose="",this.PrevDayHigh="",this.PrevDayLow="",this.FiftyTwoWL="",this.FiftyTwoWH="",this.BuyPriceTrend="mwgridnochg taR fs9",this.PivotPointClass="pp-title",this.Support1="pp-s1",this.Support2="pp-s2",this.Support3="pp-s3",this.Support4="pp-s4",this.Resistance1="pp-r1",this.Resistance2="pp-r2",this.Resistance3="pp-r3",this.Resistance4="pp-r4",this.decOldPrcBuy="",this._BuyPrice="",this.decOldPrcSell="",this._SellPrice="",this.SellPriceTrend="mwgridnochg taR fs9",this.decOldPrcLTP="",this._LTP="",this.LTPTrend="mwgridnochg taR",this.BuyQtyTrend="mwgridnochg taR fs9",this._BuyQty="",this._SellQty="",this.SellQtyTrend="mwgridnochg taR fs9",this._LTQ="",this.LTQTrend="mwgridnochg taR fs9",this._Volume="",this._LTT="",this.LTTFormatted="",this.Value="",this._LUT="",this.LUTFormatted="",this.OpenPrice="",this.HighPrice="",this.LowPrice="",this.ClosePrice="",this.OpenInt="",this.PercNetChange="",this.ATP="",this.TotalBuyQty="",this.TotalSellQty="",this.DPR="",this._NetChangeInRs="",this.SelectedMWDataClass="ht03 odd mdetail",this.MWDataClass="fs9 taR",this.TER="",this.rowExpandTransitionState="hidden",this.rowExpandCSS="expand_icon",this.isFirstRsp=!0,this.isCheckSelected=!1,void 0!==i.xB.User.MarketWatchPerfDetails&&i.xB.User.MarketWatchPerfDetails.length>0&&i.xB.User.MarketWatchPerfDetails[0].nDisplaySparkLine&&(this.intHistorySize=i.xB.User.MarketWatchPerfDetails[0].nSparkLineValue)}get BuyPrice(){return this._BuyPrice}set BuyPrice(s){this._BuyPrice=s;var r=this._BuyPrice;r==this.decOldPrcBuy||""==this.decOldPrcBuy||""==r?this.BuyPriceTrend="mwgridnochg taR fs9":r>this.decOldPrcBuy?this.BuyPriceTrend="mwgridbuy taR fs9":r<this.decOldPrcBuy&&(this.BuyPriceTrend="mwgridsell taR fs9"),this.decOldPrcBuy=this._BuyPrice}get SellPrice(){return this._SellPrice}set SellPrice(s){this._SellPrice=s;var r=s;r==this.decOldPrcSell||""==this.decOldPrcSell||""==r?this.SellPriceTrend="mwgridnochg taR fs9":r>this.decOldPrcSell?this.SellPriceTrend="mwgridbuy taR fs9":r<this.decOldPrcSell&&(this.SellPriceTrend="mwgridsell taR fs9"),this.decOldPrcSell=this._SellPrice}get LTP(){return this._LTP}set LTP(s){this._LTP=s;var r=this._LTP;this._LTP<=0&&"0"==this.ScripDetail.Spread?this.lstLTPHistory=[]:r!=this.decOldPrcLTP&&this.fn_AddHistory(this.lstLTPHistory,r),this.LTPSparkLine=this.lstLTPHistory.slice(),r==this.decOldPrcLTP||""==this.decOldPrcLTP||""==r?this.LTPTrend="mwgridnochg taR":r>this.decOldPrcLTP?this.LTPTrend="mwgridbuy taR":r<this.decOldPrcLTP&&(this.LTPTrend="mwgridsell taR"),this.decOldPrcLTP=this._LTP}get BuyQty(){return this._BuyQty}set BuyQty(s){this._BuyQty=s}fn_AddHistory(s,r){for(;s.length>this.intHistorySize;)s.splice(0,1);if(0==s.length)for(var y=this.intHistorySize-1;s.length<y;)s.push(0);for(;s.length<=this.intHistorySize;)s.push(r)}get SellQty(){return this._SellQty}set SellQty(s){this._SellQty=s}get LTQ(){return this._LTQ}set LTQ(s){this._LTQ=s}get Volume(){return this._Volume}set Volume(s){this._Volume=s}get LTT(){return this._LTT}set LTT(s){this._LTT=s,this.LTTFormatted=this.fn_GetTimePart(this._LTT)}calculateData(){if(parseInt(this.Volume)>0){parseInt(this.Volume);let r=t.X.calculateValue(this.Volume,this.ATP,this.ScripDetail);this.Value=t.X.IsCommodityExchange(this.ScripDetail.ScripDet.MapMktSegId)?parseFloat(r)>0?r:Math.abs(r):parseFloat(r)>0?r:""}}get LUT(){return this._LUT}set LUT(s){this._LUT=s,this.LUTFormatted=this.fn_GetTimePart(this._LUT)}get NetChangeInRs(){return this._NetChangeInRs}set NetChangeInRs(s){this._NetChangeInRs=s,parseFloat(this.NetChangeInRs)<0?this.SymbolTrend="tc5 tkr_dwn scripname":0==parseFloat(this.NetChangeInRs)?this.SymbolTrend="tc5 tkr_nochg scripname":parseFloat(this.NetChangeInRs)>0&&(this.SymbolTrend="tc5 tkr_up scripname")}fn_GetTimePart(s){var r="";if(""!=s.trim()){var y=s.split(" ");"00:00:00"==(r=y.length>1?y[1].insert(2,":").insert(5,":"):y[0].insert(2,":").insert(5,":"))&&(r="")}return r}}},9473:(W,B,u)=>{u.d(B,{V:()=>t});
1var i=u(1705),U=u(8407);class t{constructor(){this.PrevDayOpen="",this.PrevDayHigh="",this.PrevDayLow="",this.PrevDayClose="",this.Resistance4="0.0000",this.Resistance3="0.0000",this.Resistance2="0.0000",this.Resistance1="0.0000",this.PivotPoint="0.0000",this.Support1="0.0000",this.Support2="0.0000",this.Support3="0.0000",this.Support4="0.0000",this.CalculationMethod="",this.PPFormula="",this.Minimum="0.0000",this.Maximum="0.0000",this.Range=0,this.Midpoint1="",this.Midpoint2="",this.Midpoint3="",this.Midpoint4="",this.Midpoint5="",this.Midpoint6="",this.Midpoint7="",this.Midpoint8="",this.FBRatio1=null!=i.xB.User.PivotPrefDetails&&null!=i.xB.User.PivotPrefDetails?i.xB.User.PivotPrefDetails[0].nRatio1:"0.0000",this.FBRatio2=null!=i.xB.User.PivotPrefDetails&&null!=i.xB.User.PivotPrefDetails?i.xB.User.PivotPrefDetails[0].nRatio2:"0.0000",this.FBRatio3=null!=i.xB.User.PivotPrefDetails&&null!=i.xB.User.PivotPrefDetails?i.xB.User.PivotPrefDetails[0].nRatio3:"0.0000",this.FBRatio4=null!=i.xB.User.PivotPrefDetails&&null!=i.xB.User.PivotPrefDetails?i.xB.User.PivotPrefDetails[0].nRatio4:"0.0000",this.Midpoint1="0.0000",this.Midpoint2="0.0000",this.Midpoint3="0.0000",this.Midpoint4="0.0000",this.Midpoint5="0.0000",this.Midpoint6="0.0000",this.Midpoint7="0.0000",this.Midpoint8="0.0000"}CalculatePP(g,s){let r;switch(this.PPFormula){case"(H+L+C)/3":r=((Number(this.PrevDayHigh)+Number(this.PrevDayLow)+Number(this.PrevDayClose))/3).toFixed(4);break;case"(H+L+O)/3":r=((Number(this.PrevDayHigh)+Number(this.PrevDayLow)+Number(this.PrevDayOpen))/3).toFixed(4);break;case"(H+L+C+O)/4":r=((Number(this.PrevDayHigh)+Number(this.PrevDayLow)+Number(this.PrevDayClose)+Number(this.PrevDayOpen))/4).toFixed(4);break;case"(H+L+C+C)/4":r=((Number(this.PrevDayHigh)+Number(this.PrevDayLow)+Number(this.PrevDayClose)+Number(this.PrevDayClose))/4).toFixed(4);break;case"(H+L+O+O)/4":r=((Number(this.PrevDayHigh)+Number(this.PrevDayLow)+Number(this.PrevDayOpen)+Number(this.PrevDayOpen))/4).toFixed(4);break;case"(H+L)/2":r=((Number(this.PrevDayHigh)+Number(this.PrevDayLow))/2).toFixed(4);break;case"(H+C)/2":r=((Number(this.PrevDayHigh)+Number(this.PrevDayClose))/2).toFixed(4);break;case"(L+C)/2":r=((Number(this.PrevDayLow)+Number(this.PrevDayClose))/2).toFixed(4)}var y=isNaN(parseFloat(this.PrevDayHigh))?0:this.PrevDayHigh,Q=isNaN(parseFloat(this.PrevDayLow))?0:this.PrevDayLow,V=isNaN(parseFloat(this.PrevDayClose))?0:this.PrevDayClose,w=isNaN(parseFloat(this.PrevDayOpen))?0:this.PrevDayOpen;this.PivotPoint=U.X.calculatePP(this.PPFormula,y,Q,V,w),this.CalculateSupportResistance(g,s)}CalculateSupportResistance(g,s){switch(this.fn_CalculateRange(),this.CalculationMethod){case"Classic":this.Maximum=(3*(Number(this.PivotPoint)+this.Range)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Minimum=(3*(Number(this.PivotPoint)-this.Range)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.fn_CalculateMinimum(),this.Resistance4=(Number(this.PivotPoint)+3*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance3=(Number(this.PivotPoint)+2*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance2=(Number(this.PivotPoint)+this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance1=(2*Number(this.PivotPoint)-Number(this.PrevDayLow)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support1=(2*Number(this.PivotPoint)-Number(this.PrevDayHigh)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support2=(Number(this.PivotPoint)-this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support3=(Number(this.PivotPoint)-2*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support4=(Number(this.PivotPoint)-3*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1));break;case"Woodie":this.Maximum=(3*(Number(this.PivotPoint)+this.Range)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Minimum=(3*(Number(this.PivotPoint)-this.Range)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.fn_CalculateMinimum(),this.Resistance4=(Number(this.PivotPoint)+3*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance3=(Number(this.PrevDayHigh)+2*(Number(this.PivotPoint)-Number(this.PrevDayLow))).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance2=(Number(this.PivotPoint)+this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance1=(2*Number(this.PivotPoint)-Number(this.PrevDayLow)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support1=(2*Number(this.PivotPoint)-Number(this.PrevDayHigh)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support2=(Number(this.PivotPoint)-this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support3=(Number(this.PrevDayLow)-2*(Number(this.PrevDayHigh)-Number(this.PivotPoint))).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support4=(Number(this.PivotPoint)-3*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1));break;case"Camarilla":this.Maximum=(Number(this.PrevDayClose)+.55*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Minimum=(Number(this.PrevDayClose)-.55*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.fn_CalculateMinimum(),this.Resistance4=(Number(this.PrevDayClose)+.55*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance3=(Number(this.PrevDayClose)+.275*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance2=(Number(this.PrevDayClose)+this.Range*(1.1/6)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance1=(Number(this.PrevDayClose)+this.Range*(1.1/12)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support1=(Number(this.PrevDayClose)-this.Range*(1.1/12)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support2=(Number(this.PrevDayClose)-this.Range*(1.1/6)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support3=(Number(this.PrevDayClose)-.275*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support4=(Number(this.PrevDayClose)-.55*this.Range).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1));break;case"Fibonacci":this.Maximum=(Number(this.PivotPoint)+this.Range*this.FBRatio4).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Minimum=(Number(this.PivotPoint)-this.Range*this.FBRatio4).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.fn_CalculateMinimum(),this.Resistance4=(Number(this.PivotPoint)+this.Range*Number(this.FBRatio4)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance3=(Number(this.PivotPoint)+this.Range*Number(this.FBRatio3)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance2=(Number(this.PivotPoint)+this.Range*Number(this.FBRatio2)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Resistance1=(Number(this.PivotPoint)+this.Range*Number(this.FBRatio1)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support1=(Number(this.PivotPoint)-this.Range*Number(this.FBRatio1)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support2=(Number(this.PivotPoint)-this.Range*Number(this.FBRatio2)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support3=(Number(this.PivotPoint)-this.Range*Number(this.FBRatio3)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1)),this.Support4=(Number(this.PivotPoint)-this.Range*Number(this.FBRatio4)).toFixed(i.xB.ExchManager.ReturnPrecisionForPrice(g,s.toString().length-1))}this.fn_CalculateMidpoint()}fn_CalculateRange(){this.Range=Number(this.PrevDayHigh)-Number(this.PrevDayLow)}fn_CalculateMidpoint(){this.Midpoint1=(Number(this.Resistance4)+Number(this.Resistance3)/2).toFixed(4),this.Midpoint2=(Number(this.Resistance3)+Number(this.Resistance2)/2).toFixed(4),this.Midpoint3=(Number(this.Resistance2)+Number(this.Resistance1)/2).toFixed(4),this.Midpoint4=(Number(this.Resistance1)+Number(this.PivotPoint)/2).toFixed(4),this.Midpoint5=((Number(this.PivotPoint)+Number(this.Support1))/2).toFixed(4),this.Midpoint6=((Number(this.Support1)+Number(this.Support2))/2).toFixed(4),this.Midpoint7=((Number(this.Support2)+Number(this.Support3))/2).toFixed(4),this.Midpoint8=((Number(this.Support3)+Number(this.Support4))/2).toFixed(4)}fn_CalculateMinimum(){this.Minimum=Number(this.Maximum)-Number(this.Minimum)<=40?(Number(this.Minimum)-(Number(this.Maximum)-Number(this.Minimum))/9).toFixed(4):(Number(this.Minimum)-10).toString()}}},5607:(W,B,u)=>{u.d(B,{u:()=>M});
1var i=u(1705),U=u(2282),t=u(8407);class M{constructor(){this.ScripDet=new U.A,this.Symbol="",this.Validity="",this.RecoId="",this.sRecoTitle="",this.MarketLot="",this.PriceTick="",this.SecurityDesc="",this.MWSecurityDescShort="",this._MWSecurityDesc="",this.DescPart1="",this.DescPart2="",this.DecimalLocator="",this.PriceFormat="",this.ISIN="",this.SPOS="",this.POS="",this._IsGlobal="0",this.OrderType="",this.Quantity=0,this.Price=0,this.ProductType="",this.AssetToken="",this.UnderlyingMktSegId=0,this.FutureMKtSegId=0,this.PriceNumerator=1,this.PriceDenominator=1,this.GenNumerator=1,this.GenDenominator=1,this.Spread="",this.FIILimit="",this.NRILimit="",this.Token=0,this.FIIFlag="",this.MarginTypeIndicator="",this.IsAsset="",this.IntrinsicValue="",this.IsIndex=0,this.nExpiryMonth=-1,this.IsSIP=0,this.IsSpread=0,this._Series="",this._InstrumentName="",this._StrikePrice="",this._OptionType="",this._ExpiryDate="",this.SelMarketLot=0,this.SelPriceTick=0,this.SelDecimalloc=0,this.SelStrikePrice=0}get MWSecurityDesc(){return this._MWSecurityDesc}set MWSecurityDesc(s){this._MWSecurityDesc=s,this.DescPart1=this._MWSecurityDesc.substr(0,this._MWSecurityDesc.indexOf(" ")).trim(),this.DescPart2=this._MWSecurityDesc.substr(this._MWSecurityDesc.indexOf(" ")+1).trim()}get IsGlobal(){return this._IsGlobal}set IsGlobal(s){this._IsGlobal=s,this.ScripDet.IsGlobal=this._IsGlobal}get ExchangeName(){return this._ExchangeName}set ExchangeName(s){var r;(this._ExchangeName=s,null!=this.ScripDet.MktSegId)&&(r=t.X.GetExchangeName(this.ScripDet.MktSegId),this._ExchangeName=r)}get Series(){return this._Series}set Series(s){var r=s;r=this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_NSEL_SPOT||this.ScripDet.MktSegId==i.gT.C_V_NSEL_SPOT?"EQ":r&&"XX"!=r.trim()?r.trim():"NA",this._Series=r}get InstrumentName(){return this._InstrumentName}set InstrumentName(s){var r=s;r=""==r?i.gT.C_S_INSTRUMENT_EQUITIES_TEXT:r.trim()==i.gT.C_S_INSTRUMENT_MCXFUTSPT_TEXT&&this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_NSEL_SPOT?i.gT.C_S_INSTRUMENT_MCXFUTSPT_TEXT:r.trim()==i.gT.C_S_INSTRUMENT_MCXFUTSPT_TEXT||r.trim()==i.gT.C_S_INSTRUMENT_NCDEXSPOT_TEXT?i.gT.C_S_INSTRUMENT_FUTSPT_TEXT:this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_MSX_CASH||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_DSE_CASH?i.gT.C_S_INSTRUMENT_EQUITIES_TEXT:r.toUpperCase().trim(),this._InstrumentName=r}get StrikePrice(){return this._StrikePrice}set StrikePrice(s){var r=s;(this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_BSECOMM_DERIVATIVES&&this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTBLN_TEXT||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_NSECOMM_DERIVATIVES&&this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTBLN_TEXT||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_MCX_DERIVATIVES&&this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTFUT_TEXT)&&(null==r||"undefined"==r||""==r||"NA"==r.trim())&&(r="NA"),null==r||"undefined"==r||""==r||"-1"==r.trim()||"0"==r.trim()||"0.00"==r.trim()||"-0.01"==r.trim()||"0.0000"==r.trim()||"-0.0001"==r.trim()||"-1.00"==r.trim()||"NA"==r.trim()?r="NA":-1==r.toString().trim().indexOf(".")&&(r=this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_MSX_DERIVATIVES&&this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTCUR_TEXT?t.X.ConvertToRe(r.trim(),this.ScripDet.MapMktSegId,"10000"):this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_NSX_DERIVATIVES&&(this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTCUR_TEXT||this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTIRC_TEXT)||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_BFX_DERIVATIVES||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_MSX_FAO||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_BSECDX_DERIVATIVES&&(this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTCUR_TEXT||this.InstrumentName==i.gT.C_S_INSTRUMENT_OPTIRD_TEXT)?t.X.ConvertToRe(r.trim(),this.ScripDet.MapMktSegId,this.DecimalLocator):this.ScripDet.MapMktSegId!=i.gT.C_V_MAPPED_NSECOMM_DERIVATIVES||this.InstrumentName!=i.gT.C_S_INSTRUMENT_OPTBLN_TEXT&&this.InstrumentName!=i.gT.C_S_INSTRUMENT_OPTBAS_TEXT&&this.InstrumentName!=i.gT.C_S_INSTRUMENT_OPTFUT_TEXT?t.X.ConvertToReWithPrice(r.trim()):t.X.ConvertToRe(r.trim(),this.ScripDet.MapMktSegId,"10000")),this._StrikePrice=r}get OptionType(){return this._OptionType}set OptionType(s){var r=s;r=""==r||"undefined"==r||"XX"==r.trim()?"NA":r.trim(),this._OptionType=r}get ExpiryDate(){return this._ExpiryDate}set ExpiryDate(s){var r=s;r=!r||"01Jan1980"==r.trim()||"0"==r.trim()||"01JAN2020"==r.toUpperCase().replace(" ","")||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_NSEL_DERIVATIVES&&this.InstrumentName.trim()!=i.gT.C_S_INSTRUMENT_FUTCOM_TEXT||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_MSX_CASH||this.ScripDet.MapMktSegId==i.gT.C_V_MAPPED_DSE_CASH?"NA":r.toUpperCase().trim(),this._ExpiryDate=r}}},2282:(W,B,u)=>{u.d(B,{A:()=>U});var i=u(8407);class U{constructor(){this.IsGlobal="0",this.Token=""}get MktSegId(){return this._MktSegId}
1set MktSegId(M){this._MktSegId=M,this.MapMktSegId=i.X.GetMappedMarketSegmentId(M)}}}}]);
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.