0.6.4 • Published 1 month ago

inves-broker v0.6.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

inves-broker

inves-broker provides a unified interface for dealing with multiple broker APIs in the Indian stock market.

Currently supported brokers

  1. Kite by Zerodha
  2. Paytm Money

Quick Start

npm install inves-broker
import { IConnect, BrokerName } from 'inves-broker';

const kite = IConnect(BrokerName.KITE, {
                kiteAPIKey: process.env.KITE_API_KEY,
                kiteAPISecret: process.env.KITE_API_SECRET
            });
const kiteUrl = await kite.getLoginURL({});


const paytm = IConnect(BrokerName.PAYTM_MONEY, {
                paytmMoneyAPIKey: process.env.PAYTM_API_KEY,
                paytmMoneyAPISecret: process.env.PAYTM_API_SECRET
            });
const paytmUrl = await paytm.getLoginURL({});

Why

Building a platform to support order placement and retrieval via multiple brokers is an exhaustive task. To achieve the same end goal, each broker has a slightly different way of doing things. Integrating each broker would require extensive reading of all the documentation followed by a tedious implementation.

How do we solve for multiple brokers under a common interface?

We enforce a standard of how you should place an order, get order information, etc. This standard closely conforms to Zerodha's way of doing things. If you are familiar with using the Kite API, you will find inves-broker's interface to be similar. For exceptional cases where a broker cannot fit within a standard, we provide an extended support for that. Hence, all brokers under inves-broker follow the Open-closed principle.

Usage

Each broker class will provide the methods listed here. In some cases, it will be necessary to deviate from the standard. This is described below.

Paytm Money and Dhan

Paytm Money and Dhan identify an instrument via its list of security ids. This list needs to be downloaded once a day. By default, when you place an order, this list is downloaded and stored in memory for the next 24 hours. Hence, the first call to place an order would be slow. Subsequent calls would just hit the cache. However, if you wish to pre-fetch this list, even before you invoke the placeOrder method, you can do this via following:

import { IConnect, BrokerName, PaytmMoneyBroker } from 'inves-broker';

const broker = IConnect(BrokerName.PAYTM_MONEY, config);
if (broker instanceof PaytmMoneyBroker) {
     await broker.triggerMemoizationOfSecurityList();
}

Contributing

  • We follow the conventional commit message spec. It's recommended that you read more about on conventionalcommits.org.
  • Each accepted pull request will be squashed and merged.
0.6.4

1 month ago

0.6.3

4 months ago

0.6.2

4 months ago

0.6.1

4 months ago

0.6.0

5 months ago

0.5.99

5 months ago

0.5.98

5 months ago

0.5.96

5 months ago

0.5.97

5 months ago

0.5.94

5 months ago

0.4.9

6 months ago

0.5.95

5 months ago

0.4.8

6 months ago

0.5.92

6 months ago

0.5.93

6 months ago

0.4.5-beta.0

6 months ago

0.4.5-beta.1

6 months ago

0.5.91

6 months ago

0.5.4

6 months ago

0.5.3

6 months ago

0.5.6

6 months ago

0.5.5

6 months ago

0.5.0

6 months ago

0.5.2

6 months ago

0.5.1

6 months ago

0.5.8

6 months ago

0.5.7

6 months ago

0.5.9

6 months ago

0.4.7

6 months ago

0.4.6

6 months ago

0.4.5

7 months ago

0.4.4

7 months ago

0.4.3

7 months ago

0.3.1-beta.2

8 months ago

0.3.1-beta.1

8 months ago

0.3.1-beta.4

8 months ago

0.3.1-beta.3

8 months ago

0.3.1-beta.6

8 months ago

0.3.1-beta.5

8 months ago

0.3.1-beta.7

8 months ago

0.4.1

7 months ago

0.4.0

7 months ago

0.3.1-beta.0

8 months ago

0.4.2

7 months ago

0.3.0

9 months ago

0.3.1

9 months ago

0.2.99

9 months ago

0.2.96

1 year ago

0.2.95

1 year ago

0.2.94

1 year ago

0.2.93

1 year ago

0.2.92

1 year ago

0.2.91

1 year ago

0.2.98

1 year ago

0.2.97

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.1

1 year ago

0.1.2

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.1.3

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.1.0

1 year ago