Beginner’s Python Financial Analysis Walk-through — Part 6

Keith Chan
Analytics Vidhya
Published in
2 min readAug 23, 2020
You’ve made it! Image adapted from https://manchesterfbc.com/inside-fbc/finish-line

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')
qf.iplot()
Figure 1. A combination of candlestick chart, simple moving averages, Bollinger band plots, and trading volume

Conclusion

Through this project, I have simultaneously learned a lot about coding and investing. This blog post captures what I’ve learned and I’ve hoped to convey that information to you. It’s never too late to start investing, and when you do, I encourage you to review this project and remember the fundamentals you’ve learned!

In summary, we have successfully looked at how to use Python to pull and understand basic stock information. With some basic Python lines, we were able to query stock data, understand their historic returns, conduct rudimentary risk analysis, and even use past performance to (attempt to) predict future market behavior.

About halfway through this project, I learned of platforms like Think or Swim and Yahoo Finance actually have a lot of visualization capability. While they offer more comprehensive visualizations than those covered here, those platforms can also be intimidating to start with. I think it’s good to understand the basics first before adding more advanced concepts and analysis to your market research.

Figure 2. Other complex visualization platforms

This is just the beginning of the journey, and I want to add to this analysis as I learn more about coding and finance. Currently, some directions I want to explore include more technical analysis, fundamental analysis using yfinance, and using Dash or PowerBI to create a user-friendly dashboard.

I hope you enjoyed this financial analysis walk-through and found it instructive, beginner friendly, and easy to follow. Please let me know what you liked most and what you would like to see in future analyses in the comment section below!

If you liked what you read, please reach out and connect! I always welcome a chance to talk with fellow coders, investors, or avid learners!

--

--

Keith Chan
Analytics Vidhya

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