Stocker is a versatile stock portfolio management tool that allows users to create, upload, and manage their stock portfolios with a range of features including portfolio valuation, cost basis calculations, and performance tracking over time.
-
Create Portfolio: Users can create two types of portfolios:
- Fixed Portfolio: A static portfolio that cannot be modified post-creation.
- Flexible Portfolio: A dynamic portfolio that allows modifications, including adding and selling shares after creation.
-
Upload Portfolio: Users can upload their own portfolio using:
- Absolute Path: Specify the absolute file path from the user's system.
- Relative Path: Specify a path relative to the application's directory.
-
View Portfolio: This feature displays all portfolios and allows users to:
- View the composition of a portfolio.
- Get the valuation of a portfolio on a specific date.
- Calculate the cost basis of a portfolio up to a specific date.
- Buy or sell shares.
- Track the performance of the portfolio over time.
-
Existing Portfolio Strategy: Apply dollar-cost averaging strategy to existing flexible portfolios.
-
Create Strategy Portfolio: Create a new portfolio with a dollar-cost averaging strategy, assigning weights to different stocks.
- Unzip the submitted file and copy the JAR file to a desired location within an empty folder.
- Open a terminal or command prompt in the folder containing the JAR file.
- Execute the following commands:
jar tf pdp.jar jar xf pdp.jar stocker java -jar pdp.jar
- Follow the on-screen prompts to manage your portfolios.
-
To create a new portfolio:
- Choose to create a Fixed or Flexible Portfolio.
- Add shares to the portfolio by entering the company name, the number of shares, and the date of purchase.
- Finalize the portfolio by providing a unique name.
-
To upload a portfolio:
- Select 'Upload Portfolio' from the start menu.
- Provide the relative path to the
.csv
file containing the portfolio data.
- To view and manage portfolios:
- Select 'View Portfolio' from the start menu.
- Choose a portfolio by its name.
- Select an action (e.g., buy shares, sell shares, view composition).
-
To calculate the valuation of a portfolio:
- From the 'View Portfolio Menu', select 'Valuation of Portfolio on a specific date'.
- Provide the date for which you want to value the portfolio.
-
To track the performance of a portfolio over time:
- From the 'View Portfolio Menu', select 'Performance of portfolio over time'.
- The application will display the portfolio's performance graph.
The application follows a modular design with a clear separation between the Model, View, and Controller (MVC) components. It includes support for both text-based and GUI interactions, allowing users to work with the tool in a manner best suited to their preferences.
- Model: Handles all data-related logic, including API interactions and file I/O operations.
- The
ModelInterface
hides low-level operations and is the single point of interaction for the controller. ModelAbstract
contains common method definitions used by concrete implementations like portfolio and share management.FlexibleModelImplementation
caters to dynamic portfolios allowing modifications post-creation.
- The
- View: Manages the user interface and interactions, including display messages and user prompts.
ViewImpl
for text-based interactions displays messages based on controller inputs.GUIView
interfaces and panels manage GUI components for a richer user experience.
- Controller: Acts as the intermediary between the Model and View, controlling the flow of data and responses.
ControllerImpl
manages inputs and outputs, interacting with the model based on user commands.- The
Features
interface andGeneralController
facilitate the addition of new text-based or GUI views.
For a detailed explanation of the design changes and architecture, refer to the DESIGN-README.md
included in the codebase.
The application includes support for the AlphaVantage API and can handle all ticker symbols reported by the API. Commission fees are accounted for each transaction. For a complete list of functionalities and their status, refer to the questionnaire.txt
provided with the code.