I want to create an InterpolatedNodalCurve programmatically. The Curve contains discount factors and doesn’t need to be calibrated. For testing purposes, I did it by importing CSV files, but now I need to do it programmatically.
The final InterpolatedNodalCurve object should look as follows:
InterpolatedNodalCurve {
metadata = DefaultCurveMetadata {
curveName = USD - Disc, xValueType = YearFraction, yValueType = DiscountFactor, info = {
DayCount = Act / 360
}, parameterMetadata = [LabelDateParameterMetadata {
date = 2019 - 02 - 20, label = 0 D
}, LabelDateParameterMetadata {
date = 2019 - 03 - 20, label = 1 M
}, ...
}]
}, xValues = [0.0, 0.07777777777777778, ...], yValues = [0.002571524, 0.001034099, ...], interpolator = Linear, extrapolatorLeft = Flat, extrapolatorRight = Flat
I have tried to look up the code that is used by RatesCurvesCsvLoader
, but it seems to use internal methods or properties such as LoadedCurveNode
. So I cannot just reuse this code.
For the xValues I only have dates (as in the example with the CSV files), so I need Strata to compute these based on the input dates.
I found an example here: https://github.com/OpenGamma/Strata/blob/master/modules/pricer/src/test/java/com/opengamma/strata/pricer/curve/CalibrationZeroRateUsdOisIrsEurFxXCcyIrsTest.java#L307
However, the USD_DSC_NODES
in this example are FixedOvernightSwapCurveNode
, but I would need a FxSingleCurveNode
which does not exist.
Can someone point me to or show me example code where an InterpolatedNodalCurve using discount factors is constructed programmatically?