question

Upvotes
Accepted
23 0 3 4

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 512.0 KiB each and 1.0 MiB total.

@WestWinter

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,

AHS

@WestWinter

Hi,

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvotes
Accepted
78.6k 248 52 74

@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 512.0 KiB each and 1.0 MiB total.

Upvotes
78.6k 248 52 74

@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 512.0 KiB each and 1.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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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