cryman38's picture
Upload README.md
ce05d5d verified
|
raw
history blame
2.7 kB
---
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
1. Clone the repository:
```bash
git clone https://github.com/yourusername/portfolio-rebalancing-analysis.git
cd portfolio-rebalancing-analysis
```
2. Install the required packages:
```bash
pip install gradio logging math FinanceDataReader requests ssl datetime matplotlib
```
## Usage
1. Run the application:
```bash
python your_script_name.py
```
2. Open the provided Gradio interface link in your browser.
3. 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
```
4. Enter the additional cash amount you want to invest.
5. Adjust the cash ratio slider to set your desired cash ratio.
6. 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](LICENSE) file for details.
## Acknowledgments
- [FinanceDataReader](https://github.com/FinanceDataReader/FinanceDataReader) for stock data.
- [Gradio](https://gradio.app/) 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 [[email protected]](mailto:[email protected]).