Cannot Modify a Cover Order.


I am trying to modify the trigger price for few cover order through python code as below:

Note: The initial positions are short positions and I am trying to modify the SL_TRIGGER price for the corresponding "BUY" orders

kite.order_modify(order_id=row['order_id'],tradingsymbol=row['tradingsymbol'],exchange=row['exchange'],transaction_type='BUY',order_type='SL-M',quantity=row['quantity'], product=row['product'], trigger_price=row['sl_price_new'])

However, the error I am getting is : "'Cannot Modify a Cover Order.'"

The order_modify api is being called with following values:


Could you please advise where could the problem be?

I am using the latest kiteconnect sdk
  • sabyasm
    Hi Kailash,

    Any help on this please? Even though I pass on all the required parameters - the exception message is "'Cannot Modify a Cover Order.'"

    The order_ids correspond to 21-June trade and were tried around 10-11 am.
  • Kailash
    Kailash edited June 2016
    @sabyasm Sorry, missed this post somehow. Looks like you're not sending the variety='co' parameter.
  • sabyasm
    @Kailash -- after adding the variety='co' parameter, I am getting the error as:

    'Not a second Legged Cover Order.'

    my order_modify call now looks like:

    kite.order_modify(order_id=row['order_id']),tradingsymbol=row['tradingsymbol'],exchange=row['exchange'],transaction_type='BUY',order_type='SL-M',quantity=row['quantity'],product=row['product'], trigger_price=row['sl_price_new'], variety='co' )



    Am I sending anything wrong in order_type or product?
  • sabyasm
    @Kailash ideally, when modifying a CO, only order_id and trigger_price should be passed. Isn't it?

    I tried the following call:

    kite.order_modify(order_id=row['order_id']),trigger_price=row['sl_price_new'], variety='co' )

    Still failing with error: 'Not a second Legged Cover Order.'
  • sabyasm

    Nevermind - the last bit of code works. The order_id value wasn't correct. Passing variety='co' solved the issue.

    Suggestion: can the python document be updated to explain the mandatory parameters and their values? Seeing the code it seems to be understandable but it will help developers.
  • Kailash
    @sabyasm Thanks. Will improve the docs at some point soon.
This discussion has been closed.