@quotemedia.com/streamer 2.51.0 → 2.52.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.52.0.js} +70 -12
- package/{qmci-streamer-2.51.0.min.js → qmci-streamer-2.52.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,11 @@ 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
|
+
|
|
2276
2281
|
Object.assign(headers, this.config.credentials.getHeaders());
|
|
2277
2282
|
|
|
2278
2283
|
var request = {
|
|
@@ -6143,6 +6148,7 @@ fmt.Formatter = function () {
|
|
|
6143
6148
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.MMQUOTE] = this._fmtmmquote;
|
|
6144
6149
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.BOOKORDER] = this._fmtbookorder;
|
|
6145
6150
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.PRICELEVEL] = this._fmtpricelevel;
|
|
6151
|
+
this.formatters[_streamerApi.messages.MessageTypeNames.data.MMPRICELEVEL] = this._fmtmmpricelevel;
|
|
6146
6152
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.PURGEBOOK] = this._fmtpurgebook;
|
|
6147
6153
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.BOOKDELETE] = this._fmtbookdelete;
|
|
6148
6154
|
this.formatters[_streamerApi.messages.MessageTypeNames.data.SYMBOLINFO] = this._fmtsymbolinfo;
|
|
@@ -6569,6 +6575,34 @@ fmt.Formatter.prototype._fmtpricelevel = function (val) {
|
|
|
6569
6575
|
return s.toString();
|
|
6570
6576
|
};
|
|
6571
6577
|
|
|
6578
|
+
fmt.Formatter.prototype._fmtmmpricelevel = function (val) {
|
|
6579
|
+
var s = new fmt.StringBuilder();
|
|
6580
|
+
s.append('MMPL');
|
|
6581
|
+
s.sep();
|
|
6582
|
+
s.datetime(val.timestamp);
|
|
6583
|
+
s.sep();
|
|
6584
|
+
s.append(val.symbol);
|
|
6585
|
+
s.sep();
|
|
6586
|
+
s.append(val.locateCode);
|
|
6587
|
+
s.sep();
|
|
6588
|
+
s.append(val.marketMakerID);
|
|
6589
|
+
s.sep();
|
|
6590
|
+
s.append(val.excode);
|
|
6591
|
+
s.sep();
|
|
6592
|
+
s.append(val.orderSide);
|
|
6593
|
+
s.sep();
|
|
6594
|
+
s.append(val.price);
|
|
6595
|
+
s.sep();
|
|
6596
|
+
s.append(val.size);
|
|
6597
|
+
s.sep();
|
|
6598
|
+
s.append(val.count);
|
|
6599
|
+
s.sep();
|
|
6600
|
+
s.append(val.bookType);
|
|
6601
|
+
s.sep();
|
|
6602
|
+
s.append(val.changeType);
|
|
6603
|
+
return s.toString();
|
|
6604
|
+
};
|
|
6605
|
+
|
|
6572
6606
|
fmt.Formatter.prototype._fmtbookorder = function (val) {
|
|
6573
6607
|
var s = new fmt.StringBuilder();
|
|
6574
6608
|
s.append('BO');
|
|
@@ -13719,8 +13753,6 @@ var StompStream = function () {
|
|
|
13719
13753
|
};
|
|
13720
13754
|
|
|
13721
13755
|
StompStream.prototype.SCFSendMessage = function SCFSendMessage(destination, frame, headers, message, callbackOrNothing) {
|
|
13722
|
-
var jsonMessage = JSON.parse(message);
|
|
13723
|
-
|
|
13724
13756
|
var callback = callbackOrNothing ? callbackOrNothing : optsOrCallback && typeof optsOrCallback === "function" ? optsOrCallback : null;
|
|
13725
13757
|
|
|
13726
13758
|
if (this.isClosed()) {
|
|
@@ -13737,21 +13769,27 @@ var StompStream = function () {
|
|
|
13737
13769
|
|
|
13738
13770
|
var subscription = {
|
|
13739
13771
|
ids: [],
|
|
13740
|
-
dataTypes: jsonMessage["@T"],
|
|
13741
|
-
action: jsonMessage["action"],
|
|
13742
13772
|
callback: callback
|
|
13743
13773
|
};
|
|
13744
13774
|
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13775
|
+
var id = this.requestid.next();
|
|
13776
|
+
|
|
13777
|
+
var jsonMessage = void 0;
|
|
13778
|
+
if (message && message !== "") {
|
|
13779
|
+
try {
|
|
13780
|
+
jsonMessage = JSON.parse(message);
|
|
13781
|
+
} catch (err) {
|
|
13782
|
+
this.log.info("Error parsing message content: " + err.message);
|
|
13783
|
+
callback(null, null);
|
|
13784
|
+
return;
|
|
13785
|
+
}
|
|
13786
|
+
subscription.dataTypes = jsonMessage["@T"];
|
|
13787
|
+
subscription.action = jsonMessage["action"];
|
|
13788
|
+
jsonMessage.id = id;
|
|
13748
13789
|
}
|
|
13749
13790
|
|
|
13750
|
-
var id = this.requestid.next();
|
|
13751
13791
|
subscription.ids.push(id);
|
|
13752
13792
|
this.pendingSCFMessages[id] = subscription;
|
|
13753
|
-
jsonMessage.id = id;
|
|
13754
|
-
|
|
13755
13793
|
this.sendCustomFrame(destination, frame, headers, jsonMessage);
|
|
13756
13794
|
};
|
|
13757
13795
|
|
|
@@ -15320,6 +15358,12 @@ var StompStreamingService = function () {
|
|
|
15320
15358
|
this.addToHeaderParams('wmid', _stompWmid);
|
|
15321
15359
|
}
|
|
15322
15360
|
|
|
15361
|
+
var _userSymbology = this.config.userSymbology;
|
|
15362
|
+
if (_userSymbology != null && _userSymbology !== '') {
|
|
15363
|
+
headers['X-Stream-User-Symbology'] = _userSymbology;
|
|
15364
|
+
this.addToHeaderParams('X-Stream-User-Symbology', _userSymbology);
|
|
15365
|
+
}
|
|
15366
|
+
|
|
15323
15367
|
Object.assign(headers, this.config.credentials.getHeaders());
|
|
15324
15368
|
|
|
15325
15369
|
var url = this.config.url + STREAMURLS.streamStomp + HEADERPARAMS;
|
|
@@ -15438,7 +15482,7 @@ exports.__esModule = true;
|
|
|
15438
15482
|
*/
|
|
15439
15483
|
|
|
15440
15484
|
var LIBRARY_NAME = exports.LIBRARY_NAME = "JavaScript";
|
|
15441
|
-
var VERSION = exports.VERSION = "2.
|
|
15485
|
+
var VERSION = exports.VERSION = "2.52.0";
|
|
15442
15486
|
|
|
15443
15487
|
/**
|
|
15444
15488
|
* Streamer message api namespace.
|
|
@@ -15541,7 +15585,8 @@ messages.MessageTypeNames = {
|
|
|
15541
15585
|
EARNINGS: 'D23',
|
|
15542
15586
|
SPLIT: 'D24',
|
|
15543
15587
|
SYMBOLCHANGED: 'D25',
|
|
15544
|
-
PRICELEVEL: 'D26'
|
|
15588
|
+
PRICELEVEL: 'D26',
|
|
15589
|
+
MMPRICELEVEL: 'D27'
|
|
15545
15590
|
}
|
|
15546
15591
|
};
|
|
15547
15592
|
|
|
@@ -16320,6 +16365,7 @@ messages.control.MarketdataType = {
|
|
|
16320
16365
|
BOOKORDER: "BOOKORDER",
|
|
16321
16366
|
BOOKDELETE: "BOOKDELETE",
|
|
16322
16367
|
PRICELEVEL: "PRICELEVEL",
|
|
16368
|
+
MMPRICELEVEL: "MMPRICELEVEL",
|
|
16323
16369
|
PURGEBOOK: "PURGEBOOK",
|
|
16324
16370
|
LIMITUPLIMITDOWN: "LIMITUPLIMITDOWN",
|
|
16325
16371
|
IVGREEKS: "IVGREEKS",
|
|
@@ -16368,6 +16414,7 @@ messages.market.SubscriptionTypes = {
|
|
|
16368
16414
|
NETHOUSEPOSITION: "NETHOUSEPOSITION",
|
|
16369
16415
|
MMQUOTE: "MMQUOTE",
|
|
16370
16416
|
PRICELEVEL: "PRICELEVEL",
|
|
16417
|
+
MMPRICELEVEL: "MMPRICELEVEL",
|
|
16371
16418
|
BOOKORDER: "BOOKORDER",
|
|
16372
16419
|
PURGEBOOK: "PURGEBOOK",
|
|
16373
16420
|
BOOKDELETE: "BOOKDELETE",
|
|
@@ -16518,6 +16565,17 @@ messages.market.PriceLevel = function () {
|
|
|
16518
16565
|
};
|
|
16519
16566
|
messages.market.PriceLevel.prototype = new messages.market.DataMessage();
|
|
16520
16567
|
|
|
16568
|
+
/**
|
|
16569
|
+
*
|
|
16570
|
+
* @constructor
|
|
16571
|
+
*/
|
|
16572
|
+
messages.market.MMPriceLevel = function () {
|
|
16573
|
+
this.init(messages.MessageTypeNames.data.MMPRICELEVEL);
|
|
16574
|
+
|
|
16575
|
+
// TODO properties
|
|
16576
|
+
};
|
|
16577
|
+
messages.market.MMPriceLevel.prototype = new messages.market.DataMessage();
|
|
16578
|
+
|
|
16521
16579
|
/**
|
|
16522
16580
|
*
|
|
16523
16581
|
* @constructor
|