Re: COUPDAY* functions

Neil Booth wrote:

Andreas J. Guelzow wrote:-

I didn't read his message properly then.

The implementations of Act/Act and 30/360 (US) are wrong.

Pardon me?

COUPNCD is independent from the bases chosen.

I know, after all, it was me who told _you_ that!  But have you read
the subject of the message, or the content of the original?

Now, I didn't download the file that was linked to, but the original
message and the subject don't make it sound like the only problem is
coupncd.  From glancing at the code, I think you've got ncd / pcd
correct, which is great.

It wasn't quite correct (ie. it didn't match XL because they fell into a trap. Well, we can do that too. I committed appropriate change s a few hours ago.

 If Excel has it wrong, that's really sad; I
know you want to introduce the compatibility option.

They ar edefinitely wrong... because a 11/29/2001 maturity date should not have a quarterly coupon at 11/28/2000, I think

If you want to be compatible, what exactly is the Excel implementation
doing?  I'm curious, because it appears awfully broken from the
example you posted;

They simply backtrack by 3 or 6 months as appropriate. Whene they hit February 29th becomes 28th... they never go back to 29th.

I can't imagine how you could get the answers it
gives.  (After all, the obvious implementation is to take the day of
the maturity date and shove it into a new create-serial-date function,
with the appropriate month and year, and with the day adjusted for EOM
if necessary).  I guess they must be counting days to get coupon dates
or something daft like that.

It turns out that using serial dates makes things awfully complicated. That's why I decided to stay with GDate. couppcd and coupncd now mathces XL. (We will have a correct implementation with a fifth argument eom/oem.

But anyway, my message was about the day count stuff like DAYS360 and
COUPDAYBS and COUPDAYSNC; I _think_ the latter are broken for Act/Act
and and 30/360.

THe basis=0 30/360 convention wasn't quite right, but I nearly got it now. (Febraury 28th sometimes becomes February 30th in the calscs)

 As always, I could be wrong - the more you find out
about bond conventions, the less willing you are to ever be certain
8-) Some conventions are mind numbingly weird, and no two countries
have the same conventions.


Why can't they use real dates???

(Don't answer that, it's rhetorical)


PS: Getting close to finishing coup...

Prof. Dr. Andreas J. Guelzow

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]