FE 520 Final Project · Stevens Institute of Technology · Spring 2026

StockAnalyzer

A small Python package: four modules, 517 lines, built only on pandas, numpy, matplotlib and yfinance. It fetches prices, computes technical indicators and risk metrics, and draws the charts. The demo below runs the same formulas in your browser on a one-year price snapshot the package downloaded.

Usage

from the README
import stockanalyzer as sa

aapl = sa.fetch_stock_data("AAPL", period="1y")
rsi  = sa.rsi(aapl, window=14)
macd, signal, hist = sa.macd(aapl)

sa.sharpe_ratio(aapl)       # risk-free 2%
sa.max_drawdown(aapl)
sa.plot_technical(aapl, indicators=["sma", "bollinger", "rsi", "macd"])
Authors
Zhenhan Chen and FE 520 teammates
Modules
data · technical · returns · visualization
Libraries
pandas · numpy · matplotlib · yfinance · datetime
Snapshot
Daily closes, last 12 months
01

Run it on a stock

Pick a ticker and overlays. Hover any chart for values. Numbers match the package's Python output on the same data.

Close and overlays
RSI (14) · 30 / 70 bands
MACD (12, 26, 9)
Drawdown from running peak
02

Four modules, one job each

Each module can be imported on its own; indicators accept a Series or a DataFrame with a Close column.

data.pyDownload OHLCV from Yahoo Finance, flatten yfinance's multi-level columns, validate columns and prices.
technical.pySMA and EMA for trend, RSI and MACD for momentum, Bollinger Bands for volatility.
returns.pyDaily and cumulative returns, annualized volatility, Sharpe, maximum drawdown, beta on aligned dates.
visualization.pyPrice with volume, multi-panel technical chart with a panel per oscillator, return histogram, drawdown.

Every public function checks its inputs: wrong types raise TypeError, bad values (empty ticker, non-positive window, negative prices) raise ValueError, and a failed download raises ConnectionError. Indicator warm-up periods stay as NaN instead of being dropped, so results keep the price index.

03

Source

The package as submitted.

Loading…