I see the way to do COorder and see the documentation but there is no mentioned CO order; Is it regular order with product=CO and Orderype=Market and TriggerPrice? And does API place SL Order? in whichcase do we cancel the SL order for exit or do we need to place fresh order with Product=CO with opposite transaction type? to exit?
Example:- Stock: XYZ LTP: 545.25 You are Placing a BUY Cover Order with Trigger Price 540.55 The above will Place a BUY order at MARKET.(1st Leg) && a Stoploss SELL Order with Trigger Price 540.55(2nd Leg) You can Exit this Stoploss Order to Close Your CO. Here Exiting Means, Your Stoploss Order will be Modified to MARKET. No need to Place Opposite Order.
@jsudhams When we place CO order, the API call will return only the 1st leg order id. For stoploss Order Id, you have to call"https://api.kite.trade/orders?api_key=xxx&access_token=yyy". This will Return all Orders and you have to parse it to get the stoploss Order Id.
I am still confused with CO. In your above example of XYZ, how do i exit the position ? After the Buy order is executed, when I want to exit the position at 550 and LTP is 550, do I need to place a sell order @ market price and delete the existing Sell @ 540 ? What you mean by delete request will convert the SL Order to market ?
Kite Server will modify your Trigger Pending Stoploss order(TrgPrice:540) to Market Order(Ltp:550), So that your sell order will be completed, thus closing CO Position.
No need to place sell order market, if you place, this will initiate new position.
Here i.e. in case of CO, DELETE means not CANCEL but Modifying to Market Order Type.
For Regular Order DELETE means CANCEL of that Order.
CO is not a Regular Order.
curl https://api.kite.trade/orders/co \
-d "api_key=xxx" \
-d "access_token=yyy" \
-d "tradingsymbol=ACC" \
-d "exchange=NSE" \
-d "transaction_type=BUY" \
-d "quantity=1" \
-d "trigger_price=540.55" \
Example:-
Stock: XYZ
LTP: 545.25
You are Placing a BUY Cover Order with Trigger Price 540.55
The above will Place a BUY order at MARKET.(1st Leg)
&& a Stoploss SELL Order with Trigger Price 540.55(2nd Leg)
You can Exit this Stoploss Order to Close Your CO.
Here Exiting Means, Your Stoploss Order will be Modified to MARKET.
No need to Place Opposite Order.
When we place CO order, the API call will return only the 1st leg order id.
For stoploss Order Id, you have to call"https://api.kite.trade/orders?api_key=xxx&access_token=yyy".
This will Return all Orders and you have to parse it to get the stoploss Order Id.
You have to send DELETE Request
"https://api.kite.trade/orders/co/151220000000000?api_key=xxx&access_token=yyy&parent_order_id=151210000000000"
This will convert the Stoploss Order to Market & thus close the CO.
In your above example of XYZ, how do i exit the position ?
After the Buy order is executed, when I want to exit the position at 550 and LTP is 550, do I need to place a sell order @ market price and delete the existing Sell @ 540 ?
What you mean by delete request will convert the SL Order to market ?
When You send DELETE Request ""https://api.kite.trade/orders/co/151220000000000?api_key=xxx&access_token=yyy&parent_order_id=151210000000000"
Kite Server will modify your Trigger Pending Stoploss order(TrgPrice:540) to Market Order(Ltp:550), So that your sell order will be completed, thus closing CO Position.
No need to place sell order market, if you place, this will initiate new position.
Here i.e. in case of CO, DELETE means not CANCEL but Modifying to Market Order Type.
For Regular Order DELETE means CANCEL of that Order.
Hope this clears.