Trade generation bug in XCcyIborIborSwapCurveNode


We have spotted an issue while generating trades from XCcyIborIborSwapCurveNode. It seems notional for flat leg is computed incorrectly. In XCcyIborIborSwapCurveNode method trade, quantity should have been calculated based on fxRate, but it seems just actual fxRate is being passed to template. Take a look:

  public SwapTrade trade(double quantity, MarketData marketData, ReferenceData refData) {
    double marketQuote = marketData.getValue(spreadId) + additionalSpread;
    FxRate fxRate = marketData.getValue(fxRateId);
    double rate = fxRate.fxRate(template.getCurrencyPair());
    BuySell buySell = quantity > 0 ? BuySell.SELL : BuySell.BUY;
    return template.createTrade(marketData.getValuationDate(), buySell, Math.abs(quantity), rate, marketQuote, refData);

So flat leg notional is always the same, no matter what quantity you pass. Of course it works fine when quantity is one. But I believe there should be additional line of code, which multiplies rate by quantity and then pass the result to template`s createTrade method. Does that makes sense? Or do I miss something here?

Thank you!

Fixed in master, thanks