Order placement failed - list index out of range

DeepakTanpure
Hi Team,

last Thursday (8-Oct), I got error after placing the order, - it said list index out of range
14:35:20 NSE POWERGRID SELL 6 regular LIMIT 158.8 MIS Order placed. ID is: 201008004111510
14:35:20 Order placement failed: list index out of range
I checked order book, order was successful, can you please explain in which case we get this error
  • rakeshr
    list index out of range
    Looks like your internal error. Are you parsing any list post order placement?
  • DeepakTanpure
    Here is the code used for those print line
    try:
    order_id = kite.place_order(tradingsymbol=instrument[4:],
    exchange=instrument[0:3],
    transaction_type=kite.TRANSACTION_TYPE_BUY,
    quantity=c_qty,
    variety=kite.VARIETY_REGULAR,
    order_type=kite.ORDER_TYPE_LIMIT,
    price=ltp,
    product=kite.PRODUCT_MIS)
    print(datetime.now().strftime("%H:%M:%S"),
    instrument[0:3], instrument[4:], kite.TRANSACTION_TYPE_BUY, c_qty,
    kite.VARIETY_REGULAR, kite.ORDER_TYPE_LIMIT, ltp, kite.PRODUCT_MIS,
    "Order placed. ID is:{}".format(order_id))
    except Exception as ex3:
    print('datetime.now().strftime("%H:%M:%S"), "Order placement failed: {}".format(ex3))
  • rakeshr
    The code looks fine. Got placement id too,which got printed by print statement MIS Order placed. ID is: 201008004111510. And there is nothing post-print statement to throw an exception.
  • DeepakTanpure
    Hi Rakesh,

    Thanks for double checking, I appreciate your help
    it's my mistake. Error was due to another dict variable that was caught in try block,

    you can close this thread. :)
This discussion has been closed.