order_history returning inconsistent data for cancelled SL orders

Killa
Killa edited 1:24PM in Python client
Date: 21/07/2026

Kite Connect client: pykiteconnect 5.0.1
Kite Connect API version: 3

Order IDs: 2079416151988805632, 2079426462892466176, 2079414679989428224

I observed unexpected behavior in the `order_history` response for cancelled SL orders.

I placed an SL order (NIFTY options, quantity: 390) and later sent a cancel request.
The cancel API returned the order ID successfully, and the order was actually cancelled. The cancellation was also reflected in the Kite web terminal.
However, the final `order_history` response shows an inconsistent state:

Status: CANCELLED
Quantity: 390
Filled quantity: 0
Cancelled quantity: 0
Pending quantity: 390

I checked the order history several hours after the cancellation as well, but the response remained the same.
Cancellation time: 12:47:30
The attached order_history snapshot was taken around 17:00.

I encountered the same issue with two other SL orders today. I have attached the relevant screenshots; order log, trade history from Kite web terminal,
and the corresponding order_history responses from PyKiteConnect for all the three SL orders I had issue with.
Even at the time of posting this, the latest order_history response still shows cancelled_quantity as 0, even though the order was actually cancelled.

I would also like to clarify the following:

1. Is it possible for a large quantity order cancellation to happen partially/in batches, or does the cancellation always apply to the complete pending quantity in a single operation?

2. When the cancel API returns the order ID, does it only indicate that the cancellation request was accepted by the OMS, or does it guarantee that the order has been successfully cancelled?

Any clarification on the expected behavior of these fields after cancellation would help in correctly handling order state reconciliation.

Thanks.
  • Killa

    Update:

    I also queried the GET /orders/{order_id} REST endpoint directly (instead of using the PyKiteConnect wrapper).
            {
    "account_id": "******",
    "placed_by": "******",
    "terminal_id": "",
    "order_id": "2079416151988805632",
    "exchange_order_id": "1200000017934794",
    "parent_order_id": null,
    "status": "CANCELLED",
    "status_message": null,
    "status_message_raw": null,
    "order_timestamp": "2026-07-21 12:47:30",
    "exchange_update_timestamp": "2026-07-21 12:47:30",
    "exchange_timestamp": "2026-07-21 12:47:30",
    "variety": "regular",
    "modified": true,
    "exchange": "NFO",
    "tradingsymbol": "NIFTY2672124250CE",
    "instrument_token": 14681602,
    "order_type": "SL",
    "transaction_type": "BUY",
    "validity": "DAY",
    "validity_ttl": 0,
    "product": "NRML",
    "quantity": 390,
    "disclosed_quantity": 0,
    "price": 49.45,
    "trigger_price": 48.45,
    "average_price": 0,
    "filled_quantity": 0,
    "pending_quantity": 390,
    "cancelled_quantity": 0,
    "market_protection": 0,
    "meta": {},
    "meta_raw": "{\"_kite\":{\"silo\":\"e\",\"user\":{\"poa\":\"physical\",\"silo\":\"e\",\"twofa_type\":\"totp\"}},\"app_id\":*****,\"aucno\":\"\",\"gttp\":null,\"iceberg\":{\"leg\":0,\"leg_quantity\":0,\"legs\":0,\"remaining_quantity\":0,\"total_quantity\":0},\"kite_order_id\":\"\",\"silo\":\"e\",\"tag\":\"3_C_iib4dA'\",\"tags\":[\"3_C_iib4dA'\"],\"user\":{\"silo\":\"e\",\"poa\":\"physical\",\"twofa_type\":\"totp\"},\"validity_ttl\":0}",
    "tag": "3_C_iib4dA'",
    "tags": [
    "3_C_iib4dA'"
    ],
    "guid": null
    }
    ]
    }
Sign In or Register to comment.