1.1.2 • Published 5 years ago

market_tbt v1.1.2

Weekly downloads
1
License
ISC
Repository
bitbucket
Last release
5 years ago

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 and Singleton pattern are the most relatable pattern to solve the above design problems. Why Facade pattern? Read this

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);
1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago