Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python for Finance

You're reading from  Python for Finance

Product type Book
Published in Apr 2014
Publisher
ISBN-13 9781783284375
Pages 408 pages
Edition 1st Edition
Languages
Author (1):
Yuxing Yan Yuxing Yan
Profile icon Yuxing Yan

Table of Contents (20) Chapters

Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Introduction and Installation of Python Using Python as an Ordinary Calculator Using Python as a Financial Calculator 13 Lines of Python to Price a Call Option Introduction to Modules Introduction to NumPy and SciPy Visual Finance via Matplotlib Statistical Analysis of Time Series The Black-Scholes-Merton Option Model Python Loops and Implied Volatility Monte Carlo Simulation and Options Volatility Measures and GARCH Index

Chapter 3. Using Python as a Financial Calculator

In this chapter, we will learn how to write simple functions such as estimation of the present value for a given future value, the present value of an annuity, and the monthly payment of our mortgage. In addition, we will show how to combine two dozens of small functions as a big Python program and use it for financial estimation. In other words, we plan to create a financial calculator using Python.

In particular, we will cover the following topics:

  • Writing a Python function without saving it

  • Why indentation is critical in Python

  • Three ways to input values and a default value for an input variable

  • Using dir() to check the existence of our newly generated function

  • Saving our pv_f() function

  • Activating our function from our Python editor using import()

  • While debugging a program, activate your program from a Python editor

  • import test01 versus from test01 import *

  • Removing a function using the del() method

  • Generating our own module

  • Two types of comments...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}