A newer version of the Gradio SDK is available:
5.23.1
title: re-balancing-app-demo
emoji: 🦄
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.36.1
app_file: app.py
pinned: false
Portfolio Rebalancing Analysis
This project provides a tool for analyzing and rebalancing your investment portfolio. It calculates the current and target values of your portfolio and provides visualizations for better understanding.
Features
- Parses user input to get stock information and cash amount.
- Fetches current stock prices and exchange rates.
- Calculates the rebalanced portfolio based on the target weights.
- Provides visualizations including pie charts and bar charts to show the current and target portfolio distributions.
- Separates output into two sections: one for charts and one for text details.
Requirements
- Python 3.x
- Required Python packages:
gradio
logging
math
FinanceDataReader
requests
ssl
datetime
matplotlib
Installation
Clone the repository:
git clone https://github.com/yourusername/portfolio-rebalancing-analysis.git cd portfolio-rebalancing-analysis
Install the required packages:
pip install gradio logging math FinanceDataReader requests ssl datetime matplotlib
Usage
Run the application:
python your_script_name.py
Open the provided Gradio interface link in your browser.
Enter your portfolio data in the provided text box. The format should be:
<currency> <stock_code> <quantity> <target_weight>, ...
For example:
usd schd 545 8, usd qqq 22 2
Enter the additional cash amount you want to invest.
Adjust the cash ratio slider to set your desired cash ratio.
Click the submit button to see the analysis. The output will show visualizations (pie chart and bar chart) and text details of your portfolio rebalancing information.
Example
usd schd 545 8, usd qqq 22 2
Additional cash: 36974411
Cash ratio: 33%
The output will display the current and target portfolio distributions both in visual charts and detailed text information.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments
- FinanceDataReader for stock data.
- Gradio for the interactive web interface.
Contribution
Feel free to fork this repository and contribute by submitting a pull request. Any contributions, issues, and feature requests are welcome.
Contact
For any questions or feedback, please contact cryman38@daum.net.