Posted by
Alex McGuire on
URL: http://quantlib.414.s1.nabble.com/History-construction-tp2517p2518.html
Andre Louw wrote:
>Hi all,
>
>I have historical rates where the weekends/non-business days are missing.
>
>While looking at History I notice that feeding the History(dates,value)
>constructor with lists with missing dates/values causes it to fill these
>blanks with Null<double> values. Any objection to me propagating the last
>known value into these slots (in my example the Friday's rate will then be
>used as the last known rate)? I could always pass a flag to specify whether
>this must be done or not?
>
>
>
I wouldn't recommend that.
There are several ways the missing rates could be filled (last good
value, next good value, interpolation ...), so implementing this in the
constructor would need more than just a flag, complicating things somewhat.
Also, what does it mean to assign rates to weekends and bank-holidays,
when no such rates exist? Am I right in assuming you want to do this so
as to analyse the rates using some tool that expects daily rates? If so
might it not be a better idea to improve the analysis to take account of
weekends etc.
Supposing you really do need rates for every day, I think it would be
better to add a method to History to either
a) fill it's own gaps
b) return a copy with the gaps filled in
in either case taking some parameter that determines the rule used to
fill the gaps. I'd choose b) as I'm an immutability nut, but whatever.
cheers,
Alex McGuire