Is there a way I can get DV01 breakup of a Swap across different tenors of the deal in Quantlib-Python. The question asked here, follows the basic method of re-valuing the swap by shifting the curve through 1-bips and summing positive and negative impacts.
By the above method we can get net DV01, for each leg(fixed/float) of a derivative instrument. But if we drill-down we could see that net DV01 of a leg is an aggregration of differential DV01s accrued at tenor point where cash flow occurs (each cash flow tenor point might not have DV contribution). In short, we generally calculate Modified Duration, but I am looking for Key-rate Duration.
I have to create a hedge basket, where I get differential DV01s for each tenor points. Such that I can buy/sell instruments to net the PV impact for individual tenors.
As an illustration, this is how my Pricer provides tenor-wise DV01s.
Is there a function/module which does this, or it has to be created from the scratch. I have done the steps explained in this post, but it illustrates for a flat rate curve. I need to evaluate for a swap with floating rates. I am not sure how it will handle interpolation of floating rates.