order status ws response | extreme cases


  • Doubts are marked with D(n) -> D(1), D(2) ... please answer each one of them.
    Defined orderStatusResponse as what i recieve from order web-socket.

    assume following scenario

    I made LIMIT order for an instrument at price 100 with quantity 5000.
    i got partial filled at 100 with 2000 quantity, i modified the order to price 98 (which means order is OPEN at 3000 quantity at limit price of 98)
    D1-> YES/NO -> filled in orderStatusResponse = 2000 / unfilled = 3000
    order got partially filled at 98 with 1000 quantity, i modified the order to price 95 (which means order is OPEN at 2000 quantity at limit price of 95)
    D2-> YES/NO -> filled in orderStatusResponse = 3000 / unfilled = 2000
    Assume i have traded in the same instrument today when its price was 200, lets say bought at 200 and sold at 250. (that order was different then my current order as their parent id are not same)

    now i have 3000 quantity of instruments at avg price of [(100 * 2000) + (98 * 1000)] / 3000 = 99.33 this is the avg of current order cycle,
    but instrument avg price will include the prev orders of same instruments as mentioned above. which will be different number lets say 150

    want clarification in these possibilities (cancel/modify/completion)

    i cancelled the existing order, recieved cancelled status from web-socket
    D3 -> define orderStatusResponse fields price/avg price/filled/unfilled. please provide actual values.

    order is modified to price 90 [no partial executions happend], recieved modfied status from web-socket
    D4 -> define orderStatusResponse fields price/avg price/filled/unfilled. please provide actual values.

    order is COMPLETED at price 95 with remaining 2000 quantity, recieved COMPLETED status from web-socket
    D5 -> define orderStatusResponse fields price/avg price/filled/unfilled. please provide actual values.

    #partial #order #order_status #order_response