|
Start of topic | Skip to actions
Blog for RSwig
24 Apr 2006 - More work on unit tests. R-SWIG now runs (although it doesn't pass) the entire SWIG unit test system. Also fixed some bugs with long long and const casts. (Yaahhh!!!)
23 Apr 2006 - Made new SWIG unit tests compatible with SWIG standards
17 Apr 2006 - Uploaded new version with fixed unit tests.
27 Feb 2006 - Even more progress. I'll work on the RSwig part of this for another week or so before trying to work on the screen scraping for Shanghai derivatives.
I fixed the problem with QuantLib not loading/saving the dollar operator in the data file. The basic problem is that S3 and S4 methods don't work very well with each other, and so I lot of what I did was to convert S4 to S3 methods.
16 Feb 2006 - Lots of progress. Got some basic option valuation working.
The main thing was to include code in r.cxx to cast down to the most basic typedef for a type. Most of that is now working. The next steps are:
quote <- function(x) {
todaysDate <- Date(15, "May", 1998)
Settings_instance()$setEvaluationDate(d=todaysDate)
settlementDate <- Date(17, "May", 1998)
riskFreeRate <- FlatForward(settlementDate, 0.05, Actual365Fixed())
exercise <- EuropeanExercise(Date(17, "May", 1999))
payoff <- PlainVanillaPayoff("Call", 8.0)
underlying <- SimpleQuote(x)
volatility <- BlackConstantVol(todaysDate, 0.10, Actual365Fixed())
dividendYield <- FlatForward(settlementDate, 0.05, Actual365Fixed())
process <- BlackScholesProcess(QuoteHandle(underlying),
YieldTermStructureHandle(dividendYield),
YieldTermStructureHandle(riskFreeRate),
BlackVolTermStructureHandle(volatility))
option <- VanillaOption(process, payoff, exercise)
Instrument_setPricingEngine(option, s_arg2=AnalyticEuropeanEngine())
value <- option$NPV()
value
}
plot(seq(1.0,10.0,by=0.1), lapply(seq(1.0,10.0,by=0.1), quote))
15 Feb 2006 - Got StrVectors? to work. Trying to upload package, but CVS is done. Commented out old array code.
> s <- new_StrVector() > s$append(x="foo") NULL > s$append(x="bar") NULL > s$size() [1] 2 > s[0] [1] "bar" > s[1] [1] "foo" > s[2] [1] "bar" > today <- new_Date(as.integer(15), "February", as.integer(2006)) > today$weekday() [1] "Wednesday" > today$dayOfYear() [1] 46 | ||||