cxdatelist.h File Reference

#include "datelist.h"

Functions

TDateListJpmcdsDateListAddDates (TDateList *dl, int numItems, TDate *array)
 Adds dates to a TDateList.
TDateListJpmcdsDateListAddDatesFreeOld (TDateList *dl, int numItems, TDate *array)
 Adds dates to a TDateList and frees the input date list.
TDateListJpmcdsDateListTruncate (TDateList *dateList, TDate truncationDate, TBoolean inclusive, TBoolean excludeBefore, TBoolean inPlace)
 Truncates a date list at the specified date.
TDateListJpmcdsDateListMakeRegular (TDate startDate, TDate endDate, TDateInterval *interval, TStubMethod *stubType)

Detailed Description


Function Documentation

TDateList* JpmcdsDateListAddDates ( TDateList dl,
int  numItems,
TDate array 
)

Adds dates to a TDateList.

If the original date list and date list to be added are sorted, then the resulting date list will be sorted and duplicate dates will be removed. Sorting assumes ascending order ([0] < [1] etc).

If either of the inputs are not sorted, then the resulting date list will not be sorted, and some duplicates may remain.

For efficiency, we do not automatically try to sort the resulting date list for unsorted inputs. Sorting the date list each time appears to be a huge performance issue in some algorithms (where the input dates would all be sorted anyway).

Note that if dl is NULL, then this will create a new date list from the given dates.

Note that if numItems=0, this will copy the given date list.

TDateList* JpmcdsDateListAddDatesFreeOld ( TDateList dl,
int  numItems,
TDate array 
)

Adds dates to a TDateList and frees the input date list.

If the original date list and date list to be added are sorted, then the resulting date list will be sorted and duplicate dates will be removed. Sorting assumes ascending order ([0] < [1] etc).

If either of the inputs are not sorted, then the resulting date list will not be sorted, and some duplicates may remain.

For efficiency, we do not automatically try to sort the resulting date list for unsorted inputs. Sorting the date list each time appears to be a huge performance issue in some algorithms (where the input dates would all be sorted anyway).

Note that if dl is NULL, then this will create a new date list from the given dates.

Note that if numItems=0, this will copy the given date list.

The input date list is FREE'd by this routine. Thus if you have an algorithm which involves building up a datelist gradually, you can do something like this:

TDateList* dl = NULL; ... dl = JpmcdsDateListAddDatesFreeOld (dl, numItems, array); if (dl == NULL) goto done; .. dl = JpmcdsDateListAddDatesFreeOld (dl, numItems, array); if (dl == NULL) goto done; .. etc.

with the point being that you don't have to worry about the original date list at each step since this routine frees it for you.

Parameters:
dl (I/O) Initial date list - gets freed
numItems (I) Number of dates to add
array (I) [numItems] Dates to be added

TDateList* JpmcdsDateListMakeRegular ( TDate  startDate,
TDate  endDate,
TDateInterval interval,
TStubMethod stubType 
)

Makes a date list from a given start date to a given end date with dates seperated by a given interval

Use the stub parameter to determine whether the stub appears at the start or the end of the date list, and whether the stub is long or short.

The start date and end date are always both in the date list. The end date must be strictly after the start date. The date interval must be positive.

Parameters:
startDate (I) Start date
endDate (I) End date
interval (I) Date interval
stubType (I) Stub type

TDateList* JpmcdsDateListTruncate ( TDateList dateList,
TDate  truncationDate,
TBoolean  inclusive,
TBoolean  excludeBefore,
TBoolean  inPlace 
)

Truncates a date list at the specified date.

The resulting date list will contain all dates previous to (or following) the specified date. Dates in the datelist which match the specified date may be optionally included.

The datelist may optionally be modified in place or a new copy is returned.

The input date list must be sorted.

Parameters:
dateList (I/O) Date list to be modified in place
truncationDate (I) Date on which to perform trunctation
inclusive (I) TRUE=include truncation date if in list
excludeBefore (I) TRUE=exclude dates before truncation date
inPlace (I) TRUE=modify date list in place


Distributed by BN Algorithms Ltd -- consulting in quantitative finance, mathematical algorithms and software implementations. CDS Home Page. For enquires contact webs@bnikolic.co.uk.
This documentation is derived from ISDA CDS Standard Model version 1.7. You can get a copy of the original ISDA code at www.bnikolic.co.uk. This is a derivative work under the terms of the ISDA CDS Standard Model Public License. BN Algorithms Ltd licenses this work to you solely for on-screen viewing on your own computer. Making copies and further distribution of this work is prohibited.
This documentation is provided "as-is", without warranty of any kind, either expressed or implied, including, without limitation, warranties that the documentation is free of defects, merchantable, fit for a particular purpose or non-infringing. the entire risk as to the quality of the documentation is with you. Should this documentation prove defective in any respect, you (not the licensor) assume the cost of any necessary correction. This disclaimer of warranty constitutes an essential part of this license.