Calculation of DV01 for interest rate swap

Dear users! I’m trying to understand how do we calculate DV01 for interest rate swap. I have found the formula (Down Principal - Up Principal)/(2x Shift) but it’s summarized the main elements, without anything specific.

Could you please help me how do we calculate DV01? Is it possible to calculate using Strata?

Thank you!

Take a look at com.opengamma.strata.examples.SwapPricingExample

It shows how to calculate a variety of measures including PV01_CALIBRATED_SUM which is equivalent to the Bloomberg DV01 measure on SWPM which looks surprisingly similar to your text definition. Be aware that the presence of a fixing value for your floating index will effect the result of this calculation for a spot starting swap.

If you want to calculate the PV01 number you can do so by using a DiscountingSwapTradePricer directly and extracting DiscountingSwapLegPricer to calculate pvbp on the fixed leg.