A console-based Java application that reads a user's stock portfolio from a remote CSV file, fetches live stock data from the Financial Modeling Prep API, and provides analysis such as total investment value, the cheapest and most expensive stocks, and average stock price.
- π Live Stock Data β Fetches up-to-date stock prices, volumes, and market caps using Financial Modeling Prep API.
- π Portfolio Analysis β Calculates total investment per stock and total portfolio value.
- πΉ Stock Comparison β Identifies the cheapest and most expensive stocks in the portfolio.
- π Average Stock Price β Computes the average price of all stocks.
- π Remote CSV Parsing β Loads and reads a remote CSV of stock symbols and shares.
- β Test Coverage β Includes JUnit-based unit tests to validate logic and ensure reliability.
- Java 17
- Apache Commons CSV
- Jackson (FasterXML)
- JUnit 4
Your portfolio should be structured like this:
Symbol,Shares AAPL,500 NFLX,200 IBM,300
- Clone the repo
git clone https://github.com/JoshuaDada007/StockPortfolio.git 2. Update the CSV URL
Open InvestmentTest.java and replace the default URL with your own public CSV:
String url = "https://your-csv-link.com/yourfile.csv";
3. Open the project in IntelliJ or any Java IDE.
4. Ensure Java 17+ is installed.
5. Run InvestmentTest to fetch live stock data and view analysis.