dtlist.h File Reference

#include "cgeneral.h"
#include "cdate.h"

Functions

TDateListJpmcdsNewEmptyDateList (int numDates)
 Creates a new empty TDateList.
int JpmcdsExtendDateList (TDateList *dateList, int numDates)
 Extends a date list to the given number of dates.
TDateListJpmcdsNewDateListFromDates (TDate *dates, int numDates)
 Allocates a new TDateList and copies supplied dates into it.
void JpmcdsFreeDateList (TDateList *)
 Frees a DateList.
TDateListJpmcdsMergeDateLists (TDateList *dateList1, TDateList *dateList2)
 Merges two date lists such that the resultant date list represents the union of the original lists (no duplicates).
TDateListJpmcdsJpmcdsDateListAddDates (TDateList *dateList, int numDates, TDate *addDates, TBoolean allowDuplicates)
 Adds dates to a date list, and returns a new date list.
TDateListJpmcdsSubtractDateLists (TDateList *dateList, TDateList *subDates)
 Removes one date list from another date list, and returns a new date list.
TDateListJpmcdsCopyDateList (TDateList *dl)
 Makes a copy of a date list.
TDateListJpmcdsSortDateList (TDateList *dl)
 Sorts a datelist.
TDateListJpmcdsNewDateListDistinct (TDateList *theDateList)
 Takes away the excess same date elements in a DateList.
TDateListJpmcdsJpmcdsDateListTruncate (TDateList *dateList, TDate truncationDate, TBoolean inclusive, TBoolean excludeBefore, TBoolean inPlace)
 Truncates a date list at the specified date.

Detailed Description


Function Documentation

TDateList* JpmcdsCopyDateList ( TDateList dl  ) 

Makes a copy of a date list.

Returns NULL on error, or if the original datelist was NULL.

int JpmcdsExtendDateList ( TDateList dateList,
int  numDates 
)

Extends a date list to the given number of dates.

This involves re-allocating the array within the TDateList structure.

Requesting a smaller number of dates returns FAILURE and leaves the dateList unchanged.

TDateList* JpmcdsJpmcdsDateListAddDates ( TDateList dateList,
int  numDates,
TDate addDates,
TBoolean  allowDuplicates 
)

Adds dates to a date list, and returns a new date list.

Both the list of dates and the date list must be sorted. Keeps duplicates dates depending on the allowDuplicate flag (FALSE = remove duplicates, TRUE = keep them).

TDateList* JpmcdsJpmcdsDateListTruncate ( 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.

TDateList* JpmcdsMergeDateLists ( TDateList dateList1,
TDateList dateList2 
)

Merges two date lists such that the resultant date list represents the union of the original lists (no duplicates).

Resultant list will be in sorted order.

Note:

1. Both input lists must be in sorted order

2. Each original date list must not contain duplicates

3. If either of the datelists is NULL, it just makes a copy of the other and returns it. If both are NULL, it returns NULL.

TDateList* JpmcdsNewDateListDistinct ( TDateList theDateList  ) 

Takes away the excess same date elements in a DateList.

Especially, useful to clean up a DateList after going through bad-day adj.

TDateList* JpmcdsNewEmptyDateList ( int  numDates  ) 

Creates a new empty TDateList.

Note that it is permissible to create a TDateList with 0 dates.

TDateList* JpmcdsSortDateList ( TDateList dl  ) 

Sorts a datelist.

Returns NULL on FAILURE, and the sorted DateList on success.

TDateList* JpmcdsSubtractDateLists ( TDateList dateList,
TDateList subDates 
)

Removes one date list from another date list, and returns a new date list.

The input date lists may be unsorted. Output date list is sorted. Note the algorithm used may be inefficient if subDates is large.


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.