api_connect_nodejs 2.0.2 → 2.0.5

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 (43) hide show
  1. package/README.md +30 -30
  2. package/conf/settings.ini +19 -19
  3. package/enums/actionType.js +10 -10
  4. package/enums/assetType.js +25 -25
  5. package/enums/chartExchangeType.js +15 -15
  6. package/enums/chartType.js +13 -13
  7. package/enums/eodIntervalType.js +11 -11
  8. package/enums/exchangeType.js +14 -14
  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/streamingConstants.js +14 -11
  15. package/enums/termsType.js +12 -12
  16. package/enums/validity.js +22 -22
  17. package/index.js +3 -3
  18. package/package.json +25 -25
  19. package/src/apiConnect.js +2397 -2430
  20. package/src/apiUtils.js +221 -129
  21. package/src/chart.js +258 -258
  22. package/src/config.js +321 -326
  23. package/src/feed/depthFeed.js +137 -0
  24. package/src/feed/feed.js +162 -139
  25. package/src/feed/liveNewsFeed.js +112 -112
  26. package/src/feed/miniQuoteFeed.js +121 -0
  27. package/src/feed/ordersFeed.js +124 -124
  28. package/src/feed/quotesFeed.js +226 -121
  29. package/src/http.js +197 -197
  30. package/src/iniparser.js +42 -42
  31. package/src/liveNews.js +362 -362
  32. package/src/logger.js +16 -16
  33. package/src/order.js +48 -48
  34. package/src/quote.js +75 -0
  35. package/src/researchCalls.js +175 -175
  36. package/src/watchlist.js +378 -378
  37. package/validations/apiConnectValidator.js +521 -508
  38. package/validations/chartValidator.js +85 -85
  39. package/validations/feedStreamerValidator.js +162 -68
  40. package/validations/liveNewsValidator.js +60 -60
  41. package/validations/quoteValidator.js +19 -0
  42. package/validations/researchCallsValidator.js +86 -86
  43. package/validations/watchlistValidator.js +60 -60
