Importare e gestire dati finanziari in R
Joshua Ulrich
Quantitative Analyst & quantmod Co-Author and Maintainer
head(DC)
DC.Open DC.High DC.Low DC.Close DC.Volume
2016-01-16 01:00:00 20.845 20.850 20.835 20.845 157
2016-01-16 02:00:00 20.845 20.850 20.835 20.845 214
2016-01-16 03:00:00 20.845 20.850 20.835 20.845 103
2016-01-16 04:00:00 20.845 20.855 20.835 20.845 180
2016-01-16 05:00:00 20.845 20.845 20.845 20.845 211
2016-01-16 06:00:00 20.845 20.845 20.840 20.845 35
Op() - prezzo di aperturaHi() - prezzo massimoLo() - prezzo minimoCl() - prezzo di chiusuraVo() - volume scambiatoAd() - prezzo di chiusura rettificato# Prezzo di apertura
dc_open <- Op(DC)
head(dc_open, 4)
DC.Open
2016-01-16 01:00:00 20.84
2016-01-16 02:00:00 20.85
2016-01-16 03:00:00 20.85
2016-01-16 04:00:00 20.85
# Prezzo massimo
dc_high <- Hi(DC)
head(dc_high, 4)
DC.High
2016-01-16 01:00:00 20.85
2016-01-16 02:00:00 20.85
2016-01-16 03:00:00 20.85
2016-01-16 04:00:00 20.85
# Estrarre più colonne
dc_ohlc <- OHLC(DC)
head(dc_ohlc)
DC.Open DC.High DC.Low DC.Close
2016-01-16 01:00:00 20.84 20.85 20.83 20.84
2016-01-16 02:00:00 20.85 20.85 20.83 20.85
2016-01-16 03:00:00 20.85 20.85 20.84 20.85
2016-01-16 04:00:00 20.85 20.85 20.84 20.85
2016-01-16 05:00:00 20.85 20.85 20.84 20.85
2016-01-16 06:00:00 20.84 20.85 20.84 20.85
x: oggetto che contiene i datisymbol: simbolo opzionale se x ha più titoliprefer: prezzo preferito opzionaleprefer non è specificato:"price", poi "trade", poi "close"head(DC)
Price Volume Bid.Price Bid.Size Ask.Price Ask.Size
2016-01-16 00:00:07 NA NA 20.84 198 20.85 684
2016-01-16 00:00:08 NA NA 20.84 198 20.85 683
2016-01-16 00:00:08 NA NA 20.84 198 20.85 682
2016-01-16 00:00:11 NA NA 20.84 198 20.85 683
2016-01-16 00:00:25 NA NA 20.84 198 20.85 684
2016-01-16 00:00:44 20.84 1 20.84 198 20.85 684
dc_bid <- getPrice(DC, prefer = "bid")
head(dc_bid)
Bid.Price
2016-01-16 00:00:07 20.84
2016-01-16 00:00:08 20.84
2016-01-16 00:00:08 20.84
2016-01-16 00:00:11 20.84
2016-01-16 00:00:25 20.84
2016-01-16 00:00:44 20.84
Importare e gestire dati finanziari in R