ds: Request data from Thomson Reuters Datastream SOAP API.

Description Usage Arguments Value Examples

View source: R/ds.R

Description

Request data from Thomson Reuters Datastream SOAP API.

Usage

1
2
3
4
  ds(user, securities = NULL, fields = NULL, date = NULL,
    fromDate = NULL, toDate = NULL, period = "D",
    requests = NULL, asDataFrame = TRUE,
    source = "Datastream", htmlEscape=FALSE)

Arguments

user

list with values username and password.

securities

vector of DS tickers or codes.

fields

vector of DS datatypes.

date

date in yyyy-mm-dd format, if only one day is requested. If set, ignores fromDate, toDate and period.

fromDate

date in yyyy-mm-dd format from which to start series.

toDate

date in yyyy-mm-dd format at which to end series.

period

character describing the periodicity ('D','W','M','Q','Y'), defaults to daily.

requests

a vector of requests following the Datastream format. If set, ignores all other parameters (except user). More flexible syntax, notably for the use of expressions.

asDataFrame

boolean whether to output a dataframe in the "Data" row of the returned matrix.

source

default "Datastream", useful if you want to access another Dataworks Enterprise data source. You can obtain the list of sources you have access to by using the dsSources() function in this package.

htmlEscape

boolean whether the provided parameters should be html escaped (ie. & replaced by &). Defaults to FALSE to maintain backwards compatibility where people provide already escaped strings

Value

matrix with the returned data, columns being individual requests and rows "Source", "Instrument", "StatusType", "StatusCode", "StatusMessage", "Fields" and "Data".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
user <- list(username= "DS:XXXX000", password="XXX000")
ds(user, c("U:IBM", "U:MMM"), c("P", "PO"), "2012-07-20")

request1 <- "U:IBM(P)~~USD~2007-09-01~:2008-09-05~D"
request2 <- "U:BAC~=P,PO~2007-09-01~:2007-09-12~D"
request3 <- "906187~2008-01-01~:2008-10-02~M"
request4 <- "PCH#(U:MMM(MV))~2008-01-01~:2008-10-02~M"
requests <- c(request1, request2, request3, request4)

ds(user, requests=request1)
ds(user, requests=requests)

fcocquemas/rdatastream documentation built on July 19, 2019, 7:51 p.m.