/montestocks

Monte Carlo simulation for stocks

Primary LanguagePythonMIT LicenseMIT

montestocks

Fetch Historical Data:

The function first retrieves the stock's historical data using yfinance. It extracts the closing prices.

Calculate Log Returns:

Log returns are calculated from the historical closing prices. These are used as the basis for the Monte Carlo simulation.

Monte Carlo Simulation:

The simulation generates random returns for the next days based on the historical log returns. It then calculates the potential prices for each day, assuming the stock price follows a geometric Brownian motion (a common thing in financial modeling).

Price Prediction:

The function returns the minimum, maximum, mean, and median potential prices for the future days. These values give a range of possible outcomes for the stock price.