R में वित्तीय डेटा का इम्पोर्ट और प्रबंधन
Joshua Ulrich
Quantitative Analyst & quantmod Co-Author and Maintainer
setSymbolLookup(AAPL = "google")
aapl <- getSymbols("AAPL", auto.assign = FALSE)
str(aapl) # 'src' एट्रिब्यूट पर ध्यान दें
An 'xts' object on 2007-01-03/2017-02-22 containing:
Data: num [1:2552, 1:5] 12.3 12 12.2 12.3 12.3 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "AAPL.Open" "AAPL.High" "AAPL.Low" "AAPL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "google"
$ updated: POSIXct[1:1], format: "2017-02-23 14:16:55"
setSymbolLookup(MSFT = list(src = "google", from = "2016-01-01"))
msft <- getSymbols("MSFT", auto.assign = FALSE)
str(msft) # 'src' एट्रिब्यूट और पहली तारीख पर ध्यान दें
An 'xts' object on 2016-01-04/2017-02-27 containing:
Data: num [1:290, 1:5] 54.3 54.9 54.3 52.7 52.4 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "MSFT.Open" "MSFT.High" "MSFT.Low" "MSFT.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
$ src : chr "google"
$ updated: POSIXct[1:1], format: "2017-02-23 14:20:21"
# डिफॉल्ट सेट करें
setSymbolLookup(AAPL = "google")
# जाँचें कि डिफॉल्ट बदला है
getSymbolLookup()
$AAPL
$AAPL$src
"google"
# लुकअप सहेजें
saveSymbolLookup("symbol_lookup.rda")
# लुकअप हटाएँ
setSymbolLookup(AAPL = NULL)
# जाँचें कि डिफॉल्ट हट गया है
getSymbolLookup()
named list()
# लोड करें
loadSymbolLookup("symbol_lookup.rda")
# जाँचें कि डिफॉल्ट बहाल हुआ है
getSymbolLookup()
$AAPL
$AAPL$src
"google"
R में वित्तीय डेटा का इम्पोर्ट और प्रबंधन