[Rquantlib-devel] RQuantLib fixed-income discussion (Re: 1 Rquantlib-devel moderator request(s) waiting)

Dirk Eddelbuettel edd at debian.org
Wed Oct 8 13:52:22 CEST 2014


On 8 October 2014 at 10:53, Michele Salvadore wrote:
| Hi Dick,

Dirk, with an r. It happens :)
 
| Eventually I was able to get it up.

Ok. If you have suggestions for making the documentation clearer let me know.

| I've been working a bit on the bond interface as I needed to make it more
| flexible and match more closely the structure on the QuantLib side. Briefly, I
| changed the interface (just for FixedRateBond for the time being) to match the
| most general case available on the quantlib side:
| 1. provide a named list 'bond' with all parameters matching
| the QuantLib::FixedRateBond ctor (with externally constructed schedule), apart
| from the schedule (constructed separately) and the coupon rates vector (also
| constructed separately).
| 2. provide a named list 'schedule' with all parameters matching the
| QuantLib::Schedule ctor.
| 3. provide a named list 'calc' with parameters required for some additional
| calculations (for example duration)
| 4. Either a yield or a discountCurve can be provided (if both are not available
| or defined I stop()). Depending on which is given, we include a price engine or
| not and calculate parameters accordingly (in case of yield, as there is no
| price engine, I return NA for NPV). In both cases, the same type of object is
| returned to R, a FixedRateBond.
| 5. I added some additional field to the returned object: the settlementDate
| used in the calculation (not necessarily obvious from the input parameters) and
| the duration.
| 6. I extended the supported calendars by using the getCalendar function already
| available in calendars.cpp (there was a different getCalendar function declared
| in the header which didn't have an implementation and I substituted it with the
| correct declaration).
| 
| I was wondering what you think of these changes. I would like to contribute
| them back to the package, but I am worried about the fact the the need to
| extend the interface has broken backward compatibility for FixedRateBond. I was

I generally like backwards compatibility.  

This may be an exception where it is worth breaking things.

| initially thinking of adding a new function with a different name, but I
| believe that would be very confusing for users. My believe is that the
| FixedRateBond should match as closely as possible the QuantLib::FixedRateBond
| (even the name says that :)).
| If you think it would be worthile, I would implement similar changes to the
| other bond functions in the package and contribute it back.
| 
| Looking forward to hearing your opinion on this,

Can you provide a 'pull request' ?  That is the GitHub way of clearly showing
the differences.  If you know (some) git, creating a branch and a pull
request is easy.  If you don't know git, it may be worth learning.  We can
also fall back to 'diff and patch'.

This discussion should be on the mailing list, though, so I am reverting it
there. Please follow-up on list, if possible.

Dirk
 
| Michele
| 
| 
| On 1 October 2014 18:32, Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| 
|     Hi again,
|    
|     On 1 October 2014 at 18:18, Michele Salvadore wrote:
|     | Hi Dirk,
|     |
|     | sorry to bother you, I was wondering if you had the chance to take a look
|     at
|     | this issue (multiple definitions at linkage). It looks like something to
|     do
| 
|     I have not.
| 
|     RQuantLib builds at CRAN incl on the win-builder service.
|    
|     | with proper header inclusion, but I'm not sure what's going on. Btw, I
|     was able
|     | to get all other issues/warning sorted (including openmp and so on), this
|     is
|     | the last bit left before being able to work on it.
| 
|     Can you construct a small reproducible example and post it (within the 40kb
|     limit, ie do not attach or include lots) to the list?
|    
|     Dirk
|    
|     | Thanks a lot, apologies for bothering!
|     |
|     | Michele
|     |
|     | On 26 September 2014 22:10, Dirk Eddelbuettel <edd at debian.org> wrote:
|     |
|     |
|     |     On 26 September 2014 at 20:48, Michele Salvadore wrote:
|     |     | Sorry about that dirk, will keep it shorter in the future :) i was
|     out of
|     |     Office today and saw emails just now.
|     |
|     |     No worries.
|     |
|     |     What is a little stranger is that I can see the post now in the list
|     |     archives, yet I never seem to have gotten a copy to my account.
|     |
|     |     We'll follow up in a bit.
|     |
|     |     Dirk
|     |
|     |     --
|     |     http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
|     |
|     |
| 
|     --
|     http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
| 
| 

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rquantlib-devel mailing list