1.0.1 • Published 2 days ago

shoonya-sdk v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 days ago

Shoonya SDK

Wrapper around Shoonya API

Installation

# bun
bun add shoonya-sdk
# npm
npm install shoonya-sdk
# yarn
yarn add shoonya-sdk
# pnpm
pnpm add shoonya-sdk

Getting Started

Using both WebsocketClient and RestClient

import { RestClient, WebsocketClient } from "shoonya-sdk";

const restClient = new RestClient(credentials, { logging: true });
const wsClient = new WebsocketClient({ logging: true }); // No need to pass credential here

const userDetail = await restClient.getUserDetails();
console.log(`Logged in as ${userDetail.actid}`);

wsClient.on("connected", () => {
  wsClient.subscribe("NSE|26009"); // Bank Nifty
});

wsClient.on("priceUpdate", (data) => {
  console.log(data);
});

wsClient.connect();

Only using WebsocketClient

import { WebsocketClient } from "shoonya-sdk";

const wsClient = new WebsocketClient({
  cred: {
    // now you need to pass the credentials here
  },
  logging: true,
});

wsClient.on("connected", () => {
  wsClient.subscribe(["NSE|26009", "NSE|26000"]); // Bank Nifty and Nifty 50
});

wsClient.on("priceUpdate", (data) => {
  console.log(data);
});

wsClient.connect();

Features

  • Auto Reconnect On Failures
  • Auto Refresh Access Token When it is expired
  • Sync Credentials and Tokens between Rest and WS Clients
  • Reconnect with Shoonya WS at fixed time interval, which is configurable
  • and more...
1.0.1

2 days ago

1.0.0

11 days ago

0.5.1

18 days ago

0.5.0

19 days ago

0.4.9

3 months ago

0.4.8

3 months ago

0.4.7

3 months ago

0.4.6

3 months ago

0.4.5

3 months ago

0.4.4

3 months ago

0.4.3

4 months ago

0.4.1

4 months ago

0.4.2

4 months ago

0.4.0

4 months ago

0.3.7

4 months ago

0.3.6

4 months ago

0.3.5

4 months ago

0.3.4

4 months ago

0.3.3

4 months ago

0.3.2

5 months ago

0.3.1

5 months ago

0.3.0

5 months ago

0.2.5

5 months ago

0.2.4

5 months ago

0.2.3

5 months ago