Home > other >  Extracting data from Yahoo Finance, getSymbols
Extracting data from Yahoo Finance, getSymbols

Time:01-23

Do you know what happened with quantmod? The following code worket, but now it is not working.

library(quantmod)
sp <- getSymbols("^GSPC", scr = "yahoo", auto.assign = FALSE)

Could you help me, please, how to update it? Thank you!

CodePudding user response:

tidyquant is built on top of quantmod and is gathering info from Yahoo Finance. Seems to be working.

library(tidyquant)

tq_get("^GSPC")

# A tibble: 2,531 × 8
   symbol date        open  high   low close     volume adjusted
   <chr>  <date>     <dbl> <dbl> <dbl> <dbl>      <dbl>    <dbl>
 1 ^GSPC  2013-01-02 1426. 1462. 1426. 1462. 4202600000    1462.
 2 ^GSPC  2013-01-03 1462. 1465. 1456. 1459. 3829730000    1459.
 3 ^GSPC  2013-01-04 1459. 1468. 1459. 1466. 3424290000    1466.
 4 ^GSPC  2013-01-07 1466. 1466. 1457. 1462. 3304970000    1462.
 5 ^GSPC  2013-01-08 1462. 1462. 1452. 1457. 3601600000    1457.
 6 ^GSPC  2013-01-09 1457. 1465. 1457. 1461. 3674390000    1461.
 7 ^GSPC  2013-01-10 1461. 1472. 1461. 1472. 4081840000    1472.
 8 ^GSPC  2013-01-11 1472. 1473. 1468. 1472. 3340650000    1472.
 9 ^GSPC  2013-01-14 1472. 1472. 1466. 1471. 3003010000    1471.
10 ^GSPC  2013-01-15 1471. 1473. 1464. 1472. 3135350000    1472.
# … with 2,521 more rows
# ℹ Use `print(n = ...)` to see more rows
  • Related