Skip to content

Instantly share code, notes, and snippets.

@FrozenQuant
FrozenQuant / Faber Monitor Web.Rmd
Last active January 1, 2016 13:39
R Markdown file for watching a Faber strategy
Faber Strategy Monitor
========================================================
This post was created in R using Markdown and posted directly to WordPress. It creates a table of data and a set of price charts for tracking funds used in Mebane Faber's trend following strategy. Data is gathered from Yahoo Finance using the API in the **quantmod** package, then rendered into a web page using RStudio and [***knitr***](http://yihui.name/knitr/), with the help of **googleVis** and **ggplot2**.
This particular implementation of the Faber strategy comes from his book *The Ivy Portfolio*. The program is to invest in a broad array of markets and buy individual ETFs when the price of the ETF exceeds its 10-month moving average and sell when it goes below. This particular example uses ten ETFs, two in each major category (as shown in Table 9.2 of *The Ivy Portfolio*).
The table shows some basic information about each ETF, the current price versus the 10-month SMA, and the same price/SMA data as of the prior m
@FrozenQuant
FrozenQuant / GDP vs Treasury Rates
Created February 28, 2014 13:57
R file for charting nominal GDP versus Treasury rates
# R plot of nominal GDP vs 10-year rate using data from FRED
# Frozenquant.com
# Thanks to KLR for his posts on charting with xtsExtra
require(quantmod)
require(PerformanceAnalytics)
require(xtsExtra)
require(RColorBrewer)
# Get data for chart --------------------------------------------------------
@FrozenQuant
FrozenQuant / PCA Post 2.R
Last active November 16, 2016 19:53
PCA Post Number 2
# PCA Analysis of Interest Rates
# Post #2
# FrozenQuant.com
require(quantmod)
require(PerformanceAnalytics)
options(scipen = 20)
##############################################################
# Get and Prepare data
@FrozenQuant
FrozenQuant / PCA Post 3.R
Created June 1, 2016 01:46
PCA Post Number 3
# PCA Analysis of Interest Rates Post Number 3
# frozenquant.com
# 20160531
library(quantmod)
library(PerformanceAnalytics)
library(ellipse)
library(rgl)
options(scipen = 20)