Giter VIP home page Giter VIP logo

trading_game's Introduction

C++ Stock Trading Game

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.

Features

  • 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, sellg, check, next, and profile to interact with the game.

Skills Demonstrated

  • 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.

How to Run

  1. Clone this repository to your local machine.

  2. Make sure you have a C++ compiler installed (e.g., g++, clang).

  3. Compile the code. For example, using g++:

    g++ -o tradingGame test.cpp
  4. Run the executable:

    ./tradingGame
  5. Follow the on-screen prompts to interact with the game.

Game Instructions

  • 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.

Contributions

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!

trading_game's People

Contributors

sad-sys avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.