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

Normal distribution, standard normal distribution, and cumulative standard normal distribution


In finance, normal distribution plays a central role. This is especially true for option theory. The major reason is that it is commonly assumed that the stock prices follow a log normal distribution while the stock returns follow a normal distribution. The density of a normal distribution is defined as follows:

Here, μ is the mean and σ is the standard deviation.

By setting μ as 0 and σ as 1, the preceding general normal distribution density function collapses to the following standard normal distribution:

The following code generates a graph for the standard normal distribution. The SciPy's stats.norm.pdf() function is used for the standard normal distribution. The default setting is with a zero mean and unit standard deviation, that is, the standard normal density function:

>>>from scipy import exp,sqrt,stats
>>>stats.norm.pdf(0)
0.3989422804014327
>>>1/sqrt(2*pi)   ...