Cannot Modify a Cover Order.

sabyasm
Hello!

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:

160621000057099,SBIN,NSE,BUY,480,SL-M,CO,217.95
160621000057344,ZEEL,NSE,BUY,229,SL-M,CO,456.1
160621000057553,BPCL,NSE,BUY,103,SL-M,CO,1013.2
160621000057731,COALINDIA,NSE,BUY,331,SL-M,CO,315.7
160621000058059,UPL,NSE,BUY,182,SL-M,CO,573.65
160621000058259,AUROPHARMA,NSE,BUY,140,SL-M,CO,745.35

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' )

    Exmaple:

    160623000046137,LICHSGFIN,NSE,BUY,213,SL-M,CO,491.2,co
    160623000046409,BANKBARODA,NSE,BUY,695,SL-M,CO,150.75,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
    @Kailash

    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.