This is a Golang library which contains finance related functions.
The following example explains how to use this package to retrieve the exchange rates from ECB:
package main
import (
"fmt"
"os"
"github.com/pieterclaerhout/go-finance"
)
func main() {
rates, err := finance.ExchangeRates()
if err != nil {
fmt.Println("ERROR:", err.Error())
os.Exit(1)
}
for currency, rate := range rates {
fmt.Println(currency, "-> €1 =", rate)
}
}
You can also VAT numbers via the VIES service. The following sample code shows how to do this:
package main
import (
"fmt"
"os"
"github.com/pieterclaerhout/go-finance"
)
func main() {
info, err := finance.CheckVAT("BE0836157420")
if err != nil {
fmt.Println("ERROR:", err.Error())
os.Exit(1)
}
fmt.Println(info)
}
There is also a function which converts a regular Belgian Bank Account Number to it's IBAN / BIC equivalent:
package main
import (
"fmt"
"os"
"github.com/pieterclaerhout/go-finance"
)
func main() {
info, err := finance.CheckIBAN("738120256174")
if err != nil {
fmt.Println("ERROR:", err.Error())
os.Exit(1)
}
fmt.Println(info)
}