Redundant postbacks

joy
joy edited July 2018 in General
Hi,
First congrats on the Kite 3 API. Order postbacks via websockets is really appreciated.

I am facing an issue of redundant postback. To clarify when I am modifying an order I am receiving 2 postback. The first one contains the updated data. while the second postback contain the stale data. For example if I modify an order from Rs 259.7 to 259.8 the first postback have the correct information. However the second postback contains the information of the original order. Please let me examplify.


PLACED AN ORDER
03Jul18 10:46:29, POST|apiKey=api_key, accessToken= access_token, Url=https://api.kite.trade/orders/regular, Payload= exchange=NSE&tradingsymbol=HINDPETRO&transaction_type=BUY&order_type=LIMIT&product=CNC&quantity=100&price=259.7&validity=DAY&tag=9ce766ce
RECEIVED POSTBACK - THIS IS FINE
03Jul18 10:46:29, WebSocket_MessageReceived : {"type":"order","data":{"placed_by":"clientId","order_id":"180703000699577","exchange_order_id":"1100000002036463","parent_order_id":null,"status":"OPEN","status_message":null,"order_timestamp":"2018-07-03 10:46:31","exchange_update_timestamp":null,"exchange_timestamp":"2018-07-03 10:46:31","variety":"regular","exchange":"NSE","tradingsymbol":"HINDPETRO","instrument_token":359937,"order_type":"LIMIT","transaction_type":"BUY","validity":"DAY","product":"CNC","quantity":100,"disclosed_quantity":0,"price":259.7,"trigger_price":0,"average_price":0,"filled_quantity":0,"pending_quantity":100,"cancelled_quantity":0,"market_protection":0,"meta":null,"tag":"9ce766ce","guid":"lxMWdEbuRnd7GRq5","account_id":"clientId","unfilled_quantity":0,"app_id":106,"checksum":""}}
RESPONSE RECEIVED - THIS IS FINE
03Jul18 10:46:29, OrderId : {"status":"success","data":{"order_id":"180703000699577"}}
MODIFIED ORDER - PRICE CHANGED TO 259.8 FROM 259.7
03Jul18 10:46:31, PUT|apiKey=api_key, accessToken= access_token, Url=https://api.kite.trade/orders/regular/180703000699577, Payload= exchange=NSE&tradingsymbol=HINDPETRO&transaction_type=BUY&order_type=LIMIT&product=CNC&quantity=100&price=259.8&validity=DAY
FIRST POSTBACK RECEIVED - THIS IS FINE
03Jul18 10:46:31, WebSocket_MessageReceived : {"type":"order","data":{"placed_by":"clientId","order_id":"180703000699577","exchange_order_id":"1100000002036463","parent_order_id":null,"status":"OPEN","status_message":null,"order_timestamp":"2018-07-03 10:46:34","exchange_update_timestamp":null,"exchange_timestamp":"2018-07-03 10:46:34","variety":"regular","exchange":"NSE","tradingsymbol":"HINDPETRO","instrument_token":359937,"order_type":"LIMIT","transaction_type":"BUY","validity":"DAY","product":"CNC","quantity":100,"disclosed_quantity":0,"price":259.8,"trigger_price":0,"average_price":0,"filled_quantity":0,"pending_quantity":100,"cancelled_quantity":0,"market_protection":0,"meta":null,"tag":"9ce766ce","guid":"lxMWdEbuRnd7GRq5","account_id":"clientId","unfilled_quantity":0,"app_id":106,"checksum":""}}
SECOND POST BACK RECEIVED - THIS CONTAINS STALE DATA (ORDER PRICE IS 259.7)
03Jul18 10:46:31, WebSocket_MessageReceived : {"type":"order","data":{"placed_by":"clientId","order_id":"180703000699577","exchange_order_id":"1100000002036463","parent_order_id":null,"status":"UPDATE","status_message":null,"order_timestamp":"2018-07-03 10:46:34","exchange_update_timestamp":null,"exchange_timestamp":"2018-07-03 10:46:34","variety":"regular","exchange":"NSE","tradingsymbol":"HINDPETRO","instrument_token":359937,"order_type":"LIMIT","transaction_type":"BUY","validity":"DAY","product":"CNC","quantity":100,"disclosed_quantity":0,"price":259.7,"trigger_price":0,"average_price":0,"filled_quantity":0,"pending_quantity":100,"cancelled_quantity":0,"market_protection":0,"meta":null,"tag":"9ce766ce","guid":"lxMWdEbuRnd7GRq5","account_id":"clientId","unfilled_quantity":0,"app_id":106,"checksum":""}}
RESPONSE FOR ORDER MODIFICATION RECEIVED - THIS IS FINE
03Jul18 10:46:31, OrderId : {"status":"success","data":{"order_id":"180703000699577"}}
the second postback is completely redundant as it contains stale data. in the above scenario since the filled quantity == 0, the order 'status' is send as OPEN (for the first postback) and UPDATE (for the 2nd postback). This gives us an option to filter out the 2nd postback. However in case of a partial fill the status is UPDATE for both the scenario. Let me give another example (the order is different from the previous example)

