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 = '****';
var access_token = '****';
var auth = {app_id, access_token};
console.log(await http.getFunds(auth));
console.log(await http.getHoldings(auth));
var id = await http.placeOrder(auth, {
symbol: 'NSE:SBIN-EQ',
productType: "CNC",
qty: 5,
side: 1,
type: 2,
offlineOrder: "False"
});
console.log(await http.getPositions(auth));
}
main();
Index
References