C++ Risk Valuation Engine: Calculating Sharpe Ratio and Max Drawdown

I built a functional C++ program to calculate portfolio returns, Sharpe Ratio, Historical VaR (95%), and Max Drawdown, forcing me to understand the underlying math.

Today I dove into basic portfolio theory. I built a Risk Valuation Engine in C++. I am 18 and still learning. I do not understand everything yet, but I am getting better with each project. This one helped a lot.

You input a few assets, their weights, and daily returns. The code then calculates: Portfolio returns Sharpe Ratio Historical VaR (95%) Max Drawdown Log returns

I wanted to stop just reading and start doing. I kept hearing terms like VaR and Sharpe but did not fully get them. Coding forced me to slow down and think. What does each part actually mean? Why do we calculate it that way?

How weighted returns work. What drawdown really shows. Why VaR matters in risk. How the Sharpe ratio balances return and volatility. The difference between simple and log returns (still wrapping my head around it).

I know this is not perfect code. But I wrote it myself and I understand more now than I did yesterday. That is enough for today.