pieterclaerhout / go-finance

Finance related Go functions (e.g. exchange rates, VAT number checking, …)

Home Page:https://www.yellowduck.be

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-finance

Go Report Card Documentation license GitHub version GitHub issues

This is a Golang library which contains finance related functions.

Exchange Rates

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)
	}

}

Checking VAT Numbers

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)

}

IBAN & BIC

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)

}

About

Finance related Go functions (e.g. exchange rates, VAT number checking, …)

https://www.yellowduck.be

License:Apache License 2.0


Languages

Language:Go 98.5%Language:Makefile 1.5%