diff --git a/dist/smartapi-java-2.2.3.jar b/dist/smartapi-java-2.2.3.jar
new file mode 100644
index 0000000..95ce7db
Binary files /dev/null and b/dist/smartapi-java-2.2.3.jar differ
diff --git a/pom.xml b/pom.xml
index 9bef3eb..4b22945 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.angelbroking.smartapi
smartapi-java
- 2.2.2
+ 2.2.3
jar
smartapi-java
diff --git a/src/main/java/com/angelbroking/smartapi/Routes.java b/src/main/java/com/angelbroking/smartapi/Routes.java
index b44ed22..83a781f 100644
--- a/src/main/java/com/angelbroking/smartapi/Routes.java
+++ b/src/main/java/com/angelbroking/smartapi/Routes.java
@@ -50,6 +50,14 @@ public Routes() {
put("api.market.data", "/rest/secure/angelbroking/market/v1/quote");
put("api.margin.batch", "/rest/secure/angelbroking/margin/v1/batch");
put("api.individual.order", "/rest/secure/angelbroking/order/v1/details/");
+ put("api.estimateCharges", "/rest/secure/angelbroking/brokerage/v1/estimateCharges");
+ put("api.verifyDis", "/rest/secure/angelbroking/edis/v1/verifyDis");
+ put("api.generateTPIN", "/rest/secure/angelbroking/edis/v1/generateTPIN");
+ put("api.getTranStatus", "/rest/secure/angelbroking/edis/v1/getTranStatus");
+ put("api.optionGreek", "/rest/secure/angelbroking/marketData/v1/optionGreek");
+ put("api.gainersLosers", "/rest/secure/angelbroking/marketData/v1/gainersLosers");
+ put("api.putCallRatio", "/rest/secure/angelbroking/marketData/v1/putCallRatio");
+ put("api.oIBuildup", "/rest/secure/angelbroking/marketData/v1/OIBuildup");
}
};
}
diff --git a/src/main/java/com/angelbroking/smartapi/SmartConnect.java b/src/main/java/com/angelbroking/smartapi/SmartConnect.java
index 82545ec..bfff450 100644
--- a/src/main/java/com/angelbroking/smartapi/SmartConnect.java
+++ b/src/main/java/com/angelbroking/smartapi/SmartConnect.java
@@ -862,5 +862,168 @@ public JSONObject getIndividualOrderDetails(String orderId) throws IOException,
throw new JSONException(String.format("%s while fetching margin data %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
}
}
+
+
+ public JSONObject estimateCharges(List estimateChargesParams) throws IOException, SmartAPIException {
+ try {
+ JSONArray ordersArray = new JSONArray();
+
+ for (EstimateChargesParams params : estimateChargesParams) {
+ JSONObject order = new JSONObject();
+ order.put("product_type", params.product_type);
+ order.put("transaction_type", params.transaction_type);
+ order.put("quantity", params.quantity);
+ order.put("price", params.price);
+ order.put("exchange", params.exchange);
+ order.put("symbol_name", params.symbol_name);
+ order.put("token", params.token);
+ ordersArray.put(order);
+ }
+
+ JSONObject requestBody = new JSONObject();
+ requestBody.put("orders", ordersArray);
+
+ String url = routes.get("api.estimateCharges");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, requestBody, accessToken);
+ return response;
+ } catch (SmartAPIException ex) {
+ log.error("{} while fetching estimateCharges data {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s while fetching estimateCharges data %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while fetching estimateCharges data {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s while fetching estimateCharges data %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while fetching estimateCharges data {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s while fetching estimateCharges data %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+ public JSONObject verifyDis(JSONObject params) throws SmartAPIException, IOException {
+ try{
+ String url = routes.get("api.verifyDis");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, params, accessToken);
+ return response;
+ }catch (SmartAPIException ex) {
+ log.error("{} while verifyDis {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in verifyDis %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while verifyDis {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s in verifyDis %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while verifyDis {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s in verifyDis %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+ public JSONObject generateTPIN(JSONObject params) throws SmartAPIException, IOException {
+ try{
+ String url = routes.get("api.generateTPIN");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, params, accessToken);
+ return response;
+ }catch (SmartAPIException ex) {
+ log.error("{} while generateTPIN {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in generateTPIN %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while generateTPIN {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s in generateTPIN %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while generateTPIN {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s in generateTPIN %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+ public JSONObject getTranStatus(JSONObject params) throws SmartAPIException, IOException {
+ try{
+ String url = routes.get("api.getTranStatus");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, params, accessToken);
+ return response;
+ }catch (SmartAPIException ex) {
+ log.error("{} while getTranStatus {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in getTranStatus %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while getTranStatus {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s in getTranStatus %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while getTranStatus {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s in getTranStatus %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+ public JSONObject optionGreek(JSONObject params) throws SmartAPIException, IOException {
+ try{
+ String url = routes.get("api.optionGreek");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, params, accessToken);
+ return response;
+ }catch (SmartAPIException ex) {
+ log.error("{} while optionGreek {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in optionGreek %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while optionGreek {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s in optionGreek %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while optionGreek {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s in optionGreek %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+ public JSONObject gainersLosers(JSONObject params) throws SmartAPIException, IOException {
+ try{
+ String url = routes.get("api.gainersLosers");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, params, accessToken);
+ return response;
+ }catch (SmartAPIException ex) {
+ log.error("{} while gainersLosers {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in gainersLosers %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while gainersLosers {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s in gainersLosers %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while gainersLosers {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s in gainersLosers %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+ public JSONObject putCallRatio() throws IOException, SmartAPIException {
+ try {
+ String url = routes.get("api.putCallRatio");
+ JSONObject response = smartAPIRequestHandler.getRequest(this.apiKey, url, accessToken);
+ return response;
+ } catch (SmartAPIException ex) {
+ log.error("{} while getting putCallRatio {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in getting putCallRatio %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while getting putCallRatio {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s while fetching putCallRatio data %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while getting putCallRatio {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s while fetching putCallRatio data %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ }
+ }
+
+ public JSONObject oIBuildup(JSONObject params) throws SmartAPIException, IOException {
+ try{
+ String url = routes.get("api.oIBuildup");
+ JSONObject response = smartAPIRequestHandler.postRequest(this.apiKey, url, params, accessToken);
+ return response;
+ }catch (SmartAPIException ex) {
+ log.error("{} while oIBuildup {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
+ throw new SmartAPIException(String.format("%s in oIBuildup %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
+ } catch (IOException ex) {
+ log.error("{} while oIBuildup {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new IOException(String.format("%s in oIBuildup %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
+ } catch (JSONException ex) {
+ log.error("{} while oIBuildup {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
+ throw new JSONException(String.format("%s in oIBuildup %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
+
+ }
+ }
+
+
}
diff --git a/src/main/java/com/angelbroking/smartapi/models/EstimateChargesParams.java b/src/main/java/com/angelbroking/smartapi/models/EstimateChargesParams.java
new file mode 100644
index 0000000..955140d
--- /dev/null
+++ b/src/main/java/com/angelbroking/smartapi/models/EstimateChargesParams.java
@@ -0,0 +1,12 @@
+package com.angelbroking.smartapi.models;
+
+public class EstimateChargesParams {
+
+ public String product_type;
+ public String transaction_type;
+ public String quantity;
+ public String price;
+ public String exchange;
+ public String symbol_name;
+ public String token;
+}
diff --git a/src/main/java/com/angelbroking/smartapi/sample/APITest.java b/src/main/java/com/angelbroking/smartapi/sample/APITest.java
index 1ba8185..01a383a 100644
--- a/src/main/java/com/angelbroking/smartapi/sample/APITest.java
+++ b/src/main/java/com/angelbroking/smartapi/sample/APITest.java
@@ -110,6 +110,22 @@ public static void main(String[] args) throws SmartAPIException {
/* log.info("Individual Order"); */
examples.getIndividualOrder(smartConnect, "1000051");
+ examples.estimateCharges(smartConnect);
+
+ examples.verifyDis(smartConnect);
+
+ examples.generateTPIN(smartConnect);
+
+ examples.getTranStatus(smartConnect);
+
+ examples.optionGreek(smartConnect);
+
+ examples.gainersLosers(smartConnect);
+
+ examples.putCallRatio(smartConnect);
+
+ examples.oIBuildup(smartConnect);
+
/* SmartAPITicker */
String clientId = "";
diff --git a/src/main/java/com/angelbroking/smartapi/sample/Examples.java b/src/main/java/com/angelbroking/smartapi/sample/Examples.java
index 8098862..1a3746e 100644
--- a/src/main/java/com/angelbroking/smartapi/sample/Examples.java
+++ b/src/main/java/com/angelbroking/smartapi/sample/Examples.java
@@ -489,4 +489,87 @@ public void onOrderUpdate(String data) {
}
});
}
+
+ public void estimateCharges(SmartConnect smartConnect) throws SmartAPIException, IOException {
+ List estimateChargesParamsList = new ArrayList<>();
+ EstimateChargesParams estimate_Charges_Params = new EstimateChargesParams();
+ estimate_Charges_Params.product_type = Constants.PRODUCT_DELIVERY;
+ estimate_Charges_Params.transaction_type = Constants.TRANSACTION_TYPE_BUY;
+ estimate_Charges_Params.quantity = "10";
+ estimate_Charges_Params.price = "800";
+ estimate_Charges_Params.exchange = Constants.EXCHANGE_NSE;
+ estimate_Charges_Params.symbol_name = "745AS33";
+ estimate_Charges_Params.token = "17117";
+
+ estimateChargesParamsList.add(estimate_Charges_Params);
+
+ JSONObject jsonObject = smartConnect.estimateCharges(estimateChargesParamsList);
+ log.info("response {} ", jsonObject);
+ }
+
+ public void verifyDis(SmartConnect smartConnect) throws SmartAPIException, IOException {
+
+ JSONObject payload = new JSONObject();
+ payload.put("isin", "INE242A01010");
+ payload.put("quantity", "1");
+
+ JSONObject jsonObject = smartConnect.verifyDis(payload);
+ log.info("response {} ", jsonObject);
+ }
+
+ public void generateTPIN(SmartConnect smartConnect) throws SmartAPIException, IOException {
+
+ JSONObject payload = new JSONObject();
+ payload.put("dpId", "33200");
+ payload.put("ReqId", "1431307824801952");
+ payload.put("boid", "1203320018563571");
+ payload.put("pan", "JZTPS2255C");
+
+ JSONObject jsonObject = smartConnect.generateTPIN(payload);
+ log.info("response {} ", jsonObject);
+ }
+
+ public void getTranStatus(SmartConnect smartConnect) throws SmartAPIException, IOException {
+
+ JSONObject payload = new JSONObject();
+ payload.put("ReqId", "1431307824801952");
+
+ JSONObject jsonObject = smartConnect.getTranStatus(payload);
+ log.info("response {} ", jsonObject);
+ }
+
+ public void optionGreek(SmartConnect smartConnect) throws SmartAPIException, IOException {
+
+ JSONObject payload = new JSONObject();
+ payload.put("name", "TCS");
+ payload.put("expirydate", "25MAR2024");
+
+ JSONObject jsonObject = smartConnect.optionGreek(payload);
+ log.info("response {} ", jsonObject);
+ }
+
+ public void gainersLosers(SmartConnect smartConnect) throws SmartAPIException, IOException {
+
+ JSONObject payload = new JSONObject();
+ payload.put("datatype", "PercOIGainers");
+ payload.put("expirytype", "NEAR");
+
+ JSONObject jsonObject = smartConnect.gainersLosers(payload);
+ log.info("response {} ", jsonObject);
+ }
+
+ public void putCallRatio(SmartConnect smartConnect) throws SmartAPIException, IOException {
+ JSONObject response = smartConnect.putCallRatio();
+ log.info("response {} ", response);
+ }
+
+ public void oIBuildup(SmartConnect smartConnect) throws SmartAPIException, IOException {
+
+ JSONObject payload = new JSONObject();
+ payload.put("expirytype", "NEAR");
+ payload.put("datatype", "Long Built Up");
+
+ JSONObject jsonObject = smartConnect.oIBuildup(payload);
+ log.info("response {} ", jsonObject);
+ }
}
diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml
index 8fa85a9..f43cad9 100644
--- a/src/main/resources/logback.xml
+++ b/src/main/resources/logback.xml
@@ -5,8 +5,23 @@
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+ INFO
+ DENY
+ ACCEPT
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+
+
+
+
+
+
+