Group10 Report

From Visual Analytics and Applications
Jump to navigation Jump to search

Title.jpg China Stock Data Visualization

Proposal

Poster

Application

Report

1 Motivation of the application

Predicting the stock change is difficult since a complex mix of factors is involved. And although the stock market data is abundant, it is usually disorderly retained on a lot of websites. A visualization dashboard that enables the users to explore the patterns of stock market data, directly eyeball the trend of different stocks and also forecast the future market changes will be extremely helpful for market participants.
This project aims to provide investors and traders with advanced data visualization of stock market data to reveal the hidden pattern of market movement, providing portfolio recommendations based on risk assessment and the preference of investors.

2 Review and Critic on Past Work

In the most of websites, they provided the value and volume graphs of each stocks. But there are two main critic on the past work:

  • Most of websites are not provided the predictive analysis for user to forecast future trend in a short period.
  • Most of websites are not provided portfolio optimization for user can choose the stock they are interested and are not provided the expected return of combined stocks.

Report1.png

3 Design Framework

The visualization dashboard implements ggplot2 to create graphics, based on The Grammar of Graphics. After the data input, ggplot2 is able to map variables according to various aesthetics. For auto ARIMA time-series forecast, the dashboard makes use of tseries to plot the forecasting fan chart. The dashboard also includes googleVis for annotation trend chart and portfolio pie chart. The completed dashboard is based on R Shiny application.

4 Demonstration

The dataset comes from CSMAR, a comprehensive database of China stock returns, covering all companies listed on Shanghai Stock Exchange and Shenzen Stock Exchange.
Create an interface for users to directly find the trend of different stocks and predict the stock prices. For each investor, provided investment recommendations based on risk assessment and preference of investors.
The dashboard consists of three section:
Exploratory analysis: to give a general view of the price trend of certain stocks and to perform comparison between a pair of stocks.
Predictive analysis: decompose the trend, season, cycle & noise in time series data future stock price, using ARIMA methods to forecast the with reported accuracy and confidence interval.
Portfolio optimization: to suggest users with optimized portfolio based on the preference of the users and the historical return data. It aims to help investors on their decisions on how many should they invest in different stocks that they like.

4.1 Data preparation

Report2.png
For the data we make use of the package dplyr to combine the stock code and the Chinese name of the stock. Since for the raw data it only includes stock code without stock name. For better user experience, we add in the Chinese name of the stock name, enabling the user to select stocks based on their familiar information when performing various analyses.
We select the data from the beginning of 2018 to 23 November 2018. In the future we plan to implement the function that allows user to input their own dataset and perform independent analysis.

4.2 Exploratory Analysis

In the description analysis, we will visualize individual stock time series data with the ability to compare different other stocks & market index, to study the correlations and relative trend to industry/market.
The dashboard interface implement package googleViz to include two selection panels and one graph section. With the selection panels the user could alternatively choose one stock from the dataset, and click to visualize the price fluctuation within various duration, such as one day, five days, one month, six months and the maximum duration is one year. Report3.png
When the user hover the mouse over the graph, on the top right of the graph will appear the annotation of the specific stock with its Chinese name, stock code, price and date.
On the bottom of the graph the user could zoom in the view based on specific dates, which will allow the user to perform deep and personalized exploration upon the trend of certain stock.
The second panel enables users to select a pair of stocks for price comparison. After selection, the stocks will appear on the same graph with different color, along with the annotation on the graph. In view of this, the user could eyeball the differences between two stocks on the price and the trend. The above timeline function still applies.

4.3 Predictive Analysis

In predictive analysis, we would like to visual a.pattern of time series data and examine the outliers b.decomposition of the trend, season, cycle & noise in time series data future stock price, using ARIMA methods to forecast the with reported accuracy and confidence interval.
The dashboard makes use of package forecast to present the pattern of time series data and examine the outliers. There are three panels on the interface, the stock selection, the prediction period and the forecast confidence level. After selecting the stocks, the user could select the prediction period from one day to twenty days. The user is also allowed to select the forecast confidence level.
By presenting the forecast price of the stock based on the prediction period the user chose, the interface helps the user predict the future price of the stocks, which will enhance the decision-making of market-participants.
Report4.png

4.4 Portfolio Optimization

In optimization analysis, we will visualize a suggested optimal investment portfolio to minimize risk / maximize the margin, based on investors’ risk tolerance
The section will provide users with suggested portfolio based on their selections and the variance in return of the stock.
After selecting multiple stocks, the interface will return with the general trend line of the selected stocks, doughnut chart of the suggested portfolio and the historical return of the selected stocks.
The doughnut chart will present users with the combination of the suggested investment assets, which is supported by function portfolio optimization in the package tseries. In the same time, the dashboard also provide users with historical data to have a better understanding of the market trends.
Report5.png
A suggested optimal investment portfolio aims to minimize risk / maximize the margin, based on investors’ risk tolerance. For the investors, the dashboard could suggest the investors with various investment portfolio based on the preferences and the return. It would also allow users to eyeball the history stock return trends.

5 Discussion

We leverage R packages such as ggplot, googleVis, forecast, tseries for creating interactive visualization dashboard which is user-friendly. The dashboard could not only present financial data in a clear and aesthetics way, but also could it help users inspect and manipulate the data in hand.

6 Future Work

For time and knowledge limitation, the project is imperfect for there are a lot of idea we have during doing this project but we could only save it to the next time. In the future we would like to enhance our visualization dashboard in these aspects:
Implement the use of candlestick graph. The candlestick graph is useful for stock data visualization for its multiple function served in one single graph. It could shows the open price, close price, the highest price and the lowest price during one day. The user could easily eyeball the trend of the price as well as the detail information of each day.
In the forecast section we will try to find out more solid and reliable solution than the current package. In our test, the model returns a relatively reasonable forecast outcomes however, the algorithm is out-dated and it should be examined in the future.
In the portfolio suggestion section we will seek for more diverse and accountable packages or methods to enhance the current portfolio optimization since it is insufficient and unsophisticated.
In the future, hopefully we could leverage our project in the real scenarios, exploring how it will help market participants as well as if there is any improvements we could do.

References

[1]Introduction to forecasting with ARIMA in R  https://www.datascience.com/blog/introduction-to-forecasting-with-arima-in-r-learn-data-science-tutorials
[2]Application of data mining techniques in stock markets: A survey https://www.researchgate.net/publication/228664309_Application_of_data_mining_techniques_in_stock_markets_A_survey
[3]A Data mining algorithm to analyze stock market data using lagged correlation https://ieeexplore.ieee.org/document/4783968
[4]Stock Price Analysis in Tableau https://www.edupristine.com/blog/stock-price-analysis-in-tableau
[5]Markowitz portfolio optimization for cryptocurrencies in Catalyst https://medium.com/catalyst-crypto/markowitz-portfolio-optimization-for-cryptocurrencies-in-catalyst-b23c38652556