TSdbiMethods: Methods for TSdbi Generics to Connect to zipped csv Files

Description Usage Arguments Details Value See Also Examples

Description

Get a time series (matrix) from a zipped csv file (at a url).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    zip(...) 
    ## 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, ... )  

Arguments

q

A character string indicating the query interface to use, or a database connection object.

dbname

The name of the database to which the connection should be established, omitted if q is a database connection object.

con

a database connection object.

serIDs

identifiers for series on the database (name of the zip file less ”.zip”).

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 TSget in package TSdbi.)

suffix

A vector of strings indicating names of the columns if the zipped file has more than one series (see Details).

quote

A vector of strings, as in suffix, indicating series that should be returned in the result(see Details).

...

Arguments currently unused.

Details

These functions interface to zip (.zip) files. TSget is a wrapper to read.csv to provide an interface that is consistent with TSdbi. The TSdbi function argument serId is passed as the series to return, dbname indicates the location of zip files (a url or directory).

TSzip does not support writing data to the source.

If the zip files in a dbname location contain more than one series then suffix should be a vector of strings indicating names of the columns in the zipped files. (If different files contain different columns then a con will have to be specified for each different kind of returned file.) In TSget, quote should be a vector of strings, a subset of suffix, indicating series that should be returned in the result. The default returns all series. In the matrix of series returned, the series names will be generated by appending suffix onto the name of the base name of the zip file.

The classes zipDriver and TSzipConnection extend classes DBIDriver and DBIConnection in the DBI package.

See the package vignette for additional examples and TSget in TSdbi for more details.

Value

Depends.

See Also

TSdates, TSget, tfwindow

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  require("tfplot")
  # data from http://pitrading.com/
  # par(ask=TRUE) # to pause between pages
 ## Not run: 
  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)

TSzip documentation built on Sept. 23, 2019, 3 a.m.

Related to TSdbiMethods in TSzip...