Mmmmm, 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 [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
When the shift period is not "Days", the "advance" method works in this order 1) shift of tha period 2) adjustment on calendar business days On 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 you Bye Marco
Mmmmm, 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 |
Hi- Is there an exposed excel function that advances according to a calendar? And when adjusting for business days, I assume it always goes to the following business day?
Thanks.
On 8/11/08, [hidden email] <[hidden email]> wrote:
------------------------------------------------------------------------- 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 |
I just can try to answer your second question: the adjustment is "Following" by default, but when using "advance" with shift period in "Days", whatever adjustment you choose it uses "Following" for forward shift and "Preceding" for backward shift. Marco
Hi- Is there an exposed excel function that advances according to a calendar? And when adjusting for business days, I assume it always goes to the following business day? Thanks. On 8/11/08, marco.tarenghi@...<marco.tarenghi@...> wrote: When the shift period is not "Days", the "advance" method works in this order 1) shift of tha period 2) adjustment on calendar business days On 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 you Bye Marco
|
In reply to this post by marco.tarenghi
<marco.tarenghi <at> bancaleonardo.com> writes:
> > > 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 youByeMarco Marco, thanks a lot for your replay. If I understand well, every Period object which has a "Days" time unit behaves like that ... so, if I have to calibrate a short-rate model, using for example SwaptionCalibrationHelper (which takes as first argument the maturity period of the swaption) and the maturity dates of the calibrating options, I should initialize the maturity period as: Date AsOfDate(1, January, 2008); std::vector< Date > swaptionMaturityDates(); // initialize maturity dates Calendar calendar = TARGET(); std::vector< Period > swaptionMaturityPeriods() for (int i = 0; i < swaptionMaturityDates.size(); ++i) { swaptionMaturityPeriods.push_back( Period firstMaturity(calendar.businessDaysBetween( AsOfDate, swaptionMaturityDates[i]) , Days) ) ); } ... instead of (the wrong way I've been using): DayCounter dc = ActualActual(); for (int i = 0; i < swaptionMaturityDates.size(); ++i) { swaptionMaturityPeriods.push_back( Period firstMaturity(dc.dayCount( AsOfDate, swaptionMaturityDates[i]) , Days) ) ); } ... am I right? Is there a better way to compute periods to initialize CalibrationHelpers? Thanks again, luca PS: can anybody pleeeease spend some words on the question I previously posted, titled "Calibrating Hull-White model with market data" (see http://article.gmane.org/gmane.comp.finance.quantlib.user/5007). I have found the SwaptionVolatilityMatrix class to interpolate volatilities, but what is the common practice? Any sample code? At least a link to a newby discussion :-) ------------------------------------------------------------------------- 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 |
On Thu, 2008-08-21 at 11:29 +0000, Luca Ferraro wrote:
> <marco.tarenghi <at> bancaleonardo.com> writes: > > > [...] 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. > > Marco, thanks a lot for your replay. > > [...]If I understand well, every Period object which has a "Days" time unit behaves > like that ... so [...] I should > initialize the maturity period as: > > for (int i = 0; i < swaptionMaturityDates.size(); ++i) { > swaptionMaturityPeriods.push_back( > Period firstMaturity(calendar.businessDaysBetween( > AsOfDate, swaptionMaturityDates[i]) , Days) ) > ); > } > > ... am I right? Is there a better way to compute periods to initialize > CalibrationHelpers? Luca, yes, you're right. Unfortunately, there's no better way. We should have used different enums for Days and BusinessDays, but I'm afraid it's a bit late for that---we'd have to change too much code... I'm open to suggestions if anyone comes up with an idea to bolt the choice between calendar/business days upon the current code (in a backward-compatible way, of course.) Luigi -- The economy depends about as much on economists as the weather does on weather forecasters. -- Jean-Paul Kauffmann ------------------------------------------------------------------------- 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 |
Free forum by Nabble | Edit this page |