How to enhance QuantLibXL without breaking anything?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to enhance QuantLibXL without breaking anything?

 

--




Piter Dias
[hidden email]


------------------------------------------------------------------------------
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-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Piter Dias-4

Guys,

I am trying to enhance the FixedRateBond function of QuantLibXL but I can't find a way to do that without breaking compatibility. Below you can see the all current arguments of the function. In order to correctly represent that NTNF bond I need that coupon rate is 10% Annual 30/360 (30/360 just to count integer months).

I believe there are at least two ways to do that:

  • Change coupons from scalar to InterestRate object - it means that any current spreadsheet will fail because it is a new type for the field
  • Include fields to the compounding rule and day counter - it meas that some spreadsheet will fail because that trigger field is always the last one (you don't setup it in bonds.xml)

It is a bit weird because I enhanced QuantLib's FixedRateBond to include proper behavior and kept backward compatibility (test suite just ran Laughing), but can't do the same for QuantLibXL. However, main main purpose doing that was ehancing QuantLibXL).

How could I finish this work? Should I create a new function (like newFixedRateBond), generate the diff file, attach a spreadsheet use case and let maintainers decide what to do with it?

I believe any object exposed to QuantLibXL may have this problem because make spreadsheet functions backward compatible is much harder than making it for C++ classes.

Regards,


ObjectID  
Description NTNF
Currency BRL
SettlementDays 3
FaceAmount 1000
ScheduleID obj_0000f#0003
Coupons 10.0000%
DayCounter Business252
PaymentBDC Following
Redemption  
IssueDate  
Permanent  
Trigger  
Reply | Threaded
Open this post in threaded view
|

Re: How to enhance QuantLibXL without breaking anything?

Eric Ehlers-2
Hi Piter,

I don't understand your question, can you elaborate?

>   * Change coupons from scalar to InterestRate object -
> it means that any current spreadsheet will fail because it is a new type
> for the field

You say "Change coupons *from scalar*", I don't understand.  In the  
latest version of QuantLibXL (0.9.7), for function qlFixedRateBond(),  
the argument "Coupons" is not a scalar, it is a vector of doubles.

Do you want a setup where

1) old spreadsheets call function qlFixedRateBond() and pass to  
argument Coupon a value of type vector<double>, and
2) new spreadsheets call the same function and pass to the same  
argument a value of type InterestRate?

If so, this could be accomplished using coercion:

     http://quantlib.org/quantlibxl/coercion.html

Regards,
Eric


------------------------------------------------------------------------------
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-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to enhance QuantLibXL without breaking anything?

Piter Dias-4
Eric,

I am trying to make a sample Brazilian treasuries spreadsheet and started
with NTNF bond. It has a 10% Annual 30/360 coupon rate paid Semi-annual,
which means that it pays around 4.880884817% each semester.

> the argument "Coupons" is not a scalar, it is a vector of doubles.

Yes, you are right by I would like to include Compounding and Frequency as
well. This should be easy using InterestRate object or including two more
inputs.
In order to test it, I created a qlnewFixedRateBond function with two
extra inputs (Compounding and Frequency) but this is far from a good
solution because of lack of backward compatibility. However, it generated
the correct cash flows.

> If so, this could be accomplished using coercion:
>
>      http://quantlib.org/quantlibxl/coercion.html

This is new for me and should do exactly what I want. I will try to do the
same spreadsheet using it.

Thanks a lot,

-------------------------

Piter Dias
[hidden email]

------------------------------------------------------------------------------
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-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev