Skip to content

Commit 3364be6

Browse files
committed
Fix string formattinh issue in Header
1 parent b1a9059 commit 3364be6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ui/layout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ def render_header(financial_data, financial_calculations):
5353
f"### {stock_info['symbol']} - {stock_info['longName']}", unsafe_allow_html=True
5454
)
5555
# Render price change
56-
current_price = stock_info["currentPrice"]
57-
previous_close_price = stock_info["previousClose"]
56+
current_price = float(stock_info["currentPrice"])
57+
previous_close_price = float(stock_info["previousClose"])
5858
currency_symbol = financial_calculations["currency_symbol"](stock_info["currency"])
59-
current_price_content = f"{currency_symbol}{current_price}"
59+
current_price_content = f"{currency_symbol}{current_price:.2f}"
6060
price_diff = financial_calculations["percentage_value_change"](
6161
current_price, previous_close_price
6262
)
63-
price_diff_content = f"({price_diff:.2}%)"
63+
price_diff_content = f"({price_diff:.2f}%)"
6464
price_change_content = (
6565
apply_text_color(price_diff_content, "red")
6666
if price_diff < 0

0 commit comments

Comments
 (0)