Bootstrapping foreign discount curve with forward points and spot

Is it possible under the OG multi-curve bootstrapping framework to automatically construct foreign discount curves from the domestic curve, spot and forward FX? Or do I have to manually backout the foreign discount curve?

Hi Richard,

Yes this is possible. There is an already build example in strata-examples: CalibrationXCcyCheckExample.

The example has a curve calibration including to cross-currency swaps. If you only want FX forward you can use the example with only the discounting curves (in both currencies) and the nodes with FX swaps (FXS as Type in the csv files describing the curves in the examples).

You can also look at the test called CalibrationZeroRateUsdEur2OisFxTest in strata-pricer. In the test all the settings and data are constructed programatically. In the example, the data and settings are stored in csv files.

Regards,

Marc

Thanks Mark. I was able to setup curves for the predefined FxSwapConventions GBP & EUR. I’m having difficulty though setting up for other currency pairs through extending FxSwapConvention in Strata 1.7. I created a FxSwapConvention.ini located in com.opengamma.strata.config.library and added my class as a provider and it throws an NPE.

Stack:

Caused by: java.lang.NullPointerException: null
	at com.opengamma.strata.product.fx.type.FxSwapConvention.of(FxSwapConvention.java:47) ~[strata-product-1.7.0.jar:1.7.0]
	at com.opengamma.strata.product.fx.type.FxSwapConventionsExt.<clinit>(FxSwapConventionsExt.java:36) ~[classes/:1.7.0]

FxSwapConvention.ini:

[providers]
com.opengamma.strata.product.fx.type.FxSwapConventionsExt = constants

FxSwapConventionsExt.java:

package com.opengamma.strata.product.fx.type;
public final class FxSwapConventionsExt {
  static final ExtendedEnum<FxSwapConvention> ENUM_LOOKUP = ExtendedEnum.of(FxSwapConvention.class);
  
  private static final HolidayCalendarId AUSY_USNY = AUSY.combinedWith(USNY);
  
  public static final FxSwapConvention AUD_USD =
      FxSwapConvention.of(ImmutableFxSwapConvention.of(
          CurrencyPair.of(AUD, USD),
          DaysAdjustment.ofBusinessDays(2, AUSY_USNY),
          BusinessDayAdjustment.of(BusinessDayConventions.MODIFIED_FOLLOWING, AUSY_USNY)).getName());

OK, looking at the OG source code I think it should be:

FxSwapConvention.ini:

[providers]
com.opengamma.strata.product.fx.type.ExtendedSwapConventions = constants

ExtendedFxSwapConventions.java

package com.opengamma.strata.product.fx.type;
public final class ExtendedFxSwapConventions {
  private static final HolidayCalendarId AUSY_USNY = AUSY.combinedWith(USNY);
  
  public static final FxSwapConvention AUD_USD =
     ImmutableFxSwapConvention.of(
          CurrencyPair.of(AUD, USD),
          DaysAdjustment.ofBusinessDays(2, AUSY_USNY),
          BusinessDayAdjustment.of(BusinessDayConventions.MODIFIED_FOLLOWING, AUSY_USNY));

However I’m not sure what I need to do with FxSwapConventionsExt in the previous reply. Does that need to be added to the ini file as well?

Sorry, I missed this one.

To add conventions you need two parts - the ini file and the class of constants.

The ini file simply references the class of constants, as you are doing above (although your class names don’t match, and I’d expect your code to be in your package, not Strata’s package). The com.opengamma.strata.config.library location for the config file is correct.

Your ExtendedFxSwapConventions constants class also looks correct, there is no need to redeclare ExtendedEnum<FxSwapConvention> as the one declared in Strata’s FxSwapConventions will load the config file and make the additional constants available.

I assume the NPE was because there were two instances of the ExtendedEnum class, but I’m not sure without more stack trace.