func NewCurrencyPairFromString(currency string) CurrencyPair {
	delimiters := []string{"_", "-"}
	var delimiter string
	for _, x := range delimiters {
		if strings.Contains(currency, x) {
			delimiter = x
			return NewCurrencyPairDelimiter(currency, delimiter)
		}
	}
	return NewCurrencyPair(currency[0:3], currency[3:])
}
NewCurrencyPairFromString converts currency string into a new CurrencyPair
with or without delimeter
package pair
import (
	"strings"
)
type CurrencyItem string
func (c CurrencyItem) Lower() CurrencyItem {
	return CurrencyItem(strings.ToLower(string(c)))
}
func (c CurrencyItem) Upper() CurrencyItem {
	return CurrencyItem(strings.ToUpper(string(c)))
}
func (c CurrencyItem) String() string {
	return string(c)
}
type CurrencyPair struct {
	Delimiter      string       `json:"delimiter"`
	FirstCurrency  CurrencyItem `json:"first_currency"`
	SecondCurrency CurrencyItem `json:"second_currency"`
}
func (c CurrencyPair) GetFirstCurrency() CurrencyItem {
	return c.FirstCurrency
}
func (c CurrencyPair) GetSecondCurrency() CurrencyItem {
	return c.SecondCurrency
}
func (c CurrencyPair) Pair() CurrencyItem {
	return c.FirstCurrency + CurrencyItem(c.Delimiter) + c.SecondCurrency
}
func (c CurrencyPair) Display(delimiter string, uppercase bool) CurrencyItem {
	var pair CurrencyItem
	if delimiter != "" {
		pair = c.FirstCurrency + CurrencyItem(delimiter) + c.SecondCurrency
	} else {
		pair = c.FirstCurrency + c.SecondCurrency
	}
	if uppercase {
		return pair.Upper()
	}
	return pair.Lower()
}
func (c CurrencyPair) FormatPair(delimiter string, uppercase bool) CurrencyPair {
	if uppercase {
		return CurrencyPair{
			Delimiter:      delimiter,
			FirstCurrency:  c.FirstCurrency.Upper(),
			SecondCurrency: c.SecondCurrency.Upper(),
		}
	}
	return CurrencyPair{
		Delimiter:      delimiter,
		FirstCurrency:  c.FirstCurrency.Lower(),
		SecondCurrency: c.SecondCurrency.Lower(),
	}
}
func (c CurrencyPair) Equal(p CurrencyPair) bool {
	if c.FirstCurrency.Upper() == p.FirstCurrency.Upper() &&
		c.SecondCurrency.Upper() == p.SecondCurrency.Upper() {
		return true
	}
	return false
}
func (c CurrencyPair) Invert() CurrencyPair {
	ret := c
	ret.FirstCurrency, ret.SecondCurrency = c.SecondCurrency, c.FirstCurrency
	return ret
}
func NewCurrencyPairDelimiter(currency, delimiter string) CurrencyPair {
	result := strings.Split(currency, delimiter)
	return CurrencyPair{
		Delimiter:      delimiter,
		FirstCurrency:  CurrencyItem(result[0]),
		SecondCurrency: CurrencyItem(result[1]),
	}
}
func NewCurrencyPair(firstCurrency, secondCurrency string) CurrencyPair {
	return CurrencyPair{
		FirstCurrency:  CurrencyItem(firstCurrency),
		SecondCurrency: CurrencyItem(secondCurrency),
	}
}
func NewCurrencyPairFromIndex(currency, index string) CurrencyPair {
	i := strings.Index(currency, index)
	if i == 0 {
		return NewCurrencyPair(currency[0:len(index)], currency[len(index):])
	}
	return NewCurrencyPair(currency[0:i], currency[i:])
}