How to get time series of forecast data in R API

I am trying to get time series data for a series that contains actual and forecast data.


However I am getting an error when I use the following code:

inflation1    <- dsws$timeSeriesRequest(instrument = "AUOCFCOR",
                                    datatype   = "",
                                    startDate  = "-2Y"
                                    endDate    = "-0D",
                                    frequency  = "Y") 

The error messages that I get in the console are:

> inflation1    <- dsws$timeSeriesRequest(instrument = "AUOCFCOR",
+                                     datatype   = "",
+                                     startDate  = ""
+                                     endDate    = "",
Error: unexpected symbol in:
"                                    startDate  = ""
                                    endDate"
>                                     frequency  = "Y")
Error: unexpected ')' in "                                    frequency  = "Y")"
>


What am I doing wrong here?

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @Ed_J

    From the code, I think that a comma is missing in the startDate parameter.

    image

    If it has a comma, it can get the data properly.

    > inflations <- mydsws$timeSeriesRequest(instrument="AUOCFCOR",
    + datatype="",
    + startDate="-2Y",
    + endDate="-0D",
    + frequency="Y")
    > inflations
               AUOCFCOR
    2017-06-30  101.701
    2018-06-29  103.380
    2019-06-28  105.151


Answers