这是我之前的问题的后续,我试图从雅虎财经下载期权数据。它仍然不起作用。但我在互联网上找到了另一个代码,它可以工作,但输出格式我无法使用,因为我对 R 有点陌生。
该代码给了我一个名为 OptionPrices 的变量。
以下是使用命令 fix(OptionPrices) 打印的 OptionPrices 的输出:
structure(list(call = structure(list(Strike = 26, Symbol = structure(1L, .Label = "VIXM131221C00026000", class = "factor"),
Last = 1.8, Chg = 0, Bid = 2.05, Ask = 2.65, Vol = 10L, Open.Int = 10L), .Names = c("Strike",
"Symbol", "Last", "Chg", "Bid", "Ask", "Vol", "Open.Int"), row.names = c(NA,
-1L), class = "data.frame"), put = structure(list(Strike = c(24,
25, 26, 29), Symbol = structure(1:4, .Label = c("VIXM131221P00024000",
"VIXM131221P00025000", "VIXM131221P00026000", "VIXM131221P00029000"
), class = "factor"), Last = c(1.05, 2, 3.2, 4.3), Chg = c(0,
0, 0, 0), Bid = c(1, 1.45, 1.95, 3.8), Ask = c(1.4, 1.85, 2.35,
4.4), Vol = c(20L, 1L, 10L, 10L), Open.Int = c(20L, 5L, 10L,
10L)), .Names = c("Strike", "Symbol", "Last", "Chg", "Bid", "Ask",
"Vol", "Open.Int"), row.names = c(NA, -4L), class = "data.frame"),
Stock.ticker = "VIXM", Quote.date = <S4 object of class structure("timeDate", package = "timeDate")>,
Strike.date = <S4 object of class structure("timeDate", package = "timeDate")>,
Stock.name = "ProShares VIX Mid-Term Futures ETF (VIXM)",
Stock.price = 26.34, TTM = 193, Short.rate = 0.0893939393939394), .Names = c("call",
"put", "Stock.ticker", "Quote.date", "Strike.date", "Stock.name",
"Stock.price", "TTM", "Short.rate"))
提取上述信息的雅虎财经页面为:
http://finance.yahoo.com/q/op?s=VIXM&m=2013-12
我想从上述变量 OptionPrices 中为罢工、期权符号、买入价、卖出价等创建向量。
我如何做到这一点。