queryParams, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
updateParamsForAuth(authNames, queryParams, headerParams);
headerParams.put("X-Upstox-SDK-Language","java");
- headerParams.put("X-Upstox-SDK-Version","1.19");
+ headerParams.put("X-Upstox-SDK-Version","1.20");
final String url = buildUrl(path, queryParams, collectionQueryParams);
final Request.Builder reqBuilder = new Request.Builder().url(url);
processHeaderParams(headerParams, reqBuilder);
diff --git a/src/main/java/com/upstox/api/GttRule.java b/src/main/java/com/upstox/api/GttRule.java
index 4eba5b9..1c6d8ba 100644
--- a/src/main/java/com/upstox/api/GttRule.java
+++ b/src/main/java/com/upstox/api/GttRule.java
@@ -130,6 +130,9 @@ public TriggerTypeEnum read(final JsonReader jsonReader) throws IOException {
@SerializedName("trailing_gap")
private Double trailingGap = null;
+ @SerializedName("market_protection")
+ private Double marketProtection = null;
+
public GttRule strategy(StrategyEnum strategy) {
this.strategy = strategy;
return this;
@@ -202,6 +205,24 @@ public void setTrailingGap(Double trailingGap) {
this.trailingGap = trailingGap;
}
+ public GttRule marketProtection(Double marketProtection) {
+ this.marketProtection = marketProtection;
+ return this;
+ }
+
+ /**
+ * Market price protection (optional).
+ * @return marketProtection
+ **/
+ @Schema(description = "Market price protection (optional).")
+ public Double getMarketProtection() {
+ return marketProtection;
+ }
+
+ public void setMarketProtection(Double marketProtection) {
+ this.marketProtection = marketProtection;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -215,12 +236,13 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(this.strategy, gttRule.strategy) &&
Objects.equals(this.triggerType, gttRule.triggerType) &&
Objects.equals(this.triggerPrice, gttRule.triggerPrice) &&
- Objects.equals(this.trailingGap, gttRule.trailingGap);
+ Objects.equals(this.trailingGap, gttRule.trailingGap) &&
+ Objects.equals(this.marketProtection, gttRule.marketProtection);
}
@Override
public int hashCode() {
- return Objects.hash(strategy, triggerType, triggerPrice, trailingGap);
+ return Objects.hash(strategy, triggerType, triggerPrice, trailingGap, marketProtection);
}
@@ -233,6 +255,7 @@ public String toString() {
sb.append(" triggerType: ").append(toIndentedString(triggerType)).append("\n");
sb.append(" triggerPrice: ").append(toIndentedString(triggerPrice)).append("\n");
sb.append(" trailingGap: ").append(toIndentedString(trailingGap)).append("\n");
+ sb.append(" marketProtection: ").append(toIndentedString(marketProtection)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/src/main/java/com/upstox/api/ModifyOrderRequest.java b/src/main/java/com/upstox/api/ModifyOrderRequest.java
index f85a72a..b1e692d 100644
--- a/src/main/java/com/upstox/api/ModifyOrderRequest.java
+++ b/src/main/java/com/upstox/api/ModifyOrderRequest.java
@@ -139,6 +139,9 @@ public OrderTypeEnum read(final JsonReader jsonReader) throws IOException {
@SerializedName("trigger_price")
private Float triggerPrice = null;
+ @SerializedName("market_protection")
+ private Float marketProtection = null;
+
public ModifyOrderRequest quantity(Integer quantity) {
this.quantity = quantity;
return this;
@@ -265,6 +268,24 @@ public void setTriggerPrice(Float triggerPrice) {
this.triggerPrice = triggerPrice;
}
+ public ModifyOrderRequest marketProtection(Float marketProtection) {
+ this.marketProtection = marketProtection;
+ return this;
+ }
+
+ /**
+ * Market price protection (optional).
+ * @return marketProtection
+ **/
+ @Schema(description = "Market price protection (optional).")
+ public Float getMarketProtection() {
+ return marketProtection;
+ }
+
+ public void setMarketProtection(Float marketProtection) {
+ this.marketProtection = marketProtection;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -281,12 +302,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.orderId, modifyOrderRequest.orderId) &&
Objects.equals(this.orderType, modifyOrderRequest.orderType) &&
Objects.equals(this.disclosedQuantity, modifyOrderRequest.disclosedQuantity) &&
- Objects.equals(this.triggerPrice, modifyOrderRequest.triggerPrice);
+ Objects.equals(this.triggerPrice, modifyOrderRequest.triggerPrice) &&
+ Objects.equals(this.marketProtection, modifyOrderRequest.marketProtection);
}
@Override
public int hashCode() {
- return Objects.hash(quantity, validity, price, orderId, orderType, disclosedQuantity, triggerPrice);
+ return Objects.hash(quantity, validity, price, orderId, orderType, disclosedQuantity, triggerPrice, marketProtection);
}
@@ -302,6 +324,7 @@ public String toString() {
sb.append(" orderType: ").append(toIndentedString(orderType)).append("\n");
sb.append(" disclosedQuantity: ").append(toIndentedString(disclosedQuantity)).append("\n");
sb.append(" triggerPrice: ").append(toIndentedString(triggerPrice)).append("\n");
+ sb.append(" marketProtection: ").append(toIndentedString(marketProtection)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/src/main/java/com/upstox/api/MultiOrderRequest.java b/src/main/java/com/upstox/api/MultiOrderRequest.java
index 55a358c..040dd45 100644
--- a/src/main/java/com/upstox/api/MultiOrderRequest.java
+++ b/src/main/java/com/upstox/api/MultiOrderRequest.java
@@ -245,6 +245,9 @@ public TransactionTypeEnum read(final JsonReader jsonReader) throws IOException
@SerializedName("correlation_id")
private String correlationId = null;
+ @SerializedName("market_protection")
+ private Float marketProtection = null;
+
public MultiOrderRequest quantity(Integer quantity) {
this.quantity = quantity;
return this;
@@ -479,6 +482,24 @@ public void setCorrelationId(String correlationId) {
this.correlationId = correlationId;
}
+ public MultiOrderRequest marketProtection(Float marketProtection) {
+ this.marketProtection = marketProtection;
+ return this;
+ }
+
+ /**
+ * Market price protection (optional).
+ * @return marketProtection
+ **/
+ @Schema(description = "Market price protection (optional).")
+ public Float getMarketProtection() {
+ return marketProtection;
+ }
+
+ public void setMarketProtection(Float marketProtection) {
+ this.marketProtection = marketProtection;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -501,12 +522,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.disclosedQuantity, multiOrderRequest.disclosedQuantity) &&
Objects.equals(this.triggerPrice, multiOrderRequest.triggerPrice) &&
Objects.equals(this.isAmo, multiOrderRequest.isAmo) &&
- Objects.equals(this.correlationId, multiOrderRequest.correlationId);
+ Objects.equals(this.correlationId, multiOrderRequest.correlationId) &&
+ Objects.equals(this.marketProtection, multiOrderRequest.marketProtection);
}
@Override
public int hashCode() {
- return Objects.hash(quantity, product, validity, price, tag, slice, instrumentToken, orderType, transactionType, disclosedQuantity, triggerPrice, isAmo, correlationId);
+ return Objects.hash(quantity, product, validity, price, tag, slice, instrumentToken, orderType, transactionType, disclosedQuantity, triggerPrice, isAmo, correlationId, marketProtection);
}
@@ -528,6 +550,7 @@ public String toString() {
sb.append(" triggerPrice: ").append(toIndentedString(triggerPrice)).append("\n");
sb.append(" isAmo: ").append(toIndentedString(isAmo)).append("\n");
sb.append(" correlationId: ").append(toIndentedString(correlationId)).append("\n");
+ sb.append(" marketProtection: ").append(toIndentedString(marketProtection)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/src/main/java/com/upstox/api/PlaceOrderV3Request.java b/src/main/java/com/upstox/api/PlaceOrderV3Request.java
index bd69cc7..f55a537 100644
--- a/src/main/java/com/upstox/api/PlaceOrderV3Request.java
+++ b/src/main/java/com/upstox/api/PlaceOrderV3Request.java
@@ -242,6 +242,9 @@ public TransactionTypeEnum read(final JsonReader jsonReader) throws IOException
@SerializedName("is_amo")
private Boolean isAmo = null;
+ @SerializedName("market_protection")
+ private Float marketProtection = null;
+
public PlaceOrderV3Request quantity(Integer quantity) {
this.quantity = quantity;
return this;
@@ -458,6 +461,24 @@ public void setIsAmo(Boolean isAmo) {
this.isAmo = isAmo;
}
+ public PlaceOrderV3Request marketProtection(Float marketProtection) {
+ this.marketProtection = marketProtection;
+ return this;
+ }
+
+ /**
+ * Market price protection (optional).
+ * @return marketProtection
+ **/
+ @Schema(description = "Market price protection (optional).")
+ public Float getMarketProtection() {
+ return marketProtection;
+ }
+
+ public void setMarketProtection(Float marketProtection) {
+ this.marketProtection = marketProtection;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -479,12 +500,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.transactionType, placeOrderV3Request.transactionType) &&
Objects.equals(this.disclosedQuantity, placeOrderV3Request.disclosedQuantity) &&
Objects.equals(this.triggerPrice, placeOrderV3Request.triggerPrice) &&
- Objects.equals(this.isAmo, placeOrderV3Request.isAmo);
+ Objects.equals(this.isAmo, placeOrderV3Request.isAmo) &&
+ Objects.equals(this.marketProtection, placeOrderV3Request.marketProtection);
}
@Override
public int hashCode() {
- return Objects.hash(quantity, product, validity, price, tag, slice, instrumentToken, orderType, transactionType, disclosedQuantity, triggerPrice, isAmo);
+ return Objects.hash(quantity, product, validity, price, tag, slice, instrumentToken, orderType, transactionType, disclosedQuantity, triggerPrice, isAmo, marketProtection);
}
@@ -505,6 +527,7 @@ public String toString() {
sb.append(" disclosedQuantity: ").append(toIndentedString(disclosedQuantity)).append("\n");
sb.append(" triggerPrice: ").append(toIndentedString(triggerPrice)).append("\n");
sb.append(" isAmo: ").append(toIndentedString(isAmo)).append("\n");
+ sb.append(" marketProtection: ").append(toIndentedString(marketProtection)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/src/main/java/com/upstox/api/TokenRequest.java b/src/main/java/com/upstox/api/TokenRequest.java
index db378df..9140339 100644
--- a/src/main/java/com/upstox/api/TokenRequest.java
+++ b/src/main/java/com/upstox/api/TokenRequest.java
@@ -43,6 +43,9 @@ public class TokenRequest {
@SerializedName("grant_type")
private String grantType = null;
+ @SerializedName("refresh_extended_token")
+ private Boolean refreshExtendedToken = null;
+
public TokenRequest code(String code) {
this.code = code;
return this;
@@ -133,6 +136,24 @@ public void setGrantType(String grantType) {
this.grantType = grantType;
}
+ public TokenRequest refreshExtendedToken(Boolean refreshExtendedToken) {
+ this.refreshExtendedToken = refreshExtendedToken;
+ return this;
+ }
+
+ /**
+ * Whether to generate an extended token along with the access token
+ * @return refreshExtendedToken
+ **/
+ @Schema(description = "Whether to generate an extended token along with the access token")
+ public Boolean isRefreshExtendedToken() {
+ return refreshExtendedToken;
+ }
+
+ public void setRefreshExtendedToken(Boolean refreshExtendedToken) {
+ this.refreshExtendedToken = refreshExtendedToken;
+ }
+
@Override
public boolean equals(java.lang.Object o) {
@@ -147,12 +168,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.clientId, tokenRequest.clientId) &&
Objects.equals(this.clientSecret, tokenRequest.clientSecret) &&
Objects.equals(this.redirectUri, tokenRequest.redirectUri) &&
- Objects.equals(this.grantType, tokenRequest.grantType);
+ Objects.equals(this.grantType, tokenRequest.grantType) &&
+ Objects.equals(this.refreshExtendedToken, tokenRequest.refreshExtendedToken);
}
@Override
public int hashCode() {
- return Objects.hash(code, clientId, clientSecret, redirectUri, grantType);
+ return Objects.hash(code, clientId, clientSecret, redirectUri, grantType, refreshExtendedToken);
}
@@ -166,6 +188,7 @@ public String toString() {
sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n");
sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n");
sb.append(" grantType: ").append(toIndentedString(grantType)).append("\n");
+ sb.append(" refreshExtendedToken: ").append(toIndentedString(refreshExtendedToken)).append("\n");
sb.append("}");
return sb.toString();
}
diff --git a/src/main/java/io/swagger/client/api/LoginApi.java b/src/main/java/io/swagger/client/api/LoginApi.java
index e95920b..c31961d 100644
--- a/src/main/java/io/swagger/client/api/LoginApi.java
+++ b/src/main/java/io/swagger/client/api/LoginApi.java
@@ -487,7 +487,7 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
*/
public com.squareup.okhttp.Call tokenCall(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
-
+
// create path and map variables
String localVarPath = "/v2/login/authorization/token";
@@ -537,21 +537,21 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
-
+
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call tokenValidateBeforeCall(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
- // verify the required parameter 'apiVersion' is set
+ // verify the required parameter ‘apiVersion’ is set
if (apiVersion == null) {
- throw new ApiException("Missing the required parameter 'apiVersion' when calling token(Async)");
+ throw new ApiException("Missing the required parameter ‘apiVersion’ when calling token(Async)");
}
-
+
com.squareup.okhttp.Call call = tokenCall(apiVersion, code, clientId, clientSecret, redirectUri, grantType, progressListener, progressRequestListener);
return call;
-
-
-
-
+
+
+
+
}
/**
@@ -628,4 +628,148 @@ public void onRequestProgress(long bytesWritten, long contentLength, boolean don
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
+
+ // Overloaded token methods with refreshExtendedToken
+
+ public com.squareup.okhttp.Call tokenCall(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, Boolean refreshExtendedToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ Object localVarPostBody = null;
+
+ String localVarPath = "/v2/login/authorization/token";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+
+ Map localVarHeaderParams = new HashMap();
+ if (apiVersion != null)
+ localVarHeaderParams.put("Api-Version", apiClient.parameterToString(apiVersion));
+
+ Map localVarFormParams = new HashMap();
+ if (code != null)
+ localVarFormParams.put("code", code);
+ if (clientId != null)
+ localVarFormParams.put("client_id", clientId);
+ if (clientSecret != null)
+ localVarFormParams.put("client_secret", clientSecret);
+ if (redirectUri != null)
+ localVarFormParams.put("redirect_uri", redirectUri);
+ if (grantType != null)
+ localVarFormParams.put("grant_type", grantType);
+ if (refreshExtendedToken != null)
+ localVarFormParams.put("refresh_extended_token", refreshExtendedToken);
+
+ final String[] localVarAccepts = {
+ "application/json", "*/*"
+ };
+ final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
+
+ final String[] localVarContentTypes = {
+ "application/x-www-form-urlencoded"
+ };
+ final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ if(progressListener != null) {
+ apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
+ @Override
+ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
+ com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), progressListener))
+ .build();
+ }
+ });
+ }
+
+ String[] localVarAuthNames = new String[] { };
+ return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private com.squareup.okhttp.Call tokenValidateBeforeCall(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, Boolean refreshExtendedToken, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
+ if (apiVersion == null) {
+ throw new ApiException("Missing the required parameter ‘apiVersion’ when calling token(Async)");
+ }
+
+ com.squareup.okhttp.Call call = tokenCall(apiVersion, code, clientId, clientSecret, redirectUri, grantType, refreshExtendedToken, progressListener, progressRequestListener);
+ return call;
+ }
+
+ /**
+ * Get token API
+ * This API provides the functionality to obtain opaque token from authorization_code exchange and also provides the user’s profile in the same response.
+ * @param apiVersion API Version Header (required)
+ * @param code (optional)
+ * @param clientId (optional)
+ * @param clientSecret (optional)
+ * @param redirectUri (optional)
+ * @param grantType (optional)
+ * @param refreshExtendedToken (optional)
+ * @return TokenResponse
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public TokenResponse token(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, Boolean refreshExtendedToken) throws ApiException {
+ ApiResponse resp = tokenWithHttpInfo(apiVersion, code, clientId, clientSecret, redirectUri, grantType, refreshExtendedToken);
+ return resp.getData();
+ }
+
+ /**
+ * Get token API
+ * This API provides the functionality to obtain opaque token from authorization_code exchange and also provides the user’s profile in the same response.
+ * @param apiVersion API Version Header (required)
+ * @param code (optional)
+ * @param clientId (optional)
+ * @param clientSecret (optional)
+ * @param redirectUri (optional)
+ * @param grantType (optional)
+ * @param refreshExtendedToken (optional)
+ * @return ApiResponse<TokenResponse>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ */
+ public ApiResponse tokenWithHttpInfo(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, Boolean refreshExtendedToken) throws ApiException {
+ com.squareup.okhttp.Call call = tokenValidateBeforeCall(apiVersion, code, clientId, clientSecret, redirectUri, grantType, refreshExtendedToken, null, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return apiClient.execute(call, localVarReturnType);
+ }
+
+ /**
+ * Get token API (asynchronously)
+ * This API provides the functionality to obtain opaque token from authorization_code exchange and also provides the user’s profile in the same response.
+ * @param apiVersion API Version Header (required)
+ * @param code (optional)
+ * @param clientId (optional)
+ * @param clientSecret (optional)
+ * @param redirectUri (optional)
+ * @param grantType (optional)
+ * @param refreshExtendedToken (optional)
+ * @param callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ */
+ public com.squareup.okhttp.Call tokenAsync(String apiVersion, String code, String clientId, String clientSecret, String redirectUri, String grantType, Boolean refreshExtendedToken, final ApiCallback callback) throws ApiException {
+
+ ProgressResponseBody.ProgressListener progressListener = null;
+ ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
+
+ if (callback != null) {
+ progressListener = new ProgressResponseBody.ProgressListener() {
+ @Override
+ public void update(long bytesRead, long contentLength, boolean done) {
+ callback.onDownloadProgress(bytesRead, contentLength, done);
+ }
+ };
+
+ progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
+ @Override
+ public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
+ callback.onUploadProgress(bytesWritten, contentLength, done);
+ }
+ };
+ }
+
+ com.squareup.okhttp.Call call = tokenValidateBeforeCall(apiVersion, code, clientId, clientSecret, redirectUri, grantType, refreshExtendedToken, progressListener, progressRequestListener);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ apiClient.executeAsync(call, localVarReturnType, callback);
+ return call;
+ }
}
diff --git a/src/test/java/com/upstox/sanity/GttModifyOrderV3Test.java b/src/test/java/com/upstox/sanity/GttModifyOrderV3Test.java
index 6e5b0f0..a01dab1 100644
--- a/src/test/java/com/upstox/sanity/GttModifyOrderV3Test.java
+++ b/src/test/java/com/upstox/sanity/GttModifyOrderV3Test.java
@@ -30,6 +30,7 @@ public static void main(String[] args) {
entryRule.setStrategy(GttRule.StrategyEnum.ENTRY);
entryRule.setTriggerType(GttRule.TriggerTypeEnum.ABOVE);
entryRule.setTriggerPrice(7D);
+ entryRule.setMarketProtection(0D);
gttRules.add(entryRule);
GttRule stopLossRule = new GttRule();
diff --git a/src/test/java/com/upstox/sanity/GttPlaceOrderV3Test.java b/src/test/java/com/upstox/sanity/GttPlaceOrderV3Test.java
index 37997d3..b72f672 100644
--- a/src/test/java/com/upstox/sanity/GttPlaceOrderV3Test.java
+++ b/src/test/java/com/upstox/sanity/GttPlaceOrderV3Test.java
@@ -29,6 +29,7 @@ public static void main(String[] args) {
entryRule.setStrategy(GttRule.StrategyEnum.ENTRY);
entryRule.setTriggerType(GttRule.TriggerTypeEnum.ABOVE);
entryRule.setTriggerPrice(7D);
+ entryRule.setMarketProtection(0D);
gttRules.add(entryRule);
GttRule stopLossRule = new GttRule();
diff --git a/src/test/java/com/upstox/sanity/ModifyOrderV3Test.java b/src/test/java/com/upstox/sanity/ModifyOrderV3Test.java
index 322e2d1..7edaab3 100644
--- a/src/test/java/com/upstox/sanity/ModifyOrderV3Test.java
+++ b/src/test/java/com/upstox/sanity/ModifyOrderV3Test.java
@@ -23,6 +23,7 @@ public static void main(String[] args) {
body.setTriggerPrice(0F);
body.setOrderType(ModifyOrderRequest.OrderTypeEnum.LIMIT);
body.setOrderId("250128010532402");
+ body.setMarketProtection(0F);
String apiVersion = "2.0"; // String | API Version Header
try {
ModifyOrderV3Response result = apiInstance.modifyOrder(body);
diff --git a/src/test/java/com/upstox/sanity/PlaceMultiOrderTest.java b/src/test/java/com/upstox/sanity/PlaceMultiOrderTest.java
index 2928c09..116099f 100644
--- a/src/test/java/com/upstox/sanity/PlaceMultiOrderTest.java
+++ b/src/test/java/com/upstox/sanity/PlaceMultiOrderTest.java
@@ -32,6 +32,7 @@ public static void main(String[] args) {
request1.setIsAmo(true);
request1.setCorrelationId("cid1");
request1.setSlice(true);
+ request1.setMarketProtection(0F);
MultiOrderRequest request2 = new MultiOrderRequest();
@@ -48,6 +49,7 @@ public static void main(String[] args) {
request2.setIsAmo(true);
request2.setCorrelationId("cid2");
request2.setSlice(true);
+ request2.setMarketProtection(2F);
String apiVersion = "2.0"; // String | API Version Header
try {
diff --git a/src/test/java/com/upstox/sanity/PlaceOrderV3Test.java b/src/test/java/com/upstox/sanity/PlaceOrderV3Test.java
index a844411..991c2eb 100644
--- a/src/test/java/com/upstox/sanity/PlaceOrderV3Test.java
+++ b/src/test/java/com/upstox/sanity/PlaceOrderV3Test.java
@@ -28,6 +28,7 @@ public static void main(String[] args) {
body.setDisclosedQuantity(0);
body.setTriggerPrice(0F);
body.setIsAmo(true);
+ body.setMarketProtection(0F);
String apiVersion = "2.0"; // String | API Version Header
try {
diff --git a/src/test/java/com/upstox/sanity/TokenTest.java b/src/test/java/com/upstox/sanity/TokenTest.java
new file mode 100644
index 0000000..5069119
--- /dev/null
+++ b/src/test/java/com/upstox/sanity/TokenTest.java
@@ -0,0 +1,27 @@
+package com.upstox.sanity;
+
+import com.upstox.ApiException;
+import com.upstox.api.TokenResponse;
+import io.swagger.client.api.LoginApi;
+
+public class TokenTest {
+ public static void main(String[] args) {
+ LoginApi apiInstance = new LoginApi();
+ String apiVersion = "2.0";
+ String code = "{authCode}";
+ String clientId = "{client_id}";
+ String clientSecret = "{client_secret}";
+ String redirectUri = "{redirect_url}";
+ String grantType = "authorization_code";
+ try {
+ TokenResponse result = apiInstance.token(apiVersion, code, clientId, clientSecret, redirectUri, grantType,true);
+ System.out.println(result);
+ } catch (ApiException e) {
+ if(!e.getResponseBody().contains("UDAPI100069")){
+ System.err.println("Exception when calling LoginApi#token");
+ e.printStackTrace();
+ }
+
+ }
+ }
+}