api_connect_nodejs 2.0.1 → 2.0.2
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 +30 -30
- package/conf/settings.ini +19 -19
- package/enums/actionType.js +10 -10
- package/enums/assetType.js +25 -25
- package/enums/chartExchangeType.js +15 -15
- package/enums/chartType.js +13 -13
- package/enums/eodIntervalType.js +11 -11
- package/enums/exchangeType.js +14 -14
- package/enums/intradayIntervalType.js +14 -14
- package/enums/marketCapType.js +12 -12
- package/enums/orderType.js +21 -21
- package/enums/productType.js +24 -24
- package/enums/segementsType.js +13 -13
- package/enums/streamingConstants.js +11 -11
- package/enums/termsType.js +12 -12
- package/enums/validity.js +22 -22
- package/index.js +3 -3
- package/package.json +25 -25
- package/src/apiConnect.js +2430 -2424
- package/src/apiUtils.js +129 -129
- package/src/chart.js +258 -258
- package/src/config.js +326 -326
- package/src/feed/feed.js +139 -139
- package/src/feed/liveNewsFeed.js +112 -112
- package/src/feed/ordersFeed.js +124 -124
- package/src/feed/quotesFeed.js +121 -121
- package/src/http.js +197 -197
- package/src/iniparser.js +42 -42
- package/src/liveNews.js +362 -362
- package/src/logger.js +16 -16
- package/src/order.js +48 -48
- package/src/researchCalls.js +175 -175
- package/src/watchlist.js +378 -378
- package/validations/apiConnectValidator.js +508 -508
- package/validations/chartValidator.js +85 -85
- package/validations/feedStreamerValidator.js +68 -68
- package/validations/liveNewsValidator.js +60 -60
- package/validations/researchCallsValidator.js +86 -86
- package/validations/watchlistValidator.js +60 -60
package/src/feed/ordersFeed.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
const log4js = require("../logger");
|
|
2
|
-
const configData = require("../iniparser");
|
|
3
|
-
const { ORDER_STREAM_REQ_CODE } = require("../../enums/streamingConstants");
|
|
4
|
-
const {
|
|
5
|
-
validateSubscribeOrdersFeed,
|
|
6
|
-
} = require("../../validations/feedStreamerValidator");
|
|
7
|
-
class OrdersFeed {
|
|
8
|
-
/**
|
|
9
|
-
* Streamer
|
|
10
|
-
* OrderFeed Class for subsribe or unsubsribe order
|
|
11
|
-
* @param {string} accid Customer Account ID
|
|
12
|
-
* @param {string} userid User ID
|
|
13
|
-
*/
|
|
14
|
-
constructor(feed, accountId, userId) {
|
|
15
|
-
this.feed = feed;
|
|
16
|
-
this.accountId = accountId;
|
|
17
|
-
this.userId = userId;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Orders Feed RequestBody Structure
|
|
22
|
-
* Return OrderFeed RequestBody Structure
|
|
23
|
-
* @function ordersFeedRequestBody
|
|
24
|
-
* @returns object
|
|
25
|
-
*/
|
|
26
|
-
ordersFeedRequestBody = () => {
|
|
27
|
-
return {
|
|
28
|
-
request: {
|
|
29
|
-
streaming_type: "orderFiler",
|
|
30
|
-
data: {
|
|
31
|
-
accType: "EQ",
|
|
32
|
-
userID: this.userId,
|
|
33
|
-
accID: this.accountId,
|
|
34
|
-
responseType: ["ORDER_UPDATE", "TRADE_UPDATE"],
|
|
35
|
-
},
|
|
36
|
-
formFactor: configData.formFactor,
|
|
37
|
-
appID: configData.ApiIdKey,
|
|
38
|
-
response_format: "json",
|
|
39
|
-
request_type: "",
|
|
40
|
-
},
|
|
41
|
-
echo: {},
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Create OrdersFeed Request Body
|
|
47
|
-
* @param {boolean} subscribe - true for subsribe and false for unsubsribe
|
|
48
|
-
* @returns object
|
|
49
|
-
*/
|
|
50
|
-
createOrderRequest = (subscribe = false) => {
|
|
51
|
-
let body = {};
|
|
52
|
-
try {
|
|
53
|
-
body = this.ordersFeedRequestBody();
|
|
54
|
-
if (subscribe) {
|
|
55
|
-
body.request.request_type = "subscribe";
|
|
56
|
-
} else {
|
|
57
|
-
body.request.request_type = "unsubscribe";
|
|
58
|
-
}
|
|
59
|
-
} catch (error) {
|
|
60
|
-
log4js.debug("createOrderRequest error - " + error);
|
|
61
|
-
} finally {
|
|
62
|
-
return body;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Subsribe Order Feed
|
|
68
|
-
* To subscribe to the streamer, Create the single instance of this mentioning `callback` method. After successsful subscription, `callback` method will be called whenever packet is available at the streamer.
|
|
69
|
-
* @async
|
|
70
|
-
* @function subscribeOrdersFeed
|
|
71
|
-
* @param {(err?, data?, close?: number) => void} callBack Callback to receive the Feed in
|
|
72
|
-
* @returns
|
|
73
|
-
*/
|
|
74
|
-
subscribeOrdersFeed = async (callback) => {
|
|
75
|
-
try {
|
|
76
|
-
/** Validation Start */
|
|
77
|
-
const validateResponse = validateSubscribeOrdersFeed(
|
|
78
|
-
this.accountId,
|
|
79
|
-
this.userId,
|
|
80
|
-
callback
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
if (validateResponse.error) {
|
|
84
|
-
log4js.debug(
|
|
85
|
-
"SubscribeOrdersFeed validation error - " +
|
|
86
|
-
validateResponse.error.details
|
|
87
|
-
);
|
|
88
|
-
return Promise.reject(validateResponse.error.details);
|
|
89
|
-
}
|
|
90
|
-
/** Validation End */
|
|
91
|
-
|
|
92
|
-
/** Get Order Request */
|
|
93
|
-
let orderRequest = this.createOrderRequest(true);
|
|
94
|
-
|
|
95
|
-
/** Call connect method of Feed Class */
|
|
96
|
-
this.feed.subsribe(ORDER_STREAM_REQ_CODE, orderRequest, callback);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
log4js.debug("SubscribeOrdersFeed error - " + error);
|
|
99
|
-
console.log(error);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Unsubsribe Order Feed
|
|
105
|
-
* This method will unsubscribe the streamer. After successful invokation of this, will stop the streamer.
|
|
106
|
-
* @async
|
|
107
|
-
* @function unsubscribeOrdersFeed
|
|
108
|
-
* @returns
|
|
109
|
-
*/
|
|
110
|
-
unsubscribeOrdersFeed = async () => {
|
|
111
|
-
try {
|
|
112
|
-
/** Get Order Request */
|
|
113
|
-
const orderRequest = this.createOrderRequest();
|
|
114
|
-
|
|
115
|
-
/** Unsubsribe OrderFeed */
|
|
116
|
-
this.feed.unsubsribe(ORDER_STREAM_REQ_CODE, orderRequest);
|
|
117
|
-
} catch (error) {
|
|
118
|
-
log4js.debug("unsubscribeOrdersFeed error - " + error);
|
|
119
|
-
console.log(error);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
module.exports = OrdersFeed;
|
|
1
|
+
const log4js = require("../logger");
|
|
2
|
+
const configData = require("../iniparser");
|
|
3
|
+
const { ORDER_STREAM_REQ_CODE } = require("../../enums/streamingConstants");
|
|
4
|
+
const {
|
|
5
|
+
validateSubscribeOrdersFeed,
|
|
6
|
+
} = require("../../validations/feedStreamerValidator");
|
|
7
|
+
class OrdersFeed {
|
|
8
|
+
/**
|
|
9
|
+
* Streamer
|
|
10
|
+
* OrderFeed Class for subsribe or unsubsribe order
|
|
11
|
+
* @param {string} accid Customer Account ID
|
|
12
|
+
* @param {string} userid User ID
|
|
13
|
+
*/
|
|
14
|
+
constructor(feed, accountId, userId) {
|
|
15
|
+
this.feed = feed;
|
|
16
|
+
this.accountId = accountId;
|
|
17
|
+
this.userId = userId;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Orders Feed RequestBody Structure
|
|
22
|
+
* Return OrderFeed RequestBody Structure
|
|
23
|
+
* @function ordersFeedRequestBody
|
|
24
|
+
* @returns object
|
|
25
|
+
*/
|
|
26
|
+
ordersFeedRequestBody = () => {
|
|
27
|
+
return {
|
|
28
|
+
request: {
|
|
29
|
+
streaming_type: "orderFiler",
|
|
30
|
+
data: {
|
|
31
|
+
accType: "EQ",
|
|
32
|
+
userID: this.userId,
|
|
33
|
+
accID: this.accountId,
|
|
34
|
+
responseType: ["ORDER_UPDATE", "TRADE_UPDATE"],
|
|
35
|
+
},
|
|
36
|
+
formFactor: configData.formFactor,
|
|
37
|
+
appID: configData.ApiIdKey,
|
|
38
|
+
response_format: "json",
|
|
39
|
+
request_type: "",
|
|
40
|
+
},
|
|
41
|
+
echo: {},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Create OrdersFeed Request Body
|
|
47
|
+
* @param {boolean} subscribe - true for subsribe and false for unsubsribe
|
|
48
|
+
* @returns object
|
|
49
|
+
*/
|
|
50
|
+
createOrderRequest = (subscribe = false) => {
|
|
51
|
+
let body = {};
|
|
52
|
+
try {
|
|
53
|
+
body = this.ordersFeedRequestBody();
|
|
54
|
+
if (subscribe) {
|
|
55
|
+
body.request.request_type = "subscribe";
|
|
56
|
+
} else {
|
|
57
|
+
body.request.request_type = "unsubscribe";
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
log4js.debug("createOrderRequest error - " + error);
|
|
61
|
+
} finally {
|
|
62
|
+
return body;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Subsribe Order Feed
|
|
68
|
+
* To subscribe to the streamer, Create the single instance of this mentioning `callback` method. After successsful subscription, `callback` method will be called whenever packet is available at the streamer.
|
|
69
|
+
* @async
|
|
70
|
+
* @function subscribeOrdersFeed
|
|
71
|
+
* @param {(err?, data?, close?: number) => void} callBack Callback to receive the Feed in
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
subscribeOrdersFeed = async (callback) => {
|
|
75
|
+
try {
|
|
76
|
+
/** Validation Start */
|
|
77
|
+
const validateResponse = validateSubscribeOrdersFeed(
|
|
78
|
+
this.accountId,
|
|
79
|
+
this.userId,
|
|
80
|
+
callback
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (validateResponse.error) {
|
|
84
|
+
log4js.debug(
|
|
85
|
+
"SubscribeOrdersFeed validation error - " +
|
|
86
|
+
validateResponse.error.details
|
|
87
|
+
);
|
|
88
|
+
return Promise.reject(validateResponse.error.details);
|
|
89
|
+
}
|
|
90
|
+
/** Validation End */
|
|
91
|
+
|
|
92
|
+
/** Get Order Request */
|
|
93
|
+
let orderRequest = this.createOrderRequest(true);
|
|
94
|
+
|
|
95
|
+
/** Call connect method of Feed Class */
|
|
96
|
+
this.feed.subsribe(ORDER_STREAM_REQ_CODE, orderRequest, callback);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
log4js.debug("SubscribeOrdersFeed error - " + error);
|
|
99
|
+
console.log(error);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Unsubsribe Order Feed
|
|
105
|
+
* This method will unsubscribe the streamer. After successful invokation of this, will stop the streamer.
|
|
106
|
+
* @async
|
|
107
|
+
* @function unsubscribeOrdersFeed
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
unsubscribeOrdersFeed = async () => {
|
|
111
|
+
try {
|
|
112
|
+
/** Get Order Request */
|
|
113
|
+
const orderRequest = this.createOrderRequest();
|
|
114
|
+
|
|
115
|
+
/** Unsubsribe OrderFeed */
|
|
116
|
+
this.feed.unsubsribe(ORDER_STREAM_REQ_CODE, orderRequest);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
log4js.debug("unsubscribeOrdersFeed error - " + error);
|
|
119
|
+
console.log(error);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
module.exports = OrdersFeed;
|
package/src/feed/quotesFeed.js
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
const log4js = require("../logger");
|
|
2
|
-
const configData = require("../iniparser");
|
|
3
|
-
const { QUOTE_SREAM_REQ_CODE } = require("../../enums/streamingConstants");
|
|
4
|
-
const {
|
|
5
|
-
validateSubscribeQuotesFeed,
|
|
6
|
-
validateUnsubscribeQuotesFeed,
|
|
7
|
-
} = require("../../validations/feedStreamerValidator");
|
|
8
|
-
|
|
9
|
-
class QuotesFeed {
|
|
10
|
-
/**
|
|
11
|
-
* Streamer
|
|
12
|
-
* QuotesFeed Class for subsribe or unsubsribe Quotes
|
|
13
|
-
*/
|
|
14
|
-
constructor(feed) {
|
|
15
|
-
this.feed = feed;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* QutoesFeed RequestBody Structure
|
|
20
|
-
* Return QuotesFeed RequestBody Structure
|
|
21
|
-
* @function quotesFeedRequestBody
|
|
22
|
-
* @returns object
|
|
23
|
-
*/
|
|
24
|
-
requestBody = () => {
|
|
25
|
-
return {
|
|
26
|
-
request: {
|
|
27
|
-
streaming_type: "quote3",
|
|
28
|
-
data: {
|
|
29
|
-
"accType": "EQ",
|
|
30
|
-
symbols: [],
|
|
31
|
-
},
|
|
32
|
-
formFactor: configData.formFactor,
|
|
33
|
-
appID: configData.ApiIdKey,
|
|
34
|
-
response_format: "json",
|
|
35
|
-
request_type: "",
|
|
36
|
-
},
|
|
37
|
-
echo: {},
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Create QuotesFeed RequestBody
|
|
43
|
-
* Return QuotesFeed RequestBody
|
|
44
|
-
* @function createQuotesFeedRequest
|
|
45
|
-
* @param {Object[]} symbols - Array of subsribe Symbols
|
|
46
|
-
* @param {boolean} order - true for subsribe and false for unsubsribe
|
|
47
|
-
* @returns object
|
|
48
|
-
*/
|
|
49
|
-
createQuotesFeedRequest = (symbols, quote = false) => {
|
|
50
|
-
let body = {};
|
|
51
|
-
try {
|
|
52
|
-
body = this.requestBody();
|
|
53
|
-
const symset = symbols.map((sym) => ({ symbol: sym.trim() }));
|
|
54
|
-
|
|
55
|
-
body.request.data.symbols = symset;
|
|
56
|
-
|
|
57
|
-
if (quote) {
|
|
58
|
-
body.request.request_type = "subscribe";
|
|
59
|
-
} else {
|
|
60
|
-
body.request.request_type = "unsubscribe";
|
|
61
|
-
}
|
|
62
|
-
} catch (error) {
|
|
63
|
-
log4js.debug("createQuotesFeedRequest error - " + error);
|
|
64
|
-
} finally {
|
|
65
|
-
return body;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* To subscribe to the streamer, Create the single instance of this mentioning `callback` method. After successsful subscription, `callback` method will be called whenever packet is available at the streamer.
|
|
71
|
-
* @async
|
|
72
|
-
* @function subscribeQuotesFeed
|
|
73
|
-
* @param {(err?, data?, close?: number) => void} callBack Callback to receive the Feed in
|
|
74
|
-
* @param {Array<string>} symbols Symbol list for subscription: Symbol_exchange to be obtained from Contract File
|
|
75
|
-
* @returns
|
|
76
|
-
*/
|
|
77
|
-
subscribeQuotesFeed = async (symbols, callback) => {
|
|
78
|
-
try {
|
|
79
|
-
/** Validation Start */
|
|
80
|
-
const validateResponse = validateSubscribeQuotesFeed(callback, symbols);
|
|
81
|
-
|
|
82
|
-
if (validateResponse.error) {
|
|
83
|
-
log4js.debug(
|
|
84
|
-
"subscribeQuotesFeed validation error - " +
|
|
85
|
-
validateResponse.error.details
|
|
86
|
-
);
|
|
87
|
-
return Promise.reject(validateResponse.error.details);
|
|
88
|
-
}
|
|
89
|
-
/** Validation End */
|
|
90
|
-
|
|
91
|
-
/** Create Streaming Quote Request */
|
|
92
|
-
let quoteRequest = this.createQuotesFeedRequest(symbols, true);
|
|
93
|
-
/** Call connect method of Feed Class */
|
|
94
|
-
this.feed.subsribe(QUOTE_SREAM_REQ_CODE, quoteRequest, callback);
|
|
95
|
-
} catch (error) {
|
|
96
|
-
log4js.debug("subscribeQuotesFeed error - " + error);
|
|
97
|
-
console.log(error);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* This method will unsubscribe the symbols from the streamer. After successful invokation of this, will stop the streamer packets of these symbols.
|
|
103
|
-
* @async
|
|
104
|
-
* @function unsubscribeQuotesFeed
|
|
105
|
-
* @returns
|
|
106
|
-
*/
|
|
107
|
-
unsubscribeQuotesFeed = async () => {
|
|
108
|
-
try {
|
|
109
|
-
/** Get Streaming Quote Request */
|
|
110
|
-
const quoteRequest = this.createQuotesFeedRequest([]);
|
|
111
|
-
|
|
112
|
-
/** Unsubsribe symbols */
|
|
113
|
-
this.feed.unsubsribe(QUOTE_SREAM_REQ_CODE, quoteRequest);
|
|
114
|
-
} catch (error) {
|
|
115
|
-
log4js.debug("unsubscribeQuotesFeed error - " + error);
|
|
116
|
-
console.log(error);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
module.exports = QuotesFeed;
|
|
1
|
+
const log4js = require("../logger");
|
|
2
|
+
const configData = require("../iniparser");
|
|
3
|
+
const { QUOTE_SREAM_REQ_CODE } = require("../../enums/streamingConstants");
|
|
4
|
+
const {
|
|
5
|
+
validateSubscribeQuotesFeed,
|
|
6
|
+
validateUnsubscribeQuotesFeed,
|
|
7
|
+
} = require("../../validations/feedStreamerValidator");
|
|
8
|
+
|
|
9
|
+
class QuotesFeed {
|
|
10
|
+
/**
|
|
11
|
+
* Streamer
|
|
12
|
+
* QuotesFeed Class for subsribe or unsubsribe Quotes
|
|
13
|
+
*/
|
|
14
|
+
constructor(feed) {
|
|
15
|
+
this.feed = feed;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* QutoesFeed RequestBody Structure
|
|
20
|
+
* Return QuotesFeed RequestBody Structure
|
|
21
|
+
* @function quotesFeedRequestBody
|
|
22
|
+
* @returns object
|
|
23
|
+
*/
|
|
24
|
+
requestBody = () => {
|
|
25
|
+
return {
|
|
26
|
+
request: {
|
|
27
|
+
streaming_type: "quote3",
|
|
28
|
+
data: {
|
|
29
|
+
"accType": "EQ",
|
|
30
|
+
symbols: [],
|
|
31
|
+
},
|
|
32
|
+
formFactor: configData.formFactor,
|
|
33
|
+
appID: configData.ApiIdKey,
|
|
34
|
+
response_format: "json",
|
|
35
|
+
request_type: "",
|
|
36
|
+
},
|
|
37
|
+
echo: {},
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Create QuotesFeed RequestBody
|
|
43
|
+
* Return QuotesFeed RequestBody
|
|
44
|
+
* @function createQuotesFeedRequest
|
|
45
|
+
* @param {Object[]} symbols - Array of subsribe Symbols
|
|
46
|
+
* @param {boolean} order - true for subsribe and false for unsubsribe
|
|
47
|
+
* @returns object
|
|
48
|
+
*/
|
|
49
|
+
createQuotesFeedRequest = (symbols, quote = false) => {
|
|
50
|
+
let body = {};
|
|
51
|
+
try {
|
|
52
|
+
body = this.requestBody();
|
|
53
|
+
const symset = symbols.map((sym) => ({ symbol: sym.trim() }));
|
|
54
|
+
|
|
55
|
+
body.request.data.symbols = symset;
|
|
56
|
+
|
|
57
|
+
if (quote) {
|
|
58
|
+
body.request.request_type = "subscribe";
|
|
59
|
+
} else {
|
|
60
|
+
body.request.request_type = "unsubscribe";
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
log4js.debug("createQuotesFeedRequest error - " + error);
|
|
64
|
+
} finally {
|
|
65
|
+
return body;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* To subscribe to the streamer, Create the single instance of this mentioning `callback` method. After successsful subscription, `callback` method will be called whenever packet is available at the streamer.
|
|
71
|
+
* @async
|
|
72
|
+
* @function subscribeQuotesFeed
|
|
73
|
+
* @param {(err?, data?, close?: number) => void} callBack Callback to receive the Feed in
|
|
74
|
+
* @param {Array<string>} symbols Symbol list for subscription: Symbol_exchange to be obtained from Contract File
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
subscribeQuotesFeed = async (symbols, callback) => {
|
|
78
|
+
try {
|
|
79
|
+
/** Validation Start */
|
|
80
|
+
const validateResponse = validateSubscribeQuotesFeed(callback, symbols);
|
|
81
|
+
|
|
82
|
+
if (validateResponse.error) {
|
|
83
|
+
log4js.debug(
|
|
84
|
+
"subscribeQuotesFeed validation error - " +
|
|
85
|
+
validateResponse.error.details
|
|
86
|
+
);
|
|
87
|
+
return Promise.reject(validateResponse.error.details);
|
|
88
|
+
}
|
|
89
|
+
/** Validation End */
|
|
90
|
+
|
|
91
|
+
/** Create Streaming Quote Request */
|
|
92
|
+
let quoteRequest = this.createQuotesFeedRequest(symbols, true);
|
|
93
|
+
/** Call connect method of Feed Class */
|
|
94
|
+
this.feed.subsribe(QUOTE_SREAM_REQ_CODE, quoteRequest, callback);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
log4js.debug("subscribeQuotesFeed error - " + error);
|
|
97
|
+
console.log(error);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* This method will unsubscribe the symbols from the streamer. After successful invokation of this, will stop the streamer packets of these symbols.
|
|
103
|
+
* @async
|
|
104
|
+
* @function unsubscribeQuotesFeed
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
unsubscribeQuotesFeed = async () => {
|
|
108
|
+
try {
|
|
109
|
+
/** Get Streaming Quote Request */
|
|
110
|
+
const quoteRequest = this.createQuotesFeedRequest([]);
|
|
111
|
+
|
|
112
|
+
/** Unsubsribe symbols */
|
|
113
|
+
this.feed.unsubsribe(QUOTE_SREAM_REQ_CODE, quoteRequest);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
log4js.debug("unsubscribeQuotesFeed error - " + error);
|
|
116
|
+
console.log(error);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
module.exports = QuotesFeed;
|