Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EconMaett committed Aug 27, 2023
1 parent ca69ada commit ec1a4cb
Show file tree
Hide file tree
Showing 28 changed files with 379 additions and 59 deletions.
File renamed without changes.
Binary file not shown.
36 changes: 25 additions & 11 deletions Indicators/KOF_Jobroom/kof_jobroom.R
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
# ************************************************************************
# KOF Jobroom ----

# URL:
# URL: https://www.job-room.ch/home/job-seeker
#
# Feel free to copy, adapt, and use this code for your own purposes at
# your own risk.
#
# Matthias Spichiger, 2023 ([email protected])
# ************************************************************************

## Load packages ----
library(tidyverse)
library(xts)
library(tsbox)
library(kofdata)
library(ggtext)

## Access the data ----

list_keys_in_collection(collectionname = "ch.seco.jobroom")

# available by cantons or total (tot)
cantons(full = FALSE)


# ch.seco.jobroom.candidates.immediate.[canton]

# ch.seco.jobroom.candidates.tot.[canton]

# ch.seco.jobroom.vacancies.[canton]


# ch.seco.jobroom.candidates_rate

# ch.seco.jobroom.predicted_unemprate

#
#### Total
seco.jobroom.cand.imm.tot <- get_time_series(ts_keys = "ch.seco.jobroom.candidates.immediate.tot")

seco.jobroom.cand.imm.tot <- ts(
start = c(2019)
)

plot(seco.jobroom.cand.imm.tot)

# END
Binary file not shown.
46 changes: 0 additions & 46 deletions Indicators/KOF_Nowcasting_Lab/kof_nowcasting_lab.R

This file was deleted.

Binary file not shown.
55 changes: 53 additions & 2 deletions Indicators/KOF_Tourism/kof_tourism.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,60 @@
# ************************************************************************
# KOF Tourism Forecasts ----
# URL: https://kof.ethz.ch/en/forecasts-and-indicators/forecasts/kof-forecasts-of-tourism-in-switzerland.html
# Feel free to copy, adapt, and use this code for your own purposes at
# your own risk.
#
# Matthias Spichiger, 2023 ([email protected])
# ************************************************************************
## Load packages ----
library(tidyverse)
library(tsbox)
library(kofdata)
library(ggtext)

# URL:
## Access the data ----

### Total ----
# ch.kof.trsm.fcst.year KOF Tourism Forecast Total Year
list_keys_in_collection(collectionname = "ch.kof.trsm.fcst.year")
# ch.kof.trsm.fcst.ty.l.all.alpin.lg ch.kof.trsm.fcst.ty.l.all.ch.lg
# ch.kof.trsm.fcst.ty.l.all.city.lg ch.kof.trsm.fcst.ty.l.all.rest.lg
# ch.kof.trsm.fcst.ty.l.che.ch.lg ch.kof.trsm.fcst.ty.l.chn.ch.lg
# ch.kof.trsm.fcst.ty.l.deu.ch.lg ch.kof.trsm.fcst.ty.l.for.ch.lg
# ch.kof.trsm.fcst.ty.l.fra.ch.lg ch.kof.trsm.fcst.ty.l.ita.ch.lg
# ch.kof.trsm.fcst.ty.l.rest.ch.lg ch.kof.trsm.fcst.ty.l.usa.ch.lg
kof_trsm_fcst.ty.l.all.ch.lg <- get_time_series(ts_keys = "ch.kof.trsm.fcst.ty.l.all.ch.lg")
kof_trsm_fcst.ty.l.all.ch.lg <- ts(
data = kof_trsm_fcst.ty.l.all.ch.lg$ch.kof.trsm.fcst.ty.l.all.ch.lg,
start = c(2006),
frequency = 1
)

plot(kof_trsm_fcst.ty.l.all.ch.lg)

### Summer season ----

# ch.kof.trsm.fcst.summer KOF Tourism Forecast Summer Season

