@@ -1895,6 +1895,113 @@ if(exists('fl')) rm(fl)
1895
1895
1896
1896
## Intraday Seasonal Data
1897
1897
1898
+
1899
+ ### 20Hr >> 1min
1900
+
1901
+ I set the length of data as Daily (` 1200 mins ` which is 1 trading days) to forecast ` 1 min ` in advance.
1902
+
1903
+ ``` {r, eval = FALSE}
1904
+ # --------- eval=FALSE ---------
1905
+ ets.m <- 'MNN'
1906
+ source('function/intra_min.R')
1907
+
1908
+ timeID <- unique(dsmp$date)
1909
+ bse <- dsmp[year == 2016]$date[1] #"2016-01-04" #1st trading date in 2nd year
1910
+ timeID %<>% .[. >= bse]
1911
+ #timeID %<>% .[. >= as_date('2016-01-04')]
1912
+ data_len <- 1200
1913
+ hrz1 <- 1
1914
+
1915
+ llply(ets.m, function(md) {
1916
+ intra_min(timeID = timeID, dsmp,
1917
+ data_len = data_len, hrz1 = hrz1,
1918
+ .model = md)
1919
+ })
1920
+ ```
1921
+
1922
+ ``` {r 18hr-1min, warning = FALSE, message = FALSE, results = 'asis'}
1923
+ #```{r, warning = FALSE, message = FALSE, results = 'asis'}
1924
+ fl <- list.files(paste0(.dtr, 'data/fx/USDJPY/intraday/'), pattern = '^ts_ets_MNN_1200_1.p_[0-9]{0,}.[0-9]{4}')[1:6]
1925
+ #smp <- readRDS(paste0(.dtr, 'data/fx/USDJPY/intraday/', fl))
1926
+
1927
+ if(all(is.na(fl))){
1928
+ smp <- NA
1929
+
1930
+ } else {
1931
+ smp <- ldply(fl, function(x) {
1932
+ readRDS(paste0(.dtr, 'data/fx/USDJPY/intraday/', x))
1933
+ })
1934
+
1935
+ smp %>%
1936
+ kbl(caption = 'Data Sample (ETS MNN 1200 forecast 1)', escape = FALSE) %>%
1937
+ row_spec(0, background = 'DimGrey', color = 'yellow') %>%
1938
+ column_spec(1, background = '#556DAC') %>%
1939
+ column_spec(2, background = 'Gainsboro', color = 'goldenrod') %>%
1940
+ column_spec(3, background = 'LightGray', color = 'goldenrod') %>%
1941
+ kable_styling(bootstrap_options = c('striped', 'hover', 'condensed', 'responsive')) %>%
1942
+ kable_material(full_width = FALSE) %>%
1943
+ scroll_box(width = '100%', fixed_thead = TRUE)
1944
+ }
1945
+ ```
1946
+
1947
+ ``` {r include = FALSE}
1948
+ if(exists('smp')) rm(smp)
1949
+ if(exists('fl')) rm(fl)
1950
+ ```
1951
+
1952
+ ### 18Hr >> 1min
1953
+
1954
+ I set the length of data as Daily (` 1080 mins ` which is 1 trading days) to forecast ` 1 min ` in advance.
1955
+
1956
+ ``` {r, eval = FALSE}
1957
+ # --------- eval=FALSE ---------
1958
+ ets.m <- 'MNN'
1959
+ source('function/intra_min.R')
1960
+
1961
+ timeID <- unique(dsmp$date)
1962
+ bse <- dsmp[year == 2016]$date[1] #"2016-01-04" #1st trading date in 2nd year
1963
+ timeID %<>% .[. >= bse]
1964
+ #timeID %<>% .[. >= as_date('2016-01-04')]
1965
+ data_len <- 1080
1966
+ hrz1 <- 1
1967
+
1968
+ llply(ets.m, function(md) {
1969
+ intra_min(timeID = timeID, dsmp,
1970
+ data_len = data_len, hrz1 = hrz1,
1971
+ .model = md)
1972
+ })
1973
+ ```
1974
+
1975
+ ``` {r 18hr-1min, warning = FALSE, message = FALSE, results = 'asis'}
1976
+ #```{r, warning = FALSE, message = FALSE, results = 'asis'}
1977
+ fl <- list.files(paste0(.dtr, 'data/fx/USDJPY/intraday/'), pattern = '^ts_ets_MNN_1080_1.p_[0-9]{0,}.[0-9]{4}')[1:6]
1978
+ #smp <- readRDS(paste0(.dtr, 'data/fx/USDJPY/intraday/', fl))
1979
+
1980
+ if(all(is.na(fl))){
1981
+ smp <- NA
1982
+
1983
+ } else {
1984
+ smp <- ldply(fl, function(x) {
1985
+ readRDS(paste0(.dtr, 'data/fx/USDJPY/intraday/', x))
1986
+ })
1987
+
1988
+ smp %>%
1989
+ kbl(caption = 'Data Sample (ETS MNN 1080 forecast 1)', escape = FALSE) %>%
1990
+ row_spec(0, background = 'DimGrey', color = 'yellow') %>%
1991
+ column_spec(1, background = '#556DAC') %>%
1992
+ column_spec(2, background = 'Gainsboro', color = 'goldenrod') %>%
1993
+ column_spec(3, background = 'LightGray', color = 'goldenrod') %>%
1994
+ kable_styling(bootstrap_options = c('striped', 'hover', 'condensed', 'responsive')) %>%
1995
+ kable_material(full_width = FALSE) %>%
1996
+ scroll_box(width = '100%', fixed_thead = TRUE)
1997
+ }
1998
+ ```
1999
+
2000
+ ``` {r include = FALSE}
2001
+ if(exists('smp')) rm(smp)
2002
+ if(exists('fl')) rm(fl)
2003
+ ```
2004
+
1898
2005
### 16Hr >> 1min
1899
2006
1900
2007
I set the length of data as Daily (` 960 mins ` which is 1 trading days) to forecast ` 1 min ` in advance.
0 commit comments