formatting
Helpers for formatting values displayed in the Streamlit interface.
format_currency(value)
Format a numeric value as whole-dollar currency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
Numeric value to format. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Dollar-formatted string without decimal cents. |
Source code in src/refi_calculator/web/formatting.py
10 11 12 13 14 15 16 17 18 19 | |
format_months(value)
Describe a month count alongside its equivalent in years.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | int | None
|
Number of months to convert. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Human-friendly string or "N/A" when value is missing. |
Source code in src/refi_calculator/web/formatting.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
format_optional_currency(value)
Format an optional numeric value as currency, falling back to N/A.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | None
|
Optional numeric value. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Formatted currency or "N/A" when no value is present. |
Source code in src/refi_calculator/web/formatting.py
22 23 24 25 26 27 28 29 30 31 32 33 | |
format_savings_delta(value)
Invert savings sign to match user-facing storytelling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
Value representing savings. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Signed string reflecting the UX messaging used in the GUI. |
Source code in src/refi_calculator/web/formatting.py
65 66 67 68 69 70 71 72 73 74 75 | |
format_signed_currency(value)
Format a signed value with explicit plus/minus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
Value to format with sign. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Signed currency string to highlight deltas. |
Source code in src/refi_calculator/web/formatting.py
52 53 54 55 56 57 58 59 60 61 62 | |