This day trading simulator uses a Neural Hierarchical Interpolation for Time Series (NHITS) model to simulate high-ish frequency day trading.
- It uses yfinance to poll stock data every 3 seconds.
- It stores that data in a PostgreSQL database.
- Before the market opens each day, it pulls the data and trains a new NHITS model.
- In addition to polling the stock data every 3 seconds and writing to the database, it uses the model to predict the stock price 3 seconds later.
- Based on the predicted price, it simulates a buy or sell and tracks a simulated account balance and stock holdings.
- At the end of the day, it record the account's value and trades executed throughout the day.
- Setup a PostgreSQL database with the quote_data and account_data table columns set as the same in config.py.
- Provide valid database connection parameters in db.py.
- Build a docker image with the provided dockerfile and run as a container OR use notebook.ipynb to run the code manually.
- Setup a cronjob to run the container before each weekday.
- Yahoo Finance often rate limits quote info pulls. This is the main blocker for this script and often results in lack of data.