diff --git a/src/Qwack.Models/Risk/BasicMetrics.cs b/src/Qwack.Models/Risk/BasicMetrics.cs index 11de210a..15338240 100644 --- a/src/Qwack.Models/Risk/BasicMetrics.cs +++ b/src/Qwack.Models/Risk/BasicMetrics.cs @@ -1438,7 +1438,8 @@ private static IPriceCurve GetBumpedCurve(double bumpSize, IPriceCurve curveObjX Currency = cpc.Currency, AssetId = AssetId, SpotCalendar = cpc.SpotCalendar, - SpotLag = cpc.SpotLag + SpotLag = cpc.SpotLag, + Units = cpc.Units, }, // if (bCurve.Value.UnderlyingsAreForwards) //de-discount delta @@ -1451,7 +1452,9 @@ private static IPriceCurve GetBumpedCurve(double bumpSize, IPriceCurve curveObjX Currency = pc.Currency, AssetId = AssetId, SpotCalendar = pc.SpotCalendar, - SpotLag = pc.SpotLag + SpotLag = pc.SpotLag, + RefDate = pc.RefDate, + Units = pc.Units, }, _ => throw new Exception("Unable to handle curve type for flat shift"), }; @@ -1497,6 +1500,8 @@ public static ICube AssetParallelDeltaGamma(this IPvModel pvModel, ICurrencyProv if (subPortfolio.Instruments.Count == 0) continue; + var bumpForCurve = bumpSize / 10 * curveObj.GetPriceForDate(model.BuildDate); + var lastDateInBook = subPortfolio.LastSensitivityDate; var baseModel = pvModel.Rebuild(model, subPortfolio); @@ -1507,8 +1512,8 @@ public static ICube AssetParallelDeltaGamma(this IPvModel pvModel, ICurrencyProv var tTypeIx = pvCube.GetColumnIndex(TradeType); - var bumpedCurveUp = GetBumpedCurve(bumpSize, curveObj, model.VanillaModel, currencyProvider); - var bumpedCurveDown = GetBumpedCurve(-bumpSize, curveObj, model.VanillaModel, currencyProvider); + var bumpedCurveUp = GetBumpedCurve(bumpForCurve, curveObj, model.VanillaModel, currencyProvider); + var bumpedCurveDown = GetBumpedCurve(-bumpForCurve, curveObj, model.VanillaModel, currencyProvider); var newVanillaModelUp = model.Clone(); newVanillaModelUp.AddPriceCurve(curveName, bumpedCurveUp); @@ -1529,8 +1534,8 @@ public static ICube AssetParallelDeltaGamma(this IPvModel pvModel, ICurrencyProv for (var i = 0; i < pvRows.Length; i++) { - var deltaUp = (bumpedRowsUp[i].Value - pvRows[i].Value) / bumpSize; - var deltaDown = (pvRows[i].Value - bumpedRowsDown[i].Value) / bumpSize; + var deltaUp = (bumpedRowsUp[i].Value - pvRows[i].Value) / bumpForCurve; + var deltaDown = (pvRows[i].Value - bumpedRowsDown[i].Value) / bumpForCurve; var delta = (deltaUp + deltaDown) / 2; if (delta != 0.0) { @@ -1552,7 +1557,7 @@ public static ICube AssetParallelDeltaGamma(this IPvModel pvModel, ICurrencyProv cube.AddRow(row, delta); } - var gamma = (deltaUp - deltaDown) / bumpSize; + var gamma = (deltaUp - deltaDown) / bumpForCurve; if (gamma != 0.0) { var row = new Dictionary diff --git a/version.props b/version.props index 6889d45c..5ff97e16 100644 --- a/version.props +++ b/version.props @@ -1,5 +1,5 @@ - 0.8.58 + 0.8.59 diff --git a/version.txt b/version.txt index 56e5878b..ce247a4d 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.8.58 \ No newline at end of file +0.8.59 \ No newline at end of file