Investors have a long list of theories to choose from when it comes to crafting their investment strategy. One approach that remains particularly popular, however, is assessing the correlation between stocks in a portfolio.
Modern Portfolio Theory, or MPT, argues you can maximize returns for a given level of risk by collecting assets based on their correlations. For instance, it proposes that collecting uncorrelated assets may protect a portfolio from fluctuations by reducing the probability of asset prices moving together. Many investors seek to diversify their portfolios for these reasons.
But how do you make those calculations? In this video tutorial, JP Hwang demonstrates how to crunch the numbers and find correlation – which you can then use to inform how you construct your own portfolio and minimize risk.
- 0:00: Introduction and background on IEX Cloud
- 0:35: Background on volatility and correlation
- 4:45: Automation is the answer: Why use Python
- 5:38: First example and dataset (load data, create a pivot table, calculate correlation)
- 8:45: Next dataset (plotting, pivot data, and calculate correlation, the Pearson R function)
- 10:30: Our first real-life dataset (loading, cleaning, calculating correlation)
- 13:45: Working with a larger dataset (importing, inspecting, calculations, plotting)
- 17:22: Working with a DataFrame (converting correlation coefficient, extracting a ticker)
- 18:55: Identifying least corelated symbols
- 25:10: Creating an “average” data series and comparing to individual stocks
- 27:22: Getting started with IEX Cloud: Finding data, starting for free, and sandbox mode
- 30:45: Closing remarks and the Community Blog
To see the full written tutorial step-by-step – including links to code – click below to visit our other blog post, “Portfolio Risk Management: From Correlation to Diversification”.
IEX Cloud Services LLC makes no promises or guarantees herein regarding results from particular products and services, and neither the information, nor any opinion expressed here, constitutes a solicitation or offer to buy or sell any securities or provide any investment advice or service.
12 Questions to Ask Your Financial Data Provider Before You Launch Your App
Creating a fintech app or website that uses financial data? Before jumping in, you need to know what you're getting into with your financial data provider. We've put together a list of 12 questions to help you navigate potential challenges and identify key success factors.
A Strong Foundation: Building With Financial Data
In this piece, we’ll explore the various types and sources for financial data with an eye toward software application and API developers. If you’re building a financial services app, this piece will give you everything you need to start from a strong foundation.
Have question about our platform and how to get started?