Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Python for Finance

You're reading from   Mastering Python for Finance Understand, design, and implement state-of-the-art mathematical and statistical applications used in finance with Python

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781784394516
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Python for Financial Applications FREE CHAPTER 2. The Importance of Linearity in Finance 3. Nonlinearity in Finance 4. Numerical Procedures 5. Interest Rates and Derivatives 6. Interactive Financial Analytics with Python and VSTOXX 7. Big Data with Python 8. Algorithmic Trading 9. Backtesting 10. Excel with Python Index

Valuing a zero-coupon bond


A zero-coupon bond is a bond that does not pay any periodic interest except on maturity, where the principal or face value is repaid. Zero-coupon bonds are also called pure discount bonds.

A zero-coupon bond can be valued as follows:

Here, is the annually compounded yield or rate of the bond, and is the time remaining to the maturity of the bond.

Let's take a look at an example of a 5-year zero-coupon bond with a face value of $100. The yield is 5 percent, compounded annually. The price can be calculated as follows:

A simple Python zero-coupon bond calculator can be used to illustrate this example:

def zero_coupon_bond(par, y, t):
    """
    Price a zero coupon bond.
    
    Par - face value of the bond.
    y - annual yield or rate of the bond.
    t - time to maturity in years.
    """
    return par/(1+y)**t

Using the preceding example, we get the following result:

>>> print zero_coupon_bond(100, 0.05, 5)
78.3526166468

In the preceding example, we assumed...

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 $19.99/month. Cancel anytime