https://github.com/lexiestleszek/montestocks
Monte Carlo simulation for stocks
https://github.com/lexiestleszek/montestocks
Last synced: 3 months ago
JSON representation
Monte Carlo simulation for stocks
- Host: GitHub
- URL: https://github.com/lexiestleszek/montestocks
- Owner: LexiestLeszek
- License: mit
- Created: 2024-02-29T21:29:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-29T21:32:10.000Z (over 1 year ago)
- Last Synced: 2025-01-13T21:44:18.106Z (5 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.