Skip to content

Instantly share code, notes, and snippets.

View alexchinco's full-sized avatar

Alex Chinco alexchinco

View GitHub Profile
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width">
<head>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.1-latest/MathJax.js?config=TeX-AMS-MML_SVG-full"></script>
<style type="text/css">
body {
font: 12px serif;
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width">
<head>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
<style type="text/css">
svg { font: 12px serif; }
@alexchinco
alexchinco / asset-pricing-time-scales.R
Created August 22, 2013 16:41
Code to create figures for my post "Identifying Relevant Asset Pricing Time Scales". url: http://www.alexchinco.com/identifying-relevant-asset-pricing-time-scales/
################################################################################
################################################################################
## Prep workspace
################################################################################
################################################################################
options(width=200, digits=6, digits.secs=6)
rm(list=ls())
library(foreign)
@alexchinco
alexchinco / binom-approx-to-normal.R
Created September 20, 2013 21:42
Code simulating the accuracy of the binomial approximation to the normal distribution via Berry-Esseen.
## Prep workspace
rm(list=ls())
library(foreign)
library(grid)
library(plyr)
library(ggplot2)
library(tikzDevice)
library(reshape)
library(vars)
library(scales)
for (t in 1:10) {
print t
}
@alexchinco
alexchinco / Create Figure
Last active August 29, 2015 13:57
Replicate Hou (2007) Table 1
## Prep workspace
rm(list=ls())
library(foreign)
library(grid)
library(plyr)
library(ggplot2)
library(tikzDevice)
print(options('tikzLatexPackages'))
options(tikzLatexPackages =
@alexchinco
alexchinco / R code: Price of aggregate volatility
Created May 15, 2014 15:08
Code to replicate main results in Ang, Hodrick, Xing, and Zhang (2006)
## Prep workspace
rm(list=ls())
library(foreign)
library(grid)
library(plyr)
library(ggplot2)
library(tikzDevice)
print(options('tikzLatexPackages'))
options(tikzLatexPackages =
@alexchinco
alexchinco / parse-wsj-data--17jul2014.py
Created July 18, 2014 02:04
Reads HTML files containing WSJ articles mentioning S&P 500 companies and saves metadata.
import csv
import time
import random
import os
import urllib2
import io
import gzip
import sys
import urllib
import re
@alexchinco
alexchinco / ticker-data.csv
Created July 18, 2014 02:07
List of S&P 500 companies from 01/01/2008 to 12/31/2012.
ticker name t1 t2 interval
A "Agilent Technologies" 2008-01-01 2012-12-31 5.00547945205479
AA "Alcoa" 2008-01-01 2012-12-31 5.00547945205479
AAPL "Apple" 2008-01-01 2012-12-31 5.00547945205479
ABBV "AbbVie" 2012-12-31 2012-12-31 0.00273972602739726
ABC "AmerisourceBergen" 2008-01-01 2012-12-31 5.00547945205479
ABK "Ambac Financial" 2008-01-01 2008-06-10 0.443835616438356
ABT "Abbot Laboratories" 2008-01-01 2012-12-31 5.00547945205479
ACE "ACE Limited" 2010-07-14 2012-12-31 2.47123287671233
ACN "Accenture" 2011-07-05 2012-12-31 1.4958904109589
@alexchinco
alexchinco / Wavelet Variance Simulation
Created July 26, 2014 21:03
Create figures for wavelet variance post.
## Prep workspace
rm(list=ls())
library(foreign)
library(grid)
library(plyr)
library(ggplot2)
library(tikzDevice)
library(wmtsa)