Created
July 24, 2012 23:51
-
-
Save josephdunn/3173473 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(quantmod) | |
getSymbols('SPY') | |
expiry_idx <- options.expiry(SPY) | |
for (i in 2:length(expiry_idx)-1) | |
{ | |
period_start <- index(SPY[expiry_idx[i] + 1]) | |
period_end <- index(SPY[expiry_idx[i + 1]]) | |
message('i is ', i, ', period start is ', period_start, ', period end is ', period_end) | |
subset_string <- paste0(period_start, '::', period_end) | |
period_subset <- SPY[subset_string] | |
period_min <- min(period_subset$SPY.Close) | |
period_max <- max(period_subset$SPY.Close) | |
message('period min is ', period_min, ', period max is ', period_max) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment