4.5.0 • Published 6 months ago

smarter_api v4.5.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months 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.5.0

6 months ago

4.1.1

6 months ago

4.1.0

8 months ago

4.0.10

9 months ago

4.0.7

9 months ago

4.0.6

9 months ago

4.0.11

9 months ago

4.0.9

9 months ago

4.0.8

9 months ago

1.2.0

9 months ago

1.2.1

9 months ago

2.3.0

9 months ago

2.2.0

9 months ago

2.5.0

9 months ago

2.4.0

9 months ago

2.7.0

9 months ago

2.6.0

9 months ago

2.9.0

9 months ago

2.8.0

9 months ago

2.0.1

9 months ago

1.1.19

9 months ago

1.1.18

9 months ago

1.1.17

9 months ago

3.0.0

9 months ago

4.0.5

9 months ago

4.0.4

9 months ago

4.0.1

9 months ago

4.0.0

9 months ago

4.0.3

9 months ago

4.0.2

9 months ago

1.1.21

9 months ago

1.1.12

9 months ago

1.1.16

9 months ago

1.1.15

9 months ago

1.1.14

9 months ago

1.1.13

9 months ago

1.1.9

9 months ago

1.1.8

9 months ago

1.1.11

9 months ago

1.1.10

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.1.7

9 months ago

1.1.6

9 months ago

1.1.5

9 months ago

1.1.4

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago