International Monetary Fund’s API

Data - IMF

Info

source dataset .html .RData

imf

api

2024-06-18 NA

List of APIs

source dataset .html .RData

bdf

api

2024-06-19 NA

bea

api

2024-06-19 NA

bis

api

2024-04-19 NA

bls

api

2024-06-17 NA

ecb

api

2024-06-19 NA

eurostat

api

2024-06-08 NA

imf

api

2024-06-18 NA

insee

api

2024-06-18 NA

oecd

api

2024-05-07 2024-04-16

rdb

api

NA NA

wdi

api

2024-04-14 NA

All

  • Use the JSON RESTful Web Service. html

LAST_COMPILE

LAST_COMPILE
2024-06-20

Liste

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/Dataflow" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "Dataflows", "Dataflow") %>%
  setNames(gsub("@", "", names(.))) %>%
  select(1:3) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

BOP

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/BOP" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 BOP IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 BOP IMF CL_AREA_BOP 1.0 IMF NA
INDICATOR 1.0 BOP IMF CL_INDICATOR_BOP 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/BOP" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 BOP IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
OBS_STATUS 1.0 BOP IMF NA NA NA Observation Conditional String NA
OFFICIAL_BPM 1.0 BOP IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 BOP IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

REF_AREA

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_AREA_BOP" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

REF_AREA <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("REF_AREA", "Ref_area"))

REF_AREA %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_BOP" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

CPI

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/CPI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 CPI IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 CPI IMF CL_AREA_CPI 1.0 IMF NA
INDICATOR 1.0 CPI IMF CL_INDICATOR_CPI 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/CPI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 CPI IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
COMMON_REFERENCE_PERIOD 1.0 CPI IMF NA NA NA Series Conditional String NA
OBS_STATUS 1.0 CPI IMF NA NA NA Observation Conditional String NA
REFERENCE_PERIOD 1.0 CPI IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 CPI IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

REF_AREA

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_AREA_CPI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

REF_AREA <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("REF_AREA", "Ref_area"))

REF_AREA %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_CPI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Ex 1

Code
Sys.sleep(10)
"..PCPIH_IX" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/CPI/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  filter(!is.na(OBS_STATUS)) %>%
  left_join(REF_AREA, by = "REF_AREA") %>%
  group_by(REF_AREA, FREQ, Ref_area) %>%
  summarise(Nobs = n()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

CPI, Housing

Code
# PCPI_IX: Consumer Price Index, All items
"Q.GB+FR+DE.PCPIH_IX" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/CPI/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  na.omit %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10),
                     labels = dollar_format(accuracy = 1, prefix = "")) +
  
  theme(legend.position = c(0.2, 0.80),
        legend.title = element_blank())

CPI, Harmonized Housing

Code
# PCPIHAH_IX: Housing, Water, Electricity, Gas and Other Fuels, Harmonized
"Q.GB+FR+DE.PCPIHAH_IX" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/CPI/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  na.omit %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10),
                     labels = dollar_format(accuracy = 1, prefix = "")) +
  
  theme(legend.position = c(0.8, 0.20),
        legend.title = element_blank())

CPI, All

Code
# PCPI_IX: Consumer Price Index, All items
"Q.GB+FR+DE.PCPI_IX" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/CPI/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("") +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_log10(breaks = c(seq(1, 5, 1), seq(0, 200, 10)),
                     labels = dollar_format(accuracy = 1, prefix = "")) +
  
  theme(legend.position = c(0.2, 0.80),
        legend.title = element_blank())

DOTS

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/DOT" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 DOT IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 DOT IMF CL_AREA_DOT 1.0 IMF NA
INDICATOR 1.0 DOT IMF CL_INDICATOR_DOT 1.0 IMF NA
COUNTERPART_AREA 1.0 DOT IMF CL_COUNTERPART_AREA_DOT 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/DOT" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  select(1:5) %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist
UNIT_MULT 1.0 DOT IMF CL_UNIT_MULT
OBS_STATUS 1.0 DOT IMF NA
TIME_FORMAT 1.0 DOT IMF CL_TIME_FORMAT

REF_AREA

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_AREA_DOT" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

REF_AREA <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("REF_AREA", "Ref_area"))

REF_AREA %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_DOT" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Using the API

Code
"M.US.TXG_FOB_USD" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/DOT/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  setNames(gsub("@", "", names(.))) %>%
  select(-Obs) %>%
  head %>%
  {if (is_html_output()) print_table(.) else .}
FREQ REF_AREA INDICATOR COUNTERPART_AREA UNIT_MULT TIME_FORMAT
M US TXG_FOB_USD CH 6 P1M
M US TXG_FOB_USD PL 6 P1M
M US TXG_FOB_USD AE 6 P1M
M US TXG_FOB_USD AU 6 P1M
M US TXG_FOB_USD BJ 6 P1M
M US TXG_FOB_USD CG 6 P1M

World Exports

Code
"M.US+CN+JP+W00.TXG_FOB_USD.W00.?startPeriod=1972&endPeriod=2016" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/DOT/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  month_to_date %>%
  setNames(gsub("@", "", names(.))) %>%
  mutate(`OBS_VALUE` = `OBS_VALUE` %>% as.numeric) %>%
  head %>%
  {if (is_html_output()) print_table(.) else .}
date FREQ REF_AREA INDICATOR COUNTERPART_AREA UNIT_MULT TIME_FORMAT OBS_VALUE
1972-01-01 M W00 TXG_FOB_USD W00 6 P1M 23673.33
1972-02-01 M W00 TXG_FOB_USD W00 6 P1M 25255.76
1972-03-01 M W00 TXG_FOB_USD W00 6 P1M 28622.94
1972-04-01 M W00 TXG_FOB_USD W00 6 P1M 26378.75
1972-05-01 M W00 TXG_FOB_USD W00 6 P1M 28297.07
1972-06-01 M W00 TXG_FOB_USD W00 6 P1M 28451.89

Trade Balance

Code
"A..TBG_USD.W00.?startPeriod=2016&endPeriod=2017" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/DOT/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  select(-matches("\bObs\b")) %>%
  setNames(gsub("@", "", names(.))) %>%
  mutate(OBS_VALUE = as.numeric(OBS_VALUE)) %>%
  head %>%
  {if (is_html_output()) print_table(.) else .}
FREQ REF_AREA INDICATOR COUNTERPART_AREA UNIT_MULT TIME_FORMAT TIME_PERIOD OBS_VALUE
A GN TBG_USD W00 6 P1Y 2016 -789.5061
A GN TBG_USD W00 6 P1Y 2017 -565.7270
A B0 TBG_USD W00 6 P1Y 2016 347285.1098
A B0 TBG_USD W00 6 P1Y 2017 303941.2998
A AL TBG_USD W00 6 P1Y 2016 -2704.6118
A AL TBG_USD W00 6 P1Y 2017 -3207.2913

World Share

