public Order cancelOrder(String orderId, String variety) throws KiteException, JSONException, IOException {
        String url = routes.get("orders.cancel").replace(":variety", variety).replace(":order_id", orderId);
        Map<String, Object> params = new HashMap<String, Object>();

        JSONObject jsonObject = new KiteRequestHandler(proxy).deleteRequest(url, params, apiKey, accessToken);
        Order order =  new Order();
        order.orderId = jsonObject.getJSONObject("data").getString("order_id");
        return order;
    }
public Order cancelOrder ( String orderId , String variety ) throws KiteException , JSONException , IOException { String url = routes . get ( "orders.cancel" ) . replace ( ":variety" , variety ) . replace ( ":order_id" , orderId ) ; Map < String , Object > params = new HashMap < String , Object > ( ) ; JSONObject jsonObject = new KiteRequestHandler ( proxy ) . deleteRequest ( url , params , apiKey , accessToken ) ; Order order = new Order ( ) ; order . orderId = jsonObject . getJSONObject ( "data" ) . getString ( "order_id" ) ; return order ; }
Cancels an order.
@param orderId order id of the order to be cancelled.
@param variety [variety="regular"]. Order variety can be bo, co, amo, regular.
@return Order object contains only orderId.
@throws KiteException is thrown for all Kite trade related errors.
@throws JSONException is thrown when there is exception while parsing response.
@throws IOException is thrown when there is connection error.