Skip to content

Commit

Permalink
IsDarkpool (#24)
Browse files Browse the repository at this point in the history
* isDarkpool

* SYNTAX

* version bump
  • Loading branch information
ssnyder-intrinio authored Mar 14, 2024
1 parent e29fe48 commit 2078e43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function sleep(ms) {
}

const CLIENT_INFO_HEADER_KEY = "Client-Information";
const CLIENT_INFO_HEADER_VALUE = "IntrinioRealtimeNodeSDKv5.2";
const CLIENT_INFO_HEADER_VALUE = "IntrinioRealtimeNodeSDKv5.3";
const MESSAGE_VERSION_HEADER_KEY = "UseNewEquitiesFormat";
const MESSAGE_VERSION_HEADER_VALUE = "v2";
const EVENT_BUFFER_SIZE = 100;
Expand Down Expand Up @@ -417,6 +417,8 @@ class IntrinioRealtime {
_parseTrade(bytes) {
let symbolLength = bytes[2];
let conditionLength = bytes[26 + symbolLength];
let marketCenter = readUnicodeString(bytes, 4 + symbolLength, 6 + symbolLength);
let isDarkpool = (!marketCenter) || marketCenter == "\0" || marketCenter == "D" || marketCenter == "E" || marketCenter.trim().length === 0;
return {
Type: this._getMessageType(bytes[0]),
Symbol: readString(bytes, 3, 3 + symbolLength),
Expand All @@ -425,8 +427,9 @@ class IntrinioRealtime {
Timestamp: readUInt64(bytes, 14 + symbolLength),
TotalVolume: readUInt32(bytes, 22 + symbolLength),
SubProvider: this._getSubProvider(bytes[3 + symbolLength]),
MarketCenter: readUnicodeString(bytes, 4 + symbolLength, 6 + symbolLength),
Condition: conditionLength > 0 ? readString(bytes, 27 + symbolLength, 27 + symbolLength + conditionLength) : ""
MarketCenter: marketCenter,
Condition: conditionLength > 0 ? readString(bytes, 27 + symbolLength, 27 + symbolLength + conditionLength) : "",
IsDarkpool: isDarkpool
}
}

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": "5.2.0",
"version": "5.3.0",
"engines": {
"node": ">=20.7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion realtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function onQuote(quote) {
}

let client = new Client(accessKey, onTrade, onQuote, config);
await client.join("AAPL", false); //use $lobby for firehose.
client.join("AAPL", false); //use $lobby for firehose.
//require("./index").replayToCsv("outputFilePath.csv", config, ["$lobby"], false, accessKey)

setInterval(() => {
Expand Down

0 comments on commit 2078e43

Please sign in to comment.