-
Notifications
You must be signed in to change notification settings - Fork 52
RQuantLib
RQuantLib is an R interface to the C++ library QuantLib. Currently, no binary packages of RQuantLib are being provided by CRAN. So users typically need to install QuantLib in order to compile RQuantLib from source, and then run it.
NB:
- It may take considerable time (_i.e., possibly several hours) to compile
QuantLibfrom source. Thus, we recommend to install binary version directly if it is possible. -
RQuantLibrefers to the R package, whileQuantLibrefers to the C++ Quantitative library thatRQuantLibuses. Please do not confuse the two terms.
Starting with release 0.4.3, binaries of RQuantLib (including the required QuantLib object) are provided via the ghrr drat repo and can be installed in an R session with the following commands:
if (!require("drat")) install.packages("drat")
drat::addRepo("ghrr")
install.packages("RQuantLib", type="binary")- Ensure that Apple’s Command Line Tools for Xcode (which includes clang) are installed.
- If you use (or wish to use) HomeBrew, open the terminal, where you need to execute the commands:
2a. Install Homebrew, so that you can use Homebrew to manage packages on OSX:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2b. brew install boost to install boost (a C++ library needed by QuantLib). You might need to accept the license of XCode or install XCode, just follow the message that pops up in the terminal;
2c. In R console, install with
install.packages(
"RQuantLib",
type = "source",
configure.args =
c("--with-boost-include=/opt/homebrew/opt/boost/include/"),
configure.vars =
c("CPPFLAGS='-DQL_HIGH_RESOLUTION_DATE'") # for intraday calculations
)Note:
brew install quantlib --with-intraday no longer works, and it does not come with the intraday feature anymore. You need to install quantlib with custom configuration -DQL_HIGH_RESOLUTION_DATE for cmake.
- If you directly installed R using R package installer at cran.r-project.org, download install.libs as described at mac.r-project.org/bin. In an R session (you may need to run sudo R from terminal),
install.libs("QuantLib") #also installs boost
install.packages("RQuantLib", type = "source", configure.vars = c("CPPFLAGS='-DQL_HIGH_RESOLUTION_DATE'"))Simply sudo apt-get install r-cran-rquantlib installs the RQuantLib package for R. If you want the headers and examples of QuantLib as well, please execute sudo apt-get install r-cran-rquantlib quantlib-examples libquantlib0-dev.
- Check out http://quantlib.org/install.shtml to install
QuantLib; - Install
RQuantLibusinginstall.packages()orR CMD INSTALL.