Practice trading strategies in a risk free environment.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
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.
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).
- Clone the repo
git clone https://github.com/ben-m-90/stock_sim.git
- Navigate your terminal to the local storage location created in Step 2.
- Install packages from requirements.txt
pip install -r requirements.txt
- Download and install an SQL server. PostgreSQL was used to develop this project so it is recommended.
- Rename the file 'sample.env' to '.env'
- 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"
- 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
- Navigate to localhost:8000 in your web browser.
- Create a new user account and log-in. E-mail verification will appear in the terminal the local server is running on.
- Configure user settings by clicking the profile icon at the top right of the home page and selecting 'Settings'.
- Create a new stock portfolio within user settings.
- Navigate to a stock page by going to url localhost:8000/stock_details/"TICKER"
- View information of the chosen stock and buy/sell the stock being viewed.
- 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).
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Project Link: https://github.com/ben-m-90/stock_sim