@quotemedia.com/streamer 2.59.0 → 2.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/enduser-example.html +1 -1
- package/examples/enterprise-token-example.html +1 -1
- package/examples/oauth-token-example.html +231 -0
- package/examples/reconnect-example.html +3 -3
- package/examples/stomp-3rd-party-library-example.html +1 -1
- package/examples/streaming-news-example.html +1 -1
- package/examples/subscription-example.html +3 -3
- package/examples/wmid-example.html +1 -1
- package/package.json +1 -1
- package/{qmci-streamer-2.59.0.js → qmci-streamer-2.61.0.js} +175 -7
- package/{qmci-streamer-2.59.0.min.js → qmci-streamer-2.61.0.min.js} +5 -5
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<script src="qmci-streamer-2.61.0.min.js"></script>
|
|
5
|
+
</head>
|
|
6
|
+
|
|
7
|
+
<body>
|
|
8
|
+
<script type="text/javascript">
|
|
9
|
+
/**
|
|
10
|
+
* Demonstrates how to:
|
|
11
|
+
* - Configure and creating stream
|
|
12
|
+
* - Configure and opening connection
|
|
13
|
+
* - Set up callback to handle messages
|
|
14
|
+
* - Subscribe for symbols with different type of messages
|
|
15
|
+
* - Unsubscribe for the symbols and the messages type
|
|
16
|
+
* - Close the connection and stream
|
|
17
|
+
*/
|
|
18
|
+
window.onload = function() {
|
|
19
|
+
var Streamer = qmci.Streamer;
|
|
20
|
+
/**
|
|
21
|
+
* Step 1: Configure your login credentials inside the login method to get an SID
|
|
22
|
+
* Step 2: Open the streaming connection
|
|
23
|
+
* Step 3: Add the event listeners and the handlers for the messages
|
|
24
|
+
* Step 4: Make a subscription
|
|
25
|
+
* Step 5: Make unsubscribe
|
|
26
|
+
* Step 6: Close stream
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
Streamer.open({
|
|
30
|
+
host: 'https://app.quotemedia.com/cache',
|
|
31
|
+
cors: true,
|
|
32
|
+
rejectExcessiveConnection: false,
|
|
33
|
+
conflation: null,
|
|
34
|
+
format: 'application/json',
|
|
35
|
+
credentials: {
|
|
36
|
+
oauth_token: "YourOAuthToken"
|
|
37
|
+
}
|
|
38
|
+
}, then(function(stream) {
|
|
39
|
+
// After successfully opening the stream,
|
|
40
|
+
// listen for its events.
|
|
41
|
+
stream
|
|
42
|
+
// The stream will asynchronously callback with
|
|
43
|
+
// incoming market data messages.
|
|
44
|
+
.on("message", function(message) {
|
|
45
|
+
switch (Streamer.marketDataTypes.get(message)) {
|
|
46
|
+
case Streamer.marketDataTypes.PRICEDATA:
|
|
47
|
+
print("Price data: " + message.symbol, "blue");
|
|
48
|
+
break;
|
|
49
|
+
// For checking all the available marketDataTypes, go to the README.md file or check Object.keys(Streamer.marketDataTypes)
|
|
50
|
+
case Streamer.marketDataTypes.QUOTE:
|
|
51
|
+
print("Quote :" + message.symbol, "blue");
|
|
52
|
+
break;
|
|
53
|
+
case Streamer.marketDataTypes.MMQUOTE:
|
|
54
|
+
print("MMQuote :" + message.symbol, "blue");
|
|
55
|
+
break;
|
|
56
|
+
case Streamer.marketDataTypes.ORDERBOOK:
|
|
57
|
+
print("Orderbook :" + message.symbol, "blue");
|
|
58
|
+
break;
|
|
59
|
+
case Streamer.marketDataTypes.INTERVAL:
|
|
60
|
+
print("Interval :" + message.symbol, "blue");
|
|
61
|
+
break;
|
|
62
|
+
case Streamer.marketDataTypes.NETHOUSEPOSITION:
|
|
63
|
+
print("Nethouse Position :" + message.symbol, "blue");
|
|
64
|
+
break;
|
|
65
|
+
case Streamer.marketDataTypes.LASTSALE:
|
|
66
|
+
print("Last Sale :" + message.symbol, "blue");
|
|
67
|
+
break;
|
|
68
|
+
case Streamer.marketDataTypes.LIMITUPLIMITDOWN:
|
|
69
|
+
print("LULD :" + message.symbol, "blue");
|
|
70
|
+
break;
|
|
71
|
+
case Streamer.marketDataTypes.IVGREEKS:
|
|
72
|
+
print("IVGreeks :" + message.symbol, "blue");
|
|
73
|
+
break;
|
|
74
|
+
case Streamer.marketDataTypes.IMBALANCESTATUS:
|
|
75
|
+
print("Imbalance status :" + message.symbol, "blue");
|
|
76
|
+
break;
|
|
77
|
+
case Streamer.marketDataTypes.TRADE:
|
|
78
|
+
print("Trade :" + message.symbol + " " + message.price, "blue");
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
// It's recommended to attach an error handler
|
|
84
|
+
// to help diagnose unexpected errors.
|
|
85
|
+
.on("error", function(err) {
|
|
86
|
+
print(err, "red");
|
|
87
|
+
})
|
|
88
|
+
.on("stats", function(msg) {
|
|
89
|
+
print("STATS. Number of l1 symbols available: " + msg.numberOfAvailableSymbolsL1 +
|
|
90
|
+
", number of l2 symbols available " + msg.numberOfAvailableSymbolsL2 +
|
|
91
|
+
", number of subscribed exchanges: " + msg.numberOfSubscribedExchanges +
|
|
92
|
+
", number of available connections: " + msg.numberOfAvailableConnections, "green");
|
|
93
|
+
})
|
|
94
|
+
.on("slow", function(msg) {
|
|
95
|
+
print("Slow -> TimesExceeded: " + msg.timesExceeded + " MaxExceed: " + msg.maxExceed);
|
|
96
|
+
})
|
|
97
|
+
.on("initialDataSent", function(msg) {
|
|
98
|
+
print("Initial data sent. Timestamp: " + msg.timestamp);
|
|
99
|
+
})
|
|
100
|
+
.on("resubscribeMessage", function(msg) {
|
|
101
|
+
print("Resubscription has been triggered. Timestamp: " + msg.timestamp);
|
|
102
|
+
})
|
|
103
|
+
// Due to network hiccups or other unexepected errors,
|
|
104
|
+
// the stream may be unexpectedly closed.
|
|
105
|
+
// For robustness, it's recommended to add reconnection logic.
|
|
106
|
+
.on("close", function(msg) {
|
|
107
|
+
print("Closed: " + msg);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Subscribe for symbols and subscription types.
|
|
111
|
+
// These can be either single strings or arrays of strings.
|
|
112
|
+
// See Object.keys(Streamer.subscriptionTypes) for available types.
|
|
113
|
+
// An optional options object can also be passed in. Current available options include:
|
|
114
|
+
// - skipHeavyInitialLoad: whether to skip initial heavy loads (e.g., previous trades and intervals), defaults to false.
|
|
115
|
+
// - conflation: Override default connection conflation, default to null. A matching conflation must be supplied when unsubscribing.
|
|
116
|
+
stream.subscribe(["GOOG"], [Streamer.subscriptionTypes.PRICEDATA], { skipHeavyInitialLoad: false }, then(function(result) {
|
|
117
|
+
// The subscription result will include the successful subscriptions
|
|
118
|
+
// as well as the unentitled and rejected subscriptions and invalid symbols.
|
|
119
|
+
var subscribed = result.subscribed;
|
|
120
|
+
for (var i = 0; i < subscribed.length; ++i) {
|
|
121
|
+
print("Subscribed: " + subscribed[i].symbol + " - " + subscribed[i].type + " (" + subscribed[i].entitlement + ")");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Retrieve available number of symbols and connections, number of currently open connections and subscribed symbols.
|
|
125
|
+
stream.getSessionStats();
|
|
126
|
+
|
|
127
|
+
setTimeout(function() {
|
|
128
|
+
// Unsubscribe for symbols and data types.
|
|
129
|
+
// These can be either single strings or arrays of strings.
|
|
130
|
+
// An optional options object can also be passed in. Current available options include:
|
|
131
|
+
// - conflation: Override default connection conflation, default to null. Should match a subscribe conflation.
|
|
132
|
+
stream.unsubscribe(["GOOG"], [Streamer.subscriptionTypes.PRICEDATA], {}, then(function(result) {
|
|
133
|
+
// The unsubscription result will include the unsubscriptions.
|
|
134
|
+
var unsubscribed = result.unsubscribed;
|
|
135
|
+
for (var i = 0; i < unsubscribed.length; ++i) {
|
|
136
|
+
print("Unsubscribed: " + unsubscribed[i].symbol + " - " + unsubscribed[i].type);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Finally, close the stream.
|
|
140
|
+
//stream.close(then(function(){
|
|
141
|
+
//
|
|
142
|
+
//}));
|
|
143
|
+
}));
|
|
144
|
+
}, 5000);
|
|
145
|
+
}));
|
|
146
|
+
|
|
147
|
+
//Another example for a subscription for the Trade datatype
|
|
148
|
+
stream.subscribe(["MSFT", "AAPL"], [Streamer.subscriptionTypes.QUOTE, Streamer.subscriptionTypes.TRADE], { skipHeavyInitialLoad: false }, then(function(result) {
|
|
149
|
+
var subscribed = result.subscribed;
|
|
150
|
+
for (var i = 0; i < subscribed.length; ++i) {
|
|
151
|
+
print("Subscribed: " + subscribed[i].symbol + " - " + subscribed[i].type + " (" + subscribed[i].entitlement + ")");
|
|
152
|
+
}
|
|
153
|
+
stream.getSessionStats();
|
|
154
|
+
|
|
155
|
+
setTimeout(function() {
|
|
156
|
+
|
|
157
|
+
stream.unsubscribe(["MSFT", "AAPL"], [Streamer.subscriptionTypes.QUOTE, Streamer.subscriptionTypes.TRADE], {}, then(function(result) {
|
|
158
|
+
|
|
159
|
+
var unsubscribed = result.unsubscribed;
|
|
160
|
+
for (var i = 0; i < unsubscribed.length; ++i) {
|
|
161
|
+
print("Unsubscribed: " + unsubscribed[i].symbol + " - " + unsubscribed[i].type);
|
|
162
|
+
}
|
|
163
|
+
// Finally, close the stream.
|
|
164
|
+
stream.close(then(function() {
|
|
165
|
+
print("Streamer connection closed", "red");
|
|
166
|
+
}));
|
|
167
|
+
}));
|
|
168
|
+
}, 5000);
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Subscription to an exchange to receive stock status messages containing data such as halt,
|
|
174
|
+
* resume, regSHO.
|
|
175
|
+
* ************** NOTE: **************
|
|
176
|
+
* The stock status by exchange feature in the streaming datafeed api is considered a premium service
|
|
177
|
+
* that requires additional entitlements for clients to have access to the service and helps active traders
|
|
178
|
+
* to monitor the market. If you are entitled to this premium service and you want exchange data,
|
|
179
|
+
* you can uncomment the code below.
|
|
180
|
+
*
|
|
181
|
+
* Please inquire about your account if you need further information in this regard.
|
|
182
|
+
* @see https://quotemediasupport.freshdesk.com/support/solutions/articles/13000088921-exchange-level-subscriptions-only-stock-status-halt-regsho-is-supported
|
|
183
|
+
* ***********************************
|
|
184
|
+
*
|
|
185
|
+
* An optional options object can also be passed in. Current available options include:
|
|
186
|
+
* - conflation: Override default connection conflation, default to null.
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
// stream.subscribeExchange("NYE", then(function(result) {
|
|
190
|
+
// print("Subscribed Exchange: " + result.exchange);
|
|
191
|
+
|
|
192
|
+
// setTimeout(function() {
|
|
193
|
+
// // Unsubscribe from the exchange.
|
|
194
|
+
// // An optional options object can also be passed in. Current available options include:
|
|
195
|
+
// // - conflation: Override default connection conflation, default to null. Should match a subscribe conflation.
|
|
196
|
+
// stream.unsubscribeExchange("NYE", then(function(result) {
|
|
197
|
+
// print("Unsubscribed Exchange: " + result.exchange);
|
|
198
|
+
|
|
199
|
+
// // Finally, close the stream.
|
|
200
|
+
// stream.close(then(function() {
|
|
201
|
+
|
|
202
|
+
// }));
|
|
203
|
+
// }));
|
|
204
|
+
// }, 5000);
|
|
205
|
+
// }));
|
|
206
|
+
}));
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
function print(msg, color) {
|
|
210
|
+
var el = document.createElement("div");
|
|
211
|
+
el.innerText = msg;
|
|
212
|
+
if (color) {
|
|
213
|
+
el.style.color = color;
|
|
214
|
+
}
|
|
215
|
+
document.body.appendChild(el);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function then(onSuccess) {
|
|
219
|
+
return function(err, result) {
|
|
220
|
+
if (err) {
|
|
221
|
+
print(err, "red");
|
|
222
|
+
} else {
|
|
223
|
+
onSuccess(result);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
</script>
|
|
229
|
+
</body>
|
|
230
|
+
|
|
231
|
+
</html>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<html>
|
|
2
2
|
|
|
3
3
|
<head>
|
|
4
|
-
<script src="qmci-streamer-2.
|
|
4
|
+
<script src="qmci-streamer-2.61.0.min.js"></script>
|
|
5
5
|
</head>
|
|
6
6
|
|
|
7
7
|
<body>
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
}));
|
|
180
180
|
|
|
181
181
|
//Another example for a subscription for the Trade datatype
|
|
182
|
-
stream.subscribe(["MSFT"], [Streamer.subscriptionTypes.TRADE], { skipHeavyInitialLoad: false }, then(function(result) {
|
|
182
|
+
stream.subscribe(["MSFT", "AAPL"], [Streamer.subscriptionTypes.QUOTE, Streamer.subscriptionTypes.TRADE], { skipHeavyInitialLoad: false }, then(function(result) {
|
|
183
183
|
var subscribed = result.subscribed;
|
|
184
184
|
for (var i = 0; i < subscribed.length; ++i) {
|
|
185
185
|
print("Subscribed: " + subscribed[i].symbol + " - " + subscribed[i].type + " (" + subscribed[i].entitlement + ")");
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
|
|
189
189
|
setTimeout(function() {
|
|
190
190
|
|
|
191
|
-
stream.unsubscribe(["MSFT"], [Streamer.subscriptionTypes.TRADE], {}, then(function(result) {
|
|
191
|
+
stream.unsubscribe(["MSFT", "AAPL"], [Streamer.subscriptionTypes.QUOTE, Streamer.subscriptionTypes.TRADE], {}, then(function(result) {
|
|
192
192
|
|
|
193
193
|
var unsubscribed = result.unsubscribed;
|
|
194
194
|
for (var i = 0; i < unsubscribed.length; ++i) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<html>
|
|
2
2
|
|
|
3
3
|
<head>
|
|
4
|
-
<script src="qmci-streamer-2.
|
|
4
|
+
<script src="qmci-streamer-2.61.0.min.js"></script>
|
|
5
5
|
</head>
|
|
6
6
|
|
|
7
7
|
<body>
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
}));
|
|
167
167
|
|
|
168
168
|
//Another example for a subscription for the Trade datatype
|
|
169
|
-
stream.subscribe(["MSFT"], [Streamer.subscriptionTypes.TRADE], { skipHeavyInitialLoad: false }, then(function(result) {
|
|
169
|
+
stream.subscribe(["MSFT", "AAPL"], [Streamer.subscriptionTypes.QUOTE, Streamer.subscriptionTypes.TRADE], { skipHeavyInitialLoad: false }, then(function(result) {
|
|
170
170
|
var subscribed = result.subscribed;
|
|
171
171
|
for (var i = 0; i < subscribed.length; ++i) {
|
|
172
172
|
print("Subscribed: " + subscribed[i].symbol + " - " + subscribed[i].type + " (" + subscribed[i].entitlement + ")");
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
|
|
176
176
|
setTimeout(function() {
|
|
177
177
|
|
|
178
|
-
stream.unsubscribe(["MSFT"], [Streamer.subscriptionTypes.TRADE], {}, then(function(result) {
|
|
178
|
+
stream.unsubscribe(["MSFT", "AAPL"], [Streamer.subscriptionTypes.QUOTE, Streamer.subscriptionTypes.TRADE], {}, then(function(result) {
|
|
179
179
|
|
|
180
180
|
var unsubscribed = result.unsubscribed;
|
|
181
181
|
for (var i = 0; i < unsubscribed.length; ++i) {
|
package/package.json
CHANGED
|
@@ -917,6 +917,30 @@ var Stream = function () {
|
|
|
917
917
|
this.send(msg);
|
|
918
918
|
};
|
|
919
919
|
|
|
920
|
+
Stream.prototype.updateOAuthToken = function updateOAuthToken(token, previousToken, callbackOrNothing) {
|
|
921
|
+
var callback = callbackOrNothing ? callbackOrNothing : optsOrCallback && typeof optsOrCallback === "function" ? optsOrCallback : null;
|
|
922
|
+
|
|
923
|
+
if (this.isClosed()) {
|
|
924
|
+
var event = events.error("Stream is disconnected", {
|
|
925
|
+
code: -1,
|
|
926
|
+
reason: "Already disconnected"
|
|
927
|
+
});
|
|
928
|
+
this.events.fire("error", event);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
var updateToken = {
|
|
933
|
+
mimetype: this.format,
|
|
934
|
+
callback: callback
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
var request = this.buildUpdateAuthTokenRequest("oauth", token, previousToken, updateToken);
|
|
938
|
+
var id = this.requestid.next();
|
|
939
|
+
request.id = id;
|
|
940
|
+
|
|
941
|
+
this.send(request);
|
|
942
|
+
};
|
|
943
|
+
|
|
920
944
|
Stream.prototype.fltUpdateNews = function fltUpdateNews(filters, filterId, callbackOrNothing) {
|
|
921
945
|
var callback = callbackOrNothing ? callbackOrNothing : optsOrCallback && typeof optsOrCallback === "function" ? optsOrCallback : null;
|
|
922
946
|
|
|
@@ -1362,6 +1386,17 @@ var Stream = function () {
|
|
|
1362
1386
|
return msg;
|
|
1363
1387
|
};
|
|
1364
1388
|
|
|
1389
|
+
Stream.prototype.buildUpdateAuthTokenRequest = function buildUpdateAuthTokenRequest(authMethod, token, previousToken, updateToken) {
|
|
1390
|
+
var msg = new _streamerApi.messages.control.AuthTokenMessage();
|
|
1391
|
+
msg.authMethod = authMethod;
|
|
1392
|
+
msg.authParams = {
|
|
1393
|
+
"oauthToken": token,
|
|
1394
|
+
"previousToken": previousToken
|
|
1395
|
+
};
|
|
1396
|
+
msg.mimetype = updateToken.mimetype;
|
|
1397
|
+
return msg;
|
|
1398
|
+
};
|
|
1399
|
+
|
|
1365
1400
|
Stream.prototype.buildNewsCommandRequest = function buildNewsCommandRequest(sub, newsAction) {
|
|
1366
1401
|
var msg = new _streamerApi.messages.control.NewsCommandMessage();
|
|
1367
1402
|
msg.newsAction = newsAction;
|
|
@@ -1452,10 +1487,16 @@ var Stream = function () {
|
|
|
1452
1487
|
case _streamerApi.messages.MessageTypeNames.ctrl.NEWS_FLT_UPDATE_RESPONSE:
|
|
1453
1488
|
this.onNewsFltUpdateMessage(msg);
|
|
1454
1489
|
break;
|
|
1490
|
+
case _streamerApi.messages.MessageTypeNames.ctrl.AUTH_TOKEN_RESPONSE:
|
|
1491
|
+
this.onAuthTokenResponse(msg);
|
|
1492
|
+
break;
|
|
1455
1493
|
}
|
|
1456
1494
|
};
|
|
1457
1495
|
|
|
1458
|
-
Stream.prototype.onHeartbeat = function onHeartbeat(msg) {
|
|
1496
|
+
Stream.prototype.onHeartbeat = function onHeartbeat(msg) {
|
|
1497
|
+
this.log.debug(_formatting.msgfmt.fmt(msg));
|
|
1498
|
+
this.events.fire("heartbeat", msg);
|
|
1499
|
+
};
|
|
1459
1500
|
|
|
1460
1501
|
Stream.prototype.onSubscribeResponse = function onSubscribeResponse(msg) {
|
|
1461
1502
|
var subscription = this.pendingsubscriptions[msg.__id];
|
|
@@ -2138,6 +2179,11 @@ var Stream = function () {
|
|
|
2138
2179
|
}
|
|
2139
2180
|
};
|
|
2140
2181
|
|
|
2182
|
+
Stream.prototype.onAuthTokenResponse = function onAuthTokenResponse(msg) {
|
|
2183
|
+
this.log.debug(_formatting.msgfmt.fmt(msg));
|
|
2184
|
+
this.events.fire("authTokenResponse", msg);
|
|
2185
|
+
};
|
|
2186
|
+
|
|
2141
2187
|
Stream.prototype._handledatamsg = function _handledatamsg(msg) {
|
|
2142
2188
|
this.events.fire("message", msg);
|
|
2143
2189
|
};
|
|
@@ -6184,6 +6230,22 @@ var DataToolCredentials = function () {
|
|
|
6184
6230
|
return DataToolCredentials;
|
|
6185
6231
|
}();
|
|
6186
6232
|
|
|
6233
|
+
var OAuthTokenCredentials = function () {
|
|
6234
|
+
function OAuthTokenCredentials(token) {
|
|
6235
|
+
_classCallCheck(this, OAuthTokenCredentials);
|
|
6236
|
+
|
|
6237
|
+
this.oauth_token = token;
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6240
|
+
OAuthTokenCredentials.prototype.getHeaders = function getHeaders() {
|
|
6241
|
+
return {
|
|
6242
|
+
"Authorization": this.oauth_token
|
|
6243
|
+
};
|
|
6244
|
+
};
|
|
6245
|
+
|
|
6246
|
+
return OAuthTokenCredentials;
|
|
6247
|
+
}();
|
|
6248
|
+
|
|
6187
6249
|
function asCredentials(credentials) {
|
|
6188
6250
|
var keys = Object.keys(credentials);
|
|
6189
6251
|
if ((0, _arrayEqual2["default"])(keys, ["sid"])) {
|
|
@@ -6194,6 +6256,8 @@ function asCredentials(credentials) {
|
|
|
6194
6256
|
return new WebmasterIpCredentials(credentials.wmid);
|
|
6195
6257
|
} else if ((0, _arrayEqual2["default"])(keys, ["data_token"])) {
|
|
6196
6258
|
return new DataToolCredentials(credentials.data_token);
|
|
6259
|
+
} else if ((0, _arrayEqual2["default"])(keys, ["oauth_token"])) {
|
|
6260
|
+
return new OAuthTokenCredentials(credentials.oauth_token);
|
|
6197
6261
|
} else {
|
|
6198
6262
|
throw new Error("Misconfigured credentials, should be one of {sid}, {wmid,token}, or {wmid}");
|
|
6199
6263
|
}
|
|
@@ -6346,6 +6410,8 @@ fmt.Formatter = function () {
|
|
|
6346
6410
|
this.formatters[_streamerApi.messages.MessageTypeNames.ctrl.NEWS_FILTER_MESSAGE] = this._fmtnewsfilterremotemessage;
|
|
6347
6411
|
this.formatters[_streamerApi.messages.MessageTypeNames.ctrl.NEWS_ERROR_MESSAGE] = this._fmtnewserrorremotemessage;
|
|
6348
6412
|
this.formatters[_streamerApi.messages.MessageTypeNames.ctrl.NEWS_SUCCESS_MESSAGE] = this._fmtnewssuccessremotemessage;
|
|
6413
|
+
this.formatters[_streamerApi.messages.MessageTypeNames.ctrl.AUTH_TOKEN] = this._fmtauthtoken;
|
|
6414
|
+
this.formatters[_streamerApi.messages.MessageTypeNames.ctrl.AUTH_TOKEN_RESPONSE] = this._fmtauthtokenresponse;
|
|
6349
6415
|
|
|
6350
6416
|
//
|
|
6351
6417
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.QUOTE] = this._fmtquote;
|
|
@@ -6654,6 +6720,8 @@ fmt.Formatter.prototype._fmttrade = function (val) {
|
|
|
6654
6720
|
s.append(val.accumulatedVolume);
|
|
6655
6721
|
s.sep();
|
|
6656
6722
|
s.append(val.vwap);
|
|
6723
|
+
s.sep();
|
|
6724
|
+
s.append(val.orderExecutions);
|
|
6657
6725
|
// TODO flags
|
|
6658
6726
|
return s.toString();
|
|
6659
6727
|
};
|
|
@@ -7149,6 +7217,8 @@ fmt.Formatter.prototype._fmtorderexecuted = function (val) {
|
|
|
7149
7217
|
s.append(val.marketMakerID);
|
|
7150
7218
|
s.sep();
|
|
7151
7219
|
s.append(val.orderID);
|
|
7220
|
+
s.sep();
|
|
7221
|
+
s.append(val.aggressorSide);
|
|
7152
7222
|
|
|
7153
7223
|
return s.toString();
|
|
7154
7224
|
};
|
|
@@ -7184,9 +7254,27 @@ fmt.Formatter.prototype._fmtnewssuccessremotemessage = function (val) {
|
|
|
7184
7254
|
return s.toString();
|
|
7185
7255
|
};
|
|
7186
7256
|
|
|
7257
|
+
fmt.Formatter.prototype._fmtauthtoken = function (val) {
|
|
7258
|
+
var s = new fmt.StringBuilder();
|
|
7259
|
+
s.append('AUTH TOKEN');
|
|
7260
|
+
s.sep();
|
|
7261
|
+
this.__baseresponse(val, s);
|
|
7262
|
+
// TODO
|
|
7263
|
+
return s.toString();
|
|
7264
|
+
};
|
|
7265
|
+
|
|
7266
|
+
fmt.Formatter.prototype._fmtauthtokenresponse = function (val) {
|
|
7267
|
+
var s = new fmt.StringBuilder();
|
|
7268
|
+
s.append('AUTH TOKEN RESPONSE');
|
|
7269
|
+
s.sep();
|
|
7270
|
+
this.__baseresponse(val, s);
|
|
7271
|
+
// TODO
|
|
7272
|
+
return s.toString();
|
|
7273
|
+
};
|
|
7274
|
+
|
|
7187
7275
|
fmt.Formatter.prototype._fmtheartbeat = function (val) {
|
|
7188
7276
|
var s = new fmt.StringBuilder();
|
|
7189
|
-
s.append("
|
|
7277
|
+
s.append("HEARTBEAT");
|
|
7190
7278
|
s.sep();
|
|
7191
7279
|
s.datetime(val.timestamp);
|
|
7192
7280
|
return s.toString();
|
|
@@ -8419,6 +8507,8 @@ var EnumValueTranslator = function () {
|
|
|
8419
8507
|
return "DLO";
|
|
8420
8508
|
case 8:
|
|
8421
8509
|
return "DLN";
|
|
8510
|
+
case 9:
|
|
8511
|
+
return "LCQ";
|
|
8422
8512
|
default:
|
|
8423
8513
|
return "NA";
|
|
8424
8514
|
}
|
|
@@ -14301,6 +14391,30 @@ var StompStream = function () {
|
|
|
14301
14391
|
this.send(msg);
|
|
14302
14392
|
};
|
|
14303
14393
|
|
|
14394
|
+
StompStream.prototype.updateOAuthToken = function updateOAuthToken(token, previousToken, callbackOrNothing) {
|
|
14395
|
+
var callback = callbackOrNothing ? callbackOrNothing : optsOrCallback && typeof optsOrCallback === "function" ? optsOrCallback : null;
|
|
14396
|
+
|
|
14397
|
+
if (this.isClosed()) {
|
|
14398
|
+
var event = events.error("Stream is disconnected", {
|
|
14399
|
+
code: -1,
|
|
14400
|
+
reason: "Already disconnected"
|
|
14401
|
+
});
|
|
14402
|
+
this.events.fire("error", event);
|
|
14403
|
+
return;
|
|
14404
|
+
}
|
|
14405
|
+
|
|
14406
|
+
var updateToken = {
|
|
14407
|
+
mimetype: this.format,
|
|
14408
|
+
callback: callback
|
|
14409
|
+
};
|
|
14410
|
+
|
|
14411
|
+
var request = this.buildUpdateAuthTokenRequest("oauth", token, previousToken, updateToken);
|
|
14412
|
+
var id = this.requestid.next();
|
|
14413
|
+
request.id = id;
|
|
14414
|
+
|
|
14415
|
+
this.send(request);
|
|
14416
|
+
};
|
|
14417
|
+
|
|
14304
14418
|
StompStream.prototype.cmdFilterNews = function cmdFilterNews(callbackOrNothing) {
|
|
14305
14419
|
var callback = callbackOrNothing ? callbackOrNothing : optsOrCallback && typeof optsOrCallback === "function" ? optsOrCallback : null;
|
|
14306
14420
|
|
|
@@ -14650,6 +14764,17 @@ var StompStream = function () {
|
|
|
14650
14764
|
return msg;
|
|
14651
14765
|
};
|
|
14652
14766
|
|
|
14767
|
+
StompStream.prototype.buildUpdateAuthTokenRequest = function buildUpdateAuthTokenRequest(authMethod, token, previousToken, updateToken) {
|
|
14768
|
+
var msg = new _streamerApi.messages.control.AuthTokenMessage();
|
|
14769
|
+
msg.authMethod = authMethod;
|
|
14770
|
+
msg.authParams = {
|
|
14771
|
+
"oauthToken": token,
|
|
14772
|
+
"previousToken": previousToken
|
|
14773
|
+
};
|
|
14774
|
+
msg.mimetype = updateToken.mimetype;
|
|
14775
|
+
return msg;
|
|
14776
|
+
};
|
|
14777
|
+
|
|
14653
14778
|
StompStream.prototype.buildNewsCommandRequest = function buildNewsCommandRequest(sub, newsAction) {
|
|
14654
14779
|
var msg = new _streamerApi.messages.control.NewsCommandMessage();
|
|
14655
14780
|
msg.newsAction = newsAction;
|
|
@@ -14734,6 +14859,9 @@ var StompStream = function () {
|
|
|
14734
14859
|
case _streamerApi.messages.MessageTypeNames.ctrl.MISSED_DATA_SENT:
|
|
14735
14860
|
this.onMissedDataSent(msg);
|
|
14736
14861
|
break;
|
|
14862
|
+
case _streamerApi.messages.MessageTypeNames.ctrl.AUTH_TOKEN_RESPONSE:
|
|
14863
|
+
this.onAuthTokenResponse(msg);
|
|
14864
|
+
break;
|
|
14737
14865
|
}
|
|
14738
14866
|
};
|
|
14739
14867
|
|
|
@@ -14763,7 +14891,10 @@ var StompStream = function () {
|
|
|
14763
14891
|
}
|
|
14764
14892
|
};
|
|
14765
14893
|
|
|
14766
|
-
StompStream.prototype.onHeartbeat = function onHeartbeat(msg) {
|
|
14894
|
+
StompStream.prototype.onHeartbeat = function onHeartbeat(msg) {
|
|
14895
|
+
this.log.debug(_formatting.msgfmt.fmt(msg));
|
|
14896
|
+
this.events.fire("heartbeat", msg);
|
|
14897
|
+
};
|
|
14767
14898
|
|
|
14768
14899
|
StompStream.prototype.onSubscribeResponse = function onSubscribeResponse(msg) {
|
|
14769
14900
|
var subscription = this.pendingsubscriptions[msg.__id];
|
|
@@ -15352,6 +15483,11 @@ var StompStream = function () {
|
|
|
15352
15483
|
this.conn.send(msg);
|
|
15353
15484
|
};
|
|
15354
15485
|
|
|
15486
|
+
StompStream.prototype.onAuthTokenResponse = function onAuthTokenResponse(msg) {
|
|
15487
|
+
this.log.debug(_formatting.msgfmt.fmt(msg));
|
|
15488
|
+
this.events.fire("authTokenResponse", msg);
|
|
15489
|
+
};
|
|
15490
|
+
|
|
15355
15491
|
StompStream.prototype._handledatamsg = function _handledatamsg(msg) {
|
|
15356
15492
|
this.events.fire("message", msg);
|
|
15357
15493
|
};
|
|
@@ -15568,6 +15704,9 @@ var StompStreamingService = function () {
|
|
|
15568
15704
|
} else if (this.config.credentials.data_token !== undefined) {
|
|
15569
15705
|
authMessage.authenticationMethod = "datatool";
|
|
15570
15706
|
authMessage.authorization = this.config.credentials.data_token;
|
|
15707
|
+
} else if (this.config.credentials.oauth_token !== undefined) {
|
|
15708
|
+
authMessage.authenticationMethod = "oauth";
|
|
15709
|
+
authMessage.authorization = this.config.credentials.oauth_token;
|
|
15571
15710
|
}
|
|
15572
15711
|
|
|
15573
15712
|
if (this.config.conflation != null && this.config.conflation !== "") {
|
|
@@ -15671,7 +15810,7 @@ exports.__esModule = true;
|
|
|
15671
15810
|
*/
|
|
15672
15811
|
|
|
15673
15812
|
var LIBRARY_NAME = exports.LIBRARY_NAME = "JavaScript";
|
|
15674
|
-
var VERSION = exports.VERSION = "2.
|
|
15813
|
+
var VERSION = exports.VERSION = "2.61.0";
|
|
15675
15814
|
|
|
15676
15815
|
/**
|
|
15677
15816
|
* Streamer API namespace.
|
|
@@ -15753,8 +15892,9 @@ messages.MessageTypeNames = {
|
|
|
15753
15892
|
NEWS_FLT_UPDATE_RESPONSE: 'C36',
|
|
15754
15893
|
NEWS_FILTER_MESSAGE: "C37",
|
|
15755
15894
|
NEWS_ERROR_MESSAGE: "C38",
|
|
15756
|
-
NEWS_SUCCESS_MESSAGE: "C39"
|
|
15757
|
-
|
|
15895
|
+
NEWS_SUCCESS_MESSAGE: "C39",
|
|
15896
|
+
AUTH_TOKEN: "C41",
|
|
15897
|
+
AUTH_TOKEN_RESPONSE: "C42"
|
|
15758
15898
|
},
|
|
15759
15899
|
/**
|
|
15760
15900
|
* Name space for data message type identifiers.<br>
|
|
@@ -16038,7 +16178,6 @@ messages.control.AlertsSubUnsubMessage.prototype = new messages.control.CtrlMess
|
|
|
16038
16178
|
* Creates Trade notification subscribe message.
|
|
16039
16179
|
* @constructor
|
|
16040
16180
|
*/
|
|
16041
|
-
|
|
16042
16181
|
messages.control.TradeSubscribeMessage = function () {
|
|
16043
16182
|
this.init(messages.MessageTypeNames.ctrl.TRADE_SUBSCRIBE);
|
|
16044
16183
|
|
|
@@ -16064,6 +16203,34 @@ messages.control.TradeSubscribeMessage = function () {
|
|
|
16064
16203
|
};
|
|
16065
16204
|
messages.control.TradeSubscribeMessage.prototype = new messages.control.CtrlMessage();
|
|
16066
16205
|
|
|
16206
|
+
/**
|
|
16207
|
+
* Creates Update Auth Token message.
|
|
16208
|
+
* @constructor
|
|
16209
|
+
*/
|
|
16210
|
+
messages.control.AuthTokenMessage = function () {
|
|
16211
|
+
this.init(messages.MessageTypeNames.ctrl.AUTH_TOKEN);
|
|
16212
|
+
|
|
16213
|
+
/**
|
|
16214
|
+
* The auth method.
|
|
16215
|
+
* @type {string}
|
|
16216
|
+
*/
|
|
16217
|
+
this.authMethod = null;
|
|
16218
|
+
|
|
16219
|
+
/**
|
|
16220
|
+
* The auth parameters.
|
|
16221
|
+
* @type {Array}
|
|
16222
|
+
*/
|
|
16223
|
+
this.authParams = null;
|
|
16224
|
+
|
|
16225
|
+
/**
|
|
16226
|
+
* Requested message mime-type format.
|
|
16227
|
+
* @type {string}
|
|
16228
|
+
* @see exports.messages.MimeTypes
|
|
16229
|
+
*/
|
|
16230
|
+
this.mimetype = null;
|
|
16231
|
+
};
|
|
16232
|
+
messages.control.AuthTokenMessage.prototype = new messages.control.CtrlMessage();
|
|
16233
|
+
|
|
16067
16234
|
/**
|
|
16068
16235
|
* Base class for response exports.
|
|
16069
16236
|
* @abstract
|
|
@@ -16552,6 +16719,7 @@ messages.control.StreamEntitlementType = {
|
|
|
16552
16719
|
DL: "Delayed",
|
|
16553
16720
|
DLO: "Delayed CBOE One",
|
|
16554
16721
|
DLN: "Delayed NASDAQ",
|
|
16722
|
+
LCQ: "Low Cost QM",
|
|
16555
16723
|
NA: "Not Entitled"
|
|
16556
16724
|
};
|
|
16557
16725
|
|