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.

    Returns

    order id

    Parameters

    • id: string

      order id

    Returns Promise<void>

  • Cancels orders placed on any exchange via Fyers.

    Returns

    unique order ids

    Parameters

    • ids: string[]

      unique order ids

    Returns Promise<void>[]

  • Converts a position on the current trading day.

    Returns

    conversion status

    Parameters

    • conversion: ConvertPosition

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

    Returns Promise<void>

  • Exits all positions on the current trading day.

    Returns

    positions status

    Returns Promise<void>

  • Exits a position on the current trading day.

    Returns

    position status

    Parameters

    • id: string

      position id

    Returns Promise<void>

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

    Returns

    optional data

    Returns Promise<void>

  • 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, ...}}

    Returns Promise<EdisTransactions>

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

    Returns

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

    Returns Promise<Funds>

  • 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, ...}}

    Returns Promise<Holdings>

  • Get the current market depth for a particular symbol.

    Returns

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

    Parameters

    • symbol: string

      symbol name

    Returns Promise<MarketDepth>

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

    Returns

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

    Parameters

    • symbols: string[]

      list of symbols

    Returns Promise<MarketQuote[]>

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

    Returns

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

    Returns Promise<MarketsStatus>

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

    Returns

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

    Parameters

    • id: string

      order id

    Returns Promise<Order>

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

    Returns

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

    Returns Promise<Orders>

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

    Returns

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

    Returns Promise<Positions>

  • Get basic details of the client.

    Returns

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

    Returns Promise<Profile>

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

    Returns

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

    Returns Promise<Trades>

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

    Returns

    edis status

    Parameters

    • id: string

      transaction id

    Returns Promise<number>

  • Get details of symbols from the symbol master files.

    Returns

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

    Parameters

    • exchange: string

      exchange name

    • segment: string

      segment name

    Returns Promise<SymbolDetails[]>

  • Modifies an order placed on any exchange via Fyers.

    Returns

    order id

    Parameters

    • order: ModifyOrder

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

    Returns Promise<string>

  • Modifies orders placed on any exchange via Fyers.

    Returns

    unique order ids

    Parameters

    • orders: ModifyOrder[]

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

    Returns Promise<void>[]

  • Place an order to any exchange via Fyers.

    Returns

    order id

    Parameters

    • order: PlaceOrder

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

    Returns Promise<string>

  • Place multiple orders to any exchange via Fyers.

    Returns

    unique order ids

    Parameters

    • orders: PlaceOrder[]

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

    Returns Promise<string>[]

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

    Returns

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

    Parameters

    • csv: string

      symbol master file text

    Returns SymbolDetails[]

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

    Returns

    HTTP(s) request options (manual)

    Parameters

    • holdings: EdisHolding[]

      holding details [{isin, quantity}]

    Returns HttpRequestOptions

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

    Returns

    symbol master file as text

    Parameters

    • exchange: string

      exchange name

    • segment: string

      segment name

    Returns Promise<string>

  • Get request step 1 for authorization.

    Returns

    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

  • Get request step 2 for authorization.

    Returns

    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

Generated using TypeDoc