New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

finvasia-extra

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

finvasia-extra

JS client library for Finvasia Shoonya API

1.2.4
latest
npm
Version published
Maintainers
1
Created
Source

Finvasia Shoonya API Nodejs client

Installation

Install via npm

npm install finvasia-extra

Getting started

const { RestAPI } = require('finvasia-extra');

const api = new RestAPI({ userId: 'user_id' });

api
  .login('user_id', 'password', 'factor2', 'vendor_code', 'api_key', 'imei')
  .then(console.log)
  .then((data) => {
    console.log(data.susertoken);
    // OR
    console.log(api.accessToken);

    // fetch order book
    return api.getOrders();
  })
  .then((orders) => {
    console.log(orders);
  })
  .catch((err) => {
    console.log(err);
  });

If you have already generated access token then

const api = new RestAPI({
  userId: 'user_id',
  accessToken: 'access_token',
});

api
  .getOrders()
  .then((orders) => {
    console.log(orders);
  })
  .catch((err) => {
    console.log(err);
  });

Getting started with WebSocket API

const { WebSocket } = require('finvasia-extra');

const socket = new WebSocket({
  userId: 'user_id',
  accessToken: 'access_token',
});

socket.on('connect', () => {
  console.log('Connected');
  socket.subscribeOrderUpdates();
});

socket.on('orderUpdate', (update) => {
  console.log('Order Update', update);
});

socket.on('error', (e) => {
  console.log('Error', e);
});

socket.on('close', () => {
  console.log('Closed');
});

socket.connect();

Keywords

finvasia

FAQs

Package last updated on 27 Feb 2023

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