May-29-2020, 07:09 AM
(May-29-2020, 06:31 AM)buran Wrote: maybe I got it wrong... I was under impression you cut part of the traceback in the first psot
No, that was the full error message that appeared on Excel. I'm not sure if it's truncated by Excel though.
I've tested the code further by commenting out xlwings and doing a print as below. It works fine.
#import xlwings as xw import mibian #@xw.func def BSPutOptionImpVol(underlyingPrice,strike,interestRate,expiryDays,premium): c = mibian.BS([underlyingPrice, strike, interestRate, expiryDays], putPrice=premium) # return c.impliedVolatility print(c.impliedVolatility)
Output:BSPutOptionImpVol(40.75,32,1,127,0.95)
45.654296875
So, I am a bit stumped why if I were to rewrite it for Excel usage, the Mibian library is not able to use scipy.