Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


In this chapter, we introduced different types of loops. Then, we demonstrated how to estimate the implied volatility based on a European option (Black-Scholes-Merton option model) and on an American option. We discussed the for loop and the while loop, and their applications. For a given set of input values, such as current stock price, the exercise price, the time to maturity, the continuously compounded risk-free rate, and a call price (or put price), we showed how to estimate a stock's implied volatility. In terms of efficiency, we explained the binary search method and compared it with other approaches when estimating an implied volatility. In addition, we demonstrated how to download option data, such as put-call ratio, from Yahoo! Finance and the CBOE web page.

In the next chapter, we will focus on applications of Monte Carlo simulations on option pricing. Using random numbers drawn from a normal distribution, we could mimic the movements of a stock for a given set of mean...