trapatsas / super-simple-stock-market

Super Simple Stock Market is a lightweight, easy-to-use simulation platform designed to provide a basic understanding of stock market mechanics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Super Simple Stock Market

The "Super Simple Stock Market" is a Python-based simulation designed to illustrate the basic principles of a stock market system. This project facilitates the simulation of trading activities, calculation of dividend yields, and tracking of stock price changes in a simplified environment.

Running the project using Dev Containers

This project supports development in a containerized environment using Docker and Visual Studio Code DevContainers. This ensures that you have a consistent, isolated, and reproducible environment.

Prerequisites

  • Install Docker
  • Install Visual Studio Code
  • Install the Dev Containers extension for Visual Studio Code

Steps to Open and Run the Project

  1. Open Visual Studio Code and clone the repository within VS Code or open the project folder if already cloned.
  2. Press F1 to open the command palette and type Dev Containers: Open Folder in Container.... Select the project folder and it will start building the container.
  3. Wait for the container to build. This may take a few minutes the first time as it downloads the necessary Docker image and sets up the environment.
  4. Once the build is complete, VS Code will automatically connect to the container. You can now run scripts and use the terminal inside Visual Studio Code to execute any project-related commands in a Docker environment.
  5. Run the project or tests by using the integrated terminal in VS Code.

Running the project without Dev Containers

If you prefer not to use Docker and Visual Studio Code Dev Containers, you can run the project directly on your local machine. Follow these steps to set up and run the project locally:

Upgrade pip and install required packages

echo "Upgrading pip and installing required packages..."
pip install --upgrade pip
pip install -r requirements.txt

Run the unit tests

echo "Running unit tests..."
python -m unittest discover -s tests -v

Run coverage analysis

echo "Analyzing code coverage..."
coverage run -m unittest discover -s tests -v
coverage html

This should produce the following report: Test Coverage Report

Run the simulation example

echo "Running the stock market simulation..."
python3 -m examples.simulation

Code Pointers to Requirements Implementation

This section provides direct links to the specific code implementations of major functionalities and requirements outlined in the project requirements file. Each link points to the relevant file and line in this GitHub repository where you can see how each feature is coded.

  1. Functions to return the Dividend Yield for any given stock

  2. Function to update multiple stock prices at once: app/market.py

  3. Function to to record a trade: app/market.py

  4. Function to return the Volume Weighted Stock Price on the trades in the past 15 minutes, for a given stock: app/market.py

  5. Function to compute the Geometric Mean of prices for all stocks: app/market.py

About

Super Simple Stock Market is a lightweight, easy-to-use simulation platform designed to provide a basic understanding of stock market mechanics.

License:MIT License


Languages

Language:Python 96.2%Language:Shell 3.8%