write SQL query that takes its own output as input
You can use a subquery with the same table in both the primary and sub queries, join on trade_id = keyword_value

Depending on how many levels a trade could have it might get complex, but this should get you going in the right direction.