0

I have a question regarding extracting strings. i have a string with financial tickers. For extending these tickers I want to auto maize the getSymbols function

So for example I have the df

ticker = c("BTC-USD", "^GDAXI")

with the function I want to use it in getSymbols by doing

getSymbols = (Extracted_String, source = "yahoo")

the end product should be then 2 dfs with one for BTC-USD and the other for the DAX

thank you!

user438383
  • 5,716
  • 8
  • 28
  • 43
MA_1760
  • 31
  • 5
  • You say you have a data frame, but `ticker = c("BTC-USD", "^GDAXI")` is a vector. You could do `data_list = lapply(ticker, getSymbols, source = "yahoo")` – Gregor Thomas Aug 24 '22 at 18:46
  • Related: [How do I store data from getSymbols (quantmod library) to a list?](https://stackoverflow.com/questions/52791718/how-do-i-store-data-from-getsymbols-quantmod-library-to-a-list) – markus Aug 24 '22 at 18:46
  • i do have all ticker names in the string ticker and I want to extract the first ticker, f.ex. "BTC-USD" to put it in getSymbols then I want to extract the second ticker, "^GDAXI and put it in getSymbols – MA_1760 Aug 24 '22 at 18:47
  • I guess `getSymbols` `Symbols` is already vectorized - `a character vector specifying the names of each symbol to be loaded` – akrun Aug 24 '22 at 18:50
  • Stocks = lapply(ticker, getSymbols, source = "yahoo", auto.assign = FALSE) – MA_1760 Aug 24 '22 at 18:51

0 Answers0