Skip to content

Commit

Permalink
Added delayed SIP as a source
Browse files Browse the repository at this point in the history
  • Loading branch information
ssnyder-intrinio committed Jan 24, 2023
1 parent 1b013dc commit fdc5d04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SDK for working with Intrinio's realtime Multi-Exchange prices feed. Intrinio’
* Receive streaming, real-time price quotes (last trade, bid, ask)
* Subscribe to updates from individual securities
* Subscribe to updates for all securities
* Multiple sources of data - REALTIME or DELAYED_SIP

## Script
To use the Web SDK (non-NodeJS), include the `index.js` script (found in this repository) at the end of your `<body>` tag:
Expand Down Expand Up @@ -61,7 +62,7 @@ npm install intrinio-realtime --save
```javascript
const IntrinioRealtimeClient = require('intrinio-realtime')
const accessKey = ""
const provider = "REALTIME"
const provider = "REALTIME" // or "DELAYED_SIP"
const config = {
tradesOnly: true,
}
Expand Down
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ class IntrinioRealtime {
case "REALTIME":
if (this._config.isPublicKey) return "https://realtime-mx.intrinio.com/auth"
else return "https://realtime-mx.intrinio.com/auth?api_key=" + this._accessKey
case "DELAYED_SIP":
if (this._config.isPublicKey) return "https://realtime-delayed-sip.intrinio.com/auth"
else return "https://realtime-delayed-sip.intrinio.com/auth?api_key=" + this._accessKey
case "MANUAL":
if (this._config.isPublicKey) return "http://" + this._config.ipAddress + "/auth"
else return "http://" + this._config.ipAddress + "/auth?api_key=" + this._accessKey
Expand All @@ -181,6 +184,7 @@ class IntrinioRealtime {
_getWebSocketUrl() {
switch(this._config.provider) {
case "REALTIME": return "wss://realtime-mx.intrinio.com/socket/websocket?vsn=1.0.0&token=" + this._token
case "DELAYED_SIP": return "wss://realtime-delayed-sip.intrinio.com/socket/websocket?vsn=1.0.0&token=" + this._token
case "MANUAL": return "ws://" + this._config.ipAddress + "/socket/websocket?vsn=1.0.0&token=" + this._token
default: throw "Intrinio Realtime Client - 'config.provider' not specified!"
}
Expand Down Expand Up @@ -276,7 +280,7 @@ class IntrinioRealtime {
xhr.overrideMimeType("text/html")
xhr.setRequestHeader('Content-Type', 'application/json')
xhr.setRequestHeader('Authorization', 'Public ' + this._accessKey)
xhr.setRequestHeader('Client-Information', "IntrinioRealtimeWebSDKv4.0.2")
xhr.setRequestHeader('Client-Information', "IntrinioRealtimeWebSDKv4.1.0")
xhr.send()
}
catch (error) {
Expand All @@ -292,7 +296,7 @@ class IntrinioRealtime {
const url = this._getAuthUrl()
const options = {
headers: {
'Client-Information': 'IntrinioRealtimeNodeSDKv3.1'
'Client-Information': 'IntrinioRealtimeNodeSDKv4.1'
}
}
const request = protocol.get(url, options, response => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intrinio-realtime",
"version": "4.0.2",
"version": "4.1.0",
"engines": {
"node": ">=16.13.0"
},
Expand Down

0 comments on commit fdc5d04

Please sign in to comment.