This is the repository of Team 5 for the HKUST course TEMG4952A "Special Project: Financial Investment Prototyping for UBS Zurich" in 2020-21 Winter Semester. For the final front-end results, see the instructions below. For the back-end models, see ..\data_and_model\stable_prediction\Models_training.ipynb
.
Note: this project's raw data are the CSV files from bulk_export
folder from Crunchbase at the end of Dec 2020.
- Initial Set-up
- Start Development Server
- View Jupyter Notebooks
- Dependencies
- Project Methodology
- Weekly Progress
We assume that Python 3 and Jupyter Notebook is already installed in your system.
This project's GUI uses Mapbox's APIs to render a world map in data visualization. Mapbox's APIs require an access token that is obtainable after registering for an account in this page. After registering for an account, head to your Mapbox account page and copy your default public token.
- Create a file called
.env
in the root of thefrontend/
folder - Copy the content in
frontend/.env.example
and paste it into the.env
file you just created. Your.env
file should look like:REACT_APP_MAPBOX_API_KEY=
- At the end of the line, paste in the Mapbox default public token you previously copied from Mapbox's account page. After that, it should look something like:
REACT_APP_MAPBOX_API_KEY=pk.XXXXXXXX
- For Windows users, follow the remaining steps in section 1.2. For Mac users, follow the remaining steps in section 1.3.
-
Open Powershell and change directory to this repository's root (
cd path\to\root\here
) -
Run the following commands:
py -m venv venv .\venv\Scripts\activate pip install -r requirements.txt cd backend\ flask run
If you encountered the following error when running
.\venv\Scripts\activate
, read item 1.4.1 in the Troubleshooting section. -
Keep this Powershell window running in background. At the same time, open another Powershell window and change directory to this repository's root
-
Run the following commands:
cd .\frontend\ npm install npm start
-
Open Terminal and change directory to this repository's root (
cd path/to/root/here
) -
Run the following commands:
python3 -m venv venv . venv/bin/activate pip install -r requirements.txt cd backend && flask run
-
Keep this Terminal window running in background. At the same time, open another Terminal window and change directory to this repository's root
-
Run the following commands:
cd frontend/ npm install npm start
For Windows users, if you encounter the following error while running .\venv\Scripts\activate
:
.\venv\Scripts\activate : File path\to\repo\root\backend\venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system.
-
Open "Start" menu by pressing the Window key on the keyboard
-
Search for "Windows Powershell"
-
Run Powershell as Administrator
-
Run the following command:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
-
Type
Y
(Yes) when it asks whether you want to change the execution policy -
Retry the commands in section 1.2 item 6
If you failed to run npm start
after running npm install
at the frontend/
directory, try re-installation all the npm packages:
- Delete
frontend/package-lock.json
- Delete
frontend/node_modules
folder - Run
npm cache clear --force
at thefrontend
directory - Re-run
npm install
The following steps are used to start up the React and Flask server in order to view the GUI. Before running these steps, make sure that you have already finished the initial set-up guide in Step 1.
-
cd frontend/
-
Windows users:
npm run flask-run-win
; Mac users:npm run flask-run-mac
-
Keep this terminal running in background and open another terminal window. Change directory to this repository's root
-
Run the following commands:
cd frontend/ npm start
-
If you have VS Code installed, open this repository's root folder in VS Code.
-
Open the "Explorer" tab at the sidebar with the shortcut of "Ctrl + Shift + E"
-
Expand the "NPM SCRIPTS" tab at the bottom of the Explorer sidebar window
-
For Windows users, hover over
flask-run-win - frontend
and press the right button to run the script
If you are a Mac user, hover over
flask-run-mac - frontend
and press the right button -
Hover over
start - frontend
and press the right button to run the script
- Open Terminal and change directory to the root folder of this repository (
cd path/to/root/
) - For Windows users, run
.\venv\Scripts\activate
. For Mac users, run. venv/bin/activate
- Run
jupyter notebook
- A new browser window will pop up. Click on the
data_and_model
folder on the browser screen and you can click on different notebooks to view them
Prerequisite: Make sure that Python extension is installed in your VS Code.
- Open Explorer in the sidebar, expand the
data_and_model
folder and double click on a Jupyter notebook you wish to view - On the upper right corner, click the "Python 3: Idle" button
- In the new window, choose the Python interpreter where the path looks something like
path\to\root\venv\Scripts\python.exe
(Windows) orpath/to/root/venv/bin/python
(Mac)
- Your Jupyter notebook now runs in the virtual environment that we've set up earlier in Step 1. You can now run the cells in the notebook
Click here to see the libraries and frameworks used in this project.
Click here to see the methodology used in the project, e.g. code structure.
Click here to see the work progress for each week.