1.3.2 • Published 11 months ago
shoonya-sdk v1.3.2
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-sdkGetting 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
 - Configurable heartbeat timer to keep connection alive
 - and more...
 
1.3.2
11 months ago
1.3.1
12 months ago
1.3.0
1 year ago
1.2.0
1 year ago
1.1.1
1 year ago
1.1.0
1 year ago
1.1.3
1 year ago
1.1.2
1 year ago
1.0.1
2 years ago
1.0.0
2 years ago
0.5.1
2 years ago
0.5.0
2 years ago
0.4.9
2 years ago
0.4.8
2 years ago
0.4.7
2 years ago
0.4.6
2 years ago
0.4.5
2 years ago
0.4.4
2 years ago
0.4.3
2 years ago
0.4.1
2 years ago
0.4.2
2 years ago
0.4.0
2 years ago
0.3.7
2 years ago
0.3.6
2 years ago
0.3.5
2 years ago
0.3.4
2 years ago
0.3.3
2 years ago
0.3.2
2 years ago
0.3.1
2 years ago
0.3.0
2 years ago
0.2.5
2 years ago
0.2.4
2 years ago
0.2.3
2 years ago