4.1.0 • Published 27 days ago

smarter_api v4.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
27 days ago

SmarterAPI

SmarterAPI is a wrapper for the Angel SmartAPI Rest API, providing an improved interface over their own SDK. It simplifies interaction with the Angel Broking API, making it easier to manage sessions, place orders, retrieve holdings, positions, and more.

Installation

To install SmarterAPI, you can use npm:
npm install smarter-api

Usage

First, import SmarterAPI into your project:

const SmarterApi = require('smarter-api');

Creating a Session

To create a session (authenticate), use the createSession method:

const jwtToken = await SmarterApi.createSession(apiKey, username, mpin, totpToken);

Parameters:

  • apiKey: Your API key.
  • username: Your Angel Broking client code.
  • mpin: Your Angel Broking MPIN.
  • totpToken: Your TOTP token for two-factor authentication.

Returns:

  • jwtToken: JWT token for authenticated session.

Placing an Order

To place an order, use the placeOrder method:

const orderResponse = await SmarterApi.placeOrder(apiKey, jwtToken, order);

Parameters:

  • apiKey: Your API key.
  • jwtToken: JWT token obtained from the session creation.
  • order: Order details in JSON format.

Returns:

  • orderResponse: Response object from the API.

Getting Holdings

To retrieve holdings, use the getHoldings method:

const holdings = await SmarterApi.getHoldings(apiKey, jwtToken);

Parameters:

  • apiKey: Your API key.
  • jwtToken: JWT token obtained from the session creation.

Returns:

  • holdings: Holdings information.

Getting All Holdings

To retrieve all holdings, use the getAllHoldings method:

const allHoldings = await SmarterApi.getAllHoldings(apiKey, jwtToken);

Parameters and Returns are similar to getHoldings.

Getting Positions

To retrieve positions, use the getPositions method:

const positions = await SmarterApi.getPositions(apiKey, jwtToken);

Parameters and Returns are similar to getHoldings.

Getting RMS

To retrieve risk management system (RMS) details, use the getRMS method:

const rmsData = await SmarterApi.getRMS(apiKey, jwtToken);

Parameters and Returns are similar to getHoldings.

Notes

  • Ensure you have a valid API key, client code, MPIN, and TOTP token for authentication.
  • Always handle errors gracefully, and consider implementing error handling in your application.
4.1.0

27 days ago

4.0.10

1 month ago

4.0.7

1 month ago

4.0.6

1 month ago

4.0.11

1 month ago

4.0.9

1 month ago

4.0.8

1 month ago

1.2.0

1 month ago

1.2.1

1 month ago

2.3.0

1 month ago

2.2.0

1 month ago

2.5.0

1 month ago

2.4.0

1 month ago

2.7.0

1 month ago

2.6.0

1 month ago

2.9.0

1 month ago

2.8.0

1 month ago

2.0.1

1 month ago

1.1.19

1 month ago

1.1.18

1 month ago

1.1.17

1 month ago

3.0.0

1 month ago

4.0.5

1 month ago

4.0.4

1 month ago

4.0.1

1 month ago

4.0.0

1 month ago

4.0.3

1 month ago

4.0.2

1 month ago

1.1.21

1 month ago

1.1.12

1 month ago

1.1.16

1 month ago

1.1.15

1 month ago

1.1.14

1 month ago

1.1.13

1 month ago

1.1.9

1 month ago

1.1.8

1 month ago

1.1.11

1 month ago

1.1.10

1 month ago

1.1.1

1 month ago

1.1.0

1 month ago

1.1.7

1 month ago

1.1.6

1 month ago

1.1.5

1 month ago

1.1.4

1 month ago

1.1.3

1 month ago

1.1.2

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago