@quotemedia.com/streamer 2.51.0 → 2.53.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/README.md +47 -1
- package/examples/enduser-example.html +1 -1
- package/examples/enterprise-token-example.html +1 -1
- package/examples/reconnect-example.html +1 -1
- package/examples/stomp-3rd-party-library-example.html +1 -1
- package/examples/subscription-example.html +1 -1
- package/examples/wmid-example.html +1 -1
- package/package.json +1 -1
- package/{qmci-streamer-2.51.0.js → qmci-streamer-2.53.0.js} +74 -12
- package/{qmci-streamer-2.51.0.min.js → qmci-streamer-2.53.0.min.js} +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
# Overview
|
|
1
2
|
JavaScript streaming client that provides easy-to-use client APIs to connect and subscribe to QuoteMedia's market data streaming services.
|
|
2
3
|
|
|
3
|
-
https://quotemedia.com/
|
|
4
|
+
https://quotemedia.com/
|
|
5
|
+
## Getting Started
|
|
6
|
+
The Javascript streaming client is a library that contains all the necessary dependencies to run not only in the `browser`, but also in `Node.js` environments.
|
|
7
|
+
|
|
8
|
+
### Browser Usage
|
|
9
|
+
To use the library in your browser project simply include the library file in your HTML page as a script.
|
|
10
|
+
|
|
11
|
+
### Node.js Usage
|
|
12
|
+
Since the `window` object is not available in `Node.js`, it will need to be mocked before we import the library.
|
|
13
|
+
1. Mock the window object before importing the library:
|
|
14
|
+
```javascript
|
|
15
|
+
if (typeof global.window === 'undefined') {
|
|
16
|
+
var window = {
|
|
17
|
+
navigator: { userAgent: "atmosphere.js" },
|
|
18
|
+
document: {},
|
|
19
|
+
location: {
|
|
20
|
+
protocol: 'https:'},
|
|
21
|
+
JSON: JSON
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
window.WebSocket = require("ws");
|
|
25
|
+
window.EventSource = require("eventsource");
|
|
26
|
+
window.XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
|
27
|
+
|
|
28
|
+
global.window = window;
|
|
29
|
+
global.location = window.location;
|
|
30
|
+
global.WebSocket = window.WebSocket;
|
|
31
|
+
global.EventSource = window.EventSource;
|
|
32
|
+
global.navigator = window.navigator;
|
|
33
|
+
global.document = window.document;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
2. Then import the library with require syntax:
|
|
37
|
+
```javascript
|
|
38
|
+
var Streamer = require("<path to the library>");
|
|
39
|
+
```
|
|
40
|
+
3. The library is ready for use in your `Node.js` project.
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
- [Enterprise Example](./enterprise-example.html) <br> An example showing how to configure, create a stream, and subscribe to market data with tokens. <br>
|
|
45
|
+
- [Enduser Example](./enduser-example.html): <br> An example showing how to configure, create a stream, and subscribe to market data with enduser credentials.
|
|
46
|
+
- [WMID Example](./wmid-example.html): <br> An example showing how to configure, create a stream, and subscribe to market data with a webmaster ID. <br>
|
|
47
|
+
- [Stomp Example](./stomp-example.html): <br> An example showing how to subscribe and unsubscribe to market data using the Stomp protocol. <br>
|
|
48
|
+
- [Reconnect Example](./reconnect-example.html): <br> An example showing how configure and setup automatic reconnection.
|
|
49
|
+
- [Subscription Example](./subscription-example.html): <br> An example showing how to subscribe to the trade data market type.
|
package/package.json
CHANGED
|
@@ -2273,6 +2273,15 @@ var StreamingService = function () {
|
|
|
2273
2273
|
headers['X-Stream-connectionFrom'] = _connectionFrom;
|
|
2274
2274
|
}
|
|
2275
2275
|
|
|
2276
|
+
var _userSymbology = this.config.userSymbology;
|
|
2277
|
+
if (_userSymbology != null && _userSymbology !== '') {
|
|
2278
|
+
headers['X-Stream-User-Symbology'] = _userSymbology;
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
if (this.config.entMax != null && this.config.entMax != '') {
|
|
2282
|
+
headers['X-Stream-EntMax'] = this.config.entMax;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2276
2285
|
Object.assign(headers, this.config.credentials.getHeaders());
|
|
2277
2286
|
|
|
2278
2287
|
var request = {
|
|
@@ -6143,6 +6152,7 @@ fmt.Formatter = function () {
|
|
|
6143
6152
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.MMQUOTE] = this._fmtmmquote;
|
|
6144
6153
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.BOOKORDER] = this._fmtbookorder;
|
|
6145
6154
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.PRICELEVEL] = this._fmtpricelevel;
|
|
6155
|
+
this.formatters[_streamerApi.messages.MessageTypeNames.data.MMPRICELEVEL] = this._fmtmmpricelevel;
|
|
6146
6156
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.PURGEBOOK] = this._fmtpurgebook;
|
|
6147
6157
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.BOOKDELETE] = this._fmtbookdelete;
|
|
6148
6158
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.SYMBOLINFO] = this._fmtsymbolinfo;
|
|
@@ -6569,6 +6579,34 @@ fmt.Formatter.prototype._fmtpricelevel = function (val) {
|
|
|
6569
6579
|
return s.toString();
|
|
6570
6580
|
};
|
|
6571
6581
|
|
|
6582
|
+
fmt.Formatter.prototype._fmtmmpricelevel = function (val) {
|
|
6583
|
+
var s = new fmt.StringBuilder();
|
|
6584
|
+
s.append('MMPL');
|
|
6585
|
+
s.sep();
|
|
6586
|
+
s.datetime(val.timestamp);
|
|
6587
|
+
s.sep();
|
|
6588
|
+
s.append(val.symbol);
|
|
6589
|
+
s.sep();
|
|
6590
|
+
s.append(val.locateCode);
|
|
6591
|
+
s.sep();
|
|
6592
|
+
s.append(val.marketMakerID);
|
|
6593
|
+
s.sep();
|
|
6594
|
+
s.append(val.excode);
|
|
6595
|
+
s.sep();
|
|
6596
|
+
s.append(val.orderSide);
|
|
6597
|
+
s.sep();
|
|
6598
|
+
s.append(val.price);
|
|
6599
|
+
s.sep();
|
|
6600
|
+
s.append(val.size);
|
|
6601
|
+
s.sep();
|
|
6602
|
+
s.append(val.count);
|
|
6603
|
+
s.sep();
|
|
6604
|
+
s.append(val.bookType);
|
|
6605
|
+
s.sep();
|
|
6606
|
+
s.append(val.changeType);
|
|
6607
|
+
return s.toString();
|
|
6608
|
+
};
|
|
6609
|
+
|
|
6572
6610
|
fmt.Formatter.prototype._fmtbookorder = function (val) {
|
|
6573
6611
|
var s = new fmt.StringBuilder();
|
|
6574
6612
|
s.append('BO');
|
|
@@ -13719,8 +13757,6 @@ var StompStream = function () {
|
|
|
13719
13757
|
};
|
|
13720
13758
|
|
|
13721
13759
|
StompStream.prototype.SCFSendMessage = function SCFSendMessage(destination, frame, headers, message, callbackOrNothing) {
|
|
13722
|
-
var jsonMessage = JSON.parse(message);
|
|
13723
|
-
|
|
13724
13760
|
var callback = callbackOrNothing ? callbackOrNothing : optsOrCallback && typeof optsOrCallback === "function" ? optsOrCallback : null;
|
|
13725
13761
|
|
|
13726
13762
|
if (this.isClosed()) {
|
|
@@ -13737,21 +13773,27 @@ var StompStream = function () {
|
|
|
13737
13773
|
|
|
13738
13774
|
var subscription = {
|
|
13739
13775
|
ids: [],
|
|
13740
|
-
dataTypes: jsonMessage["@T"],
|
|
13741
|
-
action: jsonMessage["action"],
|
|
13742
13776
|
callback: callback
|
|
13743
13777
|
};
|
|
13744
13778
|
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13779
|
+
var id = this.requestid.next();
|
|
13780
|
+
|
|
13781
|
+
var jsonMessage = void 0;
|
|
13782
|
+
if (message && message !== "") {
|
|
13783
|
+
try {
|
|
13784
|
+
jsonMessage = JSON.parse(message);
|
|
13785
|
+
} catch (err) {
|
|
13786
|
+
this.log.info("Error parsing message content: " + err.message);
|
|
13787
|
+
callback(null, null);
|
|
13788
|
+
return;
|
|
13789
|
+
}
|
|
13790
|
+
subscription.dataTypes = jsonMessage["@T"];
|
|
13791
|
+
subscription.action = jsonMessage["action"];
|
|
13792
|
+
jsonMessage.id = id;
|
|
13748
13793
|
}
|
|
13749
13794
|
|
|
13750
|
-
var id = this.requestid.next();
|
|
13751
13795
|
subscription.ids.push(id);
|
|
13752
13796
|
this.pendingSCFMessages[id] = subscription;
|
|
13753
|
-
jsonMessage.id = id;
|
|
13754
|
-
|
|
13755
13797
|
this.sendCustomFrame(destination, frame, headers, jsonMessage);
|
|
13756
13798
|
};
|
|
13757
13799
|
|
|
@@ -15320,6 +15362,12 @@ var StompStreamingService = function () {
|
|
|
15320
15362
|
this.addToHeaderParams('wmid', _stompWmid);
|
|
15321
15363
|
}
|
|
15322
15364
|
|
|
15365
|
+
var _userSymbology = this.config.userSymbology;
|
|
15366
|
+
if (_userSymbology != null && _userSymbology !== '') {
|
|
15367
|
+
headers['X-Stream-User-Symbology'] = _userSymbology;
|
|
15368
|
+
this.addToHeaderParams('X-Stream-User-Symbology', _userSymbology);
|
|
15369
|
+
}
|
|
15370
|
+
|
|
15323
15371
|
Object.assign(headers, this.config.credentials.getHeaders());
|
|
15324
15372
|
|
|
15325
15373
|
var url = this.config.url + STREAMURLS.streamStomp + HEADERPARAMS;
|
|
@@ -15438,7 +15486,7 @@ exports.__esModule = true;
|
|
|
15438
15486
|
*/
|
|
15439
15487
|
|
|
15440
15488
|
var LIBRARY_NAME = exports.LIBRARY_NAME = "JavaScript";
|
|
15441
|
-
var VERSION = exports.VERSION = "2.
|
|
15489
|
+
var VERSION = exports.VERSION = "2.53.0";
|
|
15442
15490
|
|
|
15443
15491
|
/**
|
|
15444
15492
|
* Streamer message api namespace.
|
|
@@ -15541,7 +15589,8 @@ messages.MessageTypeNames = {
|
|
|
15541
15589
|
EARNINGS: 'D23',
|
|
15542
15590
|
SPLIT: 'D24',
|
|
15543
15591
|
SYMBOLCHANGED: 'D25',
|
|
15544
|
-
PRICELEVEL: 'D26'
|
|
15592
|
+
PRICELEVEL: 'D26',
|
|
15593
|
+
MMPRICELEVEL: 'D27'
|
|
15545
15594
|
}
|
|
15546
15595
|
};
|
|
15547
15596
|
|
|
@@ -16320,6 +16369,7 @@ messages.control.MarketdataType = {
|
|
|
16320
16369
|
BOOKORDER: "BOOKORDER",
|
|
16321
16370
|
BOOKDELETE: "BOOKDELETE",
|
|
16322
16371
|
PRICELEVEL: "PRICELEVEL",
|
|
16372
|
+
MMPRICELEVEL: "MMPRICELEVEL",
|
|
16323
16373
|
PURGEBOOK: "PURGEBOOK",
|
|
16324
16374
|
LIMITUPLIMITDOWN: "LIMITUPLIMITDOWN",
|
|
16325
16375
|
IVGREEKS: "IVGREEKS",
|
|
@@ -16368,6 +16418,7 @@ messages.market.SubscriptionTypes = {
|
|
|
16368
16418
|
NETHOUSEPOSITION: "NETHOUSEPOSITION",
|
|
16369
16419
|
MMQUOTE: "MMQUOTE",
|
|
16370
16420
|
PRICELEVEL: "PRICELEVEL",
|
|
16421
|
+
MMPRICELEVEL: "MMPRICELEVEL",
|
|
16371
16422
|
BOOKORDER: "BOOKORDER",
|
|
16372
16423
|
PURGEBOOK: "PURGEBOOK",
|
|
16373
16424
|
BOOKDELETE: "BOOKDELETE",
|
|
@@ -16518,6 +16569,17 @@ messages.market.PriceLevel = function () {
|
|
|
16518
16569
|
};
|
|
16519
16570
|
messages.market.PriceLevel.prototype = new messages.market.DataMessage();
|
|
16520
16571
|
|
|
16572
|
+
/**
|
|
16573
|
+
*
|
|
16574
|
+
* @constructor
|
|
16575
|
+
*/
|
|
16576
|
+
messages.market.MMPriceLevel = function () {
|
|
16577
|
+
this.init(messages.MessageTypeNames.data.MMPRICELEVEL);
|
|
16578
|
+
|
|
16579
|
+
// TODO properties
|
|
16580
|
+
};
|
|
16581
|
+
messages.market.MMPriceLevel.prototype = new messages.market.DataMessage();
|
|
16582
|
+
|
|
16521
16583
|
/**
|
|
16522
16584
|
*
|
|
16523
16585
|
* @constructor
|