Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

extra-fyers.web

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-fyers.web - npm Package Compare versions

Comparing version 0.0.32 to 0.0.33

2

index.js

@@ -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")}var T;!function(e){e[e.NSE=10]="NSE",e[e.MCX=11]="MCX",e[e.BSE=12]="BSE"}(T||(T={}));const g=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 v(e){return g.get(e)}function C(e){var t=e.charAt(0).toUpperCase();return h.get(t)}var D;!function(e){e[e.Capital=10]="Capital",e[e.Derivative=11]="Derivative",e[e.Currency=12]="Currency",e[e.Commodity=20]="Commodity"}(D||(D={}));const I=new Map([[10,"Capital Market (CM)"],[11,"Equity Derivatives (FO)"],[12,"Currency Derivatives (CD)"],[20,"Commodity Derivatives (COM)"]]),E=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function P(e){return I.get(e)}function O(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"),E.get(t)}var S;!function(e){e[e.Long=1]="Long",e[e.Short=-1]="Short",e[e.Closed=0]="Closed"}(S||(S={}));const R=new Map([[1,"Long"],[-1,"Short"],[0,"Closed position"]]),U=new Map([["L",1],["S",-1],["C",0]]);function M(e){return R.get(e)}function b(e){var t=e.charAt(0).toUpperCase();return U.get(t)}var A;!function(e){e[e.Buy=1]="Buy",e[e.Sell=-1]="Sell"}(A||(A={}));const N=new Map([[1,"Buy"],[-1,"Sell"]]),w=new Map([["B",1],["S",-1]]);function F(e){return N.get(e)}function q(e){var t=e.charAt(0).toUpperCase();return w.get(t)}var _;!function(e){e.Mobile="M",e.Web="W",e.FyersOne="R",e.Admin="A",e.API="ITS"}(_||(_={}));const k=new Map([["M","Mobile"],["W","Web"],["R","Fyers One"],["A","Admin"],["ITS","API"]]),L=new Map([["MO","M"],["WE","W"],["ON","R"],["AD","A"],["AP","ITS"]]);function x(e){return k.get(e)}function Q(e){var t=e.split(" "),n=t[t.length-1].substring(0,2).toUpperCase();return L.get(n)}var B;!function(e){e[e.Cancelled=1]="Cancelled",e[e.Traded=2]="Traded",e[e.Unused=3]="Unused",e[e.Transit=4]="Transit",e[e.Rejected=5]="Rejected",e[e.Pending=6]="Pending",e[e.Expired=7]="Expired"}(B||(B={}));const X=new Map([[1,"Cancelled"],[2,"Traded / Filled"],[3,"For future use"],[4,"Transit"],[5,"Rejected"],[6,"Pending"],[7,"Expired"]]),H=new Map([["C",1],["F",2],["T",4],["R",5],["P",6],["E",7]]);function z(e){return X.get(e)}function G(e){/traded/i.test(e)&&(e="Filled");var t=e.charAt(0).toUpperCase();return H.get(t)}var V;!function(e){e[e.Limit=1]="Limit",e[e.Market=2]="Market",e[e.SlMarket=3]="SlMarket",e[e.SlLimit=4]="SlLimit"}(V||(V={}));const Y=new Map([[1,"Limit order"],[2,"Market order"],[3,"Stop order (SL-M)"],[4,"Stoplimit order (SL-L)"]]),K=new Map([["L",1],["M",2],["S",3],["R",4]]);function W(e){return Y.get(e)}function J(e){var t=e.charAt(0).toUpperCase();return/s.+l(?!oss)/i.test(e)&&(t="R"),K.get(t)}var j;!function(e){e.Day="DAY",e.IOC="IOC"}(j||(j={}));const $=new Map([["DAY","End of day validity (DAY)"],["IOC","Immediate or Cancel validity (IOC)"]]);function Z(e){return/ioc|imm/i.test(e)?"IOC":"DAY"}var ee;!function(e){e.Call="CE",e.Put="PE"}(ee||(ee={}));const te=new Map([["CE","Call Option (CE)"],["PE","Put Option (PE)"]]);function ne(e){return te.get(e)}function re(e){return/^[ps]/i.test(e)?"PE":"CE"}var ie;!function(e){e.Purchased="T1",e.Delivered="HLD"}(ie||(ie={}));const oe=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 ae(e){return oe.get(e)}function ue(e){return/not|un/i.test(e)?"T1":"HLD"}var se;!function(e){e.CNC="CNC",e.Intraday="INTRADAY",e.Margin="MARGIN",e.Cover="CO",e.Bracket="BO"}(se||(se={}));const ce=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)"]]),le=new Map([["D","CNC"],["I","INTRADAY"],["M","MARGIN"],["M","MARGIN"],["C","CO"],["B","BO"]]);function de(e){return ce.get(e)}function pe(e){/cnc|cash|carry/i.test(e)&&(e="Delivery");var t=e.charAt(0).toUpperCase();return le.get(t)}var ye;!function(e){e[e.EQ=0]="EQ",e[e.PREFSHARES=1]="PREFSHARES",e[e.DEBENTURES=2]="DEBENTURES",e[e.WARRANTS=3]="WARRANTS",e[e.MISC=4]="MISC",e[e.INDEX=10]="INDEX",e[e.FUTIDX=11]="FUTIDX",e[e.FUTIVX=12]="FUTIVX",e[e.FUTSTK=13]="FUTSTK",e[e.OPTIDX=14]="OPTIDX",e[e.OPTSTK=15]="OPTSTK",e[e.FUTCUR=16]="FUTCUR",e[e.FUTIRT=17]="FUTIRT",e[e.FUTIRC=18]="FUTIRC",e[e.OPTCUR=19]="OPTCUR",e[e.UNDCUR=20]="UNDCUR",e[e.UNDIRC=21]="UNDIRC",e[e.UNDIRT=22]="UNDIRT",e[e.UNDIRD=23]="UNDIRD",e[e.INDEX_CD=24]="INDEX_CD",e[e.FUTIRD=25]="FUTIRD",e[e.FUTCOM=30]="FUTCOM",e[e.OPTFUT=31]="OPTFUT",e[e.OPTCOM=32]="OPTCOM"}(ye||(ye={}));const fe=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)"]]),me=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 Te(e){return fe.get(e)}function ge(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",me.get(t)}var he=Object.freeze({__proto__:null,errorDescription:i,year2Description:o,year2:a,month3Description:s,month3:c,month1Description:p,month1:y,day2Description:f,day2:m,get Exchange(){return T},exchangeDescription:v,exchange:C,get Segment(){return D},segmentDescription:P,segment:O,get PositionSide(){return S},positionSideDescription:M,positionSide:b,get OrderSide(){return A},orderSideDescription:F,orderSide:q,get OrderSource(){return _},orderSourceDescription:x,orderSource:Q,get OrderStatus(){return B},orderStatusDescription:z,orderStatus:G,get OrderType(){return V},orderTypeDescription:W,orderType:J,get OrderValidity(){return j},orderValidityDescription:function(e){return $.get(e)},orderValidity:Z,get OptionType(){return ee},optionTypeDescription:ne,optionType:re,get HoldingType(){return ie},holdingTypeDescription:ae,holdingType:ue,get ProductType(){return se},productTypeDescription:de,productType:pe,get InstrumentType(){return ye},instrumentTypeDescription:Te,instrumentType:ge});function ve(e,t){var n=new Error(t);return n.code=e.status,n.response=null,n}function Ce(e,t){return null!=t.headers&&(!!t.headers.hasOwnProperty(e)||!!t.headers.hasOwnProperty(e.toLowerCase()))}function De(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||Ce("Content-Type",t)||e.setRequestHeader("Content-Type","application/json; charset=utf-8"),Ce("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(ve(t,"Unexpected error occurred"))},c.onabort=function(e){u=!0;var t=e.target;r(ve(t,"Request was aborted"))},c.ontimeout=function(e){s=!0;var t=e.target;r(ve(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 Ie="https://api.fyers.in/api/v2/",Ee="https://api.fyers.in/data-rest/v2/",Pe="https://public.fyers.in/sym_details/";var Oe,Se;function Re(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 Ue(e,t,n,r,i){return De("text",Re(e,t,n,r,i))}function Me(e,t,n,r,i){return De("json",Re(e,t,n,r,i))}function be(e,t,n,r,i){return Me(e,t,Ie+n,r,i)}function Ae(e,t,n,r,i){return Me(e,t,Ee+n,r,i)}function Ne(e){return Re(null,"GET","generate-authcode",e,null)}function we(e){return Re(null,"POST","validate-authcode",null,e)}function Fe(e){return be(e,"GET","profile",null,null)}function qe(e){return be(e,"GET","funds",null,null)}function _e(e){return be(e,"GET","holdings",null,null)}function ke(e,t){return be(e,"GET","orders",t,null)}function Le(e){return be(e,"GET","orders",null,null)}function xe(e){return be(e,"GET","positions",null,null)}function Qe(e){return be(e,"GET","tradebook",null,null)}function Be(e,t){return be(e,"POST","orders",null,t)}function Xe(e,t){return be(e,"POST","orders-multi",null,t)}function He(e,t){return be(e,"PUT","orders",null,t)}function ze(e,t){return be(e,"PUT","orders-multi",null,t)}function Ge(e,t){return be(e,"DELETE","orders",null,t)}function Ve(e,t){return be(e,"DELETE","orders-multi",null,t)}function Ye(e,t){return be(e,"DELETE","positions",null,t)}function Ke(e){return be(e,"DELETE","positions",null,{})}function We(e,t){return be(e,"PUT","positions",null,t)}function Je(e){return be(e,"GET","market-status",null,null)}function je(e,t){return Ae(e,"GET","history",t,null)}function $e(e,t){return Ae(e,"GET","quotes",t,null)}function Ze(e,t){return Ae(e,"GET","depth",t,null)}function et(e,t){var{exchange:n,segment:r}=t;return function(e,t,n,r,i){return Ue(e,t,Pe+n,r,i)}(null,"GET",n+"_"+r+".csv",null,null)}function tt(e){return be(e,"GET","tpin",null,null)}function nt(e){return be(e,"GET","details",null,null)}function rt(e,t){return Re(e,"POST","index",null,t)}function it(e,t){return be(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"}(Oe||(Oe={})),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"}(Se||(Se={}));var ot=Object.freeze({__proto__:null,API_URL:Ie,DATA_URL:Ee,SYMBOLS_URL:Pe,get FundLimitType(){return Oe},get ShortCandleIndex(){return Se},authorizationStep1:Ne,authorizationStep2:we,getProfile:Fe,getFunds:qe,getHoldings:_e,getOrder:ke,getOrders:Le,getPositions:xe,getTrades:Qe,placeOrder:Be,placeOrders:Xe,modifyOrder:He,modifyOrders:ze,cancelOrder:Ge,cancelOrders:Ve,exitPosition:Ye,exitAllPositions:Ke,convertPosition:We,getMarketStatus:Je,getMarketHistory:je,getMarketQuotes:$e,getMarketDepth:Ze,getSymbolMaster:et,generateEdisTpin:tt,getEdisTransactions:nt,submitEdisHoldingsStep:rt,inquireEdisTransaction:it});const at=new Map([[10,"NSE"],[11,"MCX"],[12,"BSE"]]),ut=new Map([["NSE",10],["MCX",11],["BSE",12]]);function st(e){return at.get(e)}const ct=new Map([[10,"CM"],[11,"FO"],[12,"CD"],[20,"COM"]]),lt=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function dt(e){return ct.get(e)}const pt=new Map([[1,"LONG"],[-1,"SHORT"],[0,"CLOSED"]]),yt=new Map([["LONG",1],["SHORT",-1],["CLOSED",0]]);function ft(e){return pt.get(e)}function mt(e){return yt.get(e)}const Tt=new Map([[1,"BUY"],[-1,"SELL"]]),gt=new Map([["BUY",1],["SELL",-1]]);function ht(e){return Tt.get(e)}function vt(e){return gt.get(e)}const Ct=new Map([["M","MOBILE"],["W","WEB"],["R","ONE"],["A","ADMIN"],["ITS","API"]]),Dt=new Map([["MOBILE","M"],["WEB","W"],["ONE","R"],["ADMIN","A"],["API","ITS"]]);function It(e){return Ct.get(e)}const Et=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 Ot(e){return Et.get(e)}const St=new Map([[1,"LIMIT"],[2,"MARKET"],[3,"SL-MARKET"],[4,"SL-LIMIT"]]),Rt=new Map([["LIMIT",1],["MARKET",2],["SL-MARKET",3],["SL-LIMIT",4]]);function Ut(e){return St.get(e)}function Mt(e){return Rt.get(e)}const bt=new Map([["CE","CALL"],["PE","PUT"]]),At=new Map([["CALL","CE"],["PUT","PE"]]);const Nt=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"]]),wt=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 Ft(e){return Nt.get(e)}function qt(e){return{app_id:e.appId,access_token:e.accessToken}}var _t=Oe;function kt(e){return{isin:e.isin,symbol:e.symbol,exchange:st(e.exchange),type:e.holdingType,quantity:e.quantity,remainingQuantity:e.remainingQuantity,buyPrice:e.costPrice,currentValue:e.marketVal,currentPrice:e.ltp,returns:e.pl}}function Lt(e){return{count:e.count_total,investedValue:e.total_investment,currentValue:e.total_current_value,returns:e.total_pl,returnsPercent:e.pnl_perc}}function xt(e){return{id:e.id,symbol:e.symbol,ticker:e.ex_sym,description:e.description,segment:dt(e.segment),instrument:Ft(e.instrument),exchange:st(e.exchange),type:Ut(e.type),side:ht(e.side),productType:e.productType,source:It(e.source),status:Ot(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,priceChange:e.ch,priceChangePercent:e.chp,currentPrice:e.lp,tradedPrice:e.tradedPrice,message:e.message,pan:e.pan,clientId:e.clientId}}function Qt(e){var t={count:0,quantity:0,remainingQuantity:0,tradedQuantity:0,disclosedQuantity:0,remainingDisclosedQuantity:0};for(var n of e)t.count++,t.quantity+=n.qty,t.remainingQuantity+=n.remainingQuantity,t.tradedQuantity+=n.filledQty,t.disclosedQuantity+=n.discloseQty,t.remainingDisclosedQuantity+=n.dqQtyRem;return t}function Bt(e){return{id:e.id,symbol:e.symbol,segment:dt(e.segment),exchange:st(e.exchange),productType:e.productType,side:ft(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 Xt(e){return{count:e.count_total,openCount:e.count_open,returns:e.pl_total,realizedReturns:e.pl_realized,unrealizedReturns:e.pl_unrealized}}function Ht(e){return{id:e.id,orderId:e.orderNumber,symbol:e.symbol,segment:dt(e.segment),exchange:st(e.exchange),side:ht(e.side),productType:e.productType,orderDate:e.orderDateTime,price:e.tradePrice,quantity:e.tradedQty,value:e.tradeValue,clientId:e.clientId,type:e.transactionType.toString(),orderType:e.orderType.toString()}}function zt(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 Gt(e){return{symbol:e.symbol,type:Mt(e.type),side:vt(e.side),productType:e.productType,limitPrice:e.limitPrice,stopPrice:e.stopPrice,qty:e.quantity,disclosedQty:e.disclosedQuantity,validity:e.validity,offlineOrder:e.offline?"True":"False",stopLoss:e.stopLoss,takeProfit:e.takeProfit}}function Vt(e){return{id:e.id,type:Mt(e.type),qty:e.quantity,disclosedQty:e.disclosedQuantity,limitPrice:e.limitPrice,stopPrice:e.stopPrice}}function Yt(e){return{exchange:st(e.exchange),segment:dt(e.segment),type:e.market_type,status:e.status}}function Kt(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}var Wt=Se;function Jt(e){return{date:e[Wt.Time],openPrice:e[Wt.Open],highPrice:e[Wt.High],lowPrice:e[Wt.Low],closePrice:e[Wt.Close],volume:e[Wt.Volume]}}function jt(e){return{date:e.t,openPrice:e.o,highPrice:e.h,lowPrice:e.l,closePrice:e.c,volume:e.v}}function $t(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][Wt.Time],t.toDate=e[n][Wt.Time],t.openPrice=e[0][Wt.Open],t.highPrice=e[0][Wt.High],t.lowPrice=e[0][Wt.Low],t.closePrice=e[n][Wt.Close],e))t.highPrice=Math.max(t.highPrice,r[Wt.High]),t.lowPrice=Math.min(t.lowPrice,r[Wt.Low]),t.volume+=r[Wt.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:jt(t.cmd)}}function en(e){return{price:e.price,volume:e.volume,orders:e.ord}}function tn(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 nn(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 rn(e){return{isin_code:e.isin,qty:e.quantity}}function on(e,t,n="default"){var r;return Ne({client_id:(r={appId:e,redirectUrl:t,state:n}).appId,redirect_uri:r.redirectUrl,response_type:"code",state:r.state})}function an(e,t){var n;return we({grant_type:"authorization_code",appIdHash:(n={appHash:e,authorizationCode:t}).appHash,code:n.authorizationCode})}async function un(e){return{id:(t=await Fe(qt(e))).fy_id,email:t.email_id,name:t.name,pan:t.PAN};var t}async function sn(e){return function(e){var t={},n={};for(var r of e.fund_limit)switch(r.id){case _t.Start:t.start=r.equityAmount,n.start=r.commodityAmount;break;case _t.Deposits:t.deposits=r.equityAmount,n.deposits=r.commodityAmount;break;case _t.RealizedReturns:t.realizedReturns=r.equityAmount,n.realizedReturns=r.commodityAmount;break;case _t.Collaterals:t.collaterals=r.equityAmount,n.collaterals=r.commodityAmount;break;case _t.Adhoc:t.adhoc=r.equityAmount,n.adhoc=r.commodityAmount;break;case _t.Utilized:t.utilized=r.equityAmount,n.utilized=r.commodityAmount;break;case _t.Receivables:t.receivables=r.equityAmount,n.receivables=r.commodityAmount;break;case _t.Available:t.available=r.equityAmount,n.available=r.commodityAmount;break;case _t.Clear:t.clear=r.equityAmount,n.clear=r.commodityAmount;break;case _t.Total:t.total=r.equityAmount,n.total=r.commodityAmount}return{equity:t,commodity:n}}(await qe(qt(e)))}async function cn(e){return{details:(t=await _e(qt(e))).holdings.map(kt),overall:Lt(t.overall)};var t}async function ln(e,t){var n={id:t};return xt((await ke(qt(e),n)).orderBook[0])}async function dn(e){return{details:(t=await Le(qt(e))).orderBook.map(xt),overall:Qt(t.orderBook)};var t}async function pn(e){return{details:(t=await xe(qt(e))).netPositions.map(Bt),overall:Xt(t.overall)};var t}async function yn(e){return{details:(t=await Qe(qt(e))).tradeBook.map(Ht),overall:zt(t.tradeBook)};var t}async function fn(e,t){var n=Gt(t);return(await Be(qt(e),n)).id}async function mn(e,t){var n=t.map(Gt);return(await Xe(qt(e),n)).data.map((e=>e.body.id))}async function Tn(e,t){var n=Vt(t);return(await He(qt(e),n)).id}async function gn(e,t){var n=t.map(Vt);return(await ze(qt(e),n)).data.map((e=>e.body.id))}async function hn(e,t){var n={id:t};return(await Ge(qt(e),n)).id}async function vn(e,t){var n=t.map((e=>({id:e})));return(await Ve(qt(e),n)).data.map((e=>e.body.id))}async function Cn(e,t){var n={id:t};return(await Ye(qt(e),n)).s}async function Dn(e){return(await Ke(qt(e))).s}async function In(e,t){var n,r={symbol:(n=t).symbol,positionSide:mt(n.side),convertQty:n.quantity,convertFrom:n.fromProductType,convertTo:n.toProductType};return(await We(qt(e),r)).s}async function En(e){return{details:(t=await Je(qt(e))).marketStatus.map(Yt),overall:Kt(t.marketStatus)};var t}async function Pn(e,t){var n,r={symbol:(n=t).symbol,resolution:n.resolution,date_format:n.dateFormat,range_from:n.fromDate,range_to:n.toDate,cont_flag:n.continuous?"1":"0"};return function(e){return{details:e.candles.map(Jt),overall:$t(e.candles)}}(await je(qt(e),r))}async function On(e,t){var n={symbols:t.join()};return(await $e(qt(e),n)).d.map(Zt)}async function Sn(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(en),sellOffers:n.ask.map(en),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 Ze(qt(e),n))}function Rn(e,t,n){return et(0,{exchange:t,segment:n})}async function Un(e){return(await tt(qt(e))).data}async function Mn(e){return t=await nt(qt(e)),{details:(n=0===t.data.length?[]:t.data).map(tn),overall:nn(n)};var t,n}function bn(e,t){var n={recordLst:t.map(rn)};return rt(qt(e),n)}async function An(e,t){var n={transactionId:t},r=(await it(qt(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 on(e,t,n)}static authorizationStep2(e,t){return an(e,t)}getProfile(){return un(this)}getFunds(){return sn(this)}getHoldings(){return cn(this)}getOrder(e){return ln(this,e)}getOrders(){return dn(this)}getPositions(){return pn(this)}getTrades(){return yn(this)}placeOrder(e){return fn(this,e)}placeOrders(e){return mn(this,e)}modifyOrder(e){return Tn(this,e)}modifyOrders(e){return gn(this,e)}cancelOrder(e){return hn(this,e)}cancelOrders(e){return vn(this,e)}exitPosition(e){return Cn(this,e)}exitAllPositions(){return Dn(this)}convertPosition(e){return In(this,e)}getMarketStatus(){return En(this)}getMarketHistory(e){return Pn(this,e)}getMarketQuotes(e){return On(this,e)}getMarketDepth(e){return Sn(this,e)}static getSymbolMaster(e,t){return Rn(0,e,t)}generateEdisTpin(){return Un(this)}getEdisTransactions(){return Mn(this)}submitEdisHoldingsStep(e){return bn(this,e)}inquireEdisTransaction(e){return An(this,e)}},n.appendix=he,n.authorizationStep1=on,n.authorizationStep2=an,n.cancelOrder=hn,n.cancelOrders=vn,n.convertPosition=In,n.day2=m,n.day2Description=f,n.errorDescription=i,n.exchange=function(e){return st(C(e))},n.exchangeDescription=function(e){return v((t=e,ut.get(t)));var t},n.exitAllPositions=Dn,n.exitPosition=Cn,n.generateEdisTpin=Un,n.getEdisTransactions=Mn,n.getFunds=sn,n.getHoldings=cn,n.getMarketDepth=Sn,n.getMarketHistory=Pn,n.getMarketQuotes=On,n.getMarketStatus=En,n.getOrder=ln,n.getOrders=dn,n.getPositions=pn,n.getProfile=un,n.getSymbolMaster=Rn,n.getTrades=yn,n.holdingType=function(e){return ue(e)},n.holdingTypeDescription=function(e){return ae(e)},n.http=ot,n.inquireEdisTransaction=An,n.instrumentType=function(e){return Ft(ge(e))},n.instrumentTypeDescription=function(e){return Te((t=e,wt.get(t)));var t},n.modifyOrder=Tn,n.modifyOrders=gn,n.month1=y,n.month1Description=p,n.month3=c,n.month3Description=s,n.optionType=function(e){return t=re(e),bt.get(t);var t},n.optionTypeDescription=function(e){return ne((t=e,At.get(t)));var t},n.orderSide=function(e){return ht(q(e))},n.orderSideDescription=function(e){return F(vt(e))},n.orderSource=function(e){return It(Q(e))},n.orderSourceDescription=function(e){return x((t=e,Dt.get(t)));var t},n.orderStatus=function(e){return Ot(G(e))},n.orderStatusDescription=function(e){return z((t=e,Pt.get(t)));var t},n.orderType=function(e){return Ut(J(e))},n.orderTypeDescription=function(e){return W(Mt(e))},n.orderValidity=function(e){return Z(e)},n.orderValidityDescription=function(e){return Z(e)},n.placeOrder=fn,n.placeOrders=mn,n.positionSide=function(e){return ft(b(e))},n.positionSideDescription=function(e){return M(mt(e))},n.productType=function(e){return pe(e)},n.productTypeDescription=function(e){return de(e)},n.segment=function(e){return dt(O(e))},n.segmentDescription=function(e){return P((t=e,lt.get(t)));var t},n.submitEdisHoldingsStep=bn,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")}var T;!function(e){e[e.NSE=10]="NSE",e[e.MCX=11]="MCX",e[e.BSE=12]="BSE"}(T||(T={}));const g=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 v(e){return g.get(e)}function C(e){var t=e.charAt(0).toUpperCase();return h.get(t)}var D;!function(e){e[e.Capital=10]="Capital",e[e.Derivative=11]="Derivative",e[e.Currency=12]="Currency",e[e.Commodity=20]="Commodity"}(D||(D={}));const I=new Map([[10,"Capital Market (CM)"],[11,"Equity Derivatives (FO)"],[12,"Currency Derivatives (CD)"],[20,"Commodity Derivatives (COM)"]]),E=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function P(e){return I.get(e)}function O(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"),E.get(t)}var S;!function(e){e[e.Long=1]="Long",e[e.Short=-1]="Short",e[e.Closed=0]="Closed"}(S||(S={}));const R=new Map([[1,"Long"],[-1,"Short"],[0,"Closed position"]]),U=new Map([["L",1],["S",-1],["C",0]]);function M(e){return R.get(e)}function b(e){var t=e.charAt(0).toUpperCase();return U.get(t)}var A;!function(e){e[e.Buy=1]="Buy",e[e.Sell=-1]="Sell"}(A||(A={}));const N=new Map([[1,"Buy"],[-1,"Sell"]]),w=new Map([["B",1],["S",-1]]);function F(e){return N.get(e)}function q(e){var t=e.charAt(0).toUpperCase();return w.get(t)}var _;!function(e){e.Mobile="M",e.Web="W",e.FyersOne="R",e.Admin="A",e.API="ITS"}(_||(_={}));const k=new Map([["M","Mobile"],["W","Web"],["R","Fyers One"],["A","Admin"],["ITS","API"]]),L=new Map([["MO","M"],["WE","W"],["ON","R"],["AD","A"],["AP","ITS"]]);function x(e){return k.get(e)}function Q(e){var t=e.split(" "),n=t[t.length-1].substring(0,2).toUpperCase();return L.get(n)}var B;!function(e){e[e.Cancelled=1]="Cancelled",e[e.Traded=2]="Traded",e[e.Unused=3]="Unused",e[e.Transit=4]="Transit",e[e.Rejected=5]="Rejected",e[e.Pending=6]="Pending",e[e.Expired=7]="Expired"}(B||(B={}));const X=new Map([[1,"Cancelled"],[2,"Traded / Filled"],[3,"For future use"],[4,"Transit"],[5,"Rejected"],[6,"Pending"],[7,"Expired"]]),H=new Map([["C",1],["F",2],["T",4],["R",5],["P",6],["E",7]]);function z(e){return X.get(e)}function G(e){/traded/i.test(e)&&(e="Filled");var t=e.charAt(0).toUpperCase();return H.get(t)}var V;!function(e){e[e.Limit=1]="Limit",e[e.Market=2]="Market",e[e.SlMarket=3]="SlMarket",e[e.SlLimit=4]="SlLimit"}(V||(V={}));const Y=new Map([[1,"Limit order"],[2,"Market order"],[3,"Stop order (SL-M)"],[4,"Stoplimit order (SL-L)"]]),K=new Map([["L",1],["M",2],["S",3],["R",4]]);function W(e){return Y.get(e)}function J(e){var t=e.charAt(0).toUpperCase();return/s.+l(?!oss)/i.test(e)&&(t="R"),K.get(t)}var j;!function(e){e.Day="DAY",e.IOC="IOC"}(j||(j={}));const $=new Map([["DAY","End of day validity (DAY)"],["IOC","Immediate or Cancel validity (IOC)"]]);function Z(e){return/ioc|imm/i.test(e)?"IOC":"DAY"}var ee;!function(e){e.Call="CE",e.Put="PE"}(ee||(ee={}));const te=new Map([["CE","Call Option (CE)"],["PE","Put Option (PE)"]]);function ne(e){return te.get(e)}function re(e){return/^[ps]/i.test(e)?"PE":"CE"}var ie;!function(e){e.Purchased="T1",e.Delivered="HLD"}(ie||(ie={}));const oe=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 ae(e){return oe.get(e)}function ue(e){return/not|un/i.test(e)?"T1":"HLD"}var se;!function(e){e.CNC="CNC",e.Intraday="INTRADAY",e.Margin="MARGIN",e.Cover="CO",e.Bracket="BO"}(se||(se={}));const ce=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)"]]),le=new Map([["D","CNC"],["I","INTRADAY"],["M","MARGIN"],["M","MARGIN"],["C","CO"],["B","BO"]]);function de(e){return ce.get(e)}function pe(e){/cnc|cash|carry/i.test(e)&&(e="Delivery");var t=e.charAt(0).toUpperCase();return le.get(t)}var ye;!function(e){e[e.EQ=0]="EQ",e[e.PREFSHARES=1]="PREFSHARES",e[e.DEBENTURES=2]="DEBENTURES",e[e.WARRANTS=3]="WARRANTS",e[e.MISC=4]="MISC",e[e.INDEX=10]="INDEX",e[e.FUTIDX=11]="FUTIDX",e[e.FUTIVX=12]="FUTIVX",e[e.FUTSTK=13]="FUTSTK",e[e.OPTIDX=14]="OPTIDX",e[e.OPTSTK=15]="OPTSTK",e[e.FUTCUR=16]="FUTCUR",e[e.FUTIRT=17]="FUTIRT",e[e.FUTIRC=18]="FUTIRC",e[e.OPTCUR=19]="OPTCUR",e[e.UNDCUR=20]="UNDCUR",e[e.UNDIRC=21]="UNDIRC",e[e.UNDIRT=22]="UNDIRT",e[e.UNDIRD=23]="UNDIRD",e[e.INDEX_CD=24]="INDEX_CD",e[e.FUTIRD=25]="FUTIRD",e[e.FUTCOM=30]="FUTCOM",e[e.OPTFUT=31]="OPTFUT",e[e.OPTCOM=32]="OPTCOM"}(ye||(ye={}));const fe=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)"]]),me=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 Te(e){return fe.get(e)}function ge(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",me.get(t)}var he=Object.freeze({__proto__:null,errorDescription:i,year2Description:o,year2:a,month3Description:s,month3:c,month1Description:p,month1:y,day2Description:f,day2:m,get Exchange(){return T},exchangeDescription:v,exchange:C,get Segment(){return D},segmentDescription:P,segment:O,get PositionSide(){return S},positionSideDescription:M,positionSide:b,get OrderSide(){return A},orderSideDescription:F,orderSide:q,get OrderSource(){return _},orderSourceDescription:x,orderSource:Q,get OrderStatus(){return B},orderStatusDescription:z,orderStatus:G,get OrderType(){return V},orderTypeDescription:W,orderType:J,get OrderValidity(){return j},orderValidityDescription:function(e){return $.get(e)},orderValidity:Z,get OptionType(){return ee},optionTypeDescription:ne,optionType:re,get HoldingType(){return ie},holdingTypeDescription:ae,holdingType:ue,get ProductType(){return se},productTypeDescription:de,productType:pe,get InstrumentType(){return ye},instrumentTypeDescription:Te,instrumentType:ge});function ve(e,t){var n=new Error(t);return n.code=e.status,n.response=null,n}function Ce(e,t){return null!=t.headers&&(!!t.headers.hasOwnProperty(e)||!!t.headers.hasOwnProperty(e.toLowerCase()))}function De(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||Ce("Content-Type",t)||e.setRequestHeader("Content-Type","application/json; charset=utf-8"),Ce("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(ve(t,"Unexpected error occurred"))},c.onabort=function(e){u=!0;var t=e.target;r(ve(t,"Request was aborted"))},c.ontimeout=function(e){s=!0;var t=e.target;r(ve(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 Ie="https://api.fyers.in/api/v2/",Ee="https://api.fyers.in/data-rest/v2/",Pe="https://public.fyers.in/sym_details/";var Oe,Se;function Re(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 Ue(e,t,n,r,i){return De("text",Re(e,t,n,r,i))}function Me(e,t,n,r,i){return De("json",Re(e,t,n,r,i))}function be(e,t,n,r,i){return Me(e,t,Ie+n,r,i)}function Ae(e,t,n,r,i){return Me(e,t,Ee+n,r,i)}function Ne(e){return Re(null,"GET",Ie+"generate-authcode",e,null)}function we(e){return Re(null,"POST",Ie+"validate-authcode",null,e)}function Fe(e){return be(e,"GET","profile",null,null)}function qe(e){return be(e,"GET","funds",null,null)}function _e(e){return be(e,"GET","holdings",null,null)}function ke(e,t){return be(e,"GET","orders",t,null)}function Le(e){return be(e,"GET","orders",null,null)}function xe(e){return be(e,"GET","positions",null,null)}function Qe(e){return be(e,"GET","tradebook",null,null)}function Be(e,t){return be(e,"POST","orders",null,t)}function Xe(e,t){return be(e,"POST","orders-multi",null,t)}function He(e,t){return be(e,"PUT","orders",null,t)}function ze(e,t){return be(e,"PUT","orders-multi",null,t)}function Ge(e,t){return be(e,"DELETE","orders",null,t)}function Ve(e,t){return be(e,"DELETE","orders-multi",null,t)}function Ye(e,t){return be(e,"DELETE","positions",null,t)}function Ke(e){return be(e,"DELETE","positions",null,{})}function We(e,t){return be(e,"PUT","positions",null,t)}function Je(e){return be(e,"GET","market-status",null,null)}function je(e,t){return Ae(e,"GET","history",t,null)}function $e(e,t){return Ae(e,"GET","quotes",t,null)}function Ze(e,t){return Ae(e,"GET","depth",t,null)}function et(e,t){var{exchange:n,segment:r}=t;return function(e,t,n,r,i){return Ue(e,t,Pe+n,r,i)}(null,"GET",n+"_"+r+".csv",null,null)}function tt(e){return be(e,"GET","tpin",null,null)}function nt(e){return be(e,"GET","details",null,null)}function rt(e,t){return Re(e,"POST","index",null,t)}function it(e,t){return be(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"}(Oe||(Oe={})),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"}(Se||(Se={}));var ot=Object.freeze({__proto__:null,API_URL:Ie,DATA_URL:Ee,SYMBOLS_URL:Pe,get FundLimitType(){return Oe},get ShortCandleIndex(){return Se},authorizationStep1:Ne,authorizationStep2:we,getProfile:Fe,getFunds:qe,getHoldings:_e,getOrder:ke,getOrders:Le,getPositions:xe,getTrades:Qe,placeOrder:Be,placeOrders:Xe,modifyOrder:He,modifyOrders:ze,cancelOrder:Ge,cancelOrders:Ve,exitPosition:Ye,exitAllPositions:Ke,convertPosition:We,getMarketStatus:Je,getMarketHistory:je,getMarketQuotes:$e,getMarketDepth:Ze,getSymbolMaster:et,generateEdisTpin:tt,getEdisTransactions:nt,submitEdisHoldingsStep:rt,inquireEdisTransaction:it});const at=new Map([[10,"NSE"],[11,"MCX"],[12,"BSE"]]),ut=new Map([["NSE",10],["MCX",11],["BSE",12]]);function st(e){return at.get(e)}const ct=new Map([[10,"CM"],[11,"FO"],[12,"CD"],[20,"COM"]]),lt=new Map([["CM",10],["FO",11],["CD",12],["COM",20]]);function dt(e){return ct.get(e)}const pt=new Map([[1,"LONG"],[-1,"SHORT"],[0,"CLOSED"]]),yt=new Map([["LONG",1],["SHORT",-1],["CLOSED",0]]);function ft(e){return pt.get(e)}function mt(e){return yt.get(e)}const Tt=new Map([[1,"BUY"],[-1,"SELL"]]),gt=new Map([["BUY",1],["SELL",-1]]);function ht(e){return Tt.get(e)}function vt(e){return gt.get(e)}const Ct=new Map([["M","MOBILE"],["W","WEB"],["R","ONE"],["A","ADMIN"],["ITS","API"]]),Dt=new Map([["MOBILE","M"],["WEB","W"],["ONE","R"],["ADMIN","A"],["API","ITS"]]);function It(e){return Ct.get(e)}const Et=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 Ot(e){return Et.get(e)}const St=new Map([[1,"LIMIT"],[2,"MARKET"],[3,"SL-MARKET"],[4,"SL-LIMIT"]]),Rt=new Map([["LIMIT",1],["MARKET",2],["SL-MARKET",3],["SL-LIMIT",4]]);function Ut(e){return St.get(e)}function Mt(e){return Rt.get(e)}const bt=new Map([["CE","CALL"],["PE","PUT"]]),At=new Map([["CALL","CE"],["PUT","PE"]]);const Nt=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"]]),wt=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 Ft(e){return Nt.get(e)}function qt(e){return{app_id:e.appId,access_token:e.accessToken}}var _t=Oe;function kt(e){return{isin:e.isin,symbol:e.symbol,exchange:st(e.exchange),type:e.holdingType,quantity:e.quantity,remainingQuantity:e.remainingQuantity,buyPrice:e.costPrice,currentValue:e.marketVal,currentPrice:e.ltp,returns:e.pl}}function Lt(e){return{count:e.count_total,investedValue:e.total_investment,currentValue:e.total_current_value,returns:e.total_pl,returnsPercent:e.pnl_perc}}function xt(e){return{id:e.id,symbol:e.symbol,ticker:e.ex_sym,description:e.description,segment:dt(e.segment),instrument:Ft(e.instrument),exchange:st(e.exchange),type:Ut(e.type),side:ht(e.side),productType:e.productType,source:It(e.source),status:Ot(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,priceChange:e.ch,priceChangePercent:e.chp,currentPrice:e.lp,tradedPrice:e.tradedPrice,message:e.message,pan:e.pan,clientId:e.clientId}}function Qt(e){var t={count:0,quantity:0,remainingQuantity:0,tradedQuantity:0,disclosedQuantity:0,remainingDisclosedQuantity:0};for(var n of e)t.count++,t.quantity+=n.qty,t.remainingQuantity+=n.remainingQuantity,t.tradedQuantity+=n.filledQty,t.disclosedQuantity+=n.discloseQty,t.remainingDisclosedQuantity+=n.dqQtyRem;return t}function Bt(e){return{id:e.id,symbol:e.symbol,segment:dt(e.segment),exchange:st(e.exchange),productType:e.productType,side:ft(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 Xt(e){return{count:e.count_total,openCount:e.count_open,returns:e.pl_total,realizedReturns:e.pl_realized,unrealizedReturns:e.pl_unrealized}}function Ht(e){return{id:e.id,orderId:e.orderNumber,symbol:e.symbol,segment:dt(e.segment),exchange:st(e.exchange),side:ht(e.side),productType:e.productType,orderDate:e.orderDateTime,price:e.tradePrice,quantity:e.tradedQty,value:e.tradeValue,clientId:e.clientId,type:e.transactionType.toString(),orderType:e.orderType.toString()}}function zt(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 Gt(e){return{symbol:e.symbol,type:Mt(e.type),side:vt(e.side),productType:e.productType,limitPrice:e.limitPrice,stopPrice:e.stopPrice,qty:e.quantity,disclosedQty:e.disclosedQuantity,validity:e.validity,offlineOrder:e.offline?"True":"False",stopLoss:e.stopLoss,takeProfit:e.takeProfit}}function Vt(e){return{id:e.id,type:Mt(e.type),qty:e.quantity,disclosedQty:e.disclosedQuantity,limitPrice:e.limitPrice,stopPrice:e.stopPrice}}function Yt(e){return{exchange:st(e.exchange),segment:dt(e.segment),type:e.market_type,status:e.status}}function Kt(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}var Wt=Se;function Jt(e){return{date:e[Wt.Time],openPrice:e[Wt.Open],highPrice:e[Wt.High],lowPrice:e[Wt.Low],closePrice:e[Wt.Close],volume:e[Wt.Volume]}}function jt(e){return{date:e.t,openPrice:e.o,highPrice:e.h,lowPrice:e.l,closePrice:e.c,volume:e.v}}function $t(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][Wt.Time],t.toDate=e[n][Wt.Time],t.openPrice=e[0][Wt.Open],t.highPrice=e[0][Wt.High],t.lowPrice=e[0][Wt.Low],t.closePrice=e[n][Wt.Close],e))t.highPrice=Math.max(t.highPrice,r[Wt.High]),t.lowPrice=Math.min(t.lowPrice,r[Wt.Low]),t.volume+=r[Wt.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:jt(t.cmd)}}function en(e){return{price:e.price,volume:e.volume,orders:e.ord}}function tn(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 nn(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 rn(e){return{isin_code:e.isin,qty:e.quantity}}function on(e,t,n="default"){var r;return Ne({client_id:(r={appId:e,redirectUrl:t,state:n}).appId,redirect_uri:r.redirectUrl,response_type:"code",state:r.state})}function an(e,t){var n;return we({grant_type:"authorization_code",appIdHash:(n={appHash:e,authorizationCode:t}).appHash,code:n.authorizationCode})}async function un(e){return{id:(t=await Fe(qt(e))).fy_id,email:t.email_id,name:t.name,pan:t.PAN};var t}async function sn(e){return function(e){var t={},n={};for(var r of e.fund_limit)switch(r.id){case _t.Start:t.start=r.equityAmount,n.start=r.commodityAmount;break;case _t.Deposits:t.deposits=r.equityAmount,n.deposits=r.commodityAmount;break;case _t.RealizedReturns:t.realizedReturns=r.equityAmount,n.realizedReturns=r.commodityAmount;break;case _t.Collaterals:t.collaterals=r.equityAmount,n.collaterals=r.commodityAmount;break;case _t.Adhoc:t.adhoc=r.equityAmount,n.adhoc=r.commodityAmount;break;case _t.Utilized:t.utilized=r.equityAmount,n.utilized=r.commodityAmount;break;case _t.Receivables:t.receivables=r.equityAmount,n.receivables=r.commodityAmount;break;case _t.Available:t.available=r.equityAmount,n.available=r.commodityAmount;break;case _t.Clear:t.clear=r.equityAmount,n.clear=r.commodityAmount;break;case _t.Total:t.total=r.equityAmount,n.total=r.commodityAmount}return{equity:t,commodity:n}}(await qe(qt(e)))}async function cn(e){return{details:(t=await _e(qt(e))).holdings.map(kt),overall:Lt(t.overall)};var t}async function ln(e,t){var n={id:t};return xt((await ke(qt(e),n)).orderBook[0])}async function dn(e){return{details:(t=await Le(qt(e))).orderBook.map(xt),overall:Qt(t.orderBook)};var t}async function pn(e){return{details:(t=await xe(qt(e))).netPositions.map(Bt),overall:Xt(t.overall)};var t}async function yn(e){return{details:(t=await Qe(qt(e))).tradeBook.map(Ht),overall:zt(t.tradeBook)};var t}async function fn(e,t){var n=Gt(t);return(await Be(qt(e),n)).id}async function mn(e,t){var n=t.map(Gt);return(await Xe(qt(e),n)).data.map((e=>e.body.id))}async function Tn(e,t){var n=Vt(t);return(await He(qt(e),n)).id}async function gn(e,t){var n=t.map(Vt);return(await ze(qt(e),n)).data.map((e=>e.body.id))}async function hn(e,t){var n={id:t};return(await Ge(qt(e),n)).id}async function vn(e,t){var n=t.map((e=>({id:e})));return(await Ve(qt(e),n)).data.map((e=>e.body.id))}async function Cn(e,t){var n={id:t};return(await Ye(qt(e),n)).s}async function Dn(e){return(await Ke(qt(e))).s}async function In(e,t){var n,r={symbol:(n=t).symbol,positionSide:mt(n.side),convertQty:n.quantity,convertFrom:n.fromProductType,convertTo:n.toProductType};return(await We(qt(e),r)).s}async function En(e){return{details:(t=await Je(qt(e))).marketStatus.map(Yt),overall:Kt(t.marketStatus)};var t}async function Pn(e,t){var n,r={symbol:(n=t).symbol,resolution:n.resolution,date_format:n.dateFormat,range_from:n.fromDate,range_to:n.toDate,cont_flag:n.continuous?"1":"0"};return function(e){return{details:e.candles.map(Jt),overall:$t(e.candles)}}(await je(qt(e),r))}async function On(e,t){var n={symbols:t.join()};return(await $e(qt(e),n)).d.map(Zt)}async function Sn(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(en),sellOffers:n.ask.map(en),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 Ze(qt(e),n))}function Rn(e,t,n){return et(0,{exchange:t,segment:n})}async function Un(e){return(await tt(qt(e))).data}async function Mn(e){return t=await nt(qt(e)),{details:(n=0===t.data.length?[]:t.data).map(tn),overall:nn(n)};var t,n}function bn(e,t){var n={recordLst:t.map(rn)};return rt(qt(e),n)}async function An(e,t){var n={transactionId:t},r=(await it(qt(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 on(e,t,n)}static authorizationStep2(e,t){return an(e,t)}getProfile(){return un(this)}getFunds(){return sn(this)}getHoldings(){return cn(this)}getOrder(e){return ln(this,e)}getOrders(){return dn(this)}getPositions(){return pn(this)}getTrades(){return yn(this)}placeOrder(e){return fn(this,e)}placeOrders(e){return mn(this,e)}modifyOrder(e){return Tn(this,e)}modifyOrders(e){return gn(this,e)}cancelOrder(e){return hn(this,e)}cancelOrders(e){return vn(this,e)}exitPosition(e){return Cn(this,e)}exitAllPositions(){return Dn(this)}convertPosition(e){return In(this,e)}getMarketStatus(){return En(this)}getMarketHistory(e){return Pn(this,e)}getMarketQuotes(e){return On(this,e)}getMarketDepth(e){return Sn(this,e)}static getSymbolMaster(e,t){return Rn(0,e,t)}generateEdisTpin(){return Un(this)}getEdisTransactions(){return Mn(this)}submitEdisHoldingsStep(e){return bn(this,e)}inquireEdisTransaction(e){return An(this,e)}},n.appendix=he,n.authorizationStep1=on,n.authorizationStep2=an,n.cancelOrder=hn,n.cancelOrders=vn,n.convertPosition=In,n.day2=m,n.day2Description=f,n.errorDescription=i,n.exchange=function(e){return st(C(e))},n.exchangeDescription=function(e){return v((t=e,ut.get(t)));var t},n.exitAllPositions=Dn,n.exitPosition=Cn,n.generateEdisTpin=Un,n.getEdisTransactions=Mn,n.getFunds=sn,n.getHoldings=cn,n.getMarketDepth=Sn,n.getMarketHistory=Pn,n.getMarketQuotes=On,n.getMarketStatus=En,n.getOrder=ln,n.getOrders=dn,n.getPositions=pn,n.getProfile=un,n.getSymbolMaster=Rn,n.getTrades=yn,n.holdingType=function(e){return ue(e)},n.holdingTypeDescription=function(e){return ae(e)},n.http=ot,n.inquireEdisTransaction=An,n.instrumentType=function(e){return Ft(ge(e))},n.instrumentTypeDescription=function(e){return Te((t=e,wt.get(t)));var t},n.modifyOrder=Tn,n.modifyOrders=gn,n.month1=y,n.month1Description=p,n.month3=c,n.month3Description=s,n.optionType=function(e){return t=re(e),bt.get(t);var t},n.optionTypeDescription=function(e){return ne((t=e,At.get(t)));var t},n.orderSide=function(e){return ht(q(e))},n.orderSideDescription=function(e){return F(vt(e))},n.orderSource=function(e){return It(Q(e))},n.orderSourceDescription=function(e){return x((t=e,Dt.get(t)));var t},n.orderStatus=function(e){return Ot(G(e))},n.orderStatusDescription=function(e){return z((t=e,Pt.get(t)));var t},n.orderType=function(e){return Ut(J(e))},n.orderTypeDescription=function(e){return W(Mt(e))},n.orderValidity=function(e){return Z(e)},n.orderValidityDescription=function(e){return Z(e)},n.placeOrder=fn,n.placeOrders=mn,n.positionSide=function(e){return ft(b(e))},n.positionSideDescription=function(e){return M(mt(e))},n.productType=function(e){return pe(e)},n.productTypeDescription=function(e){return de(e)},n.segment=function(e){return dt(O(e))},n.segmentDescription=function(e){return P((t=e,lt.get(t)));var t},n.submitEdisHoldingsStep=bn,n.year2=a,n.year2Description=o},{}]},{},[1])(1)}));
{
"name": "extra-fyers.web",
"version": "0.0.32",
"version": "0.0.33",
"description": "A Javascript interface for FYERS API.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc