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? André Louw Decillion Limited - "Your Risk Is Our Domain" Email: [hidden email] Office: +27 (11) 328 1256 Mobile: +27 (83) 414 5785 Fax: +27 (11) 442 4456 ------------------------------------------------------------------------- This e-mail is intended only for the use of the individual or entity named above and may contain information that is confidential and privileged, proprietary to the company and protected by law. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail is strictly prohibited. Opinions, conclusions and other information in this message that do not relate to the official business of our company shall be understood as neither given nor endorsed by it. |
Hi Andre,
At 02:35 PM 5/8/03 +0200, Andre Louw wrote: >I have historical rates where the weekends/non-business days are missing. A common occurrence :) >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? Hmm. Well, those fixings *are* missing after all, so I'd like them to be null as default behavior. You could add a flag (with default = false) that causes last values to be propagated. Bye, Luigi |
In reply to this post by Andre Louw-2
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? > > > 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 |
At 03:07 PM 5/8/03 +0100, Alex McGuire wrote:
>Andre Louw wrote: >>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. Good point. >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. I'd second that, and being a polymorphism nut, I'd dump the method and write a few history processors---each of them taking a History and returning a copy with gaps filled in according to its one rule. Bye, Luigi |
Free forum by Nabble | Edit this page |