Inspiration
The personal finance and retirement simulations widely available on the internet only asks you the compound rate, initial contributions, and recurring contributions and then spit out a graph. However, the graphs only capture the first moment of the probability distribution (expected value) and ignores the second moment (variance). This is a problem as many do not realize in that in probability theory any stochastic process with a finite expected growth, but has a recurrent return state of -100% (the actual financial market) will always have an expected long-term value of zero. While it is not likely this will happen, this is something retirement planners often miss out on. This project tries to capture the second moment of the probability distribution of financial instruments, and makes tools available only to Wall-Street quants public.
What it does
Serment the cunning fox will ask you a few questions about yourself such as your age, target retirement age, your risk tolerance, your non-retirement financial goals, and more. It will then run 1,000 simulations of your wealth using Geometric Brownian motion (aka Wiener Process) with a drift (expected return - first moment) and a variance (volatility, second moment) determined by our embedded AI based on the user's risk tolerance. Annual contributions will be factored into the simulation too. The Monte-Carlo simulation will also highlight an optimistic (75th percentile), median (50th percentile), and pessimistic (25th percentile) progressions of the user's wealth.
The Stochastic Differential Equation used is: $$ dW_t=\mu W_tdt + \sigma W_tdX_t $$ The Euler-Maruyama approximation applied at each time step $dt$ is (where dt is 1/252 of a year, or one trading day): $$W_{t+dt} = W_t \exp\left( \left( \mu - \frac{1}{2}\sigma^2 \right) dt + \sigma \sqrt{dt} Z \right)$$ $W_t$ is the wealth at time t $\mu$The expected real drift (annual rate of return) discounted by expected inflation using the Fisher equation $\sigma$ The blended portfolio volatility / standard deviation
How we built it
Frontend: React Backend: Python with Numpy
Challenges we ran into
Backend: First tried to use a Binomial tree simulation, but then found out it behaved extremely unnaturally so switched to GBM instead.
Accomplishments that we're proud of
This is the first Hackathon where we all contributed significantly.
What we learned
JSON frontend and backend communication
What's next for Serment
To the moon!
Log in or sign up for Devpost to join the conversation.