Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -163,9 +163,8 @@ def get_portfolio_rebalancing_info(portfolio, target_weights, krw_cash):
|
|
| 163 |
for adjustment in adjustments:
|
| 164 |
difference, current_value, target_value, current_value_pct, trade_quantity, stock_code, price, new_value, trade_value, old_quantity, new_quantity, target_weight_expr = adjustment # target_weight_expr 추가
|
| 165 |
new_value_pct = (new_value / total_value) * 100
|
| 166 |
-
formatted_trade_quantity = f"<span style='color: {'#57bb8a' if trade_quantity > 0 else '#cc0000'}'> {trade_quantity:+,} </span>" if trade_quantity != 0 else "0"
|
| 167 |
result_message += (
|
| 168 |
-
f"<li style='font-size: 1rem;'><strong>{stock_code.upper()}</strong> {current_value_pct:.0f}% <span style='background-color:
|
| 169 |
)
|
| 170 |
result_message += "</ol>"
|
| 171 |
|
|
@@ -174,9 +173,8 @@ def get_portfolio_rebalancing_info(portfolio, target_weights, krw_cash):
|
|
| 174 |
krw_target_value = total_value * krw_cash['target_weight']
|
| 175 |
krw_difference = krw_new_amount - krw_cash['amount']
|
| 176 |
krw_new_pct = (krw_new_amount / total_value) * 100
|
| 177 |
-
formatted_krw_difference = f"<span style='color: {'#57bb8a' if krw_difference > 0 else '#cc0000'}'> {krw_difference:+,} </span>" if krw_difference != 0 else "0"
|
| 178 |
result_message += (
|
| 179 |
-
f"<p style='font-size: 1rem;'><strong>💰
|
| 180 |
)
|
| 181 |
|
| 182 |
result_message += f"<p style='font-size: 1.5rem;'><strong>🦄 {total_value:,}</strong></p>"
|
|
|
|
| 163 |
for adjustment in adjustments:
|
| 164 |
difference, current_value, target_value, current_value_pct, trade_quantity, stock_code, price, new_value, trade_value, old_quantity, new_quantity, target_weight_expr = adjustment # target_weight_expr 추가
|
| 165 |
new_value_pct = (new_value / total_value) * 100
|
|
|
|
| 166 |
result_message += (
|
| 167 |
+
f"<li style='font-size: 1rem;'><strong>{stock_code.upper()}</strong> {current_value_pct:.0f}% <span style='background-color: yellow; color: blue;'>[ {target_weight_expr} ]</span> {target_value / total_value * 100:.0f}% <span style='background-color: #ddf5fd'; color: black;'>{trade_quantity:+,}</span></li>" # target_weight_expr로 변경
|
| 168 |
)
|
| 169 |
result_message += "</ol>"
|
| 170 |
|
|
|
|
| 173 |
krw_target_value = total_value * krw_cash['target_weight']
|
| 174 |
krw_difference = krw_new_amount - krw_cash['amount']
|
| 175 |
krw_new_pct = (krw_new_amount / total_value) * 100
|
|
|
|
| 176 |
result_message += (
|
| 177 |
+
f"<p style='font-size: 1rem;'><strong>💰 CASH</strong> {krw_cash['amount'] / total_value * 100:.0f}% <span style='background-color: yellow; color: blue;'>[ {krw_cash['target_weight'] * 100:.0f}% ]</span> <span style='background-color: #ddf5fd'; color: black;>{krw_difference:+,}</span></p>"
|
| 178 |
)
|
| 179 |
|
| 180 |
result_message += f"<p style='font-size: 1.5rem;'><strong>🦄 {total_value:,}</strong></p>"
|