[Blotter-commits] r1193 - pkg/FinancialInstrument/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 21 04:12:28 CEST 2012
Author: gsee
Date: 2012-09-21 04:12:27 +0200 (Fri, 21 Sep 2012)
New Revision: 1193
Modified:
pkg/FinancialInstrument/R/instrument.R
Log:
check to make sure ticker symbol appears in option symbol. (quantmod::getOptionChain sometimes has a bad row that is the last price of the underlying instead of an option quote; not sure why yet)
Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R 2012-09-21 02:03:19 UTC (rev 1192)
+++ pkg/FinancialInstrument/R/instrument.R 2012-09-21 02:12:27 UTC (rev 1193)
@@ -650,7 +650,8 @@
opts <- getOptionChain(Symbols=symbol,Exp=Exp, src="yahoo")
- locals <- function(x) c(rownames(x$calls),rownames(x$puts))
+ locals <- function(x) c(grep(symbol, rownames(x$puts), value=TRUE),
+ grep(symbol, rownames(x$calls), value=TRUE))
if (is.null(opts$calls)) { #if is.null(Exp) we'll get back all chains
led <- (lapply(opts, locals))
optnames <- unname(do.call(c, led)) #FIXME: Is this a reasonable way to get rownames?
More information about the Blotter-commits
mailing list