Search icon CANCEL
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
Python for Finance

You're reading from   Python for Finance Apply powerful finance models and quantitative analysis with Python

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher
ISBN-13 9781787125698
Length 586 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Yuxing Yan Yuxing Yan
Author Profile Icon Yuxing Yan
Yuxing Yan
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Python Basics FREE CHAPTER 2. Introduction to Python Modules 3. Time Value of Money 4. Sources of Data 5. Bond and Stock Valuation 6. Capital Asset Pricing Model 7. Multifactor Models and Performance Measures 8. Time-Series Analysis 9. Portfolio Theory 10. Options and Futures 11. Value at Risk 12. Monte Carlo Simulation 13. Credit Risk Analysis 14. Exotic Options 15. Volatility, Implied Volatility, ARCH, and GARCH Index

Exercises

  1. Where can you download and install Python?
  2. Is Python case-sensitive?
  3. How do you assign a set of values to pv in the format of a tuple. Could we change its values after the assignment?
  4. Estimate the area of a circle if the diameter is 9.7 using Python.
  5. How do you assign a value to a new variable?
  6. How can you find some sample examples related to Python?
  7. How do you launch Python's help function?
  8. How can you find out more information about a specific function, such as print()?
  9. What is the definition of built-in functions?
  10. Is pow() a built-in function? How do we use it?
  11. How do we find all built-in functions? How many built-in functions are present?
  12. When we estimate the square root of 3, which Python function should we use?
  13. Assume that the present value of a perpetuity is $124 and the annual cash flow is $50; what is the corresponding discount rate? The formula is given here:
    Exercises
  14. Based on the solution of the previous question, what is the corresponding quarterly rate?
  15. For a perpetuity, the same cash flow happens at the same interval forever. A growing perpetuity is defined as follows: the future cash flow is increased at a constant growth rate forever. If the first cash flow happens at the end of the first period, we have the following formula:
    Exercises

    Here PV is the present value, C is the cash flow of the next period, g is a growth rate, and R is the discount rate. If the first cash flow is $12.50, the constant growth rate is 2.5 percent, and the discount rate is 8.5 percent. What is the present value of this growing perpetuity?

  16. For an n-day variance, we have the following formula:
    Exercises

    Here Exercisesis the daily variance and is Exercises is the daily standard deviation (volatility). If the volatility (daily standard deviation) of a stock is 0.2, what is its 10-day volatility?

  17. We expect to have $25,000 in 5 years. If the annual deposit rate is 4.5 percent, how much do we have to deposit today?
  18. The substitution function called sub() is from a Python module. Find out how many functions are contained in that module.
  19. Write a Python program to convert the standard deviation estimated based on daily data or monthly data to an annual one by using the following formulas:
    Exercises
    Exercises
  20. The Sharpe ratio is a measure of trade-off between benefit (excess return) and cost (total risk) for an investment such as a portfolio. Write a Python program to estimate the Sharpe ratio by applying the following formula:
    Exercises

    Here Exercises is the portfolio mean return, Exercises is the mean risk-free rate and σ is the risk of the portfolio. Again, at this moment, it is perfectly fine that a reader does not understand the economic meaning of this ratio since the Sharpe ratio will be discussed in more detail in Chapter 7, Multifactor Models and Performance Measures.

You have been reading a chapter from
Python for Finance - Second Edition
Published in: Jun 2017
Publisher:
ISBN-13: 9781787125698
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 €18.99/month. Cancel anytime