list_keys_in_collection(collectionname = "ch.kof.trsm.fcst.summer")
# ch.kof.trsm.fcst.ss.l.all.alpin.lg ch.kof.trsm.fcst.ss.l.all.ch.lg
# ch.kof.trsm.fcst.ss.l.all.city.lg ch.kof.trsm.fcst.ss.l.all.rest.lg
# ch.kof.trsm.fcst.ss.l.che.ch.lg ch.kof.trsm.fcst.ss.l.chn.ch.lg
# ch.kof.trsm.fcst.ss.l.deu.ch.lg ch.kof.trsm.fcst.ss.l.for.ch.lg
# ch.kof.trsm.fcst.ss.l.fra.ch.lg ch.kof.trsm.fcst.ss.l.ita.ch.lg
# ch.kof.trsm.fcst.ss.l.rest.ch.lg ch.kof.trsm.fcst.ss.l.usa.ch.lg


### Winter season ----
# ch.kof.trsm.fcst.winter KOF Tourism Forecast Winter Season
# ch.kof.trsm.fcst.year KOF Tourism Forecast Total Year

list_keys_in_collection(collectionname = "ch.kof.trsm.fcst.winter")
# ch.kof.trsm.fcst.ws.l.all.alpin.lg ch.kof.trsm.fcst.ws.l.all.ch.lg
# ch.kof.trsm.fcst.ws.l.all.city.lg ch.kof.trsm.fcst.ws.l.all.rest.lg
# ch.kof.trsm.fcst.ws.l.che.ch.lg ch.kof.trsm.fcst.ws.l.chn.ch.lg
# ch.kof.trsm.fcst.ws.l.deu.ch.lg ch.kof.trsm.fcst.ws.l.for.ch.lg
# ch.kof.trsm.fcst.ws.l.fra.ch.lg ch.kof.trsm.fcst.ws.l.ita.ch.lg
# ch.kof.trsm.fcst.ws.l.rest.ch.lg ch.kof.trsm.fcst.ws.l.usa.ch.lg


# END
Binary file not shown.
159 changes: 159 additions & 0 deletions KOF_Economic_Forecasts/kof_economic_forecasts.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# ************************************************************************
# KOF Economic Forecasts -----
# URL: https://kof.ethz.ch/en/forecasts-and-indicators/forecasts/kof-economic-forecast.html
# Feel free to copy, adapt, and use this code for your own purposes at
# your own risk.
#
# Matthias Spichiger, 2023 ([email protected])
# ************************************************************************

## Load packages ----
library(tidyverse)
library(tsbox)
library(kofdata)
library(ggtext)
library(readxl)

## Access the data ----

kof_ec_fcst_url <- "https://datenservice.kof.ethz.ch/api/v1/public/sets/vja_public?mime=xlsx"
download.file(url = kof_ec_fcst_url, destfile = "KOF_Economic_Forecasts/KOF_Economic_Forecasts.xlsx", method = "curl")
kof_ec_fcst <- readxl::read_excel(path = "KOF_Economic_Forecasts/KOF_Economic_Forecasts.xlsx")

names(kof_ec_fcst)
# date"
# ch.kof.vja.bau.mfh_nom
# ch.kof.vja.bau.mfh_real
# ch.kof.vja.fx.chf_reer
# ch.kof.vja.koma.consg
# ch.kof.vja.koma.consp
# ch.kof.vja.koma.constot
# ch.kof.vja.koma.domdem
# ch.kof.vja.koma.domdem2
# ch.kof.vja.koma.domdemoi
# ch.kof.vja.koma.ebsc
# ch.kof.vja.koma.ebsp
# ch.kof.vja.koma.et
# ch.kof.vja.koma.exc1
# ch.kof.vja.koma.exc2
# ch.kof.vja.koma.excm
# ch.kof.vja.koma.exs
# ch.kof.vja.koma.exst
# ch.kof.vja.koma.ext
# ch.kof.vja.koma.extot1
# ch.kof.vja.koma.extot2
# ch.kof.vja.koma.gdp
# ch.kof.vja.koma.gdpos
# ch.kof.vja.koma.icinfrar
# ch.kof.vja.koma.icnstr
# ch.kof.vja.koma.ictraf
# ch.kof.vja.koma.ifix
# ch.kof.vja.koma.iinv1
# ch.kof.vja.koma.imc1
# ch.kof.vja.koma.imc2
# ch.kof.vja.koma.ime
# ch.kof.vja.koma.ims
# ch.kof.vja.koma.imst
# ch.kof.vja.koma.imt
# ch.kof.vja.koma.imtot1
# ch.kof.vja.koma.imtot2
# ch.kof.vja.koma.lfpot
# ch.kof.vja.koma.lprodh
# ch.kof.vja.koma.lprodos
# ch.kof.vja.koma.ltot
# ch.kof.vja.koma.ltoth
# ch.kof.vja.koma.ltotv
# ch.kof.vja.koma.nconsg
# ch.kof.vja.koma.nconsp
#ch.kof.vja.koma.nconstot
# ch.kof.vja.koma.ndomdem
# ch.kof.vja.koma.ndomdem2
# ch.kof.vja.koma.ndomdemoi
# ch.kof.vja.koma.nexc1
# ch.kof.vja.koma.nexc2
# ch.kof.vja.koma.nexcm
# ch.kof.vja.koma.nexs
# ch.kof.vja.koma.nexst
# ch.kof.vja.koma.next
# ch.kof.vja.koma.nextot1
# ch.kof.vja.koma.nextot2
# ch.kof.vja.koma.ngdp
# ch.kof.vja.koma.ngdpos
# ch.kof.vja.koma.nicnstr
# ch.kof.vja.koma.nifix
# ch.kof.vja.koma.niinv1
# ch.kof.vja.koma.niival
# ch.kof.vja.koma.nimc1
# ch.kof.vja.koma.nimc2
# ch.kof.vja.koma.nime
# ch.kof.vja.koma.nims
# ch.kof.vja.koma.nimst
# ch.kof.vja.koma.nimt
# ch.kof.vja.koma.nimtot1
# ch.kof.vja.koma.nimtot2
# ch.kof.vja.koma.ntotdem
# ch.kof.vja.koma.ntotdem2
# ch.kof.vja.koma.pconsg
# ch.kof.vja.koma.pconsp
# ch.kof.vja.koma.pconstot
# ch.kof.vja.koma.pdomdem
# ch.kof.vja.koma.pdomdem2
# ch.kof.vja.koma.pdomdemoi
# ch.kof.vja.koma.pexc1
# ch.kof.vja.koma.pexc2
# ch.kof.vja.koma.pexcm
# ch.kof.vja.koma.pexs
# ch.kof.vja.koma.pexst
# ch.kof.vja.koma.pext
# ch.kof.vja.koma.pextot1
# ch.kof.vja.koma.pextot2
# ch.kof.vja.koma.pgdp
# ch.kof.vja.koma.pgdpos
# ch.kof.vja.koma.picnstr
# ch.kof.vja.koma.pifix
# ch.kof.vja.koma.pimc1
# ch.kof.vja.koma.pimc2
# ch.kof.vja.koma.pime
# ch.kof.vja.koma.pims
# ch.kof.vja.koma.pimst
# ch.kof.vja.koma.pimt
# ch.kof.vja.koma.pimtot1
# ch.kof.vja.koma.pimtot2
# ch.kof.vja.koma.pop
# ch.kof.vja.koma.ptotdem
# ch.kof.vja.koma.ptotdem2
# ch.kof.vja.koma.savpfund
# ch.kof.vja.koma.totdem
# ch.kof.vja.koma.totdem2
# ch.kof.vja.koma.urilo
# ch.kof.vja.koma.uroff
# ch.kof.vja.koma.vasport
# ch.kof.vja.koma.wage
# ch.kof.vja.koma.winc
# [110] "ch.kof.vja.koma.ydispb
# [111] "ch.kof.vja.konsum.p31fc10_unterrichtswesen
# [112] "ch.kof.vja.konsum.p31fc11_restaurants_und_hotels
# [113] "ch.kof.vja.konsum.p31fc12_sonstige_waren_und_dienstleistungen
# [114] "ch.kof.vja.konsum.p31fc1_p31fc2_nahrungsmittel_und_getraenke
# [115] "ch.kof.vja.konsum.p31fc3_bekleidung_und_schuhe
# [116] "ch.kof.vja.konsum.p31fc4_wohnung_wasser_strom_gas
# [117] "ch.kof.vja.konsum.p31fc5_moebel_innenausstattung_haushaltsgeraete
# ch.kof.vja.konsum.p31fc6_gesundheitspflege
# ch.kof.vja.konsum.p31fc7_verkehr
# ch.kof.vja.konsum.p31fc8_nachrichtenuebermittlung
# ch.kof.vja.konsum.p31fc9_freizeit_und_kultur
# ch.kof.vja.lik.cpi
# ch.kof.vja.lik.cpi_dom
# ch.kof.vja.lik.cpi_domg
# ch.kof.vja.lik.cpi_doms
# ch.kof.vja.lik.cpi_domspri
# ch.kof.vja.lik.cpi_domspub
# ch.kof.vja.lik.cpi_domsren
# ch.kof.vja.lik.cpi_im
# ch.kof.vja.lik.lrate
# ch.kof.vja.lik.srate
# ch.kof.vja.saldi.saldo_arbeitseinkommen
# ch.kof.vja.saldi.saldo_kapitaleinkommen
# ch.kof.vja.saldi.sekundaereinkommen

