api_connect_nodejs 2.0.12 → 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 -154
  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,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
+ };
@@ -1,19 +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
- };
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
+ };
@@ -1,35 +1,35 @@
1
- const Joi = require("Joi");
2
-
3
- const enumSegmentType = require("../enums/segmentType");
4
- const JoiDate = require("Joi").extend(require("@joi/date"));
5
- const segmentTypeArray = Object.values(enumSegmentType);
6
-
7
- /**
8
- * Validate Transaction History input params
9
- */
10
- validateTransactionHistory = (segment,fromDate,toDate) => {
11
- const paramsObject = {
12
- segment,
13
- fromDate,
14
- toDate
15
- };
16
- const transactionHistoryParamsSchema = Joi.object({
17
- segment: Joi.string()
18
- .valid(...segmentTypeArray)
19
- .required(),
20
- fromDate: Joi.alternatives().try(
21
- JoiDate.date().format("YYYY-MM-DD").utc(),
22
- Joi.string().required()
23
- ),
24
- toDate: Joi.alternatives().try(
25
- JoiDate.date().format("YYYY-MM-DD").utc(),
26
- Joi.string().required()
27
- ),
28
- }).options({ abortEarly: false });
29
-
30
- return transactionHistoryParamsSchema.validate(paramsObject);
31
- };
32
-
33
- module.exports = {
34
- validateTransactionHistory
35
- };
1
+ const Joi = require("Joi");
2
+
3
+ const enumSegmentType = require("../enums/segmentType");
4
+ const JoiDate = require("Joi").extend(require("@joi/date"));
5
+ const segmentTypeArray = Object.values(enumSegmentType);
6
+
7
+ /**
8
+ * Validate Transaction History input params
9
+ */
10
+ validateTransactionHistory = (segment,fromDate,toDate) => {
11
+ const paramsObject = {
12
+ segment,
13
+ fromDate,
14
+ toDate
15
+ };
16
+ const transactionHistoryParamsSchema = Joi.object({
17
+ segment: Joi.string()
18
+ .valid(...segmentTypeArray)
19
+ .required(),
20
+ fromDate: Joi.alternatives().try(
21
+ JoiDate.date().format("YYYY-MM-DD").utc(),
22
+ Joi.string().required()
23
+ ),
24
+ toDate: Joi.alternatives().try(
25
+ JoiDate.date().format("YYYY-MM-DD").utc(),
26
+ Joi.string().required()
27
+ ),
28
+ }).options({ abortEarly: false });
29
+
30
+ return transactionHistoryParamsSchema.validate(paramsObject);
31
+ };
32
+
33
+ module.exports = {
34
+ validateTransactionHistory
35
+ };
@@ -1,86 +1,86 @@
1
- const Joi = require("joi");
2
- const JoiDate = Joi.extend(require("@joi/date"));
3
- const segments = require("../enums/segementsType");
4
- const terms = require("../enums/termsType");
5
- const marketCap = require("../enums/marketCapType");
6
- const action = require("../enums/actionType");
7
-
8
- /**
9
- * Conver Enum Object into Array for validation
10
- */
11
- const segmentsArr = Object.values(segments);
12
- const termsArr = Object.values(terms);
13
- const marketCapArr = Object.values(marketCap);
14
- const actionArr = Object.values(action);
15
-
16
- validateActiveResearchCalls = (segment, term, marketCap) => {
17
- const activeResearchCallsObj = {
18
- segment: segment,
19
- term: term,
20
- marketCap,
21
- };
22
-
23
- const activeResearchCallsSchema = Joi.object({
24
- segment: Joi.string()
25
- .valid(...segmentsArr)
26
- .required(),
27
- term: Joi.string()
28
- .valid(...termsArr)
29
- .required(),
30
- marketCap: Joi.string().when("segment", {
31
- is: "EQ",
32
- then: Joi.valid(...marketCapArr).required(),
33
- otherwise: Joi.valid(null).messages({
34
- "any.only": `"marketCap" is only applicable for EQ segment type so it's value must be null`,
35
- }),
36
- }),
37
- }).options({ abortEarly: false });
38
-
39
- return activeResearchCallsSchema.validate(activeResearchCallsObj);
40
- };
41
-
42
- validateClosedResearchCalls = (
43
- segment,
44
- term,
45
- action,
46
- fromDate,
47
- toDate,
48
- recommendationType,
49
- marketCap
50
- ) => {
51
- const closedResearchCallsObj = {
52
- fromDate: fromDate,
53
- toDate: toDate,
54
- recommendationType: recommendationType,
55
- action: action,
56
- segment: segment,
57
- term: term,
58
- marketCap: marketCap,
59
- };
60
-
61
- const closedResearchCallsSchema = Joi.object({
62
- fromDate: JoiDate.date().format("YYYY-MM-DD").allow(""),
63
- toDate: JoiDate.date().format("YYYY-MM-DD").allow(""),
64
- action: Joi.string()
65
- .valid(...actionArr)
66
- .allow(""),
67
- recommendationType: Joi.string().allow(""),
68
- segment: Joi.string()
69
- .valid(...segmentsArr)
70
- .required(),
71
- term: Joi.string()
72
- .valid(...termsArr)
73
- .required(),
74
- marketCap: Joi.string().when("segment", {
75
- is: "EQ",
76
- then: Joi.valid(...marketCapArr).required(),
77
- otherwise: Joi.valid(null).messages({
78
- "any.only": `"marketCap" is only applicable for EQ segment type so it's value must be null`,
79
- }),
80
- }),
81
- }).options({ abortEarly: false });
82
-
83
- return closedResearchCallsSchema.validate(closedResearchCallsObj);
84
- };
85
-
86
- module.exports = { validateActiveResearchCalls, validateClosedResearchCalls };
1
+ const Joi = require("joi");
2
+ const JoiDate = Joi.extend(require("@joi/date"));
3
+ const segments = require("../enums/segementsType");
4
+ const terms = require("../enums/termsType");
5
+ const marketCap = require("../enums/marketCapType");
6
+ const action = require("../enums/actionType");
7
+
8
+ /**
9
+ * Conver Enum Object into Array for validation
10
+ */
11
+ const segmentsArr = Object.values(segments);
12
+ const termsArr = Object.values(terms);
13
+ const marketCapArr = Object.values(marketCap);
14
+ const actionArr = Object.values(action);
15
+
16
+ validateActiveResearchCalls = (segment, term, marketCap) => {
17
+ const activeResearchCallsObj = {
18
+ segment: segment,
19
+ term: term,
20
+ marketCap,
21
+ };
22
+
23
+ const activeResearchCallsSchema = Joi.object({
24
+ segment: Joi.string()
25
+ .valid(...segmentsArr)
26
+ .required(),
27
+ term: Joi.string()
28
+ .valid(...termsArr)
29
+ .required(),
30
+ marketCap: Joi.string().when("segment", {
31
+ is: "EQ",
32
+ then: Joi.valid(...marketCapArr).required(),
33
+ otherwise: Joi.valid(null).messages({
34
+ "any.only": `"marketCap" is only applicable for EQ segment type so it's value must be null`,
35
+ }),
36
+ }),
37
+ }).options({ abortEarly: false });
38
+
39
+ return activeResearchCallsSchema.validate(activeResearchCallsObj);
40
+ };
41
+
42
+ validateClosedResearchCalls = (
43
+ segment,
44
+ term,
45
+ action,
46
+ fromDate,
47
+ toDate,
48
+ recommendationType,
49
+ marketCap
50
+ ) => {
51
+ const closedResearchCallsObj = {
52
+ fromDate: fromDate,
53
+ toDate: toDate,
54
+ recommendationType: recommendationType,
55
+ action: action,
56
+ segment: segment,
57
+ term: term,
58
+ marketCap: marketCap,
59
+ };
60
+
61
+ const closedResearchCallsSchema = Joi.object({
62
+ fromDate: JoiDate.date().format("YYYY-MM-DD").allow(""),
63
+ toDate: JoiDate.date().format("YYYY-MM-DD").allow(""),
64
+ action: Joi.string()
65
+ .valid(...actionArr)
66
+ .allow(""),
67
+ recommendationType: Joi.string().allow(""),
68
+ segment: Joi.string()
69
+ .valid(...segmentsArr)
70
+ .required(),
71
+ term: Joi.string()
72
+ .valid(...termsArr)
73
+ .required(),
74
+ marketCap: Joi.string().when("segment", {
75
+ is: "EQ",
76
+ then: Joi.valid(...marketCapArr).required(),
77
+ otherwise: Joi.valid(null).messages({
78
+ "any.only": `"marketCap" is only applicable for EQ segment type so it's value must be null`,
79
+ }),
80
+ }),
81
+ }).options({ abortEarly: false });
82
+
83
+ return closedResearchCallsSchema.validate(closedResearchCallsObj);
84
+ };
85
+
86
+ module.exports = { validateActiveResearchCalls, validateClosedResearchCalls };
@@ -1,60 +1,60 @@
1
- const Joi = require("joi");
2
-
3
- validateGetWatchlistScrips = (groupName) => {
4
- const watchlistScriptsObj = {
5
- groupName: groupName,
6
- };
7
-
8
- const watchlistScriptsSchema = Joi.object({
9
- groupName: Joi.string().required(),
10
- }).options({ abortEarly: false });
11
-
12
- return watchlistScriptsSchema.validate(watchlistScriptsObj);
13
- };
14
-
15
- validateGroupNameAndSymbolList = (groupName, symbolList) => {
16
- const createWatchlistObj = {
17
- groupName: groupName,
18
- symbolList: symbolList,
19
- };
20
-
21
- const createWatchlistSchema = Joi.object({
22
- groupName: Joi.string().required(),
23
- symbolList: Joi.array().items(Joi.string().required()).min(1).required(),
24
- }).options({ abortEarly: false });
25
-
26
- return createWatchlistSchema.validate(createWatchlistObj);
27
- };
28
-
29
- validateDeleteWatchlistGroups = (groups) => {
30
- const paramsObj = {
31
- groups: groups,
32
- };
33
-
34
- const deleteGroupsSchema = Joi.object({
35
- groups: Joi.array().items(Joi.string().required()).min(1).required(),
36
- }).options({ abortEarly: false });
37
-
38
- return deleteGroupsSchema.validate(paramsObj);
39
- };
40
-
41
- validateRenameGroup = (groupName, newGroupName) => {
42
- const renameWatchlistObj = {
43
- groupName: groupName,
44
- newGroupName: newGroupName,
45
- };
46
-
47
- const renameWatchlistSchema = Joi.object({
48
- groupName: Joi.string().required(),
49
- newGroupName: Joi.string().required(),
50
- }).options({ abortEarly: false });
51
-
52
- return renameWatchlistSchema.validate(renameWatchlistObj);
53
- };
54
-
55
- module.exports = {
56
- validateGetWatchlistScrips,
57
- validateGroupNameAndSymbolList,
58
- validateDeleteWatchlistGroups,
59
- validateRenameGroup,
60
- };
1
+ const Joi = require("joi");
2
+
3
+ validateGetWatchlistScrips = (groupName) => {
4
+ const watchlistScriptsObj = {
5
+ groupName: groupName,
6
+ };
7
+
8
+ const watchlistScriptsSchema = Joi.object({
9
+ groupName: Joi.string().required(),
10
+ }).options({ abortEarly: false });
11
+
12
+ return watchlistScriptsSchema.validate(watchlistScriptsObj);
13
+ };
14
+
15
+ validateGroupNameAndSymbolList = (groupName, symbolList) => {
16
+ const createWatchlistObj = {
17
+ groupName: groupName,
18
+ symbolList: symbolList,
19
+ };
20
+
21
+ const createWatchlistSchema = Joi.object({
22
+ groupName: Joi.string().required(),
23
+ symbolList: Joi.array().items(Joi.string().required()).min(1).required(),
24
+ }).options({ abortEarly: false });
25
+
26
+ return createWatchlistSchema.validate(createWatchlistObj);
27
+ };
28
+
29
+ validateDeleteWatchlistGroups = (groups) => {
30
+ const paramsObj = {
31
+ groups: groups,
32
+ };
33
+
34
+ const deleteGroupsSchema = Joi.object({
35
+ groups: Joi.array().items(Joi.string().required()).min(1).required(),
36
+ }).options({ abortEarly: false });
37
+
38
+ return deleteGroupsSchema.validate(paramsObj);
39
+ };
40
+
41
+ validateRenameGroup = (groupName, newGroupName) => {
42
+ const renameWatchlistObj = {
43
+ groupName: groupName,
44
+ newGroupName: newGroupName,
45
+ };
46
+
47
+ const renameWatchlistSchema = Joi.object({
48
+ groupName: Joi.string().required(),
49
+ newGroupName: Joi.string().required(),
50
+ }).options({ abortEarly: false });
51
+
52
+ return renameWatchlistSchema.validate(renameWatchlistObj);
53
+ };
54
+
55
+ module.exports = {
56
+ validateGetWatchlistScrips,
57
+ validateGroupNameAndSymbolList,
58
+ validateDeleteWatchlistGroups,
59
+ validateRenameGroup,
60
+ };