I want to build an implied vol surface w/ Quantlib. I notice BlackVarianceSurface class can take in a strike list, an expiration list and a volMatrix as input. However, what if I want to set different strikes for different tenors? In the below example, how should I set strikes for 2013/12/20 as [1645, 1650, 1655], and for 2014/1/17 as [1650, 1660, 1670]?
Thanks for helping out.
import Quantlib as ql
referenceDate = ql.Date(30, 9, 2013)
ql.Settings.instance().evaluationDate = referenceDate
calendar = ql.TARGET()
dayCounter = ql.ActualActual()
strikes = [1650.0, 1660.0, 1670.0]
expirations = [ql.Date(20, 12, 2013), ql.Date(17, 1, 2014), ql.Date(21, 3, 2014)]
volMatrix = ql.Matrix(len(strikes), len(expirations))
volMatrix[0][0] = .15640
volMatrix[0][1] = .15433
volMatrix[0][2] = .16079
volMatrix[1][0] = .15343
volMatrix[1][1] = .15240
volMatrix[1][2] = .15804
volMatrix[2][0] = .15128
volMatrix[2][1] = .14888
volMatrix[2][2] = .15512
volatilitySurface = ql.BlackVarianceSurface(referenceDate, calendar, expirations, strikes, volMatrix, dayCounter)
volatilitySurface.enableExtrapolation()
volatilitySurface.blackVol(0.5, 1650.0)