Skip to content
Merged
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ SmartAPI is a set of REST-like APIs that expose many capabilities required to bu
JSONObject response = smartConnect.getHolding();
}

/** Get All Holdings */
public void getAllHolding(SmartConnect smartConnect) throws SmartAPIException, IOException {
// Returns Holdings.
JSONObject response = smartConnect.getAllHolding();
}

/** Get Position */
public void getPosition(SmartConnect smartConnect) throws SmartAPIException, IOException {
// Returns Position.
Expand Down
2 changes: 1 addition & 1 deletion doc/com/angelbroking/smartapi/sample/Test.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h2 title="Class Test" class="title">Class Test</h2>
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.angelbroking.smartapi.sample.Test</li>
<li>com.angelbroking.smartapi.sample.APITest</li>
</ul>
</li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions doc/com/angelbroking/smartapi/sample/class-use/Test.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_161) on Wed Dec 23 16:24:07 IST 2020 -->
<title>Uses of Class com.angelbroking.smartapi.sample.Test</title>
<title>Uses of Class com.angelbroking.smartapi.sample.APITest</title>
<meta name="date" content="2020-12-23">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
Expand Down Expand Up @@ -70,9 +70,9 @@
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.angelbroking.smartapi.sample.Test" class="title">Uses of Class<br>com.angelbroking.smartapi.sample.Test</h2>
<h2 title="Uses of Class com.angelbroking.smartapi.sample.APITest" class="title">Uses of Class<br>com.angelbroking.smartapi.sample.APITest</h2>
</div>
<div class="classUseContainer">No usage of com.angelbroking.smartapi.sample.Test</div>
<div class="classUseContainer">No usage of com.angelbroking.smartapi.sample.APITest</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/angelbroking/smartapi/Routes.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public Routes() {
put("api.order.book", "/rest/secure/angelbroking/order/v1/getOrderBook");
put("api.order.trade.book", "/rest/secure/angelbroking/order/v1/getTradeBook");
put("api.order.rms.data", "/rest/secure/angelbroking/user/v1/getRMS");
put("api.order.rms.AllHolding", "/rest/secure/angelbroking/portfolio/v1/getAllHolding");
put("api.order.rms.holding", "/rest/secure/angelbroking/portfolio/v1/getHolding");
put("api.order.rms.position", "/rest/secure/angelbroking/order/v1/getPosition");
put("api.order.rms.position.convert", "/rest/secure/angelbroking/order/v1/convertPosition");
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/angelbroking/smartapi/SmartConnect.java
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,29 @@ public JSONObject getHolding() {
}
}


/**
* Retrieves All Holdings.
*
* @return Object of Holding.
*
*/
public JSONObject getAllHolding() throws SmartAPIException, IOException {
try {
String url = routes.get("api.order.rms.AllHolding");
return smartAPIRequestHandler.getRequest(this.apiKey, url, accessToken);
} catch (SmartAPIException ex) {
log.error("{} while getting all holdings {}", SMART_API_EXCEPTION_OCCURRED, ex.toString());
throw new SmartAPIException(String.format("%s in getting all holdings %s", SMART_API_EXCEPTION_ERROR_MSG, ex));
} catch (IOException ex) {
log.error("{} while getting all holdings {}", IO_EXCEPTION_OCCURRED, ex.getMessage());
throw new IOException(String.format("%s in getting all holdings %s", IO_EXCEPTION_ERROR_MSG, ex.getMessage()));
} catch (JSONException ex) {
log.error("{} while getting all holdings {}", JSON_EXCEPTION_OCCURRED, ex.getMessage());
throw new JSONException(String.format("%s in getting all holdings %s", JSON_EXCEPTION_ERROR_MSG, ex.getMessage()));
}
}

/**
* Retrieves position.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.angelbroking.smartapi.http.exceptions.SmartAPIException;
import com.angelbroking.smartapi.models.User;

public class Test {
public class APITest {

public static void main(String[] args) throws SmartAPIException {
try {
Expand Down Expand Up @@ -63,6 +63,9 @@ public static void main(String[] args) throws SmartAPIException {
/* System.out.println("getHolding"); */
examples.getHolding(smartConnect);

/* System.out.println("getAllHolding"); */
examples.getAllHolding(smartConnect);

/* System.out.println("getPosition"); */
examples.getPosition(smartConnect);

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/angelbroking/smartapi/sample/Examples.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ public void getHolding(SmartConnect smartConnect) throws SmartAPIException, IOEx
JSONObject response = smartConnect.getHolding();
}

/** Get All Holdings */
public void getAllHolding(SmartConnect smartConnect) throws SmartAPIException, IOException {
// Returns All Holding.
JSONObject response = smartConnect.getAllHolding();
}

/** Get Position */
public void getPosition(SmartConnect smartConnect) throws SmartAPIException, IOException {
// Returns Position.
Expand Down