Luigi Ballabio <[hidden email]> wrote on 12/09/2009 02:13:47 AM: > Hi Yan, > > On Fri, 2009-09-11 at 14:04 +1000, Yan Kuang wrote: > > I am build an AUD depo-future-swap curve. I have defined nessary > > interest rate index such as BBSW etc. > > Would you like to share them? If you're in a position to contribute > them, I'll add them to a future release. > Surely, but I need to finish my current work first. > > I implemeted AUD Bank Bill Future last trading date function: > > > > However, the [FuturesRateHelper] constructor required the future's > > last trading date as an IMM date, I have commented the > > QL_REQUIRE. > > I see. Yes, that might have been too specific. > > > > Also the the earliestDate shoule be: > > > > earliestDate_ = cal.advance(immDate, i->fixingDays(), Days); > > > > Instead of > > //earliestDate_ = immDate; > > That depends on how one defines the relevant date, doesn't it? > You're currently passing the fixing date for the rate, meaning that the > start of your accrual period is 2 days later. The convention currently > implemented seems to be that the IMM date is the value date, and the > fixing date is 2 days before that (Nando, you probably wrote the code: > is this correct?) However, the two conventions could be made to > agree---for instance, if your function or another similar one returned > the value date of the last trading date. > Agree, I had another look at IMM date in Quantlib, it's 3dr Wenesday, which is the underlying start date. Future last trading date or underlying start date can infer each other, so both way are ok. Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Yan Kuang
Yan Kuang <[hidden email]> wrote on 14/09/2009 09:35:14 AM: > > > Luigi Ballabio <[hidden email]> wrote on 12/09/2009 12:14:31 AM: > > > On Fri, 2009-09-11 at 14:28 +1000, Yan Kuang wrote: > > > As I pointed in the last email, Aussie market has similar situation > > > (under 3 year swaps are different from 4 years and plus). But that has > > > been handle in the swap index. > > > > > > [...] > > > > > > There are may be a clever way of doing this, e.g., passing in a > > > generic swap index. > > > The generic swap index should be able to tell you the market > > > conventions for each tenor. > > > > We need some kind of factory. We could use a factory class, but it's > > probably overkill. We could just add a factory method to SwapRate that > > returns a correctly-instantiated rate of the same family but with the > > given tenor. Yan, do you want to give it a try? > > > > Luigi, > > Thanks for the encouragement. I haven't done serious C++ programmingfor quite > a few years. I will certainly give it a go. However, I need to > finish a validation > project in two weeks times with quantlib, I then will take a two > weeks leaves. > > I plan to use quantlib quite extensively to assist some exotic ir > models validation > in the next six months. Certainly I hope to contribute. > > Cheers, > Yan > > Hi Luigi, I changed my mind, and had a go this afternoon. Basically I added a methods in SwapIndex: inline boost::shared_ptr<SwapIndex> SwapIndex::Create(const Period& new_tenor) { return boost::shared_ptr<SwapIndex> (new SwapIndex(familyName_, new_tenor, fixingDays_, currency_, fixingCalendar_, fixedLegTenor_, fixedLegConvention_, dayCounter_, iborIndex_)); } The object created is SwapIndex, not a subtype say GbpLiborSwapIsdaFix. However I think this is ok for two reasons: 1. One can always get the run time 'type' via familyName. 2. Logically subtype like GbpLiborSwapIsdaFix is almost like an instance (object) of SwapIndex. I changed atmStrike method to: Rate SwaptionVolatilityCube::atmStrike(const Date& optionD, const Period& swapTenor) const { return (swapIndexBase_->Create(swapTenor))->fixing(optionD); } Let me know what you think. Cheers, Yan Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Yan Kuang
On Mon, Sep 14, 2009 at 1:41 AM, Yan Kuang <[hidden email]> wrote:
> Agree, I had another look at IMM date in Quantlib, it's 3dr Wenesday, which > is the underlying start date. Future last trading date or underlying start > date can infer each other, so both way are ok. The IMMDates are defined as the 3rd Wednesday of March, June, September and December (or in a broader sense the 3rd Wednesday of any month) They are the delivery date of futures contracts on most (all?) exchanges. What is the last trading date for each contract depends on the contract, and generally speaking is not relevant for bootstrapping, the delivery date being the relevant one ciao -- Nando ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Yan Kuang
Hi Luigi, On the way home yesterday, I realissed Create method has to be virtual. I have attached three files this time us gbpliborswap as example. If this works, it will be better than the facotry pattern I think. Cheers, Yan
Yan Kuang <[hidden email]> wrote on 14/09/2009 09:35:14 AM: > > > Luigi Ballabio <[hidden email]> wrote on 12/09/2009 12:14:31 AM: > > > On Fri, 2009-09-11 at 14:28 +1000, Yan Kuang wrote: > > > As I pointed in the last email, Aussie market has similar situation > > > (under 3 year swaps are different from 4 years and plus). But that has > > > been handle in the swap index. > > > > > > [...] > > > > > > There are may be a clever way of doing this, e.g., passing in a > > > generic swap index. > > > The generic swap index should be able to tell you the market > > > conventions for each tenor. > > > > We need some kind of factory. We could use a factory class, but it's > > probably overkill. We could just add a factory method to SwapRate that > > returns a correctly-instantiated rate of the same family but with the > > given tenor. Yan, do you want to give it a try? > > > > Luigi, > > Thanks for the encouragement. I haven't done serious C++ programmingfor quite > a few years. I will certainly give it a go. However, I need to > finish a validation > project in two weeks times with quantlib, I then will take a two > weeks leaves. > > I plan to use quantlib quite extensively to assist some exotic ir > models validation > in the next six months. Certainly I hope to contribute. > > Cheers, > Yan > > Hi Luigi, I changed my mind, and had a go this afternoon. Basically I added a methods in SwapIndex: inline boost::shared_ptr<SwapIndex> SwapIndex::Create(const Period& new_tenor) { return boost::shared_ptr<SwapIndex> (new SwapIndex(familyName_, new_tenor, fixingDays_, currency_, fixingCalendar_, fixedLegTenor_, fixedLegConvention_, dayCounter_, iborIndex_)); } The object created is SwapIndex, not a subtype say GbpLiborSwapIsdaFix. However I think this is ok for two reasons: 1. One can always get the run time 'type' via familyName. 2. Logically subtype like GbpLiborSwapIsdaFix is almost like an instance (object) of SwapIndex. I changed atmStrike method to: Rate SwaptionVolatilityCube::atmStrike(const Date& optionD, const Period& swapTenor) const { return (swapIndexBase_->Create(swapTenor))->fixing(optionD); } Let me know what you think. Cheers, Yan Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141.[attachment "swapindex.hpp" deleted by Yan Kuang/CORPAU/WBCAU/WBG] [attachment "swaptionvolcube.cpp" deleted by Yan Kuang/CORPAU/WBCAU/WBG] ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users gbpliborswap.hpp (2K) Download Attachment swaptionvolcube.cpp (5K) Download Attachment swapindex.hpp (4K) Download Attachment |
In reply to this post by Ferdinando M. Ametrano-3
Future contract delivery date sometime is same as last trading date (AUD BBF, EuroDollar Futures ( Second London bank business day prior to the third Wednesday of the contract month)), or even after underlying index start date (NZ Bill Future). IMMDate is underlying start date. While last trading date (expiry date) is not used in curve construction, it's roll-over date, and very important to maintain a curve. For a future contract (whether used to construct curve), my view is that it is important to model the last trading date, and way to work out what is the underlying start date (last trading date + fixing). Cheers, Yan
On Mon, Sep 14, 2009 at 1:41 AM, Yan Kuang <[hidden email]> wrote: > Agree, I had another look at IMM date in Quantlib, it's 3dr Wenesday, which > is the underlying start date. Future last trading date or underlying start > date can infer each other, so both way are ok. The IMMDates are defined as the 3rd Wednesday of March, June, September and December (or in a broader sense the 3rd Wednesday of any month) They are the delivery date of futures contracts on most (all?) exchanges. What is the last trading date for each contract depends on the contract, and generally speaking is not relevant for bootstrapping, the delivery date being the relevant one ciao -- Nando Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Fixed a typo, new files attached:
Future contract delivery date sometime is same as last trading date (AUD BBF, EuroDollar Futures ( Second London bank business day prior to the third Wednesday of the contract month)), or even after underlying index start date (NZ Bill Future). IMMDate is underlying start date. While last trading date (expiry date) is not used in curve construction, it's roll-over date, and very important to maintain a curve. For a future contract (whether used to construct curve), my view is that it is important to model the last trading date, and way to work out what is the underlying start date (last trading date + fixing). Cheers, Yan
On Mon, Sep 14, 2009 at 1:41 AM, Yan Kuang <[hidden email]> wrote: > Agree, I had another look at IMM date in Quantlib, it's 3dr Wenesday, which > is the underlying start date. Future last trading date or underlying start > date can infer each other, so both way are ok. The IMMDates are defined as the 3rd Wednesday of March, June, September and December (or in a broader sense the 3rd Wednesday of any month) They are the delivery date of futures contracts on most (all?) exchanges. What is the last trading date for each contract depends on the contract, and generally speaking is not relevant for bootstrapping, the delivery date being the relevant one ciao -- Nando Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141.------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf_______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users gbpliborswap.hpp (2K) Download Attachment swapindex.hpp (4K) Download Attachment swaptionvolcube.cpp (5K) Download Attachment |
In reply to this post by Yan Kuang
On Tue, 2009-09-15 at 09:23 +1000, Yan Kuang wrote:
> On the way home yesterday, I realissedCreatemethod has to be virtual. Yes, I was about to point that out :) > I have attached three files this time us gbpliborswap as example. If > this works, it will be better than the facotry pattern I think. Ok. I added copying the yield term structure from the original index to the new one (it turns out we need that too) and implemented it in the remaining indexes. I just committed the changes to the repository. Thanks, Luigi -- Hofstadter's Law: It always takes longer than you expect, even when you take Hofstadter's Law into account. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Luigi, Yan
nice clean re-factoring of interest rate indexes. While you're there... a couple of issues. 1) The termstructure passed to SwapIndexes is the forwarding termstructure of the appropriate underlying iborIndex, but it's also used for discounting. The current market practice is to have a different discount curve: can we add this additional parameter? 2) EuriborSwap longer than 1Y use Euribor6M, while the 1Y swap uses Euribor3M: this imply that two different forwarding curves must be used. This breaks the single EuriborSwap factory approach, at least in SwaptionVolCube as we would need to use two factories. [by the way, please revert SwaptionVolCube to two EuriborSwap indexes/factories: as of Rev16469 it prevents me to use the correct different forwarding curves] 3) What about something along the line of decoupling the factory: EuriborSwapFactory(const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount); from the base class EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw, const Handle<YieldTermStructure>& discount); ciao -- Nando ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Nando and Luigi, A suggestion: EuriborSwap::EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount) ... tenor > 1*Years ? boost::shared_ptr<IborIndex>(new EURLibor(6*Months, fdw6M)) : boost::shared_ptr<IborIndex>(new EURLibor(3*Months, fdw3M))) {} ... Add two data members to EuriborSwap Handle<YieldTermStructure> fdw6M_; Handle<YieldTermStructure> fdw3M_; Add one data member in swapIndex Handle<YieldTermStructure> discount_; So that: EurLiborSwap::create(const Period& tenor) const { return boost::shared_ptr<SwapIndex>( new EurLiborSwap(tenor, fdw6M_, fdw3M_, discount_); This will work, and it's not too bad as we hide swapIndex definition from SwaptionVolCube. Alternatively we may decouple index from yield curve (market data), and add an association: map<std::string, Handle<YieldTermStructure> > curveMap; //market date association curveMap.insert(std::pair<std::string, Handle<YieldTermStructure> >("EURLibor6M", fdw6M); But too much works involved. Cheers, Yan
Luigi, Yan nice clean re-factoring of interest rate indexes. While you're there... a couple of issues. 1) The termstructure passed to SwapIndexes is the forwarding termstructure of the appropriate underlying iborIndex, but it's also used for discounting. The current market practice is to have a different discount curve: can we add this additional parameter? 2) EuriborSwap longer than 1Y use Euribor6M, while the 1Y swap uses Euribor3M: this imply that two different forwarding curves must be used. This breaks the single EuriborSwap factory approach, at least in SwaptionVolCube as we would need to use two factories. [by the way, please revert SwaptionVolCube to two EuriborSwap indexes/factories: as of Rev16469 it prevents me to use the correct different forwarding curves] 3) What about something along the line of decoupling the factory: EuriborSwapFactory(const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount); from the base class EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw, const Handle<YieldTermStructure>& discount); ciao -- Nando Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Ferdinando M. Ametrano
On Tue, 2009-09-15 at 17:33 +0200, Ferdinando M. Ametrano wrote:
> 1) The current market practice is to have a different discount curve > > 2) two different forwarding curves must be used. Right. I was stuck in 2007. Ok, I'm reverting the change until we figure it out. Later, Luigi -- Ninety percent of everything is crap. --- Theodore Sturgeon ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Luigi, I don't think we need to reverting the change, I think my suggestion will work, please give a comment on my email from yesterday (and I retached below). Cheers, Yan >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Nando and Luigi, A suggestion: EuriborSwap::EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount) ... tenor > 1*Years ? boost::shared_ptr<IborIndex>(new EURLibor(6*Months, fdw6M)) : boost::shared_ptr<IborIndex>(new EURLibor(3*Months, fdw3M))) {} ... Add two data members (private) to EuriborSwap Handle<YieldTermStructure> fdw6M_; Handle<YieldTermStructure> fdw3M_; Add one data member (protected) in swapIndex Handle<YieldTermStructure> discount_; So that: EurLiborSwap::create(const Period& tenor) const { return boost::shared_ptr<SwapIndex>( new EurLiborSwap(tenor, fdw6M_, fdw3M_, discount_); This will work, and it's not too bad as we hide swapIndex definition from SwaptionVolCube. Alternatively we may decouple index from yield curve (market data), and add an association: map<std::string, Handle<YieldTermStructure> > curveMap; //market date association curveMap.insert(std::pair<std::string, Handle<YieldTermStructure> >("EURLibor6M", fdw6M); But too much works involved. Cheers, Yan
On Tue, 2009-09-15 at 17:33 +0200, Ferdinando M. Ametrano wrote: > 1) The current market practice is to have a different discount curve > > 2) two different forwarding curves must be used. Right. I was stuck in 2007. Ok, I'm reverting the change until we figure it out. Later, Luigi -- Ninety percent of everything is crap. --- Theodore Sturgeon Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Thu, 2009-09-17 at 09:02 +1000, Yan Kuang wrote:
> I don't think we need to reverting the change, I think my suggestion > will work, please give a comment > on my email from yesterday (and I retached below). Yes, I'm sure it will work. However, it's a bigger change, and I'm not sure that the resulting interface is the one we want in the end. We'll have to think a bit more about it. For instance, about the sketch you made: > EuriborSwap::EuriborSwap(const Period& tenor, > const Handle<YieldTermStructure>& fdw6M, > const Handle<YieldTermStructure>& fdw3M, > const Handle<YieldTermStructure>& discount) Now if you want to create a swap index, you have to pass two forward curves even though you're only going to use one. Moreover: > Add two data members (private) to EuriborSwap > Handle<YieldTermStructure> fdw6M_; > Handle<YieldTermStructure> fdw3M_; > > Add one data member (protected) in swapIndex > > Handle<YieldTermStructure> discount_; > > EurLiborSwap::create(const Period& tenor) const { > return boost::shared_ptr<SwapIndex>( > new EurLiborSwap(tenor, fdw6M_, fdw3M_, discount_); It's three more data members and one method, now. Do we want to add the baggage to SwapIndex, or do we leave SwapIndex alone and create a separate factory class? Luigi -- The wisdom of the wise and the experience of the ages are perpetuated by quotations. -- Benjamin Disraeli ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Thu, Sep 17, 2009 at 10:40 AM, Luigi Ballabio <[hidden email]> wrote:
> Do we want to add the > baggage to SwapIndex, or do we leave SwapIndex alone and create a > separate factory class? I already proposed the latter. Let me revisit my proposal which is backward compatible and incremental. EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw = Handle<YieldTermStructure>(), const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); This preserves backward compatibility while allowing for discounting curve. Plus I would add a new constructor EuriborSwap(const Period& tenor, const boost::shared_ptr<Euribor>& euribor, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); which makes a lot more sense to me in the current market, as it makes evident the forwarding role being delegated to the Euribor index while the swap index is mainly concerned about discounting. This addition would also allow for a quick way to handle non-standard swaps, e.g. 10Y fix rate vs 3M Euribor Then the factory EuriborSwapFactory(const Handle<Euribor>& euribor6M, const Handle<Euribor>& euribor3M, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); EuriborSwapFactory(const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); boost::shared_ptr<EuriborSwapFactory> create(const Period& tenor, const Handle<Euribor>& euribor = Handle<Euribor>(), const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()) const; most of the code could be even templetized at the SwapIndex level, but I would leave this for a second step. Any feedback? -- RSS feed: http://www.google.com/reader/shared/ferdinando.ametrano ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Luigi Ballabio
Luigi Ballabio <[hidden email]> wrote on 17/09/2009 06:40:55 PM: > On Thu, 2009-09-17 at 09:02 +1000, Yan Kuang wrote: > > I don't think we need to reverting the change, I think my suggestion > > will work, please give a comment > > on my email from yesterday (and I retached below). > > Yes, I'm sure it will work. However, it's a bigger change, and I'm not > sure that the resulting interface is the one we want in the end. We'll > have to think a bit more about it. > > For instance, about the sketch you made: > > > EuriborSwap::EuriborSwap(const Period& tenor, > > const Handle<YieldTermStructure>& fdw6M, > > const Handle<YieldTermStructure>& fdw3M, > > const Handle<YieldTermStructure>& discount) > > Now if you want to create a swap index, you have to pass two forward > curves even though you're only going to use one. > > Moreover: > > > Add two data members (private) to EuriborSwap > > Handle<YieldTermStructure> fdw6M_; > > Handle<YieldTermStructure> fdw3M_; > > > > Add one data member (protected) in swapIndex > > > > Handle<YieldTermStructure> discount_; > > > > EurLiborSwap::create(const Period& tenor) const { > > return boost::shared_ptr<SwapIndex>( > > new EurLiborSwap(tenor, fdw6M_, fdw3M_, discount_); > > It's three more data members and one method, now. Do we want to add the > baggage to SwapIndex, or do we leave SwapIndex alone and create a > separate factory class? > EuriborSwap is already a 'Factory', it create a 'SwapIndex' according to tenor. The tenor decide which one of two 'IborIndex' (and the associated forward curves) to use. Adding the discount curve (one data member) to 'SwapIndex' is consistent with IborIndex with forecast curve. So I am in agreement with Nando here. I think it's nothing wrong to add data members to sub type like EuriborSwap. To Nando: If you just want to create a SwapIndex with one Euribor and assocated forecast curve, why don't you just use constructor of SwapIndex. So I am questioning why you need the following two constructor? So the key is whether you guys agree that EuriborSwap is already a 'Factory'. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw = Handle<YieldTermStructure>(), const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); This preserves backward compatibility while allowing for discounting curve. Plus I would add a new constructor EuriborSwap(const Period& tenor, const boost::shared_ptr<Euribor>& euribor, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Yan Kuang <[hidden email]> wrote on 18/09/2009 01:38:01 PM: > > > Luigi Ballabio <[hidden email]> wrote on 17/09/2009 06:40:55 PM: > > > On Thu, 2009-09-17 at 09:02 +1000, Yan Kuang wrote: > > > I don't think we need to reverting the change, I think my suggestion > > > will work, please give a comment > > > on my email from yesterday (and I retached below). > > > > Yes, I'm sure it will work. However, it's a bigger change, and I'm not > > sure that the resulting interface is the one we want in the end. We'll > > have to think a bit more about it. > > > > For instance, about the sketch you made: > > > > > EuriborSwap::EuriborSwap(const Period& tenor, > > > const Handle<YieldTermStructure>& fdw6M, > > > const Handle<YieldTermStructure>& fdw3M, > > > const Handle<YieldTermStructure>& discount) > > > > Now if you want to create a swap index, you have to pass two forward > > curves even though you're only going to use one. > > > > Moreover: > > > > > Add two data members (private) to EuriborSwap > > > Handle<YieldTermStructure> fdw6M_; > > > Handle<YieldTermStructure> fdw3M_; > > > > > > Add one data member (protected) in swapIndex > > > > > > Handle<YieldTermStructure> discount_; > > > > > > EurLiborSwap::create(const Period& tenor) const { > > > return boost::shared_ptr<SwapIndex>( > > > new EurLiborSwap(tenor, fdw6M_, fdw3M_, discount_); > > > > It's three more data members and one method, now. Do we want to add the > > baggage to SwapIndex, or do we leave SwapIndex alone and create a > > separate factory class? > > > > EuriborSwap is already a 'Factory', it create a 'SwapIndex' > according to tenor. > The tenor decide which one of two 'IborIndex' (and the associated > forward curves) to use. > > Adding the discount curve (one data member) to 'SwapIndex' is > consistent with IborIndex > with forecast curve. So I am in agreement with Nando here. > I think it's nothing wrong to add data members to sub type like EuriborSwap. > > To Nando: > > If you just want to create a SwapIndex with one Euribor and > assocated forecast curve, why don't > you just use constructor of SwapIndex. So I am questioning why you > need the following two constructor? > > So the key is whether you guys agree that EuriborSwap is already a 'Factory'. > > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > EuriborSwap(const Period& tenor, > const Handle<YieldTermStructure>& fdw = > Handle<YieldTermStructure>(), > const Handle<YieldTermStructure>& discount = > Handle<YieldTermStructure>()); > > This preserves backward compatibility while allowing for discounting > curve. Plus I would add a new constructor > > EuriborSwap(const Period& tenor, > const boost::shared_ptr<Euribor>& euribor, > const Handle<YieldTermStructure>& discount = > Handle<YieldTermStructure>()); > Fundamentally, having EurLiborSwapIsdaFixA, GbpLiborSwapIsdaFix etc as subtype of SwapIndex is not proper abstraction, as they are factories of SwapIndex. If we want to make it clean, we should remove all the these classes from quantlib. Instead, implementing Factory as: class SwapIndexFactory { public: virtual boost::shared_ptr<SwapIndex> operator()(const Period& tenor) =0; } class EuriborSwapFactory : SwapIndexFactory { public: EuriborSwapFactory(const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); virtual boost::shared_ptr<SwapIndex> operator()(const Period& tenor) { return boost::shared_ptr<SwapIndex> (new SwapIndex("GbpLiborSwapIsdaFix", // familyName ... } All the factory create SwapIndex type, rather than (run time) sub type. We can save any SwapIndex into database, load from data base etc. So the removal of the subtype like (EurLiborSwapIsdaFixA, GbpLiborSwapIsdaFix) is not only logically sound, but also practically good. Please consider our environment before printing this email. WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately. It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments. This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision. Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency. Westpac Banking Corporation ABN 33 007 457 141. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Yan Kuang
On Fri, Sep 18, 2009 at 5:38 AM, Yan Kuang <[hidden email]> wrote:
> EuriborSwap is already a 'Factory', it create a 'SwapIndex' > according to tenor. The tenor decide which one of two 'IborIndex' > (and the associated forward curves) to use. I agree that EuriborSwap is already a SwapIndex factory based on tenor. It's flawed in 4 ways: 1) it doesn't have a discount curve 2) it only has 1 forwarding curve instad of 2 (3M/6M) 3) it doesn't allow to create non-standard swap (eg 10Y fixed rate vs 3M euribor) 4) it focuses on tenor Unfortunately we have to keep it for backward compatibility (I for once don't care at all about backward compatibility, but I do understand the point). Anyway moving to EuriborSwap(const Period& tenor, const Handle<YieldTermStructure>& fdw = Handle<YieldTermStructure>(), const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); fixes point (1) in a backward compatible way. Adding the new constructor EuriborSwap(const Period& tenor, const boost::shared_ptr<Euribor>& euribor, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); would satisfy (3) and would allow to circumvent (2) in an incremental way. Point (4) cannot be fixed as it was the key design choice, which was good enough until a couple years ago. In the past the relevant point of a 10Y fixed rate vs floating rate was the 10Y length, and you almost didn't care if it was 3M or 6M floating rate. Today this is not true anymore. So I would add a new EuriborSwap factory (the only one I would use, deprecating/removing the old one). Let's call it EuriborSwap2 for sake of clarity EuriborSwap2(const Handle<Euribor>& euribor6M, const Handle<Euribor>& euribor3M, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); EuriborSwap2(const Handle<YieldTermStructure>& fdw6M, const Handle<YieldTermStructure>& fdw3M, const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()); boost::shared_ptr<EuriborSwap2> create(const Period& tenor, const Handle<Euribor>& euribor = Handle<Euribor>(), const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>()) const; Finally, I'm not sure I would give up SwapIndex subtyping. I must confess I've never exploited SwapIndex subtyping for compile time checks but the code above shows how IborIndex subtyping is used, requesting Euribor indexes instead of generic Ibor indexes. One day we might need something similar for SwapIndex, anyway I don't have strong opinion on this. Any code duplication between different currencies and fixing agencies could be avoided using template ciao -- Nando -- RSS feed: http://www.google.com/reader/shared/ferdinando.ametrano ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Yan Kuang
On Fri, 2009-09-18 at 13:38 +1000, Yan Kuang wrote:
> EuriborSwap is already a 'Factory', it create a 'SwapIndex' according > to tenor. > The tenor decide which one of two 'IborIndex' (and the associated > forward curves) to use. Oh, I see. You're talking about the QuantLibAddin class. I thought we were still talking about QuantLib proper. Ok, that is a factory indeed. And of course it could have any data members it needs to instantiate the swap indexes. > If you just want to create a SwapIndex with one Euribor and assocated > forecast curve, why don't > you just use constructor of SwapIndex. So I am questioning why you > need the following two constructor? > > EuriborSwap(const Period& tenor, > const Handle<YieldTermStructure>& fdw = > Handle<YieldTermStructure>(), > const Handle<YieldTermStructure>& discount = > Handle<YieldTermStructure>()); (Note: I'm talking about the core library here, since we might want to modify some code there as well. The addin could choose a different design. In the core library, the above should be a constructor for, e.g., EurLiborSwapIsdaFixA.) By having such constructors, you don't have to look up and insert the correct market conventions (calendars, business-day conventions, day counters etc.) It's true that you might delegate this entirely to a factory. But when you just need one index, it's simpler to build it directly (I see EurLiborSwapIsdaFixA as subtypes, not as factories) than to build a factory and ask it for the index. So all in all, I'd keep the subclasses and add the factories. Probably after 1.0, though. Luigi -- Within C++, there is a much smaller and cleaner language struggling to get out. -- Bjarne Stroustrup ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |