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

StockAnalyzer

Our FE 520 group built a Python package for downloading stock prices, calculating indicators and plotting results. We wanted these steps to work through one interface without paid tools. The browser demo uses the package's formulas with a saved set of daily prices.

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

Stock analysis demo

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

Package structure

The four modules handle data, indicators, risk metrics and plotting. Each can be imported separately.

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.

Most of the implementation work was in handling the data consistently: flattening yfinance column names, retaining missing values during indicator warm-up, and aligning stock and benchmark dates before computing beta.

03

Source

Python files from the course submission.

Loading…