Skip to content

Final Project on Managing and Analyzing Stock portfolio information through a python file

Notifications You must be signed in to change notification settings

L3B3/Portfolio-Manager

Repository files navigation

Portfolio Manager: A Full-Stack Financial Analysis and Forecasting System

Developed Individually by Daniel Rodriguez
OIM3640 – Problem Solving & Software Design
Fall 2025


The project presented here is a comprehensive, fully functional Portfolio Manager designed and implemented individually by Daniel Rodriguez. This system showcases key concepts from software design, data analytics, financial modeling, machine learning, and web development. It serves both as a demonstration of technical proficiency and as a practical tool capable of monitoring and analyzing a real investment portfolio. Thank you for taking the time to explore this work; I hope the system proves both useful and insightful in its design and execution.


Purpose and Motivation

The idea behind this project was to build a tool that mirrors features of professional portfolio dashboards while remaining accessible to students and new investors. Many users rely on limited brokerage dashboards or manual tracking methods that lack transparency or analytical depth. The Portfolio Manager bridges this gap by offering:

  • The handling of buy/sell transactions
  • A reliable reconstruction of holdings from raw data
  • Live market data integration using yfinance
  • Key performance metrics and comparisons to benchmarks
  • Sector and risk analysis
  • Interactive charts and time-series visualizations
  • A prototype LSTM neural network forecast built with PyTorch

The goal is to support informed decision-making while providing an educational look into portfolio behavior and investment analytics.


System Architecture and Design

The system follows a modular architecture that separates core responsibilities into distinct files, ensuring clarity, maintainability, and scalability.

Static Portfolio Logic — Static_Portfolio.py

This module reconstructs portfolio holdings from transactions.csv, computing:

  • Cost basis
  • Average buy price
  • Realized and unrealized P/L
  • First buy date
  • Holding durations

By rebuilding the portfolio state from raw transactions, the system maintains accuracy and transparency.

Live Market Data — Market_Data.py

This layer retrieves:

  • Current prices
  • Sector classifications
  • Market value
  • Unrealized P/L
  • S&P 500 benchmark comparisons

It transforms raw pricing data into readable financial metrics.

Visualization Module — visuals.py

This module generates charts including:

  • Sector allocation
  • Unrealized P/L
  • Portfolio value over time
  • Portfolio vs S&P 500
  • Drawdown curves

These visualizations highlight structural, risk, and performance trends.

Machine Learning — lstm_forecast.py

The LSTM forecaster:

  • Downloads 5 years of historical data
  • Computes daily returns
  • Builds 60-day sliding windows
  • Trains a multivariate LSTM model
  • Predicts next-day returns for all tickers
  • Generates a 20-day forward projection

This is an educational prototype demonstrating deep learning applied to finance.

Flask Web Application — app.py

The user interface includes pages for:

  • Initial portfolio setup
  • Dashboard view
  • Risk analysis
  • LSTM forecasts
  • Chart rendering routes

All system logic connects through this front-end layer.

Data Input Layer — data_input.py

Handles writing and updating of:

  • transactions.csv
  • holdings.csv

Ensures perfect synchronization between user inputs and stored portfolio state.


Functionality and User Experience

Setup Page

Users record their first transactions, which automatically update both CSV files.

Dashboard

Displays:

  • Total market value
  • Cost basis
  • Unrealized P/L
  • S&P 500 comparison
  • Portfolio value chart
  • Position tables
  • Holding durations

Risk Page

Shows:

  • Drawdown history
  • Sector exposure
  • Individual ticker performance
  • Live P/L metrics

Forecast Page

Presents the LSTM model’s:

  • Predicted next-day returns
  • Predicted next-day prices
  • 20-day simulated projection

Technical Skills Demonstrated

This project integrates a wide range of skills, including:

  • Python software design & modularization
  • File I/O and persistent data management
  • Web development with Flask
  • Data analysis with pandas
  • Market data ingestion using yfinance
  • Charting and time-series visualization
  • Deep learning using PyTorch
  • Time-series return computation and forecasting
  • Debugging, refactoring, and exception handling

The final result is a working analytics engine capable of further enhancement and demonstration.


Conclusion

The Portfolio Manager represents a significant individual effort and a practical demonstration of the concepts taught in OIM3640 and QTM3601. It merges computational thinking with financial analysis and machine learning in a cohesive, user-friendly system. Thanks to you the reader, for reviewing this work and hope the platform provides both value and insight.

This application stands as a foundation for future personal exploration in quantitative finance, predictive modeling, and full-stack software development. With further extensions—such as database integration, optimization algorithms, or API trading connectivity—the system could grow into a full production-ready application.

About

Final Project on Managing and Analyzing Stock portfolio information through a python file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages