1.2.2 • Published 6 months ago

@quantiply/finvasia-nodejs-sdk v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Finvasia Shoonya API Nodejs client

Installation

Install via npm

npm install @quantiply/finvasia-nodejs-sdk

Getting started

const { RestAPI } = require('@quantiply/finvasia-nodejs-sdk');

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('@quantiply/finvasia-nodejs-sdk');

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();

License

Quantiply Technologies Pvt Ltd (c) 2022. Licensed under the ISC License.

1.2.2

6 months ago

1.2.0

12 months ago

1.2.1

12 months ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago