npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@quotemedia.com/streamer

v2.48.0

Published

A JavaScript client for QuoteMedia's streaming data service.

Downloads

359

Readme

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.48.0.min.js) in your html page.

<script src="qmci-streamer-2.48.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/