Skip to content

Stock simulator to simulate buying and selling of stocks using real stock data with virtual funds.

License

Notifications You must be signed in to change notification settings

Ben-M-90/stock_sim

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Practice trading strategies in a risk free environment.
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

Django web app which scrapes live stock market data and allows users to buy & sell stocks to test their trading strategies in a risk-free environment. Data is stored to SQL database with updates made just in time when user views page requiring data and only if data hasn’t been updated recently to reduce database demand.

  • User account system. Users can create stock portfolios with whatever initial balance they want. Test how you would do with $1,000,000 or challenge yourself with $50.
  • Data is scraped from Yahoo Finance. Prices are updated on demand (only when a user is viewing an element that requires displaying the price) and other data is updated on demand every hour.

(back to top)

Built With

  • Django
  • Bootstrap
  • JQuery
  • PostgreSQL

(back to top)

Getting Started

Prerequisites

Before beginning setup, it is recommended to [https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments](create and activate a Python virtual environment).

Installation

  1. Clone the repo
    git clone https://github.com/ben-m-90/stock_sim.git
  2. Navigate your terminal to the local storage location created in Step 2.
  3. Install packages from requirements.txt
    pip install -r requirements.txt
  4. Download and install an SQL server. PostgreSQL was used to develop this project so it is recommended.
  5. Rename the file 'sample.env' to '.env'
  6. Edit '.env' using a text editor.
  • ENGINE_DB_PATH, DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, and DB_PORT are values set during SQL database creation.
  • See [https://docs.djangoproject.com/en/4.1/ref/databases/](Django database documentation) for more information.
  • A Django Secret Key can be generated online. Simply copy and paste for DJANGO_SECRET_KEY.
    # .env
    
    ENGINE_DB_PATH = "postgresql+psycopg2://postgres:PASSWORD@localhost:5432/DATABASE_NAME"
    DJANGO_SECRET_KEY = 
    
    DB_ENGINE = "django.db.backends.postgresql_psycopg2"
    DB_NAME = ""
    DB_USER = ""
    DB_PASSWORD = ""
    DB_HOST = "127.0.0.1"
    DB_PORT = "5432"
    
  1. Run the Django localserver in your terminal. Note that the shortcut py may not work on all systems and is dependent on how your local Python installation is configured.
    py manage.py runserver
  2. Navigate to localhost:8000 in your web browser.

(back to top)

Usage

  1. Create a new user account and log-in. E-mail verification will appear in the terminal the local server is running on.
  2. Configure user settings by clicking the profile icon at the top right of the home page and selecting 'Settings'.
  3. Create a new stock portfolio within user settings.
  4. Navigate to a stock page by going to url localhost:8000/stock_details/"TICKER"
  5. View information of the chosen stock and buy/sell the stock being viewed.

(back to top)

Roadmap

  • Implement initialization function to create Stock objects enmasse on startup.
  • Implement database bulk update functionality to update all stocks on a schedule rather solely on-demand.
  • Add feature to make call type trades (buy/sell at specific price)
  • Add feature(s) for highlighting trending stocks

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/ben-m-90/stock_sim

(back to top)

Acknowledgments

(back to top)

About

Stock simulator to simulate buying and selling of stocks using real stock data with virtual funds.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published