Not Able To Modify Bracket Order


Been trying to modify the limit order for an existing bracket order using the below code:

kite.order_modify(order_id = int(item["order_id"]), parent_order_id=int(item["parent_order_id"]), exchange='NFO', tradingsymbol=item["tradingsymbol"], transaction_type=item["transaction_type"], quantity=int(item["quantity"]), price=183, order_type='LIMIT', product='MIS', trigger_price=0, validity='DAY', disclosed_quantity=0, variety='bo')

But am getting an error related to parent_order_id as below although I am expliciting passing it after retreiving the same from the orderbook:

Traceback (most recent call last):
File "", line 3, in
File "C:\Python27\lib\site-packages\kiteconnect\", line 319, in order_modify
"parent_order_id": parent_order_id
File "C:\Python27\lib\site-packages\kiteconnect\", line 472, in _put
return self._request(route, "PUT", params)
File "C:\Python27\lib\site-packages\kiteconnect\", line 496, in _request
uri = self._routes[route]
KeyError: 'order_modify'

Also face the error when modifying a open bracket order (not yet executed) wherein I pass parent_order_id = None. But same error as above.

Please assist.
  • virtualKG
    Hi @sujith @Kailash ... Any assistance into this guys ?
  • sujith
    Hi @virtualKG,
    It seems to be a bug in pykiteconnect. We will fix it and update it soon.
  • virtualKG
    Looks like everytime I report something - it ends up in a new release - but glad to help @sujith ... :) Let me know once fixed so that I can try it out...
  • virtualKG
    Hi @sujith... Any timeline by when this can be fixed as it is a basic functionality that my system revolves around ?
  • sujith
    We will fix it in a couple of days. We will let you know once it is done.
  • virtualKG

    Looks like there is still some issue with the order modification function. Tried to executed the below code:

    kite.order_modify(order_id = '1600000001840697', parent_order_id='171113000307966', exchange='NFO', tradingsymbol='DLF17NOVFUT', transaction_type='BUY', quantity=5000, price=201, order_type='LIMIT', product='BO', trigger_price=0, validity='DAY', disclosed_quantity=0, variety='bo')

    Return is the below error message:

    Traceback (most recent call last):
    File "", line 1, in
    File "C:\Python27\lib\site-packages\kiteconnect\", line 344, in order_modify
    return self._put("orders.modify", params)["order_id"]
    File "C:\Python27\lib\site-packages\kiteconnect\", line 585, in _put
    return self._request(route, "PUT", params)
    File "C:\Python27\lib\site-packages\kiteconnect\", line 668, in _request
    raise(exp(data["message"], code=r.status_code))
    kiteconnect.exceptions.OrderException: MSG_FAILURE

    Please assist.
  • sujith
    Hi @virtualKG,
    It seems like order_id param is wrong.
    You need to pass order_id in the order id field and not exchange_order_id.
    I think that should resolve the issue.
This discussion has been closed.