Giter Site home page Giter Site logo

ralphholzmann / intrinio-realtime-node-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intrinio/intrinio-realtime-node-sdk

0.0 1.0 0.0 19 KB

Intrinio NodeJS SDK for Real-Time Stock Prices

Home Page: https://intrinio.com/data/realtime-stock-prices

License: GNU General Public License v3.0

JavaScript 100.00%

intrinio-realtime-node-sdk's Introduction

Intrinio NodeJS SDK for Real-Time Stock Prices

Intrinio provides real-time stock prices from the IEX stock exchange, via a two-way WebSocket connection. To get started, subscribe here and follow the instructions below.

Requirements

  • NodeJS 6.9.5

Features

  • Receive streaming, real-time price quotes from the IEX stock exchange
    • Bid, ask, and last price
    • Order size
    • Order execution timestamp
  • Subscribe to updates from individual securities
  • Subscribe to updates for all securities (contact us for special access)

Installation

npm install intrinio-realtime --save

Example Usage

var IntrinioRealtime = require('intrinio-realtime')

// Create an IntrinioRealtime instance
var ir = new IntrinioRealtime({
  username: "INTRINIO_API_USERNAME",
  password: "INTRINIO_API_PASSWORD",
})

// Listen for quotes
ir.onQuote(quote => {
  var { ticker, type, price, size, timestamp } = quote
  console.log("QUOTE: ", ticker, type, price, size, timestamp)
})

// Join channels
ir.join("AAPL", "MSFT", "GE")

Channels

To receive price quotes from the Intrinio Real-Time API, you need to instruct the client to "join" a channel. A channel can be

  • A security ticker (AAPL, MSFT, GE, etc)
  • The security lobby ($lobby) where all price quotes for all securities are posted
  • The security last price lobby ($lobby_last_price) where only last price quotes for all securities are posted

Special access is required for both lobby channeles. Contact us for more information.

API Keys

You will receive your Intrinio API Username and Password after creating an account. You will need a subscription to the IEX Real-Time Stock Prices data feed as well.

Documentation

Methods

constructor(options) - Creates a new instance of the IntrinioRealtime client.

  • Parameter options: An object with a username and password property corresponding to your Intrinio API Username and Password.
var ir = new IntrinioRealtime({
  username: "INTRINIO_API_USERNAME",
  password: "INTRINIO_API_PASSWORD",
})

destroy() - Closes the WebSocket, stops the self-healing and heartbeat intervals. You MUST call this to dispose of the client.


onError(callback) - Invokes the given callback when a fatal error is encountered. If no callback has been registered, the error will be thrown.

  • Parameter callback - The callback to invoke. The error will be passed as an argument to the callback.

onQuote(callback) - Invokes the given callback when a quote has been received.

  • Parameter callback - The callback to invoke. The quote will be passed as an argument to the callback.
ir.onQuote(quote => {
  var { ticker, type, price, size, timestamp } = quote
  console.log("QUOTE: ", ticker, type, price, size, timestamp)
})

join(...channels) - Joins the given channels. This can be called at any time. The client will automatically register joined channels and establish the proper subscriptions with the WebSocket connection.

  • Parameter channels - An argument list or array of channels to join. See Channels section above for more details.
ir.join("AAPL", "MSFT", "GE")
ir.join(["GOOG", "VG"])
ir.join("$lobby")

leave(...channels) - Leaves the given channels.

  • Parameter channels - An argument list or array of channels to leave.
ir.leave("AAPL", "MSFT", "GE")
ir.leave(["GOOG", "VG"])
ir.leave("$lobby")

leaveAll() - Leaves all joined channels.


listConnectedChannels() - Returns the list of joined channels. Recently joined channels may not appear in this list immediately.

intrinio-realtime-node-sdk's People

Contributors

alexnsolo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.