← All projects

Stock Market Risk and Return

How did ten large US stocks compare on return and risk, and what mix balances them?

Real-world dataFinancePythonpandasPlotlySciPy
2,765trading days
10stocks
1.48best Sharpe ratio (NVDA)

The question

Raw returns hide risk. I compared ten stocks across tech, finance, healthcare, consumer goods and energy on a risk-adjusted basis.

What I did

Cleaned daily prices for AAPL, AMZN, GOOGL, META, MSFT, NVDA, JPM, JNJ, PG and XOM.
Calculated returns, moving averages, rolling volatility and a return correlation matrix.
Ranked stocks by annualised return, volatility and Sharpe ratio.
Simulated 5,000 random portfolios to draw an efficient frontier, and estimated Value at Risk.

What I found

NVDA had the best risk-adjusted record, with a Sharpe ratio of 1.48 from a 72% annual return and 49% volatility. MSFT (0.95) and GOOGL (0.88) followed.
Tech stocks moved together. JNJ and PG had volatility near 18% and lower correlation with tech, which makes them natural diversifiers.
The random portfolios form a clear frontier, and most single stocks sit below it, so mixing holdings improved the return for a given level of risk.

Charts from the analysis

Cumulative returns over time.
Cumulative returns over time.
Daily return correlation matrix.
Daily return correlation matrix.
Efficient frontier from 5,000 random portfolios.
Efficient frontier from 5,000 random portfolios.

Limits to keep in mind

Real-world data

This is a historical study and not investment advice. Past returns, especially NVDA’s, do not predict future ones.

View the code on GitHub ↗
← PreviousGaming and Mental HealthNext →FIFA Player Performance and Market Value