Description Usage Arguments Value References Examples
View source: R/getSymbols.ALFRED.R
Estimate the time distance between observations Dates/times and their corresponding LastUpdated(Publishing) Dates/times.
1 2 3 4 5 6 7 8 | estimLastUpdated(
x,
Calendar = "UnitedStates/GovernmentBond",
Frequency,
LastUpdated = NULL,
NdayInMonth = NULL,
LastOfDateRange = NULL
)
|
x |
Date times of observation dates |
Calendar |
Default is "UnitedStates/GovernmentBond". Calendar to use. See ?? RQuantLib::Calendars |
Frequency |
No default (required). Values can be Daily(not implemented yet), Weekly(not implemented yet), Monthly, and Quarterly |
LastUpdated |
Date time. Default NULL. Date time of the published date of the newest(latest) observation |
NdayInMonth |
Integer. Default NULL. This only applied to the Frequency of "Quarterly" or "Monthly". If this parameter is present, then this parameter provides additiona information to parameter LastUpdated. Use this parameter NdayInMonth to as the Day after the Reference period to estimate. See ? timeDate::timeNthNdayInMonth |
LastOfDateRange |
Default NULL. If not present, this value will be taken from the last observation of x. This parameter value represents the earliest of the time between an observation and its corresponding LastUpdated Date time. |
vector of Date times
Schedule of Releases for the Employment Situation https://www.bls.gov/schedule/news_release/empsit.htm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ## Not run:
Title: Gross Domestic Product
Series ID: GDP
Source: U.S. Bureau of Economic Analysis
Release: Gross Domestic Product
Seasonal Adjustment: Seasonally Adjusted Annual Rate
Frequency: Quarterly
Units: Billions of Dollars
Date Range: 1947-01-01 to 2020-07-01
Last Updated: 2020-10-29 7:52 AM CDT
atr <- fredAttributes("GDP")
library(quantmod)
getSymbols("GDP", src = "FRED")
estimLastUpdated(index(getSymbols("GDP")),
Frequency = atr$Frequency,
LastUpdated = atr$LastUpdated,
LastOfDateRange = tail(strsplit(atr$DateRange, " to "),1)
)
Title: Unemployment Rate
Series ID: UNRATE
Source: U.S. Bureau of Labor Statistics
Release: Employment Situation
Seasonal Adjustment: Seasonally Adjusted
Frequency: Monthly
Units: Percent
Date Range: 1948-01-01 to 2020-10-01
Last Updated: 2020-11-06 7:47 AM CST
# LastUpdated (updated) during the first Friday of every month
# if that "first Friday" is not available, then the
# the updated occurs at the next Friday
#
# Schedule of Releases for the Employment Situation
https://www.bls.gov/schedule/news_release/empsit.htm
# PAY & LEAVE (UNRATE data is not released during these days)
https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/#url=2020
atr <- fredAttributes("UNRATE")
library(quantmod)
getSymbols("UNRATE", src = "FRED")
# UNRATE is released on the First Friday that is
# not a weekend day no holiday
#
tail(estimLastUpdated(index(UNRATE),
Frequency = head(strsplit(atr$Frequency, ", ")[[1]],1),
LastUpdated = atr$LastUpdated,
LastOfDateRange = tail(strsplit(atr$DateRange, " to ")[[1]],1)
), 4)
[1] "2020-08-06" "2020-09-08" "2020-10-07" "2020-11-05"
# first Friday (better)
tail(estimLastUpdated(index(UNRATE),
Frequency = head(strsplit(atr$Frequency, ", ")[[1]],1),
LastUpdated = atr$LastUpdated,
NdayInMonth = 5L, # 1st Friday
LastOfDateRange = tail(strsplit(atr$DateRange, " to ")[[1]],1)
), 4)
[1] "2020-08-07" "2020-09-04" "2020-10-02" "2020-11-06"
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.