@quotemedia.com/streamer

2.43.0 • Public • Published

Quotemedia Streaming Data Service JavaScript Client

Javascript library responsible to connect to the Quotemedia Streaming Service.

Requirements

1. Quotemedia Credentials

Usage

Include the javascript file (qmci-streamer-2.43.0.min.js) in your html page.

<script src="qmci-streamer-2.43.0.min.js"></script>

After this, you should be able to use the Streamer object. It will allow you to authenticate, subscribe and unsubscribe symbols. More details in the enduser-example.html, enterprise-token-example.html, wmid-example.html and subscription-example.html.

Authentication

    Streamer.login({
        host: 'https://app.quotemedia.com/auth',
        credentials: {
            wmid: "YourWebmasterID",
            username: "YourUsername",
            password: "YourPassword"
        }
    }

When using the login method this will generate a SID which then can be used to open a Streamer connection. You can also authenticate using different methods like: - Credentials - SID Token - Enterprise token - Webmaster ID - Datatool token

Open

Set rejectExcessiveConnection:true to reject new connections when limit is reached. If not specified or value is false, first open connection will be closed instead.

If needed, there is ability to specify conflation value per connection. When conflation value is null or not specified, default conflation is used.

Set format value to 'application/qitch' to use this binary protocol. Please note that although QITCH protocol uses less bandwidth it can cause significant performance degradation. In case if no format was specified JSON will be used by default.

if and SID was previously generated using the login() funtion, it will be used to open the connection, otherwise a WMID and/or token will be required for opening (please see the wmid-example.html and the enterprise-token.html)

    Streamer.open({
            host: 'https://app.quotemedia.com/cache',
            cors: true,
            rejectExcessiveConnection: false,
            conflation: null,
            format: 'application/json',
            credentials: { sid: sid }
        }, then(function(stream) {
        // After successfully opening the stream,
        // listen for its events.
        ...
    }));

After a connection was open, make sure to add the different event listeners required for the different events that the streamer object may trigger (please see more of this events on any of the examples).

Subscription

The different subscriptionTypes that you can subscribe to are:

  • Streamer.subscriptionTypes.QUOTE
  • Streamer.subscriptionTypes.PRICEDATA
  • Streamer.subscriptionTypes.TRADE
  • Streamer.subscriptionTypes.MMQUOTE
  • Streamer.subscriptionTypes.ORDERBOOK
  • Streamer.subscriptionTypes.INTERVAL
  • Streamer.subscriptionTypes.NETHOUSEPOSITION
  • Streamer.subscriptionTypes.LASTSALE
  • Streamer.subscriptionTypes.LIMITUPLIMITDOWN
  • Streamer.subscriptionTypes.IVGREEKS
  • Streamer.subscriptionTypes.IMBALANCESTATUS

Some of this subscriptionTypes required different entitlements so make sure that you do have entitlements for the required datatype.

Then the different market data response types that can be received from the server are:

  • Streamer.marketDataTypes.QUOTE
  • Streamer.marketDataTypes.PRICEDATA
  • Streamer.marketDataTypes.TRADE
  • Streamer.marketDataTypes.INTERVAL
  • Streamer.marketDataTypes.NETHOUSEPOSITION
  • Streamer.marketDataTypes.MMQUOTE
  • Streamer.marketDataTypes.BOOKORDER
  • Streamer.marketDataTypes.PURGEBOOK
  • Streamer.marketDataTypes.BOOKDELETE
  • Streamer.marketDataTypes.SYMBOLINFO
  • Streamer.marketDataTypes.SYMBOLSTATUS
  • Streamer.marketDataTypes.DERIVATIVEINFO
  • Streamer.marketDataTypes.LASTSALE
  • Streamer.marketDataTypes.LIMITUPLIMITDOWN
  • Streamer.marketDataTypes.IVGREEKS
  • Streamer.marketDataTypes.IMBALANCESTATUS
  • Streamer.marketDataTypes.ALERT
  • Streamer.marketDataTypes.NEWS
  • Streamer.marketDataTypes.TRADENOTIFICATION
  • Streamer.marketDataTypes.NEWSCMDFILTER
  • Streamer.marketDataTypes.NEWSERROR
  • Streamer.marketDataTypes.DIVIDEND

You can check which types of market data message you are receiving by using the method: Streamer.marketDataTypes.get(msg)

An optional options object can also be passed in. Current available options include:

  • skipHeavyInitialLoad: whether to skip initial heavy loads (e.g., previous trades and intervals), defaults to false.
  • conflation: Override default connection conflation, default to null. A matching conflation must be supplied when unsubscribing.
stream.subscribe(["GOOG"], [Streamer.dataTypes.PRICEDATA], { skipHeavyInitialLoad: false }, then(function(result) {
    ...
}

The subscription result will include the successful subscriptions as well as the unentitled and rejected subscriptions and invalid symbols.

Exchange subscription

NOTE:

This type of subscription will only work if you are entitled to exchange subscription data. Subscription to an exchange to receive stock status messages containing data such as halt, resume, regSHO.

stream.subscribeExchange("NYE", then(function(result) {
    ...
}

Unsubscription

stream.unsubscribe(["GOOG"], [Streamer.dataTypes.PRICEDATA], {}, then(function(result) {
    ...
}

Unsubscribe for symbols and data types. These can be either single strings or arrays of strings. An optional options object can also be passed in. Current available options include:

  • conflation: Override default connection conflation, default to null. Should match a subscribe conflation.

Retrieve available number of symbols and connections, number of currently open connections and subscribed symbols.

stream.getSessionStats();
    ...
}

Quotemedia Contact

https://www.quotemedia.com/

Readme

Keywords

none

Package Sidebar

Install

npm i @quotemedia.com/streamer

Weekly Downloads

35

Version

2.43.0

License

none

Unpacked Size

1.7 MB

Total Files

10

Last publish

Collaborators

  • streamingservicequotemedia
  • quotemedia