I tried to calculate the NPV for an EUR/USD FX Forward trade and 2 discount curves. Unfortunately I get the following error:
An unhandled exception of type 'java.lang.IllegalStateException' occurred in StrataNet.dll
Additional information: Unable to get a value from a failure result: Failed to converge in backtracking, even after a Jacobian recalculation.Final position:[0.00937838500036448, [and a lot of numbers follow]
My curve definitions are as follows.
groups.csv
Group Name,Curve Type,Reference,Curve Name
USD-EUR-XCCY,Discount,USD,USD-DSC
USD-EUR-XCCY,Discount,EUR,EUR-DSC
settings.csv
Curve Name,Value Type,Day Count,Interpolator,Left Extrapolator,Right Extrapolator
USD-DSC,Zero,Act/365F,Linear,Flat,Flat
EUR-DSC,Zero,Act/365F,Linear,Flat,Flat
calibrations.csv > see pastebin link here.
quotes.csv > see pastebin link here.
The trade including calibration of the curves, etc. is done as follows:
//create another trade
FxSingle fx = FxSingle.of(CurrencyAmount.of(EUR, 100), FxRate.of(EUR, USD, 1.72), LocalDate.of(2016, 9, 2));
Trade FXSingleTrade = FxSingleTrade.builder()
.product(fx)
.info(TradeInfo.builder()
.id(StandardId.of("example", "1"))
.addAttribute(AttributeType.DESCRIPTION, "EUR 1,000/USD @ 1.72 fwd")
.counterparty(StandardId.of("example", "BigBankA"))
.settlementDate(LocalDate.of(2016, 3, 2))
.build())
.build();
trades.Add(FXSingleTrade);
// the columns, specifying the measures to be calculated
List columns = ImmutableList.of(
Column.of(Measures.PRESENT_VALUE));
// the configuration that defines how to create the curves when a curve group is requested
MarketDataConfig marketDataConfig = MarketDataConfig.builder()
.add(CURVE_GROUP_NAME, curveGroupDefinition)
.build();
// the complete set of rules for calculating measures
CalculationFunctions functions = StandardComponents.calculationFunctions();
RatesMarketDataLookup ratesLookup = RatesMarketDataLookup.of(curveGroupDefinition);
CalculationRules rules = CalculationRules.of(functions, ratesLookup);
// calibrate the curves and calculate the results
MarketDataRequirements reqs = MarketDataRequirements.of(rules, trades, columns, refData);
MarketData calibratedMarketData = marketDataFactory().create(reqs, marketDataConfig, marketData, refData);
Results results = runner.calculate(rules, trades, columns, calibratedMarketData, refData);
return Pair.of(trades, results);
What is going wrong here? Sorry for taking your time. I think not much is missing and I’m almost there, so your help would be greatly appreciated. Thanks!