1
中获得的价格提取特定股票我正在运行quantmod,我想读取某个日期的股票及其价格列表。那么我想要保持那些符合特定门槛的股票。根据Quant Mod从R
我的代码开始:
library(quantmod)
s = c("AAPL","FB","GOOG", "CRM")
e = new.env() #environment in which to store data
getSymbols(s, src="yahoo", env=e)
prices = do.call(merge, eapply(e, Cl)[s])
today = prices["2017-04-07",]
today
The output is:
AAPL.Close FB.Close GOOG.Close CRM.Close
2017-04-07 143.34 140.78 824.67 84.38
我想只有那些以跟上价格> 140所以它应该阅读:
AAPL.Close GOOG.Close
2017-04-07 143.34 824.67
试试这个:'threshold = 140,filteredPx = today [,today> threshold]' – OdeToMyFiddle