Trade Simulator

[Click here to try.]

Introduction

The Trade Simulator allows for risk free practice in trading stocks. It uses data that is updated daily after the market closes to reflect current prices. Users can create an account, deposit pretend money, buy or sell stocks at the current market price, view transaction history, and analyze the data on a graph with the provided polynomial regression and linear regression lines.

Analysis

API

I created the Trade Simulator to practice my trading skills in a risk free environment. I began creating this by doing research on financial APIs and which ones had the best free tier. I originally used Alpha Vantage API but ran into some issues so I decided to go with the polygon.io API. This did include some limitations such as a max data history of 2 years as well as 5 API pulls per minute. One of the main problems I faced was that when a user interacted with the page, the data would be pulled from the API multiple times within one minute. This caused the page to crash, so I decided to cache the stock data and retrieve it from the cache when the page updated.

Software Decisions

Following the steps of other stock trading platforms such as Robinhood, I decided to use python for writing the backend code. This allowed for an easier creation of data structures and coding in general than what would have been my second choice, C++. To get my python code onto a website I decided to once again follow the steps of Robinhood and use Django. After learning the basics of Django, the transfer of the python code onto a website was a simple transition.

Libraries

Libraries that I used for the project included Pickle for storing username and password information, NumPy for storing data and regression calculations, and Plotly and matplotlib for graphing.

Sources

Navigation Bar: https://www.w3schools.com/howto/howto_js_topnav.asp

Drop Down Menu: https://www.w3schools.com/howto/howto_css_dropdown.asp

Numpy: https://numpy.org/

Plotly: https://plotly.com/