Thông tin dữ liệu: S&P500 stock data
BỘ dữ liệu về chứng khoán của tất cả công ty có trong S&P500 thời gian từ ngày 08/02/2013 đến ngày 10/09/2014
Mô tả dữ liệu:
Thông tin dữ liệu được mô tả ở các cột sau :
(tính số lần tăng,giảm, giữ nguyên của cổ phiếu đó, trong khoảng thời gian đó, tỉ lệ % tăng giảm)
Link download : https://docs.google.com/spreadsheets/d/14GTxp_yktiXY_s7B6zZULs3XlUiLq0aJ/edit?usp=sharing&ouid=115122603206656803042&rtpof=true&sd=true
library(readxl)
library(DT)
# Đọc thông tin file
stock <- read_excel("d:/stock.xlsx")
# Hiển thị số dòng mỗi trang
line <- 10
# Xem kết quả
datatable(stock, options = list(pageLength = line))
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html
# Tải các gói cần thiết
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
# Vẽ biểu đồ giá mở cửa
ggplot(stock, aes(x = date, y = open)) +
geom_bar(stat = "identity", fill = "steelblue") +
labs(title = "Biểu đồ giá cổ phiếu S&P 500 phiên mở cửa",
x = "Ngày",
y = "Giá mở cửa") +
theme_minimal()
## Warning: Removed 1 rows containing missing values (`position_stack()`).
# Vẽ biểu đồ giá đóng cửa
ggplot(stock, aes(x = date, y = close)) +
geom_bar(stat = "identity", fill = "black") +
labs(title = "Biểu đồ giá cổ phiếu S&P 500 phiên đóng cửa",
x = "Ngày",
y = "Giá đóng cửa") +
theme_minimal()
# Vẽ biểu đồ giá cao nhất
ggplot(stock, aes(x = date, y = high)) +
geom_bar(stat = "identity", fill = "pink") +
labs(title = "Biểu đồ giá cổ phiếu S&P 500 cao nhất trong ngày",
x = "Ngày",
y = "Giá cao nhất") +
theme_minimal()
## Warning: Removed 1 rows containing missing values (`position_stack()`).
# Vẽ biểu đồ giá thấp nhất
ggplot(stock, aes(x = date, y = low)) +
geom_bar(stat = "identity", fill = "red") +
labs(title = "Biểu đồ giá cổ phiếu S&P 500 thấp nhất trong ngày",
x = "Ngày",
y = "Giá thấp nhất") +
theme_minimal()
## Warning: Removed 1 rows containing missing values (`position_stack()`).