coinbase.go
func (c Client) GetExchangeRate(from string, to string) (float64, error) {
	exchanges, err := c.GetExchangeRates()
	if err != nil {
		return 0.0, err
	}
	key := from + "_to_" + to
	if exchanges[key] == "" {
		return 0.0, errors.New("The exchange rate does not exist for this currency pair")
	}
	exchangeFloat, err := strconv.ParseFloat(exchanges[key], 64)
	if err != nil {
		return 0.0, err
	}
	return exchangeFloat, nil
}
func (c Client) GetExchangeRate(from string, to string) (float64, error) {
	exchanges, err := c.GetExchangeRates()
	if err != nil {
		return 0.0, err
	}
	key := from + "_to_" + to
	if exchanges[key] == "" {
		return 0.0, errors.New("The exchange rate does not exist for this currency pair")
	}
	exchangeFloat, err := strconv.ParseFloat(exchanges[key], 64)
	if err != nil {
		return 0.0, err
	}
	return exchangeFloat, nil
}
func ( c Client ) GetExchangeRate ( from string , to string ) ( float64 , error ) { exchanges , err := c . GetExchangeRates ( ) if err != nil { return 0.0 , err } key := from + " " + to if exchanges [ key ] == " " { return 0.0 , errors . New ( " " ) } exchangeFloat , err := strconv . ParseFloat ( exchanges [ key ] , 64 ) if err != nil { return 0.0 , err } return exchangeFloat , nil }
// GetExchangeRate gets the exchange rate between two specified currencies
GetExchangeRate gets the exchange rate between two specified currencies