Getting Order History and Sorting

Hi, using Delta API, I am able to get the order history. But sorting through each trade cycle, what would be the best logic?

ie.
i am able to get the order history dump on specific time window (from and to date)
How do I categorise these into individual trade cycles .. ie 1 trade is an entry, adds/scaling and then exit (partial or total square off).
When I have a dump of say 20 trades, how do classify them into seperate trade cycles ?
how can i use order id, fill id, timestamp etc. to club them into individual trade cycles
Trade 1 {entries and exits} , Trade 2{entries and exits}, Trade 3 {entries and exits} and so on

Does any one have a logic for this?