Posted by
marco.tarenghi on
URL: http://quantlib.414.s1.nabble.com/calendar-advance-problem-with-Days-TimeUnit-bug-tp6531p6532.html
When the shift period is not "Days",
the "advance" method works in this order 1) shift of tha period
2) adjustment on calendar business daysOn the other side, when the shift period
is "Days", the shift is made day by day on business days; so
a shift of 365Days is different from a shift of 1Year, and making a 365Days
shift will not take you a yera before.The same reasoning holds for forward
adjustment.I hope this answers youByeMarcoMmmmm, is the advance method thougth to work just
to really ADVANCE or also to
get back in the past? It seems there is a problem with the latter ... am
I wrong?
Reference Date: January 1st, 2008
Result of calendar.advance(referenceDate,-365,Days) = July 27th, 2006
Using QuantLib-0.9.6 and g++ 4.2.3
original code:
#include <ql/quantlib.hpp>
using namespace QuantLib;
// Simple program to test DayCounters and Calendar advance features
int main() {
Calendar calendar = TARGET();
Date referenceDate(1,January,2008);
std::cout << "\nReference Date: " <<
referenceDate << std::endl;
Date verify;
verify = calendar.advance(referenceDate, -365, Days);
std::cout << "Result of calendar.advance(referenceDate,-365,Days)
= "
<<verify << std::endl;
return 0;
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------
Il presente messaggio di posta elettronica e i suoi allegati sono destinati esclusivamente e personalmente al/ai destinatario/i e possono contenere informazioni di carattere riservato. Qualora non fosse il destinatario del presente messaggio la preghiamo di avvertirci immediatamente tramite posta elettronica o telefonicamente e di cancellare il presente messaggio e i suoi allegati dalla sua casella di posta elettronica e dai suoi sistemi. E’vietato copiare, utilizzare, comunicare e divulgare il presente messaggio senza autorizzazione. Questo messaggio non costituisce una sollecitazione all'investimento o un'offerta di acquisto o di vendita di strumenti finanziari o una conferma formale di un’operazione. Gruppo Banca Leonardo è impegnata solo dalle dichiarazioni dei propri legali rappresentanti. Poiché le trasmissioni elettroniche non garantiscono la sicurezza e la correttezza dei dati, non assumiamo alcuna responsabilità in merito alla completezza e accuratezza delle informazioni contenute nel presente messaggio.
L'indirizzo di posta elettronica dal quale viene inviato il presente messaggio non é un indirizzo privato del mittente. Si avverte che le risposte a questo messaggio potrebbero essere conosciute nell'organizzazione del mittente, nei limiti e con le procedure di legge.
------------------------------------------------------------
This e-mail and its attachment(s) are intended solely for the personal and confidential use of the addressee(s). If you are not the intended recipient of this message please notify us immediately by reply e-mail or by telephone and then delete this message and any file attached from your inbox and systems. Any unauthorized copy, use, disclosure, dissemination of this message is strictly prohibited. This communication should not be regarded as a solicitation or as an offer to sell or to buy any financial product, an official confirmation of any transaction, or as an official statement of Gruppo Banca Leonardo. E-mail transmissions cannot be guaranteed to be secure or error-free. Therefore, no representation is made that this information is complete or accurate and it should not be relied upon as such.
The e-mail address from which this message is being sent is not private to the sender. Please note that responses to this message could be known in the sender's organization, in compliance with the mandatory limits and procedures.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users