The Optimal Portfolio Allocation application is a dynamic web-based platform designed to assist users in crafting optimized investment portfolios tailored to their risk tolerance and financial goals.
The Optimal Portfolio Allocation application is conceived at the intersection of economics, mathematics, and computing, drawing inspiration from academic coursework in Econ 337, portfolio management exercises, and professional shadowing experiences. This project aims to demystify the complexities of portfolio allocation and asset pricing for those new to the financial industry, fostering a deeper understanding and confidence in investment strategies.
In a landscape where financial tools and literacy remain largely accessible to a privileged few, the widening wealth gap underscores the urgent need for inclusive financial education. The Optimal Portfolio Allocation application seeks to bridge this divide, offering a user-friendly interface that empowers users to make informed investment decisions, regardless of their financial background.
The Optimal Portfolio Allocation application is a dynamic web-based platform designed to assist users in crafting optimized investment portfolios tailored to their risk tolerance and financial goals. Utilizing a sophisticated mathematical framework, the application guides users through the process of allocating their wealth across various asset classes, balancing risk and return to achieve optimal portfolio performance.
Follow these steps to prepare and run the backend API:
Create and Activate a New Environment
First, create a new virtual environment and activate it. This ensures that the dependencies for the project do not interfere with your global Python setup.
For Unix/macOS:
python -m venv env && source env/bin/activate
For Windows:
python -m venv env && .\env\Scripts\activate
Install the Requirements
To ensure that all necessary Python packages are installed for the project to run properly, you will need to install the dependencies listed in the requirements.txt
file. After setting up your Python environment, you can install these dependencies using pip
, Python's package installer.
pip install -r requirements.txt
This command will automatically read the requirements.txt
file and install all the listed packages along with their specified versions. Make sure you are in the project's root directory where requirements.txt
is located when you run this command.
Run the Server
Start the backend server by running:
python api/main.py
This command starts the backend server, which the frontend will communicate with.
To set up the frontend for the Optimal Portfolio Allocation application, follow these steps:
Navigate to the Frontend Directory
Change to the frontend
directory where the frontend code resides:
cd ./frontend/
Install the Packages
Install the necessary npm packages required for the frontend:
npm install
Run the Frontend
From inside the frontend
folder, start the frontend development server:
npm run dev
This will serve the frontend application, which can be accessed through a web browser.
We welcome contributions from the community! If you'd like to contribute to the Optimal Portfolio Allocation application, please follow these steps:
To initiate a connection to your virtual machine, use the following SSH command:
ssh -i ~/.ssh/id_rsa.pem asmodk@172.172.155.79
Make sure to replace ~/.ssh/id_rsa.pem with the actual path to your private key and 172.172.155.79 with the IP address of your VM.
Exploring the Project Directory After logging into the VM, you can navigate through the project's structure:
ls # Lists the contents of the home directory, look for 'stock-evaluator'
cd stock-evaluator/ # Changes the directory to 'stock-evaluator'
ls # Lists the project files including 'LICENSE', 'README.md', etc.
Running the Application with Podman-Compose Use podman-compose to start the application's services:
podman-compose up -d # Starts services in detached mode
podman ps # Shows running containers to verify they started correctly
If you have made changes to the compose.yaml or need to restart the services, run:
podman-compose up -d # This command can be repeated as needed
This guide outlines the steps for deploying the Stock-Evaluator project using Podman, a daemonless container engine, and Podman Compose as an alternative to Docker.
Containerize the Application using Podman and Podman Compose
Provision a Virtual Machine (VM)
Set up Nginx on the VM
Build the Image from the Container Registry
Set up Podman environment in the VM
Compile the Frontend into Static Files
Run the Podman Compose Configuration
podman-compose
to deploy the services as defined in your configuration files.Note: In this setup, Podman is used in place of Docker, providing a similar functionality with the added benefit of not requiring a daemon to run.
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
If you have any questions or need assistance, please feel free to reach out at khakurel1@kenyon.edu.