Choose random 10 codes to test with time from ‘2017-01-01’ to ‘2018-01-01’.
library(VNDS)
library(dplyr)
ls_VND <- VNDS::tq_bigquery( symbols = c('VND','VPB','FPT','ABC','MSN',
'BID','SHB','SSI','VCB','MBB'),
from = '2017-01-01',
to = '2018-01-01',
src = 'VND',
minimal = FALSE)
## 1 - 5 : VND VPB FPT ABC MSNNULL
## #VND from 2017-01-01 to 2018-01-01 already cloned
## #VPB from 2017-01-01 to 2018-01-01 already cloned
## #FPT from 2017-01-01 to 2018-01-01 already cloned
## #ABC from 2017-01-01 to 2018-01-01 already cloned
## #MSN from 2017-01-01 to 2018-01-01 already cloned
## 6 - 10 : BID SHB SSI VCB MBBNULL
## #BID from 2017-01-01 to 2018-01-01 already cloned
## #SHB from 2017-01-01 to 2018-01-01 already cloned
## #SSI from 2017-01-01 to 2018-01-01 already cloned
## #VCB from 2017-01-01 to 2018-01-01 already cloned
## #MBB from 2017-01-01 to 2018-01-01 already cloned
ls_CAFEF <- VNDS::tq_bigquery(symbols = c('VND','VPB','FPT','ABC','MSN',
'BID','SHB','SSI','VCB','MBB'),
from = '2017-01-01',
to = '2018-01-01',
src = 'CAFEF',
minimal = FALSE)
## 1 - 5 : VND VPB FPT ABC MSNNULL
## #VND from 2017-01-01 to 2018-01-01 already cloned
## #VPB from 2017-01-01 to 2018-01-01 already cloned
## #FPT from 2017-01-01 to 2018-01-01 already cloned
## #ABC from 2017-01-01 to 2018-01-01 already cloned
## #MSN from 2017-01-01 to 2018-01-01 already cloned
## 6 - 10 : BID SHB SSI VCB MBBNULL
## #BID from 2017-01-01 to 2018-01-01 already cloned
## #SHB from 2017-01-01 to 2018-01-01 already cloned
## #SSI from 2017-01-01 to 2018-01-01 already cloned
## #VCB from 2017-01-01 to 2018-01-01 already cloned
## #MBB from 2017-01-01 to 2018-01-01 already cloned
f_check <- function(i){
ls_VND[[i]] %>% left_join(ls_CAFEF[[i]], by = c("date")) %>%
transmute(
date = date,
dif.open = open.x - open.y,
dif.close = close.x - close.y,
dif.high = high.x - high.y,
dif.open = low.x - low.y,
dif.match = match.volume.x - match.volume.y
) %>%
summarise(
open = sum(dif.open),
close = sum(dif.close),
high = sum(dif.high),
open = sum(dif.open),
match = sum(dif.match))
}
f_checkdetail <- function(i){
ls_VND[[i]] %>% left_join(ls_CAFEF[[i]], by = c("date")) %>%
transmute(
date = date,
dif.open = open.x - open.y,
dif.close = close.x - close.y,
dif.high = high.x - high.y,
dif.open = low.x - low.y,
dif.match = match.volume.x - match.volume.y
)
}
lapply(c(1:10),f_check)
## [[1]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[2]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[3]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[4]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 NA NA NA NA
##
## [[5]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[6]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[7]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[8]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[9]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
##
## [[10]]
## # A tibble: 1 x 4
## open close high match
## <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0
lapply(c(1),f_checkdetail) %>% View()