Code
"M.FR+DE+IT+US+CN+W00.TXG_FOB_USD.W00.?startPeriod=1972&endPeriod=2020" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/DOT/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  select(-matches("\bObs\b")) %>%
  setNames(gsub("@", "", names(.))) %>%
  month_to_date2 %>%
  mutate(OBS_VALUE = as.numeric(OBS_VALUE)) %>%
  select(date, REF_AREA, OBS_VALUE) %>%
  group_by(date) %>%
  mutate(OBS_VALUE = OBS_VALUE / OBS_VALUE[REF_AREA == "W00"]) %>%
  filter(REF_AREA != "W00") %>%
  ggplot() + theme_minimal() + ylab("World Share (%)") + xlab("") +
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) +
  scale_color_manual(values = viridis(6)[1:5]) +
  theme(legend.position = c(0.45, 0.9),
        legend.title = element_blank(),
        legend.direction = "horizontal") +
  scale_x_date(breaks = seq(1920, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = 0.01*seq(-7, 60, 1),
                     labels = scales::percent_format(accuracy = 1))

Code
"Q.FR+DE+IT+US+CN+W00.TXG_FOB_USD.W00.?startPeriod=1972&endPeriod=2020" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/DOT/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(value = OBS_VALUE %>% as.numeric) %>%
  select(date, iso2c = REF_AREA, value) %>%
  group_by(date) %>%
  mutate(value = value / value[iso2c == "W00"]) %>%
  filter(iso2c != "W00") %>%
  ggplot() + geom_line(aes(x = date, y = value, color = iso2c)) +
  scale_color_manual(values = viridis(6)[1:5]) +
  theme_minimal() +
  scale_x_date(breaks = seq(1920, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.45, 0.9),
        legend.title = element_blank(),
        legend.direction = "horizontal") +
  scale_y_continuous(breaks = 0.01*seq(-7, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  ylab("World Share (%)") + xlab("")

Code
"A.FR+DE+IT+US+CN+W00.TXG_FOB_USD.W00.?startPeriod=1972&endPeriod=2020" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/DOT/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  year_to_date2 %>%
  mutate(value = OBS_VALUE %>% as.numeric) %>%
  select(date, iso2c = REF_AREA, value) %>%
  group_by(date) %>%
  mutate(value = value / value[iso2c == "W00"]) %>%
  filter(iso2c != "W00") %>%
  ggplot() + geom_line(aes(x = date, y = value, color = iso2c)) +
  scale_color_manual(values = viridis(6)[1:5]) +
  theme_minimal() +
  scale_x_date(breaks = seq(1920, 2025, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  theme(legend.position = c(0.45, 0.95),
        legend.title = element_blank(),
        legend.direction = "horizontal") +
  scale_y_continuous(breaks = 0.01*seq(-7, 60, 1),
                     labels = scales::percent_format(accuracy = 1)) +
  ylab("World Share (%)") + xlab("")

FM

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/FM" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 FM IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 FM IMF CL_AREA_FM 1.0 IMF NA
INDICATOR 1.0 FM IMF CL_INDICATOR_FM 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/FM" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 FM IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
OBS_STATUS 1.0 FM IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 FM IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

REF_AREA

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_AREA_FM" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

REF_AREA <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("REF_AREA", "Ref_area"))

REF_AREA %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_FM" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

GGCB_G01_PGDP_PT

Code
"A.US+CN+JP+W00.GGCB_G01_PGDP_PT?startPeriod=1972" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/FM/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  mutate(`OBS_VALUE` = `OBS_VALUE` %>% as.numeric) %>%
  year_to_date2 %>%
  head %>%
  {if (is_html_output()) print_table(.) else .}
date FREQ REF_AREA INDICATOR UNIT_MULT TIME_FORMAT OBS_VALUE
1991-01-01 A CN GGCB_G01_PGDP_PT 0 P1Y 0.000000
1992-01-01 A CN GGCB_G01_PGDP_PT 0 P1Y 0.000000
1993-01-01 A CN GGCB_G01_PGDP_PT 0 P1Y 0.000000
1994-01-01 A CN GGCB_G01_PGDP_PT 0 P1Y 0.000000
1995-01-01 A CN GGCB_G01_PGDP_PT 0 P1Y -1.254052
1996-01-01 A CN GGCB_G01_PGDP_PT 0 P1Y -0.981640

FSI

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/FSI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 FSI IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 FSI IMF CL_AREA_FSI 1.0 IMF NA
INDICATOR 1.0 FSI IMF CL_INDICATOR_FSI 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/FSI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 FSI IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
LATEST_CONSOLIDATION_BASIS 1.0 FSI IMF NA NA NA Series Conditional String NA
LATEST_SUBMISSION_DATA 1.0 FSI IMF NA NA NA Series Conditional String NA
OBS_STATUS 1.0 FSI IMF NA NA NA Observation Conditional String NA
CONSOLIDATION_BASIS 1.0 FSI IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 FSI IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_FSI" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

GFSE

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/GFSE" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 GFSE IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 GFSE IMF CL_AREA_GFSE 1.0 IMF NA
REF_SECTOR 1.0 GFSE IMF CL_SECTOR_GFSE 1.0 IMF NA
UNIT_MEASURE 1.0 GFSE IMF CL_UNIT_GFSE 1.0 IMF NA
CLASSIFICATION 1.0 GFSE IMF CL_INDICATOR_GFSE 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/GFSE" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 GFSE IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
GLOBAL_DSD_TIME_SERIES_CODE 1.0 GFSE IMF NA NA NA Series Conditional String NA
INDICATOR_CODE 1.0 GFSE IMF NA NA NA Series Conditional String NA
OBS_STATUS 1.0 GFSE IMF NA NA NA Observation Conditional String NA
BASES_OF_RECORDING_CASH_NON_CASH 1.0 GFSE IMF NA NA NA Observation Conditional String NA
BASES_OF_RECORDING_GROSSNET 1.0 GFSE IMF NA NA NA Observation Conditional String NA
VALUATION 1.0 GFSE IMF NA NA NA Observation Conditional String NA
NATURE_OF_DATA 1.0 GFSE IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 GFSE IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

REF_AREA

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_AREA_GFSE" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

REF_AREA <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("REF_AREA", "Ref_area"))

REF_AREA %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

SECTOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_SECTOR_GFSE" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

SECTOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("SECTOR", "Sector"))

save(SECTOR, file = "CL_SECTOR_GFSE2.RData")

SECTOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_GFSE" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

save(INDICATOR, file = "CL_INDICATOR_GFSE2")

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

ICSD

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/IFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 IFS IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
BASE_YEAR 1.0 IFS IMF NA NA NA Series Conditional String NA
OBS_STATUS 1.0 IFS IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 IFS IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_IFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

IFS

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/IFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 IFS IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 IFS IMF CL_AREA_IFS 1.0 IMF NA
INDICATOR 1.0 IFS IMF CL_INDICATOR_IFS 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/IFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 IFS IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
BASE_YEAR 1.0 IFS IMF NA NA NA Series Conditional String NA
OBS_STATUS 1.0 IFS IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 IFS IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

REF_AREA

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_AREA_IFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

REF_AREA <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("REF_AREA", "Ref_area"))

REF_AREA %>%
  mutate(Flag = gsub(" ", "-", str_to_lower(gsub(" ", "-", Ref_area))),
         Flag = paste0('<img src="../../icon/flag/vsmall/', Flag, '.png" alt="Flag">')) %>%
  select(Flag, everything()) %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F, escape = F) else .}

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_IFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}

