Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

A hands-on guide with easy-to-follow examples to help you learn about option theory, quantitative finance, financial modeling, and time series using Python. Python for Finance is perfect for graduate students, practitioners, and application developers who wish to learn how to utilize Python to handle their financial needs. Basic knowledge of Python will be helpful but knowledge of programming is necessary.
Table of Contents (14 chapters)
13
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:

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

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:

Normal distribution, standard normal distribution, and cumulative 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...