1.3.0 • Published 3 months ago

shoonya-sdk v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months 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
  • Configurable heartbeat timer to keep connection alive
  • and more...
1.3.0

3 months ago

1.2.0

5 months ago

1.1.1

5 months ago

1.1.0

6 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.0.1

7 months ago

1.0.0

7 months ago

0.5.1

8 months ago

0.5.0

8 months ago

0.4.9

10 months ago

0.4.8

10 months ago

0.4.7

10 months ago

0.4.6

10 months ago

0.4.5

10 months ago

0.4.4

10 months ago

0.4.3

11 months ago

0.4.1

11 months ago

0.4.2

11 months ago

0.4.0

11 months ago

0.3.7

11 months ago

0.3.6

11 months ago

0.3.5

11 months ago

0.3.4

11 months ago

0.3.3

11 months ago

0.3.2

12 months ago

0.3.1

12 months ago

0.3.0

12 months ago

0.2.5

12 months ago

0.2.4

12 months ago

0.2.3

12 months ago