A clean and modular Python time‑series analysis project for fetching stock market data, calculating moving averages, and generating professional financial charts.
This project is designed for Data Science / Finance portfolios and follows industry‑standard practices: virtual environments, requirements management, and clean architecture.
This application:
- Fetches real‑time historical stock prices using
yfinance - Calculates 50-day and 200-day Simple Moving Averages (SMA)
- Plots price + SMAs using Matplotlib
- Demonstrates time‑series analysis fundamentals
- Uses a clean folder structure suitable for GitHub portfolios
Unlike many beginner projects, this version does not store raw data or images inside the repository
(to keep the repo clean and lightweight).
Instead, data is fetched dynamically each time the script runs.
Stock market data is fetched in real time from:
Yahoo Finance API (via yfinance library)
https://pypi.org/project/yfinance/
No API key is required.
stock-analysis/
│
├── README.md
├── requirements.txt
└── src/
└── main.py
If you choose to save data or charts locally, the script will automatically create:
data/
assets/visuals/
These folders are optional and not included by default to keep the repo clean.
python -m venv .venv
Windows:
.venv\Scripts\activate
macOS / Linux:
source .venv/bin/activate
When you finish working on the project:
deactivate
Inside your activated venv:
pip install -r requirements.txt
To generate a fresh requirements.txt file:
pip freeze > requirements.txt
Inside the project directory:
python src/main.py
You will be prompted for a stock ticker symbol:
Examples:
AAPL
MSFT
TSLA
NVDA
SPY
The script will:
- Fetch 1 year of historical price data
- Calculate SMA 50 & SMA 200
- Display a Matplotlib chart
- (Optional) Save CSV + chart locally
- Real-time time‑series financial analysis
- REST-like data retrieval via yfinance
- Rolling window signal generation (SMA indicators)
- Matplotlib financial visualizations
- Path‑safe architecture suitable for GitHub
- Fully venv‑isolated workflow
- Zero hardcoded paths
- Python 3.x
- Pandas
- Matplotlib
- yfinance
Berke Arda Türk
Data Science & AI Enthusiast | Computer Science (B.ASc)
🌐 Portfolio Website • 💼 LinkedIn • 🐙 GitHub