Skip to content

Instantly share code, notes, and snippets.

@isomorphisms
isomorphisms / USD.R
Created July 20, 2013 03:36
$USDX or $USD:IND, the USD index basket. #forex #currency #oanda #FRED
# This computes the USD index which is the "broad measure of the US Dollar against a BASKET of currencies" rather than against a particular pair
getFX(c("USD/EUR", "USD/JPY", "USD/GBP", "USD/CAD", "USD/SEK", "USD/CHF"))
# The formula comes from ICE markets https://www.theice.com/publicdocs/futures_us/ICE_Dollar_Index_FAQ.pdf
e <- .576
y <- .136
s <- .119
l <- .091
@joshuaulrich
joshuaulrich / CBOE_csv_to_xts
Created October 19, 2012 02:15 — forked from jaredwoodard/CBOE_csv_to_xts
pulls csv files from the CBOE and converts them to xts
library(quantmod)
# we're pulling the Google VIX index (VXGOG) but this also works for VXAPL, VXGS etc.
# see http://www.cboe.com/micro/equityvix/introduction.aspx
url <- "http://www.cboe.com/publish/ScheduledTask/mktdata/datahouse/VXGOGDailyPrices.csv"
# use read.zoo to read the data directly into a zoo object
z <- read.zoo(url, header=TRUE, sep=",", skip=1, FUN=as.Date, format="%m/%d/%Y")
# convert to xts