This project is a web-app built with React, Python, and MySQL. It allows users to backtest trading strategies and visualize stock data in a very simple fashion.
Before you begin, ensure you have the following installed on your machine:
- Node.js (v14 or higher)
- npm (v6 or higher)
- Python (v3.8 or higher)
- pip (v20 or higher)
- MySQL
Follow these steps to set up and run the application from scratch.
-
Clone the repository:
git clone https://github.com/little-dao/quantify.git cd quantify -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install required libraries:
pip install flask flask-cors pymysql json backtesting strategy sqlalchemy pandas http tqdm dataclasses typing enum numpy ehset
-
Set up MySQL database:
- Start your MySQL server.
- Create a database named
hack_canada. - Update the
db_configdictionary and the credentials in theget_db_connection()function in app.py with your MySQL credentials. - Run
python data/data.pyto fetch stock data of some of the most popular stocks.
-
Run the backend server:
python app.py
-
Navigate to the
clientdirectory:cd finance-dashboard -
Install required npm packages:
npm install
-
Start the React development server:
npm start
- Ensure both the backend and frontend servers are running.
- Open your web browser and navigate to
http://localhost:3000.
You should now be able to use the Quantify web-app to backtest trading strategies and visualize stock data.
If you encounter dependency resolution errors, such as:
npm ERR! ERESOLVE unable to resolve dependency tree
try the following solutions:
If npm install fails due to peer dependency conflicts, run:
npm install --legacy-peer-depsThis allows dependencies to install even if there are mismatched peer versions.
If --legacy-peer-deps does not work, try:
npm install --forceSome packages, like react-table@7.8.0, do not support React 19. If you face issues, downgrade React to version 18:
npm uninstall react react-dom
npm install react@18 react-dom@18If you see an error like:
Module not found: Error: Can't resolve '@fortawesome/fontawesome-svg-core'Manually install missing dependencies:
npm install @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesomeIf dependency conflicts persist, reset your environment:
rm -rf node_modules package-lock.json
npm cache clean --force
npm installAfter reinstalling, restart your development server:
npm run devor
npm startDue to time constraints, our current login system does not support user registration and authentication. Instead, we provide a default login for all users:
Login Credentials:
- Username:
user - Password:
password
Simply enter these credentials on the login screen to access the system.