44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#ifndef _ANALYTIC_BOND_HPP_
|
|
#define _ANALYTIC_BOND_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_GLOBALDATA_HPP_
|
|
#include <common/gdata.hpp>
|
|
#endif
|
|
#ifndef _ANALYTIC_INSTRUMENT_HPP_
|
|
#include <analytic/instrmnt.hpp>
|
|
#endif
|
|
#ifndef _ANALYTIC_RATE_HPP_
|
|
#include <analytic/rate.hpp>
|
|
#endif
|
|
|
|
class Bond : public Instrument
|
|
{
|
|
public:
|
|
Bond(void);
|
|
Bond(const Bond &bond);
|
|
Bond(double par,const Coupon &coupon,int ytm,double price=0.00);
|
|
virtual ~Bond();
|
|
Bond &operator=(const Bond &bond);
|
|
BOOL operator==(const Bond &bond)const;
|
|
double par(void)const;
|
|
void par(double par);
|
|
int ytm(void)const;
|
|
void ytm(int ytm);
|
|
const Rate &yield(void)const;
|
|
void yield(const Rate &yield);
|
|
virtual BOOL cashflows(GlobalData<double> &cashflows); // retrieve cashflows (ie)periodic payments
|
|
virtual double discount(Rate yield); // given the yield, calculate the price
|
|
virtual Rate discount(double price); // given the price, calculate the yield
|
|
private:
|
|
double mPar;
|
|
Rate mYield;
|
|
int mYTM;
|
|
};
|
|
#endif
|
|
|
|
|
|
|
|
|