Photo by Kelly Sikkema on Unsplash

Without a doubt, we’ve heard countless times: “2020 has been a wild ride”. I don’t need to tell you that, you lived it. This blog post is a personal reflection of the past year, and frankly, there are no takeaways from this post for the reader, except maybe learning more about me. This post is for me. First, I’ll go through a short, honest reflection of some global events, and then more into my personal life.

World Outlook

Despite the many life-shaking events that happened this year, I came away unscathed. 2020 highlighted how privileged I am. Through a global pandemic that…


Data visualization is the balance of art and science to better see and understand data, allowing hidden stories to be told.

This project was conceived as a birthday surprise to my sister, who is an avid fan of Broadway. I kid you not, she has literally watched Phantom of the Opera 3 times, Les Mis 13 times, Hamilton 4 times, etc. all on Broadway! Unlike her, I am personally not a huge fan of theater. …

Photo by Austin Distel on Unsplash

Project Background

Besides working to earn an income, investing is the best way to reach your financial goals in life, be it saving for a new car, starting a new business, or ensuring a comfortable retirement. The idea of passively increasing the value of my assets over time without doing anything (besides buying stocks and holding it) intrigued me as I pursued financial independence. However, I didn’t know where to start. How do I make a decision on what stocks to buy? How can I understand company’s performance by looking at the stock market? …

You’ve made it! Image adapted from

Putting it all Together

You’ve made it! Finally, we are at the end of the project and to put everything together, there is just one more plot to make.

I combined the candlestick chart, simple moving averages, Bollinger band plots, and even added trading volume in one plot. The Cufflinks package has a pretty nifty QuantFig Class that can add multiple technical analyses to the same plot for this purpose.

df_of_interest = each_df['SPY']
qf = cf.QuantFig(df_of_interest,title='A Look at the US Economy',legend='top',name='GS',up_color='green', down_color='red')
qf.add_bollinger_bands(periods=20, boll_std=2, colors=['cyan','grey'], fill=True,)
qf.add_volume(name='Volume',up_color='green', down_color='red')

Image adapted from

“Predicting” Future Stock Movements

Boy am I glad you made it here! This section covers what I find to be the most exciting part of the entire project! At this point, if you’ve read through parts 1–4 of the project, you understand my steps to evaluate the historical performance of stocks, but the question we are all asking is “How do I predict if a stock will go up and make me rich?” This is probably why you’re here in the first place; You want to know how to choose a stock that has a higher likelihood of yielding greater returns. Let’s see how…

Risk-Return Trade-off. Image adapted from

Simple Risk Management

You’re over halfway there to making more educated stock decisions! Welcome to part 4 of the financial analysis project. In this section, I’ll cover how to quantify stock performances over time and compare it with the risks for each investment. Understanding the relationship between risk and return is critical for making decisions that will work for you in the long run.

Returns Analysis

In part 3, we saw that most companys’ stock rose with the passage of time, but what I’m really interested in is understanding how much they rose by. Give me the numbers! Let’s quantify the returns of these companies…

Data Visualization. Image adapted from

Visualization over time

Welcome to part 3 of my financial analysis project, where we begin making sense of all the numbers we have in a massive dataframe using data visualization. Data visualization makes big data easier for the human brain to understand by bringing to the surface patterns, trends, and outliers. We will use two charts to uncover stories buried in the data. It’s story time!

Closing Prices Over Time

The first visualization to create is the one you’ve seen on the news every day or in your phone’s investing app. …

Pulling Data. Image adapted from

Pulling Historical Stock Market Data using Python

In part 2 of my Financial Analysis side project, I demonstrate how I use Python to easily pull historical stock market data. The code can pull data for multiple companies, so we can compare company performances to those of their competitors. Finally, I’ll show you the steps I take to understand what we’re looking at and make sure the data is ready for further analysis.

Getting Data

You must first install pandas-datareader to use this code. You can install this python package by typing pip install pandas-datareader into your command prompt.

The pandas-datareader package gets data via remote data access from various…

Image from
Image from
Financial Analysis using Python


Hello and welcome to my first coding side project!

My name is Keith and I encourage you to read more about me to understand why I am sharing this code and who I aim to speak to.

About a year ago, I found myself caught in a coming-of-age experience that many new college grads experience. I sat there staring at my first pay check and wondered what to do with all that money! Without having much excess money as a student, I suddenly found myself needing to learn personal finance. Scouring the internet for advice, I came across the common…

Keith Chan — Proud UT 19 Grad

Hi, I’m Keith. I’m a recent 2019 graduate from the University of Texas at Austin. While I majored in Mechanical Engineering and minored in Business Foundations, my interests are wide and varied. At the beginning of the year, I discovered an interest in coding and stock trading, and since then I’ve been trying to learn both.

I’m still a beginner, curious and fascinated by all there is to learn. I’m continuously trying to code more efficiently, adopt best practices, and navigate problems creatively. …

Keith Chan

A curious adventure-seeker aspiring to write good code and live a full life

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store