extra-fyers.web
Advanced tools
Comparing version 0.0.57 to 0.0.58
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).extra_fyers=e()}}((function(){return function e(t,n,r){function i(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,(function(e){return i(t[a][1][e]||e)}),l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=new Map([[-209,"Invalid order id"],[-101,"Invalid order type"],[-305,"For CO orders only market and limit orders are allowed"],[-323,"For BO orders only market and limit orders are allowed"],[-308,"Invalid limit price"],[-309,"Invalid stop price"],[-310,"Invalid order quantity"],[-311,"Invalid stop loss price"],[-313,"Invalid order side of either buy or sell"],[-314,"Invalid product type for the order"],[-315,"Invalid price for stop limit order"],[-316,"Invalid stop loss price for CO/BO orders"],[-323,"Invalid stop loss value"],[-325,"Ivalid target value (take_profit)"],[-326,"Invalid order validity"],[-327,"Invalid order disclosed quantity"],[-328,"Invalid order offline flag"],[-201,"Connection issue while processing your request"],[-202,"Connection timed out"],[-204,"Request wasnt processed"],[-205,"Market wasnt able to accept or process the request"],[-157,"User doesnt exist"],[-159,"Invalid order number"],[-161,"This order has already been cancelled"],[-162,"This order has already traded"],[-163,"Order modfication wasnt done successfully"],[-164,"This order has already been rejected"],[-390,"Invalid stop price"],[-392,"Price is not in multiples of tick size"],[-353,"API limit exceeded"],[-372,"Invalid price"],[-397,"Position quantity is zero"],[-398,"No open positions"],[-399,"No pending orders to be closed/cancelled"],[-329,"Please check if exit positions is complete"],[-373,"No permission"],[-374,"Invalid authorization code (auth_code)"],[-371,"Invalid SHA256 hash of (app_id:secret_key)"],[-17,"Invalid access token used for authentication"],[-352,"Invalid app id"],[-96,"An unexpected error occurred when processing request"],[-351,"Greater than 50 symbols"],[-300,"Invalid symbol"],[-310,"Invalid symbols"],[-301,"Invalid resolution format"],[-302,"Invalid historical timestamp from when you require data"],[-303,"Invalid historical timestamp till when you require data"],[-356,"The range_from value cannot be greater than range_to value"],[-334,"Invalid key date format value"],[-335,"Historical timestamp from when you require data not in epoch format"],[-336,"Historical timestamp till when you require data not in epoch format"],[-337,"Historical timestamp from when you require data not in YYYY-MM-DD format"],[-338,"Historical timestamp till when you require data not in YYYY-MM-DD format"],[-339,"The range cannot be more than 1 year for day resolution"],[-341,"The range cannot be more than 100 days for 1 min resolution"],[-343,"The range cannot be more than 100 days for 2 min resolution"],[-344,"The range cannot be more than 100 days for 3 min resolution"],[-345,"The range cannot be more than 100 days for 5 min resolution"],[-346,"The range cannot be more than 100 days for 10 min resolution"],[-347,"The range cannot be more than 100 days for 15 min resolution"],[-348,"The range cannot be more than 100 days for 20 min resolution"],[-349,"The range cannot be more than 100 days for 30 min resolution"],[-353,"The range cannot be more than 100 days for 60 min resolution"],[-354,"The range cannot be more than 100 days for 120 min resolution"],[-355,"The range cannot be more than 100 days for 240 min resolution"]]);function i(e){return r.get(e)}function o(e){return parseInt(e,10)>50?"19"+e:"20"+e}function a(e){return e.substring(2)}const u=new Map([["JAN","January"],["FEB","February"],["MAR","March"],["APR","April"],["MAY","May"],["JUN","June"],["JUL","July"],["AUG","August"],["SEP","September"],["OCT","October"],["NOV","November"],["DEC","December"]]);function s(e){return u.get(e)}function c(e){return e.substring(0,3).toUpperCase()}const l=new Map([["1","January"],["2","February"],["3","March"],["4","April"],["5","May"],["6","June"],["7","July"],["8","August"],["9","September"],["O","October"],["N","November"],["D","December"]]),d=new Map([["JAN","1"],["FEB","2"],["MAR","3"],["APR","4"],["MAY","5"],["JUN","6"],["JUL","7"],["AUG","8"],["SEP","9"],["OCT","O"],["NOV","N"],["DEC","D"]]);function p(e){return l.get(e)}function y(e){var t=e.substring(0,3).toUpperCase();return d.get(t)}function f(e){return e.replace(/^0+/,"")}function m(e){return e.padStart(2,"0")}const T=new Map([[10,"National Stock Exchange (NSE)"],[11,"Multi Commodity Exchange (MCX)"],[12,"Bombay Stock Exchange (BSE)"]]),h=new Map([["N",10],["M",11],["B",12]]);function g(e){return T.get(e)}function v(e){var t=e.charAt(0).toUpperCase();return h.get(t)}const C=new Map([[10,"Capital Market (CM)"],[11,"Equity Derivatives (FO)"],[12,"Currency Derivatives (CD)"],[20,"Commodity Derivatives (COM)"]]),D=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function I(e){return C.get(e)}function P(e){var t="CM";return/^com/i.test(e)?t="COM":/^cur/i.test(e)?t="CD":/der|fut|opt/i.test(e)&&(t="FO"),D.get(t)}const E=new Map([[1,"Long"],[-1,"Short"],[0,"Closed position"]]),M=new Map([["L",1],["S",-1],["C",0]]);function O(e){return E.get(e)}function b(e){var t=e.charAt(0).toUpperCase();return M.get(t)}const S=new Map([[1,"Buy"],[-1,"Sell"]]),R=new Map([["B",1],["S",-1]]);function U(e){return S.get(e)}function A(e){var t=e.charAt(0).toUpperCase();return R.get(t)}const w=new Map([["M","Mobile"],["W","Web"],["R","Fyers One"],["A","Admin"],["ITS","API"]]),N=new Map([["MO","M"],["WE","W"],["ON","R"],["AD","A"],["AP","ITS"]]);function F(e){return w.get(e)}function q(e){var t=e.split(" "),n=t[t.length-1].substring(0,2).toUpperCase();return N.get(n)}const _=new Map([[1,"Cancelled"],[2,"Traded / Filled"],[3,"For future use"],[4,"Transit"],[5,"Rejected"],[6,"Pending"],[7,"Expired"]]),k=new Map([["C",1],["F",2],["T",4],["R",5],["P",6],["E",7]]);function L(e){return _.get(e)}function x(e){/traded/i.test(e)&&(e="Filled");var t=e.charAt(0).toUpperCase();return k.get(t)}const Q=new Map([[1,"Limit order"],[2,"Market order"],[3,"Stop order (SL-M)"],[4,"Stoplimit order (SL-L)"]]),B=new Map([["L",1],["M",2],["S",3],["R",4]]);function H(e){return Q.get(e)}function z(e){var t=e.charAt(0).toUpperCase();return/s.+l(?!oss)/i.test(e)&&(t="R"),B.get(t)}const G=new Map([["DAY","End of day validity (DAY)"],["IOC","Immediate or Cancel validity (IOC)"]]);function V(e){return/ioc|imm/i.test(e)?"IOC":"DAY"}const X=new Map([["CE","Call Option (CE)"],["PE","Put Option (PE)"]]);function Y(e){return X.get(e)}function J(e){return/^[ps]/i.test(e)?"PE":"CE"}const K=new Map([["T1","The shares are purchased but not yet delivered to the demat account"],["HLD","The shares are purchased and are available in the demat account"]]);function W(e){return K.get(e)}function j(e){return/not|un/i.test(e)?"T1":"HLD"}const $=new Map([["CNC","Cash N Carry or Delivery Order, for equity only (CNC)"],["INTRADAY","Intraday Order, applicable for all segments (INTRADAY)"],["MARGIN","Margin Order, applicable only for derivatives (MARGIN)"],["CO","Cover Order (CO)"],["BO","Bracket Order (BO)"]]),Z=new Map([["D","CNC"],["I","INTRADAY"],["M","MARGIN"],["M","MARGIN"],["C","CO"],["B","BO"]]);function ee(e){return $.get(e)}function te(e){/cnc|cash|carry/i.test(e)&&(e="Delivery");var t=e.charAt(0).toUpperCase();return Z.get(t)}const ne=new Map([[0,"Equity Shares (EQ)"],[1,"Preference Shares (PREFSHARES)"],[2,"Collateral-free Debt (DEBENTURES)"],[3,"Warrants on Stock (WARRANTS)"],[4,"Miscellaneous (MISC)"],[10,"Stock Market Index (INDEX)"],[11,"Futures on Index (FUTIDX)"],[12,"Futures on Volatility Index (FUTIVX)"],[13,"Futures on Stock (FUTSTK)"],[14,"Options on Index (OPTIDX)"],[15,"Options on Stock (OPTSTK)"],[16,"Futures on Currency (FUTCUR)"],[17,"Futures on Government of India Treasury Bills (FUTIRT)"],[18,"Futures on Government of India Bonds (FUTIRC)"],[19,"Options on Currency (OPTCUR)"],[20,"Underlying on Currency (UNDCUR)"],[21,"Underlying on Government of Bonds (UNDIRC)"],[22,"Underlying on Government of India Treasury Bills (UNDIRT)"],[23,"Underlying on 10 Year Notional coupon bearing GOI security (UNDIRD)"],[24,"Market-indexed Certificate of deposit (INDEX_CD)"],[25,"Futures on 10 Year Notional coupon bearing GOI security (FUTIRD)"],[30,"Futures on Commodity (FUTCOM)"],[31,"Options on Commodity Futures (OPTFUT)"],[32,"Options on Commodity (OPTCOM)"]]),re=new Map([["EQ",0],["PREFSHARES",1],["DEBENTURES",2],["WARRANTS",3],["MISC",4],["INDEX",10],["FUTIDX",11],["FUTIVX",12],["FUTSTK",13],["OPTIDX",14],["OPTSTK",15],["FUTCUR",16],["FUTIRT",17],["FUTIRC",18],["OPTCUR",19],["UNDCUR",20],["UNDIRC",21],["UNDIRT",22],["UNDIRD",23],["INDEX_CD",24],["FUTIRD",25],["FUTCOM",30],["OPTFUT",31],["OPTCOM",32]]);function ie(e){return ne.get(e)}function oe(e){var t="EQ",n=/fut|future/i.test(e),r=/opt|option/i.test(e),i=/idx|index/i.test(e),o=/und|underlying/i.test(e);return t=/com(\b|$)|commodit/i.test(e)?r?n?"OPTFUT":"OPTCOM":i?"FUTIDX_COM":"FUTCOM":/(^|\b)und|cd(\b|$)|ir[cdt](\b|$)|cur|gov|bond|trea|coup/i.test(e)?/irc(\b|$)|bond/i.test(e)?o?"UNDIRC":"FUTIRC":/ird(\b|$)|coup/i.test(e)?o?"UNDIRD":"FUTIRD":/irt(\b|$)|trea/i.test(e)?o?"UNDIRT":"FUTIRT":i?"INDEX_CD":r?"OPTCUR":"FUTCUR":n||r?/ivx|volatil/i.test(e)?"FUTIVX":i?r?"OPTIDX":"FUTIDX":r?"OPTSTK":"FUTSTK":i?"INDEX":/misc/i.test(e)?"MISC":/warrant/i.test(e)?"WARRANTS":/deb/i.test(e)?"DEBENTURES":/pref/i.test(e)?"PREFSHARES":"EQ",re.get(t)}var ae=Object.freeze({__proto__:null,errorDescription:i,year2Description:o,year2:a,month3Description:s,month3:c,month1Description:p,month1:y,day2Description:f,day2:m,exchangeDescription:g,exchange:v,segmentDescription:I,segment:P,positionSideDescription:O,positionSide:b,orderSideDescription:U,orderSide:A,orderSourceDescription:F,orderSource:q,orderStatusDescription:L,orderStatus:x,orderTypeDescription:H,orderType:z,orderValidityDescription:function(e){return G.get(e)},orderValidity:V,optionTypeDescription:Y,optionType:J,holdingTypeDescription:W,holdingType:j,productTypeDescription:ee,productType:te,instrumentTypeDescription:ie,instrumentType:oe});function ue(e,t){var n=new Error(t);return n.code=e.status,n.response=null,n}function se(e,t){return null!=t.headers&&(!!t.headers.hasOwnProperty(e)||!!t.headers.hasOwnProperty(e.toLowerCase()))}function ce(e,t){return new Promise(((n,r)=>{var i=t.url,o=t.method||"GET",a=!1,u=!1,s=!1,c=new XMLHttpRequest;c.open(o,i),function(e,t){for(var n in null==t.body||se("Content-Type",t)||e.setRequestHeader("Content-Type","application/json; charset=utf-8"),se("Accept",t)||e.setRequestHeader("Accept","application/json, text/*"),t.headers)e.setRequestHeader(n,t.headers[n])}(c,t),t.timeout&&(c.timeout=t.timeout),c.responseType=e,c.onerror=function(e){a=!0;var t=e.target;r(ue(t,"Unexpected error occurred"))},c.onabort=function(e){u=!0;var t=e.target;r(ue(t,"Request was aborted"))},c.ontimeout=function(e){s=!0;var t=e.target;r(ue(t,"Request timed out"))},c.onreadystatechange=function(t){if(!(a||u||s)){var o=t.target;if(function(e){return e.readyState===e.DONE}(o))try{var c=function(e,t){if("json"===t){if(!e.responseType)try{return JSON.parse(e.responseText)}catch(e){return null}}else if((!t||"text"===t)&&null==e.response)return e.responseText;return e.response}(o,e);!function(e,t=""){return e.status>=200&&e.status<300||304===e.status||/^file:\/\//i.test(t)}(o,i)?setTimeout((function(){a||u||s||r(function(e,t){var n=null;try{n=e.responseText}catch(e){n=t}var r=new Error(n);return r.code=e.status,r.response=t,r}(o,c))})):n(c)}catch(t){r(t)}}},null==t.body?c.send():t.body instanceof FormData||t.body instanceof URLSearchParams?c.send(t.body):c.send(JSON.stringify(t.body))}))}const le="https://api.fyers.in/api/v2/",de="https://api.fyers.in/data-rest/v2/",pe="https://public.fyers.in/sym_details/";var ye,fe;function me(e,t,n,r,i){var o=n+function(e){if(null==e)return"";var t=new URLSearchParams;for(var n in e)t.append(n,e[n]);return"?"+t.toString()}(r),a={};return null!=e&&(a.authorization=e.app_id+":"+e.access_token),{url:o,method:t,headers:a,body:i}}function Te(e,t,n,r,i){return ce("text",me(e,t,n,r,i))}function he(e,t,n,r,i){return ce("json",me(e,t,n,r,i))}function ge(e,t,n,r,i){return he(e,t,le+n,r,i)}function ve(e,t,n,r,i){return he(e,t,de+n,r,i)}function Ce(e){return me(null,"GET",le+"generate-authcode",e,null)}function De(e){return me(null,"POST",le+"validate-authcode",null,e)}function Ie(e){return ge(e,"GET","profile",null,null)}function Pe(e){return ge(e,"GET","funds",null,null)}function Ee(e){return ge(e,"GET","holdings",null,null)}function Me(e,t){return ge(e,"GET","orders",t,null)}function Oe(e){return ge(e,"GET","orders",null,null)}function be(e){return ge(e,"GET","positions",null,null)}function Se(e){return ge(e,"GET","tradebook",null,null)}function Re(e,t){return ge(e,"POST","orders",null,t)}function Ue(e,t){return ge(e,"POST","orders-multi",null,t)}function Ae(e,t){return ge(e,"PUT","orders",null,t)}function we(e,t){return ge(e,"PUT","orders-multi",null,t)}function Ne(e,t){return ge(e,"DELETE","orders",null,t)}function Fe(e,t){return ge(e,"DELETE","orders-multi",null,t)}function qe(e,t){return ge(e,"DELETE","positions",null,t)}function _e(e){return ge(e,"DELETE","positions",null,{})}function ke(e,t){return ge(e,"PUT","positions",null,t)}function Le(e){return ge(e,"GET","market-status",null,null)}function xe(e,t){return ve(e,"GET","history/",t,null)}function Qe(e,t){return ve(e,"GET","quotes/",t,null)}function Be(e,t){return ve(e,"GET","depth/",t,null)}function He(e,t){var{exchange:n,segment:r}=t;return function(e,t,n,r,i){return Te(e,t,pe+n,r,i)}(null,"GET",n+"_"+r+".csv",null,null)}function ze(e){return ge(e,"GET","tpin",null,null)}function Ge(e){return ge(e,"GET","details",null,null)}function Ve(e,t){return me(e,"POST","index",null,t)}function Xe(e,t){return ge(e,"POST","inquiry",null,t)}!function(e){e[e.Start=9]="Start",e[e.Deposits=6]="Deposits",e[e.RealizedReturns=4]="RealizedReturns",e[e.Collaterals=5]="Collaterals",e[e.Adhoc=8]="Adhoc",e[e.Utilized=2]="Utilized",e[e.Receivables=7]="Receivables",e[e.Available=10]="Available",e[e.Clear=3]="Clear",e[e.Total=1]="Total"}(ye||(ye={})),function(e){e[e.Time=0]="Time",e[e.Open=1]="Open",e[e.High=2]="High",e[e.Low=3]="Low",e[e.Close=4]="Close",e[e.Volume=5]="Volume"}(fe||(fe={}));var Ye=Object.freeze({__proto__:null,API_URL:le,DATA_URL:de,SYMBOLS_URL:pe,get FundLimitType(){return ye},get ShortCandleIndex(){return fe},authorizationStep1:Ce,authorizationStep2:De,getProfile:Ie,getFunds:Pe,getHoldings:Ee,getOrder:Me,getOrders:Oe,getPositions:be,getTrades:Se,placeOrder:Re,placeOrders:Ue,modifyOrder:Ae,modifyOrders:we,cancelOrder:Ne,cancelOrders:Fe,exitPosition:qe,exitAllPositions:_e,convertPosition:ke,getMarketStatus:Le,getMarketHistory:xe,getMarketQuotes:Qe,getMarketDepth:Be,getSymbolMaster:He,generateEdisTpin:ze,getEdisTransactions:Ge,submitEdisHoldingsStep:Ve,inquireEdisTransaction:Xe});const Je=new Map([[10,"NSE"],[11,"MCX"],[12,"BSE"]]),Ke=new Map([["NSE",10],["MCX",11],["BSE",12]]);function We(e){return Je.get(e)}const je=new Map([[10,"CM"],[11,"FO"],[12,"CD"],[20,"COM"]]),$e=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function Ze(e){return je.get(e)}const et=new Map([[1,"LONG"],[-1,"SHORT"],[0,"CLOSED"]]),tt=new Map([["LONG",1],["SHORT",-1],["CLOSED",0]]);function nt(e){return et.get(e)}function rt(e){return tt.get(e)}const it=new Map([[1,"BUY"],[-1,"SELL"]]),ot=new Map([["BUY",1],["SELL",-1]]);function at(e){return it.get(e)}function ut(e){return ot.get(e)}const st=new Map([["M","MOBILE"],["W","WEB"],["R","ONE"],["A","ADMIN"],["ITS","API"]]),ct=new Map([["MOBILE","M"],["WEB","W"],["ONE","R"],["ADMIN","A"],["API","ITS"]]);function lt(e){return st.get(e)}const dt=new Map([[1,"CANCELLED"],[2,"TRADED"],[4,"TRANSIT"],[5,"REJECTED"],[6,"PENDING"],[7,"EXPIRED"]]),pt=new Map([["CANCELLED",1],["TRADED",2],["TRANSIT",4],["REJECTED",5],["PENDING",6],["EXPIRED",7]]);function yt(e){return dt.get(e)}const ft=new Map([[1,"LIMIT"],[2,"MARKET"],[3,"SL-MARKET"],[4,"SL-LIMIT"]]),mt=new Map([["LIMIT",1],["MARKET",2],["SL-MARKET",3],["SL-LIMIT",4]]);function Tt(e){return ft.get(e)}function ht(e){return mt.get(e)}const gt=new Map([["CE","CALL"],["PE","PUT"]]),vt=new Map([["CALL","CE"],["PUT","PE"]]);const Ct=new Map([[0,"EQ"],[1,"PREFSHARES"],[2,"DEBENTURES"],[3,"WARRANTS"],[4,"MISC"],[10,"INDEX"],[11,"FUTIDX"],[12,"FUTIVX"],[13,"FUTSTK"],[14,"OPTIDX"],[15,"OPTSTK"],[16,"FUTCUR"],[17,"FUTIRT"],[18,"FUTIRC"],[19,"OPTCUR"],[20,"UNDCUR"],[21,"UNDIRC"],[22,"UNDIRT"],[23,"UNDIRD"],[24,"INDEX_CD"],[25,"FUTIRD"],[30,"FUTCOM"],[31,"OPTFUT"],[32,"OPTCOM"]]),Dt=new Map([["EQ",0],["PREFSHARES",1],["DEBENTURES",2],["WARRANTS",3],["MISC",4],["INDEX",10],["FUTIDX",11],["FUTIVX",12],["FUTSTK",13],["OPTIDX",14],["OPTSTK",15],["FUTCUR",16],["FUTIRT",17],["FUTIRC",18],["OPTCUR",19],["UNDCUR",20],["UNDIRC",21],["UNDIRT",22],["UNDIRD",23],["INDEX_CD",24],["FUTIRD",25],["FUTCOM",30],["OPTFUT",31],["OPTCOM",32]]);function It(e){return Ct.get(e)}function Pt(e){return{app_id:e.appId,access_token:e.accessToken}}var Et=ye;function Mt(e){return{isin:e.isin,symbol:e.symbol,exchange:We(e.exchange),type:e.holdingType,quantity:e.quantity,remainingQuantity:e.remainingQuantity,buyPrice:e.costPrice,buyValue:e.costPrice*e.quantity,currentPrice:e.ltp,currentValue:e.marketVal,returns:e.pl,returnsPercent:e.pl/(e.costPrice*e.quantity)}}function Ot(e,t){var n=0;for(var r of e)"HLD"===r.holdingType&&n++;return{count:t.count_total,settledCount:n,investedValue:t.total_investment,currentValue:t.total_current_value,returns:t.total_pl,returnsPercent:t.pnl_perc}}function bt(e){return{id:e.id,symbol:e.symbol,ticker:e.ex_sym,description:e.description,segment:Ze(e.segment),instrument:It(e.instrument),exchange:We(e.exchange),type:Tt(e.type),side:at(e.side),productType:e.productType,source:lt(e.source)||null,status:yt(e.status),offline:"True"===e.offlineOrder,limitPrice:e.limitPrice,stopPrice:e.stopPrice,quantity:e.qty,remainingQuantity:e.remainingQuantity,tradedQuantity:e.filledQty,disclosedQuantity:e.discloseQty,remainingDisclosedQuantity:e.dqQtyRem,validity:e.orderValidity,date:e.orderDateTime,parentId:e.parentId||null,priceChange:e.ch,priceChangePercent:e.chp,currentPrice:e.lp,tradedPrice:e.tradedPrice,message:e.message,pan:e.pan||null,clientId:e.clientId||null}}function St(e){var t={count:0,openCount:0,closedCount:0,quantity:0,remainingQuantity:0,tradedQuantity:0,disclosedQuantity:0,remainingDisclosedQuantity:0};for(var n of e)t.count++,t.openCount+=6===n.status||4===n.status?1:0,t.quantity+=n.qty,t.remainingQuantity+=n.remainingQuantity,t.tradedQuantity+=n.filledQty,t.disclosedQuantity+=n.discloseQty,t.remainingDisclosedQuantity+=n.dqQtyRem;return t.closedCount=t.count-t.openCount,t}function Rt(e){return{id:e.id,symbol:e.symbol,segment:Ze(e.segment),productType:e.productType,side:nt(e.side),quantity:e.qty,quantityMultiplier:e.qtyMulti_com,buyPrice:e.buyAvg,buyQuantity:e.buyQty,buyValue:e.buyVal,sellPrice:e.sellAvg,sellQuantity:e.sellQty,sellValue:e.sellVal,netPrice:e.netAvg,netQuantity:e.netQty,returns:e.pl,realizedReturns:e.realized_profit,unrealizedReturns:e.unrealized_profit,crossCurrency:"Y"===e.crossCurrency,rbiRefRate:e.rbiRefRate,currentPrice:e.ltp}}function Ut(e,t){var n=0,r=0;for(var i of e)n+=i.buyVal,r+=i.sellVal;return{count:t.count_total,openCount:t.count_open,closedCount:t.count_total-t.count_open,buyValue:n,sellValue:r,returns:t.pl_total,realizedReturns:t.pl_realized,unrealizedReturns:t.pl_unrealized}}function At(e){return{id:e.id,orderId:e.orderNumber,symbol:e.symbol,segment:Ze(e.segment),exchange:We(e.exchange),side:at(e.transactionType),productType:e.productType,orderType:Tt(e.orderType),orderDate:e.orderDateTime,price:e.tradePrice,quantity:e.tradedQty,value:e.tradeValue,clientId:e.clientId}}function wt(e){var t={count:0,quantity:0,value:0};for(var n of e)t.count++,t.quantity+=n.tradedQty,t.value+=n.tradeValue;return t}function Nt(e){return{symbol:e.symbol,type:ht(e.type||"MARKET"),side:ut(e.side||"BUY"),productType:e.productType||"CNC",limitPrice:e.limitPrice||0,stopPrice:e.stopPrice||0,qty:e.quantity,disclosedQty:e.disclosedQuantity||0,validity:e.validity||"DAY",offlineOrder:e.offline?"True":"False",stopLoss:e.stopLoss||0,takeProfit:e.takeProfit||0}}function Ft(e){return{id:e.id,type:ht(e.type),qty:e.quantity,disclosedQty:e.disclosedQuantity,limitPrice:e.limitPrice,stopPrice:e.stopPrice}}function qt(e){return{exchange:We(e.exchange),segment:Ze(e.segment),type:e.market_type,status:e.status}}function _t(e){var t={count:0,openCount:0,closedCount:0};for(var n of e)t.count++,"OPEN"===n.status?t.openCount++:t.closedCount++;return t}const kt=[1,2,3,5,10,15,20,30,60,120,240,1440];function Lt(e){var t=1,n=1/0;for(var r of kt){var i=Math.abs(e-r);i<n&&(t=r,n=i)}return 1440===t?"D":t.toString()}var xt=fe;function Qt(e){return{date:e[xt.Time],openPrice:e[xt.Open],highPrice:e[xt.High],lowPrice:e[xt.Low],closePrice:e[xt.Close],volume:e[xt.Volume]}}function Bt(e){return{date:e.t,openPrice:e.o,highPrice:e.h,lowPrice:e.l,closePrice:e.c,volume:e.v}}function Ht(e){var t={fromDate:0,toDate:0,openPrice:0,highPrice:0,lowPrice:0,closePrice:0,volume:0};if(0===e.length)return t;var n=e.length-1;for(var r of(t.fromDate=e[0][xt.Time],t.toDate=e[n][xt.Time],t.openPrice=e[0][xt.Open],t.highPrice=e[0][xt.High],t.lowPrice=e[0][xt.Low],t.closePrice=e[n][xt.Close],e))t.highPrice=Math.max(t.highPrice,r[xt.High]),t.lowPrice=Math.min(t.lowPrice,r[xt.Low]),t.volume+=r[xt.Volume];return t}function zt(e){var t=e.v;return{symbol:e.n,name:t.short_name,exchange:t.exchange,description:t.description,priceChange:t.ch,priceChangePercent:t.chp,currentPrice:t.lp,priceSpread:t.spread,sellPrice:t.ask,buyPrice:t.bid,openPrice:t.open_price,highPrice:t.high_price,lowPrice:t.low_price,closePrice:t.prev_close_price,volume:t.volume,date:t.tt,candle:Bt(t.cmd)}}function Gt(e){return{price:e.price,volume:e.volume,orders:e.ord}}function Vt(e){return{id:e.transactionId,isin:e.isin,quantity:e.qty,remainingQuantity:e.qty-e.qtyUtlize,entryDate:e.entryDate,startDate:e.startDate,endDate:e.endDate,source:e.source,status:e.status,clientId:e.clientId,errorCode:e.errCode,errorCount:e.errorCount,reason:e.reason}}function Xt(e){var t={count:0,quantity:0,remainingQuantity:0};for(var n of e)t.count++,t.quantity+=n.qty,t.remainingQuantity+=n.qty-n.qtyUtlize;return t}function Yt(e){return{isin_code:e.isin,qty:e.quantity}}function Jt(e,t){return.01*Math.round(e*t)}function Kt(e){return Jt(e,.1)+Jt(e,18)+Jt(e,.00325)+Jt(e,.015)+Jt(e,1e-4)}function Wt(e,t,n="default"){var r;return Ce({client_id:(r={appId:e,redirectUrl:t,state:n}).appId,redirect_uri:r.redirectUrl,response_type:"code",state:r.state})}function jt(e,t){var n;return De({grant_type:"authorization_code",appIdHash:(n={appHash:e,authorizationCode:t}).appHash,code:n.authorizationCode})}async function $t(e){return t=await Ie(Pt(e)),{id:(n=t.data).fy_id,email:n.email_id,name:n.name,pan:n.PAN};var t,n}async function Zt(e){return function(e){var t={},n={};for(var r of e.fund_limit)switch(r.id){case Et.Start:t.start=r.equityAmount,n.start=r.commodityAmount;break;case Et.Deposits:t.deposits=r.equityAmount,n.deposits=r.commodityAmount;break;case Et.RealizedReturns:t.realizedReturns=r.equityAmount,n.realizedReturns=r.commodityAmount;break;case Et.Collaterals:t.collaterals=r.equityAmount,n.collaterals=r.commodityAmount;break;case Et.Adhoc:t.adhoc=r.equityAmount,n.adhoc=r.commodityAmount;break;case Et.Utilized:t.utilized=r.equityAmount,n.utilized=r.commodityAmount;break;case Et.Receivables:t.receivables=r.equityAmount,n.receivables=r.commodityAmount;break;case Et.Available:t.available=r.equityAmount,n.available=r.commodityAmount;break;case Et.Clear:t.clear=r.equityAmount,n.clear=r.commodityAmount;break;case Et.Total:t.total=r.equityAmount,n.total=r.commodityAmount}return{equity:t,commodity:n}}(await Pe(Pt(e)))}async function en(e){return{details:(t=await Ee(Pt(e))).holdings.map(Mt),overall:Ot(t.holdings,t.overall)};var t}async function tn(e,t){var n={id:t};return bt((await Me(Pt(e),n)).orderBook[0])}async function nn(e){return{details:(t=await Oe(Pt(e))).orderBook.map(bt),overall:St(t.orderBook)};var t}async function rn(e){return{details:(t=await be(Pt(e))).netPositions.map(Rt),overall:Ut(t.netPositions,t.overall)};var t}async function on(e){return{details:(t=await Se(Pt(e))).tradeBook.map(At),overall:wt(t.tradeBook)};var t}async function an(e,t){var n=Nt(t);return(await Re(Pt(e),n)).id}async function un(e,t){var n=t.map(Nt);return(await Ue(Pt(e),n)).data.map((e=>e.body.id))}async function sn(e,t){var n=Ft(t);return(await Ae(Pt(e),n)).id}async function cn(e,t){var n=t.map(Ft);return(await we(Pt(e),n)).data.map((e=>e.body.id))}async function ln(e,t){var n={id:t};return(await Ne(Pt(e),n)).id}async function dn(e,t){var n=t.map((e=>({id:e})));return(await Fe(Pt(e),n)).data.map((e=>e.body.id))}async function pn(e,t){var n={id:t};return(await qe(Pt(e),n)).s}async function yn(e){return(await _e(Pt(e))).s}async function fn(e,t){var n,r={symbol:(n=t).symbol,positionSide:rt(n.side||"LONG"),convertQty:n.quantity,convertFrom:n.fromProductType||"INTRADAY",convertTo:n.toProductType||"CNC"};return(await ke(Pt(e),r)).s}async function mn(e){return{details:(t=await Le(Pt(e))).marketStatus.map(qt),overall:_t(t.marketStatus)};var t}async function Tn(e,t){var n,r={symbol:(n=t).symbol,resolution:Lt(n.resolution),date_format:0,range_from:n.fromDate.toString(),range_to:n.toDate.toString(),cont_flag:n.continuous?"1":"0"};return function(e){return{details:e.candles.map(Qt),overall:Ht(e.candles)}}(await xe(Pt(e),r))}async function hn(e,t){var n={symbols:t.join()};return(await Qe(Pt(e),n)).d.map(zt)}async function gn(e,t){var n={symbol:t,ohlcv_flag:1};return function(e){var t=Object.keys(e.d);if(0===t.length)return null;var n=e.d[t[0]];return{buyQuantity:n.totalbuyqty,sellQuantity:n.totalsellqty,buyOffers:n.bids.map(Gt),sellOffers:n.ask.map(Gt),openPrice:n.o,highPrice:n.h,lowPrice:n.l,closePrice:n.c,volume:n.v,priceChange:n.ch,priceChangePercent:n.chp,tradedQuantity:n.ltq,tradedPrice:n.ltq,tradedDate:n.ltt,netPrice:n.atp,lowerCircuitPrice:n.lower_ckt,upperCircuitPrice:n.upper_ckt,expiryDate:n.expiry,openInterest:n.oi,openInterestEnabled:n.oiflag,previousOpenInterest:n.pdoi,openInterestChangePercent:n.oipercent}}(await Be(Pt(e),n))}function vn(e,t,n){return He(0,{exchange:t,segment:n})}async function Cn(e){return(await ze(Pt(e))).data}async function Dn(e){return t=await Ge(Pt(e)),{details:(n=0===t.data.length?[]:t.data).map(Vt),overall:Xt(n)};var t,n}function In(e,t){var n={recordLst:t.map(Yt)};return Ve(Pt(e),n)}async function Pn(e,t){var n={transactionId:t},r=(await Xe(Pt(e),n)).data;return r.FAILED_CNT>0?-r.FAILED_CNT:r.SUCEESS_CNT}n.Fyers=class{constructor(e,t){this.appId=e,this.accessToken=t}static authorizationStep1(e,t,n="default"){return Wt(e,t,n)}static authorizationStep2(e,t){return jt(e,t)}getProfile(){return $t(this)}getFunds(){return Zt(this)}getHoldings(){return en(this)}getOrder(e){return tn(this,e)}getOrders(){return nn(this)}getPositions(){return rn(this)}getTrades(){return on(this)}placeOrder(e){return an(this,e)}placeOrders(e){return un(this,e)}modifyOrder(e){return sn(this,e)}modifyOrders(e){return cn(this,e)}cancelOrder(e){return ln(this,e)}cancelOrders(e){return dn(this,e)}exitPosition(e){return pn(this,e)}exitAllPositions(){return yn(this)}convertPosition(e){return fn(this,e)}getMarketStatus(){return mn(this)}getMarketHistory(e){return Tn(this,e)}getMarketQuotes(e){return hn(this,e)}getMarketDepth(e){return gn(this,e)}static getSymbolMaster(e,t){return vn(0,e,t)}generateEdisTpin(){return Cn(this)}getEdisTransactions(){return Dn(this)}submitEdisHoldingsStep(e){return In(this,e)}inquireEdisTransaction(e){return Pn(this,e)}},n.appendix=ae,n.authorizationStep1=Wt,n.authorizationStep2=jt,n.cancelOrder=ln,n.cancelOrders=dn,n.commodityFuturesCharges=function(e,t){return"BUY"===e?(n=t,(r=Math.min(20,Jt(n,.03)))+Jt(r,18)+Jt(n,.0026)+Jt(n,.0018)+Jt(n,.002)+Jt(n,1e-4)):function(e){var t=Math.min(20,Jt(e,.03)),n=Jt(e,.01);return t+n+Jt(t+n,18)+Jt(e,.0026)+Jt(e,.0018)+Jt(e,.002)+Jt(e,1e-4)}(t);var n,r},n.commodityOptionsCharges=function(e,t){return"BUY"===e?(n=t,20+Jt(20,18)+Jt(n,.05)+Jt(n,3e-4)+Jt(n,1e-4)):function(e){var t=Jt(e,.05);return 20+t+Jt(20+t,18)+Jt(e,.05)+Jt(e,3e-4)+Jt(e,1e-4)}(t);var n},n.convertPosition=fn,n.currencyFuturesCharges=function(e,t){return n=t,(r=Math.min(20,Jt(n,.03)))+Jt(r,18)+Jt(n,.00115)+Jt(n,5e-4)+Jt(n,1e-4)+Jt(n,1e-4);var n,r},n.currencyOptionsCharges=function(e,t){return n=t,20+Jt(20,18)+Jt(n,.04)+Jt(n,.009)+Jt(n,1e-4)+Jt(n,1e-4);var n},n.day2=m,n.day2Description=f,n.equityDeliveryCharges=function(e,t){return"BUY"===e?Kt(t):12.5+Kt(t)},n.equityFuturesCharges=function(e,t){return"BUY"===e?(n=t,(r=Math.min(20,Jt(n,.03)))+Jt(r,18)+Jt(n,.0019)+Jt(n,5e-4)+Jt(n,.002)+Jt(n,1e-4)):function(e){var t=Math.min(20,Jt(e,.03)),n=Jt(e,.01);return t+n+Jt(t+n,18)+Jt(e,.0019)+Jt(e,5e-4)+Jt(e,.002)+Jt(e,1e-4)}(t);var n,r},n.equityIntradayCharges=function(e,t){return"BUY"===e?(n=t,(r=Math.min(20,Jt(n,.03)))+Jt(r,18)+Jt(n,.00325)+Jt(n,.003)+Jt(n,1e-4)):function(e){var t=Math.min(20,Jt(e,.03)),n=Jt(e,.025);return t+n+Jt(t+n,18)+Jt(e,.00325)+Jt(e,.003)+Jt(e,1e-4)}(t);var n,r},n.equityOptionsCharges=function(e,t){return"BUY"===e?(n=t,20+Jt(20,18)+Jt(n,.053)+Jt(n,.009)+Jt(n,.003)+Jt(n,1e-4)):function(e){var t=Jt(e,.05);return 20+t+Jt(20+t,18)+Jt(e,.053)+Jt(e,.009)+Jt(e,.003)+Jt(e,1e-4)}(t);var n},n.errorDescription=i,n.exchange=function(e){return We(v(e))},n.exchangeDescription=function(e){return g((t=e,Ke.get(t)));var t},n.exitAllPositions=yn,n.exitPosition=pn,n.generateEdisTpin=Cn,n.getEdisTransactions=Dn,n.getFunds=Zt,n.getHoldings=en,n.getMarketDepth=gn,n.getMarketHistory=Tn,n.getMarketQuotes=hn,n.getMarketStatus=mn,n.getOrder=tn,n.getOrders=nn,n.getPositions=rn,n.getProfile=$t,n.getSymbolMaster=vn,n.getTrades=on,n.holdingType=function(e){return j(e)},n.holdingTypeDescription=function(e){return W(e)},n.http=Ye,n.inquireEdisTransaction=Pn,n.instrumentType=function(e){return It(oe(e))},n.instrumentTypeDescription=function(e){return ie((t=e,Dt.get(t)));var t},n.modifyOrder=sn,n.modifyOrders=cn,n.month1=y,n.month1Description=p,n.month3=c,n.month3Description=s,n.optionType=function(e){return t=J(e),gt.get(t);var t},n.optionTypeDescription=function(e){return Y((t=e,vt.get(t)));var t},n.orderSide=function(e){return at(A(e))},n.orderSideDescription=function(e){return U(ut(e))},n.orderSource=function(e){return lt(q(e))},n.orderSourceDescription=function(e){return F((t=e,ct.get(t)));var t},n.orderStatus=function(e){return yt(x(e))},n.orderStatusDescription=function(e){return L((t=e,pt.get(t)));var t},n.orderType=function(e){return Tt(z(e))},n.orderTypeDescription=function(e){return H(ht(e))},n.orderValidity=function(e){return V(e)},n.orderValidityDescription=function(e){return V(e)},n.placeOrder=an,n.placeOrders=un,n.positionSide=function(e){return nt(b(e))},n.positionSideDescription=function(e){return O(rt(e))},n.productType=function(e){return te(e)},n.productTypeDescription=function(e){return ee(e)},n.segment=function(e){return Ze(P(e))},n.segmentDescription=function(e){return I((t=e,$e.get(t)));var t},n.submitEdisHoldingsStep=In,n.year2=a,n.year2Description=o},{}]},{},[1])(1)})); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).extra_fyers=e()}}((function(){return function e(t,n,r){function i(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,(function(e){return i(t[a][1][e]||e)}),l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=new Map([[-209,"Invalid order id"],[-101,"Invalid order type"],[-305,"For CO orders only market and limit orders are allowed"],[-323,"For BO orders only market and limit orders are allowed"],[-308,"Invalid limit price"],[-309,"Invalid stop price"],[-310,"Invalid order quantity"],[-311,"Invalid stop loss price"],[-313,"Invalid order side of either buy or sell"],[-314,"Invalid product type for the order"],[-315,"Invalid price for stop limit order"],[-316,"Invalid stop loss price for CO/BO orders"],[-323,"Invalid stop loss value"],[-325,"Ivalid target value (take_profit)"],[-326,"Invalid order validity"],[-327,"Invalid order disclosed quantity"],[-328,"Invalid order offline flag"],[-201,"Connection issue while processing your request"],[-202,"Connection timed out"],[-204,"Request wasnt processed"],[-205,"Market wasnt able to accept or process the request"],[-157,"User doesnt exist"],[-159,"Invalid order number"],[-161,"This order has already been cancelled"],[-162,"This order has already traded"],[-163,"Order modfication wasnt done successfully"],[-164,"This order has already been rejected"],[-390,"Invalid stop price"],[-392,"Price is not in multiples of tick size"],[-353,"API limit exceeded"],[-372,"Invalid price"],[-397,"Position quantity is zero"],[-398,"No open positions"],[-399,"No pending orders to be closed/cancelled"],[-329,"Please check if exit positions is complete"],[-373,"No permission"],[-374,"Invalid authorization code (auth_code)"],[-371,"Invalid SHA256 hash of (app_id:secret_key)"],[-17,"Invalid access token used for authentication"],[-352,"Invalid app id"],[-96,"An unexpected error occurred when processing request"],[-351,"Greater than 50 symbols"],[-300,"Invalid symbol"],[-310,"Invalid symbols"],[-301,"Invalid resolution format"],[-302,"Invalid historical timestamp from when you require data"],[-303,"Invalid historical timestamp till when you require data"],[-356,"The range_from value cannot be greater than range_to value"],[-334,"Invalid key date format value"],[-335,"Historical timestamp from when you require data not in epoch format"],[-336,"Historical timestamp till when you require data not in epoch format"],[-337,"Historical timestamp from when you require data not in YYYY-MM-DD format"],[-338,"Historical timestamp till when you require data not in YYYY-MM-DD format"],[-339,"The range cannot be more than 1 year for day resolution"],[-341,"The range cannot be more than 100 days for 1 min resolution"],[-343,"The range cannot be more than 100 days for 2 min resolution"],[-344,"The range cannot be more than 100 days for 3 min resolution"],[-345,"The range cannot be more than 100 days for 5 min resolution"],[-346,"The range cannot be more than 100 days for 10 min resolution"],[-347,"The range cannot be more than 100 days for 15 min resolution"],[-348,"The range cannot be more than 100 days for 20 min resolution"],[-349,"The range cannot be more than 100 days for 30 min resolution"],[-353,"The range cannot be more than 100 days for 60 min resolution"],[-354,"The range cannot be more than 100 days for 120 min resolution"],[-355,"The range cannot be more than 100 days for 240 min resolution"]]);function i(e){return r.get(e)}function o(e){return parseInt(e,10)>50?"19"+e:"20"+e}function a(e){return e.substring(2)}const u=new Map([["JAN","January"],["FEB","February"],["MAR","March"],["APR","April"],["MAY","May"],["JUN","June"],["JUL","July"],["AUG","August"],["SEP","September"],["OCT","October"],["NOV","November"],["DEC","December"]]);function s(e){return u.get(e)}function c(e){return e.substring(0,3).toUpperCase()}const l=new Map([["1","January"],["2","February"],["3","March"],["4","April"],["5","May"],["6","June"],["7","July"],["8","August"],["9","September"],["O","October"],["N","November"],["D","December"]]),d=new Map([["JAN","1"],["FEB","2"],["MAR","3"],["APR","4"],["MAY","5"],["JUN","6"],["JUL","7"],["AUG","8"],["SEP","9"],["OCT","O"],["NOV","N"],["DEC","D"]]);function p(e){return l.get(e)}function y(e){var t=e.substring(0,3).toUpperCase();return d.get(t)}function f(e){return e.replace(/^0+/,"")}function m(e){return e.padStart(2,"0")}const T=new Map([[10,"National Stock Exchange (NSE)"],[11,"Multi Commodity Exchange (MCX)"],[12,"Bombay Stock Exchange (BSE)"]]),h=new Map([["N",10],["M",11],["B",12]]);function g(e){return T.get(e)}function v(e){var t=e.charAt(0).toUpperCase();return h.get(t)}const D=new Map([[10,"Capital Market (CM)"],[11,"Equity Derivatives (FO)"],[12,"Currency Derivatives (CD)"],[20,"Commodity Derivatives (COM)"]]),C=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function I(e){return D.get(e)}function P(e){var t="CM";return/^com/i.test(e)?t="COM":/^cur/i.test(e)?t="CD":/der|fut|opt/i.test(e)&&(t="FO"),C.get(t)}const E=new Map([[1,"Long"],[-1,"Short"],[0,"Closed position"]]),M=new Map([["L",1],["S",-1],["C",0]]);function O(e){return E.get(e)}function b(e){var t=e.charAt(0).toUpperCase();return M.get(t)}const S=new Map([[1,"Buy"],[-1,"Sell"]]),U=new Map([["B",1],["S",-1]]);function R(e){return S.get(e)}function A(e){var t=e.charAt(0).toUpperCase();return U.get(t)}const w=new Map([["M","Mobile"],["W","Web"],["R","Fyers One"],["A","Admin"],["ITS","API"]]),N=new Map([["MO","M"],["WE","W"],["ON","R"],["AD","A"],["AP","ITS"]]);function F(e){return w.get(e)}function q(e){var t=e.split(" "),n=t[t.length-1].substring(0,2).toUpperCase();return N.get(n)}const _=new Map([[1,"Cancelled"],[2,"Traded / Filled"],[3,"For future use"],[4,"Transit"],[5,"Rejected"],[6,"Pending"],[7,"Expired"]]),k=new Map([["C",1],["F",2],["T",4],["R",5],["P",6],["E",7]]);function x(e){return _.get(e)}function L(e){/traded/i.test(e)&&(e="Filled");var t=e.charAt(0).toUpperCase();return k.get(t)}const Q=new Map([[1,"Limit order"],[2,"Market order"],[3,"Stop order (SL-M)"],[4,"Stoplimit order (SL-L)"]]),B=new Map([["L",1],["M",2],["S",3],["R",4]]);function G(e){return Q.get(e)}function X(e){var t=e.charAt(0).toUpperCase();return/s.+l(?!oss)/i.test(e)&&(t="R"),B.get(t)}const H=new Map([["DAY","End of day validity (DAY)"],["IOC","Immediate or Cancel validity (IOC)"]]);function Y(e){return/ioc|imm/i.test(e)?"IOC":"DAY"}const z=new Map([["CE","Call Option (CE)"],["PE","Put Option (PE)"]]);function V(e){return z.get(e)}function J(e){return/^[ps]/i.test(e)?"PE":"CE"}const K=new Map([["T1","The shares are purchased but not yet delivered to the demat account"],["HLD","The shares are purchased and are available in the demat account"]]);function W(e){return K.get(e)}function j(e){return/not|un/i.test(e)?"T1":"HLD"}const $=new Map([["CNC","Cash N Carry or Delivery Order, for equity only (CNC)"],["INTRADAY","Intraday Order, applicable for all segments (INTRADAY)"],["MARGIN","Margin Order, applicable only for derivatives (MARGIN)"],["CO","Cover Order (CO)"],["BO","Bracket Order (BO)"]]),Z=new Map([["D","CNC"],["I","INTRADAY"],["M","MARGIN"],["M","MARGIN"],["C","CO"],["B","BO"]]);function ee(e){return $.get(e)}function te(e){/cnc|cash|carry/i.test(e)&&(e="Delivery");var t=e.charAt(0).toUpperCase();return Z.get(t)}const ne=new Map([[0,"Equity Shares (EQ)"],[1,"Preference Shares (PREFSHARES)"],[2,"Collateral-free Debt (DEBENTURES)"],[3,"Warrants on Stock (WARRANTS)"],[4,"Miscellaneous (MISC)"],[10,"Stock Market Index (INDEX)"],[11,"Futures on Index (FUTIDX)"],[12,"Futures on Volatility Index (FUTIVX)"],[13,"Futures on Stock (FUTSTK)"],[14,"Options on Index (OPTIDX)"],[15,"Options on Stock (OPTSTK)"],[16,"Futures on Currency (FUTCUR)"],[17,"Futures on Government of India Treasury Bills (FUTIRT)"],[18,"Futures on Government of India Bonds (FUTIRC)"],[19,"Options on Currency (OPTCUR)"],[20,"Underlying on Currency (UNDCUR)"],[21,"Underlying on Government of Bonds (UNDIRC)"],[22,"Underlying on Government of India Treasury Bills (UNDIRT)"],[23,"Underlying on 10 Year Notional coupon bearing GOI security (UNDIRD)"],[24,"Market-indexed Certificate of deposit (INDEX_CD)"],[25,"Futures on 10 Year Notional coupon bearing GOI security (FUTIRD)"],[30,"Futures on Commodity (FUTCOM)"],[31,"Options on Commodity Futures (OPTFUT)"],[32,"Options on Commodity (OPTCOM)"]]),re=new Map([["EQ",0],["PREFSHARES",1],["DEBENTURES",2],["WARRANTS",3],["MISC",4],["INDEX",10],["FUTIDX",11],["FUTIVX",12],["FUTSTK",13],["OPTIDX",14],["OPTSTK",15],["FUTCUR",16],["FUTIRT",17],["FUTIRC",18],["OPTCUR",19],["UNDCUR",20],["UNDIRC",21],["UNDIRT",22],["UNDIRD",23],["INDEX_CD",24],["FUTIRD",25],["FUTCOM",30],["OPTFUT",31],["OPTCOM",32]]);function ie(e){return ne.get(e)}function oe(e){var t="EQ",n=/fut|future/i.test(e),r=/opt|option/i.test(e),i=/idx|index/i.test(e),o=/und|underlying/i.test(e);return t=/com(\b|$)|commodit/i.test(e)?r?n?"OPTFUT":"OPTCOM":i?"FUTIDX_COM":"FUTCOM":/(^|\b)und|cd(\b|$)|ir[cdt](\b|$)|cur|gov|bond|trea|coup/i.test(e)?/irc(\b|$)|bond/i.test(e)?o?"UNDIRC":"FUTIRC":/ird(\b|$)|coup/i.test(e)?o?"UNDIRD":"FUTIRD":/irt(\b|$)|trea/i.test(e)?o?"UNDIRT":"FUTIRT":i?"INDEX_CD":r?"OPTCUR":"FUTCUR":n||r?/ivx|volatil/i.test(e)?"FUTIVX":i?r?"OPTIDX":"FUTIDX":r?"OPTSTK":"FUTSTK":i?"INDEX":/misc/i.test(e)?"MISC":/warrant/i.test(e)?"WARRANTS":/deb/i.test(e)?"DEBENTURES":/pref/i.test(e)?"PREFSHARES":"EQ",re.get(t)}var ae=Object.freeze({__proto__:null,errorDescription:i,year2Description:o,year2:a,month3Description:s,month3:c,month1Description:p,month1:y,day2Description:f,day2:m,exchangeDescription:g,exchange:v,segmentDescription:I,segment:P,positionSideDescription:O,positionSide:b,orderSideDescription:R,orderSide:A,orderSourceDescription:F,orderSource:q,orderStatusDescription:x,orderStatus:L,orderTypeDescription:G,orderType:X,orderValidityDescription:function(e){return H.get(e)},orderValidity:Y,optionTypeDescription:V,optionType:J,holdingTypeDescription:W,holdingType:j,productTypeDescription:ee,productType:te,instrumentTypeDescription:ie,instrumentType:oe});function ue(e,t){var n=new Error(t);return n.code=e.status,n.response=null,n}function se(e,t){return null!=t.headers&&(!!t.headers.hasOwnProperty(e)||!!t.headers.hasOwnProperty(e.toLowerCase()))}function ce(e,t){return new Promise(((n,r)=>{var i=t.url,o=t.method||"GET",a=!1,u=!1,s=!1,c=new XMLHttpRequest;c.open(o,i),function(e,t){for(var n in null==t.body||se("Content-Type",t)||e.setRequestHeader("Content-Type","application/json; charset=utf-8"),se("Accept",t)||e.setRequestHeader("Accept","application/json, text/*"),t.headers)e.setRequestHeader(n,t.headers[n])}(c,t),t.timeout&&(c.timeout=t.timeout),c.responseType=e,c.onerror=function(e){a=!0;var t=e.target;r(ue(t,"Unexpected error occurred"))},c.onabort=function(e){u=!0;var t=e.target;r(ue(t,"Request was aborted"))},c.ontimeout=function(e){s=!0;var t=e.target;r(ue(t,"Request timed out"))},c.onreadystatechange=function(t){if(!(a||u||s)){var o=t.target;if(function(e){return e.readyState===e.DONE}(o))try{var c=function(e,t){if("json"===t){if(!e.responseType)try{return JSON.parse(e.responseText)}catch(e){return null}}else if((!t||"text"===t)&&null==e.response)return e.responseText;return e.response}(o,e);!function(e,t=""){return e.status>=200&&e.status<300||304===e.status||/^file:\/\//i.test(t)}(o,i)?setTimeout((function(){a||u||s||r(function(e,t){var n=null;try{n=e.responseText}catch(e){n=t}var r=new Error(n);return r.code=e.status,r.response=t,r}(o,c))})):n(c)}catch(t){r(t)}}},null==t.body?c.send():t.body instanceof FormData||t.body instanceof URLSearchParams?c.send(t.body):c.send(JSON.stringify(t.body))}))}const le="https://api.fyers.in/api/v2/",de="https://api.fyers.in/data-rest/v2/",pe="https://public.fyers.in/sym_details/";function ye(e,t,n,r,i){var o=n+function(e){if(null==e)return"";var t=new URLSearchParams;for(var n in e)t.append(n,e[n]);return"?"+t.toString()}(r),a={};return null!=e&&(a.authorization=e.app_id+":"+e.access_token),{url:o,method:t,headers:a,body:i}}function fe(e,t,n,r,i){return ce("text",ye(e,t,n,r,i))}function me(e,t,n,r,i){return ce("json",ye(e,t,n,r,i))}function Te(e,t,n,r,i){return me(e,t,le+n,r,i)}function he(e,t,n,r,i){return me(e,t,de+n,r,i)}function ge(e){return ye(null,"GET",le+"generate-authcode",e,null)}function ve(e){return ye(null,"POST",le+"validate-authcode",null,e)}function De(e){return Te(e,"GET","profile",null,null)}function Ce(e){return Te(e,"GET","funds",null,null)}function Ie(e){return Te(e,"GET","holdings",null,null)}function Pe(e,t){return Te(e,"GET","orders",t,null)}function Ee(e){return Te(e,"GET","orders",null,null)}function Me(e){return Te(e,"GET","positions",null,null)}function Oe(e){return Te(e,"GET","tradebook",null,null)}function be(e,t){return Te(e,"POST","orders",null,t)}function Se(e,t){return Te(e,"POST","orders-multi",null,t)}function Ue(e,t){return Te(e,"PUT","orders",null,t)}function Re(e,t){return Te(e,"PUT","orders-multi",null,t)}function Ae(e,t){return Te(e,"DELETE","orders",null,t)}function we(e,t){return Te(e,"DELETE","orders-multi",null,t)}function Ne(e,t){return Te(e,"DELETE","positions",null,t)}function Fe(e){return Te(e,"DELETE","positions",null,{})}function qe(e,t){return Te(e,"PUT","positions",null,t)}function _e(e){return Te(e,"GET","market-status",null,null)}function ke(e,t){return he(e,"GET","history/",t,null)}function xe(e,t){return he(e,"GET","quotes/",t,null)}function Le(e,t){return he(e,"GET","depth/",t,null)}function Qe(e,t){var{exchange:n,segment:r}=t;return function(e,t,n,r,i){return fe(e,t,pe+n,r,i)}(null,"GET",n+"_"+r+".csv",null,null)}function Be(e){return Te(e,"GET","tpin",null,null)}function Ge(e){return Te(e,"GET","details",null,null)}function Xe(e,t){return ye(e,"POST","index",null,t)}function He(e,t){return Te(e,"POST","inquiry",null,t)}var Ye=Object.freeze({__proto__:null,API_URL:le,DATA_URL:de,SYMBOLS_URL:pe,authorizationStep1:ge,authorizationStep2:ve,getProfile:De,getFunds:Ce,getHoldings:Ie,getOrder:Pe,getOrders:Ee,getPositions:Me,getTrades:Oe,placeOrder:be,placeOrders:Se,modifyOrder:Ue,modifyOrders:Re,cancelOrder:Ae,cancelOrders:we,exitPosition:Ne,exitAllPositions:Fe,convertPosition:qe,getMarketStatus:_e,getMarketHistory:ke,getMarketQuotes:xe,getMarketDepth:Le,getSymbolMaster:Qe,generateEdisTpin:Be,getEdisTransactions:Ge,submitEdisHoldingsStep:Xe,inquireEdisTransaction:He});const ze=new Map([[10,"NSE"],[11,"MCX"],[12,"BSE"]]),Ve=new Map([["NSE",10],["MCX",11],["BSE",12]]);function Je(e){return ze.get(e)}const Ke=new Map([[10,"CM"],[11,"FO"],[12,"CD"],[20,"COM"]]),We=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function je(e){return Ke.get(e)}const $e=new Map([[1,"LONG"],[-1,"SHORT"],[0,"CLOSED"]]),Ze=new Map([["LONG",1],["SHORT",-1],["CLOSED",0]]);function et(e){return $e.get(e)}function tt(e){return Ze.get(e)}const nt=new Map([[1,"BUY"],[-1,"SELL"]]),rt=new Map([["BUY",1],["SELL",-1]]);function it(e){return nt.get(e)}function ot(e){return rt.get(e)}const at=new Map([["M","MOBILE"],["W","WEB"],["R","ONE"],["A","ADMIN"],["ITS","API"]]),ut=new Map([["MOBILE","M"],["WEB","W"],["ONE","R"],["ADMIN","A"],["API","ITS"]]);function st(e){return at.get(e)}const ct=new Map([[1,"CANCELLED"],[2,"TRADED"],[4,"TRANSIT"],[5,"REJECTED"],[6,"PENDING"],[7,"EXPIRED"]]),lt=new Map([["CANCELLED",1],["TRADED",2],["TRANSIT",4],["REJECTED",5],["PENDING",6],["EXPIRED",7]]);function dt(e){return ct.get(e)}const pt=new Map([[1,"LIMIT"],[2,"MARKET"],[3,"SL-MARKET"],[4,"SL-LIMIT"]]),yt=new Map([["LIMIT",1],["MARKET",2],["SL-MARKET",3],["SL-LIMIT",4]]);function ft(e){return pt.get(e)}function mt(e){return yt.get(e)}const Tt=new Map([["CE","CALL"],["PE","PUT"]]),ht=new Map([["CALL","CE"],["PUT","PE"]]);const gt=new Map([[0,"EQ"],[1,"PREFSHARES"],[2,"DEBENTURES"],[3,"WARRANTS"],[4,"MISC"],[10,"INDEX"],[11,"FUTIDX"],[12,"FUTIVX"],[13,"FUTSTK"],[14,"OPTIDX"],[15,"OPTSTK"],[16,"FUTCUR"],[17,"FUTIRT"],[18,"FUTIRC"],[19,"OPTCUR"],[20,"UNDCUR"],[21,"UNDIRC"],[22,"UNDIRT"],[23,"UNDIRD"],[24,"INDEX_CD"],[25,"FUTIRD"],[30,"FUTCOM"],[31,"OPTFUT"],[32,"OPTCOM"]]),vt=new Map([["EQ",0],["PREFSHARES",1],["DEBENTURES",2],["WARRANTS",3],["MISC",4],["INDEX",10],["FUTIDX",11],["FUTIVX",12],["FUTSTK",13],["OPTIDX",14],["OPTSTK",15],["FUTCUR",16],["FUTIRT",17],["FUTIRC",18],["OPTCUR",19],["UNDCUR",20],["UNDIRC",21],["UNDIRT",22],["UNDIRD",23],["INDEX_CD",24],["FUTIRD",25],["FUTCOM",30],["OPTFUT",31],["OPTCOM",32]]);function Dt(e){return gt.get(e)}function Ct(e){return{app_id:e.appId,access_token:e.accessToken}}function It(e){return{isin:e.isin,symbol:e.symbol,exchange:Je(e.exchange),type:e.holdingType,quantity:e.quantity,remainingQuantity:e.remainingQuantity,buyPrice:e.costPrice,buyValue:e.costPrice*e.quantity,currentPrice:e.ltp,currentValue:e.marketVal,returns:e.pl,returnsPercent:e.pl/(e.costPrice*e.quantity)}}function Pt(e,t){var n=0;for(var r of e)"HLD"===r.holdingType&&n++;return{count:t.count_total,settledCount:n,investedValue:t.total_investment,currentValue:t.total_current_value,returns:t.total_pl,returnsPercent:t.pnl_perc}}function Et(e){return{id:e.id,symbol:e.symbol,ticker:e.ex_sym,description:e.description,segment:je(e.segment),instrument:Dt(e.instrument),exchange:Je(e.exchange),type:ft(e.type),side:it(e.side),productType:e.productType,source:st(e.source)||null,status:dt(e.status),offline:"True"===e.offlineOrder,limitPrice:e.limitPrice,stopPrice:e.stopPrice,quantity:e.qty,remainingQuantity:e.remainingQuantity,tradedQuantity:e.filledQty,disclosedQuantity:e.discloseQty,remainingDisclosedQuantity:e.dqQtyRem,validity:e.orderValidity,date:e.orderDateTime,parentId:e.parentId||null,priceChange:e.ch,priceChangePercent:e.chp,currentPrice:e.lp,tradedPrice:e.tradedPrice,message:e.message,pan:e.pan||null,clientId:e.clientId||null}}function Mt(e){var t={count:0,openCount:0,closedCount:0,quantity:0,remainingQuantity:0,tradedQuantity:0,disclosedQuantity:0,remainingDisclosedQuantity:0};for(var n of e)t.count++,t.openCount+=6===n.status||4===n.status?1:0,t.quantity+=n.qty,t.remainingQuantity+=n.remainingQuantity,t.tradedQuantity+=n.filledQty,t.disclosedQuantity+=n.discloseQty,t.remainingDisclosedQuantity+=n.dqQtyRem;return t.closedCount=t.count-t.openCount,t}function Ot(e){return{id:e.id,symbol:e.symbol,segment:je(e.segment),productType:e.productType,side:et(e.side),quantity:e.qty,quantityMultiplier:e.qtyMulti_com,buyPrice:e.buyAvg,buyQuantity:e.buyQty,buyValue:e.buyVal,sellPrice:e.sellAvg,sellQuantity:e.sellQty,sellValue:e.sellVal,netPrice:e.netAvg,netQuantity:e.netQty,returns:e.pl,realizedReturns:e.realized_profit,unrealizedReturns:e.unrealized_profit,crossCurrency:"Y"===e.crossCurrency,rbiRefRate:e.rbiRefRate,currentPrice:e.ltp}}function bt(e,t){var n=0,r=0;for(var i of e)n+=i.buyVal,r+=i.sellVal;return{count:t.count_total,openCount:t.count_open,closedCount:t.count_total-t.count_open,buyValue:n,sellValue:r,returns:t.pl_total,realizedReturns:t.pl_realized,unrealizedReturns:t.pl_unrealized}}function St(e){return{id:e.id,orderId:e.orderNumber,symbol:e.symbol,segment:je(e.segment),exchange:Je(e.exchange),side:it(e.transactionType),productType:e.productType,orderType:ft(e.orderType),orderDate:e.orderDateTime,price:e.tradePrice,quantity:e.tradedQty,value:e.tradeValue,clientId:e.clientId}}function Ut(e){var t={count:0,quantity:0,value:0};for(var n of e)t.count++,t.quantity+=n.tradedQty,t.value+=n.tradeValue;return t}function Rt(e){return{symbol:e.symbol,type:mt(e.type||"MARKET"),side:ot(e.side||"BUY"),productType:e.productType||"CNC",limitPrice:e.limitPrice||0,stopPrice:e.stopPrice||0,qty:e.quantity,disclosedQty:e.disclosedQuantity||0,validity:e.validity||"DAY",offlineOrder:e.offline?"True":"False",stopLoss:e.stopLoss||0,takeProfit:e.takeProfit||0}}function At(e){return{id:e.id,type:mt(e.type),qty:e.quantity,disclosedQty:e.disclosedQuantity,limitPrice:e.limitPrice,stopPrice:e.stopPrice}}function wt(e){return{exchange:Je(e.exchange),segment:je(e.segment),type:e.market_type,status:e.status}}function Nt(e){var t={count:0,openCount:0,closedCount:0};for(var n of e)t.count++,"OPEN"===n.status?t.openCount++:t.closedCount++;return t}const Ft=[1,2,3,5,10,15,20,30,60,120,240,1440];function qt(e){var t=1,n=1/0;for(var r of Ft){var i=Math.abs(e-r);i<n&&(t=r,n=i)}return 1440===t?"D":t.toString()}function _t(e){return{date:e[0],openPrice:e[1],highPrice:e[2],lowPrice:e[3],closePrice:e[4],volume:e[5]}}function kt(e){return{date:e.t,openPrice:e.o,highPrice:e.h,lowPrice:e.l,closePrice:e.c,volume:e.v}}function xt(e){var t={fromDate:0,toDate:0,openPrice:0,highPrice:0,lowPrice:0,closePrice:0,volume:0};if(0===e.length)return t;var n=e.length-1;for(var r of(t.fromDate=e[0][0],t.toDate=e[n][0],t.openPrice=e[0][1],t.highPrice=e[0][2],t.lowPrice=e[0][3],t.closePrice=e[n][4],e))t.highPrice=Math.max(t.highPrice,r[2]),t.lowPrice=Math.min(t.lowPrice,r[3]),t.volume+=r[5];return t}function Lt(e){var t=e.v;return{symbol:e.n,name:t.short_name,exchange:t.exchange,description:t.description,priceChange:t.ch,priceChangePercent:t.chp,currentPrice:t.lp,priceSpread:t.spread,sellPrice:t.ask,buyPrice:t.bid,openPrice:t.open_price,highPrice:t.high_price,lowPrice:t.low_price,closePrice:t.prev_close_price,volume:t.volume,date:t.tt,candle:kt(t.cmd)}}function Qt(e){return{price:e.price,volume:e.volume,orders:e.ord}}function Bt(e){return{id:e.transactionId,isin:e.isin,quantity:e.qty,remainingQuantity:e.qty-e.qtyUtlize,entryDate:e.entryDate,startDate:e.startDate,endDate:e.endDate,source:e.source,status:e.status,clientId:e.clientId,errorCode:e.errCode,errorCount:e.errorCount,reason:e.reason}}function Gt(e){var t={count:0,quantity:0,remainingQuantity:0};for(var n of e)t.count++,t.quantity+=n.qty,t.remainingQuantity+=n.qty-n.qtyUtlize;return t}function Xt(e){return{isin_code:e.isin,qty:e.quantity}}function Ht(e,t){return.01*Math.round(e*t)}function Yt(e){return Ht(e,.1)+Ht(e,18)+Ht(e,.00325)+Ht(e,.015)+Ht(e,1e-4)}function zt(e,t,n="default"){var r;return ge({client_id:(r={appId:e,redirectUrl:t,state:n}).appId,redirect_uri:r.redirectUrl,response_type:"code",state:r.state})}function Vt(e,t){var n;return ve({grant_type:"authorization_code",appIdHash:(n={appHash:e,authorizationCode:t}).appHash,code:n.authorizationCode})}async function Jt(e){return t=await De(Ct(e)),{id:(n=t.data).fy_id,email:n.email_id,name:n.name,pan:n.PAN};var t,n}async function Kt(e){return function(e){var t={},n={};for(var r of e.fund_limit)switch(r.id){case 9:t.start=r.equityAmount,n.start=r.commodityAmount;break;case 6:t.deposits=r.equityAmount,n.deposits=r.commodityAmount;break;case 4:t.realizedReturns=r.equityAmount,n.realizedReturns=r.commodityAmount;break;case 5:t.collaterals=r.equityAmount,n.collaterals=r.commodityAmount;break;case 8:t.adhoc=r.equityAmount,n.adhoc=r.commodityAmount;break;case 2:t.utilized=r.equityAmount,n.utilized=r.commodityAmount;break;case 7:t.receivables=r.equityAmount,n.receivables=r.commodityAmount;break;case 10:t.available=r.equityAmount,n.available=r.commodityAmount;break;case 3:t.clear=r.equityAmount,n.clear=r.commodityAmount;break;case 1:t.total=r.equityAmount,n.total=r.commodityAmount}return{equity:t,commodity:n}}(await Ce(Ct(e)))}async function Wt(e){return{details:(t=await Ie(Ct(e))).holdings.map(It),overall:Pt(t.holdings,t.overall)};var t}async function jt(e,t){var n={id:t};return Et((await Pe(Ct(e),n)).orderBook[0])}async function $t(e){return{details:(t=await Ee(Ct(e))).orderBook.map(Et),overall:Mt(t.orderBook)};var t}async function Zt(e){return{details:(t=await Me(Ct(e))).netPositions.map(Ot),overall:bt(t.netPositions,t.overall)};var t}async function en(e){return{details:(t=await Oe(Ct(e))).tradeBook.map(St),overall:Ut(t.tradeBook)};var t}async function tn(e,t){var n=Rt(t);return(await be(Ct(e),n)).id}async function nn(e,t){var n=t.map(Rt);return(await Se(Ct(e),n)).data.map((e=>e.body.id))}async function rn(e,t){var n=At(t);return(await Ue(Ct(e),n)).id}async function on(e,t){var n=t.map(At);return(await Re(Ct(e),n)).data.map((e=>e.body.id))}async function an(e,t){var n={id:t};return(await Ae(Ct(e),n)).id}async function un(e,t){var n=t.map((e=>({id:e})));return(await we(Ct(e),n)).data.map((e=>e.body.id))}async function sn(e,t){var n={id:t};return(await Ne(Ct(e),n)).s}async function cn(e){return(await Fe(Ct(e))).s}async function ln(e,t){var n,r={symbol:(n=t).symbol,positionSide:tt(n.side||"LONG"),convertQty:n.quantity,convertFrom:n.fromProductType||"INTRADAY",convertTo:n.toProductType||"CNC"};return(await qe(Ct(e),r)).s}async function dn(e){return{details:(t=await _e(Ct(e))).marketStatus.map(wt),overall:Nt(t.marketStatus)};var t}async function pn(e,t){var n,r={symbol:(n=t).symbol,resolution:qt(n.resolution),date_format:0,range_from:n.fromDate.toString(),range_to:n.toDate.toString(),cont_flag:n.continuous?"1":"0"};return function(e){return{details:e.candles.map(_t),overall:xt(e.candles)}}(await ke(Ct(e),r))}async function yn(e,t){var n={symbols:t.join()};return(await xe(Ct(e),n)).d.map(Lt)}async function fn(e,t){var n={symbol:t,ohlcv_flag:1};return function(e){var t=Object.keys(e.d);if(0===t.length)return null;var n=e.d[t[0]];return{buyQuantity:n.totalbuyqty,sellQuantity:n.totalsellqty,buyOffers:n.bids.map(Qt),sellOffers:n.ask.map(Qt),openPrice:n.o,highPrice:n.h,lowPrice:n.l,closePrice:n.c,volume:n.v,priceChange:n.ch,priceChangePercent:n.chp,tradedQuantity:n.ltq,tradedPrice:n.ltq,tradedDate:n.ltt,netPrice:n.atp,lowerCircuitPrice:n.lower_ckt,upperCircuitPrice:n.upper_ckt,expiryDate:n.expiry,openInterest:n.oi,openInterestEnabled:n.oiflag,previousOpenInterest:n.pdoi,openInterestChangePercent:n.oipercent}}(await Le(Ct(e),n))}function mn(e,t,n){return Qe(0,{exchange:t,segment:n})}async function Tn(e){return(await Be(Ct(e))).data}async function hn(e){return t=await Ge(Ct(e)),{details:(n=0===t.data.length?[]:t.data).map(Bt),overall:Gt(n)};var t,n}function gn(e,t){var n={recordLst:t.map(Xt)};return Xe(Ct(e),n)}async function vn(e,t){var n={transactionId:t},r=(await He(Ct(e),n)).data;return r.FAILED_CNT>0?-r.FAILED_CNT:r.SUCEESS_CNT}n.Fyers=class{constructor(e,t){this.appId=e,this.accessToken=t}static authorizationStep1(e,t,n="default"){return zt(e,t,n)}static authorizationStep2(e,t){return Vt(e,t)}getProfile(){return Jt(this)}getFunds(){return Kt(this)}getHoldings(){return Wt(this)}getOrder(e){return jt(this,e)}getOrders(){return $t(this)}getPositions(){return Zt(this)}getTrades(){return en(this)}placeOrder(e){return tn(this,e)}placeOrders(e){return nn(this,e)}modifyOrder(e){return rn(this,e)}modifyOrders(e){return on(this,e)}cancelOrder(e){return an(this,e)}cancelOrders(e){return un(this,e)}exitPosition(e){return sn(this,e)}exitAllPositions(){return cn(this)}convertPosition(e){return ln(this,e)}getMarketStatus(){return dn(this)}getMarketHistory(e){return pn(this,e)}getMarketQuotes(e){return yn(this,e)}getMarketDepth(e){return fn(this,e)}static getSymbolMaster(e,t){return mn(0,e,t)}generateEdisTpin(){return Tn(this)}getEdisTransactions(){return hn(this)}submitEdisHoldingsStep(e){return gn(this,e)}inquireEdisTransaction(e){return vn(this,e)}},n.appendix=ae,n.authorizationStep1=zt,n.authorizationStep2=Vt,n.cancelOrder=an,n.cancelOrders=un,n.commodityFuturesCharges=function(e,t){return"BUY"===e?(n=t,(r=Math.min(20,Ht(n,.03)))+Ht(r,18)+Ht(n,.0026)+Ht(n,.0018)+Ht(n,.002)+Ht(n,1e-4)):function(e){var t=Math.min(20,Ht(e,.03)),n=Ht(e,.01);return t+n+Ht(t+n,18)+Ht(e,.0026)+Ht(e,.0018)+Ht(e,.002)+Ht(e,1e-4)}(t);var n,r},n.commodityOptionsCharges=function(e,t){return"BUY"===e?(n=t,20+Ht(20,18)+Ht(n,.05)+Ht(n,3e-4)+Ht(n,1e-4)):function(e){var t=Ht(e,.05);return 20+t+Ht(20+t,18)+Ht(e,.05)+Ht(e,3e-4)+Ht(e,1e-4)}(t);var n},n.convertPosition=ln,n.currencyFuturesCharges=function(e,t){return n=t,(r=Math.min(20,Ht(n,.03)))+Ht(r,18)+Ht(n,.00115)+Ht(n,5e-4)+Ht(n,1e-4)+Ht(n,1e-4);var n,r},n.currencyOptionsCharges=function(e,t){return n=t,20+Ht(20,18)+Ht(n,.04)+Ht(n,.009)+Ht(n,1e-4)+Ht(n,1e-4);var n},n.day2=m,n.day2Description=f,n.equityDeliveryCharges=function(e,t){return"BUY"===e?Yt(t):12.5+Yt(t)},n.equityFuturesCharges=function(e,t){return"BUY"===e?(n=t,(r=Math.min(20,Ht(n,.03)))+Ht(r,18)+Ht(n,.0019)+Ht(n,5e-4)+Ht(n,.002)+Ht(n,1e-4)):function(e){var t=Math.min(20,Ht(e,.03)),n=Ht(e,.01);return t+n+Ht(t+n,18)+Ht(e,.0019)+Ht(e,5e-4)+Ht(e,.002)+Ht(e,1e-4)}(t);var n,r},n.equityIntradayCharges=function(e,t){return"BUY"===e?(n=t,(r=Math.min(20,Ht(n,.03)))+Ht(r,18)+Ht(n,.00325)+Ht(n,.003)+Ht(n,1e-4)):function(e){var t=Math.min(20,Ht(e,.03)),n=Ht(e,.025);return t+n+Ht(t+n,18)+Ht(e,.00325)+Ht(e,.003)+Ht(e,1e-4)}(t);var n,r},n.equityOptionsCharges=function(e,t){return"BUY"===e?(n=t,20+Ht(20,18)+Ht(n,.053)+Ht(n,.009)+Ht(n,.003)+Ht(n,1e-4)):function(e){var t=Ht(e,.05);return 20+t+Ht(20+t,18)+Ht(e,.053)+Ht(e,.009)+Ht(e,.003)+Ht(e,1e-4)}(t);var n},n.errorDescription=i,n.exchange=function(e){return Je(v(e))},n.exchangeDescription=function(e){return g((t=e,Ve.get(t)));var t},n.exitAllPositions=cn,n.exitPosition=sn,n.generateEdisTpin=Tn,n.getEdisTransactions=hn,n.getFunds=Kt,n.getHoldings=Wt,n.getMarketDepth=fn,n.getMarketHistory=pn,n.getMarketQuotes=yn,n.getMarketStatus=dn,n.getOrder=jt,n.getOrders=$t,n.getPositions=Zt,n.getProfile=Jt,n.getSymbolMaster=mn,n.getTrades=en,n.holdingType=function(e){return j(e)},n.holdingTypeDescription=function(e){return W(e)},n.http=Ye,n.inquireEdisTransaction=vn,n.instrumentType=function(e){return Dt(oe(e))},n.instrumentTypeDescription=function(e){return ie((t=e,vt.get(t)));var t},n.modifyOrder=rn,n.modifyOrders=on,n.month1=y,n.month1Description=p,n.month3=c,n.month3Description=s,n.optionType=function(e){return t=J(e),Tt.get(t);var t},n.optionTypeDescription=function(e){return V((t=e,ht.get(t)));var t},n.orderSide=function(e){return it(A(e))},n.orderSideDescription=function(e){return R(ot(e))},n.orderSource=function(e){return st(q(e))},n.orderSourceDescription=function(e){return F((t=e,ut.get(t)));var t},n.orderStatus=function(e){return dt(L(e))},n.orderStatusDescription=function(e){return x((t=e,lt.get(t)));var t},n.orderType=function(e){return ft(X(e))},n.orderTypeDescription=function(e){return G(mt(e))},n.orderValidity=function(e){return Y(e)},n.orderValidityDescription=function(e){return Y(e)},n.placeOrder=tn,n.placeOrders=nn,n.positionSide=function(e){return et(b(e))},n.positionSideDescription=function(e){return O(tt(e))},n.productType=function(e){return te(e)},n.productTypeDescription=function(e){return ee(e)},n.segment=function(e){return je(P(e))},n.segmentDescription=function(e){return I((t=e,We.get(t)));var t},n.submitEdisHoldingsStep=gn,n.year2=a,n.year2Description=o},{}]},{},[1])(1)})); |
{ | ||
"name": "extra-fyers.web", | ||
"version": "0.0.57", | ||
"version": "0.0.58", | ||
"description": "A Javascript interface for FYERS API.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
170538