Curve values in Strata

Hi OG team,

First of all thanks for great deal of work put into development of your tools while keeping it open source.

I’d like to obtain values from calibrated yield and discount curves. Could you provide me with some hints or quick code example on how to get forward rates and discount factors? I looked into your examples (like CalibrationCheckExample), but it’s not clear to me what is the preffered interface to use as a curve provider.

Cheers,
Emil

Thanks and welcome.

The CalibrationCheckExample uses the Strata calculation engine to calibrate and manage market data. With that approach there is no specific need to get forward rate or discount factors manually. Instead, you declare the measures needed, Measure.PRESENT_VALUE in the case of the example. The calculation engine will calibrate the curves and then calculate the measures on the specified trades. You might find a class like FraPricingExample easier to follow to see how the trades and measures are passed into the engine (note that FraPricingExample does not calibrate curves, but that is just because we kept the examples separate).

If you want to work at a lower level, you can call the calibrator yourself, CurveCalibrator, which will return an ImmutableRatesProvider which can be queried for the curves. To obtain discount factors, we recommend wrapping the curve in an instance of DiscountFactors using DiscountFactors.of(). To obtain forward rates, we recommend wrapping the discount factors in an instance of IborIndexRates or OvernigtIndexRates. Note however, that the pricers in strata-pricer work in terms of ImmutableRatesProvider, and only use DiscountFactors or IborIndexRates internally.

Hope this helps, and happy to guide further, or feel free to contact us for commercial support.