Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Python for Finance
  • Toc
  • feedback
Python for Finance

Python for Finance

By : Yuxing Yan
3.9 (22)
close
Python for Finance

Python for Finance

3.9 (22)
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)
close
13
Index

Test of equivalency of volatility over two periods

We know that the stock market fell dramatically in October, 1987. We could choose a stock to test the volatility before and after October, 1987. For instance, we could use Ford Motor Corp, with a ticker of F, to illustrate how to test the equality of variance before and after the market crash in 1987. In the following Python program, we define a function called ret_f() to retrieve daily price data from Yahoo! Finance and estimate its daily returns:

import scipy as sp
from matplotlib.finance import quotes_historical_yahoo
import numpy as np
# input area 
ticker='F'               # stock
begdate1=(1982,9,1)      # starting date for period  #1
enddate1=(1987,9,1)      # ending   date for period  #1
begdate2=(1987,12,1)     # starting date for period  #2
enddate2=(1992,12,1)     # ending   date for period  #2
# define a function
def ret_f(ticker,begdate,enddate):
    p = quotes_historical_yahoo(ticker, begdate, enddate,asobject=True...
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete