Leg ordering before and after resolving a swap trade

Hi all. I’m implementing a service that takes a swap in JSON, models it in Strata, then resolves the swap like so:

    final Swap swap = Swap.of(strataSwapLegs);
    TradeInfo tradeInfo = TradeInfo.empty(); //TradeInfo object used to add more info to the swap trade
    SwapTrade swapTrade = SwapTrade.of(tradeInfo, swap); 
    ReferenceData refData = ReferenceData.standard(); 
    ResolvedSwapTrade resolved = swapTrade.resolve(refData);
    ResolvedSwap resolvedSwap = resolved.getProduct();

I am wondering if the ordering in which legs are put in the strataSwapLegs List is maintained when I call resolvedSwap.getLegs(); or if I should find a way to ensure the ordering is the same / fix it otherwise. If the latter, do you have any suggestion on how to do that?

Thank you!

For questions like this, you can review the code since it is open source. The answer is yes, the order of the legs is maintained.
Stephen

1 Like