下面是我使用 Quantlib blackvariance surface 的代码。但它抱怨。你能建议吗?在这个函数中,我用 6 个变量调用 Blackvariance 函数
from QuantLib import *
# global data
todaysDate = Date(24,September,2013)
Settings.instance().evaluationDate = todaysDate
settlementDate = Date(24,September,2013)
riskFreeRate = FlatForward(settlementDate, 0.0025, Actual365Fixed())
# option parameters
exercise = EuropeanExercise(Date(23,December,2013))
payoff = PlainVanillaPayoff(Option.Call, 170.365)
# market data
underlying = SimpleQuote(170.365)
volatility = BlackConstantVol(todaysDate, TARGET(), 0.13538, Actual365Fixed())
dividendYield = FlatForward(settlementDate, 0.0227, Actual365Fixed())
dc=ActualActual()
eurexCal=Germany.Eurex
print eurexCal
dateVec=[]
strikes=[]
blackVolMatrix=[]
vol=[]
for i in range(10):
dateVec.append(Date(24, October, 2013)+Period(i, Months))
strikes.append(170+i*10)
vol.append(0.1+i/10)
def create_matrix(m, n):
return [[0.1]*n for _ in xrange(m)]
blackVolMatrix = create_matrix(10, 10)
#for x in range (10):
# for y in range(10):
# blackVolMatrix[x,y]=0.1
volsurf=BlackVarianceSurface(settlementDate,eurexCal,dateVec,
strikes,blackVolMatrix,dc)
我添加了第 6 个参数。* ** * ** * ** * *
错误信息:
Traceback (most recent call last):
File "/home/chandra/Software/snotes/test4.py", line 39, in <module>
strikes,blackVolMatrix,dc)
File "/usr/local/lib/python2.7/dist-packages/QuantLib/QuantLib.py", line 3371, in __init__
this = _QuantLib.new_BlackVarianceSurface(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_BlackVarianceSurface'.
Possible C/C++ prototypes are:
BlackVarianceSurfacePtr(Date const &,Calendar const &,std::vector< Date,std::allocator< Date > > const &,std::vector< Real,std::allocator< Real > > const &,Matrix const &,DayCounter const &,BlackVarianceSurface::Extrapolation,BlackVarianceSurface::Extrapolation)
BlackVarianceSurfacePtr(Date const &,Calendar const &,std::vector< Date,std::allocator< Date > > const &,std::vector< Real,std::allocator< Real > > const &,Matrix const &,DayCounter const &,BlackVarianceSurface::Extrapolation)
BlackVarianceSurfacePtr(Date const &,Calendar const &,std::vector< Date,std::allocator< Date > > const &,std::vector< Real,std::allocator< Real > > const &,Matrix const &,DayCounter const &)