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.
- 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 +14 -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 +2397 -2430
- package/src/apiUtils.js +221 -129
- package/src/chart.js +258 -258
- package/src/config.js +321 -326
- package/src/feed/depthFeed.js +137 -0
- package/src/feed/feed.js +162 -139
- package/src/feed/liveNewsFeed.js +112 -112
- package/src/feed/miniQuoteFeed.js +121 -0
- package/src/feed/ordersFeed.js +124 -124
- package/src/feed/quotesFeed.js +226 -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/quote.js +75 -0
- package/src/researchCalls.js +175 -175
- package/src/watchlist.js +378 -378
- package/validations/apiConnectValidator.js +521 -508
- package/validations/chartValidator.js +85 -85
- package/validations/feedStreamerValidator.js +162 -68
- package/validations/liveNewsValidator.js +60 -60
- package/validations/quoteValidator.js +19 -0
- package/validations/researchCallsValidator.js +86 -86
- package/validations/watchlistValidator.js +60 -60
|
@@ -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
|
+
};
|