Skip to content

Commit

Permalink
add nasdaq basic (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssnyder-intrinio authored Apr 19, 2023
1 parent 73e2c49 commit 8807762
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ docker compose run client
* 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
* Multiple sources of data - REALTIME or DELAYED_SIP or NASDAQ_BASIC

## 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 @@ -69,7 +69,7 @@ npm install intrinio-realtime --save
```javascript
const IntrinioRealtimeClient = require('intrinio-realtime')
const accessKey = ""
const provider = "REALTIME" // or "DELAYED_SIP"
const provider = "REALTIME" // or "DELAYED_SIP" or "NASDAQ_BASIC"
const config = {
tradesOnly: true,
}
Expand Down
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function writeString(bytes, string, startPos) {
}

const defaultConfig = {
provider: 'REALTIME',
provider: 'REALTIME', //REALTIME or DELAYED_SIP or NASDAQ_BASIC or MANUAL
ipAddress: undefined,
tradesOnly: false,
isPublicKey: false
Expand Down Expand Up @@ -135,8 +135,9 @@ class IntrinioRealtime {
if (!this._config.provider) {
throw "Intrinio Realtime Client - 'config.provider' must be specified"
}
else if ((this._config.provider !== "REALTIME") && (this._config.provider !== "MANUAL")) {
throw "Intrinio Realtime Client - 'config.provider' must be either 'REALTIME' or 'MANUAL'"
else if ((this._config.provider !== "REALTIME") && (this._config.provider !== "MANUAL")
&& (this._config.provider !== "DELAYED_SIP") && (this._config.provider !== "NASDAQ_BASIC")) {
throw "Intrinio Realtime Client - 'config.provider' must be either 'REALTIME' or 'MANUAL' or 'DELAYED_SIP' or 'NASDAQ_BASIC'"
}

if ((this._config.provider === "MANUAL") && ((!this._config.ipAddress) || (this._config.ipAddress === ""))) {
Expand Down Expand Up @@ -174,6 +175,9 @@ class IntrinioRealtime {
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 "NASDAQ_BASIC":
if (this._config.isPublicKey) return "https://realtime-nasdaq-basic.intrinio.com/auth"
else return "https://realtime-nasdaq-basic.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 @@ -185,6 +189,7 @@ class IntrinioRealtime {
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 "NASDAQ_BASIC": return "wss://realtime-nasdaq-basic.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
2 changes: 1 addition & 1 deletion realtime.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict"
const Client = require("./index")
const accessKey = ""
const accessKey = "API_KEY_HERE"

let trades = new Map()
let quotes = new Map()
Expand Down

0 comments on commit 8807762

Please sign in to comment.