1.3.0 • Published 4 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
4 months ago
1.2.0
6 months ago
1.1.1
6 months ago
1.1.0
7 months ago
1.1.3
6 months ago
1.1.2
6 months ago
1.0.1
8 months ago
1.0.0
8 months ago
0.5.1
9 months ago
0.5.0
9 months ago
0.4.9
11 months ago
0.4.8
11 months ago
0.4.7
11 months ago
0.4.6
11 months ago
0.4.5
11 months ago
0.4.4
11 months ago
0.4.3
12 months ago
0.4.1
12 months ago
0.4.2
12 months ago
0.4.0
12 months ago
0.3.7
12 months ago
0.3.6
12 months 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