ldate.h File Reference

#include "cdate.h"
#include "dateconv.h"
#include "busday.h"
#include "dateadj.h"

Defines

#define JPMCDS_BAD_DCC   -2L
#define JPMCDS_ACT_365   1L
#define JPMCDS_ACT_365F   2L
#define JPMCDS_ACT_360   3L
#define JPMCDS_B30_360   4L
#define JPMCDS_B30E_360   5L
#define JPMCDS_ACT_ACT   JPMCDS_ACT_365
#define JPMCDS_EFFECTIVE_RATE   8L
#define JPMCDS_DCC_LAST   JPMCDS_EFFECTIVE_RATE

Functions

int JpmcdsDtFwdAny (TDate startDate, TDateInterval *interval, TDate *sumDate)
 Moves forward by the specified interval.
int JpmcdsDayCountFraction (TDate beginDate, TDate endDate, long method, double *yearFrac)
 Calculates Day Count Fractions.
int JpmcdsDaysDiff (TDate beginDate, TDate endDate, long method, long *numDays)
 Calculates difference between two dates.
int JpmcdsIsLeap (TDate date, long *isLeap)
 Test if date falls in a leap year.
int JpmcdsYear (TDate, int *)
 Given a date in TDate, retrieve year as a four digit year.
int JpmcdsDaysLeftThisYear (TDate, int, long *)
 Calculates the number of days left in a year.
int JpmcdsYearStart (TDate, TDate *)
 Given a date in TDate, retrieve beginning of the year in TDate format.
int JpmcdsDateFwdThenAdjust (TDate date, TDateInterval *interval, long badDayMethod, char *holidayFile, TDate *advAdjustedDate)
 Moves forward by the specified TDateInterval, and then adjust to find a good day.

Detailed Description


Define Documentation

#define JPMCDS_ACT_360   3L

Actual/360

#define JPMCDS_ACT_365   1L

Actual/365

#define JPMCDS_ACT_365F   2L

Actual/365 Fixed

#define JPMCDS_B30_360   4L

30/360

#define JPMCDS_B30E_360   5L

30E/360

#define JPMCDS_BAD_DCC   -2L

Dummmy Day Count Conv for Brazilian bods

#define JPMCDS_EFFECTIVE_RATE   8L

Effective rate - YF always 1


Function Documentation

int JpmcdsDateFwdThenAdjust ( TDate  date,
TDateInterval interval,
long  badDayMethod,
char *  holidayFile,
TDate advAdjustedDate 
)

Moves forward by the specified TDateInterval, and then adjust to find a good day.

Basically a call to JpmcdsDtFwdAny followed by a call to JpmcdsBusinessDay.

Parameters:
date (I) Start date
interval (I) Interval to advance by
badDayMethod (I) JPMCDS_BAD_DAY_XYZ
holidayFile (I) Holiday file to use
advAdjustedDate (O) Advanced adjusted date

int JpmcdsDayCountFraction ( TDate  beginDate,
TDate  endDate,
long  method,
double *  yearFrac 
)

Calculates Day Count Fractions.

Calculates Day Count Fractions for following methods: 30/360, 30E/360, ACT/365, ACT/365F, ACT/360, etc.

int JpmcdsDaysDiff ( TDate  beginDate,
TDate  endDate,
long  method,
long *  numDays 
)

Calculates difference between two dates.

Methods currently covered:

  • Bond basis: 30, 30E
  • Actual

This function calculates the numerator for day count fraction

Parameters:
beginDate (I)
endDate (I)
method (I) Specifies day count method:
JPMCDS_B30_360 - 30/360 USA NASD

JPMCDS_B30E_360 - 30E/360 AIBD RULE 220

JPMCDS_ACT_365 - ACT/365 or ACT/ACT

JPMCDS_ACT_365F - ACT/365 Fixed

JPMCDS_ACT_360 - ACT/360

Parameters:
numDays (O) Number days between two dates

int JpmcdsIsLeap ( TDate  date,
long *  isLeap 
)

Test if date falls in a leap year.

Parameters:
date (I)
isLeap (O) 0 - if not a leap year
1 - if is a leap year

int JpmcdsYearStart ( TDate  ,
TDate  
)

Given a date in TDate, retrieve beginning of the year in TDate format.


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.