BO order question

ramatius
Hi, this is the continuation of this issue - it got closed and so continuing with a new one.

See the below transactions today for a single BO,
        
+--------+---------------+--------------------------+-----------------+------------+-----------------+------------------+-----------------+
| price | trigger_price | time(exchange_timestamp) | order_id | order_type | parent_order_id | transaction_type | status |
+--------+---------------+--------------------------+-----------------+------------+-----------------+------------------+-----------------+
[6] | 657.05 | 597.3 | 09:26:08 | 180925000167692 | SL | 180925000146966 | BUY | CANCELLED |
[5] | 592.3 | 594.8 | 09:21:32 | 180925000146966 | LIMIT | NULL | SELL | COMPLETE |
[4] | 592.3 | 0 | 09:21:32 | 180925000167691 | LIMIT | 180925000146966 | BUY | OPEN |
[3] | 657.05 | 597.3 | 09:21:32 | 180925000167692 | SL | 180925000146966 | BUY | TRIGGER PENDING |
[2] | 592.3 | 0 | 09:21:32 | 180925000167691 | LIMIT | 180925000146966 | BUY | COMPLETE |
[1] | 592.3 | 594.8 | 09:20:15 | 180925000146966 | SL | NULL | SELL | TRIGGER PENDING |
+--------+---------------+--------------------------+-----------------+------------+-----------------+------------------+-----------------+

It was a SELL order that has hit the Take-Profit (TP) and exited. User ID is the same as the one pvt msg'ed to @sujith for the above issue.

Parent ID field is NULL for [5]. The order_id in [5] is same as in [1]. Not sure how to figure out whether the order has hit the TP. Pls advise.

Also, note that [2] indicates a COMPLETEd BUY order, which never happened. Why is this row present?

Regards,
Ramakrishnan S
  • sujith
    You seem to have placed a sell bracket order with entry type SL. It sat in trigger pending state and then got completed in one trade and then your target was hit. It seems fine.
    In the above table, you have two entries for the same parent order, one for trigger pending and another for completed.
  • ramatius
    @sujith yes it is a SL BO that got triggered when target was hit. My questions are,
    1) Why is line [2] present? It is showing a BUY order as complete, which is not possible - the BO was a SELL order.
    2) From this list of txns, how can I reliably deduce that the TP has been hit?
    Appreciate your comments on the above.
  • sujith
    [2] is the target order execution.
    Since everything happened in the same second the order of notification is jumbled up.

    You can consider the product of average price and quantity of the parent order and product of average price and quantity of all second leg orders to find the profit.
  • ramatius
    ramatius edited September 2018
    @sujith I was hoping that there is a simpler way to find out whether a BO has hit TP (or SL). Looks like there isn't. The method of processing all the legs of BOs to find the P/L is rather unwieldy, when the no. of symbols & trade frequency are high. Debugging issues becomes quite tedious.

    I would like to request you to add couple of APIs for BO to simplify life for the developers,
    1) An API to find out whether the given order_id has hit TP or SL.
    2) An API to completely exit all open BO legs (if any) for a given symbol
    3) Get the last executed parent_order_id for a symbol
    4) Get the list of pending BOs order_ids

    Regards,
    Ramakrishnan S

  • sujith
    We will pass this feedback to the concerned team.
  • ramatius
    Thanks @sujith . Request you to keep this issue open, so that it receives the necessary attention from the dev team.
Sign In or Register to comment.