Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
feat: add currencies XAG and XAU (#535)
Browse files Browse the repository at this point in the history
* Added currencies XAG and XAU to currency.ts

I added XAG and XAU for myself and others who prefer to measure value with something of substance.

Review the ISO 4217 standard to view a full list of official currency codes including the ones I have added.

https://www.iso.org/iso-4217-currency-codes.html
https://en.wikipedia.org/wiki/ISO_4217

Example:
https://www.xe.com/currencyconverter/convert/?Amount=100&From=XAG&To=USD

API for exchange rates:
https://openexchangerates.org/

* Added field values xag and xau to group.go

* Update group.go
  • Loading branch information
tctlrd authored Aug 23, 2023
1 parent 9fa17be commit 5438898
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/internal/data/ent/group/group.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions backend/internal/data/ent/schema/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func (Group) Fields() []ent.Field {
"thb",
"try",
"usd",
"xag",
"xau",
"zar",
),
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/lib/data/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export type Codes =
| "THB"
| "TRY"
| "USD"
| "XAG"
| "XAU"
| "ZAR";

export type Currency = {
Expand Down Expand Up @@ -65,5 +67,7 @@ export const currencies: Currency[] = [
{ code: "THB", local: "Thailand", symbol: "฿", name: "Thai Baht" },
{ code: "TRY", local: "Turkey", symbol: "₺", name: "Turkish Lira" },
{ code: "USD", local: "United States", symbol: "$", name: "United States Dollar" },
{ code: "XAG", local: "Global", symbol: "XAG", name: "Silver Troy Ounce" },
{ code: "XAU", local: "Global", symbol: "XAU", name: "Gold Troy Ounce" },
{ code: "ZAR", local: "South Africa", symbol: "R", name: "South African Rand" },
];

1 comment on commit 5438898

@adotsch
Copy link

@adotsch adotsch commented on 5438898 Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of duplicates and this is all data. Should be a config file for both the backend and the frontend.
Even better would be to let the user define this on the UI. We shouldn't wait for the next release for the ccy we want to use.

Please sign in to comment.