Managing several currencies

Hi there,
I would like to manipulate cross-currency trades (FxVanillaOption, for example). I have 2 different currencies, which implies 2 different curveGroupDefinitions and so 2 different RatesMarketDataLookUp:

CalculationParameters calculationParameters = CalculationParameters.of(RatesMarketDataLookup.of(curveGroupDefinition1), RatesMarketDataLookup.of(curveGroupDefinition2));
CalculationRules rules = CalculationRules.of(functions, calculationParameters);

When I try to build CalculationRules from these 2 CalculationParameters, an IllegaleArgumentException is thrown:

Multiple entries with same key: interface com.opengamma.strata.measure.rate.RatesMarketDataLookup=DefaultRatesMarketDataLookup{discountCurves={GBP=CurveId{curveGroupName=GBP-DSCONOIS-L6MIRS, curveName=GBP-DSCON-OIS, observableSource=None}}, forwardCurves={GBP-LIBOR-6M=CurveId{curveGroupName=GBP-DSCONOIS-L6MIRS, curveName=GBP-LIBOR6M-IRS, observableSource=None}, GBP-SONIA=CurveId{curveGroupName=GBP-DSCONOIS-L6MIRS, curveName=GBP-DSCON-OIS, observableSource=None}}, observableSource=None, fxLookup=DefaultFxRateLookup{currency=null, observableSource=None}} and interface com.opengamma.strata.measure.rate.RatesMarketDataLookup=DefaultRatesMarketDataLookup{discountCurves={USD=CurveId{curveGroupName=USD-DSCON-LIBOR3M, curveName=USD-Disc, observableSource=None}}, forwardCurves={USD-FED-FUND=CurveId{curveGroupName=USD-DSCON-LIBOR3M, curveName=USD-Disc, observableSource=None}, USD-LIBOR-3M=CurveId{curveGroupName=USD-DSCON-LIBOR3M, curveName=USD-3ML, observableSource=None}}, observableSource=None, fxLookup=DefaultFxRateLookup{currency=null, observableSource=None}}

Perhaps what you want is the method CurveGroupDefinition.combinedWith(CurveGroupDefinition) that allows you to combine two definitions?

1 Like

Ok I did not see there has been code additions in the last couple of months so I wasn’t up to date my bad.
Thank you !

You’re right, there are in the GitHub though, so you can build the jar yourself or wait for a new release.