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

Options

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.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @WestWinter

    For example, I have items in a CSV file.

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

    imageThen, the code is:

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

    image

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @WestWinter

    I can run it properly.

    image

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

  • 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.