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

extra-fyers

Package Overview
Dependencies
Maintainers
0
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-fyers

A Javascript interface for FYERS API.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
48
decreased by-74.74%
Maintainers
0
Weekly downloads
 
Created
Source

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

FYERS is one of the cheapest online stock brokers in India, that offers trading in the equity (NSE, BSE), currency (NSE), and commodity segments (MCX). The objective of this package is to provide a cleaner interface to FYERS API. The http namespace provides the same interface as FYERS HTTP API. The websocket namespace provides the same interface as FYERS WebSocket API, along with parsing of binary market data. This allows you to recieve instant notifications of order update and market data. The top namespace (global functions, classes) provide a facade for the HTTP and the WebSocket APIs and provides additional utility functions, such as calculating charges.

Global functions associated with FYERS API, such as getPositions(), are stateless and accept Authorization as the first parameter. On the other hand, the Api class includes stateful functions which do not require the Authorization parameter (required while creating object). Note that this authorization can be obtained be performing login with loginStep1() and loginStep2().

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

This package is available in both Node.js and Web formats. The web format is exposed as extra_fyers standalone variable and can be loaded from jsDelivr CDN.

Stability: Experimental.


const fyers = require('extra-fyers');

async function main() {
  var appId       = '****';  // app_id recieved after creating app
  var accessToken = '****';  // access_token recieved after login
  var api = new fyers.Api(appId, accessToken);

  // List equity and commodity fund limits.
  console.log(await api.getFunds());

  // List holdings.
  console.log(await api.getHoldings());

  // Place CNC market order for SBIN (equity) on NSE for 5 shares
  var id = await api.placeOrder({symbol: 'NSE:SBIN-EQ', quantity: 5});

  // List postions for today (should list NSE:SBIN-EQ-CNC).
  console.log(await api.getPositions());


  // Connect to Market data with WebSocket
  // and recieve real-time market quotes.
  await api.connectMarketData(quote => {
    console.log(quote);
  });
  // Choose which symbols you want to subscribe to.
  await api.subscribeMarketDepth(['NSE:SBIN-EQ']);

  // Connect to Order update with WebSocket
  // and recieve real-time order status updates.
  await api.connectOrderUpdate(order => {
    console.log(order);
  });
  // Subscribe to order status updates.
  await api.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



ORG DOI

Keywords

FAQs

Package last updated on 29 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc