/// import { WebSocket } from 'ws'; /** HTTP(s) header keys and values. */ interface HttpHeaders { [key: string]: string; } /** HTTP(s) request options. */ interface HttpRequestOptions { /** Full URL, inluding protocol and query. */ url: string; /** HTTP(s) method (GET). */ method?: string; /** Body of request (JSON). */ body?: object | null; /** Request headers. */ headers?: HttpHeaders; /** What if we don't get a response? */ timeout?: number; } /** Root URL for API requests. */ declare const API_URL: string; /** Root URL for Data API requests. */ declare const DATA_URL: string; /** Root URL for Symbol master files. */ declare const SYMBOLS_URL: string; /** Common response format. */ interface Response { /** ok / error. */ s: string; /** This is the code to identify specific responses. */ code?: number; /** This is the message to identify the specific error responses. */ message?: string; } /** HTTP data of multi-response. */ interface ProxyResponse { /** HTTP status code. */ statusCode: number; /** The actual place order reponse. */ body: Body; /** HTTP status description. */ statusDescription: string; } /** Attributes required for authorization of all requests. */ interface Authorization$1 { /** This is the app_id which you have received after creating the app. */ app_id: string; /** This value will be used for all the requests. */ access_token: string; } /** Login step 1 request. */ interface LoginStep1Request$1 { /** This is the app_id which you have received after creating the app. */ client_id: string; /** This is where the user will be redirected after successful login. */ redirect_uri: string; /** This value must always be “code”. */ response_type: string; /** The same value will be returned after successful login to the redirect uri. */ state: string; } /** Login step 1 response. */ interface LoginStep1Response$1 extends Response { /** String value which will be used to generate the access_token. */ auth_code: string; /** This value is returned as is from the first request. */ state: string; } /** Login step 2 request. */ interface LoginStep2Request$1 { /** This value must always be “authorization_code”. */ grant_type: string; /** SHA-256 of `api_id:app_secret` in hex. */ appIdHash: string; /** This is the auth_code which is received from the first step. */ code: string; } /** Login step 2 response. */ interface LoginStep2Response$1 extends Response { /** This value will be used for all the subsequent requests. */ access_token: string; } /** Basic details of the client. */ interface Profile$1 { /** The client id of the fyers user. */ fy_id: string; /** Email address of the client. */ email_id: string; /** Name of the client. */ name: string; /** Display name, if any, provided by the client. */ display_name: string; /** URL link to the user’s profile picture, if any. */ image: string; /** PAN of the client. */ PAN: string; /** Last PIN changed date. */ pin_change_date: string; /** Last password changed date. */ pwd_change_date: string; /** Number of days until the current password expires. */ pwd_to_expire: number; } /** Get profile response. */ interface GetProfileResponse extends Response { /** Basic details of the client. */ data: Profile$1; } /** Limit details for particular fund. */ interface FundLimit { /** Unique identity for particular fund. */ id: number; /** Each title represents a heading of the ledger. */ title: string; /** The amount in the capital ledger for the above-mentioned title. */ equityAmount: number; /** The amount in the commodity ledger for the above-mentioned title. */ commodityAmount: number; } /** Get funds response. */ interface GetFundsResponse extends Response { /** Balance available for the user for capital as well as the commodity market. */ fund_limit: FundLimit[]; } /** Details of each equity or mutual fund holding. */ interface Holding$1 { /** An identifier for this holding. */ id: number; /** Fytoken is a unique identifier for every symbol. */ fytoken: string; /** 12-digit International Securities Identification Number. */ isin: string; /** Eg: NSE:RCOM-EQ. */ symbol: string; /** The exchange in which order is placed. */ exchange: number; /** Identify the type of holding. */ holdingType: string; /** The quantity of the symbol which the user has at the beginning of the day. */ quantity: number; /** This reflects the quantity - the quantity sold during the day. */ remainingQuantity: number; /** The original buy price of the holding. */ costPrice: number; /** The Market value of the current holding. */ marketVal: number; /** LTP is the price from which the next sale of the stocks happens. */ ltp: number; /** Profit and loss made. */ pl: number; } /** Overall status of equity and mutual fund holdings in this demat account. */ interface HoldingsOverall$1 { /** Total number of holdings present. */ count_total: number; /** Invested amount for the current holdings. */ total_investment: number; /** The present value of the holdings. */ total_current_value: number; /** Total profit and loss made. */ total_pl: number; /** Percentage value of the total pnl. */ pnl_perc: number; } /** Equity and mutual fund holdings which the user has in this demat account. */ interface GetHoldingsResponse extends Response { /** Details of each holding. */ holdings: Holding$1[]; /** Overall status of holdings in this demat account. */ overall: HoldingsOverall$1; } /** Order placed by the user in the current trading day. */ interface Order$1 { /** The unique order id assigned for each order. */ id: string; /** The order id provided by the exchange. */ exchOrdId: string; /** The symbol for which order is placed. */ symbol: string; /** Fytoken is a unique identifier for every symbol. */ fytoken: string; /** Short name for the symbol Eg: “SBIN-EQ”. */ ex_sym: string; /** Description of symbol for which order is placed. */ description: string; /** The segment this order is placed in. */ segment: number; /** Exchange instrument type. */ instrument: number; /** The exchange in which order is placed. */ exchange: number; /** The type of order. */ type: number; /** The order is buy or sell. */ side: number; /** The product type. */ productType: string; /** Source from where the order was placed. */ source: string; /** The status of the order. */ status: number; /** The order number and status of the order. */ orderNumStatus: number; /** True when placing AMO order. */ offlineOrder: string; /** The original order qty. */ qty: number; /** The remaining qty. */ remainingQuantity: number; /** The filled qty after partial trades. */ filledQty: number; /** The limit price for the order. */ limitPrice: number; /** The stop price for the order. */ stopPrice: number; /** Disclosed quantity. */ discloseQty: number; /** Remaining disclosed quantity. */ dqQtyRem: number; /** Day or IOC. */ orderValidity: string; /** The order time as per DD-MMM-YYYY hh:mm:ss in IST. */ orderDateTime: string; /** The parent order id will be provided only for applicable orders. */ parentId?: string; /** Price change from previous trading day. */ ch: number; /** Percent price change from previous trading day. */ chp: number; /** Last price of symbol. */ lp: number; /** The average traded price for the order. */ tradedPrice: number; /** This is used to sort the orders based on the time. */ slNo: number; /** The error messages are shown here. */ message: string; /** PAN of the client. */ pan: string; /** The client id of the fyers user. */ clientId: string; } /** Get order request. */ interface GetOrderRequest { /** The unique order id assigned for each order. */ id: string; } /** Get orders response. */ interface GetOrdersResponse extends Response { /** List of all orders places during the day. */ orderBook: Order$1[]; } /** Current open/closed position for the current trading day. */ interface Position$1 { /** The unique value for each position. */ id: string; /** Fytoken is a unique identifier for every symbol. */ fytoken: string; /** Eg: NSE:SBIN-EQ. */ symbol: string; /** The segment in which the position is taken. */ segment: number; /** The product type of the position. */ productType: string; /** The side shows whether the position is long / short. */ side: number; /** Absolute value of net qty. */ qty: number; /** Incase of commodity positions, this multiplier is required for p&l calculation. */ qtyMulti_com: number; /** Average buy price. */ buyAvg: number; /** Total buy qty. */ buyQty: number; /** Total buy value. */ buyVal: number; /** Average sell price. */ sellAvg: number; /** Total sell qty. */ sellQty: number; /** Total sell value. */ sellVal: number; /** Net average price. */ netAvg: number; /** Net qty. */ netQty: number; /** Average price (netAvg). */ avgPrice: number; /** The total p&l of the position. */ pl: number; /** The realized p&l of the position. */ realized_profit: number; /** The unrealized p&l of the open position. */ unrealized_profit: number; /** Is it a cross currency position? */ crossCurrency: string; /** Incase of cross currency position, the rbi reference rate will be required to calculate the p&l. */ rbiRefRate: number; /** LTP is the price from which the next sale of the stocks happens. */ ltp: number; /** This is used for sorting of positions. */ slNo: number; } /** Overall status of positions for the current trading day. */ interface PositionsOverall$1 { /** Total number of positions present. */ count_total: number; /** Total number of positions opened. */ count_open: number; /** Total profit and losses. */ pl_total: number; /** Profit and losses when the owned product is sold. */ pl_realized: number; /** Profit and loses when the product is owned, but is not sold. */ pl_unrealized: number; } /** Get postions response. */ interface GetPositionsResponse extends Response { /** List of all positions for the current trading day. */ netPositions: Position$1[]; /** Overall status of positions for the current trading day. */ overall: PositionsOverall$1; } /** Trade in the current trading day. */ interface Trade$1 { /** The unique id to sort the trades. */ id: string; /** The order id for which the trade occurred. */ orderNumber: string; /** The order number provided by the exchange. */ exchangeOrderNo: string; /** The trade number generated by the exchange. */ tradeNumber: string; /** Fytoken is a unique identifier for every symbol. */ fyToken: string; /** Eg: NSE:SBIN-EQ. */ symbol: string; /** The segment in which order is placed. */ segment: number; /** The exchange in which order is placed. */ exchange: number; /** The trade is buy or sell. */ transactionType: number; /** The product in which the order was placed. */ productType: string; /** The type of order. */ orderType: number; /** The time when the trade occured in “DD-MM-YYYY hh:mm:ss” format in IST. */ orderDateTime: string; /** The traded price. */ tradePrice: number; /** The total traded qty. */ tradedQty: number; /** The total traded value. */ tradeValue: number; /** Client id. */ clientId: string; /** ? */ row: number; } /** Get trades response. */ interface GetTradesResponse extends Response { /** List of all trades for the current trading day. */ tradeBook: Trade$1[]; } /** Place order request to an exchange via Fyers. */ interface PlaceOrderRequest { /** Eg: NSE:SBIN-EQ. */ symbol: string; /** The quantity should be in multiples of lot size for derivatives. */ qty: number; /** The type of order. */ type: number; /** The order is buy or sell. */ side: number; /** The product in which the order was placed. */ productType: string; /** Provide valid price for Limit and Stoplimit orders. */ limitPrice?: number; /** Provide valid price for Stop and Stoplimit orders. */ stopPrice?: number; /** Allowed only for Equity. */ disclosedQty?: number; /** Day or IOC. */ validity: string; /** True when placing AMO order. */ offlineOrder: string; /** Provide valid price for CO and BO orders. */ stopLoss?: number; /** Provide valid price for BO orders. */ takeProfit?: number; } /** Place/modify/cancel order reponse. */ interface OrderResponse extends Response { /** The order number of the placed/modified/cancelled order. */ id: string; } /** Place order reponse. */ declare type PlaceOrderResponse = OrderResponse; /** Place orders response. */ interface PlaceOrdersResponse extends Response { /** List of HTTP data for each order. */ data: ProxyResponse[]; } /** Modify order request to Fyers. */ interface ModifyOrderRequest { /** The unique order id assigned for each order. */ id: string; /** The type of order. */ type: number; /** The original order qty. */ qty?: number; /** Disclosed quantity. */ disclosedQty?: number; /** The limit price for the order. */ limitPrice?: number; /** The stop price for the order. */ stopPrice?: number; } /** Modify order response. */ declare type ModifyOrderResponse = OrderResponse; /** Modify orders response. */ interface ModifyOrdersResponse extends Response { /** List of HTTP data for each order. */ data: ProxyResponse[]; } /** Cancel order request to any exchange via Fyers. */ interface CancelOrderRequest { /** The order number of the placed order. */ id: string; } /** Cancel order response. */ declare type CancelOrderResponse = OrderResponse; /** Cancel orders response. */ interface CancelOrdersResponse extends Response { /** List of HTTP data for each order. */ data: ProxyResponse[]; } /** Exit position request to Fyers. */ interface ExitPositionRequest { /** Mandatory. Eg: NSE:FCONSUMER-EQ-INTRADAY. */ id: string; } /** Exit all positions response. */ interface ExitAllPositionsResponse extends Response { } /** Exit position response. */ interface ExitPositionResponse extends Response { } /** Convert position request to Fyers. */ interface ConvertPositionRequest { /** Mandatory. Eg: 119031547242. */ symbol: string; /** The side shows whether the position is long / short. */ positionSide: number; /** Quantity to be converted. Has to be in multiples of lot size for derivatives. */ convertQty: number; /** Existing productType (CNC positions cannot be converted). */ convertFrom: string; /** The new product type. */ convertTo: string; } /** Convert position response. */ interface ConvertPositionResponse extends Response { /** Unknown. */ positionDetails?: number; } /** Current market status of an exchange's segment. */ interface MarketStatus$1 { /** The exchange in which the position is taken. */ exchange: number; /** The segment in which the position is taken. */ segment: number; /** The type of market: NL, MS, ES, ... */ market_type: string; /** Market status: OPEN, CLOSE. */ status: string; } /** Market status response for all the exchanges and their segments. */ interface GetMarketStatusResponse extends Response { /** List of statuses of various markets. */ marketStatus: MarketStatus$1[]; } /** Market history request for a symbol. */ interface GetMarketHistoryRequest { /** Eg: NSE:RCOM-EQ. */ symbol: string; /** The candle resolution in minutes. */ resolution: string; /** 0 to enter the epoch value. 1 to enter the date format as yyyy-mm-dd. */ date_format: number; /** Indicating the start date of records (epoch, yyyy-mm-dd). */ range_from: string; /** Indicating the end date of records. */ range_to: string; /** Set cont flag 1 for continues data and future options. */ cont_flag: string; } /** Short candle used with market history [time, open, high, low, close, volume]. */ declare type ShortCandle = [number, number, number, number, number, number]; /** Market history of a particular stock response. */ interface GetMarketHistoryResponse extends Response { /** List of short candles. */ candles: ShortCandle[]; } /** Market quotes request for one or more symbols. */ interface GetMarketQuotesRequest { /** Eg: NSE:RCOM-EQ, ... */ symbols: string; } /** Candle in market quotes (1 minute). */ interface Candle$1 { /** UNIX expoch time. */ t: number; /** Open price (1 minute). */ o: number; /** High price (1 minute). */ h: number; /** Low price (1 minute). */ l: number; /** Close price (1 minute). */ c: number; /** Volume (1 minute). */ v: number; /** Time, formatted. */ tf: string; } /** Quote details of a particular symbol. */ interface MarketQuoteDetails { /** Change value. */ ch: number; /** Percentage of change between the current value and the previous day's market close. */ chp: number; /** Last traded price. */ lp: number; /** Difference between lowest asking and highest bidding price. */ spread: number; /** Asking price for the symbol. */ ask: number; /** Bidding price for the symbol. */ bid: number; /** Price at market opening time. */ open_price: number; /** Highest price for the day. */ high_price: number; /** Lowest price for the day. */ low_price: number; /** Close price of the previous trading day. */ prev_close_price: number; /** Volume traded. */ volume: number; /** Short name for the symbol Eg: “SBIN-EQ”. */ short_name: string; /** Name of the exchange. Eg: “NSE” or “BSE”. */ exchange: string; /** Description of the symbol. */ description: string; /** Original name of the symbol name provided by the use. */ original_name: string; /** Symbol name provided by the user. */ symbol: string; /** Fytoken is a unique identifier for every symbol. */ fyToken: string; /** Today’s time. */ tt: number; /** Current time, open, high, low price and volume with HH:MM timestamp. */ cmd: Candle$1; } /** Market quote for a particular symbol. */ interface MarketQuote$1 { /** Name of symbol. */ n: string; /** Status (ok). */ s: string; /** Market quote details. */ v: MarketQuoteDetails; } /** Market quotes response. */ interface GetMarketQuotesResponse extends Response { /** List of all market quotes. */ d: MarketQuote$1[]; } /** Market depth details request. */ interface GetMarketDepthRequest { /** Eg: NSE:RCOM-EQ. */ symbol: string; /** Set the ohlcv_flag to 1 to get open, high, low, closing and volume quantity. */ ohlcv_flag: number; } /** Open buy/sell orders at a particular price. */ interface MarketOffer$1 { /** Bid/ask price. */ price: number; /** Bid/ask volume. */ volume: number; /** Number of orders. */ ord: number; } /** A measure of the supply and demand for a symbol. */ interface MarketDepth$1 { /** Total buying quantity. */ totalbuyqty: number; /** Total selling quantity. */ totalsellqty: number; /** Bidding price along with volume and total number of orders. */ bids: MarketOffer$1[]; /** Offer price with volume and total number of orders. */ ask: MarketOffer$1[]; /** Price at market opening time. */ o?: number; /** Highest price for the day. */ h?: number; /** Lowest price for the day. */ l?: number; /** Price at the of market closing. */ c?: number; /** Volume traded. */ v?: number; /** Percentage of change between the current value and the previous day's market close. */ chp: number; /** Change value. */ ch: number; /** Last traded quantity. */ ltq: number; /** Last traded time. */ ltt: number; /** Last traded price. */ ltp: number; /** Average traded price. */ atp: number; /** Lower circuit price. */ lower_ckt: number; /** Upper circuit price. */ upper_ckt: number; /** Expiry date. */ expiry: string; /** Open interest. */ oi: number; /** Boolean flag for OI data, true or false. */ oiflag: false; /** Previous day open interest. */ pdoi: number; /** Change in open Interest percentage. */ oipercent: number; } /** Market depth details response. */ interface GetMarketDepthResponse extends Response { /** Dictionary of all market depth details. */ d: { [symbol: string]: MarketDepth$1; }; } /** Symbol category of master file request. */ interface GetSymbolMasterRequest { /** Name of the exchange (NSE, BSE, MCX). */ exchange: string; /** The segment whose symbols are needed (CM, FO, CD, COM). */ segment: string; } /** e-DIS TPIN generation reponse. */ interface GenerateEdisTpinResponse extends Response { /** Unknown, seen to be empty. */ data: string; } /** Details of an e-DIS transaction. */ interface EdisTransaction$1 { /** Transaction id. */ transactionId: string; /** Internal transaction id. */ internalTxnId: string; /** DP transaction id. */ dpTxnId: string; /** ISIN code of stock. */ isin: string; /** Quantity to transact. */ qty: number; /** Quantity already transacted? */ qtyUtlize: number; /** Transaction create date-time/ */ entryDate: string; /** Transaction processing start date? */ startDate: string; /** Transaction processing end date? */ endDate: string; /** No. of days since transaction create date? */ noOfDays: number; /** Source of transaction. */ source: string; /** SUCCESS, FAILURE? */ status: string; /** Unique client code? */ clientId: string; /** Error code (NA). */ errCode: string; /** Error count (0). */ errorCount: string; /** Message. */ reason: string; } /** e-DIS transaction details response. */ interface GetEdisTransactionsResponse extends Response { /** List of e-DIS transactions. */ data: EdisTransaction$1[] | string; } /** e-DIS securities held in a demat account. */ interface EdisHolding$1 { /** 12-digit alphanumeric code of specific symbol. */ isin_code: string; /** Quantity of securities held. */ qty: number; } /** e-DIS holdings submission request. */ interface SubmitEdisHoldingsRequest { /** Records of holdings of the user. */ recordLst: EdisHolding$1[]; } /** e-DIS transactions status inquiry request. */ interface InquireEdisTransactionRequest { /** Transaction id. */ transactionId: string; } /** e-DIS transaction status counts. */ interface EdisTransactionStatus { /** Failure count. */ FAILED_CNT: number; /** Success count. */ SUCEESS_CNT: number; } /** e-DIS transaction status inquiry response. */ interface InquireEdisTransactionResponse extends Response { /** Depository status data. */ data: EdisTransactionStatus; } /** * Get request step 1 for authorization (browser only). * @param options authorization step 1 details \{client_id, redirect_uri, response_type, state\} * @returns HTTP(s) request options for authorization step 1 (manual) */ declare function loginStep1$1(options: LoginStep1Request$1): HttpRequestOptions; /** * Get request step 2 for authorization (browser, server). * @param options authorization step 2 details \{graph_type, appIdHash, code\} * @returns HTTP(s) request options for authorization step 2 (manual) */ declare function loginStep2$1(options: LoginStep2Request$1): HttpRequestOptions; /** * Get basic details of the client. * @param auth authorization \{app_id, access_token\} * @returns details of user's profile \{fy_id, email_id, name, ...\} */ declare function getProfile$1(auth: Authorization$1): Promise; /** * Get balance available for the user for capital as well as the commodity market. * @param auth authorization \{app_id, access_token\} * @returns details of user's funds \{fund_limit: [\{id, title, equityAmount, commodityAmount\}]\} */ declare function getFunds$1(auth: Authorization$1): Promise; /** * Get the equity and mutual fund holdings which the user has in this demat account. * @param auth authorization \{app_id, access_token\} * @returns details of user's holdings \{holdings: \{id, ...\}, overall: \{count_total, ...\}\} */ declare function getHoldings$1(auth: Authorization$1): Promise; /** * Get details of an order placed in the current trading day. * @param auth authorization \{app_id, access_token\} * @param options order query \{id\} * @returns details of an order \{orderBook: [\{id, exchOrdId, symbol, ...\}]\} */ declare function getOrder$1(auth: Authorization$1, options: GetOrderRequest): Promise; /** * Get details of all the orders placed in the current trading day. * @param auth authorization \{app_id, access_token\} * @returns details of orders \{orderBook: [\{id, exchOrdId, symbol, ...\}]\} */ declare function getOrders$1(auth: Authorization$1): Promise; /** * Get details of all the positions in the current trading day. * @param auth authorization \{app_id, access_token\} * @returns details of positions \{netPositions: \{id, ...\}, overall: \{count_total, ...\}\} */ declare function getPositions$1(auth: Authorization$1): Promise; /** * Get details of all the trades in the current trading day. * @param auth authorization \{app_id, access_token\} * @returns details of trades \{tradeBook: [\{id, orderNumber, exchangeOrderNo, ...\}]\} */ declare function getTrades$1(auth: Authorization$1): Promise; /** * Place an order to any exchange via Fyers. * @param auth authorization \{app_id, access_token\} * @param options details of an order \{symbol, qty, type, side, ...\} * @returns place status \{id\} */ declare function placeOrder$1(auth: Authorization$1, options: PlaceOrderRequest): Promise; /** * Place multiple orders to any exchange via Fyers. * @param auth authorization \{app_id, access_token\} * @param options details of multiple orders [\{symbol, qty, type, side, ...\}] * @returns place status \{data: [\{statusCode, body: \{id\}, statusDescription\}]\} */ declare function placeOrders$1(auth: Authorization$1, options: PlaceOrderRequest[]): Promise; /** * Modify an order placed on any exchange via Fyers. * @param auth authorization \{app_id, access_token\} * @param options details of order \{id, qty, type, side, ...\} * @returns modify status \{id\} */ declare function modifyOrder$1(auth: Authorization$1, options: ModifyOrderRequest): Promise; /** * Modify orders placed on any exchange via Fyers. * @param auth authorization \{app_id, access_token\} * @param options details of orders [\{id, qty, type, side, ...\}] * @returns modify status \{data: [\{statusCode, body: \{id\}, statusDescription\}]\} */ declare function modifyOrders$1(auth: Authorization$1, options: ModifyOrderRequest[]): Promise; /** * Cancel an order placed on any exchange via Fyers. * @param auth authorization \{app_id, access_token\} * @param options details of order \{id\} * @returns cancel status \{id\} */ declare function cancelOrder$1(auth: Authorization$1, options: CancelOrderRequest): Promise; /** * Cancel orders placed on any exchange via Fyers. * @param auth authorization \{app_id, access_token\} * @param options details of orders [\{id\}] * @returns cancel status \{data: [\{statusCode, body: \{id\}, statusDescription\}]\} */ declare function cancelOrders$1(auth: Authorization$1, options: CancelOrderRequest[]): Promise; /** * Exit a position on the current trading day. * @param auth authorization \{app_id, access_token\} * @param options details of position \{id\} * @returns exit status \{\} */ declare function exitPosition$1(auth: Authorization$1, options: ExitPositionRequest): Promise; /** * Exit all positions on the current trading day. * @param auth authorization \{app_id, access_token\} * @returns exit status \{\} */ declare function exitAllPositions$1(auth: Authorization$1): Promise; /** * Convert a position on the current trading day. * @param auth authorization \{app_id, access_token\} * @param options details of position \{symbol, positionSide, convertQty, ...\} * @returns conversion status \{positionDetails\} */ declare function convertPosition$1(auth: Authorization$1, options: ConvertPositionRequest): Promise; /** * Get the current market status of all the exchanges and their segments. * @param auth authorization \{app_id, access_token\} * @returns market status \{marketStatus: [\{exchange, segment, market_type, status\}]\} */ declare function getMarketStatus$1(auth: Authorization$1): Promise; /** * Get the current market history for a particular symbol. * @param auth authorization \{app_id, access_token\} * @param options market details \{symbol, resolution, date_format, ...\} * @returns market history \{candles: \[\[time, open, high, low, close, volume\]\]\} */ declare function getMarketHistory$1(auth: Authorization$1, options: GetMarketHistoryRequest): Promise; /** * Get the current market quotes for a set of symbols. * @param auth authorization \{app_id, access_token\} * @param options market details \{symbols\} * @returns market quotes \{d: [\{n, s, v: \{ch, chp, lp, spread, ...\}\}]\} */ declare function getMarketQuotes$1(auth: Authorization$1, options: GetMarketQuotesRequest): Promise; /** * Get the current market depth for a particular symbol. * @param auth authorization \{app_id, access_token\} * @param options market details \{symbol, ohlcv_flag\} * @returns market depth \{d: \{: \{totalbuyqty, totalsellqty, bids\}\}\} */ declare function getMarketDepth$1(auth: Authorization$1, options: GetMarketDepthRequest): Promise; /** * Get all the latest symbols of all the exchanges from the symbol master files. * @param auth authorization (unused) * @param options details of symbol category \{exchange, segment\} * @returns symbol master file */ declare function getSymbolMaster$1(auth: null, options: GetSymbolMasterRequest): Promise; /** * Generate e-DIS TPIN for validating/authorising transaction. * @param auth authorization \{app_id, access_token\} * @returns optional data \{data\} */ declare function generateEdisTpin$1(auth: Authorization$1): Promise; /** * Get the necessary information regarding the holdings you have on your and also the Status of the holdings. If the “sell” for the particular holdings is a success or not. * @param auth authorization \{app_id, access_token\} * @returns list of e-DIS transactions \{data: [\{transactionId, internalTxnId, ...\}]\} */ declare function getEdisTransactions$1(auth: Authorization$1): Promise; /** * Redirect to CDSL page for login where you can submit your Holdings information and accordingly you can provide the same to exchange to Sell your holdings (browser only). * @param auth authorization \{app_id, access_token\} * @param options holding details \{recordLst: [\{isin_code, qty\}]\} * @returns HTTP(s) request options (manual) */ declare function submitEdisHoldingsStep$1(auth: Authorization$1, options: SubmitEdisHoldingsRequest): HttpRequestOptions; /** * Inquire the information/status of the provided transaction Id for the respective holdings you have on your end. * @param auth authorization \{app_id, access_token\} * @param options transaction details \{transactionId\} * @returns edis status \{FAILED_CNT, SUCEESS_CNT\} */ declare function inquireEdisTransaction$1(auth: Authorization$1, options: InquireEdisTransactionRequest): Promise; declare const http_d_API_URL: typeof API_URL; declare const http_d_DATA_URL: typeof DATA_URL; declare const http_d_SYMBOLS_URL: typeof SYMBOLS_URL; type http_d_Response = Response; type http_d_ProxyResponse = ProxyResponse; type http_d_GetProfileResponse = GetProfileResponse; type http_d_FundLimit = FundLimit; type http_d_GetFundsResponse = GetFundsResponse; type http_d_GetHoldingsResponse = GetHoldingsResponse; type http_d_GetOrderRequest = GetOrderRequest; type http_d_GetOrdersResponse = GetOrdersResponse; type http_d_GetPositionsResponse = GetPositionsResponse; type http_d_GetTradesResponse = GetTradesResponse; type http_d_PlaceOrderRequest = PlaceOrderRequest; type http_d_OrderResponse = OrderResponse; type http_d_PlaceOrderResponse = PlaceOrderResponse; type http_d_PlaceOrdersResponse = PlaceOrdersResponse; type http_d_ModifyOrderRequest = ModifyOrderRequest; type http_d_ModifyOrderResponse = ModifyOrderResponse; type http_d_ModifyOrdersResponse = ModifyOrdersResponse; type http_d_CancelOrderRequest = CancelOrderRequest; type http_d_CancelOrderResponse = CancelOrderResponse; type http_d_CancelOrdersResponse = CancelOrdersResponse; type http_d_ExitPositionRequest = ExitPositionRequest; type http_d_ExitAllPositionsResponse = ExitAllPositionsResponse; type http_d_ExitPositionResponse = ExitPositionResponse; type http_d_ConvertPositionRequest = ConvertPositionRequest; type http_d_ConvertPositionResponse = ConvertPositionResponse; type http_d_GetMarketStatusResponse = GetMarketStatusResponse; type http_d_GetMarketHistoryRequest = GetMarketHistoryRequest; type http_d_ShortCandle = ShortCandle; type http_d_GetMarketHistoryResponse = GetMarketHistoryResponse; type http_d_GetMarketQuotesRequest = GetMarketQuotesRequest; type http_d_MarketQuoteDetails = MarketQuoteDetails; type http_d_GetMarketQuotesResponse = GetMarketQuotesResponse; type http_d_GetMarketDepthRequest = GetMarketDepthRequest; type http_d_GetMarketDepthResponse = GetMarketDepthResponse; type http_d_GetSymbolMasterRequest = GetSymbolMasterRequest; type http_d_GenerateEdisTpinResponse = GenerateEdisTpinResponse; type http_d_GetEdisTransactionsResponse = GetEdisTransactionsResponse; type http_d_SubmitEdisHoldingsRequest = SubmitEdisHoldingsRequest; type http_d_InquireEdisTransactionRequest = InquireEdisTransactionRequest; type http_d_EdisTransactionStatus = EdisTransactionStatus; type http_d_InquireEdisTransactionResponse = InquireEdisTransactionResponse; declare namespace http_d { export { http_d_API_URL as API_URL, http_d_DATA_URL as DATA_URL, http_d_SYMBOLS_URL as SYMBOLS_URL, http_d_Response as Response, http_d_ProxyResponse as ProxyResponse, Authorization$1 as Authorization, LoginStep1Request$1 as LoginStep1Request, LoginStep1Response$1 as LoginStep1Response, LoginStep2Request$1 as LoginStep2Request, LoginStep2Response$1 as LoginStep2Response, Profile$1 as Profile, http_d_GetProfileResponse as GetProfileResponse, http_d_FundLimit as FundLimit, http_d_GetFundsResponse as GetFundsResponse, Holding$1 as Holding, HoldingsOverall$1 as HoldingsOverall, http_d_GetHoldingsResponse as GetHoldingsResponse, Order$1 as Order, http_d_GetOrderRequest as GetOrderRequest, http_d_GetOrdersResponse as GetOrdersResponse, Position$1 as Position, PositionsOverall$1 as PositionsOverall, http_d_GetPositionsResponse as GetPositionsResponse, Trade$1 as Trade, http_d_GetTradesResponse as GetTradesResponse, http_d_PlaceOrderRequest as PlaceOrderRequest, http_d_OrderResponse as OrderResponse, http_d_PlaceOrderResponse as PlaceOrderResponse, http_d_PlaceOrdersResponse as PlaceOrdersResponse, http_d_ModifyOrderRequest as ModifyOrderRequest, http_d_ModifyOrderResponse as ModifyOrderResponse, http_d_ModifyOrdersResponse as ModifyOrdersResponse, http_d_CancelOrderRequest as CancelOrderRequest, http_d_CancelOrderResponse as CancelOrderResponse, http_d_CancelOrdersResponse as CancelOrdersResponse, http_d_ExitPositionRequest as ExitPositionRequest, http_d_ExitAllPositionsResponse as ExitAllPositionsResponse, http_d_ExitPositionResponse as ExitPositionResponse, http_d_ConvertPositionRequest as ConvertPositionRequest, http_d_ConvertPositionResponse as ConvertPositionResponse, MarketStatus$1 as MarketStatus, http_d_GetMarketStatusResponse as GetMarketStatusResponse, http_d_GetMarketHistoryRequest as GetMarketHistoryRequest, http_d_ShortCandle as ShortCandle, http_d_GetMarketHistoryResponse as GetMarketHistoryResponse, http_d_GetMarketQuotesRequest as GetMarketQuotesRequest, Candle$1 as Candle, http_d_MarketQuoteDetails as MarketQuoteDetails, MarketQuote$1 as MarketQuote, http_d_GetMarketQuotesResponse as GetMarketQuotesResponse, http_d_GetMarketDepthRequest as GetMarketDepthRequest, MarketOffer$1 as MarketOffer, MarketDepth$1 as MarketDepth, http_d_GetMarketDepthResponse as GetMarketDepthResponse, http_d_GetSymbolMasterRequest as GetSymbolMasterRequest, http_d_GenerateEdisTpinResponse as GenerateEdisTpinResponse, EdisTransaction$1 as EdisTransaction, http_d_GetEdisTransactionsResponse as GetEdisTransactionsResponse, EdisHolding$1 as EdisHolding, http_d_SubmitEdisHoldingsRequest as SubmitEdisHoldingsRequest, http_d_InquireEdisTransactionRequest as InquireEdisTransactionRequest, http_d_EdisTransactionStatus as EdisTransactionStatus, http_d_InquireEdisTransactionResponse as InquireEdisTransactionResponse, loginStep1$1 as loginStep1, loginStep2$1 as loginStep2, getProfile$1 as getProfile, getFunds$1 as getFunds, getHoldings$1 as getHoldings, getOrder$1 as getOrder, getOrders$1 as getOrders, getPositions$1 as getPositions, getTrades$1 as getTrades, placeOrder$1 as placeOrder, placeOrders$1 as placeOrders, modifyOrder$1 as modifyOrder, modifyOrders$1 as modifyOrders, cancelOrder$1 as cancelOrder, cancelOrders$1 as cancelOrders, exitPosition$1 as exitPosition, exitAllPositions$1 as exitAllPositions, convertPosition$1 as convertPosition, getMarketStatus$1 as getMarketStatus, getMarketHistory$1 as getMarketHistory, getMarketQuotes$1 as getMarketQuotes, getMarketDepth$1 as getMarketDepth, getSymbolMaster$1 as getSymbolMaster, generateEdisTpin$1 as generateEdisTpin, getEdisTransactions$1 as getEdisTransactions, submitEdisHoldingsStep$1 as submitEdisHoldingsStep, inquireEdisTransaction$1 as inquireEdisTransaction, }; } /** Root URL for Market data notifications. */ declare const MARKET_DATA_URL: string; /** Root URL for Order update notifications. */ declare const ORDER_UPDATE_URL: string; /** Common notification format. */ declare type Notification = Response; /** Update for order placed by the user in the current trading day. */ interface OrderUpdate { /** The unique order id assigned for each order. */ id: string; /** The order id provided by the exchange. */ exchOrdId: string; /** The symbol for which order is placed. */ symbol: string; /** Fytoken is a unique identifier for every symbol. */ fyToken: string; /** The segment this order is placed in. */ segment: string; /** Exchange instrument type. */ instrument: string; /** The type of order. */ type: number; /** The order is buy or sell. */ side: number; /** The product type. */ productType: string; /** The status of the order. */ status: number; /** The order number and status of the order. */ orderNumStatus: string; /** True when placing AMO order. */ offlineOrder: boolean; /** The original order qty. */ qty: number; /** The remaining qty. */ remainingQuantity: number; /** The filled qty after partial trades. */ filledQty: number; /** The limit price for the order. */ limitPrice: number; /** The stop price for the order. */ stopPrice: number; /** Disclosed quantity. */ discloseQty: number; /** Remaining disclosed quantity. */ dqQtyRem: number; /** Day or IOC. */ orderValidity: string; /** The order time as per DD-MMM-YYYY hh:mm:ss in IST. */ orderDateTime: string; /** The parent order id will be provided only for applicable orders. */ parentId?: string; /** The average traded price for the order. */ tradedPrice: number; /** This is used to sort the orders based on the time. */ slNo: number; /** The error messages are shown here. */ message: string; } /** String notification on order update. */ interface OrderUpdateNotification$1 extends Notification { /** Websocket type [1]. */ ws_type?: number; /** Data for the notification. */ d?: OrderUpdate; } /** Header for each binary message. */ interface Header { /** Fytoken is a unique identifier for every symbol. */ token: BigInt; /** Timestamp sent by exchange (UNIX epoch). */ tt: number; /** 7202: OI data (NSE FO/CD, MCX), 7207/7208: NSE, BSE (indices/data), 31038: MCX. */ fyCode: number; /** Market status flag? */ marketStat: number; /** Packet length, including header? */ pktlen: number; /** Has L2 data (market depth)? */ L2: number; } /** Open interest data (fyCode === 7202). */ interface OiData { /** Open interest. */ oi: number; /** Previous day open interest. */ pdoi: number; } /** Common data (fyCode !== 7202). */ interface CommonData { /** Price conversion, divisor for all prices. */ price_conv: number; /** LTP is the price from which the next sale of the stocks happens. */ ltp: number; /** Price at market opening time. */ open_price: number; /** Highest price for the day. */ high_price: number; /** Lowest price for the day. */ low_price: number; /** Close price of the previous trading day. */ prev_close_price: number; /** Open price (1 minute). */ o: number; /** High price (1 minute). */ h: number; /** Low price (1 minute). */ l: number; /** Close price (1 minute). */ c: number; /** Volume (1 minute). */ v: BigInt; /** Open interest. */ oi: BigInt; /** Previous day open interest. */ pdoi: BigInt; } /** Additional data (fyCode === 7208, 31038). */ interface L1Data { /** Last traded quantity. */ LTQ: number; /** Last traded time (UNIX epoch). */ L2_LTT: number; /** Average traded price. */ ATP: number; /** Today's volume. */ volume: number; /** Total buy quantity. */ tot_buy: BigInt; /** Total sell quantity. */ tot_sell: BigInt; /** Highest bid price. */ bid: number; /** Lowest ask price. */ ask: number; } /** Open buy/sell orders at a particular price (L2 === 1). */ interface L2MarketOffer { /** Bid/ask price. */ price: number; /** Bid/ask volume. */ volume: number; /** Number of orders. */ ord: number; } /** Market depth data, 5 rows (L2 === 1). */ interface L2Data { /** Bidding price along with volume and total number of orders. */ bids: L2MarketOffer[]; /** Offer price with volume and total number of orders. */ asks: L2MarketOffer[]; } /** Market data (oi/quote/depth) for symbols subscribed by the user. */ interface MarketData extends Header, CommonData, L1Data, L2Data { } /** Binary notification on Market data. */ interface MarketDataNotification$1 extends Notification { /** Data for the notification. */ d?: MarketData; } /** * Notified function. * @param notification notification */ declare type OnNotification = (notification: Notification) => void; /** * Order update notified function. * @param notification notification */ declare type OnOrderUpdateNotification$1 = (notification: OrderUpdateNotification$1) => void; /** * Market data notified function. * @param notification notification */ declare type OnMarketDataNotification$1 = (notification: MarketDataNotification$1) => void; /** Handler for reciever which has passed (resolved). */ declare type OnResolve = (response: Response) => void; /** Handler for reciever which has failed (rejected). */ declare type OnReject = (error: Error) => void; /** Recieve response to a request, which can pass or fail. */ interface Reciever { /** Pass (resolve) handler for reciever. */ resolve: OnResolve; /** Fail (reject) handler for reciever. */ reject: OnReject; } /** * Provides the API for creating and managing a WebSocket connection to * a server, as well as for sending and receiving data on the connection. */ declare class Connection extends WebSocket { /** To recieve response to a request. */ recievers: Reciever[]; } /** * Connect to Order update URL with WebSocket. * @param auth authorization \{app_id, access_token\} * @param fn notified function * @returns WebSocket connection */ declare function connectOrderUpdate$1(auth: Authorization$1, fn: OnOrderUpdateNotification$1): Promise; /** * Subscribe to order update. * @param conn websocket connection */ declare function subscribeOrderUpdate$1(conn: Connection): Promise; /** * Unsubscribe to order update. * @param conn websocket connection */ declare function unsubscribeOrderUpdate$1(conn: Connection): Promise; /** * Connect to Market data URL with WebSocket. * @param auth authorization \{app_id, access_token\} * @param fn notified function * @returns WebSocket connection */ declare function connectMarketData$1(auth: Authorization$1, fn: OnMarketDataNotification$1): Promise; /** * Subscribe to market quote. * @param conn websocket connection * @param symbols list of symbols */ declare function subscribeMarketQuote$1(conn: Connection, symbols: string[]): Promise; /** * Subscribe to market depth. * @param conn websocket connection * @param symbols list of symbols */ declare function subscribeMarketDepth$1(conn: Connection, symbols: string[]): Promise; /** * Unsubscribe to market quote. * @param conn websocket connection * @param symbols list of symbols */ declare function unsubscribeMarketQuote$1(conn: Connection, symbols: string[]): Promise; /** * Unsubscribe to market depth. * @param conn websocket connection * @param symbols list of symbols */ declare function unsubscribeMarketDepth$1(conn: Connection, symbols: string[]): Promise; declare const websocket_d_MARKET_DATA_URL: typeof MARKET_DATA_URL; declare const websocket_d_ORDER_UPDATE_URL: typeof ORDER_UPDATE_URL; type websocket_d_Notification = Notification; type websocket_d_OrderUpdate = OrderUpdate; type websocket_d_Header = Header; type websocket_d_OiData = OiData; type websocket_d_CommonData = CommonData; type websocket_d_L1Data = L1Data; type websocket_d_L2MarketOffer = L2MarketOffer; type websocket_d_L2Data = L2Data; type websocket_d_MarketData = MarketData; type websocket_d_OnNotification = OnNotification; type websocket_d_OnResolve = OnResolve; type websocket_d_OnReject = OnReject; type websocket_d_Reciever = Reciever; type websocket_d_Connection = Connection; declare const websocket_d_Connection: typeof Connection; type websocket_d_Response = Response; declare namespace websocket_d { export { websocket_d_MARKET_DATA_URL as MARKET_DATA_URL, websocket_d_ORDER_UPDATE_URL as ORDER_UPDATE_URL, websocket_d_Notification as Notification, websocket_d_OrderUpdate as OrderUpdate, OrderUpdateNotification$1 as OrderUpdateNotification, websocket_d_Header as Header, websocket_d_OiData as OiData, websocket_d_CommonData as CommonData, websocket_d_L1Data as L1Data, websocket_d_L2MarketOffer as L2MarketOffer, websocket_d_L2Data as L2Data, websocket_d_MarketData as MarketData, MarketDataNotification$1 as MarketDataNotification, websocket_d_OnNotification as OnNotification, OnOrderUpdateNotification$1 as OnOrderUpdateNotification, OnMarketDataNotification$1 as OnMarketDataNotification, websocket_d_OnResolve as OnResolve, websocket_d_OnReject as OnReject, websocket_d_Reciever as Reciever, websocket_d_Connection as Connection, connectOrderUpdate$1 as connectOrderUpdate, subscribeOrderUpdate$1 as subscribeOrderUpdate, unsubscribeOrderUpdate$1 as unsubscribeOrderUpdate, connectMarketData$1 as connectMarketData, subscribeMarketQuote$1 as subscribeMarketQuote, subscribeMarketDepth$1 as subscribeMarketDepth, unsubscribeMarketQuote$1 as unsubscribeMarketQuote, unsubscribeMarketDepth$1 as unsubscribeMarketDepth, websocket_d_Response as Response, Authorization$1 as Authorization, }; } /** Exchange code. */ declare type Exchange = "NSE" | "MCX" | "BSE"; /** * Get exchange description. * @param code exchange code (NSE, MCX, BSE) * @returns exchange description */ declare function exchangeDescription(code: Exchange): string; /** * Get exchange code. * @param desc exchange description * @returns exchange code (NSE, MCX, BSE) */ declare function exchange(desc: string): Exchange; /** Segment code. */ declare type Segment = "CM" | "FO" | "CD" | "COM"; /** * Get segment description. * @param code segment code (CM, FO, CD, COM) * @returns segment description */ declare function segmentDescription(code: Segment): string; /** * Get segment code. * @param desc segment description * @returns segment code (CM, FO, CD, COM) */ declare function segment(desc: string): Segment; /** Position side code. */ declare type PositionSide = "LONG" | "SHORT" | "CLOSED"; /** * Get position side description. * @param code position side code (LONG, SHORT, CLOSED) * @returns position side description */ declare function positionSideDescription(code: PositionSide): string; /** * Get position side code. * @param desc position side description * @returns position side code (LONG, SHORT, CLOSED) */ declare function positionSide(desc: string): PositionSide; /** Order side code. */ declare type OrderSide = "BUY" | "SELL"; /** * Get order side description. * @param code order side code (BUY, SELL) * @returns order side description */ declare function orderSideDescription(code: OrderSide): string; /** * Get order side code. * @param desc order side description * @returns order side code (BUY, SELL) */ declare function orderSide(desc: string): OrderSide; /** Order source code. */ declare type OrderSource = "MOBILE" | "WEB" | "ONE" | "ADMIN" | "API"; /** * Get order source description. * @param code order source code (MOBILE, WEB, ONE, ADMIN, API) * @returns order source description */ declare function orderSourceDescription(code: OrderSource): string; /** * Get order source code. * @param desc order source description * @returns order source code (MOBILE, WEB, ONE, ADMIN, API) */ declare function orderSource(desc: string): OrderSource; /** Order status code. */ declare type OrderStatus = "CANCELLED" | "TRADED" | "TRANSIT" | "REJECTED" | "PENDING" | "EXPIRED"; /** * Get order status description. * @param code order status code (CANCELLED, TRADED, ...) * @returns order status description */ declare function orderStatusDescription(code: OrderStatus): string; /** * Get order status code. * @param desc order status description * @returns order status code (CANCELLED, TRADED, ...) */ declare function orderStatus(desc: string): OrderStatus; /** Order type code. */ declare type OrderType = "LIMIT" | "MARKET" | "SL_MARKET" | "SL_LIMIT"; /** * Get order type description. * @param code order type code (LIMIT, MARKET, SL_MARKET, SL_LIMIT) * @returns order type description */ declare function orderTypeDescription(code: OrderType): string; /** * Get order type code. * @param desc order type description * @returns order type code (LIMIT, MARKET, SL_MARKET, SL_LIMIT) */ declare function orderType(desc: string): OrderType; /** Order validity code. */ declare type OrderValidity = "DAY" | "IOC"; /** * Get order validity description. * @param code order validity code (DAY, IOC) * @returns order validity description */ declare function orderValidityDescription(code: OrderValidity): string; /** * Get order validity code. * @param desc order validity description * @returns order validity code (DAY, IOC) */ declare function orderValidity(desc: string): OrderValidity; /** Option type code. */ declare type OptionType = "CE" | "PE"; /** * Get option type description. * @param code option type code (CE, PE) * @returns option type description */ declare function optionTypeDescription(code: OptionType): string; /** * Get option type code. * @param desc option type description * @returns option type code (CE, PE) */ declare function optionType(desc: string): OptionType; /** Derivative type code. */ declare type DerivativeType = "FUT" | "CE" | "PE"; /** * Get derivative type description. * @param code derivative type code (FUT, CE, PE) * @returns derivative type description */ declare function derivativeTypeDescription(code: DerivativeType): string; /** * Get derivative type code. * @param desc derivative type description * @returns derivative type code (CE, PE) */ declare function derivativeType(desc: string): DerivativeType; /** Holding type code. */ declare type HoldingType = "T1" | "HLD"; /** * Get holding type description. * @param code holding type code (T1, HLD) * @returns holding type description */ declare function holdingTypeDescription(code: HoldingType): string; /** * Get holding type code. * @param desc holding type description * @returns holding type code (T1, HLD) */ declare function holdingType(desc: string): HoldingType; /** Product type code. */ declare type ProductType = "CNC" | "INTRADAY" | "MARGIN" | "CO" | "BO"; /** * Get product type description. * @param code product type code (CNC, INTRADAY, MARGIN, CO, BO) * @returns product type description */ declare function productTypeDescription(code: ProductType): string; /** * Get product type code. * @param desc product type description * @returns product type code (CNC, INTRADAY, MARGIN, CO, BO) */ declare function productType(desc: string): ProductType; /** Instrument type code. */ declare type InstrumentType = "EQ" | "PREFSHARES" | "DEBENTURES" | "WARRANTS" | "MISC" | "INDEX" | // CM segment "FUTIDX" | "FUTIVX" | "FUTSTK" | "OPTIDX" | "OPTSTK" | // FO segment "FUTCUR" | "FUTIRT" | "FUTIRC" | "OPTCUR" | "UNDCUR" | "UNDIRC" | "UNDIRT" | "UNDIRD" | "INDEX_CD" | "FUTIRD" | // CD segment "FUTCOM" | "OPTFUT" | "OPTCOM"; /** * Get instrument type description. * @param code instrument type code * @returns instrument type description */ declare function instrumentTypeDescription(code: InstrumentType): string; /** * Get instrument type code. * @param desc instrument type description * @returns instrument type code */ declare function instrumentType(desc: string): InstrumentType; /** Essential details of a symbol, as given in Symbol master CSV file. */ interface SymbolDetails { /** Eg: NSE:RCOM-EQ. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** Description of the symbol. */ description: string; /** Minimum lot size for the symbol. */ lotSize: number; /** ISIN code of stock. */ isin: string; } /** * Get symbol exchange, underlying, currency-pair, or commodity name. * @param code symbol code * @returns symbol name */ declare function symbolName(code: string): string; /** * Get symbol exchange. * @param code symbol code * @returns symbol exchange */ declare function symbolExchange(code: string): Exchange; /** * Get symbol exchange series. * @param code symbol code * @returns symbol exchange series (EQ, BE, MF, ME, ...) */ declare function symbolSeries(code: string): string | null; /** * Get symbol option type. * @param code symbol code * @returns symbol option type */ declare function symbolOptionType(code: string): OptionType | null; /** * Get symbol derivative type. * @param code symbol code * @returns symbol derivative type */ declare function symbolDerivativeType(code: string): DerivativeType | null; /** * Get symbol strike price. * @param code symbol code * @returns symbol strike price */ declare function symbolStrikePrice(code: string): number; /** * Get symbol token, a unique identifier. * @param code symbol code * @param map symbol details map * @returns symbol token */ declare function symbolToken(code: string, map: Map): string; /** * Get symbol description. * @param code symbol code * @param map symbol details map * @returns symbol description */ declare function symbolDescription(code: string, map: Map): string; /** * Get symbol ISIN. * @param code symbol code * @param map symbol details map * @returns symbol ISIN */ declare function symbolIsin(code: string, map: Map): string; /** * Get symbol minimum lot size. * @param code symbol code * @param map symbol details map * @returns symbol minimum lot size */ declare function symbolLotSize(code: string, map: Map): number; /** Attributes required for authorization of all requests. */ interface Authorization { /** This is the app_id which you have received after creating the app. */ appId: string; /** This value will be used for all the requests. */ accessToken: string; } /** Login step 1 request. */ interface LoginStep1Request { /** This is the app_id which you have received after creating the app. */ appId: string; /** This is where the user will be redirected after successful login. */ redirectUrl: string; /** The same value will be returned after successful login to the redirect uri. */ state: string; } /** Login step 1 response. */ interface LoginStep1Response { /** String value which will be used to generate the access_token. */ authorizationCode: string; /** This value is returned as is from the first request. */ state: string; } /** Login step 2 request. */ interface LoginStep2Request { /** SHA-256 of `api_id:app_secret` in hex. */ appHash: string; /** This is the auth_code which is received from the first step. */ authorizationCode: string; } /** Login step 2 response. */ interface LoginStep2Response { /** This value will be used for all the subsequent requests. */ accessToken: string; } /** Basic details of the client. */ interface Profile { /** The client id of the fyers user. */ id: string; /** Email address of the client. */ email: string; /** Name of the client. */ name: string; /** PAN of the client. */ pan: string; } /** Limits for equity/commodity fund. */ interface Fund { /** Limit at start of the day. */ start: number; /** Fund Transfer. */ deposits: number; /** Realized Profit and Loss. */ realizedReturns: number; /** Collaterals. */ collaterals: number; /** Adhoc Limit. */ adhoc: number; /** Utilized Amount. */ utilized: number; /** Receivables. */ receivables: number; /** Available Balance. */ available: number; /** Clear Balance. */ clear: number; /** Total Balance. */ total: number; } /** Balance available for the user for capital as well as the commodity market. */ interface Funds { /** Fund limits for capital market. */ equity: Fund; /** Fund limits for commodity market. */ commodity: Fund; } /** Details of each holding. */ interface Holding { /** 12-digit International Securities Identification Number. */ isin: string; /** Eg: NSE:RCOM-EQ. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** The exchange in which order is placed. */ exchange: Exchange; /** Identify the type of holding. */ type: HoldingType; /** The quantity of the symbol which the user has at the beginning of the day. */ quantity: number; /** This reflects the quantity - the quantity sold during the day. */ remainingQuantity: number; /** The original buy price of the holding. */ buyPrice: number; /** The original buy value of the holding. */ buyValue: number; /** LTP is the price from which the next sale of the stocks happens. */ currentPrice: number; /** The Market value of the current holding. */ currentValue: number; /** Profit and loss made. */ returns: number; /** Profit and loss percent made. */ returnsPercent: number; } /** Overall status of holdings in this demat account. */ interface HoldingsOverall { /** Total number of holdings present. */ count: number; /** Total number of settled holdings (HLD). */ settledCount: number; /** Invested amount for the current holdings. */ investedValue: number; /** The present value of the holdings. */ currentValue: number; /** Total profit and loss made. */ returns: number; /** Percentage value of the total pnl. */ returnsPercent: number; } /** Equity and mutual fund holdings which the user has in this demat account. */ interface Holdings { /** Details of each holding. */ details: Holding[]; /** Overall status of holdings in this demat account. */ overall: HoldingsOverall; } /** Order placed by the user in the current trading day. */ interface Order { /** The order id assigned for each order. */ id: string; /** The symbol for which order is placed. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** The name of symbol for which order is placed. */ name: string; /** The exchange in which order is placed. */ exchange: Exchange; /** Short name for the symbol Eg: “SBIN-EQ”. */ description?: string; /** The segment this order is placed in. */ segment: Segment; /** Exchange instrument type. */ instrument: InstrumentType; /** The type of order. */ type: OrderType; /** The order is buy or sell. */ side: OrderSide; /** The product type. */ productType: ProductType; /** Source from where the order was placed. */ source: OrderSource; /** The status of the order. */ status: OrderStatus; /** True when placing AMO order. */ offline: boolean; /** The limit price for the order. */ limitPrice: number; /** The stop price for the order. */ stopPrice: number; /** The original order qty. */ quantity: number; /** The remaining qty. */ remainingQuantity: number; /** The filled qty after partial trades. */ tradedQuantity: number; /** Disclosed quantity. */ disclosedQuantity: number; /** Remaining disclosed quantity. */ remainingDisclosedQuantity: number; /** Day or IOC. */ validity: OrderValidity; /** The order time as per DD-MMM-YYYY hh:mm:ss in IST. */ date: string; /** The parent order id will be provided only for applicable orders. */ parentId?: string; /** Price change from previous trading day. */ priceChange: number; /** Percent price change from previous trading day. */ priceChangePercent: number; /** Last price of symbol. */ currentPrice: number; /** The average traded price for the order. */ tradedPrice: number; /** The error messages are shown here. */ message: string; /** PAN of the client. */ pan: string; /** The client id of the fyers user. */ clientId: string; } /** Overall status of orders for the current trading day. */ interface OrdersOverall { /** Total number of orders present. */ count: number; /** Total number of open orders. */ openCount: number; /** Total number of closed orders. */ closedCount: number; /** The original order qty. */ quantity: number; /** The remaining qty. */ remainingQuantity: number; /** The filled qty after partial trades. */ tradedQuantity: number; /** Disclosed quantity. */ disclosedQuantity: number; /** Remaining disclosed quantity. */ remainingDisclosedQuantity: number; } /** All the orders placed by the user in the current trading day. */ interface Orders { /** List of all orders places during the day. */ details: Order[]; /** Overall status of orders. */ overall: OrdersOverall; } /** Current open and closed position for the current trading day. */ interface Position { /** The unique value for each position. */ id: string; /** Eg: NSE:SBIN-EQ. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** The segment in which the position is taken. */ segment: Segment; /** The product type of the position. */ productType: ProductType; /** The side shows whether the position is long / short. */ side: PositionSide; /** Absolute value of net qty. */ quantity: number; /** Incase of commodity positions, this multiplier is required for p&l calculation. */ quantityMultiplier: number; /** Average buy price. */ buyPrice: number; /** Total buy qty. */ buyQuantity: number; /** Total buy value. */ buyValue: number; /** Average sell price. */ sellPrice: number; /** Total sell qty. */ sellQuantity: number; /** Total sell value. */ sellValue: number; /** Net average price. */ netPrice: number; /** Net qty. */ netQuantity: number; /** The total p&l of the position. */ returns: number; /** The realized p&l of the position. */ realizedReturns: number; /** The unrealized p&l of the open position. */ unrealizedReturns: number; /** Is it a cross currency position? */ crossCurrency: boolean; /** Incase of cross currency position, the rbi reference rate will be required to calculate the p&l. */ rbiRefRate: number; /** LTP is the price from which the next sale of the stocks happens. */ currentPrice: number; } /** Overall status of positions for the current trading day. */ interface PositionsOverall { /** Total number of positions present. */ count: number; /** Total number of positions opened. */ openCount: number; /** Total number of positions closed. */ closedCount: number; /** Total buy value. */ buyValue: number; /** Total sell value. */ sellValue: number; /** Total profit and losses. */ returns: number; /** Profit and losses when the owned product is sold. */ realizedReturns: number; /** Profit and loses when the product is owned, but is not sold. */ unrealizedReturns: number; } /** Current open and closed positions for the current trading day. */ interface Positions { /** List of all positions for the current trading day. */ details: Position[]; /** Overall status of positions for the current trading day. */ overall: PositionsOverall; } /** Trade for the current day across all platforms and exchanges in the current trading day. */ interface Trade { /** The unique id to sort the trades. */ id: string; /** The order id for which the trade occurred. */ orderId: string; /** Eg: NSE:SBIN-EQ. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** The segment in which order is placed. */ segment: Segment; /** The exchange in which order is placed. */ exchange: Exchange; /** The trade is buy or sell. */ side: OrderSide; /** The product in which the order was placed. */ productType: ProductType; /** The type of order. */ orderType: OrderType; /** The time when the trade occured in “DD-MM-YYYY hh:mm:ss” format in IST. */ orderDate: string; /** The traded price. */ price: number; /** The total traded qty. */ quantity: number; /** The total traded value. */ value: number; /** Client id. */ clientId: string; } /** Overall trades for the current trading day. */ interface TradesOverall { /** Total number of trades. */ count: number; /** The total traded qty. */ quantity: number; /** The total traded value. */ value: number; } /** All the trades for the current day across all platforms and exchanges in the current trading day. */ interface Trades { /** List of all trades for the current trading day. */ details: Trade[]; /** Overall trades for the current trading day. */ overall: TradesOverall; } /** Defines an order to any exchange via Fyers. */ interface PlaceOrder { /** Eg: NSE:SBIN-EQ. */ symbol: string; /** The type of order. */ type?: OrderType; /** The order is buy or sell. */ side?: OrderSide; /** The product in which the order was placed. */ productType?: ProductType; /** Provide valid price for Limit and Stoplimit orders. */ limitPrice?: number; /** Provide valid price for Stop and Stoplimit orders. */ stopPrice?: number; /** The quantity should be in multiples of lot size for derivatives. */ quantity: number; /** Allowed only for Equity. */ disclosedQuantity?: number; /** Day or IOC. */ validity?: OrderValidity; /** True when placing AMO order. */ offline?: boolean; /** Provide valid price for CO and BO orders. */ stopLoss?: number; /** Provide valid price for BO orders. */ takeProfit?: number; } /** Defines an order modification request to Fyers. */ interface ModifyOrder { /** The order id assigned for each order. */ id: string; /** The type of order. */ type: OrderType; /** The original order qty. */ quantity?: number; /** Disclosed quantity. */ disclosedQuantity?: number; /** The limit price for the order. */ limitPrice?: number; /** The stop price for the order. */ stopPrice?: number; } /** Defines a convert position request to Fyers. */ interface ConvertPosition { /** Mandatory. Eg: 119031547242. */ symbol: string; /** The side shows whether the position is long / short. */ side?: PositionSide; /** Quantity to be converted. Has to be in multiples of lot size for derivatives. */ quantity: number; /** Existing productType (CNC positions cannot be converted). */ fromProductType?: ProductType; /** The new product type. */ toProductType?: ProductType; } /** Current market status of an exchange's segment. */ interface MarketStatus { /** The exchange in which the position is taken. */ exchange: Exchange; /** The segment in which the position is taken. */ segment: Segment; /** TODO: The type of market: NL, MS, ES, ... */ type: string; /** TODO: Market status: OPEN, CLOSE. */ status: string; } /** Overall status of market segments. */ interface MarketsStatusOverall { /** Total number of market segments. */ count: number; /** Total number of open market segments. */ openCount: number; /** Total number of closed market segments. */ closedCount: number; } /** Market status of all the exchanges and their segments. */ interface MarketsStatus { /** List of statuses of various market segments. */ details: MarketStatus[]; /** Overall status of market segments. */ overall: MarketsStatusOverall; } /** Request for getting market history of a symbol. */ interface GetMarketHistory { /** Eg: NSE:RCOM-EQ. */ symbol: string; /** The candle resolution in minutes. */ resolution: number; /** Indicating the start date of records (epoch, yyyy-mm-dd). */ fromDate: number; /** Indicating the end date of records. */ toDate: number; /** Set cont flag 1 for continues data and future options. */ continuous: boolean; } /** Candle in market history, quotes. */ interface Candle { /** UNIX epoch time. */ date: number; /** Open price. */ openPrice: number; /** High price. */ highPrice: number; /** Low price. */ lowPrice: number; /** Previous Close price. */ closePrice: number; /** Volume. */ volume: number; } /** Overall market history details. */ interface MarketHistoryOverall { /** Start UNIX epoch time. */ fromDate: number; /** Stop UNIX epoch time. */ toDate: number; /** Open price. */ openPrice: number; /** High price. */ highPrice: number; /** Low price. */ lowPrice: number; /** Close price. */ closePrice: number; /** Volume. */ volume: number; } /** Market history of a particular stock. */ interface MarketHistory { /** List of candes. */ details: Candle[]; /** Overall status of market history. */ overall: MarketHistoryOverall; } /** Market quote details for a particular symbol. */ interface MarketQuote { /** Symbol name provided by the user. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** Short name for the symbol Eg: “SBIN-EQ”. */ name: string; /** Name of the exchange. Eg: “NSE” or “BSE”. */ exchange: Exchange; /** Description of the symbol. */ description?: string; /** Today’s time. */ date: number; /** Last traded price. */ currentPrice: number; /** Price at market opening time. */ openPrice: number; /** Highest price for the day. */ highPrice: number; /** Lowest price for the day. */ lowPrice: number; /** Close price of the previous trading day. */ closePrice: number; /** Volume traded. */ volume: number; /** Change value. */ priceChange: number; /** Percentage of change between the current value and the previous day's market close. */ priceChangePercent: number; /** Current time, open, high, low price and volume with HH:MM timestamp. */ candle: Candle; /** Asking price for the symbol. */ sellPrice: number; /** Bidding price for the symbol. */ buyPrice: number; /** Difference between lowest asking and highest bidding price. */ priceSpread: number; } /** Open buy/sell orders at a particular price. */ interface MarketOffer { /** Bid/ask price. */ price: number; /** Bid/ask volume. */ volume: number; /** Orders? */ orders: number; } /** A measure of the supply and demand for a symbol. */ interface MarketDepth { /** Symbol name provided by the user. */ symbol: string; /** A unique identifier for every symbol. */ token: string | null; /** Short name for the symbol Eg: “SBIN-EQ”. */ name: string; /** Name of the exchange. Eg: “NSE” or “BSE”. */ exchange: Exchange; /** Expiry date. */ expiryDate: string; /** Last traded price. */ currentPrice: number; /** Lower circuit price. */ lowerCircuitPrice: number; /** Upper circuit price. */ upperCircuitPrice: number; /** Price at market opening time. */ openPrice?: number; /** Highest price for the day. */ highPrice?: number; /** Lowest price for the day. */ lowPrice?: number; /** Price at the of market closing. */ closePrice?: number; /** Volume traded. */ volume?: number; /** Change value. */ priceChange: number; /** Percentage of change between the current value and the previous day's market close. */ priceChangePercent: number; /** Open interest. */ openInterest: number; /** Previous day open interest. */ previousOpenInterest: number; /** Change in open Interest percentage. */ openInterestChangePercent: number; /** Last traded time. */ tradedDate: number; /** Last traded quantity. */ tradedQuantity: number; /** Average traded price. */ netPrice: number; /** Total buying quantity. */ buyQuantity: number; /** Total selling quantity. */ sellQuantity: number; /** Bidding price along with volume and total number of orders. */ buyOffers: MarketOffer[]; /** Offer price with volume and total number of orders. */ sellOffers: MarketOffer[]; } /** Details of an e-DIS transaction. */ interface EdisTransaction { /** Transaction id. */ id: string; /** ISIN code of stock. */ isin: string; /** Quantity to transact. */ quantity: number; /** Quantity already transacted? */ remainingQuantity: number; /** Transaction create date-time/ */ entryDate: string; /** Transaction processing start date? */ startDate: string; /** Transaction processing end date? */ endDate: string; /** Source of transaction. */ source: string; /** SUCCESS, FAILURE? */ status: string; /** Unique client code? */ clientId: string; /** Error code (NA). */ errorCode: string; /** Error count (0). */ errorCount: string; /** Message. */ reason: string; } /** Overall status of e-DIS transaction in this demat account. */ interface EdisTransactionsOverall { /** Total number of transactions. */ count: number; /** Quantity to transact. */ quantity: number; /** Quantity already transacted? */ remainingQuantity: number; } /** Details of all e-DIS transactions. */ interface EdisTransactions { /** List of e-DIS transactions. */ details: EdisTransaction[]; /** Overall status of transactions. */ overall: EdisTransactionsOverall; } /** e-DIS securities held in a demat account. */ interface EdisHolding { /** 12-digit alphanumeric code of specific symbol. */ isin: string; /** Quantity of securities held. */ quantity: number; } /** Order update notification from WebSocket. */ interface OrderUpdateNotification { /** The unique order id assigned for each order. */ id: string; /** The symbol for which order is placed. */ symbol: string; /** A unique identifier for every symbol. */ token: string; /** The type of order. */ type: OrderType; /** The order is buy or sell. */ side: OrderSide; /** The product type. */ productType: ProductType; /** The status of the order. */ status: OrderStatus; /** Day or IOC. */ validity: OrderValidity; /** True when placing AMO order. */ offline: boolean; /** The original order qty. */ quantity: number; /** The remaining qty. */ remainingQuantity: number; /** The filled qty after partial trades. */ filledQuantity: number; /** Disclosed quantity. */ disclosedQuantity: number; /** Remaining disclosed quantity. */ remainingDisclosedQuantity: number; /** The limit price for the order. */ limitPrice: number; /** The stop price for the order. */ stopPrice: number; /** The order time as per DD-MMM-YYYY hh:mm:ss in IST. */ date: string; /** The parent order id will be provided only for applicable orders. */ parentId?: string; /** The average traded price for the order. */ tradedPrice: number; /** The error messages are shown here. */ message: string; } /** Market quote notification from WebSocket. */ interface MarketQuoteNotification { /** The symbol for which order is placed. */ symbol?: string; /** A unique identifier for every symbol. */ token: string; /** Short name for the symbol Eg: “SBIN-EQ”. */ name: string | null; /** Name of the exchange. Eg: “NSE” or “BSE”. */ exchange: Exchange | null; /** Timestamp sent by exchange (UNIX epoch). */ date: number; /** Market status flag? */ marketStatus: number; /** LTP is the price from which the next sale of the stocks happens. */ currentPrice: number; /** Price at market opening time. */ openPrice: number; /** Highest price for the day. */ highPrice: number; /** Lowest price for the day. */ lowPrice: number; /** Close price of the previous trading day. */ closePrice: number; /** Change value. */ priceChange: number; /** Percentage of change between the current value and the previous day's market close. */ priceChangePercent: number; /** 1 minute candle. */ candle: Candle; /** Open interest. */ openInterest: number; /** Previous day open interest. */ previousOpenInterest: number; /** Last traded quantity. */ tradedQuantity: number; /** Last traded time (UNIX epoch). */ tradedDate: number; /** Average traded price. */ tradedPrice: number; /** Today's volume. */ volume: number; /** Total buy quantity. */ buyQuantity: number; /** Total sell quantity. */ sellQuantity: number; /** Highest bid price. */ buyPrice: number; /** Lowest ask price. */ sellPrice: number; /** Difference between lowest asking and highest bidding price. */ priceSpread: number; } /** Market depth notification from WebSocket. */ interface MarketDepthNotification extends MarketQuoteNotification { /** Bidding price along with volume and total number of orders. */ buyOffers: MarketOffer[]; /** Offer price with volume and total number of orders. */ sellOffers: MarketOffer[]; } /** Market depth notification from WebSocket. */ interface MarketDataNotification extends MarketDepthNotification { } /** * Market data notified function. * @param notification notification */ declare type OnMarketDataNotification = (notification: MarketDataNotification) => void; /** * Order update notified function. * @param notification notification */ declare type OnOrderUpdateNotification = (notification: OrderUpdateNotification) => void; /** * Get equity delivery charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function equityDeliveryCharges(side: OrderSide, value: number): number; /** * Get equity intraday charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function equityIntradayCharges(side: OrderSide, value: number): number; /** * Get equity futures charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function equityFuturesCharges(side: OrderSide, value: number): number; /** * Get equity options charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function equityOptionsCharges(side: OrderSide, value: number): number; /** * Get currency futures charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function currencyFuturesCharges(side: OrderSide, value: number): number; /** * Get currency options charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function currencyOptionsCharges(side: OrderSide, value: number): number; /** * Get commodity futures charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function commodityFuturesCharges(side: OrderSide, value: number): number; /** * Get commodity options charges. * @param side order side (BUY, SELL) * @param value traded value * @returns total charges including brokerage and taxes */ declare function commodityOptionsCharges(side: OrderSide, value: number): number; /** * Get request step 1 for authorization. * @param appId app_id which you have received after creating the app * @param redirectUrl where the user will be redirected after login * @param state same value will be returned after login to the redirect url * @returns request step 1 for authorization */ declare function loginStep1(appId: string, redirectUrl: string, state?: string): HttpRequestOptions; /** * Get request step 2 for authorization. * @param appHash SHA-256 of `api_id:app_secret` in hex * @param authorizationCode auth_code which is received from the first step * @returns request step 2 for authorization */ declare function loginStep2(appHash: string, authorizationCode: string): HttpRequestOptions; /** * Get basic details of the client. * @param auth authorization \{appId, accessToken\} * @returns details of user's profile \{id, email, name, ...\} */ declare function getProfile(auth: Authorization): Promise; /** * Get balance available for the user for capital as well as the commodity market. * @param auth authorization \{appId, accessToken\} * @returns details of user's funds \{equity: \{start, ...\}, commodity: \{start, ...\}\} */ declare function getFunds(auth: Authorization): Promise; /** * Get the equity and mutual fund holdings which the user has in this demat account. * @param auth authorization \{appId, accessToken\} * @returns details of user's holdings \{details: [\{isin, ...\}], overall: \{count, ...\}\} */ declare function getHoldings(auth: Authorization): Promise; /** * Get details of an order placed in the current trading day. * @param auth authorization \{appId, accessToken\} * @param id order id * @returns details of an order \{id, symbol, ticker, ...\} */ declare function getOrder(auth: Authorization, id: string): Promise; /** * Get details of all the orders placed in the current trading day. * @param auth authorization \{appId, accessToken\} * @returns details of orders \{details: [\{id, ...\}], overall: \{count, ...\}\} */ declare function getOrders(auth: Authorization): Promise; /** * Get details of all the positions in the current trading day. * @param auth authorization \{appId, accessToken\} * @returns details of positions \{details: [\{id, ...\}], overall: \{count, ...\}\} */ declare function getPositions(auth: Authorization): Promise; /** * Get details of all the trades in the current trading day. * @param auth authorization \{appId, accessToken\} * @returns details of trades \{details: [\{id, ...\}], overall: \{count, ...\}\} */ declare function getTrades(auth: Authorization): Promise; /** * Place an order to any exchange via Fyers. * @param auth authorization \{appId, accessToken\} * @param order details of an order \{symbol, type, side, ...\} * @returns order id */ declare function placeOrder(auth: Authorization, order: PlaceOrder): Promise; /** * Place multiple orders to any exchange via Fyers. * @param auth authorization \{appId, accessToken\} * @param orders details of multiple orders [\{symbol, type, side, ...\}] * @returns unique order ids */ declare function placeOrders(auth: Authorization, orders: PlaceOrder[]): Promise[]; /** * Modifies an order placed on any exchange via Fyers. * @param auth authorization \{appId, accessToken\} * @param order details of order \{id, type, quantity, ...\} * @returns order id */ declare function modifyOrder(auth: Authorization, order: ModifyOrder): Promise; /** * Modifies orders placed on any exchange via Fyers. * @param auth authorization \{appId, accessToken\} * @param orders details of orders [\{id, type, quantity, ...\}] * @returns unique order ids */ declare function modifyOrders(auth: Authorization, orders: ModifyOrder[]): Promise[]; /** * Cancels an order placed on any exchange via Fyers. * @param auth authorization \{appId, accessToken\} * @param id order id * @returns order id */ declare function cancelOrder(auth: Authorization, id: string): Promise; /** * Cancels orders placed on any exchange via Fyers. * @param auth authorization \{appId, accessToken\} * @param ids unique order ids * @returns unique order ids */ declare function cancelOrders(auth: Authorization, ids: string[]): Promise[]; /** * Exits a position on the current trading day. * @param auth authorization \{appId, accessToken\} * @param id position id */ declare function exitPosition(auth: Authorization, id: string): Promise; /** * Exits all positions on the current trading day. * @param auth authorization \{appId, accessToken\} */ declare function exitAllPositions(auth: Authorization): Promise; /** * Converts a position on the current trading day. * @param auth authorization \{appId, accessToken\} * @param conversion details of conversion \{symbol, side, quantity, ...\} */ declare function convertPosition(auth: Authorization, conversion: ConvertPosition): Promise; /** * Get the current market status of all the exchanges and their segments. * @param auth authorization \{appId, accessToken\} * @returns markets status \{details: [\{exchange, ...\}], overall: \{count, ...\}\} */ declare function getMarketStatus(auth: Authorization): Promise; /** * Get the market history for a particular symbol. * @param auth authorization \{appId, accessToken\} * @param market market details \{symbol, resolution, fromDate, ...\} * @returns market history \{details: [\{date, ...\}], overall: \{dateFrom, ...\}\} */ declare function getMarketHistory(auth: Authorization, market: GetMarketHistory): Promise; /** * Get the current market quotes for a set of symbols. * @param auth authorization \{appId, accessToken\} * @param symbols list of symbols * @returns market quotes [\{symbol, name, exchange, ...\}] */ declare function getMarketQuotes(auth: Authorization, symbols: string[]): Promise; /** * Get the current market depth for a particular symbol. * @param auth authorization \{appId, accessToken\} * @param symbol symbol name * @returns market depth \{buyQuantity, sellQuantity, buyOffers, ...\} */ declare function getMarketDepth(auth: Authorization, symbol: string): Promise; /** * Get all the latest symbols of all the exchanges from the symbol master files. * @param auth authorization (unused) * @param exchange exchange name * @param segment segment name * @returns symbol master file as text */ declare function getSymbolMaster(auth: null, exchange: string, segment: string): Promise; /** * Get details of symbols from the symbol master file text. * @param csv symbol master file text * @returns list of symbol details [\{symbol, description, lotSize, ...\}] */ declare function processSymbolMaster(csv: string): SymbolDetails[]; /** * Get details of symbols from the symbol master files. * @param auth authorization (unused) * @param exchange exchange name * @param segment segment name * @returns list of symbol details [\{symbol, description, lotSize, ...\}] */ declare function loadSymbolMaster(auth: null, exchange: string, segment: string): Promise; /** * Generate e-DIS TPIN for validating/authorising transaction. * @param auth authorization \{appId, accessToken\} */ declare function generateEdisTpin(auth: Authorization): Promise; /** * Get the necessary information regarding the holdings you have on your and also the status of the holdings. If the “sell” for the particular holdings is a success or not. * @param auth authorization \{appId, accessToken\} * @returns list of e-DIS transactions \{details: [\{id, isin, ...\}], overall: \{count, quantity, ...\}\} */ declare function getEdisTransactions(auth: Authorization): Promise; /** * Redirect to CDSL page for login where you can submit your Holdings information and accordingly you can provide the same to exchange to Sell your holdings (browser only). * @param auth authorization \{appId, accessToken\} * @param holdings holding details [\{isin, quantity\}] * @returns HTTP(s) request options (manual) */ declare function submitEdisHoldingsStep(auth: Authorization, holdings: EdisHolding[]): HttpRequestOptions; /** * Inquire the information/status of the provided transaction Id for the respective holdings you have on your end. * @param auth authorization \{appId, accessToken\} * @param id transaction id * @returns edis status */ declare function inquireEdisTransaction(auth: Authorization, id: string): Promise; /** * Connect to Order update URL with WebSocket. * @param auth authorization \{appId, accessToken\} * @param fn notified function * @returns WebSocket connection */ declare function connectOrderUpdate(auth: Authorization, fn: OnOrderUpdateNotification): Promise; /** * Subscribe to order update. * @param conn websocket connection */ declare function subscribeOrderUpdate(conn: Connection): Promise; /** * Unsubscribe to order update. * @param conn websocket connection */ declare function unsubscribeOrderUpdate(conn: Connection): Promise; /** * Connect to Market data URL with WebSocket. * @param auth authorization \{appId, accessToken\} * @param fn notified function * @returns WebSocket connection */ declare function connectMarketData(auth: Authorization, fn: OnMarketDataNotification, map?: Map): Promise; /** * Subscribe to market quote. * @param conn websocket connection * @param symbols list of symbols */ declare function subscribeMarketQuote(conn: Connection, symbols: string[]): Promise; /** * Subscribe to market depth. * @param conn websocket connection * @param symbols list of symbols */ declare function subscribeMarketDepth(conn: Connection, symbols: string[]): Promise; /** * Unsubscribe to market quote. * @param conn websocket connection * @param symbols list of symbols */ declare function unsubscribeMarketQuote(conn: Connection, symbols: string[]): Promise; /** * Unsubscribe to market depth. * @param conn websocket connection * @param symbols list of symbols */ declare function unsubscribeMarketDepth(conn: Connection, symbols: string[]): Promise; /** Stateful interface for FYERS API. */ declare class Api implements Authorization { appId: string; accessToken: string; /** Symbol to symbol details map. */ symbolDetails: Map; /** Token to symbol map. */ tokenSymbol: Map; /** Order update notification connection. */ orderUpdateConnection: Promise; /** Market data notification connection. */ marketDataConnection: Promise; /** * Create a container that stores authorization, symbol maps, and connections (WebSocket). * @param appId unique app_id received after creating app * @param accessToken access token for the current trading day recieved after authorization */ constructor(appId: string, accessToken: string); /** * Get request step 1 for authorization. * @param appId app_id which you have received after creating the app * @param redirectUrl where the user will be redirected after login * @param state same value will be returned after login to the redirect url * @returns request step 1 for authorization */ static loginStep1(appId: string, redirectUrl: string, state?: string): HttpRequestOptions; /** * Get request step 2 for authorization. * @param appHash SHA-256 of `api_id:app_secret` in hex * @param authorizationCode auth_code which is received from the first step * @returns request step 2 for authorization */ static loginStep2(appHash: string, authorizationCode: string): HttpRequestOptions; /** * Get all the latest symbols of all the exchanges from the symbol master files. * @param exchange exchange name * @param segment segment name * @returns symbol master file as text */ static getSymbolMaster(exchange: string, segment: string): Promise; /** * Get basic details of the client. * @returns details of user's profile \{id, email, name, ...\} */ getProfile(): Promise; /** * Get balance available for the user for capital as well as the commodity market. * @returns details of user's funds \{equity: \{start, ...\}, commodity: \{start, ...\}\} */ getFunds(): Promise; /** * Get the equity and mutual fund holdings which the user has in this demat account. * @returns details of user's holdings \{details: [\{isin, ...\}], overall: \{count, ...\}\} */ getHoldings(): Promise; /** * Get details of an order placed in the current trading day. * @param id order id * @returns details of an order \{id, symbol, ticker, ...\} */ getOrder(id: string): Promise; /** * Get details of all the orders placed in the current trading day. * @returns details of orders \{details: [\{id, ...\}], overall: \{count, ...\}\} */ getOrders(): Promise; /** * Get details of all the positions in the current trading day. * @returns details of positions \{details: [\{id, ...\}], overall: \{count, ...\}\} */ getPositions(): Promise; /** * Get details of all the trades in the current trading day. * @returns details of trades \{details: [\{id, ...\}], overall: \{count, ...\}\} */ getTrades(): Promise; /** * Place an order to any exchange via Fyers. * @param order details of an order \{symbol, type, side, ...\} * @returns order id */ placeOrder(order: PlaceOrder): Promise; /** * Place multiple orders to any exchange via Fyers. * @param orders details of multiple orders [\{symbol, type, side, ...\}] * @returns unique order ids */ placeOrders(orders: PlaceOrder[]): Promise[]; /** * Modifies an order placed on any exchange via Fyers. * @param order details of order \{id, type, quantity, ...\} * @returns order id */ modifyOrder(order: ModifyOrder): Promise; /** * Modifies orders placed on any exchange via Fyers. * @param orders details of orders [\{id, type, quantity, ...\}] * @returns unique order ids */ modifyOrders(orders: ModifyOrder[]): Promise[]; /** * Cancels an order placed on any exchange via Fyers. * @param id order id * @returns order id */ cancelOrder(id: string): Promise; /** * Cancels orders placed on any exchange via Fyers. * @param ids unique order ids * @returns unique order ids */ cancelOrders(ids: string[]): Promise[]; /** * Exits a position on the current trading day. * @param id position id * @returns position status */ exitPosition(id: string): Promise; /** * Exits all positions on the current trading day. * @returns positions status */ exitAllPositions(): Promise; /** * Converts a position on the current trading day. * @param conversion details of conversion \{symbol, side, quantity, ...\} * @returns conversion status */ convertPosition(conversion: ConvertPosition): Promise; /** * Get the current market status of all the exchanges and their segments. * @returns markets status \{details: [\{exchange, ...\}], overall: \{count, ...\}\} */ getMarketStatus(): Promise; /** * Get the market history for a particular symbol. * @param market market details \{symbol, resolution, fromDate, ...\} * @returns market history \{details: [\{date, ...\}], overall: \{dateFrom, ...\}\} */ getMarketHistory(market: GetMarketHistory): Promise; /** * Get the current market quotes for a set of symbols. * @param symbols list of symbols * @returns market quotes [\{symbol, name, exchange, ...\}] */ getMarketQuotes(symbols: string[]): Promise; /** * Get the current market depth for a particular symbol. * @param symbol symbol name * @returns market depth \{buyQuantity, sellQuantity, buyOffers, ...\} */ getMarketDepth(symbol: string): Promise; /** * Get details of symbols from the symbol master file text. * @param csv symbol master file text * @returns list of symbol details [\{symbol, description, lotSize, ...\}] */ processSymbolMaster(csv: string): SymbolDetails[]; /** * Get details of symbols from the symbol master files. * @param exchange exchange name * @param segment segment name * @returns list of symbol details [\{symbol, description, lotSize, ...\}] */ loadSymbolMaster(exchange: string, segment: string): Promise; /** * Generate e-DIS TPIN for validating/authorising transaction. * @returns optional data */ generateEdisTpin(): Promise; /** * Get the necessary information regarding the holdings you have on your and also the status of the holdings. If the “sell” for the particular holdings is a success or not. * @returns list of e-DIS transactions \{details: [\{id, isin, ...\}], overall: \{count, quantity, ...\}\} */ getEdisTransactions(): Promise; /** * Redirect to CDSL page for login where you can submit your Holdings information and accordingly you can provide the same to exchange to Sell your holdings (browser only). * @param holdings holding details [\{isin, quantity\}] * @returns HTTP(s) request options (manual) */ submitEdisHoldingsStep(holdings: EdisHolding[]): HttpRequestOptions; /** * Inquire the information/status of the provided transaction Id for the respective holdings you have on your end. * @param id transaction id * @returns edis status */ inquireEdisTransaction(id: string): Promise; /** * Connect to Order update URL with WebSocket. * @param fn notified function * @returns WebSocket connection */ connectOrderUpdate(fn: OnOrderUpdateNotification): Promise; /** * Subscribe to order update. */ subscribeOrderUpdate(): Promise; /** * Unsubscribe to order update. */ unsubscribeOrderUpdate(): Promise; /** * Connect to Market data URL with WebSocket. * @param fn notified function * @returns WebSocket connection */ connectMarketData(fn: OnMarketDataNotification): Promise; /** * Subscribe to market quote. * @param symbols list of symbols */ subscribeMarketQuote(symbols: string[]): Promise; /** * Subscribe to market depth. * @param symbols list of symbols */ subscribeMarketDepth(symbols: string[]): Promise; /** * Unsubscribe to market quote. * @param symbols list of symbols */ unsubscribeMarketQuote(symbols: string[]): Promise; /** * Unsubscribe to market depth. * @param symbols list of symbols */ unsubscribeMarketDepth(symbols: string[]): Promise; } export { Api, Authorization, Candle, ConvertPosition, DerivativeType, EdisHolding, EdisTransaction, EdisTransactions, EdisTransactionsOverall, Exchange, Fund, Funds, GetMarketHistory, Holding, HoldingType, Holdings, HoldingsOverall, HttpHeaders, HttpRequestOptions, InstrumentType, LoginStep1Request, LoginStep1Response, LoginStep2Request, LoginStep2Response, MarketDataNotification, MarketDepth, MarketDepthNotification, MarketHistory, MarketHistoryOverall, MarketOffer, MarketQuote, MarketQuoteNotification, MarketStatus, MarketsStatus, MarketsStatusOverall, ModifyOrder, OnMarketDataNotification, OnOrderUpdateNotification, OptionType, Order, OrderSide, OrderSource, OrderStatus, OrderType, OrderUpdateNotification, OrderValidity, Orders, OrdersOverall, PlaceOrder, Position, PositionSide, Positions, PositionsOverall, ProductType, Profile, Segment, SymbolDetails, Trade, Trades, TradesOverall, cancelOrder, cancelOrders, commodityFuturesCharges, commodityOptionsCharges, connectMarketData, connectOrderUpdate, convertPosition, currencyFuturesCharges, currencyOptionsCharges, derivativeType, derivativeTypeDescription, equityDeliveryCharges, equityFuturesCharges, equityIntradayCharges, equityOptionsCharges, exchange, exchangeDescription, exitAllPositions, exitPosition, generateEdisTpin, getEdisTransactions, getFunds, getHoldings, getMarketDepth, getMarketHistory, getMarketQuotes, getMarketStatus, getOrder, getOrders, getPositions, getProfile, getSymbolMaster, getTrades, holdingType, holdingTypeDescription, http_d as http, inquireEdisTransaction, instrumentType, instrumentTypeDescription, loadSymbolMaster, loginStep1, loginStep2, modifyOrder, modifyOrders, optionType, optionTypeDescription, orderSide, orderSideDescription, orderSource, orderSourceDescription, orderStatus, orderStatusDescription, orderType, orderTypeDescription, orderValidity, orderValidityDescription, placeOrder, placeOrders, positionSide, positionSideDescription, processSymbolMaster, productType, productTypeDescription, segment, segmentDescription, submitEdisHoldingsStep, subscribeMarketDepth, subscribeMarketQuote, subscribeOrderUpdate, symbolDerivativeType, symbolDescription, symbolExchange, symbolIsin, symbolLotSize, symbolName, symbolOptionType, symbolSeries, symbolStrikePrice, symbolToken, unsubscribeMarketDepth, unsubscribeMarketQuote, unsubscribeOrderUpdate, websocket_d as websocket };