ORDER MODIFICATION REQUEST
03Jul18 10:30:37, PUT|apiKey=api_key, accessToken= access_token, Url=https://api.kite.trade/orders/regular/180703000617209, Payload= exchange=NSE&tradingsymbol=HINDPETRO&transaction_type=SELL&order_type=LIMIT&product=CNC&quantity=100&price=259.65&validity=DAY
RESPONSE RECEIVED - THIS IS FINE
03Jul18 10:30:37, WebSocket_MessageReceived : {"type":"order","data":{"placed_by":"clientId","order_id":"180703000617209","exchange_order_id":"1100000001801439","parent_order_id":null,"status":"UPDATE","status_message":null,"order_timestamp":"2018-07-03 10:30:40","exchange_update_timestamp":null,"exchange_timestamp":"2018-07-03 10:30:40","variety":"regular","exchange":"NSE","tradingsymbol":"HINDPETRO","instrument_token":359937,"order_type":"LIMIT","transaction_type":"SELL","validity":"DAY","product":"CNC","quantity":100,"disclosed_quantity":0,"price":259.65,"trigger_price":0,"average_price":259.4,"filled_quantity":37,"pending_quantity":63,"cancelled_quantity":0,"market_protection":0,"meta":null,"tag":"f3f2b13d","guid":"qvYFlXD1peviuRW1","account_id":"clientId","unfilled_quantity":0,"app_id":106,"checksum":""}}
2ND RESPONSE RECEIVED - PRICE = PRE MODIFICATION PRICE - NOT GOOD
03Jul18 10:30:37, WebSocket_MessageReceived : {"type":"order","data":{"placed_by":"clientId","order_id":"180703000617209","exchange_order_id":"1100000001801439","parent_order_id":null,"status":"UPDATE","status_message":null,"order_timestamp":"2018-07-03 10:30:40","exchange_update_timestamp":null,"exchange_timestamp":"2018-07-03 10:30:40","variety":"regular","exchange":"NSE","tradingsymbol":"HINDPETRO","instrument_token":359937,"order_type":"LIMIT","transaction_type":"SELL","validity":"DAY","product":"CNC","quantity":100,"disclosed_quantity":0,"price":259.4,"trigger_price":0,"average_price":259.4,"filled_quantity":37,"pending_quantity":63,"cancelled_quantity":0,"market_protection":0,"meta":null,"tag":"f3f2b13d","guid":"qvYFlXD1peviuRW1","account_id":"clientId","unfilled_quantity":0,"app_id":106,"checksum":""}}
RESPONSE RECEIVED - THIS IS FINE
03Jul18 10:30:37, OrderId : {"status":"success","data":{"order_id":"180703000617209"}}

Please do note the order status in both the response is UPDATE (the order is partially filled).

Why are you transmitting the stale postbacks? Its completely redundant. Can we assign any TAG while modifying an order?

The postback has a "meta" and "guid" property. The documentation does not describes it. Can you please let me know the functionality of the same.


Another issue, when an order is rejected the pending quantity,/ cancelled quantity etc are all 0 (zero). Is this by design?
Sign In or Register to comment.