Eric, I implemented InterestRate as coupon parameter (in an new qlnew2FixedRateBond class, just for while) and want to make use of Coercion in order to make it backward compatible (so I can use the qlFixedRateBond). The idea of Coercion is clear but I didn't fully understand the implementation. Must I (let take Quote as example): Create the proper conversions in QuantLibAddin\qlo\conversions
Do you mind giving some directions so I could do it? Regards,
------------------------------------------------------------------------------ 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Tue, Sep 15, 2009 at 12:36 AM, Piter Dias <[hidden email]> wrote:
> I implemented InterestRate as coupon parameter (in an new > qlnew2FixedRateBond class, just for while) and want to make use of Coercion > in order to make it backward compatible (so I can use the qlFixedRateBond). what would you coerce it to? it escapes me how you could make it backward compatible; I might suggest to just add another signature if needed. 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
> what would you coerce it to? I would like to enhance the qlFixedRateBond Excel function in order to model some Brazilian bonds but I was just able in two ways that is not backward compatible: 1) Creating two new fields (Compounding and Frequency) but it would break current spreadsheets because the automatic code generation makes the fields Permanent and Trigger always as the last ones. So my new fields would be created between the IssueDate and Permanent fields, 2) Change the coupons vector from QuantLib:Rates to QuantLib::InterestRate. It breaks backward compatibility because, currently, it just accepts a handle created by qlInterestRate. When I send a Rate it crashes. A third way is create a new Excel function, the way I am doing the test, but the second way seems to be much better. Eric told that Coercion would help me on this (so I can use to convert QuantLib:Rates to QuantLib::InterestRate) but I am not sure if I got all the steps to make it. > it escapes me how you could make it backward compatible; I might > suggest to just add another signature if needed. I believe it won't work for Excel because it only accepts two functions with different names, doesn't matter if the signature is different. May you help me? Regards, ------------------------- Piter Dias [hidden email] ------------------------------------------------------------------------------ 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Tue, Sep 15, 2009 at 1:42 PM, Piter Dias <[hidden email]> wrote:
> May you help me? Basically you won't be able to coerce between Rate and InterestRate, because InterestRate also takes into account DayCount, Compounding, and Frequency. While Simple and Annual might be sensible default values for Compounding and Frequency, a default value for DayCount is implausible. btw I'm going to commit a fix removing the unused dayCounter parameter in the FixedRateCoupon InterestRate-based constructor, which should make my point above more evident. Anyway you're not lost. I've just read the other thread where you write about the problem you're having with Brazilian bonds. Could you provide an example: ISIN and expected cash flow schedule? I'm pretty sure you can have the correct bond in Excel using the FixedLeg constructor and then the generic Bond constructor. 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Nando,
> and Frequency. While Simple and Annual might be sensible default > values for Compounding and Frequency, a default value for DayCount is > implausible. You are right. My problem was not just understand but make it get DayCount from somewhere but it seems this technic should be used when we are sure about defaults (for most of markets Compounding = Simple and Frequency = Annual solves the problem), right? Find below some samples I got from Central Bank page. Sadly the technical documents are all in Portuguese but you would be able to check them using Bloomberg (BNTNF code). Selic Maturity Referece Date Issue Date Term Coupon Rate ISIN 950199 01/01/2010 02/02/2005 02/02/2005 1794 10.000000 BRSTNCNTF055 950199 01/07/2010 09/02/2007 09/02/2007 1238 10.000000 BRSTNCNTF0H7 950199 01/01/2011 06/07/2007 06/07/2007 1275 10.000000 BRSTNCNTF0I5 950199 01/01/2012 01/06/2005 01/06/2005 2405 10.000000 BRSTNCNTF063 950199 01/01/2013 06/07/2007 06/07/2007 2006 10.000000 BRSTNCNTF0J3 950199 01/01/2014 05/05/2006 05/05/2006 2798 10.000000 BRSTNCNTF071 950199 01/01/2017 05/01/2007 05/01/2007 3649 10.000000 BRSTNCNTF0G9 Let's do this way. As soon as I come home I send some samples using regular Excel functions and how I did it using QuantLibXL (I created a qlnewFixedRateBond function). The QuantLib samples (using Bonds, not FixedRateBond) are already available in the current testsuite version. I am pretty that sharing the current code and spreadsheet I have would help everyone. Regards, ------------------------- Piter Dias [hidden email] ------------------------------------------------------------------------------ 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Ferdinando Ametrano-4
Nando/Eric,
> Could you provide an example: ISIN and expected cash flow schedule? Find attached a spreadsheet that replicates schedule and pricing given the ISIN, yield and calculation date. The QuantLib patch file is included as well. > btw I'm going to commit a fix removing the unused dayCounter parameter > in the FixedRateCoupon InterestRate-based constructor, which should > make my point above more evident. We were working in the same direction but I included a FixedRateBond constructor that accepts a vector of QuantLib::InterestRate as well. The Brazilian bonds test was changed to use it because it is much more clear than the old one (using QuantLib::Bond class). I included a patch for QuantLibXL just in case you are interest in my experiments. I created qlnewFixedRateBond (includes Compounding and Frequency qlFixedRateBond) and qlnew2FixedRateBond (changes the coupon paramenter of qlFixedRateBond ot accept a vector of QuantLib::InterestRate). The qlnew2FixedRateBond is pretty cool but should have the DayCounter parameter removed once it is implicit in the coupons (it is proof of concept). I have no idea how it could be included in QuantLibXL. There is a spreadsheet included showing how the function perform well generating the cash flows. Regards, ------------------------- Piter Dias [hidden email] ------------------------------------------------------------------------------ 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev Bonds Files.zip (80K) Download Attachment |
In reply to this post by Ferdinando Ametrano-4
Quoting Ferdinando Ametrano <[hidden email]>:
> On Tue, Sep 15, 2009 at 1:42 PM, Piter Dias <[hidden email]> wrote: >> May you help me? > > Basically you won't be able to coerce between Rate and InterestRate, I wasn't suggesting he do that. I was thinking of using coercion as a kind of hack to simulate function overloading - one excel function, one function name, two signatures i.e. two different datatypes allowed for a given parameter. Regards, Eric ------------------------------------------------------------------------------ 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Wed, Sep 16, 2009 at 7:36 AM, Eric Ehlers <[hidden email]> wrote:
> [...] using coercion as a kind of hack to simulate function overloading - one excel > function, one function name, two signatures i.e. two different datatypes allowed for > a given parameter. one of the greatest feature available, even if I'm quite lost on how to add/extend coercion. It would be great if you could provide even a quick how-to 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-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |