# Category Archives: FIN 476

# FIN 476: Code to get prices for a stock portfolio

### The code is **here.**

# FIN 476: Trading Period Code

The code to estimate the daily squared deviation for each day in the trading period, and for each pair, is here **trading_period.**

# FIN 476: Time Series Characteristics of Alpha and Beta

This code will test whether a stock has a significant alpha over the last 5040 calendar days. It will then calculate alpha and beta over each 30 day subinterval and test whether alpha in one period can be used to predict alpha in the next period. The time series of alphas and betas are also plotted. The code is here: **time_series_alpha.**

# FIN 476: Pairs Trade Estimation Period Code (3/25/2014)

I have totally rewritten the pairs trade estimation period code. It will create a csv file in your working directory which has the average squared deviation, and the standard deviation of the squared deviations, for all pairs. The csv is sorted from lowest (best pair) to highest (worst pair) average squared deviation. The code is here **estim_period**.

# FIN 476: Testing for Portfolio Alpha

See the R markdown page here: **alpha_across_firms.**

# FIN 476: Naive Diversification

# FIN 476: Portfolio Frontier with Two Assets and Varying Correlation

**This page** shows how the portfolio frontier (of 2 assets) varies given an increasing correlation coefficient between the two assets. If you paste the code into R you can see the variation.

# FIN 476: VaR Functions

The link below is to R functions which allow you to calculate the 5% and 1% VaR for any stock, using any amount of historical data.

# FIN 476: Testing for Skewness and Kurtosis in Stock Returns

I have reposted the code to test for skewness and kurtosis in the link below. The page is the HTML output generated by using R Markdown and knitr.