How do I convert a daily time-series to a monthly download in R?
Note that each data feed on Nasdaq Data Link is delivered through one of the following Nasdaq data Link APIs:
- Streaming API for real-time data
- REST API for real-time or delayed data
- REST API for time-series
- REST API for tables
You can learn more about these APIs, data formats and authentication here.
Data is delivered through the REST API for time-series or REST API for tables can be used with the Nasdaq Data Link R package.
To change the sample frequency of a daily time-series to monthly, please use the collapse= parameter, like so:
data <- Quandl("XNAS/ACIW", collapse="monthly")
Collapse can be "daily","weekly", "monthly", "quarterly" or "annual".
Note that the conversion process is very simple:
Nasdaq Data Link simply takes the last observation in the day/month/week/quarter/year and uses that as the daily/monthly/weekly/quarterly/annual datum.
This simple conversion process does not work well for time-series that contain percentage changes, period averages/totals (e.g. trading volume) or period extremes (e.g. high/low or OHLC for security prices). For such time-series, we recommend downloading the raw data and carrying out the required daily to monthly transformation using your own analytics tool.
Note also that you can only convert a time-series to a less granular sampling frequency (e.g. daily to monthly) and never the other way around to a more granular frequency (e.g. annual to daily).
There is no collapse parameter for data in tables format. For tables, we recommend downloading the raw data and carrying out the required daily to monthly transformation using your own analytics tool.