api_connect_nodejs 1.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 +3 -3
- package/conf/settings.ini +9 -10
- package/enums/streamingConstants.js +11 -0
- package/index.js +2 -2
- package/package.json +2 -14
- package/src/{edelconnect.js → apiConnect.js} +401 -182
- package/src/{edelweissApiUtils.js → apiUtils.js} +1 -1
- package/src/config.js +1 -1
- package/src/feed/feed.js +139 -0
- package/src/feed/liveNewsFeed.js +112 -0
- package/src/feed/ordersFeed.js +124 -0
- package/src/feed/quotesFeed.js +121 -0
- package/src/http.js +1 -0
- package/src/iniparser.js +4 -3
- package/src/logger.js +1 -1
- package/validations/{edelconnectValidator.js → apiConnectValidator.js} +77 -188
- package/validations/feedStreamerValidator.js +68 -0
- package/.prettierrc.json +0 -19
- package/gitignore +0 -23
- package/src/feed.js +0 -166
- package/validations/feedValidator.js +0 -31
|
@@ -2,15 +2,18 @@ const fs = require("fs");
|
|
|
2
2
|
const readline = require("readline");
|
|
3
3
|
const log4js = require("./logger.js");
|
|
4
4
|
const Order = require("./order");
|
|
5
|
-
const Feed = require("./feed");
|
|
6
5
|
const Chart = require("./chart");
|
|
7
6
|
const LiveNews = require("./liveNews");
|
|
8
7
|
const Watchlist = require("./watchlist");
|
|
9
8
|
const ResearchCalls = require("./researchCalls");
|
|
10
|
-
const __Constants = require("./
|
|
9
|
+
const __Constants = require("./apiUtils");
|
|
11
10
|
const __Config = require("./config");
|
|
12
11
|
const __Http = require("./http");
|
|
13
12
|
const pkgJson = require("../package.json");
|
|
13
|
+
const Feed = require("./feed/feed");
|
|
14
|
+
const QuotesFeed = require("./feed/quotesFeed");
|
|
15
|
+
const OrdersFeed = require("./feed/ordersFeed");
|
|
16
|
+
const LiveNewsFeed = require("./feed/liveNewsFeed");
|
|
14
17
|
|
|
15
18
|
const {
|
|
16
19
|
validatePlaceTrade,
|
|
@@ -33,19 +36,19 @@ const {
|
|
|
33
36
|
validateOrderHistory,
|
|
34
37
|
validatePositionSquareOff,
|
|
35
38
|
validateMFOrderBook,
|
|
36
|
-
} = require("../validations/
|
|
39
|
+
} = require("../validations/apiConnectValidator");
|
|
37
40
|
|
|
38
41
|
const {
|
|
39
42
|
validateLiveNewsParams,
|
|
40
43
|
validateNewsForResultsAndStocksParams,
|
|
41
44
|
validateLatestCorporateActions,
|
|
42
45
|
} = require("../validations/liveNewsValidator");
|
|
43
|
-
class
|
|
46
|
+
class APIConnect {
|
|
44
47
|
/**
|
|
45
|
-
* This is **
|
|
46
|
-
* @param {string} apiKey API key provided by
|
|
47
|
-
* @param {string} password Password provided by
|
|
48
|
-
* @param {string} reqId Token to be collected post redirection from Login URL
|
|
48
|
+
* This is **APIConnect** class. Please initialise single instance of this per `api_key`.
|
|
49
|
+
* @param {string} apiKey API key provided by APIConnect
|
|
50
|
+
* @param {string} password Password provided by APIConnect
|
|
51
|
+
* @param {string} reqId Token to be collected post redirection from Login URL using APIConnect credentials
|
|
49
52
|
* @param {string} downloadContract If this is set to `True` then It will download all the contracts and return the records in dictionary `instruments`
|
|
50
53
|
*/
|
|
51
54
|
constructor(apiKey, password, reqId, downloadContract) {
|
|
@@ -59,6 +62,7 @@ class EdelweissAPIConnect {
|
|
|
59
62
|
this.reqId = reqId;
|
|
60
63
|
this.fileName = "data_" + apiKey + ".txt";
|
|
61
64
|
this.__http.fileName = this.fileName;
|
|
65
|
+
this.feedObject = null;
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
/**
|
|
@@ -75,49 +79,56 @@ class EdelweissAPIConnect {
|
|
|
75
79
|
resolve(res);
|
|
76
80
|
}
|
|
77
81
|
};
|
|
82
|
+
const readFilePromise = new Promise((resolve, reject) => {
|
|
83
|
+
fs.readFile(this.fileName, "utf8", (err, data) => {
|
|
84
|
+
if (err) {
|
|
85
|
+
//var promises=[]
|
|
86
|
+
// if file doesn't exist, then generate it
|
|
87
|
+
// these two functions will fill the __constants and generate ${fileName}
|
|
88
|
+
// promises.push(this.__GenerateVendorSession(this.apiKey, this.password, this.reqId));
|
|
89
|
+
// promises.push(this.__GetAuthorization(this.reqId));
|
|
90
|
+
count++;
|
|
91
|
+
// Promise.all(promises).then(checkDone()).catch(reject());
|
|
92
|
+
this.__GenerateVendorSession(this.apiKey, this.password, this.reqId)
|
|
93
|
+
.then((res) => {
|
|
94
|
+
this.__GetAuthorization(this.reqId)
|
|
95
|
+
.then((res) => {
|
|
96
|
+
checkDone(res);
|
|
97
|
+
resolve(true);
|
|
98
|
+
})
|
|
99
|
+
.catch((err) => reject(err));
|
|
100
|
+
})
|
|
101
|
+
.catch((err) => reject(err));
|
|
102
|
+
} else {
|
|
103
|
+
const j = JSON.parse(data);
|
|
104
|
+
this.__constants.VendorSession = j.vt;
|
|
105
|
+
this.__constants.JSession = j.auth;
|
|
106
|
+
this.__constants.eqAccId = j.eqaccid;
|
|
107
|
+
this.__constants.coAccId = j.coaccid;
|
|
108
|
+
this.__constants.Data = j.data;
|
|
109
|
+
this.__constants.AppIdKey = j.appidkey;
|
|
110
|
+
this.__constants.profileId = j.data.data.lgnData.accs.prfId;
|
|
111
|
+
count++;
|
|
112
|
+
checkDone();
|
|
113
|
+
resolve(true);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
78
117
|
|
|
79
118
|
// Check if ${fileName} exists
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
//var promises=[]
|
|
83
|
-
// if file doesn't exist, then generate it
|
|
84
|
-
// these two functions will fill the __constants and generate ${fileName}
|
|
85
|
-
// promises.push(this.__GenerateVendorSession(this.apiKey, this.password, this.reqId));
|
|
86
|
-
// promises.push(this.__GetAuthorization(this.reqId));
|
|
119
|
+
readFilePromise
|
|
120
|
+
.then((res) => {
|
|
87
121
|
count++;
|
|
88
|
-
|
|
89
|
-
this.
|
|
122
|
+
this.__CheckUpdate().then(checkDone).catch(reject);
|
|
123
|
+
this.feedObject = new Feed();
|
|
124
|
+
this.__Instruments()
|
|
90
125
|
.then((res) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
checkDone(res);
|
|
94
|
-
})
|
|
95
|
-
.catch((err) => reject(err));
|
|
126
|
+
//console.log("instrument then");
|
|
127
|
+
checkDone(res);
|
|
96
128
|
})
|
|
97
129
|
.catch((err) => reject(err));
|
|
98
|
-
} else {
|
|
99
|
-
const j = JSON.parse(data);
|
|
100
|
-
this.__constants.VendorSession = j.vt;
|
|
101
|
-
this.__constants.JSession = j.auth;
|
|
102
|
-
this.__constants.eqAccId = j.eqaccid;
|
|
103
|
-
this.__constants.coAccId = j.coaccid;
|
|
104
|
-
this.__constants.Data = j.data;
|
|
105
|
-
this.__constants.AppIdKey = j.appidkey;
|
|
106
|
-
this.__constants.profileId = j.data.data.lgnData.accs.prfId;
|
|
107
|
-
count++;
|
|
108
|
-
checkDone();
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
count++;
|
|
112
|
-
// this.__CheckUpdate().then(checkDone).catch(reject);
|
|
113
|
-
this.__Instruments()
|
|
114
|
-
.then((res) => {
|
|
115
|
-
//console.log("instrument then");
|
|
116
|
-
checkDone(res);
|
|
117
130
|
})
|
|
118
|
-
.catch((err) =>
|
|
119
|
-
reject();
|
|
120
|
-
});
|
|
131
|
+
.catch((err) => reject(err));
|
|
121
132
|
});
|
|
122
133
|
};
|
|
123
134
|
|
|
@@ -180,14 +191,14 @@ class EdelweissAPIConnect {
|
|
|
180
191
|
if (res.data.msg === "MANDATORY") {
|
|
181
192
|
console.log(
|
|
182
193
|
"Mandatory Update. New version " +
|
|
183
|
-
|
|
194
|
+
res.data.vsn +
|
|
184
195
|
". Update to new version to continue."
|
|
185
196
|
);
|
|
186
197
|
process.exit();
|
|
187
198
|
} else if (res.data.msg === "OPTIONAL") {
|
|
188
199
|
console.log(
|
|
189
200
|
"New version " +
|
|
190
|
-
|
|
201
|
+
res.data.vsn +
|
|
191
202
|
" is available. Stay up to date for better experience"
|
|
192
203
|
);
|
|
193
204
|
}
|
|
@@ -195,7 +206,54 @@ class EdelweissAPIConnect {
|
|
|
195
206
|
} else {
|
|
196
207
|
throw res;
|
|
197
208
|
}
|
|
198
|
-
})
|
|
209
|
+
})
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Get LiveNewsStreaming Object
|
|
214
|
+
* @function initLiveNewsStreaming
|
|
215
|
+
* @returns LiveNewsStreaming Object, using this object you can call subsribe() and unsubsribe() methods.
|
|
216
|
+
*/
|
|
217
|
+
initLiveNewsStreaming = () => {
|
|
218
|
+
let liveNewsFeedObj = {};
|
|
219
|
+
try {
|
|
220
|
+
liveNewsFeedObj = new LiveNewsFeed(this.feedObject);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.log(error);
|
|
223
|
+
}
|
|
224
|
+
return liveNewsFeedObj;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Get QuotesStreaming Object
|
|
229
|
+
* @function initQuotesStreaming
|
|
230
|
+
* @returns QuotesStreaming Object, using this object you can call subsribe() and unsubsribe() methods.
|
|
231
|
+
*/
|
|
232
|
+
initQuotesStreaming = () => {
|
|
233
|
+
let quoteFeedObj = {};
|
|
234
|
+
try {
|
|
235
|
+
quoteFeedObj = new QuotesFeed(this.feedObject);
|
|
236
|
+
} catch (error) {
|
|
237
|
+
console.log(error);
|
|
238
|
+
}
|
|
239
|
+
return quoteFeedObj;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Get OrdersStreaming Object
|
|
244
|
+
* @function initOrdersStreaming
|
|
245
|
+
* @param {string} accountId - accid Customer Account ID
|
|
246
|
+
* @param {string} userId - User ID
|
|
247
|
+
* @returns OrdersStreaming Object, using this object you can call subsribe() and unsubsribe() methods.
|
|
248
|
+
*/
|
|
249
|
+
initOrdersStreaming = (accountId, userId) => {
|
|
250
|
+
let orderFeedObj = {};
|
|
251
|
+
try {
|
|
252
|
+
orderFeedObj = new OrdersFeed(this.feedObject, accountId, userId);
|
|
253
|
+
} catch (error) {
|
|
254
|
+
console.log(error);
|
|
255
|
+
}
|
|
256
|
+
return orderFeedObj;
|
|
199
257
|
};
|
|
200
258
|
|
|
201
259
|
/**
|
|
@@ -208,8 +266,8 @@ class EdelweissAPIConnect {
|
|
|
208
266
|
|
|
209
267
|
/**
|
|
210
268
|
* Generate Vendor Session
|
|
211
|
-
* @param {string} apiKey Key provided by
|
|
212
|
-
* @param {string} password Password provided by
|
|
269
|
+
* @param {string} apiKey Key provided by APIConnect
|
|
270
|
+
* @param {string} password Password provided by APIConnect
|
|
213
271
|
* @returns Promise \
|
|
214
272
|
* if resolved, then returns object in the form of `{msg: string, success: boolean}` \
|
|
215
273
|
* if rejected, returns error
|
|
@@ -308,12 +366,12 @@ class EdelweissAPIConnect {
|
|
|
308
366
|
addSymbolWatchlist = (groupName, symLst) => {
|
|
309
367
|
let res = {};
|
|
310
368
|
log4js.info("Inside addSymbolWatchlist method");
|
|
311
|
-
const
|
|
369
|
+
const watchlistObj = new Watchlist(
|
|
312
370
|
this.__http,
|
|
313
371
|
this.__config,
|
|
314
372
|
this.__constants
|
|
315
373
|
);
|
|
316
|
-
res =
|
|
374
|
+
res = watchlistObj.addSymbolWatchlist(groupName, symLst);
|
|
317
375
|
return res;
|
|
318
376
|
};
|
|
319
377
|
|
|
@@ -332,12 +390,12 @@ class EdelweissAPIConnect {
|
|
|
332
390
|
deleteSymbolWatchlist = (groupName, symLst) => {
|
|
333
391
|
let res = {};
|
|
334
392
|
log4js.info("Inside deleteSymbolWatchlist method");
|
|
335
|
-
const
|
|
393
|
+
const watchlistObj = new Watchlist(
|
|
336
394
|
this.__http,
|
|
337
395
|
this.__config,
|
|
338
396
|
this.__constants
|
|
339
397
|
);
|
|
340
|
-
res =
|
|
398
|
+
res = watchlistObj.deleteSymbolWatchlist(groupName, symLst);
|
|
341
399
|
return res;
|
|
342
400
|
};
|
|
343
401
|
|
|
@@ -355,12 +413,12 @@ class EdelweissAPIConnect {
|
|
|
355
413
|
deleteWatchlistGroups = (groups) => {
|
|
356
414
|
let res = {};
|
|
357
415
|
log4js.info("Inside deleteWatchlistGroups method");
|
|
358
|
-
const
|
|
416
|
+
const watchlistObj = new Watchlist(
|
|
359
417
|
this.__http,
|
|
360
418
|
this.__config,
|
|
361
419
|
this.__constants
|
|
362
420
|
);
|
|
363
|
-
res =
|
|
421
|
+
res = watchlistObj.deleteWatchlistGroups(groups);
|
|
364
422
|
return res;
|
|
365
423
|
};
|
|
366
424
|
|
|
@@ -379,12 +437,12 @@ class EdelweissAPIConnect {
|
|
|
379
437
|
renameWatchlistGroup = (groupName, newGroupName) => {
|
|
380
438
|
let res = {};
|
|
381
439
|
log4js.info("renameWatchlistGroup method is called.");
|
|
382
|
-
const
|
|
440
|
+
const watchlistObj = new Watchlist(
|
|
383
441
|
this.__http,
|
|
384
442
|
this.__config,
|
|
385
443
|
this.__constants
|
|
386
444
|
);
|
|
387
|
-
res =
|
|
445
|
+
res = watchlistObj.renameWatchlistGroup(groupName, newGroupName);
|
|
388
446
|
return res;
|
|
389
447
|
};
|
|
390
448
|
/**
|
|
@@ -514,12 +572,8 @@ class EdelweissAPIConnect {
|
|
|
514
572
|
);
|
|
515
573
|
} else {
|
|
516
574
|
//If Holdings true then call equity Holdings
|
|
517
|
-
response = await liveNewsObj.getEqHoldings(
|
|
518
|
-
searchText,
|
|
519
|
-
pageNumber
|
|
520
|
-
);
|
|
575
|
+
response = await liveNewsObj.getEqHoldings(searchText, pageNumber);
|
|
521
576
|
}
|
|
522
|
-
console.log;
|
|
523
577
|
//Before Return filter response
|
|
524
578
|
return await liveNewsObj.filterLiveNewsResponse(
|
|
525
579
|
category,
|
|
@@ -568,10 +622,7 @@ class EdelweissAPIConnect {
|
|
|
568
622
|
);
|
|
569
623
|
} else {
|
|
570
624
|
//If Holdings true then call equity Holding
|
|
571
|
-
response = await liveNewsObj.getEqHoldings(
|
|
572
|
-
searchText,
|
|
573
|
-
pageNumber
|
|
574
|
-
);
|
|
625
|
+
response = await liveNewsObj.getEqHoldings(searchText, pageNumber);
|
|
575
626
|
}
|
|
576
627
|
|
|
577
628
|
//Filter Response before return
|
|
@@ -894,6 +945,28 @@ class EdelweissAPIConnect {
|
|
|
894
945
|
TriggerPrice = "0",
|
|
895
946
|
ProductCode = "CNC"
|
|
896
947
|
) => {
|
|
948
|
+
log4js.info("Inside PlaceTrade method");
|
|
949
|
+
const paramsObj = {
|
|
950
|
+
trdSym: Trading_Symbol,
|
|
951
|
+
exc: Exchange,
|
|
952
|
+
action: Action,
|
|
953
|
+
dur: Duration,
|
|
954
|
+
ordTyp: Order_Type,
|
|
955
|
+
qty: Quantity,
|
|
956
|
+
sym: Streaming_Symbol,
|
|
957
|
+
lmPrc: Limit_Price,
|
|
958
|
+
dscQty: Disclosed_Quantity,
|
|
959
|
+
trgPrc: TriggerPrice,
|
|
960
|
+
prdCode: ProductCode,
|
|
961
|
+
};
|
|
962
|
+
const validateResponse = validatePlaceTrade(paramsObj);
|
|
963
|
+
if (validateResponse.error) {
|
|
964
|
+
log4js.debug(
|
|
965
|
+
"PlaceTrade validation error -" + validateResponse.error.details
|
|
966
|
+
);
|
|
967
|
+
return Promise.reject(validateResponse.error.details);
|
|
968
|
+
}
|
|
969
|
+
|
|
897
970
|
const data = {
|
|
898
971
|
trdSym: Trading_Symbol,
|
|
899
972
|
exc: Exchange,
|
|
@@ -914,14 +987,6 @@ class EdelweissAPIConnect {
|
|
|
914
987
|
rmk: "",
|
|
915
988
|
flQty: true,
|
|
916
989
|
};
|
|
917
|
-
const validateResponse = validatePlaceTrade(data);
|
|
918
|
-
if (validateResponse.error) {
|
|
919
|
-
log4js.debug(
|
|
920
|
-
"PlaceTrade validation error -" + validateResponse.error.details
|
|
921
|
-
);
|
|
922
|
-
return Promise.reject(validateResponse.error.details);
|
|
923
|
-
}
|
|
924
|
-
log4js.info("Inside PlaceTrade method");
|
|
925
990
|
log4js.debug("PlaceTrade Data :" + JSON.stringify(data));
|
|
926
991
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
927
992
|
const url = this.__config.PlaceTradeURL_comm(this.__constants.coAccId);
|
|
@@ -968,10 +1033,31 @@ class EdelweissAPIConnect {
|
|
|
968
1033
|
TriggerPrice = "0",
|
|
969
1034
|
ProductCode = "CNC"
|
|
970
1035
|
) => {
|
|
1036
|
+
log4js.info("Inside PlaceCoverTrade method");
|
|
971
1037
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
972
1038
|
console.log("Operation invalid for commodities");
|
|
973
1039
|
return Promise.reject(new Error("Operation invalid for commodities"));
|
|
974
1040
|
}
|
|
1041
|
+
const paramsObj = {
|
|
1042
|
+
trdSym: Trading_Symbol,
|
|
1043
|
+
exc: Exchange,
|
|
1044
|
+
action: Action,
|
|
1045
|
+
dur: Duration,
|
|
1046
|
+
ordTyp: Order_Type,
|
|
1047
|
+
qty: Quantity,
|
|
1048
|
+
sym: Streaming_Symbol,
|
|
1049
|
+
lmPrc: Limit_Price,
|
|
1050
|
+
dscQty: Disclosed_Quantity,
|
|
1051
|
+
trgPrc: TriggerPrice,
|
|
1052
|
+
prdCode: ProductCode,
|
|
1053
|
+
};
|
|
1054
|
+
const validateResponse = validatePlaceCoverTrade(paramsObj);
|
|
1055
|
+
if (validateResponse.error) {
|
|
1056
|
+
log4js.debug(
|
|
1057
|
+
"PlaceCoverTrade validation error -" + validateResponse.error.details
|
|
1058
|
+
);
|
|
1059
|
+
return Promise.reject(validateResponse.error.details);
|
|
1060
|
+
}
|
|
975
1061
|
|
|
976
1062
|
const data = {
|
|
977
1063
|
trdSym: Trading_Symbol,
|
|
@@ -993,14 +1079,7 @@ class EdelweissAPIConnect {
|
|
|
993
1079
|
rmk: "",
|
|
994
1080
|
flQty: "0",
|
|
995
1081
|
};
|
|
996
|
-
|
|
997
|
-
const validateResponse = validatePlaceCoverTrade(data);
|
|
998
|
-
if (validateResponse.error) {
|
|
999
|
-
log4js.debug(
|
|
1000
|
-
"PlaceCoverTrade validation error -" + validateResponse.error.details
|
|
1001
|
-
);
|
|
1002
|
-
return Promise.reject(validateResponse.error.details);
|
|
1003
|
-
}
|
|
1082
|
+
|
|
1004
1083
|
log4js.debug("PlaceCoverTrade Data :" + JSON.stringify(data));
|
|
1005
1084
|
const url = this.__config.PlaceCoverTradeURL(this.__constants.eqAccId);
|
|
1006
1085
|
log4js.debug("PlaceCoverTrade URLS -" + url);
|
|
@@ -1039,6 +1118,27 @@ class EdelweissAPIConnect {
|
|
|
1039
1118
|
Product_Code,
|
|
1040
1119
|
DTDays
|
|
1041
1120
|
) => {
|
|
1121
|
+
log4js.info("Inside PlaceGtcGtdTrade method");
|
|
1122
|
+
const paramsObj = {
|
|
1123
|
+
trdSym: Trading_Symbol,
|
|
1124
|
+
exc: Exchange,
|
|
1125
|
+
action: Action,
|
|
1126
|
+
dur: Duration,
|
|
1127
|
+
ordTyp: Order_Type,
|
|
1128
|
+
qty: Quantity,
|
|
1129
|
+
lmPrc: Limit_Price,
|
|
1130
|
+
sym: streaming_symbol,
|
|
1131
|
+
prdCode: Product_Code,
|
|
1132
|
+
dtDays: DTDays,
|
|
1133
|
+
};
|
|
1134
|
+
const validateResponse = validatePlaceGtcGtdTrade(paramsObj);
|
|
1135
|
+
if (validateResponse.error) {
|
|
1136
|
+
log4js.debug(
|
|
1137
|
+
"PlaceGtcGtdTrade validation error -" + validateResponse.error.details
|
|
1138
|
+
);
|
|
1139
|
+
return Promise.reject(validateResponse.error.details);
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1042
1142
|
const data = {
|
|
1043
1143
|
trdSym: Trading_Symbol,
|
|
1044
1144
|
exc: Exchange,
|
|
@@ -1059,14 +1159,6 @@ class EdelweissAPIConnect {
|
|
|
1059
1159
|
sym: streaming_symbol,
|
|
1060
1160
|
brk: "",
|
|
1061
1161
|
};
|
|
1062
|
-
log4js.info("Inside PlaceGtcGtdTrade method");
|
|
1063
|
-
const validateResponse = validatePlaceGtcGtdTrade(data);
|
|
1064
|
-
if (validateResponse.error) {
|
|
1065
|
-
log4js.debug(
|
|
1066
|
-
"PlaceGtcGtdTrade validation error -" + validateResponse.error.details
|
|
1067
|
-
);
|
|
1068
|
-
return Promise.reject(validateResponse.error.details);
|
|
1069
|
-
}
|
|
1070
1162
|
log4js.debug("PlaceGtcGtdTrade Data :" + JSON.stringify(data));
|
|
1071
1163
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
1072
1164
|
const url = this.__config.PlaceTradeURL_comm(this.__constants.coAccId);
|
|
@@ -1112,6 +1204,28 @@ class EdelweissAPIConnect {
|
|
|
1112
1204
|
TriggerPrice = "0",
|
|
1113
1205
|
ProductCode = "CNC"
|
|
1114
1206
|
) => {
|
|
1207
|
+
log4js.info("Inside ModifyTrade method");
|
|
1208
|
+
const paramsObj = {
|
|
1209
|
+
trdSym: Trading_Symbol,
|
|
1210
|
+
exc: Exchange,
|
|
1211
|
+
action: Action,
|
|
1212
|
+
dur: Duration,
|
|
1213
|
+
ordTyp: Order_Type,
|
|
1214
|
+
qty: Quantity,
|
|
1215
|
+
sym: Streaming_Symbol,
|
|
1216
|
+
lmPrc: Limit_Price,
|
|
1217
|
+
nstOID: Order_ID,
|
|
1218
|
+
dscQty: Disclosed_Quantity,
|
|
1219
|
+
trgPrc: TriggerPrice,
|
|
1220
|
+
prdCode: ProductCode,
|
|
1221
|
+
};
|
|
1222
|
+
const validateResponse = validateModifyTrade(paramsObj);
|
|
1223
|
+
if (validateResponse.error) {
|
|
1224
|
+
log4js.debug(
|
|
1225
|
+
"ModifyTrade validation error -" + validateResponse.error.details
|
|
1226
|
+
);
|
|
1227
|
+
return Promise.reject(validateResponse.error.details);
|
|
1228
|
+
}
|
|
1115
1229
|
const data = {
|
|
1116
1230
|
trdSym: Trading_Symbol,
|
|
1117
1231
|
exc: Exchange,
|
|
@@ -1130,14 +1244,7 @@ class EdelweissAPIConnect {
|
|
|
1130
1244
|
nstOID: Order_ID,
|
|
1131
1245
|
valid: false,
|
|
1132
1246
|
};
|
|
1133
|
-
|
|
1134
|
-
const validateResponse = validateModifyTrade(data);
|
|
1135
|
-
if (validateResponse.error) {
|
|
1136
|
-
log4js.debug(
|
|
1137
|
-
"ModifyTrade validation error -" + validateResponse.error.details
|
|
1138
|
-
);
|
|
1139
|
-
return Promise.reject(validateResponse.error.details);
|
|
1140
|
-
}
|
|
1247
|
+
|
|
1141
1248
|
log4js.debug("ModifyTrade Data :" + JSON.stringify(data));
|
|
1142
1249
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
1143
1250
|
const url = this.__config.ModifyTradeURL_comm(this.__constants.coAccId);
|
|
@@ -1183,36 +1290,50 @@ class EdelweissAPIConnect {
|
|
|
1183
1290
|
TriggerPrice = "0",
|
|
1184
1291
|
ProductCode = "CNC"
|
|
1185
1292
|
) => {
|
|
1293
|
+
log4js.info("Inside ModifyCoverTrade method");
|
|
1186
1294
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
1187
1295
|
console.log("Operation invalid for commodities");
|
|
1188
1296
|
return Promise.reject(new Error("Operation invalid for commodities"));
|
|
1189
1297
|
}
|
|
1190
|
-
|
|
1191
|
-
const data = {
|
|
1298
|
+
const paramsObj = {
|
|
1192
1299
|
trdSym: Trading_Symbol,
|
|
1193
1300
|
exc: Exchange,
|
|
1194
1301
|
action: Action,
|
|
1195
1302
|
dur: Duration,
|
|
1196
|
-
flQty: "0",
|
|
1197
1303
|
ordTyp: Order_Type,
|
|
1198
1304
|
qty: Quantity,
|
|
1199
|
-
dscQty: Disclosed_Quantity,
|
|
1200
1305
|
sym: Streaming_Symbol,
|
|
1201
|
-
mktPro: "",
|
|
1202
1306
|
lmPrc: Limit_Price,
|
|
1307
|
+
nstOID: Order_ID,
|
|
1308
|
+
dscQty: Disclosed_Quantity,
|
|
1203
1309
|
trgPrc: TriggerPrice,
|
|
1204
1310
|
prdCode: ProductCode,
|
|
1205
|
-
dtDays: "",
|
|
1206
|
-
nstOID: Order_ID,
|
|
1207
1311
|
};
|
|
1208
|
-
|
|
1209
|
-
const validateResponse = validateModifyCoverTrade(data);
|
|
1312
|
+
const validateResponse = validateModifyCoverTrade(paramsObj);
|
|
1210
1313
|
if (validateResponse.error) {
|
|
1211
1314
|
log4js.debug(
|
|
1212
1315
|
"ModifyCoverTrade validation error -" + validateResponse.error.details
|
|
1213
1316
|
);
|
|
1214
1317
|
return Promise.reject(validateResponse.error.details);
|
|
1215
1318
|
}
|
|
1319
|
+
const data = {
|
|
1320
|
+
trdSym: Trading_Symbol,
|
|
1321
|
+
exc: Exchange,
|
|
1322
|
+
action: Action,
|
|
1323
|
+
dur: Duration,
|
|
1324
|
+
flQty: "0",
|
|
1325
|
+
ordTyp: Order_Type,
|
|
1326
|
+
qty: Quantity,
|
|
1327
|
+
dscQty: Disclosed_Quantity,
|
|
1328
|
+
sym: Streaming_Symbol,
|
|
1329
|
+
mktPro: "",
|
|
1330
|
+
lmPrc: Limit_Price,
|
|
1331
|
+
trgPrc: TriggerPrice,
|
|
1332
|
+
prdCode: ProductCode,
|
|
1333
|
+
dtDays: "",
|
|
1334
|
+
nstOID: Order_ID,
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1216
1337
|
log4js.debug("ModifyCoverTrade Data :" + JSON.stringify(data));
|
|
1217
1338
|
const url = this.__config.ModifyCoverTradeURL(this.__constants.eqAccId);
|
|
1218
1339
|
log4js.debug("ModifyCoverTrade URLS -" + url);
|
|
@@ -1230,13 +1351,13 @@ class EdelweissAPIConnect {
|
|
|
1230
1351
|
* @returns Promise that resolves/rejects to Cancel Trade api response
|
|
1231
1352
|
*/
|
|
1232
1353
|
CancelTrade = (OrderId, Exchange, Order_Type, ProductCode) => {
|
|
1354
|
+
log4js.info("Inside CancelTrade method");
|
|
1233
1355
|
const data = {
|
|
1234
1356
|
nstOID: OrderId,
|
|
1235
1357
|
exc: Exchange,
|
|
1236
1358
|
prdCode: ProductCode,
|
|
1237
1359
|
ordTyp: Order_Type,
|
|
1238
1360
|
};
|
|
1239
|
-
log4js.info("Inside CancelTrade method");
|
|
1240
1361
|
const validateResponse = validateCancelPlaceTrade(data);
|
|
1241
1362
|
if (validateResponse.error) {
|
|
1242
1363
|
log4js.debug(
|
|
@@ -1277,7 +1398,7 @@ class EdelweissAPIConnect {
|
|
|
1277
1398
|
*/
|
|
1278
1399
|
MFOrderBook = (fromDate, toDate) => {
|
|
1279
1400
|
log4js.info("Inside MFOrderBook method");
|
|
1280
|
-
const validateResponse = validateMFOrderBook(
|
|
1401
|
+
const validateResponse = validateMFOrderBook(fromDate, toDate);
|
|
1281
1402
|
if (validateResponse.error) {
|
|
1282
1403
|
log4js.debug(
|
|
1283
1404
|
"MFOrderBook validation error -" + validateResponse.error.details
|
|
@@ -1302,7 +1423,7 @@ class EdelweissAPIConnect {
|
|
|
1302
1423
|
*/
|
|
1303
1424
|
ExitCoverTrade = (OrderId) => {
|
|
1304
1425
|
log4js.info("Inside ExitCoverTrade method");
|
|
1305
|
-
const validateResponse = validateExitCoverTrade(
|
|
1426
|
+
const validateResponse = validateExitCoverTrade(OrderId);
|
|
1306
1427
|
if (validateResponse.error) {
|
|
1307
1428
|
log4js.debug(
|
|
1308
1429
|
"ExitCoverTrade validation error -" + validateResponse.error.details
|
|
@@ -1325,6 +1446,7 @@ class EdelweissAPIConnect {
|
|
|
1325
1446
|
*/
|
|
1326
1447
|
ExitBracketTrade = (Order_Id, Syom_Id, Status) => {
|
|
1327
1448
|
log4js.info("Inside ExitBracketTrade method");
|
|
1449
|
+
const data = { nstOrdNo: Order_Id, syomID: Syom_Id, sts: Status };
|
|
1328
1450
|
const validateResponse = validateExitBracketTrade(data);
|
|
1329
1451
|
if (validateResponse.error) {
|
|
1330
1452
|
log4js.debug(
|
|
@@ -1332,7 +1454,6 @@ class EdelweissAPIConnect {
|
|
|
1332
1454
|
);
|
|
1333
1455
|
return Promise.reject(validateResponse.error.details);
|
|
1334
1456
|
}
|
|
1335
|
-
const data = { nstOrdNo: Order_Id, syomID: Syom_Id, sts: Status };
|
|
1336
1457
|
log4js.debug("ExitBracketTrade Data :" + JSON.stringify(data));
|
|
1337
1458
|
const url = this.__config.ExitBracketTradeURL(this.__constants.eqAccId);
|
|
1338
1459
|
log4js.debug("ExitBracketTrade URLS -" + url);
|
|
@@ -1369,12 +1490,12 @@ class EdelweissAPIConnect {
|
|
|
1369
1490
|
Trailing_Stop_Loss = "Y",
|
|
1370
1491
|
Trailing_Stop_Loss_Value = "1"
|
|
1371
1492
|
) => {
|
|
1493
|
+
log4js.info("Inside PlaceBracketTrade method");
|
|
1372
1494
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
1373
1495
|
console.log("Operation invalid for commodities");
|
|
1374
1496
|
return Promise.reject(new Error("Operation invalid for commodities"));
|
|
1375
1497
|
}
|
|
1376
|
-
|
|
1377
|
-
const data = {
|
|
1498
|
+
const paramsObj = {
|
|
1378
1499
|
exc: Exchange,
|
|
1379
1500
|
sym: Streaming_Symbol,
|
|
1380
1501
|
trnsTyp: Transaction_Type,
|
|
@@ -1382,23 +1503,36 @@ class EdelweissAPIConnect {
|
|
|
1382
1503
|
dur: Duration,
|
|
1383
1504
|
dsQty: Disclosed_Quantity,
|
|
1384
1505
|
prc: Limit_Price,
|
|
1385
|
-
trdBsdOn: "LTP",
|
|
1386
|
-
sqOffBsdOn: "Absolute",
|
|
1387
1506
|
sqOffVal: Target,
|
|
1388
|
-
slBsdOn: "Absolute",
|
|
1389
1507
|
slVal: StopLoss,
|
|
1390
1508
|
trlSl: Trailing_Stop_Loss,
|
|
1391
1509
|
trlSlVal: Trailing_Stop_Loss_Value,
|
|
1392
|
-
ordSrc: "API",
|
|
1393
1510
|
};
|
|
1394
|
-
|
|
1395
|
-
const validateResponse = validatePlaceBracketTrade(data);
|
|
1511
|
+
const validateResponse = validatePlaceBracketTrade(paramsObj);
|
|
1396
1512
|
if (validateResponse.error) {
|
|
1397
1513
|
log4js.debug(
|
|
1398
1514
|
"PlaceBracketTrade validation error -" + validateResponse.error.details
|
|
1399
1515
|
);
|
|
1400
1516
|
return Promise.reject(validateResponse.error.details);
|
|
1401
1517
|
}
|
|
1518
|
+
const data = {
|
|
1519
|
+
exc: Exchange,
|
|
1520
|
+
sym: Streaming_Symbol,
|
|
1521
|
+
trnsTyp: Transaction_Type,
|
|
1522
|
+
qty: Quantity,
|
|
1523
|
+
dur: Duration,
|
|
1524
|
+
dsQty: Disclosed_Quantity,
|
|
1525
|
+
prc: Limit_Price,
|
|
1526
|
+
trdBsdOn: "LTP",
|
|
1527
|
+
sqOffBsdOn: "Absolute",
|
|
1528
|
+
sqOffVal: Target,
|
|
1529
|
+
slBsdOn: "Absolute",
|
|
1530
|
+
slVal: StopLoss,
|
|
1531
|
+
trlSl: Trailing_Stop_Loss,
|
|
1532
|
+
trlSlVal: Trailing_Stop_Loss_Value,
|
|
1533
|
+
ordSrc: "API",
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1402
1536
|
log4js.debug("PlaceBracketTrade Data :" + JSON.stringify(data));
|
|
1403
1537
|
const url = this.__config.PlaceBracketTradeURL(this.__constants.eqAccId);
|
|
1404
1538
|
log4js.debug("PlaceBracketTrade URLS -" + url);
|
|
@@ -1413,6 +1547,13 @@ class EdelweissAPIConnect {
|
|
|
1413
1547
|
*/
|
|
1414
1548
|
PlaceBasketTrade = (orderlist) => {
|
|
1415
1549
|
log4js.info("Inside PlaceBasketTrade method");
|
|
1550
|
+
const validateResponse = validatePlaceBasketTrade(orderlist);
|
|
1551
|
+
if (validateResponse.error) {
|
|
1552
|
+
log4js.debug(
|
|
1553
|
+
"PlaceBasketTrade validation error -" + validateResponse.error.details
|
|
1554
|
+
);
|
|
1555
|
+
return Promise.reject(validateResponse.error.details);
|
|
1556
|
+
}
|
|
1416
1557
|
let isComm = false;
|
|
1417
1558
|
const lst = [];
|
|
1418
1559
|
orderlist.forEach(({ sym, GTDDate, rmk, ...order }) => {
|
|
@@ -1425,14 +1566,6 @@ class EdelweissAPIConnect {
|
|
|
1425
1566
|
lst.push(data);
|
|
1426
1567
|
});
|
|
1427
1568
|
|
|
1428
|
-
const validateResponse = validatePlaceBasketTrade(orderlist);
|
|
1429
|
-
if (validateResponse.error) {
|
|
1430
|
-
log4js.debug(
|
|
1431
|
-
"PlaceBasketTrade validation error -" + validateResponse.error.details
|
|
1432
|
-
);
|
|
1433
|
-
return Promise.reject(validateResponse.error.details);
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
1569
|
const fd = { ordLst: lst, ordSrc: "API" };
|
|
1437
1570
|
if (isComm) {
|
|
1438
1571
|
console.log("Basket Order not available for Commodity");
|
|
@@ -1513,6 +1646,27 @@ class EdelweissAPIConnect {
|
|
|
1513
1646
|
TriggerPrice = "0",
|
|
1514
1647
|
ProductCode = "CNC"
|
|
1515
1648
|
) => {
|
|
1649
|
+
log4js.info("Inside PlaceAMOTrade method");
|
|
1650
|
+
const paramsObj = {
|
|
1651
|
+
trdSym: Trading_Symbol,
|
|
1652
|
+
exc: Exchange,
|
|
1653
|
+
action: Action,
|
|
1654
|
+
dur: Duration,
|
|
1655
|
+
ordTyp: Order_Type,
|
|
1656
|
+
qty: Quantity,
|
|
1657
|
+
sym: Streaming_Symbol,
|
|
1658
|
+
Limit_Price,
|
|
1659
|
+
dscQty: Disclosed_Quantity,
|
|
1660
|
+
trgPrc: TriggerPrice,
|
|
1661
|
+
prdCode: ProductCode,
|
|
1662
|
+
};
|
|
1663
|
+
const validateResponse = validatePlaceAMOTrade(paramsObj);
|
|
1664
|
+
if (validateResponse.error) {
|
|
1665
|
+
log4js.debug(
|
|
1666
|
+
"PlaceAMOTrade validation error -" + validateResponse.error.details
|
|
1667
|
+
);
|
|
1668
|
+
return Promise.reject(validateResponse.error.details);
|
|
1669
|
+
}
|
|
1516
1670
|
const data = {
|
|
1517
1671
|
trdSym: Trading_Symbol,
|
|
1518
1672
|
exc: Exchange,
|
|
@@ -1533,14 +1687,7 @@ class EdelweissAPIConnect {
|
|
|
1533
1687
|
vnCode: "",
|
|
1534
1688
|
rmk: "",
|
|
1535
1689
|
};
|
|
1536
|
-
|
|
1537
|
-
const validateResponse = validatePlaceAMOTrade(data);
|
|
1538
|
-
if (validateResponse.error) {
|
|
1539
|
-
log4js.debug(
|
|
1540
|
-
"PlaceAMOTrade validation error -" + validateResponse.error.details
|
|
1541
|
-
);
|
|
1542
|
-
return Promise.reject(validateResponse.error.details);
|
|
1543
|
-
}
|
|
1690
|
+
|
|
1544
1691
|
log4js.debug("PlaceAMOTrade Data :" + JSON.stringify(data));
|
|
1545
1692
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
1546
1693
|
const url = this.__config.PlaceAMOTrade_comm(this.__constants.coAccId);
|
|
@@ -1587,31 +1734,46 @@ class EdelweissAPIConnect {
|
|
|
1587
1734
|
TriggerPrice = "0",
|
|
1588
1735
|
ProductCode = "CNC"
|
|
1589
1736
|
) => {
|
|
1590
|
-
|
|
1737
|
+
log4js.info("Inside ModifyAMOTrade method");
|
|
1738
|
+
const paramsObj = {
|
|
1591
1739
|
trdSym: Trading_Symbol,
|
|
1592
1740
|
exc: Exchange,
|
|
1593
1741
|
action: Action,
|
|
1594
1742
|
dur: Duration,
|
|
1595
|
-
flQty: "0",
|
|
1596
1743
|
ordTyp: Order_Type,
|
|
1597
1744
|
qty: Quantity,
|
|
1598
|
-
dscQty: Disclosed_Quantity,
|
|
1599
1745
|
sym: Streaming_Symbol,
|
|
1600
|
-
mktPro: "",
|
|
1601
1746
|
lmPrc: Limit_Price,
|
|
1747
|
+
nstOID: Order_ID,
|
|
1748
|
+
dscQty: Disclosed_Quantity,
|
|
1602
1749
|
trgPrc: TriggerPrice,
|
|
1603
1750
|
prdCode: ProductCode,
|
|
1604
|
-
dtDays: "",
|
|
1605
|
-
nstOID: Order_ID,
|
|
1606
1751
|
};
|
|
1607
|
-
|
|
1608
|
-
const validateResponse = validateModifyAMOTrade(data);
|
|
1752
|
+
const validateResponse = validateModifyAMOTrade(paramsObj);
|
|
1609
1753
|
if (validateResponse.error) {
|
|
1610
1754
|
log4js.debug(
|
|
1611
1755
|
"ModifyAMOTrade validation error -" + validateResponse.error.details
|
|
1612
1756
|
);
|
|
1613
1757
|
return Promise.reject(validateResponse.error.details);
|
|
1614
1758
|
}
|
|
1759
|
+
const data = {
|
|
1760
|
+
trdSym: Trading_Symbol,
|
|
1761
|
+
exc: Exchange,
|
|
1762
|
+
action: Action,
|
|
1763
|
+
dur: Duration,
|
|
1764
|
+
flQty: "0",
|
|
1765
|
+
ordTyp: Order_Type,
|
|
1766
|
+
qty: Quantity,
|
|
1767
|
+
dscQty: Disclosed_Quantity,
|
|
1768
|
+
sym: Streaming_Symbol,
|
|
1769
|
+
mktPro: "",
|
|
1770
|
+
lmPrc: Limit_Price,
|
|
1771
|
+
trgPrc: TriggerPrice,
|
|
1772
|
+
prdCode: ProductCode,
|
|
1773
|
+
dtDays: "",
|
|
1774
|
+
nstOID: Order_ID,
|
|
1775
|
+
};
|
|
1776
|
+
|
|
1615
1777
|
log4js.debug("ModifyAMOTrade Data :" + JSON.stringify(data));
|
|
1616
1778
|
if (Exchange == "MCX" || Exchange == "NCDEX") {
|
|
1617
1779
|
const url = this.__config.ModifyAMOTrade_comm(this.__constants.coAccId);
|
|
@@ -1673,6 +1835,13 @@ class EdelweissAPIConnect {
|
|
|
1673
1835
|
* @returns Promise that resolves/rejects to the Position Square Off api response
|
|
1674
1836
|
*/
|
|
1675
1837
|
PositionSquareOff = (orderlist) => {
|
|
1838
|
+
const validateResponse = validatePositionSquareOff(orderlist);
|
|
1839
|
+
if (validateResponse.error) {
|
|
1840
|
+
log4js.debug(
|
|
1841
|
+
"PositionSquareOff validation error -" + validateResponse.error.details
|
|
1842
|
+
);
|
|
1843
|
+
return Promise.reject(validateResponse.error.details);
|
|
1844
|
+
}
|
|
1676
1845
|
const lstEq = [];
|
|
1677
1846
|
const lstComm = [];
|
|
1678
1847
|
log4js.info("Inside PositionSquareOff method");
|
|
@@ -1703,13 +1872,7 @@ class EdelweissAPIConnect {
|
|
|
1703
1872
|
? lstComm.push(data)
|
|
1704
1873
|
: lstEq.push(data);
|
|
1705
1874
|
});
|
|
1706
|
-
|
|
1707
|
-
if (validateResponse.error) {
|
|
1708
|
-
log4js.debug(
|
|
1709
|
-
"PositionSquareOff validation error -" + validateResponse.error.details
|
|
1710
|
-
);
|
|
1711
|
-
return Promise.reject(validateResponse.error.details);
|
|
1712
|
-
}
|
|
1875
|
+
|
|
1713
1876
|
const postEq = lstEq.length
|
|
1714
1877
|
? this.__http.PostMethod(
|
|
1715
1878
|
this.__config.PositionSqOffURL(this.__constants.eqAccId),
|
|
@@ -1828,6 +1991,31 @@ class EdelweissAPIConnect {
|
|
|
1828
1991
|
Scheme_Plan,
|
|
1829
1992
|
Scheme_Code
|
|
1830
1993
|
) => {
|
|
1994
|
+
const paramsObj = {
|
|
1995
|
+
token: Token,
|
|
1996
|
+
isin: ISIN_Code,
|
|
1997
|
+
txnTyp: Transaction_Type,
|
|
1998
|
+
clientCode: Client_Code,
|
|
1999
|
+
qty: Quantity,
|
|
2000
|
+
amt: Amount,
|
|
2001
|
+
reInvFlg: ReInv_Flag,
|
|
2002
|
+
folioNo: Folio_Number,
|
|
2003
|
+
schemeName: Scheme_Name,
|
|
2004
|
+
strtDt: Start_Date,
|
|
2005
|
+
endDt: End_Date,
|
|
2006
|
+
sipFrq: SIP_Frequency,
|
|
2007
|
+
gfot: Generate_First_Order_Today,
|
|
2008
|
+
schemePlan: Scheme_Plan,
|
|
2009
|
+
schemeCode: Scheme_Code,
|
|
2010
|
+
};
|
|
2011
|
+
log4js.info("Inside PlaceMF method");
|
|
2012
|
+
const validateResponse = validatePlaceMF(paramsObj);
|
|
2013
|
+
if (validateResponse.error) {
|
|
2014
|
+
log4js.debug(
|
|
2015
|
+
"PlaceMF validation error -" + validateResponse.error.details
|
|
2016
|
+
);
|
|
2017
|
+
return Promise.reject(validateResponse.error.details);
|
|
2018
|
+
}
|
|
1831
2019
|
const data = {
|
|
1832
2020
|
currentOrdSts: "",
|
|
1833
2021
|
token: Token,
|
|
@@ -1863,14 +2051,7 @@ class EdelweissAPIConnect {
|
|
|
1863
2051
|
euinflag: "N",
|
|
1864
2052
|
physicalFlag: "D",
|
|
1865
2053
|
};
|
|
1866
|
-
|
|
1867
|
-
const validateResponse = validatePlaceMF(data);
|
|
1868
|
-
if (validateResponse.error) {
|
|
1869
|
-
log4js.debug(
|
|
1870
|
-
"PlaceMF validation error -" + validateResponse.error.details
|
|
1871
|
-
);
|
|
1872
|
-
return Promise.reject(validateResponse.error.details);
|
|
1873
|
-
}
|
|
2054
|
+
|
|
1874
2055
|
log4js.debug("PlaceMF Data :" + JSON.stringify(data));
|
|
1875
2056
|
const url = this.__config.PlaceMFURL(this.__constants.eqAccId);
|
|
1876
2057
|
log4js.debug("PlaceMF URLS -" + url);
|
|
@@ -1917,6 +2098,32 @@ class EdelweissAPIConnect {
|
|
|
1917
2098
|
Scheme_Code,
|
|
1918
2099
|
Transaction_Id
|
|
1919
2100
|
) => {
|
|
2101
|
+
log4js.info("Inside ModifyMF method");
|
|
2102
|
+
const paramsObj = {
|
|
2103
|
+
token: Token,
|
|
2104
|
+
isin: ISIN_Code,
|
|
2105
|
+
txnTyp: Transaction_Type,
|
|
2106
|
+
clientCode: Client_Code,
|
|
2107
|
+
qty: Quantity,
|
|
2108
|
+
amt: Amount,
|
|
2109
|
+
reInvFlg: ReInv_Flag,
|
|
2110
|
+
folioNo: Folio_Number,
|
|
2111
|
+
schemeName: Scheme_Name,
|
|
2112
|
+
strtDt: Start_Date,
|
|
2113
|
+
endDt: End_Date,
|
|
2114
|
+
sipFrq: SIP_Frequency,
|
|
2115
|
+
gfot: Generate_First_Order_Today,
|
|
2116
|
+
schemePlan: Scheme_Plan,
|
|
2117
|
+
schemeCode: Scheme_Code,
|
|
2118
|
+
txnId: Transaction_Id,
|
|
2119
|
+
};
|
|
2120
|
+
const validateResponse = validateModifyMF(paramsObj);
|
|
2121
|
+
if (validateResponse.error) {
|
|
2122
|
+
log4js.debug(
|
|
2123
|
+
"ModifyMF validation error -" + validateResponse.error.details
|
|
2124
|
+
);
|
|
2125
|
+
return Promise.reject(validateResponse.error.details);
|
|
2126
|
+
}
|
|
1920
2127
|
const data = {
|
|
1921
2128
|
currentOrdSts: "ACCEPTED",
|
|
1922
2129
|
token: Token,
|
|
@@ -1952,14 +2159,7 @@ class EdelweissAPIConnect {
|
|
|
1952
2159
|
euinflag: "N",
|
|
1953
2160
|
physicalFlag: "D",
|
|
1954
2161
|
};
|
|
1955
|
-
|
|
1956
|
-
const validateResponse = validateModifyMF(data);
|
|
1957
|
-
if (validateResponse.error) {
|
|
1958
|
-
log4js.debug(
|
|
1959
|
-
"ModifyMF validation error -" + validateResponse.error.details
|
|
1960
|
-
);
|
|
1961
|
-
return Promise.reject(validateResponse.error.details);
|
|
1962
|
-
}
|
|
2162
|
+
|
|
1963
2163
|
log4js.debug("ModifyMF Data :" + JSON.stringify(data));
|
|
1964
2164
|
const url = this.__config.ModifyMFURL(this.__constants.eqAccId);
|
|
1965
2165
|
log4js.debug("ModifyMF URLS -" + url);
|
|
@@ -2006,6 +2206,32 @@ class EdelweissAPIConnect {
|
|
|
2006
2206
|
Scheme_Code,
|
|
2007
2207
|
Transaction_Id
|
|
2008
2208
|
) => {
|
|
2209
|
+
log4js.info("Inside CancelMF method");
|
|
2210
|
+
const paramsObj = {
|
|
2211
|
+
token: Token,
|
|
2212
|
+
isin: ISIN_Code,
|
|
2213
|
+
txnTyp: Transaction_Type,
|
|
2214
|
+
clientCode: Client_Code,
|
|
2215
|
+
qty: Quantity,
|
|
2216
|
+
amt: Amount,
|
|
2217
|
+
reInvFlg: ReInv_Flag,
|
|
2218
|
+
folioNo: Folio_Number,
|
|
2219
|
+
schemeName: Scheme_Name,
|
|
2220
|
+
strtDt: Start_Date,
|
|
2221
|
+
endDt: End_Date,
|
|
2222
|
+
sipFrq: SIP_Frequency,
|
|
2223
|
+
gfot: Generate_First_Order_Today,
|
|
2224
|
+
schemePlan: Scheme_Plan,
|
|
2225
|
+
schemeCode: Scheme_Code,
|
|
2226
|
+
txnId: Transaction_Id,
|
|
2227
|
+
};
|
|
2228
|
+
const validateResponse = validateCancelMF(paramsObj);
|
|
2229
|
+
if (validateResponse.error) {
|
|
2230
|
+
log4js.debug(
|
|
2231
|
+
"CancelMF validation error -" + validateResponse.error.details
|
|
2232
|
+
);
|
|
2233
|
+
return Promise.reject(validateResponse.error.details);
|
|
2234
|
+
}
|
|
2009
2235
|
const data = {
|
|
2010
2236
|
currentOrdSts: "ACCEPTED",
|
|
2011
2237
|
token: Token,
|
|
@@ -2041,14 +2267,7 @@ class EdelweissAPIConnect {
|
|
|
2041
2267
|
euinflag: "N",
|
|
2042
2268
|
physicalFlag: "D",
|
|
2043
2269
|
};
|
|
2044
|
-
|
|
2045
|
-
const validateResponse = validateCancelMF(data);
|
|
2046
|
-
if (validateResponse.error) {
|
|
2047
|
-
log4js.debug(
|
|
2048
|
-
"CancelMF validation error -" + validateResponse.error.details
|
|
2049
|
-
);
|
|
2050
|
-
return Promise.reject(validateResponse.error.details);
|
|
2051
|
-
}
|
|
2270
|
+
|
|
2052
2271
|
log4js.debug("CancelMF Data :" + JSON.stringify(data));
|
|
2053
2272
|
const url = this.__config.CancelMFURL(this.__constants.eqAccId);
|
|
2054
2273
|
log4js.debug("CancelMF URLS -" + url);
|
|
@@ -2074,8 +2293,8 @@ class EdelweissAPIConnect {
|
|
|
2074
2293
|
|
|
2075
2294
|
/**
|
|
2076
2295
|
* Login function
|
|
2077
|
-
* @param {string} source apiKey provided by
|
|
2078
|
-
* @param {string} password password provided by
|
|
2296
|
+
* @param {string} source apiKey provided by APIConnect
|
|
2297
|
+
* @param {string} password password provided by APIConnect
|
|
2079
2298
|
* @returns Promise \
|
|
2080
2299
|
* if resolved, then returns object in the form of `{msg: string, success: boolean}` \
|
|
2081
2300
|
* if rejected, returns error
|
|
@@ -2201,11 +2420,11 @@ class EdelweissAPIConnect {
|
|
|
2201
2420
|
}
|
|
2202
2421
|
}
|
|
2203
2422
|
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2423
|
+
APIConnect.prototype.__constants = new __Constants();
|
|
2424
|
+
APIConnect.prototype.__config = new __Config();
|
|
2425
|
+
APIConnect.prototype.__http = new __Http(
|
|
2426
|
+
APIConnect.prototype.__constants,
|
|
2427
|
+
APIConnect.prototype.__config.baseurl
|
|
2209
2428
|
);
|
|
2210
2429
|
|
|
2211
|
-
module.exports = {
|
|
2430
|
+
module.exports = { APIConnect };
|