You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(17) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(23) |
| 2002 |
Jan
(18) |
Feb
(20) |
Mar
(22) |
Apr
(41) |
May
(28) |
Jun
(25) |
Jul
(10) |
Aug
(7) |
Sep
(5) |
Oct
(20) |
Nov
(13) |
Dec
(11) |
| 2003 |
Jan
(28) |
Feb
(5) |
Mar
(6) |
Apr
(5) |
May
(17) |
Jun
(6) |
Jul
(45) |
Aug
(35) |
Sep
(24) |
Oct
(50) |
Nov
(53) |
Dec
(6) |
| 2004 |
Jan
(4) |
Feb
(10) |
Mar
(52) |
Apr
(46) |
May
(8) |
Jun
(25) |
Jul
(12) |
Aug
(6) |
Sep
(8) |
Oct
(8) |
Nov
(9) |
Dec
(7) |
| 2005 |
Jan
(18) |
Feb
(60) |
Mar
(19) |
Apr
(26) |
May
(14) |
Jun
(27) |
Jul
(8) |
Aug
(15) |
Sep
(19) |
Oct
(53) |
Nov
(20) |
Dec
(23) |
| 2006 |
Jan
(16) |
Feb
(27) |
Mar
(33) |
Apr
(51) |
May
(36) |
Jun
(25) |
Jul
(54) |
Aug
(30) |
Sep
(25) |
Oct
(67) |
Nov
(43) |
Dec
(13) |
| 2007 |
Jan
(23) |
Feb
(27) |
Mar
(55) |
Apr
(79) |
May
(60) |
Jun
(66) |
Jul
(46) |
Aug
(30) |
Sep
(90) |
Oct
(49) |
Nov
(85) |
Dec
(74) |
| 2008 |
Jan
(68) |
Feb
(59) |
Mar
(64) |
Apr
(28) |
May
(66) |
Jun
(35) |
Jul
(73) |
Aug
(76) |
Sep
(65) |
Oct
(46) |
Nov
(41) |
Dec
(19) |
| 2009 |
Jan
(46) |
Feb
(90) |
Mar
(51) |
Apr
(104) |
May
(13) |
Jun
(24) |
Jul
(20) |
Aug
(39) |
Sep
(109) |
Oct
(101) |
Nov
(117) |
Dec
(57) |
| 2010 |
Jan
(55) |
Feb
(42) |
Mar
(39) |
Apr
(22) |
May
(33) |
Jun
(41) |
Jul
(25) |
Aug
(52) |
Sep
(75) |
Oct
(60) |
Nov
(62) |
Dec
(52) |
| 2011 |
Jan
(70) |
Feb
(31) |
Mar
(26) |
Apr
(28) |
May
(17) |
Jun
(38) |
Jul
(51) |
Aug
(35) |
Sep
(27) |
Oct
(35) |
Nov
(10) |
Dec
(20) |
| 2012 |
Jan
(21) |
Feb
(29) |
Mar
(13) |
Apr
(37) |
May
(33) |
Jun
(12) |
Jul
(34) |
Aug
(27) |
Sep
(29) |
Oct
(35) |
Nov
(58) |
Dec
(27) |
| 2013 |
Jan
(27) |
Feb
(16) |
Mar
(40) |
Apr
(16) |
May
(34) |
Jun
(37) |
Jul
(6) |
Aug
(3) |
Sep
(4) |
Oct
(49) |
Nov
(13) |
Dec
(12) |
| 2014 |
Jan
(15) |
Feb
(21) |
Mar
(11) |
Apr
(13) |
May
(27) |
Jun
(60) |
Jul
(19) |
Aug
(29) |
Sep
(20) |
Oct
(28) |
Nov
(41) |
Dec
(15) |
| 2015 |
Jan
(33) |
Feb
(29) |
Mar
(26) |
Apr
(17) |
May
(2) |
Jun
(13) |
Jul
(21) |
Aug
(30) |
Sep
(22) |
Oct
(15) |
Nov
(46) |
Dec
(20) |
| 2016 |
Jan
(6) |
Feb
(5) |
Mar
(9) |
Apr
(15) |
May
(9) |
Jun
(4) |
Jul
(3) |
Aug
(4) |
Sep
(39) |
Oct
(8) |
Nov
(5) |
Dec
(8) |
| 2017 |
Jan
(4) |
Feb
(14) |
Mar
(4) |
Apr
(16) |
May
(5) |
Jun
(10) |
Jul
(25) |
Aug
(2) |
Sep
(5) |
Oct
(11) |
Nov
(8) |
Dec
(11) |
| 2018 |
Jan
(7) |
Feb
(4) |
Mar
|
Apr
(1) |
May
(4) |
Jun
(21) |
Jul
(8) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(5) |
Mar
(18) |
Apr
(9) |
May
(5) |
Jun
(21) |
Jul
(25) |
Aug
(25) |
Sep
(4) |
Oct
(2) |
Nov
(2) |
Dec
(5) |
| 2020 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(6) |
Dec
|
| 2021 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(5) |
| 2022 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
(2) |
May
(5) |
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
(3) |
Oct
(14) |
Nov
|
Dec
(1) |
| 2023 |
Jan
(10) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(2) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2024 |
Jan
(8) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(1) |
| 2025 |
Jan
(3) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2026 |
Jan
(1) |
Feb
(12) |
Mar
|
Apr
(2) |
May
(8) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Luigi B. <lui...@gm...> - 2010-03-03 09:28:05
|
On Wed, 2010-03-03 at 09:47 +0100, Dima wrote: > Thanks Luigi and sorry for not having answered earlier. I'm busy. I > tried to build QL from the latest trunk > but was not sucessfull. And the stuff you added is not in the official > 1.0 version, so I couldn't really check. > Don't know what happened to the trunk files, they seem to be > corrupted. For example, in smilesection.hpp > I find > > <<<<<<<<<<.mine > > in the code. Its either a problem here or in the trunk. The trunk is clean. You modified the code on your machine, made a svn update, and got a conflict between your local changes and the changes pulled in by the update. Subversion doesn't know how to merge them and keeps both sets of changes between markers such as the one above. You'll have to resolve the conflict manually. You can see <http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html#svn.tour.cycle.resolve> for more details. Luigi -- The box said "Use Windows 95 or better," so I got a Macintosh. |
|
From: Dima <dim...@go...> - 2010-03-03 09:03:27
|
I see, thanks. Will get back to you 2010/3/3 Luigi Ballabio <lui...@gm...> > On Wed, 2010-03-03 at 09:47 +0100, Dima wrote: > > Thanks Luigi and sorry for not having answered earlier. I'm busy. I > > tried to build QL from the latest trunk > > but was not sucessfull. And the stuff you added is not in the official > > 1.0 version, so I couldn't really check. > > Don't know what happened to the trunk files, they seem to be > > corrupted. For example, in smilesection.hpp > > I find > > > > <<<<<<<<<<.mine > > > > in the code. Its either a problem here or in the trunk. > > The trunk is clean. You modified the code on your machine, made a svn > update, and got a conflict between your local changes and the changes > pulled in by the update. Subversion doesn't know how to merge them and > keeps both sets of changes between markers such as the one above. You'll > have to resolve the conflict manually. You can see > < > http://svnbook.red-bean.com/en/1.5/svn.tour.cycle.html#svn.tour.cycle.resolve> > for more details. > > Luigi > > > -- > > The box said "Use Windows 95 or better," so I got a Macintosh. > > > |
|
From: Ferdinando A. <na...@am...> - 2010-03-03 08:57:34
|
On Wed, Mar 3, 2010 at 9:09 AM, Yang Ye <lea...@ya...> wrote: > We got a problem for functions returning double with Office 2003 SP3. > E.g. function qlSmileSectionVolatility. Sometimes, it return just 0; > Sometimes, it return a very big number (negative/positive). We could > trace to > > returnValue = ObjectIdLibObjPtr->volatility( > StrikeCpp); > return &returnValue; > > returnValue is still correct before return. But Excel displayed the > wrong number. this is the second report I receive about this kind of problem. what version of Excel are you using? An user wrote me about Excel 2003 (11.8169.8172) SP3 having the bug while Excel 2003 (11.8237.8221) SP3 is working correctly. I use Excel 2003 (11.8220.8202) SP3 and don't have this problem. I googled around with no luck, I hope somebody more knowledgeable will help ciao -- Nando |
|
From: Dima <dim...@go...> - 2010-03-03 08:47:49
|
Thanks Luigi and sorry for not having answered earlier. I'm busy. I tried to build QL from the latest trunk but was not sucessfull. And the stuff you added is not in the official 1.0 version, so I couldn't really check. Don't know what happened to the trunk files, they seem to be corrupted. For example, in smilesection.hpp I find <<<<<<<<<<.mine in the code. Its either a problem here or in the trunk. 2010/2/15 Luigi Ballabio <lui...@gm...> > On Tue, 2009-04-21 at 09:49 +0200, Dima wrote: > > I've uploaded > > my current working version of the deltacalculator including a > > testsuite(your recent change not incl.). > > > > You can get it here: > > > > longvega.com/DeltaEngine.zip > > > > Dimitri, > I've added your stuff to the Subversion trunk under > q;/experimental/fx. > May you check it out and see that I haven't broken anything? > > Thanks, > Luigi > > > -- > > Academic: a term of opprobrium applied to those that do their job well > by those who cannot. > -- Sir Ernest Gowers > > > |
|
From: Ferdinando A. <na...@am...> - 2010-03-03 08:41:58
|
On Tue, Mar 2, 2010 at 9:21 PM, Nathan Abbott <nka...@gm...> wrote: > the user wants the NPV of the bond to be the amount > purchased * clean price / 100. and you know what... he's simply right The current engine does calculate the dirty price (results_.settlementValue) and some "npv" (results_.value) of questionable usefulness. My reservation about the current npv are: 1) it does include cashflows before or on bond settlement date, which in most situation do not belong to the npv 2) is valid for an holding amount of faceAmount (typically 100) > I am thinking the best way to solve this > problem is to create another pricing engine for the bond that calculates the > NPV of the bond to equal the amount purchased * the clean price / 100. the real issue in not the engine, but the current lack for the "holding amount" piece of info I would put it in the Bond class since it inherits from Instrument and so it should be homogeneous to other Instruments in portfolio evaluation. Luigi? ciao -- Nando |
|
From: Nathan A. <nka...@gm...> - 2010-03-02 20:21:13
|
I think I have a need for another pricing engine for the bond instrument. My users want to place bond in a portfolio that contains different type of instruments. Right now, I place all the instruments in a collection and then loop through the collection and call the NPV method of each instrument. The problem is that the user wants the NPV of the bond to be the amount purchased * clean price / 100. I am thinking the best way to solve this problem is to create another pricing engine for the bond that calculates the NPV of the bond to equal the amount purchased * the clean price / 100. Is this a common proiblem? If I wrote the engine, would people want it include in QuantLib? |
|
From: Andrea <mar...@go...> - 2010-02-27 20:25:42
|
This patch (which contains all outstanding patches for experimental/mcbasket)
enables products to price instruments depending on the yieldTermStructure (which might be stochastic).
For the time being it is still deterministic, but in the future it might change.
The key method of the payoff class is
virtual void value(const Matrix & path,
const std::vector<Handle<YieldTermStructure> > & forwardTermStructures,
Array & payments,
Array & exercises,
std::vector<Array> & states) const = 0;
the 2nd argument is the yield term structure on each fixing date.
An example to use it is
member variables
private:
mutable RelinkableHandle<YieldTermStructure> m_termStructure;
boost::shared_ptr<IborIndex> m_euribor3m;
then in value()
const Handle<YieldTermStructure> & yieldTermStructure = forwardTermStructures[i];
const Date & referenceDate = yieldTermStructure->referenceDate();
// relink term structure to actual value
m_termStructure.linkTo(yieldTermStructure.currentLink());
const Date spotDate = m_euribor3m->fixingCalendar().adjust(referenceDate);
const Rate spotEuribor = m_euribor3m->fixing(spotDate);
Attached the patch and a little example.
Andrea
|
|
From: Ferdinando A. <na...@am...> - 2010-02-26 09:39:19
|
On Thu, Feb 25, 2010 at 4:45 PM, Luigi Ballabio <lui...@gm...> wrote: > You can remove the warning by removing > > xBegin2_(this->xBegin_+n) > > from the initializer list and adding > > xBegin2_ = this->xBegin_+n; > > to the body of the constructor. done, thank you ciao -- Nando |
|
From: Luigi B. <lui...@gm...> - 2010-02-25 16:41:35
|
On Thu, 2010-02-25 at 14:01 +0900, dikshie wrote: > successfully run quantlib-1.0 on FreeBSD. > I filled FreeBSD's problem report for quantlib-1.0: > http://www.freebsd.org/cgi/query-pr.cgi?pr=144276 > > quantlib-1.0 probably will be committed to FreeBSD's ports tree > after FreeBSD-7.3 release. I didn't even know you were maintaining a port for FreeBSD. Thanks for the support. Luigi -- The first thing we do, let's kill all the lawyers. -- W. Shakespeare, "King Henry VI, Part II" |
|
From: Luigi B. <lui...@gm...> - 2010-02-25 15:46:11
|
On Wed, 2010-02-17 at 18:46 +0100, Ferdinando Ametrano wrote: > On Wed, Feb 17, 2010 at 10:36 AM, <lba...@us...> wrote: > > I have no idea what VC9 complains about, but the 'this->' is > > required by the C++ standard. > > see Visual Studio Help below > > ================================================ > > Error Message > 'this' : used in base member initializer list > > > The this pointer is valid only within nonstatic member functions. It > cannot be used in the initializer list for a base class. I see. Except we're using it for our own data members, not for a base class. Oh well. You can remove the warning by removing xBegin2_(this->xBegin_+n) from the initializer list and adding xBegin2_ = this->xBegin_+n; to the body of the constructor. Luigi -- All generalizations are false, including this one. -- Mark Twain |
|
From: dikshie <di...@gm...> - 2010-02-25 05:02:04
|
On Thu, Feb 25, 2010 at 1:35 AM, Luigi Ballabio <lui...@gm...> wrote: > > QuantLib is a cross-platform, free/open-source quantitative finance C++ > library for modeling, pricing, trading, and risk management in > real-life. > > Version 1.0 has been released and is available for download at > <http://quantlib.org/download.shtml>. successfully run quantlib-1.0 on FreeBSD. I filled FreeBSD's problem report for quantlib-1.0: http://www.freebsd.org/cgi/query-pr.cgi?pr=144276 quantlib-1.0 probably will be committed to FreeBSD's ports tree after FreeBSD-7.3 release. thanks! -dikshie- "FreeBSD's quantlib ports maintainer" |
|
From: Luigi B. <lui...@gm...> - 2010-02-24 16:54:36
|
On Wed, 2010-02-24 at 17:35 +0100, Luigi Ballabio wrote: > Version 1.0 has been released ...and let me thank all those who made it possible, especially Nando and Eric. I risked my sanity once or twice during the release process, and man, it's good to see the release out there. Now I just hope that any unknown bugs stay hidden for a few more weeks... Thanks again to everybody, Luigi -- Every solution breeds new problems. -- unknown |
|
From: Luigi B. <lui...@gm...> - 2010-02-24 16:35:59
|
QuantLib is a cross-platform, free/open-source quantitative finance C++ library for modeling, pricing, trading, and risk management in real-life. Version 1.0 has been released and is available for download at <http://quantlib.org/download.shtml>. Please log any problems you have with this release in the SourceForge bug tracker at <http://sourceforge.net/tracker/?group_id=12740&atid=112740> specifying that you're using QuantLib 1.0. The QuantLib group |
|
From: Andrea <mar...@go...> - 2010-02-23 20:38:24
|
Hi, I saw this comment and read the code for curiosity: for (; cf>=leg.begin() && (*cf)->date()==paymentDate; --cf) my question is is it legal to decrement an iterator when it is at .begin()? can this ever be false: "cf>=leg.begin()"? it reminds me the trick to do a backward for loop with a size_t. or maybe it is just nonsense... |
|
From: Luigi B. <lui...@gm...> - 2010-02-23 08:57:13
|
On Mon, 2010-02-22 at 20:05 +0100, Ferdinando Ametrano wrote: > On Mon, Feb 22, 2010 at 9:36 AM, Luigi Ballabio > <lui...@gm...> wrote: > > Try using reverse iterators. > > following your suggestion I found out a bug in the previousAmount and > previousRate functions, which was easily fixed switching to reverse > iterator (please find the patch below). > > Unfortunately the fix is not backward compatible as it requires > CashFlows::previousCashFlow and BondFunctions::previousCashFlow to > return a Leg::const_reverse_iterator instead of Leg::const_iterator. Well, it doesn't strictly require it---you could retrieve the iterator from the reverse iterator. But I see that the common use case would be to turn it into a reverse itereator again, so it makes more sense to change the signature. <sigh> Ok, I'm applying it. Commit the thing on the trunk asap. Luigi -- Do the right thing. It will gratify some people and astonish the rest. -- Mark Twain |
|
From: Ferdinando A. <na...@am...> - 2010-02-22 19:06:27
|
Hi Luigi
On Mon, Feb 22, 2010 at 9:36 AM, Luigi Ballabio <lui...@gm...>
wrote:
> Try using reverse iterators.
following your suggestion I found out a bug in the previousAmount and
previousRate functions, which was easily fixed switching to reverse iterator
(please find the patch below).
Unfortunately the fix is not backward compatible as it
requires CashFlows::previousCashFlow and BondFunctions::previousCashFlow to
return a Leg::const_reverse_iterator instead of Leg::const_iterator. I know
you just tagged 1.0, but this fix might be worth porting to 1.0 before
release. What is your opinion ?
ciao -- Nando
PS If you go for fixing the 1.0, less relevant backward-compatible bug-fix
Rev17144 and Rev17143 can be ported too
============ patch ===============================================
Index: ql/cashflows/cashflows.cpp
===================================================================
--- ql/cashflows/cashflows.cpp (revision 17128)
+++ ql/cashflows/cashflows.cpp (working copy)
@@ -81,29 +81,22 @@
return true;
}
- Leg::const_iterator
+ Leg::const_reverse_iterator
CashFlows::previousCashFlow(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
if (leg.empty())
- return leg.end();
+ return leg.rend();
if (settlementDate == Date())
settlementDate = Settings::instance().evaluationDate();
- if ( ! (*leg.begin())->hasOccurred(settlementDate,
- includeSettlementDateFlows) )
- return leg.end();
-
- Leg::const_iterator i = nextCashFlow(leg,
- includeSettlementDateFlows,
- settlementDate);
- // --i is not what we're looking for since there
- // might be more than one CashFlow at (*--i)->date()
- Date beforeLastPaymentDate = (*--i)->date()-1;
- return nextCashFlow(leg,
- includeSettlementDateFlows,
- beforeLastPaymentDate);
+ Leg::const_reverse_iterator i;
+ for (i = leg.rbegin(); i<leg.rend(); ++i) {
+ if ( (*i)->hasOccurred(settlementDate,
includeSettlementDateFlows) )
+ return i;
+ }
+ return leg.rend();
}
Leg::const_iterator
@@ -127,61 +120,52 @@
Date CashFlows::previousCashFlowDate(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
- Leg::const_iterator cf = previousCashFlow(leg,
-
includeSettlementDateFlows,
- settlementDate);
- if (cf==leg.end()) return Date();
+ Leg::const_reverse_iterator cf;
+ cf = previousCashFlow(leg, includeSettlementDateFlows,
settlementDate);
+
+ if (cf==leg.rend())
+ return Date();
+
return (*cf)->date();
}
Date CashFlows::nextCashFlowDate(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
- Leg::const_iterator cf = nextCashFlow(leg,
- includeSettlementDateFlows,
- settlementDate);
- if (cf==leg.end()) return Date();
+ Leg::const_iterator cf;
+ cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
+
+ if (cf==leg.end())
+ return Date();
+
return (*cf)->date();
}
Real CashFlows::previousCashFlowAmount(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
- Leg::const_iterator cf = previousCashFlow(leg,
-
includeSettlementDateFlows,
- settlementDate);
- if (cf==leg.end()) return Real();
+ Leg::const_reverse_iterator cf;
+ cf = previousCashFlow(leg, includeSettlementDateFlows,
settlementDate);
+ if (cf==leg.rend())
+ return Real();
+
Date paymentDate = (*cf)->date();
Real result = 0.0;
-
- // when cf==leg.begin() the following code crashes at --cf
- // on VC8/9 Debug (boundary check)
- // but it also crashes in Release mode as if it would evaluate
- // (*cf) even when cf<leg.begin()
- //
- // help or suggestion would be appreciated
- //
- //for (; cf>=leg.begin() && (*cf)->date()==paymentDate; --cf)
- // result += (*cf)->amount();
-
- // ugly patch...
- for (; cf>leg.begin() && (*cf)->date()==paymentDate; --cf)
+ for (; cf<leg.rend() && (*cf)->date()==paymentDate; ++cf)
result += (*cf)->amount();
- if (cf==leg.begin() && (*cf)->date()==paymentDate)
- result += (*cf)->amount();
-
return result;
}
Real CashFlows::nextCashFlowAmount(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
- Leg::const_iterator cf = nextCashFlow(leg,
- includeSettlementDateFlows,
- settlementDate);
- if (cf==leg.end()) return Real();
+ Leg::const_iterator cf;
+ cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
+ if (cf==leg.end())
+ return Real();
+
Date paymentDate = (*cf)->date();
Real result = 0.0;
for (; cf<leg.end() && (*cf)->date()==paymentDate; ++cf)
@@ -192,18 +176,20 @@
// Coupon utility functions
namespace {
+ template<typename Iter>
Rate aggregateRate(const Leg& leg,
- Leg::const_iterator cf) {
- if (cf==leg.end()) return 0.0;
+ Iter first,
+ Iter last) {
+ if (first==last) return 0.0;
- Date paymentDate = (*cf)->date();
+ Date paymentDate = (*first)->date();
bool firstCouponFound = false;
Real nominal = 0.0;
Time accrualPeriod = 0.0;
DayCounter dc;
Rate result = 0.0;
- for (; cf<leg.end() && (*cf)->date()==paymentDate; ++cf) {
- shared_ptr<Coupon> cp = dynamic_pointer_cast<Coupon>(*cf);
+ for (; first<last && (*first)->date()==paymentDate; ++first) {
+ shared_ptr<Coupon> cp =
dynamic_pointer_cast<Coupon>(*first);
if (cp) {
if (firstCouponFound) {
QL_REQUIRE(nominal == cp->nominal() &&
@@ -221,7 +207,7 @@
}
}
QL_ENSURE(firstCouponFound,
- "next cashflow (" << paymentDate << ") is not a
coupon");
+ "no coupon paid at cashflow date " << paymentDate);
return result;
}
@@ -230,19 +216,18 @@
Rate CashFlows::previousCouponRate(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
- Leg::const_iterator cf = previousCashFlow(leg,
-
includeSettlementDateFlows,
- settlementDate);
- return aggregateRate(leg, cf);
+ Leg::const_reverse_iterator cf;
+ cf = previousCashFlow(leg, includeSettlementDateFlows,
settlementDate);
+
+ return aggregateRate<Leg::const_reverse_iterator>(leg, cf,
leg.rend());
}
Rate CashFlows::nextCouponRate(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate) {
- Leg::const_iterator cf = nextCashFlow(leg,
- includeSettlementDateFlows,
- settlementDate);
- return aggregateRate(leg, cf);
+ Leg::const_iterator cf;
+ cf = nextCashFlow(leg, includeSettlementDateFlows, settlementDate);
+ return aggregateRate<Leg::const_iterator>(leg, cf, leg.end());
}
Date CashFlows::accrualStartDate(const Leg& leg,
Index: ql/cashflows/cashflows.hpp
===================================================================
--- ql/cashflows/cashflows.hpp (revision 17127)
+++ ql/cashflows/cashflows.hpp (working copy)
@@ -55,7 +55,7 @@
//! \name CashFlow functions
//@{
//! the last cashflow paying before or at the given date
- static Leg::const_iterator
+ static Leg::const_reverse_iterator
previousCashFlow(const Leg& leg,
bool includeSettlementDateFlows,
Date settlementDate = Date());
Index: ql/pricingengines/bond/bondfunctions.cpp
===================================================================
--- ql/pricingengines/bond/bondfunctions.cpp (revision 17144)
+++ ql/pricingengines/bond/bondfunctions.cpp (working copy)
@@ -47,8 +47,9 @@
return bond.notional(settlement)!=0.0;
}
- Leg::const_iterator BondFunctions::previousCashFlow(const Bond& bond,
- Date settlement) {
+ Leg::const_reverse_iterator
+ BondFunctions::previousCashFlow(const Bond& bond,
+ Date settlement) {
if (settlement == Date())
settlement = bond.settlementDate();
Index: ql/pricingengines/bond/bondfunctions.hpp
===================================================================
--- ql/pricingengines/bond/bondfunctions.hpp (revision 17127)
+++ ql/pricingengines/bond/bondfunctions.hpp (working copy)
@@ -60,8 +60,9 @@
//! \name CashFlow inspectors
//@{
- static Leg::const_iterator previousCashFlow(const Bond& bond,
- Date refDate = Date());
+ static Leg::const_reverse_iterator
+ previousCashFlow(const Bond& bond,
+ Date refDate = Date());
static Leg::const_iterator nextCashFlow(const Bond& bond,
Date refDate = Date());
static Date previousCashFlowDate(const Bond& bond,
|
|
From: Luigi B. <lui...@gm...> - 2010-02-22 08:38:05
|
On Fri, 2010-02-19 at 15:57 +0000, na...@us... wrote: > Revision: 17134 > http://quantlib.svn.sourceforge.net/quantlib/?rev=17134&view=rev > Author: nando > Date: 2010-02-19 15:57:38 +0000 (Fri, 19 Feb 2010) > > Log Message: > ----------- > added tolerance for firstDate==effectiveDate and nextToLastDate==terminationDate > > Modified Paths: > -------------- > trunk/QuantLib/ql/time/schedule.cpp It would be nice to have test cases for these changes, wouldn't it? :) Luigi -- Any software problem can be solved by adding another layer of indirection. -- Steven M. Bellovin |
|
From: Luigi B. <lui...@gm...> - 2010-02-22 08:36:55
|
On Fri, 2010-02-19 at 11:36 +0000, na...@us... wrote: > Revision: 17128 > http://quantlib.svn.sourceforge.net/quantlib/?rev=17128&view=rev > Author: nando > Date: 2010-02-19 11:36:03 +0000 (Fri, 19 Feb 2010) > > Log Message: > ----------- > ugly unreasonable patch, help would be appreciated Try using reverse iterators. Luigi -- Don't let school get in the way of your education. -- Mark Twain |
|
From: Ferdinando A. <na...@am...> - 2010-02-17 17:47:27
|
On Wed, Feb 17, 2010 at 10:36 AM, <lba...@us...> wrote:
> I have no idea what VC9 complains about, but the 'this->' is
> required by the C++ standard.
see Visual Studio Help below
ciao -- Nando
================================================
Error Message
'this' : used in base member initializer list
The this pointer is valid only within nonstatic member functions. It
cannot be used in the initializer list for a base class.
The base-class constructors and class member constructors are called
before this constructor. In effect, you've passed a pointer to an
unconstructed object to another constructor. If those other
constructors access any members or call member functions on this, the
result will be undefined. You should not use the this pointer until
all construction has completed.
This is a level-1 warning under Microsoft extensions (/Ze) and a
level-4 warning otherwise.
The following sample generates C4355:
// C4355.cpp
// compile with: /W1 /c
#include <tchar.h>
class CDerived;
class CBase {
public:
CBase(CDerived *derived): m_pDerived(derived) {};
~CBase();
virtual void function() = 0;
CDerived * m_pDerived;
};
class CDerived : public CBase {
public:
CDerived() : CBase(this) {}; // C4355 "this" used in derived c'tor
virtual void function() {};
};
CBase::~CBase() {
m_pDerived -> function();
}
int main() {
CDerived myDerived;
}
|
|
From: Luigi B. <lui...@gm...> - 2010-02-17 15:27:22
|
On Wed, 2010-02-17 at 16:11 +0100, Ferdinando Ametrano wrote: > On Wed, Feb 17, 2010 at 10:21 AM, Luigi Ballabio > <lui...@gm...> wrote: > > On Tue, 2010-02-16 at 19:09 +0000, na...@us... wrote: > >> added more Coupon inspectors > > > > We're duplicating code all over the place---they're all basically the > > same loop. Why don't you write a nextCoupon() method instead and call > > whatever method you want on the result? > > you're right and this is true for both nextCashFlow and nextCoupon, > their "previous" variants, and their CashFlows and Bond flavors > > Anyway if bond_ is a shared_ptr<Bond> you would then have to write > > (*BondFunctions::nextCashFlow(*bond_))->date(); > > instead of > > bond_->nextCashFlowDate(); Worse---You'd have to check for a null iterator first. Ok, I can see it's good to have the whole bunch of functions for convenience. Plus there's the aggregation thing. It might still be worth to write the common loop in a nextCoupon() method (private, if need be) so that at least the functions returning a date can call it and remove a good part of the duplication. For the aggregation, I don't know. I had though of returning a range (begin,end) of the cashflows on the same date, but it wouldn't work if there was a non-coupon cashflow between two coupons. Maybe a composite, as you say. Well, I'll let you know if I get any ideas... Luigi -- A programming language is low-level when its programs require attention to the irrelevant. -- Alan Perlis |
|
From: Ferdinando A. <na...@am...> - 2010-02-17 15:12:09
|
On Wed, Feb 17, 2010 at 10:21 AM, Luigi Ballabio <lui...@gm...> wrote: > On Tue, 2010-02-16 at 19:09 +0000, na...@us... wrote: >> added more Coupon inspectors > > We're duplicating code all over the place---they're all basically the > same loop. Why don't you write a nextCoupon() method instead and call > whatever method you want on the result? you're right and this is true for both nextCashFlow and nextCoupon, their "previous" variants, and their CashFlows and Bond flavors Anyway if bond_ is a shared_ptr<Bond> you would then have to write (*BondFunctions::nextCashFlow(*bond_))->date(); instead of bond_->nextCashFlowDate(); You might have multiple CashFlow on the same date, so nextCashFlow might actually aggregate flows and create a new AggregateCashFlow instance, then returning a shared_ptr instead of an iterator. In this case one would have to write: BondFunctions::nextCashFlow(*bond_)->date(); As for nextCoupon it should return an instance of some AggregateCoupon class. This class would have pointers to the Coupons to be aggregated for its own nominal() and rate() method implementations. What do you think about it ? ciao -- Nando |
|
From: Ferdinando A. <na...@am...> - 2010-02-17 14:26:00
|
On Wed, Feb 17, 2010 at 10:21 AM, Luigi Ballabio <lui...@gm...> wrote: > On Tue, 2010-02-16 at 19:20 +0000, na...@us... wrote: >> added XXX::operator boost::shared_ptr<Leg>() const > > Why? Leg is not polymorphic (it's a std::vector), and shared_ptr<Leg> is > not used anywhere in the library (I'd probably remove it if it was :) you're right, my fault: reverted. thank you ciao -- Nando |
|
From: Luigi B. <lui...@gm...> - 2010-02-17 09:21:33
|
On Tue, 2010-02-16 at 19:09 +0000, na...@us... wrote: > Revision: 17105 > http://quantlib.svn.sourceforge.net/quantlib/?rev=17105&view=rev > Author: nando > Date: 2010-02-16 19:09:58 +0000 (Tue, 16 Feb 2010) > > Log Message: > ----------- > added more Coupon inspectors We're duplicating code all over the place---they're all basically the same loop. Why don't you write a nextCoupon() method instead and call whatever method you want on the result? Luigi -- These are my principles, and if you don't like them... Well, I have others. -- Groucho Marx |
|
From: Luigi B. <lui...@gm...> - 2010-02-17 09:21:26
|
On Tue, 2010-02-16 at 19:20 +0000, na...@us... wrote: > Revision: 17107 > http://quantlib.svn.sourceforge.net/quantlib/?rev=17107&view=rev > Author: nando > Date: 2010-02-16 19:20:57 +0000 (Tue, 16 Feb 2010) > > Log Message: > ----------- > added XXX::operator boost::shared_ptr<Leg>() const Why? Leg is not polymorphic (it's a std::vector), and shared_ptr<Leg> is not used anywhere in the library (I'd probably remove it if it was :) Luigi -- I am extraordinarily patient, provided I get my own way in the end. -- Margaret Thatcher |
|
From: Luigi B. <lui...@gm...> - 2010-02-15 14:02:43
|
On behalf of Eric Ehlers, whose Internet is broken: =================================================== Hi all, Quoting Luigi Ballabio <luigi.ballabio@...>: > Hi all, > another beta for QuantLib 1.0 is available at > <https://sourceforge.net/projects/quantlib/files/prerelease/>. I have uploaded the QLXL/QLA/OH 1.0 beta 3 tarballs to the same directory. There was no beta 1 or 2 release of QLXL/QLA/OH but I called it beta 3 to indicate that it's compatible with the QuantLib 1.0 beta 3 release which is also available at that link. I would be grateful to anyone who could test the files and report any problems. Kind Regards, Eric |