Re: COUP_ bases.



Andreas J. Guelzow wrote:

>>> -----------------------------------------------------------------
>>> base 0: BASIS_30Ep360
>>>
>>> date adjustment:
>>> to_date is changed from last of month (whether 28, 29, 30, or 31) to
>>> 30th
>>> from_date is changed from last of month (whether 28, 29, 30, or 31)
>>> to 30th
>>>
>>> date difference:
>>> each month 30 days, within a month serial delta
>>>
>>
>> No, both for name and description.  Called either "PSA 30/360" or,
>> only by Excel, "NASD 30/360".  Try (28Feb01,28Feb01) to see why your
>> description is wrong.  Answer is -2, not zero as your description
>> would get.
>
>
>
> Pardon? Considering that you haven't seen the code yet, you would neeed
> to trust me that that is in fact what my current code has to do to Match
> XL.In XL when you calculate COUPDAYBS ("28-Feb-2001","28-Feb-2002",1,0)
> you get: 0 _not_ -2.
>
> Which name should we use? Remember _this_ _is_ the default!



Well perhaps my description does simpify what I have to do slightly.
Here is teh two code pieces of interest:

THis handles the valid dates:

                if (g_date_day (to) >= 30) {
                        g_date_set_day (to, 30);
                        if (g_date_day (from) == 31)
                                g_date_set_day (from, 30);
                }
                break;

but when I calculate differences:

  (30 * (g_date_month(to) - g_date_month(&from_date)))
   + ((in_order && g_date_is_last_of_month (to)) ? 30 : g_date_day (to))
   - ((!in_order && g_date_is_last_of_month (from)) ? 30
                                   : g_date_day (&from_date)));

okay what I should have said is:


 >>> base 0: BASIS_30Ep360
 >>>
 >>> date adjustment:
 >>> to_date is changed from last of month (whether 28, 29, 30, or 31) to
 >>> 30th
 >>> from_date is changed from 31 to 30th

Andreas


--
Prof. Dr. Andreas J. Guelzow
http://www.math.concordia.ab.ca/aguelzow





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