This project provides a portfolio optimization solution through a Telegram bot interface, focusing on investment decisions with stochastic factors, constraints, and dependencies between projects. Users can interact with the bot to upload data, define parameters, and receive an optimization report.
For creation of this README.MD file cudos to ChatGPT-4o
You can find project demo here: https://youtu.be/6G5rUYQPuCg
- Optimization: Maximize portfolio revenue within a budget, considering each project's cost, benefit, and risk of failure.
- Stochastic Modeling: Account for scenarios of project success/failure, modeling uncertainty in outcomes.
- Dependency Constraints: Ensures that projects with dependencies are selected accordingly.
- Analysis: Provides insight into revenue distributions, expected value of perfect information, and price of stochastic solutions.
- User-Friendly Bot Interface: Telegram bot assists users in submitting project data and retrieving a detailed report.
- Python 3.x
- Required packages listed in
requirements.txt - Telegram account and API credentials
-
Clone this repository:
git clone https://github.com/yourusername/Portfolio_Optimization.git
-
Install dependencies:
pip install -r requirements.txt
-
Set up your Telegram bot credentials by creating a
.envfile or by updatingconfig.py.
-
Prepare Input Data: Ensure that your input file (
.xlsxor.csv) contains the columns:project,benefit,cost,risk,dependence. Refer to the example format inexample_files/sample.xlsx. -
Run the Bot: Execute the bot with:
python bot.py
-
Interact via Telegram:
- Upload your input file to the bot.
- Set the required optimization parameters.
- Receive the generated report.
The bot generates an automatically formatted report (example_files/sample_report.pdf for reference) that includes:
- Project selection based on optimization
- Expected revenue analysis for each scenario
- Graphical distribution of revenue for training and test sets
- Calculations of stochastic solution metrics
- bot.py: The main bot script to handle Telegram interactions.
- config.py: Configuration file for API credentials and settings.
- keyboards.py: Defines custom keyboards for the Telegram bot interface.
- utils.py: Helper functions for data processing.
- script.jl: Julia script for computationally intensive tasks.
- Manifest.toml: Configuration file for the Julia environment.
- Project.toml: Defines dependencies and project setup for the Julia script.
- example_files/: Contains example input files demonstrating the required format.
- requirements.txt: Lists Python dependencies needed for the project.
- instructions.pdf: Detailed explanation of the model, constraints, and usage instructions.
/example_files: Folder containing example input files for testing.bot.py: Main bot script to handle Telegram interactions.config.py: Configuration settings for bot credentials and parameters.keyboards.py: Defines custom keyboards for user interaction in the Telegram bot.utils.py: Contains utility functions to support data processing.script.jl: A Julia script for handling optimization calculations.Manifest.tomlandProject.toml: Define the Julia environment and dependencies.requirements.txt: Specifies Python dependencies.README.md: Documentation file (this file) for project overview and usage instructions.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/YourFeature). - Commit your changes (
git commit -m 'Add your feature'). - Push to the branch (
git push origin feature/YourFeature). - Open a pull request.