api_connect_nodejs 2.0.5 → 2.0.6

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/conf/settings.ini CHANGED
@@ -9,7 +9,7 @@ BasePathContent = https://nc.nuvamawealth.com/edelmw-content/content/
9
9
  EquityContractURL = https://nc.nuvamawealth.com/app/toccontracts/instruments.zip
10
10
  MFContractURL = https://nc.nuvamawealth.com/app/toccontracts/mfInstruments.zip
11
11
 
12
- ApiIdKey = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHAiOjAsImZmIjoiVyIsImJkIjoid2ViLXBjIiwibmJmIjoxNjkwNTQxNTQ5LCJzcmMiOiJlbXRtdyIsImF2IjoiMi4wLjUiLCJhcHBpZCI6IjQ5ZTJhNjU1MzAyZTYyM2NhZGEwMTQ2NWRkZTZiODgyIiwiaXNzIjoiZW10IiwiZXhwIjoxNjkwNTY5MDAwLCJpYXQiOjE2OTA1NDE4NDl9.n4N2-F5TWQoizi87_Tv7DyNxdizAa0IKdIS0RqZ4l1w
12
+ ApiIdKey = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHAiOjAsImZmIjoiVyIsImJkIjoid2ViLXBjIiwibmJmIjoxNjk4OTk0MTM1LCJzcmMiOiJlbXRtdyIsImF2IjoiMi4wLjYiLCJhcHBpZCI6IjhjZmE0MGJiYmUxMjQ5MGM2YzhjYzMwOWNlZmViZGQzIiwiaXNzIjoiZW10IiwiZXhwIjoxNjk5MDM2MjAwLCJpYXQiOjE2OTg5OTQ0MzV9.rwTusEQqt0VuYlW1-MSsixJm3RJGQTj2AFt8e_GsY3o
13
13
  TlsVersion = 1.2
14
14
  LogLevel = All
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api_connect_nodejs",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Command to run :",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@joi/date": "^2.1.0",
11
+ "api_connect_nodejs": "file:api_connect_nodejs-2.0.6.tgz",
11
12
  "chai": "^4.3.6",
12
13
  "csv-parser": "^3.0.0",
13
14
  "csv-writer": "^1.6.0",
package/src/apiConnect.js CHANGED
@@ -112,6 +112,7 @@ class APIConnect {
112
112
  this.__constants.AppIdKey = j.appidkey;
113
113
  this.__constants.profileId = j.data.data.lgnData.accs.prfId;
114
114
  this.__constants.prds = j.data.data.lgnData.prds;
115
+ this.__constants.accs = j.data.data.lgnData.accs;
115
116
  this.excsAndprdDpNm = this.__constants.getProductsAndExchange(
116
117
  this.__constants.prds
117
118
  );
@@ -1037,17 +1038,20 @@ class APIConnect {
1037
1038
  rmk: "",
1038
1039
  flQty: true,
1039
1040
  };
1040
- log4js.debug("PlaceTrade Data :" + JSON.stringify(data));
1041
+
1041
1042
  if (Exchange == "MCX" || Exchange == "NCDEX") {
1043
+ log4js.debug("PlaceTrade Data :" + JSON.stringify(data));
1042
1044
  const url = this.__config.PlaceTradeURL_comm(this.__constants.coAccId);
1043
1045
  log4js.debug("PlaceTrade URL -" + url);
1044
1046
  var result = this.__http.PostMethod(url, data);
1045
1047
  log4js.debug("PlaceTrade Result :" + JSON.stringify(result));
1046
1048
  return result;
1047
1049
  } else {
1050
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1048
1051
  const url = this.__config.PlaceTradeURL(this.__constants.eqAccId);
1049
1052
  log4js.debug("PlaceTrade URL -" + url);
1050
- var result = this.__http.PostMethod(url, data);
1053
+ log4js.debug("PlaceTrade Data :" + JSON.stringify(upadatedData));
1054
+ var result = this.__http.PostMethod(url, upadatedData);
1051
1055
  log4js.debug("PlaceTrade Result :" + JSON.stringify(result));
1052
1056
  return result;
1053
1057
  }
@@ -1157,6 +1161,7 @@ class APIConnect {
1157
1161
  * @param {string} Disclosed_Quantity Quantity to be disclosed while order placement
1158
1162
  * @param {string} TriggerPrice Trigger Price applicable for SL/SL-M Orders
1159
1163
  * @param {string} ProductCode CNC | MIS | NRML | MTF
1164
+ * @param {string} CurrentQuantity
1160
1165
  * @returns Promise that resolves/rejects to Modify Order api response
1161
1166
  */
1162
1167
  ModifyTrade = (
@@ -1171,7 +1176,8 @@ class APIConnect {
1171
1176
  Order_ID,
1172
1177
  Disclosed_Quantity = "0",
1173
1178
  TriggerPrice = "0",
1174
- ProductCode
1179
+ ProductCode,
1180
+ CurrentQuantity = "0"
1175
1181
  ) => {
1176
1182
  log4js.info("Inside ModifyTrade method");
1177
1183
  const paramsObj = {
@@ -1187,6 +1193,7 @@ class APIConnect {
1187
1193
  dscQty: Disclosed_Quantity,
1188
1194
  trgPrc: TriggerPrice,
1189
1195
  prdCode: ProductCode,
1196
+ curQty: CurrentQuantity,
1190
1197
  };
1191
1198
  const validateResponse = validateModifyTrade(
1192
1199
  paramsObj,
@@ -1217,17 +1224,20 @@ class APIConnect {
1217
1224
  valid: false,
1218
1225
  };
1219
1226
 
1220
- log4js.debug("ModifyTrade Data :" + JSON.stringify(data));
1221
1227
  if (Exchange == "MCX" || Exchange == "NCDEX") {
1222
1228
  const url = this.__config.ModifyTradeURL_comm(this.__constants.coAccId);
1223
1229
  log4js.debug("ModifyTrade URLS -" + url);
1230
+ log4js.debug("ModifyTrade Data :" + JSON.stringify(data));
1224
1231
  var result = this.__http.PutMethod(url, data);
1225
1232
  log4js.debug("ModifyTrade Result :" + JSON.stringify(result));
1226
1233
  return result;
1227
1234
  } else {
1235
+ data.curQty = CurrentQuantity;
1236
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1228
1237
  const url = this.__config.ModifyTradeURL(this.__constants.eqAccId);
1229
1238
  log4js.debug("ModifyTrade URLS -" + url);
1230
- var result = this.__http.PutMethod(url, data);
1239
+ log4js.debug("ModifyTrade Data :" + JSON.stringify(upadatedData));
1240
+ var result = this.__http.PutMethod(url, upadatedData);
1231
1241
  log4js.debug("ModifyTrade Result :" + JSON.stringify(result));
1232
1242
  return result;
1233
1243
  }
@@ -1238,9 +1248,20 @@ class APIConnect {
1238
1248
  * @param {string} Exchange Exchange
1239
1249
  * @param {string'} Order_Type LIMIT | MARKET | STOP_LIMIT | STOP_MARKET
1240
1250
  * @param {string} ProductCode CNC | MIS | NRML | MTF
1251
+ * @param {string} CurrentQuantity
1241
1252
  * @returns Promise that resolves/rejects to Cancel Trade api response
1242
1253
  */
1243
- CancelTrade = (OrderId, Exchange, Order_Type, ProductCode) => {
1254
+ CancelTrade = (
1255
+ OrderId,
1256
+ Exchange,
1257
+ Order_Type,
1258
+ ProductCode,
1259
+ CurrentQuantity = "0",
1260
+ FillQuantity = "0",
1261
+ Trading_Symbol,
1262
+ Action,
1263
+ Streaming_Symbol,
1264
+ ) => {
1244
1265
  log4js.info("Inside CancelTrade method");
1245
1266
  const data = {
1246
1267
  nstOID: OrderId,
@@ -1248,27 +1269,49 @@ class APIConnect {
1248
1269
  prdCode: this.__constants.getValidProductCode(this.fileName, Exchange, ProductCode),
1249
1270
  ordTyp: Order_Type,
1250
1271
  };
1251
- const validateResponse = validateCancelPlaceTrade(
1252
- data,
1253
- this.excsAndprdDpNm
1254
- );
1255
- if (validateResponse.error) {
1256
- log4js.debug(
1257
- "CancelTrade validation error -" + validateResponse.error.details
1258
- );
1259
- return Promise.reject(validateResponse.error.details);
1260
- }
1261
- log4js.debug("CancelTrade Data :" + JSON.stringify(data));
1272
+
1262
1273
  if (Exchange == "MCX" || Exchange == "NCDEX") {
1274
+ const validateResponse = validateCancelPlaceTrade(
1275
+ data,
1276
+ this.excsAndprdDpNm
1277
+ );
1278
+ if (validateResponse.error) {
1279
+ log4js.debug(
1280
+ "CancelTrade validation error -" + validateResponse.error.details
1281
+ );
1282
+ return Promise.reject(validateResponse.error.details);
1283
+ }
1284
+ log4js.debug("CancelTrade Data :" + JSON.stringify(data));
1285
+
1263
1286
  const url = this.__config.CancelTradeURL_comm(this.__constants.coAccId);
1264
1287
  log4js.debug("CancelTrade URLS -" + url);
1265
1288
  var result = this.__http.PutMethod(url, data);
1266
1289
  log4js.debug("CancelTrade Result :" + JSON.stringify(result));
1267
1290
  return result;
1268
1291
  } else {
1292
+
1293
+ data.curQty = CurrentQuantity;
1294
+ data.flQty = FillQuantity;
1295
+ data.trdSym = Trading_Symbol;
1296
+ data.action = Action;
1297
+ data.sym = Streaming_Symbol;
1298
+
1299
+ const validateResponse = validateCancelPlaceTradeV1(
1300
+ data,
1301
+ this.excsAndprdDpNm
1302
+ );
1303
+ if (validateResponse.error) {
1304
+ log4js.debug(
1305
+ "CancelTrade validation error -" + validateResponse.error.details
1306
+ );
1307
+ return Promise.reject(validateResponse.error.details);
1308
+ }
1309
+
1310
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1269
1311
  const url = this.__config.CancelTradeURL(this.__constants.eqAccId);
1270
1312
  log4js.debug("CancelTrade URLS -" + url);
1271
- var result = this.__http.PutMethod(url, data);
1313
+ log4js.debug("CancelTrade Data :" + JSON.stringify(upadatedData));
1314
+ var result = this.__http.PutMethod(url, upadatedData);
1272
1315
  log4js.debug("CancelTrade Result :" + JSON.stringify(result));
1273
1316
  return result;
1274
1317
  }
@@ -1584,17 +1627,19 @@ class APIConnect {
1584
1627
  rmk: "",
1585
1628
  };
1586
1629
 
1587
- log4js.debug("PlaceAMOTrade Data :" + JSON.stringify(data));
1588
1630
  if (Exchange == "MCX" || Exchange == "NCDEX") {
1589
1631
  const url = this.__config.PlaceAMOTrade_comm(this.__constants.coAccId);
1590
1632
  log4js.debug("PlaceAMOTrade URLS -" + url);
1633
+ log4js.debug("PlaceAMOTrade Data :" + JSON.stringify(data));
1591
1634
  var result = this.__http.PostMethod(url, data);
1592
1635
  log4js.debug("PlaceAMOTrade Result :" + JSON.stringify(result));
1593
1636
  return result;
1594
1637
  } else {
1638
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1595
1639
  const url = this.__config.PlaceAMOTrade(this.__constants.eqAccId);
1596
1640
  log4js.debug("PlaceAMOTrade URLS -" + url);
1597
- var result = this.__http.PostMethod(url, data);
1641
+ log4js.debug("PlaceAMOTrade Data :" + JSON.stringify(upadatedData));
1642
+ var result = this.__http.PostMethod(url, upadatedData);
1598
1643
  log4js.debug("PlaceAMOTrade Result :" + JSON.stringify(result));
1599
1644
  return result;
1600
1645
  }
@@ -1614,6 +1659,7 @@ class APIConnect {
1614
1659
  * @param {string} Disclosed_Quantity Quantity to be disclosed while order_placement
1615
1660
  * @param {string} TriggerPrice Trigger Price applicable for SL/SL-M Orders
1616
1661
  * @param {string} ProductCode Product Code of the trade
1662
+ * @param {string} CurrentQuantity
1617
1663
  * @returns Promise that resolves/rejects to the Place AMO Trade api response
1618
1664
  */
1619
1665
  ModifyAMOTrade = (
@@ -1628,7 +1674,8 @@ class APIConnect {
1628
1674
  Order_ID,
1629
1675
  Disclosed_Quantity = "0",
1630
1676
  TriggerPrice = "0",
1631
- ProductCode
1677
+ ProductCode,
1678
+ CurrentQuantity = "0"
1632
1679
  ) => {
1633
1680
  log4js.info("Inside ModifyAMOTrade method");
1634
1681
  const paramsObj = {
@@ -1644,6 +1691,7 @@ class APIConnect {
1644
1691
  dscQty: Disclosed_Quantity,
1645
1692
  trgPrc: TriggerPrice,
1646
1693
  prdCode: ProductCode,
1694
+ curQty: CurrentQuantity,
1647
1695
  };
1648
1696
  const validateResponse = validateModifyAMOTrade(
1649
1697
  paramsObj,
@@ -1673,17 +1721,20 @@ class APIConnect {
1673
1721
  nstOID: Order_ID,
1674
1722
  };
1675
1723
 
1676
- log4js.debug("ModifyAMOTrade Data :" + JSON.stringify(data));
1677
1724
  if (Exchange == "MCX" || Exchange == "NCDEX") {
1678
1725
  const url = this.__config.ModifyAMOTrade_comm(this.__constants.coAccId);
1679
1726
  log4js.debug("ModifyAMOTrade URLS" + url);
1727
+ log4js.debug("ModifyAMOTrade Data :" + JSON.stringify(data));
1680
1728
  var result = this.__http.PutMethod(url, data);
1681
1729
  log4js.debug("ModifyAMOTrade Result :" + JSON.stringify(result));
1682
1730
  return result;
1683
1731
  } else {
1732
+ data.curQty = CurrentQuantity;
1733
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1684
1734
  const url = this.__config.ModifyAMOTrade(this.__constants.eqAccId);
1685
1735
  log4js.debug("ModifyAMOTrade URLS" + url);
1686
- var result = this.__http.PutMethod(url, data);
1736
+ log4js.debug("ModifyAMOTrade Data :" + JSON.stringify(upadatedData));
1737
+ var result = this.__http.PutMethod(url, upadatedData);
1687
1738
  log4js.debug("ModifyAMOTrade Result :" + JSON.stringify(result));
1688
1739
  return result;
1689
1740
  }
@@ -1695,34 +1746,65 @@ class APIConnect {
1695
1746
  * @param {string} Exchange Exchange
1696
1747
  * @param {'LIMIT' | 'MARKET' | 'STOP_LIMIT' | 'STOP_MARKET'} Order_Type LIMIT | MARKET | STOP_LIMIT | STOP_MARKET
1697
1748
  * @param {'CNC' | 'MIS' | 'NRML' | 'MTF'} Product_Code CNC | MIS | NRML | MTF
1749
+ * @param {string} CurrentQuantity
1698
1750
  * @returns Promise that resolves/rejects to the Cancel AMO Trade api response
1699
1751
  */
1700
- CancelAMOTrade = (OrderId, Exchange, Order_Type, Product_Code) => {
1752
+ CancelAMOTrade = (
1753
+ OrderId,
1754
+ Exchange,
1755
+ Order_Type,
1756
+ Product_Code,
1757
+ CurrentQuantity = "0",
1758
+ FillQuantity = "0",
1759
+ Trading_Symbol,
1760
+ Action,
1761
+ Streaming_Symbol,
1762
+ ) => {
1701
1763
  const data = {
1702
1764
  nstOID: OrderId,
1703
1765
  exc: Exchange,
1704
1766
  prdCode: this.__constants.getValidProductCode(this.fileName, Exchange, Product_Code),
1705
1767
  ordTyp: Order_Type,
1768
+ curQty: CurrentQuantity,
1706
1769
  };
1707
1770
  log4js.info("Inside CancelAMOTrade method");
1708
- const validateResponse = validateCancelAMOTrade(data, this.excsAndprdDpNm);
1709
- if (validateResponse.error) {
1710
- log4js.debug(
1711
- "CancelAMOTrade validation error -" + validateResponse.error.details
1712
- );
1713
- return Promise.reject(validateResponse.error.details);
1714
- }
1715
- log4js.debug("CancelAMOTrade Data :" + JSON.stringify(data));
1771
+
1716
1772
  if (Exchange == "MCX" || Exchange == "NCDEX") {
1773
+ const validateResponse = validateCancelAMOTrade(data, this.excsAndprdDpNm);
1774
+ if (validateResponse.error) {
1775
+ log4js.debug(
1776
+ "CancelAMOTrade validation error -" + validateResponse.error.details
1777
+ );
1778
+ return Promise.reject(validateResponse.error.details);
1779
+ }
1780
+ log4js.debug("CancelAMOTrade Data :" + JSON.stringify(data));
1781
+
1717
1782
  const url = this.__config.CancelAMOTrade_comm(this.__constants.coAccId);
1718
1783
  log4js.debug("CancelAMOTrade URLS -" + url);
1719
1784
  var result = this.__http.PutMethod(url, data);
1720
1785
  log4js.debug("CancelAMOTrade Result :" + JSON.stringify(result));
1721
1786
  return result;
1722
1787
  } else {
1788
+
1789
+ data.curQty = CurrentQuantity;
1790
+ data.flQty = FillQuantity;
1791
+ data.trdSym = Trading_Symbol;
1792
+ data.action = Action;
1793
+ data.sym = Streaming_Symbol;
1794
+
1795
+ const validateResponse = validateCancelAMOTradeV1(data, this.excsAndprdDpNm);
1796
+ if (validateResponse.error) {
1797
+ log4js.debug(
1798
+ "CancelAMOTrade validation error -" + validateResponse.error.details
1799
+ );
1800
+ return Promise.reject(validateResponse.error.details);
1801
+ }
1802
+
1803
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1723
1804
  const url = this.__config.CancelAMOTrade(this.__constants.eqAccId);
1724
1805
  log4js.debug("CancelAMOTrade URLS -" + url);
1725
- var result = this.__http.PutMethod(url, data);
1806
+ log4js.debug("CancelAMOTrade Data :" + JSON.stringify(upadatedData));
1807
+ var result = this.__http.PutMethod(url, upadatedData);
1726
1808
  log4js.debug("CancelAMOTrade Result :" + JSON.stringify(result));
1727
1809
  return result;
1728
1810
  }
@@ -1738,7 +1820,6 @@ class APIConnect {
1738
1820
  orderlist,
1739
1821
  this.excsAndprdDpNm
1740
1822
  );
1741
- console.log("PositionSquareOff", validateResponse);
1742
1823
  await Promise.all(
1743
1824
  validateResponse.map((item) => {
1744
1825
  if (item.error) {
@@ -1766,29 +1847,37 @@ class APIConnect {
1766
1847
  order["lmPrc"] = order.price;
1767
1848
  const data = order;
1768
1849
 
1769
- order.exc == "MCX" || order.exc == "NCDEX"
1770
- ? lstComm.push(data)
1771
- : lstEq.push(data);
1850
+ if(order.exc == "MCX" || order.exc == "NCDEX") {
1851
+ lstComm.push(data)
1852
+ }else {
1853
+ const upadatedData = this.__checkDependentAndUpdateData(data);
1854
+ {lstEq.push(upadatedData)};
1855
+ }
1772
1856
  });
1773
1857
 
1774
- const postEq = lstEq.length
1775
- ? await this.__http.PostMethod(
1776
- this.__config.PositionSqOffURL(this.__constants.eqAccId),
1777
- lstEq
1778
- )
1779
- : undefined;
1780
- const postComm = lstComm.length
1781
- ? await this.__http.PostMethod(
1782
- this.__config.PositionSqOffURL(this.__constants.coAccId),
1783
- lstComm
1784
- )
1785
- : undefined;
1786
- var result = Promise.all([postEq, postComm]).then(([eq, comm]) => ({
1787
- eq,
1788
- comm,
1789
- }));
1790
- log4js.debug("PositionSquareOff Result :" + JSON.stringify(result));
1791
- return result;
1858
+ const dataEq = {
1859
+ sqrLst: lstEq
1860
+ };
1861
+ if(Object.keys(dataEq).length > 0) {
1862
+ const postComm = ""
1863
+ const postEq = this.__http.PostMethod(this.__config.PositionSqOffV1URL(this.__constants.eqAccId),dataEq)
1864
+ var result = Promise.all([postEq, postComm]).then(([eq, comm]) => ({
1865
+ eq,
1866
+ comm,
1867
+ }));
1868
+ log4js.debug("PositionSquareOff Result :" + JSON.stringify(result));
1869
+ return result;
1870
+ } else if(Object.keys(lstComm).length > 0) {
1871
+ const postEq = ""
1872
+ const postComm = this.__http.PostMethod(this.__config.PositionSqOffURL(this.__constants.coAccId),lstComm)
1873
+ var result = Promise.all([postEq, postComm]).then(([eq, comm]) => ({
1874
+ eq,
1875
+ comm,
1876
+ }));
1877
+ log4js.debug("PositionSquareOff Result :" + JSON.stringify(result));
1878
+ return result;
1879
+ }
1880
+ return "";
1792
1881
  };
1793
1882
 
1794
1883
  /**
@@ -2287,6 +2376,7 @@ class APIConnect {
2287
2376
  this.__constants.coAccId = res.data.lgnData.accs.coAccID;
2288
2377
  }
2289
2378
  this.__constants.JSession = res.data.auth;
2379
+ this.__constants.accs = res.data.lgnData.accs;
2290
2380
  return res;
2291
2381
  })
2292
2382
  .then((res) => {
@@ -2385,6 +2475,20 @@ class APIConnect {
2385
2475
 
2386
2476
  return response;
2387
2477
  };
2478
+
2479
+ //CheckDependentAndUpdateData
2480
+ /**
2481
+ *
2482
+ * @param {map} CheckDependentAndUpdateData = (reqBodyData) => {
2483
+ * @returns map
2484
+ */
2485
+ __checkDependentAndUpdateData(reqBodyData) {
2486
+ let accountDataMap = this.__constants.accs;
2487
+ if(accountDataMap.hasOwnProperty("empOrDependent")) {
2488
+ reqBodyData.empOrDependent = accountDataMap.empOrDependent;
2489
+ }
2490
+ return reqBodyData;
2491
+ }
2388
2492
  }
2389
2493
 
2390
2494
  APIConnect.prototype.__constants = new __Constants();
package/src/config.js CHANGED
@@ -133,7 +133,7 @@ class __Config {
133
133
  };
134
134
 
135
135
  PlaceTradeURL = function (userid) {
136
- return this.baseurleq + "trade/placetrade/" + userid;
136
+ return this.baseurleq + "trade/placetrade/v1/" + userid;
137
137
  };
138
138
 
139
139
  PlaceTradeURL_comm = function (userid) {
@@ -193,7 +193,7 @@ class __Config {
193
193
  };
194
194
 
195
195
  ModifyTradeURL = function (userid) {
196
- return this.baseurleq + "trade/modifytrade/" + userid;
196
+ return this.baseurleq + "trade/modifytrade/v1/" + userid;
197
197
  };
198
198
 
199
199
  ModifyTradeURL_comm = function (userid) {
@@ -237,6 +237,10 @@ class __Config {
237
237
  return this.baseurleq + "trade/position/sqroff/" + userid;
238
238
  };
239
239
 
240
+ PositionSqOffV1URL = function (userid) {
241
+ return this.baseurleq + "trade/position/sqroff/v1/" + userid;
242
+ };
243
+
240
244
  ConvertPositionURL = function (userid) {
241
245
  return this.baseurleq + "trade/convertposition/v1/" + userid;
242
246
  };
@@ -246,7 +250,7 @@ class __Config {
246
250
  };
247
251
 
248
252
  PlaceAMOTrade = function (userid) {
249
- return this.baseurleq + "trade/amo/placetrade/" + userid;
253
+ return this.baseurleq + "trade/amo/placetrade/v1/" + userid;
250
254
  };
251
255
 
252
256
  PlaceAMOTrade_comm = function (userid) {
@@ -254,7 +258,7 @@ class __Config {
254
258
  };
255
259
 
256
260
  ModifyAMOTrade = function (userid) {
257
- return this.baseurleq + "trade/amo/modifytrade/" + userid;
261
+ return this.baseurleq + "trade/amo/modifytrade/v1/" + userid;
258
262
  };
259
263
 
260
264
  ModifyAMOTrade_comm = function (userid) {
@@ -72,6 +72,7 @@ validateModifyTrade = (object, prds) => {
72
72
  // .valid(...prdName)
73
73
  .required(),
74
74
  nstOID: Joi.string().required(),
75
+ curQty: Joi.string().required(),
75
76
  }).options({ abortEarly: false });
76
77
 
77
78
  return modifyTradeSchema.validate(object);
@@ -98,6 +99,34 @@ validateCancelPlaceTrade = (object, prds) => {
98
99
  return cancelPlaceTradeSchema.validate(object);
99
100
  };
100
101
 
102
+ validateCancelPlaceTradeV1 = (object, prds) => {
103
+ // let prdName = [];
104
+ // if (prds.exc.includes(object.exc)) {
105
+ // prdName = prds.prd[object.exc];
106
+ // }
107
+ const cancelPlaceTradeSchema = Joi.object({
108
+ nstOID: Joi.string().required(),
109
+ exc: Joi.string()
110
+ .valid(...prds.exc)
111
+ .required(),
112
+ ordTyp: Joi.string()
113
+ .valid(...orderTypeArray)
114
+ .required(),
115
+ prdCode: Joi.string()
116
+ // .valid(...prdName)
117
+ .required(),
118
+ curQty: Joi.string().required(),
119
+ flQty: Joi.string().required(),
120
+ trdSym: Joi.string().required(),
121
+ action: Joi.string()
122
+ .valid(...actionTypeArray)
123
+ .required(),
124
+ sym: Joi.string().required(),
125
+ }).options({ abortEarly: false });
126
+
127
+ return cancelPlaceTradeSchema.validate(object);
128
+ };
129
+
101
130
  validatePlaceGtcGtdTrade = (object, prds) => {
102
131
  // let prdName = [];
103
132
  // if (prds.exc.includes(object.exc)) {
@@ -188,6 +217,7 @@ validateModifyAMOTrade = (object, prds) => {
188
217
  .required(),
189
218
  nstOID: Joi.string().required(),
190
219
  sym: Joi.string().required(),
220
+ curQty: Joi.string().required(),
191
221
  }).options({ abortEarly: false });
192
222
 
193
223
  return modifyAMOTradeSchema.validate(object);
@@ -214,6 +244,34 @@ validateCancelAMOTrade = (object, prds) => {
214
244
  return cancelAMOTradeSchema.validate(object);
215
245
  };
216
246
 
247
+ validateCancelAMOTradeV1 = (object, prds) => {
248
+ // let prdName = [];
249
+ // if (prds.exc.includes(object.exc)) {
250
+ // prdName = prds.prd[object.exc];
251
+ // }
252
+ const cancelAMOTradeSchema = Joi.object({
253
+ nstOID: Joi.string().required(),
254
+ exc: Joi.string()
255
+ .valid(...prds.exc)
256
+ .required(),
257
+ ordTyp: Joi.string()
258
+ .valid(...orderTypeArray)
259
+ .required(),
260
+ prdCode: Joi.string()
261
+ // .valid(...prdName)
262
+ .required(),
263
+ curQty: Joi.string().required(),
264
+ flQty: Joi.string().required(),
265
+ trdSym: Joi.string().required(),
266
+ action: Joi.string()
267
+ .valid(...actionTypeArray)
268
+ .required(),
269
+ sym: Joi.string().required(),
270
+ }).options({ abortEarly: false });
271
+
272
+ return cancelAMOTradeSchema.validate(object);
273
+ };
274
+
217
275
  validateConvertPositionCOMM = (object, prds) => {
218
276
  // let prdName = [];
219
277
  // if (prds.exc.includes(object.exc)) {