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.
- NodeJS 6.9.5
- 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)
npm install intrinio-realtime --save
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")
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.
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.
constructor(options)
- Creates a new instance of the IntrinioRealtime client.
- Parameter
options
: An object with ausername
andpassword
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.