Phillips Curves

Code
"A.US.EREER_IX+LUR_PT" %>%
  # EREER_IX: Exchange Rates, Real Effective Exchange Rate based on Consumer Price Index
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  year_to_date2 %>%
  mutate(value = OBS_VALUE %>% as.numeric) %>%
  select(date, variable = INDICATOR, value) %>%
  spread(variable, value) %>%
  na.omit %>%
  mutate(EREER_IX_d1ln = log(EREER_IX) - lag(log(EREER_IX), 1)) %>%
  lm(EREER_IX_d1ln ~ LUR_PT, data = .) %>%
  summary
# 
# Call:
# lm(formula = EREER_IX_d1ln ~ LUR_PT, data = .)
# 
# Residuals:
#       Min        1Q    Median        3Q       Max 
# -0.179234 -0.035789 -0.004219  0.034809  0.106755 
# 
# Coefficients:
#              Estimate Std. Error t value Pr(>|t|)
# (Intercept) 0.0024721  0.0335309   0.074    0.942
# LUR_PT      0.0002901  0.0052621   0.055    0.956
# 
# Residual standard error: 0.05735 on 40 degrees of freedom
#   (1 observation effacée parce que manquante)
# Multiple R-squared:  7.598e-05,   Adjusted R-squared:  -0.02492 
# F-statistic: 0.003039 on 1 and 40 DF,  p-value: 0.9563
Code
"A.DE.EREER_IX+LUR_PT" %>%
  # EREER_IX: Exchange Rates, Real Effective Exchange Rate based on Consumer Price Index
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  year_to_date2 %>%
  mutate(value = OBS_VALUE %>% as.numeric) %>%
  select(date, variable = INDICATOR, value) %>%
  spread(variable, value) %>%
  na.omit %>%
  mutate(EREER_IX_d1ln = log(EREER_IX) - lag(log(EREER_IX), 1)) %>%
  lm(EREER_IX_d1ln ~ LUR_PT, data = .) %>%
  summary
