-
Notifications
You must be signed in to change notification settings - Fork 50
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
QuantLib
from source. Thus, we recommend to install binary version directly if it is possible. -
RQuantLib
refers to the R package, whileQuantLib
refers to the C++ Quantitative library thatRQuantLib
uses. 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.
- Open the terminal, where you need to execute the commands;
- 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)"
-
brew install boost
to install boost (a C++ library needed byQuantLib
). You might need to accept the license of XCode or install XCode, just follow the message that pops up in the terminal; - 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.
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
RQuantLib
usinginstall.packages()
orR CMD INSTALL
.