Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZeroDivisionError: float division by zero - not able to get calculation on expiry day. #11

Open
maxh8086 opened this issue Apr 3, 2021 · 3 comments

Comments

@maxh8086
Copy link

maxh8086 commented Apr 3, 2021

\python\python36\lib\site-packages\mibian\__init__.py in __init__(self, args, volatility, callPrice, putPrice, performance)
    271 			self._d1_ = (log(self.underlyingPrice / self.strikePrice) + \
    272                                         (self.interestRate + (self.volatility**2) / 2) * \
--> 273 					self.daysToExpiration) / self._a_
    274                         self._d2_ = self._d1_ - self._a_
    275                         if performance:

ZeroDivisionError: float division by zero

i have suggession to add '+ 0.0001' to line of division or try catch and add 0.0001 which will give correct ans rather than error:

		self._d1_ = (log(self.underlyingPrice / self.strikePrice) + \
				(self.interestRate - self.dividendYield + \
				(self.volatility**2) / 2) * self.daysToExpiration) / \
				self._a_ + 0.0001
@PriyankSinghal90
Copy link

I think On Expiry day the no. of days will be 1 cause we will have that trading day.....

@sathyarajshetigar
Copy link

Which is correct answer? adding + 0.0001 or 1

@sidnet033
Copy link

what do we do on expiry day? consider daysLeftToExpiry as 1? or 0.0001?

if 0.0001, why this specific figure? why not 0.1 or 0.001?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants