Basic question about tags

Why are tags used when we have Order ID to query status of orders? The only use-case, I can think of is “partially filled” orders—I am assuming that Z will create a new order id with same tag—if the entire quantity is not filled. Can you please confirm?

Also, what are the other important reasons because of which tags are used by developers while placing orders -- I am almost certain that I am missing some very important used cases.

    SRIJAN edited August 2022
    Tags are not used to know status of an order.

    Tags are used to filter orders.

    For example, let's say you run 3 different strategies,and then all of them place orders in the same instrument.
    When you fetch orderbook to check,you can't know which order was placed by which of the 3 strategies .

    But ,what you can do is send specific tags with orders sent.

    Like, send 'strategy 1' tag for all orders sent from first strategy.
    When you fetch orderbook,filter according to this tag,and you will get all orders sent from the first strategy.
  • doubles
    Thanks, can you please confirm that “Z” will create a new order ID in case original order is partially filled(when second or third order are executed to complete the fill) - or is it handled via "filled quantity" ? Also, if multiple orders are placed because the first order was partially filled – will the subsequent orders have same tags?

    Furthermore, was going through the forums and looks like tags will need to be used because it's possible that order ID is not returned, but order was placed. Is this still the case?
  • sujith
    Only one order is created for each order placed by the user. When there is a partial fill, only a new trade is created. When there is a fill, filled_quantity, pending_quantity fields are updated.
    You can know more about the trades here.
    SRIJAN edited August 2022
    Regarding order id not being returned,I have personally never faced this issue.
    Still,if you want to use tags to overcome this issue if it occurs,you need to send a unique tag with every order as told by Sujith Sir in your mentioned thread.
  • doubles
    doubles edited August 2022
    Based on the link of trades shared by @sujith tag field is not available on trades.

    So, query order book for tag, get order id then use "Filled quantity" to know if the order is completely or partially filled.

    Have you come across a case, when filled quantity eq ordered quantity but order status is not equal to Complete

    I am trying to figure out which field is better to know of the order is completely filled( filled quantity or order status)

    SRIJAN edited August 2022
    Tags are sent with orders. The trades don't have tags.

    It's not possible that filled quantity equals ordered quantity and status won't be 'COMPLETE'.

    You can use filled quantity or status , whatever you like,not that anyone is better, status as 'COMPLETE' means filled quantity equals ordered quantity.
Sign In or Register to comment.