- Notifications
You must be signed in to change notification settings - Fork0
💵 Foreign exchange rates package for Go
License
NotificationsYou must be signed in to change notification settings
rettetdemdativ/dinero
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
dinero is aGo package for fetching exchange rates and converting between currencies. It aims to provide a simple interface and useshippasus' ExchangeRates anddecimal, which allows for higher precision when working with the values representing currency.
go get github.com/calmandniceperson/dinero
a:=Amount{Value:decimal.NewFromFloat(5.245),Currency:USD}// ora:=NewAmount(decimal.NewFromFloat(5.245),USD)res,_:=a.ConvertTo(EUR)// res contains the converted value as a decimal
a:=NewAmountFromFloat(5.232,EUR)
a:=NewAmountFromString("5423.65",JPY)
u:=USDa1:=u.Amount(decimal.NewFromFloat(25000))a2:=u.AmountFromFloat(7300.32)a3:=u.AmountFromString("200.09")
a:=Amount{decimal.NewFromFloat(450),JPY}println(a.String())