@@ -1,85 +1,85 @@
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
- module.exports = {
83
- validateChartIntraday,
84
- validateChartEOD,
85
- };
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
+ module.exports = {
83
+ validateChartIntraday,
84
+ validateChartEOD,
85
+ };
@@ -1,68 +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
- validateSubscribeOrdersFeed = (accId, userId, callback) => {
51
- let subcribeOrdersFeedObj = {
52
- accId: accId,
53
- userId: userId,
54
- callback: callback,
55
- };
56
-
57
- const subcribeOrdersFeedSchema = Joi.object({
58
- accId: Joi.string().required(),
59
- userId: Joi.string().required(),
60
- callback: Joi.function().required(),
61
- }).options({ abortEarly: false });
62
-
63
- return subcribeOrdersFeedSchema.validate(subcribeOrdersFeedObj);
64
- };
65
-
66
-
67
-
68
- module.exports = { validateStreamerCallback, validateSubscribeQuotesFeed, validateUnsubscribeQuotesFeed, validateSubscribeOrdersFeed};
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,60 +1,60 @@
1
- const Joi = require("Joi");
2
- const JoiDate = Joi.extend(require("@joi/date"));
3
-
4
- validateLiveNewsParams = (
5
- category,
6
- holdings,
7
- searchText,
8
- pageNumber,
9
- newsCategories
10
- ) => {
11
- const paramsObj = {
12
- category: category,
13
- holdings: holdings,
14
- searchText: searchText,
15
- pageNumber: pageNumber,
16
- };
17
-
18
- const liveNewsBodySchema = Joi.object({
19
- category: Joi.any()
20
- .valid(...newsCategories)
21
- .when("holdings", {
22
- is: false,
23
- then: Joi.required(),
24
- otherwise: Joi.valid(null, ""),
25
- }),
26
- searchText: Joi.string().allow(null, ""),
27
- pageNumber: Joi.number().positive().allow(0),
28
- holdings: Joi.boolean().required(),
29
- }).options({ abortEarly: false });
30
- return liveNewsBodySchema.validate(paramsObj);
31
- };
32
-
33
- validateNewsForResultsAndStocksParams = (holdings, searchText, pageNumber) => {
34
- const paramsObj = {
35
- holdings: holdings,
36
- searchText: searchText,
37
- pageNumber: pageNumber,
38
- };
39
-
40
- const liveNewsBodySchema = Joi.object({
41
- searchText: Joi.string().allow(null, ""),
42
- pageNumber: Joi.number().positive().allow(0),
43
- holdings: Joi.boolean().required(),
44
- }).options({ abortEarly: false });
45
- return liveNewsBodySchema.validate(paramsObj);
46
- };
47
-
48
- validateLatestCorporateActions = (symbol) => {
49
- const LatestCorporateActionsSchema = Joi.object({
50
- symbol: Joi.string().required(),
51
- }).options({ abortEarly: false });
52
-
53
- return LatestCorporateActionsSchema.validate({ symbol: symbol });
54
- };
55
-
56
- module.exports = {
57
- validateLiveNewsParams,
58
- validateLatestCorporateActions,
59
- validateNewsForResultsAndStocksParams,
60
- };
1
+ const Joi = require("Joi");
2
+ const JoiDate = Joi.extend(require("@joi/date"));
3
+
4
+ validateLiveNewsParams = (
5
+ category,
6
+ holdings,
7
+ searchText,
8
+ pageNumber,
9
+ newsCategories
10
+ ) => {
11
+ const paramsObj = {
12
+ category: category,
13
+ holdings: holdings,
14
+ searchText: searchText,
15
+ pageNumber: pageNumber,
16
+ };
17
+
18
+ const liveNewsBodySchema = Joi.object({
19
+ category: Joi.any()
20
+ .valid(...newsCategories)
21
+ .when("holdings", {
22
+ is: false,
23
+ then: Joi.required(),
24
+ otherwise: Joi.valid(null, ""),
25
+ }),
26
+ searchText: Joi.string().allow(null, ""),
27
+ pageNumber: Joi.number().positive().allow(0),
28
+ holdings: Joi.boolean().required(),
29
+ }).options({ abortEarly: false });
30
+ return liveNewsBodySchema.validate(paramsObj);
31
+ };
32
+
33
+ validateNewsForResultsAndStocksParams = (holdings, searchText, pageNumber) => {
34
+ const paramsObj = {
35
+ holdings: holdings,
36
+ searchText: searchText,
37
+ pageNumber: pageNumber,
38
+ };
39
+
40
+ const liveNewsBodySchema = Joi.object({
41
+ searchText: Joi.string().allow(null, ""),
42
+ pageNumber: Joi.number().positive().allow(0),
43
+ holdings: Joi.boolean().required(),
44
+ }).options({ abortEarly: false });
45
+ return liveNewsBodySchema.validate(paramsObj);
46
+ };
47
+
48
+ validateLatestCorporateActions = (symbol) => {
49
+ const LatestCorporateActionsSchema = Joi.object({
50
+ symbol: Joi.string().required(),
51
+ }).options({ abortEarly: false });
52
+
53
+ return LatestCorporateActionsSchema.validate({ symbol: symbol });
54
+ };
55
+
56
+ module.exports = {
57
+ validateLiveNewsParams,
58
+ validateLatestCorporateActions,
59
+ validateNewsForResultsAndStocksParams,
60
+ };
@@ -0,0 +1,19 @@
1
+ const Joi = require("Joi");
2
+
3
+ /**
4
+ * Validate Market Depth input params
5
+ */
6
+ validateMarketDepth = (symbol) => {
7
+ const paramsObject = {
8
+ symbol: symbol,
9
+ };
10
+ const depthParamsSchema = Joi.object({
11
+ symbol: Joi.string().required(),
12
+ }).options({ abortEarly: false });
13
+
14
+ return depthParamsSchema.validate(paramsObject);
15
+ };
16
+
17
+ module.exports = {
18
+ validateMarketDepth
19
+ };