Stock Portfolio Manager

Email for code!

Email for code!

Developing Stock Simulations with Object-Oriented Design

June - July 2024
Role:
Developer

Overview

This project was a final class assignment for CS 3500 (Object-Oriented Design). The class focused on building a user-centric application with a strong emphasis on software design principles. Core concepts involved Model-View-Controller (MVC) architectural pattern and extensive testing. This assignment was completed with my partner, Koena Gupta.

What it does

The primary goal was to create a Java application for managing stock portfolios. Users can create and manage stock portfolios, buy/sell stocks on specific dates, view portfolio composition/value/distribution on any date, save/load portfolios, analyze individual stock performance (gain/loss, moving averages, crossovers), rebalance portfolios by weight, and visualize stock/portfolio performance. Another crucial aspect was to provide both a text-based and a graphical user interface (GUI).

How It Was Built: MVC & APIs

Model

Contained all business logic, data structures, and financial calculations. This is where algorithms were created to save and calculate portfolio value and where buying/selling logic occurred. The AlphaVantage API was integrated here, with a caching mechanism to mitigate rate limits.

View

Implemented as distinct TextView and GUIView (using Java Swing), and designed with Interface Segregation Principle in mind. I focused on clean layouts and effective use of Swing components for the GUI.

Controller

Acted as the mediator, processing user input from either view, validating it, and coordinating interactions with the Model.


Lots of Testing

Testing was super important to make sure everything worked right. We used JUnit for most of my tests, really focusing on the Model part where all the math and logic happens. We made sure to hit all edge cases, like bad dates or trying to buy/sell stocks in the past after a later transaction.



To avoid constantly hitting the AlphaVantage API (and its limits!), I built a "Mocks" package with four fake classes. These allowed me to simulate API responses, which was crucial for testing of the Controller's logic. Besides unit tests, we also did integration tests to check that the Model, View, and Controller all talked to each other correctly, and results were being displayed to the user. Finally, we did some manual testing on both the text and graphical interfaces to catch any usability issues.

The Biggest Challenge

The trickiest part was navigating the project's architecture because it was incrementally developed through three separate homework assignments. It was important to preserve the Open/Closed Principle of Object-Oriented Design and stick to the MVC model. As new features were constantly being added with each assignment, it became a continuous challenge to ensure that existing code remained "closed for modification" yet "open for extension." This meant carefully designing interfaces and abstract classes, and testing for various cases and edge cases.


Next Steps

Looking ahead, potential enhancements could be implementing advanced graphical performance charts utilizing a charting library, like JFreeChart, for better visualizations. Also, changing the graphical user interface (GUI) with improved aesthetics, color schemes, and overall user experience design.

What I Learned

This project was a huge learning curve, really showing me how MVC architecture works in the real world, not just in textbooks. I got hands-on with defensive design, figuring out that planning for future features early on, especially with careful interface design and sticking to principles like Open/Closed, saves a ton of time later. Dealing with external tools like the AlphaVantage API and its limits taught me smart ways to cache data and handle errors smoothly. I also saw the benefits of solid testing and using mocks. Finally, I learned key communication skills and effective coding with a partner using GitHub for seamless collaboration.

Harini Avula - July 2025

Harini Avula - July 2025

Harini Avula - July 2025