Skip to content

Ms-Chakraborty/StockMarketSimulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

StockMarketSimulator

A fully console-based stock market simulator written in Java. It uses design principles like MVC and Observer Pattern and is designed to simulate buying/selling stocks, updating stock prices, and tracking gainers/losers. πŸš€ Features

πŸ‘€ Single user portfolio management

πŸ“¦ Buy and sell stocks

πŸ’Ή Real-time stock price updates with change tracking

πŸ”” Observer pattern to notify users of price changes

πŸ“Š Displays top gainers and losers based on price change

πŸ›  Tech Stack

Java 17+

Object-Oriented Programming (OOP)

Design Patterns: MVC, Observer

πŸ“ Project Structure

StockMarketSimulator/ β”œβ”€β”€ Main.java # Application entry point β”œβ”€β”€ StockMarket.java # Subject + Market logic β”œβ”€β”€ Stock.java # Stock entity with price tracking β”œβ”€β”€ User.java # Observer + portfolio logic β”œβ”€β”€ Observer.java # Observer interface └── Subject.java # Subject interface

βœ… How to Run

Clone or Download the project

Open in any Java IDE or use terminal

Compile all files: javac *.java java Main πŸ§ͺ Sample Flow

===== Stock Market Simulator =====

  1. Buy Stock
  2. Sell Stock
  3. View Portfolio
  4. Update Stock Price
  5. Exit

Example: Buy AAPL, update its price, and see it appear as a top gainer.

πŸ“¦ Design Patterns Used

Observer Pattern: User observes StockMarket and gets notified when prices change

MVC:

Model: Stock, User

View: Console output

Controller: Main.java handles flow

🧠 Possible Enhancements

Add multiple users

Export portfolio to CSV

Add persistence (save/load portfolio)

Build GUI (JavaFX / React + Spring Boot)

About

A fully console-based stock market simulator written in Java. It uses design principles like MVC and Observer Pattern and is designed to simulate buying/selling stocks, updating stock prices, and tracking gainers/losers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages