How to identify multiple trades on web-socket

cskasm
I need response format on web-socket when multiple trades occur on a single order. What would be the "STATUS" of a partially executed order on web-socket ("on_order_update")?
Tagged:
  • sujith
    sujith edited January 2023
    The status will be UPDATE. We suggest fetching orderbook to see the updated values, when you see an order update event on the websocket.
  • cskasm
    Fetching the order book would take 500-600 milisec time. This would bring the latency up heavily and in effect the efficiency of execution would go to virtually null!
  • cskasm
    Every trade should be communicated through the websoket for smooth running of the execution
  • sujith
    Kite Connect is not meant for HFT or latency based trading.
  • sujith
    sujith edited January 2023
    Websocket order update are asynchronous messages pushed by the OMS, order of the event or duplicate events are triggered in the few cases. Hence, we suggest fetching orderbook on order update event.
  • cskasm
    Could you post a sample message for partially executed order ?
  • rakeshr
    rakeshr edited January 2023
    It would come with status of "status": "TRIGGER PENDING" and filled_quantity lesser than quantity. Something like:
    {
    "order_id": "your order ID",
    "parent_order_id": null,
    "variety": "regular",
    "exchange": "NSE",
    "tradingsymbol": "INFY",
    "transaction_type": "SELL",
    "product": "MIS",
    "quantity": 10,
    "filled_quantity": 3,
    "price": 890.5,
    "average_price": 890.5,
    "status": "TRIGGER PENDING",
    "order_timestamp": "2022-01-10T13:00:00+05:30",
    }
  • cskasm
    @rakeshr @sujith : Unfortunately this is of no help. Thia is how I received a modification message;

    {'account_id': 'XXXXXX', 'unfilled_quantity': 0, 'checksum': '', 'placed_by': 'XXXXXX', 'order_id': '221227002038344', 'exchange_order_id': '1500000053707215', 'parent_order_id': None, 'status': 'UPDATE', 'status_message': None, 'status_message_raw': None, 'order_timestamp': '2022-12-27 11:40:14', 'exchange_update_timestamp': '2022-12-27 11:40:14', 'exchange_timestamp': '2022-12-27 11:40:14', 'variety': 'regular', 'exchange': 'NFO', 'tradingsymbol': 'BANKNIFTY22DEC44000CE', 'instrument_token': 22004994, 'order_type': 'LIMIT', 'transaction_type': 'BUY', 'validity': 'DAY', 'product': 'MIS', 'quantity': 25, 'disclosed_quantity': 0, 'price': 4.35, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 25, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '42856XZvT78rgJpPQo'}
    {'account_id': 'XXXXXX', 'unfilled_quantity': 0, 'checksum': '', 'placed_by': 'XXXXXX', 'order_id': '221227002038344', 'exchange_order_id': '1500000053707215', 'parent_order_id': None, 'status': 'OPEN', 'status_message': None, 'status_message_raw': None, 'order_timestamp': '2022-12-27 11:40:14', 'exchange_update_timestamp': '2022-12-27 11:40:14', 'exchange_timestamp': '2022-12-27 11:40:14', 'variety': 'regular', 'exchange': 'NFO', 'tradingsymbol': 'BANKNIFTY22DEC44000CE', 'instrument_token': 22004994, 'order_type': 'LIMIT', 'transaction_type': 'BUY', 'validity': 'DAY', 'product': 'MIS', 'quantity': 25, 'disclosed_quantity': 0, 'price': 5.35, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 25, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '42856XZvT78rgJpPQo'}

    I could figure out by placing large order, but that would cost me large amount. That's why I asked for a sample message for partially executed order.Could you please mention how these above messages would look like in case of partially executed order.

    PS: The 'status': 'OPEN messages for new order and modification are exactly same thereby making it very difficult to distinguish between them. The 'status': 'UPDATE message doesn't always come before 'status': 'OPEN (in case of modification)

    Below is the messages, when order Is executed fully in one trade, look like,

    {'account_id': 'XXXXXX', 'unfilled_quantity': 0, 'checksum': '', 'placed_by': 'XXXXXX', 'order_id': '221227002222858', 'exchange_order_id': '1500000060547202', 'parent_order_id': None, 'status': 'OPEN', 'status_message': None, 'status_message_raw': None, 'order_timestamp': '2022-12-27 12:05:05', 'exchange_update_timestamp': '2022-12-27 12:05:05', 'exchange_timestamp': '2022-12-27 12:05:05', 'variety': 'regular', 'exchange': 'NFO', 'tradingsymbol': 'BANKNIFTY22DEC44000CE', 'instrument_token': 22004994, 'order_type': 'LIMIT', 'transaction_type': 'BUY', 'validity': 'DAY', 'product': 'MIS', 'quantity': 25, 'disclosed_quantity': 0, 'price': 12.6, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 25, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '42856XGeUlFwRSgHo7'}
    {'account_id': 'XXXXXX', 'unfilled_quantity': 0, 'checksum': '', 'placed_by': 'XXXXXX', 'order_id': '221227002222858', 'exchange_order_id': '1500000060547202', 'parent_order_id': None, 'status': 'COMPLETE', 'status_message': None, 'status_message_raw': None, 'order_timestamp': '2022-12-27 12:05:05', 'exchange_update_timestamp': '2022-12-27 12:05:05', 'exchange_timestamp': '2022-12-27 12:05:05', 'variety': 'regular', 'exchange': 'NFO', 'tradingsymbol': 'BANKNIFTY22DEC44000CE', 'instrument_token': 22004994, 'order_type': 'LIMIT', 'transaction_type': 'BUY', 'validity': 'DAY', 'product': 'MIS', 'quantity': 25, 'disclosed_quantity': 0, 'price': 12.6, 'trigger_price': 0, 'average_price': 12.2, 'filled_quantity': 25, 'pending_quantity': 0, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '42856XGeUlFwRSgHo7'}
  • rakeshr
    Could you please mention how these above messages would look like in case of partially executed order.
    As, I explained above you need to check for quantity fields, unfilled_quantity, filled_quantity and quantity.
  • cskasm
    @rakeshr : Again, if I try to check it, it would cost me 20-30k
Sign In or Register to comment.