# END
Binary file added KOF_MPC/KOF_MPC.xlsx
Binary file not shown.
54 changes: 54 additions & 0 deletions KOF_MPC/kof_monetary_policy_communicator.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ************************************************************************
# KOF Monetary Policy Communicator ----
# URL: https://kof.ethz.ch/en/forecasts-and-indicators/indicators/kof-monetary-policy-communicator.html
# Feel free to copy, adapt, and use this code for your own purposes at
# your own risk.
#
# Matthias Spichiger, 2023 ([email protected])
# ************************************************************************

## Load packages ----
library(tidyverse)
library(tsbox)
library(kofdata)
library(ggtext)
library(readxl)
library(eurostat)


## Access the data ----

### KOF Monetary Policy Communicator ----
kof_mpc_url <- "https://datenservice.kof.ethz.ch/api/v1/public/ts?keys=ch.kof.mpc&mime=xlsx&df=YYYY-MM-DD"

download.file(url = kof_mpc_url, destfile = "KOF_MPC/KOF_MPC.xlsx", method = "curl")
kof_mpc <- readxl::read_excel(path = "KOF_MPC/KOF_MPC.xlsx")


### ECB Main Refinancing Rate ----

eurostat::search_eurostat(pattern = "marginal lending facility")

ecb_mrr <- get_eurostat(id = "teibs010", time_format = "date", select_time = "M",
sinceTimePeriod = "1990-01-01")

## Plot the data ----

kof_mpc |>
mutate(date = ymd(date)) |>
rename(time = date, value = ch.kof.mpc) |>
ggplot(mapping = aes(x = time, y = value)) +
geom_line(linewidth = 1, color = "black") +
geom_hline(yintercept = 0, color = "black", linetype = "dashed", show.legend = FALSE) +
scale_x_date(date_breaks = "1 year", date_labels = "%y") +
scale_y_continuous(limits = c(-1, 1)) +
labs(
title = "KOF monetary policy communicator",
subtitle = "",
caption = "Graph created by @econmaett with data from KOF.",
x = "", y = ""
) +
theme_bw()


# END
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ec1a4cb

Please sign in to comment.