Huge News!Announcing our $40M Series B led by Abstract Ventures.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.2
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
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

FAQs

Package last updated on 23 Jan 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

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