This project helps individuals plan their monthly SIP (Systematic Investment Plan) contributions based on:
- Their financial goal (target amount),
- Time horizon (in years), and
- Risk appetite (Conservative, Balanced, Aggressive)
It uses real historical data from 2007–2021 of asset classes:
- Bitcoin
- Gold
- Nifty50 (Indian equity index)
- Fixed Deposit (FD) (assumed stable return)
Once we calculate how these asset classes behave, we simulate portfolio growth and generate synthetic data to train a Machine Learning model — helping anyone figure out how much they should invest monthly to reach their goal.
-
Merged overlapping historical CSVs for Bitcoin (
BTC-INR) from Yahoo Finance. -
Aligned monthly closing prices for:
- Bitcoin
- Gold
- Nifty50
-
Fixed Deposit data was assumed to have a constant return of 6% per annum.
Result: A clean dataset of monthly prices (2007–2021)
We resampled monthly data to yearly, using the last closing price of each year, and computed annual returns:
**Annual Return (year)** = (Price_end - Price_start) / Price_start
This gave us a dataframe of yearly % returns for each asset.
We computed the average annual growth assuming compounding — more realistic than average returns.
Result:
- Bitcoin CAGR: ~170%
- Gold CAGR: ~10%
- Nifty50 CAGR: ~6.3%
Measures the risk or fluctuation in returns. Higher volatility = more uncertainty.
Measures risk-adjusted return — how much excess return you're getting per unit of risk.
Assuming risk-free rate = 4%.
We defined 3 sample profiles:
risk_profiles = {
'Conservative': {'FD': 0.60, 'Gold': 0.30, 'Nifty50': 0.10, 'Bitcoin': 0.00},
'Balanced': {'FD': 0.30, 'Gold': 0.30, 'Nifty50': 0.40, 'Bitcoin': 0.00},
'Aggressive': {'FD': 0.00, 'Gold': 0.20, 'Nifty50': 0.60, 'Bitcoin': 0.20}
}For each risk profile, we calculate:
Weighted average of asset CAGRs:
Where:
-
$w_i$ : weight of asset$i$ -
$\text{CAGR}_i$ : CAGR of asset$i$
We don't just average volatilities — instead, we use the covariance matrix of asset returns and calculate true portfolio volatility:
Where:
-
$\mathbf{w}$ : vector of weights -
$\Sigma$ : covariance matrix of asset returns
We excluded FD from the covariance matrix since it has 0 volatility — its impact is scaled down appropriately.
To simulate realistic portfolio growth, we model monthly SIP investments over a given time horizon using random monthly returns:
-
For each month, add monthly SIP
-
Apply a random return drawn from a normal distribution:
R_month ~ N(r / 12, σ / √12)Where:
ris the annual expected return (CAGR)σis the annual volatilityR_monthis the simulated monthly return
-
Repeat for all months and for 1000 simulations
-
Average the final portfolio values from all simulations
This gives us the expected goal amount for a given SIP, duration, and risk profile.
We flipped the simulation logic to generate data for machine learning:
- Monthly SIP amount (₹1000 to ₹50000)
- Investment duration (1–20 years)
- Risk profile (Conservative, Balanced, Aggressive)
For each combination:
- Simulate investment growth via Monte Carlo
- Record the goal amount reached
-
$X =$ [Goal Amount, Duration, Risk Profile (encoded)] -
$y =$ Monthly SIP
We generated 480 synthetic data points to train a regression model.
We trained a RandomForestRegressor model to predict the required monthly SIP, given:
- Desired goal amount
- Duration (years)
- Risk profile
-
MSE: ~12.9 lakhs²
-
R² Score: ~0.95 → Good fit
-
Feature importance:
- Goal Amount: ~64%
- Duration: ~30%
- Risk Profile: ~6%
This lets users answer:
"How much should I invest monthly to reach ₹X in Y years with Z risk tolerance?"
Model Accuracy:
The model achieved an R² Score of 0.948, indicating that ~95% of the variance in SIP prediction is explained by the inputs.
This level of accuracy is excellent for financial estimation models, especially when working with real market volatility.
We built a clean, interactive web UI using Gradio where users can:
- Enter their goal, duration, and risk profile
- View predicted SIP amount
- See an investment growth chart
- Visualize their asset allocation pie chart
- Read an investment summary (CAGR, total return, volatility)
- A trained ML model that predicts SIP for any user input
- Financial engine using real market data + Monte Carlo simulation
- Risk-adjusted metrics: CAGR, Volatility, Sharpe Ratio
- Gradio-powered interactive investment planner
| Term | Meaning |
|---|---|
| SIP | Systematic Investment Plan – monthly investing strategy |
| CAGR | Compound Annual Growth Rate – smoothed annual return |
| Volatility | Standard deviation of returns – measures investment risk |
| Sharpe Ratio | Return per unit of risk (vs. a risk-free asset like FD) |
| Covariance | Measures how two assets move together – used for portfolio optimization |
| Monte Carlo | Simulation technique using random sampling to model uncertain outcomes |
- Most SIP calculators hardcode returns and ignore real volatility.
- We use historical data + statistical modeling to provide realistic, personalized estimates.
- This builds financial literacy + planning confidence in investors, even if they're new.