knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(eval = FALSE)
This library serves as a companion to the publication "Understanding Jumps in High Frequency Digital Asset Markets". However it can also be used independently for clustering high dimensional datasets and fitting an implied stochastic volatility model.
This library contains implementations of a few recent publications in the field of High Frequency Econometrics:
The methods can be used in a stand-alone fashion or when obtained from the Blockchain Research Center with additional functionalities.
#### install and load packages #### libraries = c("knitr","lubridate","data.table") lapply(libraries, function(x) if (!(x %in% installed.packages())) {install.packages(x, dependencies = TRUE, repos = "http://cran.us.r-project.org")} ) invisible(lapply(libraries, library, quietly = TRUE, character.only = TRUE)) ## ## #### settings #### Sys.setenv(LANG = "en") # set environment language to English Sys.setlocale("LC_TIME", "en_US.UTF-8") # set timestamp language to English Sys.setlocale("LC_TIME", "English") # set timestamp language to English ## ##
The usage is pretty simple. First, install the package with devtools
. Note that this library is still experimental, s.t. no proper unit testing or object classes have been implemented yet. In case of bugs please report them and I will work on fixing them.
library(devtools) install_github("YalDan/hf.econometrics") library(hf.econometrics)
Now we can just load a suitable dataset and run the test statistics we desire. A sample dataset is provided to illustrate the necessary file structure.
# load the data # currently, for this to work the data needs to be stored in "./data/raw/csv_dump/" DT_list <- make_data("./data/raw/csv_dump/DT_sample.csv") DT_split_list <- list("impute" = split_by_id(DT_list), "no_impute" = split_by_id(DT_list))
Once the data is loaded we can calculate the jump test statistic:
## get LM result ## DT_LM_result_id <- jump_test(DT_split_list$no_impute, which_test = "LM_JumpTest") ## get AJL result ## DT_AJL_result_id <- jump_test(DT_split_list$impute, which_test = "AJL_JumpTest")
Finally, some processing can be made to denoise the jump statistic.
## Preprocess LM result ## DT_jumps_crypto <- preprocess_jump_data(DT_LM_result_id, sign_level = 0.01)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.