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

Chapter 7. Visual Finance via Matplotlib

Graphs and other visual representations have become more important in explaining many complex financial concepts, trading strategies, and formulae. In this chapter, we discuss the module matplotlib, which is used to create various types of graphs. In addition, the module will be used intensively in Chapter 9, The Black-Scholes-Merton Option Model, when we discuss the famous Black-Scholes-Merton option model and various trading strategies. The matplotlib module is designed to produce publication-quality figures and graphs. The matplotlib module depends on NumPy and SciPy which were discussed in Chapter 6, Introduction to NumPy and SciPy. There are several output formats, such as PDF, Postscript, SVG, and PNG.

In particular, we will cover the following:

  • Several ways to install matplotlib

  • Simple examples of using matplotlib

  • Net Present Value (NPV) profile, DuPont identity, stock returns, and histogram

  • Total risk, market risk (beta), and firm-specific risk...