我正在尝试获取不同股票价格的期权看涨价格。我不断收到一条错误消息,指出 float() 参数必须是字符串或数字。这是代码:
import mibian
price = [100,101,102,103,104]
c = 0.0
for i in price:
#BS([underlyingPrice, strikePrice, interestRate, daysToExpiration], volatility=x, callPrice=y, putPrice=z)
c[i] = mibian.BS([price, 100, 0,5], volatility=20)
print c.callPrice
这是错误代码:
self.underlyingPrice = float(args[0])
TypeError: float() argument must be a string or a number