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.

Sources of Data

3. Manually download monthly and daily price data for CitiGroup.

4. Convert daily price data for the CitiGroup to daily returns.

5. Convert monthly prices to monthly returns and convert daily returns to

monthly returns. Are they the same?

6. Are the following two lines equivalent?

>>>ret = p.aclose[1:]/p.aclose[:-1]-1

>>>ret = (p.aclose[1:]-p.aclose[:-1]/p.aclose[1:]

7. What are advantages and disadvantages of using public stock data versus

private stock data, for example, from some financial databases?

8. Find the annual cost of subscribing Compustat, related to accounting

information and CRSP, related to trading data.

9. Download IBM monthly data from Yahoo Finance. Estimate its standard

deviation and Sharpe ratio from January 2000 to December 2004.

10. What is the annual beta for IBM, DELL, and MSFT from 2001 to 2010?

11. What is the correlation between IBM and DELL from 2006 to 2010?

12. Estimate the mean weekday returns for IBM. Do you observe a

weekday effect?

13. Does the volatility decline over the years? For example, you could select IBM,

DELL, and MSFT to investigate this hypothesis.

14. What is the correlation between S&P500 and DJI (Dow Jones Industrial

average)?Note: S&P500 Index ticker in Yahoo Finance is ^GSPC and for

DJIit's^DJI.

15. How do you download data for n given tickers?

16. Write an R program to input n tickers from an input file.

17. What is the correlation coefficient between the US stock market (S&P500) and

the Hong Kong market (Hang Seng Index)?

18. Is it true that the Singaporean equity market is more strongly correlated with

the Japanese equitymarket than with the American equity market?

19. How would you download daily price data for 50 stocks and save to just one

text file?

20. After downloading data from Yahoo!Finance,assume that p vector contains

all the daily price data. What is the meaning of the following two lines of

code? When should we apply them?

>>> ret = p.aclose[1:]/p.aclose[:-1]-1

>>> ret = p.aclose[:-1]/p.aclose[1:]-1

[ 146 ]

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

Saved successfully!

Ooh no, something went wrong!