question

Upvotes
Accepted
23 0 0 3

How to have DSWS to reference to data in a column?

I wanted to do a snapshot request of securities in a column. I saved my column data in a variable (eg A <- Select(Table_name, Ticker) ) and would like to invoke using the data inside this variable via:

myData <- mydsws$snapshotRequest(instrument = A,

datatype = "P",

requestDate = "0D")


But was returned with a Bad Request.


Thanks in advance.

datastream-apidsws-apir
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

@WestWinter

For example, I have items in a CSV file.

mydata = read.csv("items1.csv") 
mydata

Then, the code is:

items <- mydata[['Symbol']]
myData <- mydsws$snapshotRequest(instrument =  items,
                                 datatype = "P",
                                 requestDate = "0D")
myData


1591783269568.png (10.6 KiB)
1591783356959.png (8.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
38.1k 71 35 53

@WestWinter

I can run it properly.

Please share the full code. You can also refer to an R example on GitHub.


1591759496349.png (15.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Hi, I wanted the instrument line inside the code to reference a variable.

Sample code:

A <- select(Ticker_Table,Instrument)

So within Ticker, there is a column with numerous instrument names (eg. MSACWF$)

myData <- mydsws$snapshotRequest(instrument = A,

datatype = "P",

requestDate = "0D")

I tried inserting just one/a few instrument names and they work, but I would like them to work with data inside a column so I can just update the column itself, with the dataframe queried updated as well automatically.

Click below to post an Idea Post Idea