According to Ray Dalio, the easiest way to adjust for risk is to seek uncorrelated returns.
Ray's made billions from a simple idea.
Here's how to do it in a few lines of Python code:
Step 1: Collect Stock Data
Run this code to download free stock price data from Yahoo Finance.
Step 2: Convert Prices to Returns
Using pandas code, we can get returns (just run this code):
Step 3: Use Riskfolio's Plot Clusters
This function takes our returns and creates a hierarchical dendrogram based on Pearson correlation of the stock returns.
Step 4: Analyze the plot
Select Stocks from different buckets that exhibit lower correlation to others in your portfolio.
Example:
GLD, TSLA, NVDA, AXP would be less correlated than AAPL, MSFT, NVDA, GOOG.
Step 5: Become a Quant Scientist
Once you realize that trading with algorithms gives you an edge, the next step is to learn how to exploit that edge.
We want to help.
On March 26th, we are hosting a free workshop to help you get started with algorithmic trading with Python.
Register here (500 seats): learn.quantscience.io/qs-register
That's a wrap! Over the next 24 days, I'm sharing my top 24 algorithmic trading concepts to help you get started.
If you enjoyed this thread:
1. Follow me @quantscience_ for more of these
2. RT the tweet below to share this thread with your audience
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.
