Order rejection

vivek_agg
Hi,
I am facing issue of orders getting rejected. How can I get the reason for rejection of the order?
In one case, my order got rejected when I was to close the existing trades. I was having 1 Buy and 1 Sell trade. When I executed the order to Sell the option which I had bought, it got rejected.
In another case, to take new trade, the Buy order got executed while the sell order got rejected. There were enough funds as I checked the margin requirement on Kite app.
Regards
Vivek
  • Nivas
    To identify the exact issue, you’ll need to capture the raw error response from the order placement API request. The error remarks there will give more clarity, based on which you can investigate further and work toward resolving it.
  • sujith
    sujith edited September 2
    @vivek_agg,
    You may refer to the exception format on Kite Connect here.
    Maybe enable debug logs for pykiteconnect and inspect the raw request and json response.
  • vivek_agg
    Hi @sujith , there was no Exception raised. I have captured the exception.
    Hi @Nivas , please suggest how can I capture the raw error response from the order placement API. Below is the code for placing order which is getting rejected:

    kite.place_order(
    tradingsymbol=hedge_symbol,
    exchange=option_exchange,
    transaction_type="SELL",
    quantity=quantity,
    order_type="MARKET",
    product="MIS",
    variety="regular",
    tag = trade_tag
    )
    Appreciate your help.

    Regards
    Vivek
  • sujith
    @vivek_agg,
    You may refer to the pykiteconnect docs here.
  • vivek_agg
    I got to know why the order got rejected. But that was on Kite application. How can I get the same reason via API?
  • sujith
    There are two ways one is when you get 400 error for placing order then most likely you are blocked by our mini RMS and the reason is in the message field of response. You may read the exception message or you may run with debug logs enabled and see the raw response.
    Other way is if you get 200 response then you may fetch orderbook and see the order status for the order id that you receive in response for place order. If status is REJECTED then you may check reason on status_message of the orderbook response.
Sign In or Register to comment.