stub.h File Reference

#include "yearfrac.h"

Data Structures

struct  TStubMethod
 Combines all the types of stub information for swaps. More...

Defines

#define JPMCDS_BDC_MASK   0x000000FF
#define JPMCDS_STUB_POS_MASK   0x0000FF00
#define JPMCDS_STUB_POS_SHIFT   8
#define JPMCDS_STUB_POSN_MASK   1
#define JPMCDS_STUB_POSN_FRONT   0
#define JPMCDS_STUB_POSN_BACK   1
#define JPMCDS_STUB_LENGTH_MASK   2
#define JPMCDS_STUB_LENGTH_SHORT   0
#define JPMCDS_STUB_LENGTH_LONG   2

Typedefs

typedef long int TBadDayAndStubPos

Enumerations

enum  TStubPos { JPMCDS_STUB_POS_DEFAULT_AUTO = 0, JPMCDS_STUB_POS_DEFAULT_FRONT = 1, JPMCDS_STUB_POS_DEFAULT_BACK = 2 }
 Used to pass the default stub position.

Functions

int JpmcdsStubPayment (TDate prevCouponDate, TDate nextCoupon, TDate stubStart, TDate stubEnd, double rate, long couponDayCountConv, double *stubPayment)
 Computes stub payment.
int JpmcdsStringToStubMethod (char *name, TStubMethod *stubMethod)
 This function converts a string to a stub method.
int JpmcdsIsEndStub (TDate startDate, TDate maturityDate, TDateInterval *ivl, TStubPos stubPos, TBoolean *isEndStub)
 Returns TRUE if a stub should be at the end.
int JpmcdsStubPosMake (long stubPosValue, TStubPos *stubPos)
 Creates a TStubPos from a long.
int JpmcdsBadDayAndStubPosSplit (TBadDayAndStubPos badDayAndStubPos, long *badDayConv, TStubPos *stubPos)
 Extracts TStubPos and bad day convention from TBadDayAndStubPos.

Detailed Description


Function Documentation

int JpmcdsBadDayAndStubPosSplit ( TBadDayAndStubPos  badDayAndStubPos,
long *  badDayConv,
TStubPos stubPos 
)

Extracts TStubPos and bad day convention from TBadDayAndStubPos.

Parameters:
badDayAndStubPos (I) BDC and stub position
badDayConv (O) Bad day convention
stubPos (O) Stub position

int JpmcdsIsEndStub ( TDate  startDate,
TDate  maturityDate,
TDateInterval ivl,
TStubPos  stubPos,
TBoolean *  isEndStub 
)

Returns TRUE if a stub should be at the end.

The decision is based on the following. 1. First the default stub position is checked. If this is a back stub then return TRUE - if a front stub return FALSE. 2. If the default stub position is auto then the function will return TRUE, unless there is a stub in whach case FALSE is returned.

Parameters:
startDate (I) Start date
maturityDate (I) Maturity date
ivl (I) Interval
stubPos (I) Stub position
isEndStub (O) TRUE if end stub

int JpmcdsStringToStubMethod ( char *  name,
TStubMethod stubMethod 
)

This function converts a string to a stub method.

Parameters:
name (I) Stub method name
stubMethod (O) Stub method returned

int JpmcdsStubPayment ( TDate  prevCouponDate,
TDate  nextCoupon,
TDate  stubStart,
TDate  stubEnd,
double  rate,
long  couponDayCountConv,
double *  stubPayment 
)

Computes stub payment.

Minus accrued only set for Bond option with Front Stub.

Parameters:
prevCouponDate (I) Needed for Actual/Actual
nextCoupon (I) Needed for Actual/Actual
stubStart (I) When stub starts
stubEnd (I) When stub ends
rate (I) Annual rate
couponDayCountConv (I) See JpmcdsDayCountFraction
stubPayment (O) At stub End date

int JpmcdsStubPosMake ( long  stubPosValue,
TStubPos stubPos 
)

Creates a TStubPos from a long.

Parameters:
stubPosValue (I) Number representing stub position
stubPos (O) Stub position


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.