Socket
Socket
Sign inDemoInstall

market_tbt

Package Overview
Dependencies
10
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    market_tbt

Market SDK for subscribing/unsubscribing to market tick data


Version published
Weekly downloads
7
increased by600%
Maintainers
1
Install size
1.70 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 31 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc