This project is a console-based stock trading simulation game written in C++. It allows users to simulate buying and selling stocks based on historical data, manage a portfolio, and visualize their portfolio's value over time.
- Stock Trading: Buy and sell stocks from a predefined list of companies.
- Portfolio Management: Keep track of the stocks you own and their values.
- Historical Data Simulation: Use real historical stock prices for simulation.
- Visualization: Visualize the portfolio's value changes over time in a simple text-based graph.
- Command Interface: Use commands like
buy
,sell
g,check
,next
, andprofile
to interact with the game.
- C++ Programming: The game is entirely written in C++, showcasing proficiency in the language.
- File I/O: Reads stock data from CSV files, demonstrating file input/output operations in C++.
- Data Parsing: Includes CSV parsing to extract stock data.
- Use of Standard Libraries: Utilizes standard libraries such as
<iostream>
,<fstream>
,<vector>
, and<string>
. - Object-Oriented Programming: Although the provided code is mostly procedural, the structuring around functions and data manipulation hints at OOP principles.
- Error Handling: Basic error handling for file operations and data parsing.
- Algorithm Implementation: Implements algorithms for searching, data processing, and simple visualization.
-
Clone this repository to your local machine.
-
Make sure you have a C++ compiler installed (e.g., g++, clang).
-
Compile the code. For example, using g++:
g++ -o tradingGame test.cpp
-
Run the executable:
./tradingGame
-
Follow the on-screen prompts to interact with the game.
- buy [stock symbol]: Purchase a stock. You must have enough funds in your portfolio.
- sell [stock symbol]: Sell a stock if you own it.
- check: Displays the current value of your portfolio and remaining funds.
- next: Moves to the next day, updating stock prices based on the historical data.
- profile: Shows the stocks currently owned and their total value.
Feel free to fork this project, make changes, and submit pull requests. We're always looking for ways to improve the simulation and add new features!