36 lines
912 B
C++
36 lines
912 B
C++
#ifndef _ANALYTIC_INSTRUMENT_HPP_
|
|
#define _ANALYTIC_INSTRUMENT_HPP_
|
|
#ifndef _COMMON_GLOBALDATA_HPP_
|
|
#include <common/gdata.hpp>
|
|
#endif
|
|
#ifndef _ANALYTIC_COUPON_HPP_
|
|
#include <analytic/coupon.hpp>
|
|
#endif
|
|
|
|
class Instrument
|
|
{
|
|
public:
|
|
enum Type{Generic,StraightBond,ZeroCouponBond};
|
|
Instrument(Type type=Generic);
|
|
Instrument(const Instrument &instrument);
|
|
virtual ~Instrument();
|
|
BOOL operator==(const Instrument &instrument)const;
|
|
Instrument &operator=(const Instrument &instrument);
|
|
double price(void)const;
|
|
void price(double price);
|
|
const Coupon &coupon(void)const;
|
|
void coupon(const Coupon &coupon);
|
|
Type type(void)const;
|
|
void type(Type type);
|
|
virtual BOOL cashflows(GlobalData<double> &cashflows);
|
|
virtual double par(void)const;
|
|
virtual double fv(int periods);
|
|
virtual double discount(double fv,int periods);
|
|
private:
|
|
double mPrice;
|
|
Coupon mCoupon;
|
|
Type mType;
|
|
};
|
|
#endif
|
|
|