Description Usage Arguments Details Value See Also Examples
Get a time series (matrix) from a variety of source URLs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | histQuote(...)
getSymbol(...)
xls(...)
zip(...)
## S4 method for signature 'histQuoteConnection,missing'
TSconnect(q, dbname, ...)
## S4 method for signature 'character,TShistQuoteConnection'
TSget(
serIDs, con, TSrepresentation = options()$TSrepresentation,
tf = NULL, start = tfstart(tf), end = tfend(tf), names=serIDs,
quote = "Close", quiet = TRUE, repeat.try=3, ...)
## S4 method for signature 'character,TShistQuoteConnection'
TSdates(
serIDs, con, vintage=NULL, panel=NULL, ... )
## S4 method for signature 'character,TShistQuoteConnection'
TSdescription(x, con, ... )
## S4 method for signature 'character,TShistQuoteConnection'
TSdoc(x, con, ... )
## S4 method for signature 'character,TShistQuoteConnection'
TSlabel(x, con, ... )
## S4 method for signature 'character,TShistQuoteConnection'
TSsource(x, con, ... )
## S4 method for signature 'getSymbolConnection,missing'
TSconnect(
q, dbname, ...)
## S4 method for signature 'character,TSgetSymbolConnection'
TSget(
serIDs, con, TSrepresentation = options()$TSrepresentation,
tf = NULL, start = tfstart(tf), end = tfend(tf), names=serIDs,
quote = NULL, quiet = TRUE, repeat.try=3, ...)
## S4 method for signature 'character,TSgetSymbolConnection'
TSdates(
serIDs, con, vintage=NULL, panel=NULL, ... )
## S4 method for signature 'character,TSgetSymbolConnection'
TSdescription(x, con, ... )
## S4 method for signature 'character,TSgetSymbolConnection'
TSdoc(x, con, ... )
## S4 method for signature 'character,TSgetSymbolConnection'
TSlabel(x, con, ... )
## S4 method for signature 'character,TSgetSymbolConnection'
TSsource(x, con, ... )
## S4 method for signature 'xlsConnection,missing'
TSconnect(q, dbname,
map=list(ids, data, dates, names=NULL, description=NULL, sheet=1,
tsrepresentation = function(data,dates){
zoo::zoo(data, as.Date(dates))}), ...)
## S4 method for signature 'character,TSxlsConnection'
TSget(
serIDs, con, TSrepresentation = options()$TSrepresentation,
tf = NULL, start = tfstart(tf), end = tfend(tf), names=serIDs, ...)
## S4 method for signature 'character,TSxlsConnection'
TSdates(
serIDs, con, vintage=NULL, panel=NULL, ... )
## S4 method for signature 'character,TSxlsConnection'
TSdescription(x, con, ... )
## S4 method for signature 'character,TSxlsConnection'
TSdoc(x, con, ... )
## S4 method for signature 'character,TSxlsConnection'
TSlabel(x, con, ... )
## S4 method for signature 'character,TSxlsConnection'
TSsource(x, con, ... )
## S4 method for signature 'zipConnection,missing'
TSconnect(q, dbname,
suffix=c("Open","High","Low","Close","Volume","OI"), ...)
## S4 method for signature 'character,TSzipConnection'
TSget(
serIDs, con, TSrepresentation=options()$TSrepresentation,
tf=NULL, start=tfstart(tf), end=tfend(tf),
names=NULL, quote=con@suffix, ...)
## S4 method for signature 'character,TSzipConnection'
TSdates(
serIDs, con, vintage=NULL, panel=NULL, ... )
## S4 method for signature 'character,TSzipConnection'
TSdescription(x, con, ... )
## S4 method for signature 'character,TSzipConnection'
TSdoc(x, con, ... )
## S4 method for signature 'character,TSzipConnection'
TSlabel(x, con, ... )
## S4 method for signature 'character,TSzipConnection'
TSsource(x, con, ... )
|
q |
a string indicating a query interface to use, or a database connection object. |
dbname |
a string indicating a database or omitted if |
con |
a database connection object. |
serIDs |
identifiers for series on the database. |
vintage |
character string indicating vintage of the series on the database (not supported by this database). |
panel |
character string indicating panel of the series on the database (not supported by this database). |
x |
time series data(TSput), or identifiers for series on the database (TSdoc and TSdescription). |
names |
optional character vector to use for series names in the R object. |
tf |
time frame for trimming data, passed to tfwindow. |
start |
time frame for trimming data, passed to tfwindow. |
end |
time frame for trimming data, passed to tfwindow. |
TSrepresentation |
time representation for returned series.
(See |
quote |
reference time (e.g. ”Close”) passed to |
quiet |
logical to suppress progress report, passed to |
repeat.try |
integer number of times to attempt retrieval before giving up. |
sheet |
optional integer to indicate the sheet of the workbook to use default=1). |
map |
A list with elements indicating the location of data, serIDs, dates, and optional metadata (see Details). |
suffix |
A vector of strings indicating names of the columns if the zipped file has more than one series (see Details). |
... |
Arguments passed to other methods, or by histQuote to get.hist.quote. |
These functions interface to a stock quote URL using get.hist.quote from the
tseries
package. Only URLs ”yahoo” and ”oanda” are supported.
TShistQuote is a wrapper to get.hist.quote
. No
extra functionality is provided, only an interface that is consistent
with TSdbi. The TSdbi function argument
dbname
is mapped to get.hist.quote
argument provider
, and
serId
to instrument
.
Argument quote
(ignored for provider 'oanda') is
set to ”Close” by default, but can be specified.
get.hist.quote
argument retclass
is replaced by TSdbi
argument TSrepresentation
. (See TSget
in TSdbi for
more details on how this works.)
TShistQuote does not support writing data to the source URL.
The classes histQuoteDriver
and TShistQuoteConnection
extend classes
DBIDriver
and DBIConnection
in the DBI package.
See the package vignette for additional examples.
Depends.
TSconnect
,
TSdates
,
TSget
,
get.hist.quote
tfwindow
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | require("tfplot")
## Not run:
con <- try(TSconnect("histQuote", dbname="yahoo") )
x <- TSget("^gspc", con)
tfplot(x)
con <- TSconnect("getSymbol", dbname="FRED")
x <- TSget("CPIAUCNS", con)
tfplot(x)
# data from http://pitrading.com/
# par(ask=TRUE) # to pause between pages
con <- TSconnect("zip", dbname="http://pitrading.com/free_eod_data")
x <- TSget("EURUSD", con)
tfplot(x, graphs.per.page=3)
z <- TSget(c("AD", "CD"), con, quote="Close")
tfplot(z, start="2007-01-01", Title=
"Futures, Australian and Canadian Dollar Continuous Contract at Close",
graphs.per.page=3)
## End(Not run)
#### Australian Money ####
# test file copied Nov. 29, 2010 from
# http://www.rba.gov.au/statistics/tables/xls/d03hist.xls
testfile <- system.file("xlsExampleData/d03hist.xls", package = "TSmisc")
con1 <- TSconnect("xls", dbname=testfile,
map=list(ids =list(i=11, j="B:Q"),
data =list(i=12:627, j="B:Q"),
dates=list(i=12:627, j="A"),
names=list(i=4:7, j="B:Q"),
description = NULL,
tsrepresentation = function(data,dates){
ts(data,start=c(1959,7), frequency=12)}))
z <- TSget("DMACN", con1)
tfplot(z)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.