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.
Building with Financial Data Sets and APIs
In this article, you'll learn how to incorporate financial data into your application. First, you'll learn more about how to plan for and use real-time financial data in your applications. Then, you'll use the financial API provided by IEX Cloud's Apperate platform to build a financial stock website using NestJS.
Taming the Chaos: Sourcing Financial Data from Multiple Providers
Combining multiple data sources can help your app or website stand apart from the pack. However, it also comes with several challenges. This guide can get you started on the right foot.
12 Questions to Ask Your Financial Data Provider Before You Launch Your App
Creating a fintech app or website that uses financial data? Need a stock market API? Before jumping in, you need to know what you're getting into with your financial data or stock market data provider. We've put together a list of 12 questions to help you navigate potential challenges and identify key success factors.