Skip to content

Commit

Permalink
Fix for central scenario of risk matrix when using time on other axis
Browse files Browse the repository at this point in the history
  • Loading branch information
gavbrennan committed Apr 27, 2022
1 parent 637aa9d commit c953124
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Qwack.Models/Risk/RiskMatrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,10 @@ public RiskMatrix(Currency c1, Currency c2, MutationType shiftType, RiskMetric m
IPvModel shiftedTime;
if (thisShiftAsset == 0)
shiftedTime = shifted;
else
{
d = d.AddPeriod(RollType.F, _calendar.GetCalendarSafe("USD"), iT.Bd());
shiftedTime = shifted.VanillaModel.Clone().RollModel(d, _currencyProvider);
shiftedTime = shifted.Rebuild(shiftedTime.VanillaModel, model.Portfolio.RollWithLifecycle(d, pd));
pd = d;
}
d = d.AddPeriod(RollType.F, _calendar.GetCalendarSafe("USD"), iT.Bd());
shiftedTime = shifted.VanillaModel.Clone().RollModel(d, _currencyProvider);
shiftedTime = shifted.Rebuild(shiftedTime.VanillaModel, model.Portfolio.RollWithLifecycle(d, pd));
pd = d;
results[assetIx * NTimeSteps.Value + iT] = new KeyValuePair<Tuple<string, string>, IPvModel>(
new Tuple<string, string>(thisLabelAsset, thisLabelTime), shiftedTime);
Expand Down

0 comments on commit c953124

Please sign in to comment.