@quotemedia.com/streamer 2.20.0 → 2.24.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 ADDED
@@ -0,0 +1,134 @@
1
+ # Quotemedia Streaming Data Service JavaScript Client
2
+
3
+ Javascript library responsible to connect to the Quotemedia Streaming Service.
4
+
5
+ ### Requirements
6
+
7
+ ````
8
+ 1. Quotemedia Credentials
9
+ ````
10
+
11
+ ### Usage
12
+ Include the javascript file (qmci-streamer-2.24.0.min.js) in your html page.
13
+
14
+ ````
15
+ <script src="qmci-streamer-2.24.0.min.js"></script>
16
+ ````
17
+
18
+ After this, you should be able to use the Streamer object. It will allow you to authenticate, subscribe and unsubscribe
19
+ symbols. More details in the enduser-example.html, enterprise-token-example.html, wmid-example.html and subscription-example.html.
20
+
21
+ ### Authentication
22
+
23
+ ````
24
+ Streamer.login({
25
+ host: 'https://app.quotemedia.com/auth',
26
+ credentials: {
27
+ wmid: "YourWebmasterID",
28
+ username: "YourUsername",
29
+ password: "YourPassword"
30
+ }
31
+ }
32
+ ````
33
+ When using the login method this will generate a SID which then can be used to open a Streamer connection. You can also authenticate using different methods like:
34
+ - Credentials
35
+ - SID Token
36
+ - Enterprise token
37
+ - Webmaster ID
38
+ - Datatool token
39
+
40
+
41
+
42
+ ### Open
43
+
44
+ Set rejectExcessiveConnection:true to reject new connections when limit is reached. If not specified or value is false,
45
+ first open connection will be closed instead.
46
+
47
+ If needed, there is ability to specify conflation value per connection. When conflation value is null
48
+ or not specified, default conflation is used.
49
+
50
+ Set format value to 'application/qitch' to use this binary protocol.
51
+ Please note that although QITCH protocol uses less bandwidth it can cause significant performance degradation.
52
+ In case if no format was specified JSON will be used by default.
53
+
54
+ if and SID was previously generated using the login() funtion, it will be used to open the connection, otherwise a WMID and/or token will be required for opening (please see the wmid-example.html and the enterprise-token.html)
55
+
56
+ ````
57
+ Streamer.open({
58
+ host: 'https://app.quotemedia.com/cache',
59
+ cors: true,
60
+ rejectExcessiveConnection: false,
61
+ conflation: null,
62
+ format: 'application/json',
63
+ credentials: { sid: sid }
64
+ }, then(function(stream) {
65
+ // After successfully opening the stream,
66
+ // listen for its events.
67
+ ...
68
+ }));
69
+ ````
70
+
71
+ After a connection was open, make sure to add the different event listeners required for the different events that the streamer object may trigger (please see more of this events on any of the examples).
72
+
73
+ ### Subscription
74
+
75
+ The different datatypes that you can subscribe to are:
76
+ - Streamer.dataTypes.QUOTE
77
+ - Streamer.dataTypes.PRICEDATA
78
+ - Streamer.dataTypes.MMQUOTE
79
+ - Streamer.dataTypes.ORDERBOOK
80
+ - Streamer.dataTypes.INTERVAL
81
+ - Streamer.dataTypes.NETHOUSEPOSITION
82
+ - Streamer.dataTypes.LASTSALE
83
+ - Streamer.dataTypes.LIMITUPLIMITDOWN
84
+ - Streamer.dataTypes.BOOKORDER
85
+ - Streamer.dataTypes.BOOKDELETE
86
+ - Streamer.dataTypes.PURGEBOOK
87
+ - Streamer.dataTypes.IVGREEKS
88
+ - Streamer.dataTypes.IMBALANCESTATUS
89
+ - Streamer.dataTypes.TRADE
90
+
91
+ Some of this datatypes required different entitlements so make sure that you do have entitlements for the required datatype.
92
+
93
+ An optional options object can also be passed in. Current available options include:
94
+ - skipHeavyInitialLoad: whether to skip initial heavy loads (e.g., previous trades and intervals), defaults to false.
95
+ - conflation: Override default connection conflation, default to null. A matching conflation must be supplied when unsubscribing.
96
+
97
+ ````
98
+ stream.subscribe(["GOOG"], [Streamer.dataTypes.PRICEDATA], { skipHeavyInitialLoad: false }, then(function(result) {
99
+ ...
100
+ }
101
+ ````
102
+
103
+ The subscription result will include the successful subscriptions as well as the unentitled and rejected subscriptions and invalid symbols.
104
+
105
+ ### Exchange subscription
106
+ ##### NOTE:
107
+ This type of subscription will only work if you are entitled to exchange subscription data.
108
+ Subscription to an exchange to receive stock status messages containing data such as halt, resume, regSHO.
109
+
110
+ ````
111
+ stream.subscribeExchange("NYE", then(function(result) {
112
+ ...
113
+ }
114
+ ````
115
+
116
+ ### Unsubscription
117
+ ````
118
+ stream.unsubscribe(["GOOG"], [Streamer.dataTypes.PRICEDATA], {}, then(function(result) {
119
+ ...
120
+ }
121
+ ````
122
+
123
+ Unsubscribe for symbols and data types. These can be either single strings or arrays of strings. An optional options object can also be passed in. Current available options include:
124
+ - conflation: Override default connection conflation, default to null. Should match a subscribe conflation.
125
+
126
+ ### Retrieve available number of symbols and connections, number of currently open connections and subscribed symbols.
127
+ ````
128
+ stream.getSessionStats();
129
+ ...
130
+ }
131
+ ````
132
+
133
+ ## Quotemedia Contact
134
+ https://www.quotemedia.com/
@@ -1,13 +1,30 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.20.0.min.js"></script>
4
+ <script src="qmci-streamer-2.24.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
8
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
+ */
9
18
  window.onload = function() {
10
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
+ */
11
28
 
12
29
  // Log in to get an SID.
13
30
  // This can be done by directly calling to QuoteMedia's auth service.
@@ -33,7 +50,7 @@
33
50
  // Must be set before calling open(). NOTE: May cause performance degradation.
34
51
  // Streamer.logger = console;
35
52
  Streamer.open({
36
- host: 'http://app.quotemedia.com/cache',
53
+ host: 'https://app.quotemedia.com/cache',
37
54
  cors: true,
38
55
  rejectExcessiveConnection: false,
39
56
  conflation: null,
@@ -117,6 +134,7 @@
117
134
  }, 5000);
118
135
  }));
119
136
 
137
+
120
138
  /**
121
139
  * Subscription to an exchange to receive stock status messages containing data such as halt,
122
140
  * resume, regSHO.
@@ -1,16 +1,33 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.20.0.min.js"></script>
4
+ <script src="qmci-streamer-2.24.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
8
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
+ */
9
18
  window.onload = function() {
10
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
+ */
11
28
 
12
29
  Streamer.open({
13
- host: 'http://app.quotemedia.com/cache',
30
+ host: 'https://app.quotemedia.com/cache',
14
31
  cors: true,
15
32
  rejectExcessiveConnection: false,
16
33
  conflation: null,
@@ -97,6 +114,7 @@
97
114
  }, 5000);
98
115
  }));
99
116
 
117
+
100
118
  /**
101
119
  * Subscription to an exchange to receive stock status messages containing data such as halt,
102
120
  * resume, regSHO.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quotemedia.com/streamer",
3
- "version": "2.20.0",
3
+ "version": "2.24.0",
4
4
  "description": "A JavaScript client for QuoteMedia's streaming data service.",
5
5
  "main": "lib/index.js",
6
6
  "author": "QuoteMedia",