Skip to content

Commit 2f23a67

Browse files
committed
Fix issue on price changes
1 parent 39adfe4 commit 2f23a67

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/core/financial_formulas.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
def calculate_price_changes(current_price, previous_close_price, decimal_point=2):
2-
return (
3-
round(
4-
(current_price - previous_close_price) / previous_close_price, decimal_point
5-
)
6-
* 100
7-
)
2+
return ((current_price - previous_close_price) / previous_close_price) * 100

src/ui/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def render_header(financial_data, financial_calculations):
6060
price_diff = financial_calculations["price_changes"](
6161
current_price, previous_close_price
6262
)
63-
price_diff_content = f"({price_diff}%)"
63+
price_diff_content = f"({price_diff:.2}%)"
6464
price_change_content = (
6565
apply_text_color(price_diff_content, "red")
6666
if price_diff < 0

0 commit comments

Comments
 (0)