0% found this document useful (0 votes)
23 views2 pages

Stock Selection

The document outlines a data analysis process involving monthly log returns of stock prices for symbols GMD.VN, REE.VN, and VCI.VN, including a one-sample t-test to assess daily mean returns. It also details the calculation of stock returns based on prices from one week ago compared to the latest prices. Additionally, a trading strategy is discussed, focusing on the expected demand for REE due to weather conditions and the potential of VCI.

Uploaded by

Kiệt Đỗ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

Stock Selection

The document outlines a data analysis process involving monthly log returns of stock prices for symbols GMD.VN, REE.VN, and VCI.VN, including a one-sample t-test to assess daily mean returns. It also details the calculation of stock returns based on prices from one week ago compared to the latest prices. Additionally, a trading strategy is discussed, focusing on the expected demand for REE due to weather conditions and the potential of VCI.

Uploaded by

Kiệt Đỗ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

VN_prices_monthly_log_returns <- VN_prices %>%

group_by(symbol) %>%
tq_transmute(select = adjusted,
mutate_fun = periodReturn,
period = "monthly",
type = "log",
col_rename = "monthly.returns")

VN_prices_monthly_log_returns %>% ggplot(aes(x=date, y=monthly.returns, col=symbol))+geom_line()+facet_wrap(symbol~.)

Warning message:
“There were 3 warnings in `dplyr::mutate()`.
The first warning was:
ℹ In argument: `nested.col = purrr::map(...)`.
ℹ In group 1: `symbol = "GMD.VN"`.
Caused by warning in `to_period()`:
! missing values removed from data
ℹ Run `dplyr::last_dplyr_warnings()` to see the 2 remaining warnings.”
Warning message:
“Removed 1 row containing missing values or values outside the scale range
(`geom_line()`).”

# Filter the data for the latest 2 years


latest_2_years <- Sys.Date() - years(2)
VN_prices_daily_log_returns_2_years <- VN_prices_daily_log_returns %>%
filter(date >= latest_2_years)

# Perform one-sample t-test to check if the daily mean return is greater than 0
t_test_results <- VN_prices_daily_log_returns_2_years %>%
group_by(symbol) %>%
summarize(t_test = list(t.test(daily.returns, mu = 0, alternative = "greater"))) %>%
mutate(p_value = map_dbl(t_test, ~ .x$p.value),
mean_return = map_dbl(t_test, ~ .x$estimate)) %>%
select(symbol, mean_return, p_value)

# Display the results


t_test_results

A tibble: 3 × 3
symbol mean_return p_value

<chr> <dbl> <dbl>

GMD.VN 0.0005649785 0.29372931

REE.VN 0.0004788359 0.24014523

VCI.VN 0.0016232746 0.09593474

# Get the date one week ago


one_week_ago <- Sys.Date() - 7

# Filter the prices for one week ago and the latest available date
prices_one_week_ago <- VN_prices %>%
filter(date == one_week_ago & symbol %in% c("REE.VN", "GMD.VN", "VCI.VN"))

prices_latest <- VN_prices %>%


filter(date == max(date) & symbol %in% c("REE.VN", "GMD.VN", "VCI.VN"))

# Merge the dataframes to get the prices one week ago and the latest prices
merged_prices <- merge(prices_one_week_ago, prices_latest, by = "symbol", suffixes = c(".one_week_ago", ".latest"))

# Calculate the return for each stock


merged_prices <- merged_prices %>%
mutate(return = (adjusted.latest - adjusted.one_week_ago) * 500)

#Reported return
merged_prices %>%
select(symbol, adjusted.one_week_ago, adjusted.latest, return)

A data.frame: 3 × 4
symbol adjusted.one_week_ago adjusted.latest return

<chr> <dbl> <dbl> <dbl>

GMD.VN 65900 64600 -650000

REE.VN 65800 63700 -1050000

VCI.VN 34750 33000 -875000


 

format_size format_bold format_italic code link image format_quote format_list_numbered format_list_bulleted horizontal_rule ψ mood
### Trading Strategy
I bought 500 stocks for each of the three GMD, REE, and VCI. For REE, Trading Strategy
refrigeration company, I expects demand for its products to rise becau
hotter weather in the South. For GMD, I guess that transporation may r I bought 500 stocks for each of the three GMD, REE, and VCI. For REE, a
is approaching the holiday season. Last but not least, I choose VCI be
read on this site https://tikop.vn/blog/ refrigeration company, I expects demand for its products to rise because
co-phieu-vci-danh-gia-tiem-nang-dau-tu-gia-co-phieu-vci-hien-nay-7813# of hotter weather in the South. For GMD, I guess that transporation may
-tu-co-phieu-vci-khong that VCI is a product with high potential.
rise as it is approaching the holiday season. Last but not least, I choose
VCI because I read on this site https://tikop.vn/blog/co-phieu-vci-danh-gia-
tiem-nang-dau-tu-gia-co-phieu-vci-hien-nay-7813#co-nen-dau-tu-co-phieu-
vci-khong that VCI is a product with high potential.
 

You might also like