Class Api

Stateful interface for FYERS API.

Hierarchy

  • Api

Implements

Constructors

  • Create a container that stores authorization, symbol maps, and connections (WebSocket).

    Parameters

    • appId: string

      unique app_id received after creating app

    • accessToken: string

      access token for the current trading day recieved after authorization

    Returns Api

Properties

accessToken: string

This value will be used for all the requests.

appId: string

This is the app_id which you have received after creating the app.

marketDataConnection: Promise<Connection>

Market data notification connection.

orderUpdateConnection: Promise<Connection>

Order update notification connection.

symbolDetails: Map<string, SymbolDetails>

Symbol to symbol details map.

tokenSymbol: Map<string, string>

Token to symbol map.

Methods

  • Cancels an order placed on any exchange via Fyers.

    Parameters

    • id: string

      order id

    Returns Promise<void>

    order id

  • Cancels orders placed on any exchange via Fyers.

    Parameters

    • ids: string[]

      unique order ids

    Returns Promise<void>[]

    unique order ids

  • Converts a position on the current trading day.

    Parameters

    • conversion: ConvertPosition

      details of conversion {symbol, side, quantity, ...}

    Returns Promise<void>

    conversion status

  • Exits all positions on the current trading day.

    Returns Promise<void>

    positions status

  • Exits a position on the current trading day.

    Parameters

    • id: string

      position id

    Returns Promise<void>

    position status

  • Generate e-DIS TPIN for validating/authorising transaction.

    Returns Promise<void>

    optional data

  • 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 Promise<EdisTransactions>

    list of e-DIS transactions {details: [{id, isin, ...}], overall: {count, quantity, ...}}

  • Get balance available for the user for capital as well as the commodity market.

    Returns Promise<Funds>

    details of user's funds {equity: {start, ...}, commodity: {start, ...}}

  • Get the equity and mutual fund holdings which the user has in this demat account.

    Returns Promise<Holdings>

    details of user's holdings {details: [{isin, ...}], overall: {count, ...}}

  • Get the current market depth for a particular symbol.

    Parameters

    • symbol: string

      symbol name

    Returns Promise<MarketDepth>

    market depth {bidQuantity, askQuantity, bids, ...}

  • Get the market history for a particular symbol.

    Parameters

    Returns Promise<MarketHistory>

    market history {details: [{date, ...}], overall: {dateFrom, ...}}

  • Get the current market quotes for a set of symbols.

    Parameters

    • symbols: string[]

      list of symbols

    Returns Promise<MarketQuote[]>

    market quotes [{symbol, name, exchange, ...}]

  • Get the current market status of all the exchanges and their segments.

    Returns Promise<MarketsStatus>

    markets status {details: [{exchange, ...}], overall: {count, ...}}

  • Get details of an order placed in the current trading day.

    Parameters

    • id: string

      order id

    Returns Promise<Order>

    details of an order {id, symbol, ticker, ...}

  • Get details of all the orders placed in the current trading day.

    Returns Promise<Orders>

    details of orders {details: [{id, ...}], overall: {count, ...}}

  • Get details of all the positions in the current trading day.

    Returns Promise<Positions>

    details of positions {details: [{id, ...}], overall: {count, ...}}

  • Get basic details of the client.

    Returns Promise<Profile>

    details of user's profile {id, email, name, ...}

  • Get details of all the trades in the current trading day.

    Returns Promise<Trades>

    details of trades {details: [{id, ...}], overall: {count, ...}}

  • Inquire the information/status of the provided transaction Id for the respective holdings you have on your end.

    Parameters

    • id: string

      transaction id

    Returns Promise<number>

    edis status

  • Get details of symbols from the symbol master files.

    Parameters

    • exchange: string

      exchange name

    • segment: string

      segment name

    Returns Promise<SymbolDetails[]>

    list of symbol details [{symbol, description, lotSize, ...}]

  • Modifies an order placed on any exchange via Fyers.

    Parameters

    • order: ModifyOrder

      details of order {id, type, quantity, ...}

    Returns Promise<string>

    order id

  • Modifies orders placed on any exchange via Fyers.

    Parameters

    • orders: ModifyOrder[]

      details of orders [{id, type, quantity, ...}]

    Returns Promise<void>[]

    unique order ids

  • Place an order to any exchange via Fyers.

    Parameters

    • order: PlaceOrder

      details of an order {symbol, type, side, ...}

    Returns Promise<string>

    order id

  • Place multiple orders to any exchange via Fyers.

    Parameters

    • orders: PlaceOrder[]

      details of multiple orders [{symbol, type, side, ...}]

    Returns Promise<string>[]

    unique order ids

  • Get details of symbols from the symbol master file text.

    Parameters

    • csv: string

      symbol master file text

    Returns SymbolDetails[]

    list of symbol details [{symbol, description, lotSize, ...}]

  • 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).

    Parameters

    • holdings: EdisHolding[]

      holding details [{isin, quantity}]

    Returns HttpRequestOptions

    HTTP(s) request options (manual)

  • Subscribe to market depth.

    Parameters

    • symbols: string[]

      list of symbols

    Returns Promise<void>

  • Subscribe to market quote.

    Parameters

    • symbols: string[]

      list of symbols

    Returns Promise<void>

  • Subscribe to order update.

    Returns Promise<void>

  • Unsubscribe to market depth.

    Parameters

    • symbols: string[]

      list of symbols

    Returns Promise<void>

  • Unsubscribe to market quote.

    Parameters

    • symbols: string[]

      list of symbols

    Returns Promise<void>

  • Unsubscribe to order update.

    Returns Promise<void>

  • Get all the latest symbols of all the exchanges from the symbol master files.

    Parameters

    • exchange: string

      exchange name

    • segment: string

      segment name

    Returns Promise<string>

    symbol master file as text

  • Get request step 1 for authorization.

    Parameters

    • appId: string

      app_id which you have received after creating the app

    • redirectUrl: string

      where the user will be redirected after login

    • state: string = "default"

      same value will be returned after login to the redirect url

    Returns HttpRequestOptions

    request step 1 for authorization

  • Get request step 2 for authorization.

    Parameters

    • appHash: string

      SHA-256 of api_id:app_secret in hex

    • authorizationCode: string

      auth_code which is received from the first step

    Returns HttpRequestOptions

    request step 2 for authorization

Generated using TypeDoc