It looks like you're new here. If you want to get involved, click one of these buttons!
+--------+---------------+--------------------------+-----------------+------------+-----------------+------------------+-----------------+
| 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.
In the above table, you have two entries for the same parent order, one for trigger pending and another for completed.
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.
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.
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