# market_tbt

> Market SDK for subscribing/unsubscribing to market tick data

Latest version **1.1.2** (published 2019-07-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install market_tbt
pnpm add market_tbt
yarn add market_tbt
bun add market_tbt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2019-07-31 |
| First published | 2019-07-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.0.0 |
| Dependencies | 2 |
| Unpacked size | 16.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Pawan Wagh |
| Maintainers | pawan_prodio |
| Keywords | market, data, tick, js |

## Links

- npm: https://www.npmjs.com/package/market_tbt
- Repository: https://pawanwagh@bitbucket.org/ProdioDesignworks/market_tbt
- Homepage: https://bitbucket.org/ProdioDesignworks/market_tbt#readme
- npm.io page: https://npm.io/package/market_tbt

## Dependencies (2)

- [is](https://npm.io/package/is.md) ^3.3.0
- [kiteconnect](https://npm.io/package/kiteconnect.md) ^3.0.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.2 (latest) — 2019-07-31
- 1.1.1 — 2019-07-17
- 1.1.0 — 2019-07-16
- 1.0.0 — 2019-07-05

## README

# Market_TBT

**Market_TBT** provide realtime markets tick data. For now, it supports only zerodha sdk.

# Design Principle
To provide a common interface to interact with market by abstracting the overall complexity to simple APIs. 

# Design Pattern
Goal is to solve this problems:
1. Abstract the complexity behind a well-defined interface
2. Easy to change the underlying system

The [Facade pattern](https://www.oreilly.com/library/view/learning-javascript-design/9781449334840/ch12s03.html) and [Singleton pattern](https://www.oreilly.com/library/view/learning-javascript-design/9781449334840/ch09s04.html) are the most relatable pattern to solve the above design problems. Why Facade pattern? [Read this](https://stackoverflow.com/a/3489187/6821268)

# How to install
`npm install market_tbt --save`

This command will install and add **market-tbt** to your project dependencies.

# APIs
1. subscribe
2. unsubscribe
3. instruments
4. Auto-connect is managed internally. Also, you can subscribe to instruments before receiving connect event and the ticker will take care off subscription process for you.
Not yet finished, more to come....

# How to use
1. Initialize SDK
    ```
    const { Ticker } = require('market_tbt');

    const TBTListener = Ticker({
    	api_key: "api_key",
    	access_token: "access_token"
    });
    
    // Attach event listener
    TBTListener.on('ticks', async (data) => console.log(data));
    TBTListener.on('connect', () => console.log('connected));
    TBTListener.on('disconnect', () => console.log('disconnected));
    ```
2. Fetch all subscribed instruments
    ```
    TBTListener.getInstruments()
    ```
3. Subscribe instruments
    ```
    const instruments = [ 12345, 232424, 2323232 ];
    const subscribedInstruments = TBTListener.subscribe(instruments);
    ```
4. Unsubscribe instruments
    ```
    const instruments = [ 12345, 232424, 2323232 ];
    const subscribedInstruments = TBTListener.unSubscribe(instruments);
    ```

---
_Source: https://npm.io/package/market_tbt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
