10.12.2019 Views

Python for Finance

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Portfolio Theory

If based on a sample, we have the following formula:

1. Find out whether scipy.var() and spcipy.std() functions are based on a

sample or based on population.

2. Write a Python program to estimate the expected portfolio returns for 20

stocks by using your own weights and the latest 10 year data.

3. For 50 stocks, select at least five years of data. Estimate volatility for each

stock, their average will be . Then form several equal-weighted 2-stock

portfolios and estimate their volatilities. Their average will be our .

Continue this way and will be the average volatility for n-stock equalweighted

portfolios. Draw a graph with n, the number of n-stock portfolios,

as the x axis and the volatility of the n-stock portfolio as the y axis.

Comment on it.

4. Find an appropriate definition for industry. Choosing seven stocks from

each industry, estimate their correlation matrix. Then do the same thing on

another industry. Comment on your results.

5. Write a Python program to estimate the optimal portfolio construction by

using 10 stocks.

6. Find the average of correlations for five industries, at least 10 stocks in each

industry.

7. To estimate the volatility of a portfolio, we have two formulae: for a 2-stock

portfolio and for an n-stock portfolio. Show that when n equals 2, we expand

the formula to estimate the volatility of an n-stock portfolio; we end up with

the same formula for a 2-stock portfolio.

8. Is the following statement correct? Prove or disapprove it.

Stock returns are uncorrelated.

9. Downloading one year IBM daily data and estimate its Sharpe ratio by using

two methods: its definition, and write a sharpe() function in Python.

[ 328 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!