api_connect_nodejs 2.0.13 → 2.0.14

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.
Files changed (46) hide show
  1. package/README.md +30 -30
  2. package/conf/settings.ini +17 -20
  3. package/enums/actionType.js +10 -10
  4. package/enums/assetType.js +25 -25
  5. package/enums/chartExchangeType.js +16 -16
  6. package/enums/chartType.js +13 -13
  7. package/enums/eodIntervalType.js +11 -11
  8. package/enums/exchangeType.js +15 -15
  9. package/enums/intradayIntervalType.js +14 -14
  10. package/enums/marketCapType.js +12 -12
  11. package/enums/orderType.js +21 -21
  12. package/enums/productType.js +24 -24
  13. package/enums/segementsType.js +13 -13
  14. package/enums/segmentType.js +10 -10
  15. package/enums/streamingConstants.js +13 -13
  16. package/enums/termsType.js +12 -12
  17. package/enums/validity.js +22 -22
  18. package/index.js +3 -3
  19. package/package.json +25 -25
  20. package/src/apiConnect.js +2682 -2559
  21. package/src/apiUtils.js +221 -221
  22. package/src/chart.js +404 -404
  23. package/src/config.js +347 -342
  24. package/src/feed/depthFeed.js +136 -136
  25. package/src/feed/feed.js +170 -170
  26. package/src/feed/liveNewsFeed.js +112 -112
  27. package/src/feed/miniQuoteFeed.js +122 -121
  28. package/src/feed/ordersFeed.js +125 -124
  29. package/src/feed/quotesFeed.js +123 -122
  30. package/src/http.js +260 -197
  31. package/src/iniparser.js +45 -45
  32. package/src/liveNews.js +362 -362
  33. package/src/logger.js +16 -16
  34. package/src/order.js +48 -48
  35. package/src/quote.js +75 -75
  36. package/src/report.js +49 -49
  37. package/src/researchCalls.js +175 -175
  38. package/src/watchlist.js +378 -378
  39. package/validations/apiConnectValidator.js +701 -698
  40. package/validations/chartValidator.js +125 -125
  41. package/validations/feedStreamerValidator.js +162 -162
  42. package/validations/liveNewsValidator.js +60 -60
  43. package/validations/quoteValidator.js +19 -19
  44. package/validations/reportValidator.js +35 -35
  45. package/validations/researchCallsValidator.js +86 -86
  46. package/validations/watchlistValidator.js +60 -60
@@ -1,125 +1,125 @@
1
- const Joi = require("Joi");
2
- const JoiDate = require("Joi").extend(require("@joi/date"));
3
- const enumIntradayIntervalType = require("../enums/intradayIntervalType");
4
- const enumEODIntervalType = require("../enums/eodIntervalType");
5
- const enumAssetType = require("../enums/assetType").assetType;
6
- const enumChartExchangeType = require("../enums/chartExchangeType");
7
-
8
- /**
9
- * Conver Enum Object into Array for validation
10
- */
11
- const intradayIntervalTypeArray = Object.values(enumIntradayIntervalType);
12
- const eodIntervalTypeArray = Object.values(enumEODIntervalType);
13
- const assetTypeArray = Object.values(enumAssetType);
14
- const chartExchangeTypeArray = Object.values(enumChartExchangeType);
15
-
16
- /**
17
- * Validate Chart Intraday input params
18
- */
19
- validateChartIntraday = (interval, aType, symbol, exc, tillDate, conti) => {
20
- const paramsObject = {
21
- interval: interval,
22
- aType: aType,
23
- symbol: symbol,
24
- exc: exc,
25
- tillDate: tillDate,
26
- conti: conti,
27
- };
28
- const chartParamsSchema = Joi.object({
29
- interval: Joi.string()
30
- .valid(...intradayIntervalTypeArray)
31
- .required(),
32
- aType: Joi.string()
33
- .valid(...assetTypeArray)
34
- .required(),
35
- symbol: Joi.string().required(),
36
- exc: Joi.string()
37
- .valid(...chartExchangeTypeArray)
38
- .required(),
39
- tillDate: Joi.alternatives().try(
40
- JoiDate.date().format("YYYY-MM-DD").utc(),
41
- Joi.string().valid(null)
42
- ),
43
- conti: Joi.boolean().strict(),
44
- }).options({ abortEarly: false });
45
-
46
- return chartParamsSchema.validate(paramsObject);
47
- };
48
-
49
- /**
50
- * Validate Chart EOD input params
51
- */
52
- validateChartEOD = (interval, aType, symbol, exc, tillDate, conti) => {
53
- const paramsObject = {
54
- interval: interval,
55
- aType: aType,
56
- symbol: symbol,
57
- exc: exc,
58
- tillDate: tillDate,
59
- conti: conti,
60
- };
61
- const chartSchema = Joi.object({
62
- interval: Joi.string()
63
- .valid(...eodIntervalTypeArray)
64
- .required(),
65
- aType: Joi.string()
66
- .valid(...assetTypeArray)
67
- .required(),
68
- symbol: Joi.string().required(),
69
- exc: Joi.string()
70
- .valid(...chartExchangeTypeArray)
71
- .required(),
72
- tillDate: Joi.alternatives().try(
73
- JoiDate.date().format("YYYY-MM-DD").utc(),
74
- Joi.string().valid(null)
75
- ),
76
- conti: Joi.boolean().strict(),
77
- }).options({ abortEarly: false });
78
-
79
- return chartSchema.validate(paramsObject);
80
- };
81
-
82
- /**
83
- * Validate Chart CustomPeriod input params
84
- */
85
- validateChartCustomPeriod = (interval, aType, symbol, exc, fromDate, toDate, conti) => {
86
- const paramsObject = {
87
- interval: interval,
88
- aType: aType,
89
- symbol: symbol,
90
- exc: exc,
91
- fromDate: fromDate,
92
- toDate: toDate,
93
- conti: conti,
94
- };
95
-
96
- const chartSchema = Joi.object({
97
- interval: Joi.string()
98
- .valid(...eodIntervalTypeArray)
99
- .required(),
100
- aType: Joi.string()
101
- .valid(...assetTypeArray)
102
- .required(),
103
- symbol: Joi.string().required(),
104
- exc: Joi.string()
105
- .valid(...chartExchangeTypeArray)
106
- .required(),
107
- fromDate: Joi.alternatives().try(
108
- JoiDate.date().format("YYYY-MM-DD").utc(),
109
- Joi.string().required()
110
- ),
111
- toDate: Joi.alternatives().try(
112
- JoiDate.date().format("YYYY-MM-DD").utc(),
113
- Joi.string().required()
114
- ),
115
- conti: Joi.boolean().strict(),
116
- }).options({ abortEarly: false });
117
-
118
- return chartSchema.validate(paramsObject);
119
- };
120
-
121
- module.exports = {
122
- validateChartIntraday,
123
- validateChartEOD,
124
- validateChartCustomPeriod,
125
- };
1
+ const Joi = require("Joi");
2
+ const JoiDate = require("Joi").extend(require("@joi/date"));
3
+ const enumIntradayIntervalType = require("../enums/intradayIntervalType");
4
+ const enumEODIntervalType = require("../enums/eodIntervalType");
5
+ const enumAssetType = require("../enums/assetType").assetType;
6
+ const enumChartExchangeType = require("../enums/chartExchangeType");
7
+
8
+ /**
9
+ * Conver Enum Object into Array for validation
10
+ */
11
+ const intradayIntervalTypeArray = Object.values(enumIntradayIntervalType);
12
+ const eodIntervalTypeArray = Object.values(enumEODIntervalType);
13
+ const assetTypeArray = Object.values(enumAssetType);
14
+ const chartExchangeTypeArray = Object.values(enumChartExchangeType);
15
+
16
+ /**
17
+ * Validate Chart Intraday input params
18
+ */
19
+ validateChartIntraday = (interval, aType, symbol, exc, tillDate, conti) => {
20
+ const paramsObject = {
21
+ interval: interval,
22
+ aType: aType,
23
+ symbol: symbol,
24
+ exc: exc,
25
+ tillDate: tillDate,
26
+ conti: conti,
27
+ };
28
+ const chartParamsSchema = Joi.object({
29
+ interval: Joi.string()
30
+ .valid(...intradayIntervalTypeArray)
31
+ .required(),
32
+ aType: Joi.string()
33
+ .valid(...assetTypeArray)
34
+ .required(),
35
+ symbol: Joi.string().required(),
36
+ exc: Joi.string()
37
+ .valid(...chartExchangeTypeArray)
38
+ .required(),
39
+ tillDate: Joi.alternatives().try(
40
+ JoiDate.date().format("YYYY-MM-DD").utc(),
41
+ Joi.string().valid(null)
42
+ ),
43
+ conti: Joi.boolean().strict(),
44
+ }).options({ abortEarly: false });
45
+
46
+ return chartParamsSchema.validate(paramsObject);
47
+ };
48
+
49
+ /**
50
+ * Validate Chart EOD input params
51
+ */
52
+ validateChartEOD = (interval, aType, symbol, exc, tillDate, conti) => {
53
+ const paramsObject = {
54
+ interval: interval,
55
+ aType: aType,
56
+ symbol: symbol,
57
+ exc: exc,
58
+ tillDate: tillDate,
59
+ conti: conti,
60
+ };
61
+ const chartSchema = Joi.object({
62
+ interval: Joi.string()
63
+ .valid(...eodIntervalTypeArray)
64
+ .required(),
65
+ aType: Joi.string()
66
+ .valid(...assetTypeArray)
67
+ .required(),
68
+ symbol: Joi.string().required(),
69
+ exc: Joi.string()
70
+ .valid(...chartExchangeTypeArray)
71
+ .required(),
72
+ tillDate: Joi.alternatives().try(
73
+ JoiDate.date().format("YYYY-MM-DD").utc(),
74
+ Joi.string().valid(null)
75
+ ),
76
+ conti: Joi.boolean().strict(),
77
+ }).options({ abortEarly: false });
78
+
79
+ return chartSchema.validate(paramsObject);
80
+ };
81
+
82
+ /**
83
+ * Validate Chart CustomPeriod input params
84
+ */
85
+ validateChartCustomPeriod = (interval, aType, symbol, exc, fromDate, toDate, conti) => {
86
+ const paramsObject = {
87
+ interval: interval,
88
+ aType: aType,
89
+ symbol: symbol,
90
+ exc: exc,
91
+ fromDate: fromDate,
92
+ toDate: toDate,
93
+ conti: conti,
94
+ };
95
+
96
+ const chartSchema = Joi.object({
97
+ interval: Joi.string()
98
+ .valid(...eodIntervalTypeArray)
99
+ .required(),
100
+ aType: Joi.string()
101
+ .valid(...assetTypeArray)
102
+ .required(),
103
+ symbol: Joi.string().required(),
104
+ exc: Joi.string()
105
+ .valid(...chartExchangeTypeArray)
106
+ .required(),
107
+ fromDate: Joi.alternatives().try(
108
+ JoiDate.date().format("YYYY-MM-DD").utc(),
109
+ Joi.string().required()
110
+ ),
111
+ toDate: Joi.alternatives().try(
112
+ JoiDate.date().format("YYYY-MM-DD").utc(),
113
+ Joi.string().required()
114
+ ),
115
+ conti: Joi.boolean().strict(),
116
+ }).options({ abortEarly: false });
117
+
118
+ return chartSchema.validate(paramsObject);
119
+ };
120
+
121
+ module.exports = {
122
+ validateChartIntraday,
123
+ validateChartEOD,
124
+ validateChartCustomPeriod,
125
+ };
@@ -1,162 +1,162 @@
1
- const Joi = require("joi");
2
-
3
- /**
4
- * Validator For Subsribe LiveNews Feed
5
- */
6
- validateStreamerCallback = (callback) => {
7
- let subcribeLiveNewsObj = {
8
- callback: callback,
9
- };
10
-
11
- const subcribeLiveNewsSchema = Joi.object({
12
- callback: Joi.function().required(),
13
- }).options({ abortEarly: false });
14
-
15
- return subcribeLiveNewsSchema.validate(subcribeLiveNewsObj);
16
- };
17
-
18
- /**
19
- * Validator For Subsribe Quote Feed
20
- */
21
- validateSubscribeQuotesFeed = (callback, symbols) => {
22
- let subcribeFeedQuoteObj = {
23
- callback: callback,
24
- symbols: symbols,
25
- };
26
-
27
- const subcribeFeedQuoteSchema = Joi.object({
28
- callback: Joi.function().required(),
29
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
30
- }).options({ abortEarly: false });
31
-
32
- return subcribeFeedQuoteSchema.validate(subcribeFeedQuoteObj);
33
- };
34
-
35
- /**
36
- * Validator For Unsubsribe Quote Feed
37
- */
38
- validateUnsubscribeQuotesFeed = (symbols) => {
39
- let unsubcribeFeedQuoteObj = {
40
- symbols: symbols,
41
- };
42
-
43
- const UnsubcribeFeedQuoteSchema = Joi.object({
44
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
45
- }).options({ abortEarly: false });
46
-
47
- return UnsubcribeFeedQuoteSchema.validate(unsubcribeFeedQuoteObj);
48
- };
49
-
50
- /**
51
- * Validator For Subsribe Reduced Quote Feed
52
- */
53
- validateSubscribeReducedQuotesFeed = (callback, symbols) => {
54
- let subcribeFeedReducedQuoteObj = {
55
- callback: callback,
56
- symbols: symbols,
57
- };
58
-
59
- const subcribeFeedReducedQuoteSchema = Joi.object({
60
- callback: Joi.function().required(),
61
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
62
- }).options({ abortEarly: false });
63
-
64
- return subcribeFeedReducedQuoteSchema.validate(subcribeFeedReducedQuoteObj);
65
- };
66
-
67
- /**
68
- * Validator For Unsubsribe Reduced Quote Feed
69
- */
70
- validateUnsubscribeReducedQuotesFeed = (symbols) => {
71
- let unsubcribeFeedReducedQuoteObj = {
72
- symbols: symbols,
73
- };
74
-
75
- const UnsubcribeFeedReducedQuoteSchema = Joi.object({
76
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
77
- }).options({ abortEarly: false });
78
-
79
- return UnsubcribeFeedReducedQuoteSchema.validate(unsubcribeFeedReducedQuoteObj);
80
- };
81
-
82
- validateSubscribeOrdersFeed = (accId, userId, callback) => {
83
- let subcribeOrdersFeedObj = {
84
- accId: accId,
85
- userId: userId,
86
- callback: callback,
87
- };
88
-
89
- const subcribeOrdersFeedSchema = Joi.object({
90
- accId: Joi.string().required(),
91
- userId: Joi.string().required(),
92
- callback: Joi.function().required(),
93
- }).options({ abortEarly: false });
94
-
95
- return subcribeOrdersFeedSchema.validate(subcribeOrdersFeedObj);
96
- };
97
-
98
- /**
99
- * Validator For Subsribe MiniQuote Feed
100
- */
101
- validateSubscribeMiniQuoteFeed = (callback, symbols) => {
102
- let subcribeFeedMiniQuoteObj = {
103
- callback: callback,
104
- symbols: symbols,
105
- };
106
-
107
- const subcribeFeedMiniQuoteSchema = Joi.object({
108
- callback: Joi.function().required(),
109
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
110
- }).options({ abortEarly: false });
111
-
112
- return subcribeFeedMiniQuoteSchema.validate(subcribeFeedMiniQuoteObj);
113
- };
114
-
115
- /**
116
- * Validator For Unsubsribe MiniQuote Feed
117
- */
118
- validateUnsubscribeMiniQuoteFeed = (symbols) => {
119
- let unsubcribeFeedMiniQuoteObj = {
120
- symbols: symbols,
121
- };
122
-
123
- const UnsubcribeFeedMiniQuoteSchema = Joi.object({
124
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
125
- }).options({ abortEarly: false });
126
-
127
- return UnsubcribeFeedMiniQuoteSchema.validate(unsubcribeFeedMiniQuoteObj);
128
- };
129
-
130
- /**
131
- * Validator For Subsribe Market Depth Feed
132
- */
133
- validateSubscribeDepthFeed = (callback, symbols) => {
134
- let subcribeFeedDepthObj = {
135
- callback: callback,
136
- symbols: symbols,
137
- };
138
-
139
- const subcribeFeedDepthSchema = Joi.object({
140
- callback: Joi.function().required(),
141
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
142
- }).options({ abortEarly: false });
143
-
144
- return subcribeFeedDepthSchema.validate(subcribeFeedDepthObj);
145
- };
146
-
147
- /**
148
- * Validator For Unsubsribe Depth Feed
149
- */
150
- validateUnsubscribeDepthFeed = (symbols) => {
151
- let unsubcribeFeedDepthObj = {
152
- symbols: symbols,
153
- };
154
-
155
- const UnsubcribeFeedDepthSchema = Joi.object({
156
- symbols: Joi.array().items(Joi.string().min(1).required()).required(),
157
- }).options({ abortEarly: false });
158
-
159
- return UnsubcribeFeedDepthSchema.validate(unsubcribeFeedDepthObj);
160
- };
161
-
162
- module.exports = { validateStreamerCallback, validateSubscribeQuotesFeed, validateUnsubscribeQuotesFeed, validateSubscribeReducedQuotesFeed, validateUnsubscribeReducedQuotesFeed, validateSubscribeOrdersFeed, validateSubscribeMiniQuoteFeed, validateUnsubscribeMiniQuoteFeed, validateSubscribeDepthFeed, validateUnsubscribeDepthFeed};
1
+ const Joi = require("joi");
2
+
3
+ /**
4
+ * Validator For Subsribe LiveNews Feed
5
+ */
6
+ validateStreamerCallback = (callback) => {
7
+ let subcribeLiveNewsObj = {
8
+ callback: callback,
9
+ };
10
+
11
+ const subcribeLiveNewsSchema = Joi.object({
12
+ callback: Joi.function().required(),
13
+ }).options({ abortEarly: false });
14
+
15
+ return subcribeLiveNewsSchema.validate(subcribeLiveNewsObj);
16
+ };
17
+
18
+ /**
19
+ * Validator For Subsribe Quote Feed
20
+ */
21
+ validateSubscribeQuotesFeed = (callback, symbols) => {
22
+ let subcribeFeedQuoteObj = {
23
+ callback: callback,
24
+ symbols: symbols,
25
+ };
26
+
27
+ const subcribeFeedQuoteSchema = Joi.object({
28
+ callback: Joi.function().required(),
29
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
30
+ }).options({ abortEarly: false });
31
+
32
+ return subcribeFeedQuoteSchema.validate(subcribeFeedQuoteObj);
33
+ };
34
+
35
+ /**
36
+ * Validator For Unsubsribe Quote Feed
37
+ */
38
+ validateUnsubscribeQuotesFeed = (symbols) => {
39
+ let unsubcribeFeedQuoteObj = {
40
+ symbols: symbols,
41
+ };
42
+
43
+ const UnsubcribeFeedQuoteSchema = Joi.object({
44
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
45
+ }).options({ abortEarly: false });
46
+
47
+ return UnsubcribeFeedQuoteSchema.validate(unsubcribeFeedQuoteObj);
48
+ };
49
+
50
+ /**
51
+ * Validator For Subsribe Reduced Quote Feed
52
+ */
53
+ validateSubscribeReducedQuotesFeed = (callback, symbols) => {
54
+ let subcribeFeedReducedQuoteObj = {
55
+ callback: callback,
56
+ symbols: symbols,
57
+ };
58
+
59
+ const subcribeFeedReducedQuoteSchema = Joi.object({
60
+ callback: Joi.function().required(),
61
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
62
+ }).options({ abortEarly: false });
63
+
64
+ return subcribeFeedReducedQuoteSchema.validate(subcribeFeedReducedQuoteObj);
65
+ };
66
+
67
+ /**
68
+ * Validator For Unsubsribe Reduced Quote Feed
69
+ */
70
+ validateUnsubscribeReducedQuotesFeed = (symbols) => {
71
+ let unsubcribeFeedReducedQuoteObj = {
72
+ symbols: symbols,
73
+ };
74
+
75
+ const UnsubcribeFeedReducedQuoteSchema = Joi.object({
76
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
77
+ }).options({ abortEarly: false });
78
+
79
+ return UnsubcribeFeedReducedQuoteSchema.validate(unsubcribeFeedReducedQuoteObj);
80
+ };
81
+
82
+ validateSubscribeOrdersFeed = (accId, userId, callback) => {
83
+ let subcribeOrdersFeedObj = {
84
+ accId: accId,
85
+ userId: userId,
86
+ callback: callback,
87
+ };
88
+
89
+ const subcribeOrdersFeedSchema = Joi.object({
90
+ accId: Joi.string().required(),
91
+ userId: Joi.string().required(),
92
+ callback: Joi.function().required(),
93
+ }).options({ abortEarly: false });
94
+
95
+ return subcribeOrdersFeedSchema.validate(subcribeOrdersFeedObj);
96
+ };
97
+
98
+ /**
99
+ * Validator For Subsribe MiniQuote Feed
100
+ */
101
+ validateSubscribeMiniQuoteFeed = (callback, symbols) => {
102
+ let subcribeFeedMiniQuoteObj = {
103
+ callback: callback,
104
+ symbols: symbols,
105
+ };
106
+
107
+ const subcribeFeedMiniQuoteSchema = Joi.object({
108
+ callback: Joi.function().required(),
109
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
110
+ }).options({ abortEarly: false });
111
+
112
+ return subcribeFeedMiniQuoteSchema.validate(subcribeFeedMiniQuoteObj);
113
+ };
114
+
115
+ /**
116
+ * Validator For Unsubsribe MiniQuote Feed
117
+ */
118
+ validateUnsubscribeMiniQuoteFeed = (symbols) => {
119
+ let unsubcribeFeedMiniQuoteObj = {
120
+ symbols: symbols,
121
+ };
122
+
123
+ const UnsubcribeFeedMiniQuoteSchema = Joi.object({
124
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
125
+ }).options({ abortEarly: false });
126
+
127
+ return UnsubcribeFeedMiniQuoteSchema.validate(unsubcribeFeedMiniQuoteObj);
128
+ };
129
+
130
+ /**
131
+ * Validator For Subsribe Market Depth Feed
132
+ */
133
+ validateSubscribeDepthFeed = (callback, symbols) => {
134
+ let subcribeFeedDepthObj = {
135
+ callback: callback,
136
+ symbols: symbols,
137
+ };
138
+
139
+ const subcribeFeedDepthSchema = Joi.object({
140
+ callback: Joi.function().required(),
141
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
142
+ }).options({ abortEarly: false });
143
+
144
+ return subcribeFeedDepthSchema.validate(subcribeFeedDepthObj);
145
+ };
146
+
147
+ /**
148
+ * Validator For Unsubsribe Depth Feed
149
+ */
150
+ validateUnsubscribeDepthFeed = (symbols) => {
151
+ let unsubcribeFeedDepthObj = {
152
+ symbols: symbols,
153
+ };
154
+
155
+ const UnsubcribeFeedDepthSchema = Joi.object({
156
+ symbols: Joi.array().items(Joi.string().min(1).required()).required(),
157
+ }).options({ abortEarly: false });
158
+
159
+ return UnsubcribeFeedDepthSchema.validate(unsubcribeFeedDepthObj);
160
+ };
161
+
162
+ module.exports = { validateStreamerCallback, validateSubscribeQuotesFeed, validateUnsubscribeQuotesFeed, validateSubscribeReducedQuotesFeed, validateUnsubscribeReducedQuotesFeed, validateSubscribeOrdersFeed, validateSubscribeMiniQuoteFeed, validateUnsubscribeMiniQuoteFeed, validateSubscribeDepthFeed, validateUnsubscribeDepthFeed};