Open akashiitd opened 2 years ago
``[self.callPrice, self.putPrice] = self._price() 277 else: --> 278 [self.callPrice, self.putPrice] = self._price() 279 [self.callDelta, self.putDelta] = self._delta() 280 [self.callDelta2, self.putDelta2] = self._delta2()
File c:\program files\python39\lib\site-packages\mibian__init__.py:307, in BS._price(self) 305 raise ZeroDivisionError('The strike price cannot be zero') 306 else: --> 307 call = self.underlyingPrice norm.cdf(self.d1) - \ 308 self.strikePrice e*(-self.interestRate \ 309 self.daysToExpiration) norm.cdf(self.d2) 310 put = self.strikePrice e*(-self.interestRate \ 311 self.daysToExpiration) norm.cdf(-self.d2) - \ 312 self.underlyingPrice norm.cdf(-self.d1) 313 return [call, put]
NameError: name 'norm' is not defined
i am getting the same error. what is the solution?
pip install scipy, then using from scipy.stats import norm in my code solved it for me.
pip install scipy
from scipy.stats import norm
The above did not solve the issue.
``[self.callPrice, self.putPrice] = self._price() 277 else: --> 278 [self.callPrice, self.putPrice] = self._price() 279 [self.callDelta, self.putDelta] = self._delta() 280 [self.callDelta2, self.putDelta2] = self._delta2()
File c:\program files\python39\lib\site-packages\mibian__init__.py:307, in BS._price(self) 305 raise ZeroDivisionError('The strike price cannot be zero') 306 else: --> 307 call = self.underlyingPrice norm.cdf(self.d1) - \ 308 self.strikePrice e*(-self.interestRate \ 309 self.daysToExpiration) norm.cdf(self.d2) 310 put = self.strikePrice e*(-self.interestRate \ 311 self.daysToExpiration) norm.cdf(-self.d2) - \ 312 self.underlyingPrice norm.cdf(-self.d1) 313 return [call, put]
NameError: name 'norm' is not defined