Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

feat: add Chinese yuan (CNY) currency support (#940)

Shayn Hornike438029193e6
diff --git a/backend/app/core/config.py b/backend/app/core/config.py
index 4dc6fadf..4889400d 100644
--- a/backend/app/core/config.py
+++ b/backend/app/core/config.py
@@ -66,7 +66,7 @@ class Settings(BaseSettings):
# FX Rates
openexchangerates_app_id: str = ""
- supported_currencies: str = "USD,EUR,GBP,BRL,CAD,AUD,CHF,ARS,JPY,MXN,INR,SEK,DKK,NOK,PLN,CZK,HUF,RON,CRC,IDR,COP,CLP,DOP,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN,TRY,PKR,MDL,AED,THB,EGP,MYR" # comma-separated list
+ supported_currencies: str = "USD,EUR,GBP,BRL,CAD,AUD,CHF,ARS,JPY,MXN,INR,SEK,DKK,NOK,PLN,CZK,HUF,RON,CRC,IDR,COP,CLP,DOP,RUB,GTQ,PHP,UAH,NZD,VND,SGD,AZN,TRY,PKR,MDL,AED,THB,EGP,MYR,CNY" # comma-separated list
fx_sync_mode: str = "on_demand" # "on_demand" or "scheduled"
# Storage
diff --git a/backend/tests/test_currencies_api.py b/backend/tests/test_currencies_api.py
index da43a9c7..7ed2e868 100644
--- a/backend/tests/test_currencies_api.py
+++ b/backend/tests/test_currencies_api.py
@@ -182,3 +182,15 @@ async def test_currencies_include_myr_with_metadata(client: AsyncClient):
assert myr["symbol"] == "RM"
assert myr["name"] == "Malaysian Ringgit"
assert myr["flag"] == "🇲🇾"
+
+
+async def test_currencies_include_cny_with_metadata(client: AsyncClient):
+ response = await client.get("/api/currencies")
+ data = response.json()
+ cny = next((currency for currency in data if currency["code"] == "CNY"), None)
+
+ assert cny is not None
+ assert cny["symbol"] == "¥"
+ assert cny["name"] == "Chinese Yuan"
+ assert cny["flag"] == "🇨🇳"
diff --git a/frontend/src/components/currency-select.tsx b/frontend/src/components/currency-select.tsx
index 8af09e54..1e8cc5e2 100644
--- a/frontend/src/components/currency-select.tsx
+++ b/frontend/src/components/currency-select.tsx
@@ -48,6 +48,7 @@ export const CURRENCIES = [
{ code: 'THB', flag: '\u{1F1F9}\u{1F1ED}', symbol: '฿' },
{ code: 'EGP', flag: '\u{1F1EA}\u{1F1EC}', symbol: 'E£' },
{ code: 'MYR', flag: '\u{1F1F2}\u{1F1FE}', symbol: 'RM' },
+ { code: 'CNY', flag: '\u{1F1E8}\u{1F1F3}', symbol: '¥' },
] as const
interface CurrencySelectProps {