r - How can I download a set of prices with getSymbols and store them in the order it was requested? -
I download historical prices for quantmod with the The problem I have from this perspective is that the order of the ticker and XTS in the list is not the same as I specified in the I think that This is because How can I do the same operation above, but how can I get my output in the same order as my You can simply reduce the results of getSymbols function for many tickers and By changing a list or following the following code, a multivariate XTS:
library (quantmod) myenv & lt; - new.env () Ticker & lt; - Convert the list to "c" ("^ GSPC", "AAPL", "MSFT", tas (l); do.call (merge, (eapply (myenv,).))) # Multivirate exts Convert and remove only the adjusted value
ticker Done:
& gt; Name (ll) [1] "AAPL" "GSPC" "GOOG" "Root" "MSF" & gt; Name (SS) [1] "Adjusted AAPL." "GSPC Adjusted" "GOOG.Adjusted" "RUT.Adjusted" [5] "MSFT.Adjusted"
eapply operates in a random order, as in the help pages of
eapply :
The order is arbitrary for the hashed environment.
tickers specified in vector? To wit. The first item of the list / the first column of XTS should correspond to the
ticker vector and similar first element.
eapply in the desired order.
library (quantmod) ticker & lt; -c ("^ GSPC", "AAPL", "MSFT", "GOG", "^ RUT") INNUEN (MSF), MINV & Lt; - new.env () Symimyms & lt; - getSymbols (Ticker, NV = myenv) #setSymbols Adjusted Name ts & lt; -Call (Merge, Ipli (Maneve, Ed) [Symme])
Comments
Post a Comment