RQuantlib ライブラリを使用する R コードがあります。Python から実行するために、RPy2 を使用しています。Pythonにはquantlib(quantlib-python)用の独自のバインディングがあることを知っています。RからPythonに完全に切り替えたいです。
quantlib-python を使用して以下を実行する方法を教えてください
import rpy2.robjects as robjects
robjects.r('library(RQuantLib)')
x = robjects.r('x<-EuropeanOptionImpliedVolatility(type="call", value=11.10, underlying=100,strike=100, dividendYield=0.01, riskFreeRate=0.03,maturity=0.5, volatility=0.4)')
print x
サンプルラン:
$ python vol.py
Loading required package: Rcpp
Implied Volatility for EuropeanOptionImpliedVolatility is 0.381