Dear Support, If I am having a bracket order and I don't square it off programmatically and it get squared of by RMS at 15:20 is it that a charge of Rs 40 per trade is charged ?
If there is a charge of Rs 40 in case of auto square off then it makes sense to code the auto square off programmatically to close all trades before 15:20
1. The bracket order is placed 2. The bracket order (buy or sell) is executed and trigger and target pending 3. order_cancel is run passing variety="bo" and parent_order_id of bracket order and this would square off the bracket order at market price
OrderException: Please select a valid BO Order to Exit
Below is the code. Tabbing was not working so I used underscore here to show tab space
orders = kite.orders() for order in orders: ____try: ________kite.order_cancel(str(l['order_id']), variety="bo") ____except: ________kite.order_cancel(str(l['order_id']), variety="bo", parent_order_id=str(l['parent_order_id']))
Doesn't kite.order_cancel return a response instead of error ? If it returns a response, I can use it to continue else I would have to use double try/except because of this
I think the URL is wrong. Is it this route /regular or /bo also it doesn't mention parent_order_id, which is mentioned that it is required in bracket order
I mean how can I get the correct way to cancel the order at 15:00 hours programmatically
But note it is not exiting the executed order. It is just canceling the Target and SL.
Now my executed Buy is standing in positions dashboard and I don't know how to square it off. Even i I click exit on it on web UI, now it is taking me to the Order's tab, canceled trade
Means order_cancel is actually just canceling the trigger and target. It is not exiting my buy and sell positions standing in Positions Tab
@tonystark route /bo doesn't exit was the message that I got. Are you sure /bo exists ? Please check for xxx154 cancel requests that came for /bo route and got an error response
When you send the above request the system will take care of canceling one order and modifying the other to market which will result in closing the position.
then you are canceling this order as normal order and at the end, you will end up canceling both second orders and your position will remain open.
In the above scenario when an open position exists, you need to place a market MIS order of opposite transaction type and inform our RMS about it so that there won't be confusion while doing MIS square off.
Means I need to only pass TP order_id and parent_order_id
Ok about now closing the positions that are open. If I now take reverse MIS position of equal quantity for all positions that are exiting, will that cancel the position ?
Also where should I write to RMS ? Time is less and I need to email them quickly to avoid 3:20pm open position penalty
You need to call support and speak to someone from RMS. This time, we have informed RMS and they will take care of it. Just for confirmation, Can you name the tradingsymbol for which this issue has happened?
You can check out Bulletin for details about Call N Trade charges for admin square-off of intra-day positions.
You mean use this
order_modify(
self, order_id, parent_order_id=None, exchange=None, tradingsymbol=None, transaction_type=None, quantity=None, price=None, order_type=None, product=None, trigger_price=0, validity='DAY', disclosed_quantity=0, variety='regular')
And because I place only bracket orders, what fields would be mandatory for making bracket order as market order ?
parent_order_id
order_type
?
Sorry am using Python not Java. If you can point me to Python module
So please confirm below
1. The bracket order is placed
2. The bracket order (buy or sell) is executed and trigger and target pending
3. order_cancel is run passing variety="bo" and parent_order_id of bracket order and this would square off the bracket order at market price
to use like this?
kite.order_cancel(variety="bo", parent_order_id="VALUE")
One last question. So not only will this cancel orders that are executed and standing for StopLoss or Target
But will also cancel bracket orders that were never executed because their limit order was never executed and therefore don't have SL and TP order
Got this error when using just variety and parent_order_id
TypeError: order_cancel() takes at least 2 arguments (3 given)
order_id, parent_order_id
171207000447158, 171207000433530
171207000447159, 171207000433530
What should have been the way to cancel it ?
kite.order_cancel("171207000447158" , "bo", "171207000433530")
to exit after first leg is executed.If the first leg is not executed then you can cancel like this
kite.order_cancel("171207000433530" , "bo")
Below is the code. Tabbing was not working so I used underscore here to show tab space
orders = kite.orders()
for order in orders:
____try:
________kite.order_cancel(str(l['order_id']), variety="bo")
____except:
________kite.order_cancel(str(l['order_id']), variety="bo", parent_order_id=str(l['parent_order_id']))
# Exit / cancel a bracket order.
import requests
response = requests.delete("https://api.kite.trade/orders/regular/151220000000000?api_key=xxx&access_token=yyy")
I think the URL is wrong. Is it this route /regular or /bo
also it doesn't mention parent_order_id, which is mentioned that it is required in bracket order
I mean how can I get the correct way to cancel the order at 15:00 hours programmatically
So it is only working like this
kite.order_cancel(order_id=order['order_id'], variety="regular", parent_order_id=order['parent_order_id'])
in API also valid route is just /regular
But note it is not exiting the executed order. It is just canceling the Target and SL.
Now my executed Buy is standing in positions dashboard and I don't know how to square it off. Even i I click exit on it on web UI, now it is taking me to the Order's tab, canceled trade
Means order_cancel is actually just canceling the trigger and target. It is not exiting my buy and sell positions standing in Positions Tab
What is this ?
If you are using our API directly you can find the example in documentation directly below the one you posted:
# Exit / cancel a bracket order.
curl --request DELETE \
"https://api.kite.trade/orders/bo/151220000000000?api_key=xxx&access_token=yyy&parent_order_id=151210000000000"
@sujith
@Pushwinder
Before that let me put things clearly
IOC SELL Bracket Order executed
Now standing SL and TP as below
name, order_id, parent_order_id
IOC 171211000832542 171211000832538 OPEN
IOC 171211000832543 171211000832538 TRIGGER PENDING
I want to square off the trade at market to get out of it
Please give URLs made for these. Note there are two order_id - one for TP and one for SL and have same parent_order_id
curl --request DELETE \
"https://api.kite.trade/orders/bo/171211000832542?api_key=xxx&access_token=yyy&parent_order_id= 171211000832538"
When you send the above request the system will take care of canceling one order and modifying the other to market which will result in closing the position.
If you cancel order like this,
curl --request DELETE \
"https://api.kite.trade/orders/regular/171211000832542?api_key=xxx&access_token=yyy
then you are canceling this order as normal order and at the end, you will end up canceling both second orders and your position will remain open.
In the above scenario when an open position exists, you need to place a market MIS order of opposite transaction type and inform our RMS about it so that there won't be confusion while doing MIS square off.
Finally, this worked
"https://api.kite.trade/orders/bo/171211000832542?api_key=xxx&access_token=yyy&parent_order_id= 171211000832538"
Means I need to only pass TP order_id and parent_order_id
Ok about now closing the positions that are open. If I now take reverse MIS position of equal quantity for all positions that are exiting, will that cancel the position ?
Also where should I write to RMS ? Time is less and I need to email them quickly to avoid 3:20pm open position penalty
This time, we have informed RMS and they will take care of it.
Just for confirmation, Can you name the tradingsymbol for which this issue has happened?
Thanks
Stocks are below. I have taken reverse quantity position
ADANIPOWER
IFCI
MARICO
PVR
RCOM