A library implemented in golang to convert money into other currencies
This package contains a simple library which converts a currency amount to another supported currency. The exchange rates used here are published by the official European Central Bank.
For improved performance the exchange rates are cached and refreshed every 2 hours.
import "github.com/gsingharoy/gomoney"
// generate a new money object
// Note: Check the section below for the supported currencies
m, err := gomoney.NewMoney(100, "USD")
// now convert the money to another currency
// convertedAmount will contain the conversion of 100 USD to CHF
convertedAmount, err := m.Convert("CHF")
The following currencies are supported :
EUR
: EuroUSD
: US dollarJPY
: Japanese yenBGN
: Bulgarian levCZK
: Czech korunaDKK
: Danish kroneGBP
: Pound sterlingHUF
: Hungarian forintPLN
: Polish zlotyRON
: Romanian leuSEK
: Swedish kronaCHF
: Swiss francNOK
: Norwegian kroneHRK
: Croatian kunaRUB
: Russian roubleTRY
: Turkish liraAUD
: Australian dollarBRL
: Brazilian realCAD
: Canadian dollarCNY
: Chinese yuan renminbiHKD
: Hong Kong dollarIDR
: Indonesian rupiahILS
: Israeli shekelINR
: Indian rupeeKRW
: South Korean wonMXN
: Mexican pesoMYR
: Malaysian ringgitNZD
: New Zealand dollarPHP
: Philippine pesoSGD
: Singapore dollarTHB
: Thai bahtZAR
: South African rand