Skip to content

Commit

Permalink
Fix for period premia
Browse files Browse the repository at this point in the history
  • Loading branch information
gavbrennan committed Jul 2, 2024
1 parent 000487c commit bd1da07
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Qwack.Dates/DateExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public static (DateTime Start, DateTime End) ParsePeriod(this string period)
return (Start: new DateTime(dm.Year, dm.Month, 1), End: new DateTime(dm.Year, dm.Month, 1).LastDayOfMonth());
case string p when Months.Contains(p): //Jun
var mx = Array.IndexOf(Months, p) + 1;
var yx = DateTime.Today.Month >= mx ? DateTime.Today.Year : DateTime.Today.Year + 1;
var yx = DateTime.Today.Month >= mx ? DateTime.Today.Year : (DateTime.Today.Year + 1);
return (Start: new DateTime(yx, mx, 1), End: new DateTime(yx, mx, 1).LastDayOfMonth());
case string p when p.Length == 2 && int.TryParse(p.Substring(1, 1), out var yr) && FutureMonths.Contains(p.Substring(0, 1)): //X8
var m1 = Array.IndexOf(FutureMonths, p.Substring(0, 1)) + 1;
Expand Down
2 changes: 1 addition & 1 deletion src/Qwack.Paths/Payoffs/MultiPeriodBackPricingOptionPP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void Process(IPathBlock block)
setReg[i] = spotAtExpiry[i] * _expiryToSettleCarry;
}
var futVec = new Vector<double>(futSum);
avgs[a] = (futVec + pastSum) / nTotalVec[a];
avgs[a] = (futVec + pastSum) / nTotalVec[a] + new Vector<double>(_periodPremia[a]);
}
else
{
Expand Down

0 comments on commit bd1da07

Please sign in to comment.