I am unable to do it. it was working fine for many months . Dont know why its not working now. atleast give me a sample code for how to change stop loss for cover orders
is this fine? kite.modify_order(order_id=order_id,variety=variety=kite.VARIETY_CO,parent_order_id=parent_order_id,\ quantity=int(pending_quantity), price=0, order_type=order_type, trigger_price=new_price,\ validity='DAY', disclosed_quantity=int(pending_quantity))
I'm also facing same problem - I'm trying to update SL-M (2nd leg) order of Cover Order. 2nd leg order is of BUY Type, where I'm changing trigger price to 460.45 and it is asking me to put a price lower than LTP, which is not making any sense to me as SL trigger price for SELL order should be more than LTP.
Rakeshr/Sujith, I am using correct order_id and everything was working perfectly fine from more than an year. Please i am requesting you guys again to give some sample code instead of asking to try something & pointing to some irrelevant links. please give me some solution?
-> how do we modify the stop loss market order for cover order after its triggered ( for 2nd leg) -> Do we need to give the parent order id also or not? -> is the below snippet correct or not??
@rakeshr, @sujith Yes. I'm using 2nd leg order id only. You can try yourself as well. My subscription is going to end in 4 days. Renewal depends on resolution of this thread. There is no point in wasting money. Please help.
For trigger pending buy orders API is expecting the price should be lesser than LTP ( instead of higher value). and when i give less price its accepting and executing but in the orders i see error message.
>>> kite.modify_order(order_id="211207201331813",variety=kite.VARIETY_CO,quantity=25,price=0, order_type=kite.ORDER_TYPE_LIMIT, trigger_price=1682.4,validity='DAY') DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443 DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "PUT /orders/co/211207201331813 HTTP/1.1" 400 363 Traceback (most recent call last): File "", line 1, in kite.modify_order(order_id="211207201331813",variety=kite.VARIETY_CO,quantity=25,price=0, order_type=kite.ORDER_TYPE_LIMIT, trigger_price=1682.4,validity='DAY') File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/kiteconnect/connect.py", line 371, in modify_order return self._put("order.modify", File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/kiteconnect/connect.py", line 830, in _put return self._request(route, "PUT", url_args=url_args, params=params, is_json=is_json) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/kiteconnect/connect.py", line 894, in _request raise exp(data["message"], code=r.status_code) kiteconnect.exceptions.InputException: Stoploss trigger price for the sell (exit) leg of the Cover order (CO) should be lower than the last traded price (1676.05). [Read more.](https://support.zerodha.com/category/trading-and-markets/margin-leverage-and-product-and-order-types/articles/what-are-cover-orders-and-how-to-use-them)
I saw the issue manually also sometimes while changing stop loss. it shows error saying trigger price should be lower than LTP . some issue from ur side. could you please help soon. its really blocking me
It looks like the modify request was sent with trigger price 1672.4, since for BUY stoploss the value should be greater than LTP, modify request is rejected. I think the price was around 1676 at the time you sent the request.
Oh God. . I sent with 1682.4 and not 1672.4 . And i am using these APIs from many months. and i know how to use them. And there is no issue with inputs and i tried all combinations.
Please look into the issue seriously and give some resolution.
@sujith Buddy, I have shared a screenshot with you. SL price failed from API but worked from UI. At that time the difference in SL that I tried putting was around 5%. I'm sure the price was not moving 5% up-down within seconds.
getting input exception
kite.modify_order(order_id=order_id,variety=kite.VARIETY_CO,parent_order_id=parent_order_id, \
quantity=int(pending_quantity), price=0, order_type=order_type, trigger_price=new_price,\
validity='DAY', disclosed_quantity=int(pending_quantity))
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "PUT /orders/co/211203201477596 HTTP/1.1" 400 362
[Fri, 03 Dec 2021 14:31:06] [Exception in Display & Modify Cover Orders ]
INFO:root:Exception in Display & Modify Cover Orders
kite.modify_order(order_id=order_id,variety=variety=kite.VARIETY_CO,parent_order_id=parent_order_id,\
quantity=int(pending_quantity), price=0, order_type=order_type, trigger_price=new_price,\
validity='DAY', disclosed_quantity=int(pending_quantity))
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "PUT /orders/co/211206100608902 HTTP/1.1" 400 362
[Mon, 06 Dec 2021 10:08:33] [Exception in Display & Modify Cover Orders ]
INFO:root:Exception in Display & Modify Cover Orders
You can paste the exception json here.
Error: Stoploss trigger price for the sell (exit) leg of the Cover order (CO) should be lower than the last traded price (457.2). [Read more.](https://support.zerodha.com/category/trading-and-markets/margin-leverage-and-product-and-order-types/articles/what-are-cover-orders-and-how-to-use-them)
Code:
order_id = self.kite.modify_order(
order_id='211206002218991',
variety=self.kite.VARIETY_CO,
order_type=self.kite.ORDER_TYPE_SLM,
price=None,
trigger_price=461.45
)
I'm able to modify this order from Kite App. Please help.
Attached is screenshot of another order. How such order looks when I'm trying to modify from code.
This thread explains more.
I am using correct order_id and everything was working perfectly fine from more than an year.
Please i am requesting you guys again to give some sample code instead of asking to try something & pointing to some irrelevant links. please give me some solution?
-> how do we modify the stop loss market order for cover order after its triggered ( for 2nd leg)
-> Do we need to give the parent order id also or not?
-> is the below snippet correct or not??
kite.modify_order(order_id=order_id,variety=variety=kite.VARIETY_CO,parent_order_id=parent_order_id,\
quantity=int(pending_quantity), price=0, order_type=order_type, trigger_price=new_price,\
validity='DAY', disclosed_quantity=int(pending_quantity))
For trigger pending buy orders API is expecting the price should be lesser than LTP ( instead of higher value). and when i give less price its accepting and executing but in the orders i see error message.
Its clearly api issue.
kiteconnect.exceptions.InputException: Stoploss trigger price for the sell (exit) leg of the Cover order (CO) should be lower than the last traded price (1676.05). [Read more.](https://support.zerodha.com/category/trading-and-markets/margin-leverage-and-product-and-order-types/articles/what-are-cover-orders-and-how-to-use-them)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.kite.trade:443
DEBUG:urllib3.connectionpool:https://api.kite.trade:443 "PUT /orders/co/211207201331813 HTTP/1.1" 400 363
Traceback (most recent call last):
File "", line 1, in
kite.modify_order(order_id="211207201331813",variety=kite.VARIETY_CO,quantity=25,price=0, order_type=kite.ORDER_TYPE_LIMIT, trigger_price=1682.4,validity='DAY')
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/kiteconnect/connect.py", line 371, in modify_order
return self._put("order.modify",
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/kiteconnect/connect.py", line 830, in _put
return self._request(route, "PUT", url_args=url_args, params=params, is_json=is_json)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/kiteconnect/connect.py", line 894, in _request
raise exp(data["message"], code=r.status_code)
kiteconnect.exceptions.InputException: Stoploss trigger price for the sell (exit) leg of the Cover order (CO) should be lower than the last traded price (1676.05). [Read more.](https://support.zerodha.com/category/trading-and-markets/margin-leverage-and-product-and-order-types/articles/what-are-cover-orders-and-how-to-use-them)
There is no issue with the code. This is something else. Are you modifying second leg or first leg order?
Why are you sending order type as LIMIT if it is second leg order?
I tried with "order_type=kite.ORDER_TYPE_SLM" also but still same issue.
I think the price was around 1676 at the time you sent the request.
And i am using these APIs from many months. and i know how to use them.
And there is no issue with inputs and i tried all combinations.
Please look into the issue seriously and give some resolution.
We are checking on this.
This is fixed.