Socket
Socket
Sign inDemoInstall

@extra-fyers/websocket

Package Overview
Dependencies
4
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @extra-fyers/websocket

A Javascript interface for FYERS API \{websocket\}.


Version published
Weekly downloads
6
decreased by-88.68%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

A Javascript interface for FYERS API {websocket}.
📦 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. This 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.

Global functions such as connectOrderUpdate() are stateless and accept Authorization as the first parameter. This authorization can be obtained be performing login with loginStep1() and loginStep2() in the http interface. On the other hand, global functions such as subscribeOrderUpdate() accept Connection as the first parameter, which is returned by the connect functions.

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

This is part of package extra-fyers.
Stability: Experimental.


const {http} = require('extra-fyers');

async function main() {
  var app_id       = '****';  // app_id recieved after creating app
  var access_token = '****';  // access_token recieved after login
  var auth = {app_id, access_token};

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

  // List holdings.
  console.log(await http.getHoldings(auth));

  // Place CNC market order for SBIN (equity) on NSE for 5 shares
  var id = await http.placeOrder(auth, {
    symbol: 'NSE:SBIN-EQ',
    productType: "CNC",
    qty: 5,
    side: 1, // BUY
    type: 2, // MARKET
    offlineOrder: "False"
  });

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


Index

PropertyDescription
MARKET_DATA_URLRoot URL for Market data notifications.
ORDER_UPDATE_URLRoot URL for Order update notifications.
ConnectionProvides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
connectOrderUpdateConnect to Order update URL with WebSocket.
subscribeOrderUpdateSubscribe to order update.
unsubscribeOrderUpdateUnsubscribe to order update.
connectMarketDataConnect to Market data URL with WebSocket.
subscribeMarketQuoteSubscribe to market quote.
subscribeMarketDepthSubscribe to market depth.
unsubscribeMarketQuoteUnsubscribe to market quote.
unsubscribeMarketDepthUnsubscribe to market depth.


References



Keywords

FAQs

Last updated on 14 Jan 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc