public Order placeOrder ( OrderParams orderParams , String variety ) throws KiteException , JSONException , IOException { String url = routes . get ( "orders.place" ) . replace ( ":variety" , variety ) ; Map < String , Object > params = new HashMap <> ( ) ; if ( orderParams . exchange != null ) params . put ( "exchange" , orderParams . exchange ) ; if ( orderParams . tradingsymbol != null ) params . put ( "tradingsymbol" , orderParams . tradingsymbol ) ; if ( orderParams . transactionType != null ) params . put ( "transaction_type" , orderParams . transactionType ) ; if ( orderParams . quantity != null ) params . put ( "quantity" , orderParams . quantity ) ; if ( orderParams . price != null ) params . put ( "price" , orderParams . price ) ; if ( orderParams . product != null ) params . put ( "product" , orderParams . product ) ; if ( orderParams . orderType != null ) params . put ( "order_type" , orderParams . orderType ) ; if ( orderParams . validity != null ) params . put ( "validity" , orderParams . validity ) ; if ( orderParams . disclosedQuantity != null ) params . put ( "disclosed_quantity" , orderParams . disclosedQuantity ) ; if ( orderParams . triggerPrice != null ) params . put ( "trigger_price" , orderParams . triggerPrice ) ; if ( orderParams . squareoff != null ) params . put ( "squareoff" , orderParams . squareoff ) ; if ( orderParams . stoploss != null ) params . put ( "stoploss" , orderParams . stoploss ) ; if ( orderParams . trailingStoploss != null ) params . put ( "trailing_stoploss" , orderParams . trailingStoploss ) ; if ( orderParams . tag != null ) params . put ( "tag" , orderParams . tag ) ; JSONObject jsonObject = new KiteRequestHandler ( proxy ) . postRequest ( url , params , apiKey , accessToken ) ; Order order = new Order ( ) ; order . orderId = jsonObject . getJSONObject ( "data" ) . getString ( "order_id" ) ; return order ; }
Places an order .