DepositExample.cpp
This example show how to create and value deposits.
Printing deposit Name: deposit2 Object: Deposit TradeDate: 2015-05-15 StartDate: 2015-05-19 Maturity: 2015-11-19 Notional: 2'000'000.00 Rate: 4.9500% (ACT365_Simple) Pricing deposit Object: Deposit TradeDate: 2014-10-24 StartDate: 2014-10-24 Maturity: 2015-11-06 Notional: 307'000.00 Rate: 5.4800% (ACT365_Simple) Date CF DF DCF 2015-11-06 324'422.80 0.9863799 320'004.11 Value of deposit: 320'004.11
#include <juliant.hpp>
using namespace julian;
using namespace std;
int main() {
//
// Defining auxiliary objects: calendar, interestRate, interest rate
//
Date today(2015,JUL,17);
PLNHoliday hol1;
.addHoliday(hol1)
.withSpotLag(2);
SimpleRate simple;
ACT365 yfact;
InterestRate wibor(simple,yfact);
ir::FlatCurve discounting_curve(wibor, 0.045, today, calendar);
//
// Defining deposits
//
.withTradeDate(today)
.usingCalendar(calendar)
.withNotional(10000)
.withInterestRate(wibor)
.withQuote(0.0515)
.withTenor(1*MONTH);
Deposit deposit2 = BuildLinearInstrument()
.usingCalendar(calendar)
.withNotional(2000000)
.withInterestRate(wibor)
.withQuote(0.0495)
.withTradeDate(2015, MAY, 15)
.withTenor(6*MONTH);
Deposit deposit3 = BuildLinearInstrument()
.withNotional(500000)
.withInterestRate(wibor)
.withQuote(0.0495)
.withTradeDate(2015, APR, 17)
.withStartDate(2015, APR, 18)
.withMaturityDate(2015, AUG, 22);
Deposit deposit4 = BuildLinearInstrument()
.usingCalendar(calendar)
.withNotional(307000)
.withInterestRate(wibor)
.withQuote(0.0548)
.withTradeDate(2014, OCT, 24)
.withStartDate(2014, OCT, 24)
.withMaturityDate(2015, NOV, 6);
std::cout << "\tPrinting deposit\n";
//
// Printing deposits
//
SHOW(deposit2);
//
// Value deposits
//
std::cout << "\tPricing deposit\n\n";
deposit4.valuation(discounting_curve);
}