# 
# Call:
# lm(formula = EREER_IX_d1ln ~ LUR_PT, data = .)
# 
# Residuals:
#      Min       1Q   Median       3Q      Max 
# -0.06627 -0.02150  0.00726  0.02038  0.05978 
# 
# Coefficients:
#               Estimate Std. Error t value Pr(>|t|)
# (Intercept)  0.0023105  0.0159287   0.145    0.885
# LUR_PT      -0.0007438  0.0022693  -0.328    0.745
# 
# Residual standard error: 0.03341 on 38 degrees of freedom
#   (1 observation effacée parce que manquante)
# Multiple R-squared:  0.002819,    Adjusted R-squared:  -0.02342 
# F-statistic: 0.1074 on 1 and 38 DF,  p-value: 0.7449

Financial Market Prices, Equities, Index - FPE_IX

Code
# FR: France
# ENDE_XDC_USD_RATE
"Q.GB+FR+DE+US.FPE_IX" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("Market Values") +
  scale_x_date(breaks = seq(1950, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_log10(breaks = c(seq(0, 100, 10), 200, 300, 500, 1000),
                     labels = dollar_format(accuracy = 1, prefix = "")) +
  
  theme(legend.position = c(0.8, 0.20),
        legend.title = element_blank())

Exchange Rates

Code
Sys.sleep(10)
tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  filter(id %in% c("ENDE_XDC_USD_RATE", "EREER_ULC_IX", "EREER_IX",
                   "ENEER_ULC_IX", "ENEER_IX")) %>%
  {if (is_html_output()) print_table(.) else .}
id description
ENDE_XDC_USD_RATE Exchange Rates, Domestic Currency per U.S. Dollar, End of Period, Rate
ENEER_ULC_IX Exchange Rates, Nominal Effective Exchange Rate based on Unit Labor Costs, Index
ENEER_IX Exchange Rates, Nominal Effective Exchange Rate, Index
EREER_IX Exchange Rates, Real Effective Exchange Rate based on Consumer Price Index, Index
EREER_ULC_IX Exchange Rates, Real Effective Exchange Rate based on Unit Labor Costs, Index

ENDE_XDC_USD_RATE - Exchange Rates

Code
# FR: France
# ENDE_XDC_USD_RATE
"Q.GB+FR+DE+US.ENDE_XDC_USD_RATE" %>%
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("Exchange Rate ($1 = ?National Currency)") +
  scale_x_date(breaks = seq(1960, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_continuous(breaks = seq(0, 10, 1),
                     labels = dollar_format(accuracy = 0.1, prefix = "", suffix = "../$")) +
  
  theme(legend.position = c(0.8, 0.80),
        legend.title = element_blank())

EREER_ULC_IX - REER based on ULC

Code
"Q.GB+FR+DE+US.EREER_ULC_IX" %>%
  # EREER_ULC_IX: Exchange Rates, Real Effective Exchange Rate based on Unit Labor Costs, Index
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("REER based on ULC") +
  scale_x_date(breaks = seq(1960, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10),
                     labels = dollar_format(accuracy = 1, prefix = "")) +
  
  theme(legend.position = c(0.8, 0.2),
        legend.title = element_blank())

EREER_IX - Exchange Rates, REER based on CPI

Code
"Q.GB+FR+DE+US.EREER_IX" %>%
  # EREER_IX: Exchange Rates, Real Effective Exchange Rate based on Consumer Price Index
  paste0("http://dataservices.imf.org/REST/SDMX_JSON.svc/CompactData/IFS/", .) %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("CompactData", "DataSet", "Series") %>%
  unnest(cols = "Obs") %>%
  setNames(gsub("@", "", names(.))) %>%
  quarter_to_date2 %>%
  mutate(OBS_VALUE = OBS_VALUE %>% as.numeric) %>%
  ggplot(.) + 
  geom_line(aes(x = date, y = OBS_VALUE, color = REF_AREA, linetype = REF_AREA)) + 
  theme_minimal() + xlab("") + ylab("REER based on CPI") +
  scale_x_date(breaks = seq(1960, 2100, 5) %>% paste0("-01-01") %>% as.Date,
               labels = date_format("%Y")) +
  scale_y_log10(breaks = seq(0, 200, 10),
                     labels = dollar_format(accuracy = 1, prefix = "")) +
  
  theme(legend.position = c(0.8, 0.80),
        legend.title = element_blank())

Unemployment

Code
tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  filter(id %in% c("LUR_PT")) %>%
  {if (is_html_output()) print_table(.) else .}
id description
LUR_PT Labor Markets, Unemployment Rate, Percent

CPI, Inflation

Code
Sys.sleep(10)
tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  filter(id %in% c("PCPI_IX", "PCPIHA_IX", "PPPIFG_IX", "PCPI_PC_CP_A_PT",
                   "PCPI_PC_PP_PT")) %>%
  {if (is_html_output()) print_table(.) else .}
id description
PCPI_IX Prices, Consumer Price Index, All items, Index
PCPI_PC_CP_A_PT Prices, Consumer Price Index, All items, Percentage change, Corresponding period previous year, Percent
PCPI_PC_PP_PT Prices, Consumer Price Index, All items, Percentage change, Previous period, Percent
PCPIHA_IX Prices, Consumer Price Index, Harmonized, Index
PPPIFG_IX Prices, Producer Price Index, Consumer Finished Goods, Index

MFS

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/MFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 MFS IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 MFS IMF CL_International Financial Statistics (IFS) Country_MFS 1.0 IMF NA
INDICATOR 1.0 MFS IMF CL_MFS Section of International Financial Statistics (IFS) Indicator -- NEW_MFS 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/MFS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus TextFormat isTimeFormat
UNIT_MULT 1.0 MFS IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA NA
BASE_YEAR 1.0 MFS IMF NA NA NA Series Conditional String NA
OBS_STATUS 1.0 MFS IMF NA NA NA Observation Conditional String NA
TIME_FORMAT 1.0 MFS IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory NA true

PGCS

Components

Code
Sys.sleep(10)
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/PGCS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Dimension") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency isFrequencyDimension
FREQ 1.0 PGCS IMF CL_FREQ 1.0 IMF true
REF_AREA 1.0 PGCS IMF CL_Country_PGCS 1.0 IMF NA
INDICATOR 1.0 PGCS IMF CL_Indicator_PGCS 1.0 IMF NA

Attribute

Code
"http://dataservices.imf.org/REST/SDMX_JSON.svc/DataStructure/PGCS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "KeyFamilies", "KeyFamily", "Components", "Attribute") %>%
  setNames(gsub("@", "", names(.))) %>%
  {if (is_html_output()) print_table(.) else .}
conceptRef conceptVersion conceptSchemeRef conceptSchemeAgency codelist codelistVersion codelistAgency attachmentLevel assignmentStatus isTimeFormat
UNIT_MULT 1.0 PGCS IMF CL_UNIT_MULT 1.0 IMF Series Mandatory NA
TIME_FORMAT 1.0 PGCS IMF CL_TIME_FORMAT 1.0 IMF Series Mandatory true

INDICATOR

Code
imf_codelist <- "http://dataservices.imf.org/REST/SDMX_JSON.svc/CodeList/CL_INDICATOR_PGCS" %>%
  httr::GET() %>%
  httr::content(., "text") %>%
  jsonlite::fromJSON() %>%
  pluck("Structure", "CodeLists", "CodeList", "Code")

INDICATOR <- tibble(id = imf_codelist %>% pluck("@value"),
       description = imf_codelist %>% pluck("Description", "#text")) %>%
  setNames(c("INDICATOR", "Indicator"))

INDICATOR %>%
  {if (is_html_output()) datatable(., filter = 'top', rownames = F) else .}