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