Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Javascript interface for FYERS API.

License

NotificationsYou must be signed in to change notification settings

nodef/extra-fyers

Repository files navigation

A Javascript interface for FYERS API.
📦
Node.js,🌐Web,📜Files,📰Docs.

FYERS is one of the cheapest online stock brokers in India, that offerstrading in the equity (NSE, BSE), currency (NSE), and commodity segments (MCX).The objective of this package is to provide a cleaner interface toFYERS API.Thehttp namespace provides the same interface as FYERS HTTP API. Thewebsocket namespace provides the same interface as FYERS WebSocket API, alongwith parsing of binary market data. This allows you to recieveinstantnotifications oforder update andmarket data. The top namespace (globalfunctions, classes) provide afacade for the HTTP and the WebSocket APIs andprovides additional utility functions, such as calculating charges.

Global functions associated with FYERS API, such asgetPositions(), arestateless and acceptAuthorization as the first parameter. On the otherhand, theApi class includes stateful functions which do not requiretheAuthorization parameter (required while creating object). Note thatthis authorization can be obtained be performing login withloginStep1()andloginStep2().

The goals for the future include doing a thorough interface check, and possiblywriting a CLI interface. Obtaining details of symbols, including images and morecould be done as part of a separate package.

This package is available in bothNode.js andWeb formats. The web formatis exposed asextra_fyers standalone variable and can be loaded fromjsDelivr CDN.

Stability:Experimental.


constfyers=require('extra-fyers');asyncfunctionmain(){varappId='****';// app_id recieved after creating appvaraccessToken='****';// access_token recieved after loginvarapi=newfyers.Api(appId,accessToken);// List equity and commodity fund limits.console.log(awaitapi.getFunds());// List holdings.console.log(awaitapi.getHoldings());// Place CNC market order for SBIN (equity) on NSE for 5 sharesvarid=awaitapi.placeOrder({symbol:'NSE:SBIN-EQ',quantity:5});// List postions for today (should list NSE:SBIN-EQ-CNC).console.log(awaitapi.getPositions());// Connect to Market data with WebSocket// and recieve real-time market quotes.awaitapi.connectMarketData(quote=>{console.log(quote);});// Choose which symbols you want to subscribe to.awaitapi.subscribeMarketDepth(['NSE:SBIN-EQ']);// Connect to Order update with WebSocket// and recieve real-time order status updates.awaitapi.connectOrderUpdate(order=>{console.log(order);});// Subscribe to order status updates.awaitapi.subscribeOrderUpdate();}main();


Index

PropertyDescription
exchangeDescriptionGet exchange description.
exchangeGet exchange code.
segmentDescriptionGet segment description.
segmentGet segment code.
positionSideDescriptionGet position side description.
positionSideGet position side code.
orderSideDescriptionGet order side description.
orderSideGet order side code.
orderSourceDescriptionGet order source description.
orderSourceGet order source code.
orderStatusDescriptionGet order status description.
orderStatusGet order status code.
orderTypeDescriptionGet order type description.
orderTypeGet order type code.
orderValidityDescriptionGet order validity description.
orderValidityGet order validity code.
optionTypeDescriptionGet option type description.
optionTypeGet option type code.
derivativeTypeDescriptionGet derivative type description.
derivativeTypeGet derivative type code.
holdingTypeDescriptionGet holding type description.
holdingTypeGet holding type code.
productTypeDescriptionGet product type description.
productTypeGet product type code.
instrumentTypeDescriptionGet instrument type description.
instrumentTypeGet instrument type code.
symbolNameGet symbol exchange, underlying, currency-pair, or commodity name.
symbolExchangeGet symbol exchange.
symbolSeriesGet symbol exchange series.
symbolOptionTypeGet symbol option type.
symbolDerivativeTypeGet symbol derivative type.
symbolStrikePriceGet symbol strike price.
symbolTokenGet symbol token, a unique identifier.
symbolDescriptionGet symbol description.
symbolIsinGet symbol ISIN.
symbolLotSizeGet symbol minimum lot size.
equityDeliveryChargesGet equity delivery charges.
equityIntradayChargesGet equity intraday charges.
equityFuturesChargesGet equity futures charges.
equityOptionsChargesGet equity options charges.
currencyFuturesChargesGet currency futures charges.
currencyOptionsChargesGet currency options charges.
commodityFuturesChargesGet commodity futures charges.
commodityOptionsChargesGet commodity options charges.
loginStep1Get request step 1 for authorization.
loginStep2Get request step 2 for authorization.
getProfileGet basic details of the client.
getFundsGet balance available for the user for capital as well as the commodity market.
getHoldingsGet the equity and mutual fund holdings which the user has in this demat account.
getOrderGet details of an order placed in the current trading day.
getOrdersGet details of all the orders placed in the current trading day.
getPositionsGet details of all the positions in the current trading day.
getTradesGet details of all the trades in the current trading day.
placeOrderPlace an order to any exchange via Fyers.
placeOrdersPlace multiple orders to any exchange via Fyers.
modifyOrderModifies an order placed on any exchange via Fyers.
modifyOrdersModifies orders placed on any exchange via Fyers.
cancelOrderCancels an order placed on any exchange via Fyers.
cancelOrdersCancels orders placed on any exchange via Fyers.
exitPositionExits a position on the current trading day.
exitAllPositionsExits all positions on the current trading day.
convertPositionConverts a position on the current trading day.
getMarketStatusGet the current market status of all the exchanges and their segments.
getMarketHistoryGet the market history for a particular symbol.
getMarketQuotesGet the current market quotes for a set of symbols.
getMarketDepthGet the current market depth for a particular symbol.
getSymbolMasterGet all the latest symbols of all the exchanges from the symbol master files.
processSymbolMasterGet details of symbols from the symbol master file text.
loadSymbolMasterGet details of symbols from the symbol master files.
generateEdisTpinGenerate e-DIS TPIN for validating/authorising transaction.
getEdisTransactionsGet the necessary information regarding the holdings you have on your and also the status of the holdings.
submitEdisHoldingsStepRedirect 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).
inquireEdisTransactionInquire the information/status of the provided transaction Id for the respective holdings you have on your end.
connectMarketDataConnect to Market data URL with WebSocket.
subscribeMarketQuoteSubscribe to market quote.
subscribeMarketDepthSubscribe to market depth.
unsubscribeMarketQuoteUnsubscribe to market quote.
unsubscribeMarketDepthUnsubscribe to market depth.
connectOrderUpdateConnect to Order update URL with WebSocket.
subscribeOrderUpdateSubscribe to order update.
unsubscribeOrderUpdateUnsubscribe to order update.
ApiStateful interface for FYERS API.


References



ORGDOI


[8]ページ先頭

©2009-2025 Movatter.jp