-
Notifications
You must be signed in to change notification settings - Fork 13
Download historical financial data from Yahoo finance and Google Finance
Felix edited this page Jun 6, 2014
·
1 revision
Download historical financial data from Yahoo finance
apple <- get.ohlc.yahoo(symbol = "AAPL", start = "2013-07-01", end = "2013-08-01")
head(apple)
date open high low close volume adjusted
23 2013-07-01 402.7 412.3 401.2 409.2 13966200 399.5
22 2013-07-02 410.0 421.6 409.5 418.5 16780900 408.6
21 2013-07-03 420.9 423.0 417.4 420.8 8604600 410.9
20 2013-07-05 420.4 423.3 415.4 417.4 9786600 407.6
19 2013-07-08 420.1 421.0 410.6 415.1 10647800 405.2
18 2013-07-09 413.6 423.5 410.4 422.4 12592300 412.4
Download historical financial data from Google Finance
apple <- get.ohlc.google(symbol = "AAPL", start = "2013-07-01", end = "2013-08-01")
head(apple)
date open high low close volume
23 2013-07-01 402.7 412.3 401.2 409.2 13970435
22 2013-07-02 410.0 421.6 409.5 418.5 16788797
21 2013-07-03 420.9 423.0 417.4 420.8 8604594
20 2013-07-05 420.4 423.3 415.4 417.4 9788680
19 2013-07-08 420.1 421.0 410.6 415.1 10654060
18 2013-07-09 413.6 423.5 410.4 422.4 12596034
Download multiple historical financial data from Yahoo finance
applespy <- get.ohlcs.yahoo(symbols = c("AAPL", "SPY"), start = "2013-01-01",
end = "2013-07-31")
head(applespy$AAPL)
date open high low close volume adjusted
146 2013-01-02 553.8 555.0 541.6 549.0 20018500 529.4
145 2013-01-03 547.9 549.7 541.0 542.1 12605900 522.8
144 2013-01-04 537.0 538.6 525.8 527.0 21226200 508.2
143 2013-01-07 522.0 529.3 515.2 523.9 17291300 505.2
142 2013-01-08 529.2 531.9 521.2 525.3 16382400 506.6
141 2013-01-09 522.5 525.0 516.0 517.1 14557300 498.6
head(applespy$SPY)
date open high low close volume adjusted
146 2013-01-02 145.1 146.2 144.7 146.1 192059000 142.5
145 2013-01-03 146.0 146.4 145.3 145.7 144761800 142.2
144 2013-01-04 146.0 146.6 145.7 146.4 116817700 142.8
143 2013-01-07 145.8 146.1 145.4 146.0 110002500 142.4
142 2013-01-08 145.7 145.9 145.0 145.6 121265100 142.0
141 2013-01-09 145.9 146.3 145.6 145.9 90745600 142.4
Download multiple historical financial data from Google Finance
all <- get.ohlcs.google(symbols = c("YHOO", "SPY", "SINA"), start = "2013-01-01",
end = "2013-07-31")
head(all$YHOO)
date open high low close volume
146 2013-01-02 20.20 20.32 20.01 20.08 20463033
145 2013-01-03 20.05 20.10 19.72 19.78 19599094
144 2013-01-04 19.76 19.95 19.72 19.86 12489700
143 2013-01-07 19.56 19.58 19.28 19.40 23866609
142 2013-01-08 19.32 19.68 19.30 19.66 16932176
141 2013-01-09 19.73 19.75 19.22 19.33 21656278
head(all$SPY)
date open high low close volume
146 2013-01-02 145.1 146.2 144.7 146.1 192058911
145 2013-01-03 146.0 146.4 145.3 145.7 144761781
144 2013-01-04 146.0 146.6 145.7 146.4 116817675
143 2013-01-07 145.8 146.4 145.4 146.0 110002444
142 2013-01-08 145.7 145.9 145.0 145.6 121265078
141 2013-01-09 145.9 146.3 145.6 145.9 90745581
head(all$SINA)
date open high low close volume
146 2013-01-02 52.24 55.19 51.75 52.27 3947513
145 2013-01-03 52.34 53.61 51.54 52.77 2200712
144 2013-01-04 52.70 52.94 51.70 52.76 1466652
143 2013-01-07 51.81 52.67 51.40 52.57 1368991
142 2013-01-08 52.20 53.00 51.41 51.81 1381026
141 2013-01-09 51.76 52.43 50.61 51.54 2098518