// ExchangeRate is an overrider of remoter's ExchangeRate.
331591
func (w *WalletState) ExchangeRate(ctx context.Context, currency string) (stellar1.OutsideExchangeRate, error) {
	w.Lock()
	existing, ok := w.rates[currency]
	w.Unlock()
	age := time.Since(existing.ctime)
	if ok && age < 1*time.Minute {
		w.G().Log.CDebugf(ctx, "using cached value for ExchangeRate(%s) => %+v (%s old)", currency, existing.rate, age)
		return existing.rate, nil
	}
	if ok {
		w.G().Log.CDebugf(ctx, "skipping cache for ExchangeRate(%s) because too old (%s)", currency, age)
	}
	w.G().Log.CDebugf(ctx, "ExchangeRate(%s) using remote", currency)

	rateRes, err := w.rateGroup.Do(currency, func() (interface{}, error) {
		return w.Remoter.ExchangeRate(ctx, currency)
	})
	rate, ok := rateRes.(stellar1.OutsideExchangeRate)
	if !ok {
		return stellar1.OutsideExchangeRate{}, errors.New("invalid cast")
	}

	if err == nil {
		w.Lock()
		w.rates[currency] = rateEntry{
			currency: currency,
			rate:     rate,
			ctime:    time.Now(),
		}
		w.Unlock()
		w.G().Log.CDebugf(ctx, "ExchangeRate(%s) => %+v, setting cache", currency, rate)
	}

	return rate, err
}
709231
func (m *CountMeter) RateMean() float64 {
	m.mtx.RLock()
	defer m.mtx.RUnlock()
	return m.rateMean()
}
180200
func (lftri LFTri) Rate(rate int8) Input {
	CheckRate(rate)
	(&lftri).defaults()
	return NewInput("LFTri", rate, 0, 1, lftri.Freq, lftri.Iphase)
}
735169
func (d Device) UtilizationRates() (uint, uint, error) {
	if C.nvmlHandle == nil {
		return 0, 0, errLibraryNotLoaded
	}
	var utilization C.nvmlUtilization_t
	r := C.nvmlDeviceGetUtilizationRates(d.dev, &utilization)
	return uint(utilization.gpu), uint(utilization.memory), errorString(r)
}
37637
func NewRateServer(index string, xcBot *exchanges.ExchangeBot) *RateServer {
	return &RateServer{
		btcIndex:   index,
		clientLock: new(sync.RWMutex),
		clients:    make(map[StreamID]RateClient),
		xcBot:      xcBot,
	}
}
883609
func (b *Bittrex) GetCurrencies() (currencies []Currency, err error) {
	r, err := b.client.do("GET", "public/getcurrencies", "", false)
	if err != nil {
		return
	}
	var response jsonResponse
	if err = json.Unmarshal(r, &response); err != nil {
		return
	}
	if err = handleErr(response); err != nil {
		return
	}
	err = json.Unmarshal(response.Result, &currencies)
	return
}
65755
func (tl *TokenLimiter) DefaultRates() *RateSet {
	defaultRates := NewRateSet()
	for _, r := range tl.defaultRates.m {
		defaultRates.Add(r.period, r.average, r.burst)
	}
	return defaultRates
}
1005216
func (envgen EnvGen) Rate(rate int8) Input {
	CheckRate(rate)
	(&envgen).defaults()
	ins := []Input{
		envgen.Gate,
		envgen.LevelScale,
		envgen.LevelBias,
		envgen.TimeScale,
		C(float32(envgen.Done)),
	}
	ins = append(ins, envgen.Env.Inputs()...)
	return NewInput("EnvGen", rate, 0, 1, ins...)
}
963872
func (m *StandardMeter) Rate5() float64 {
	m.lock.RLock()
	rate5 := m.snapshot.rate5
	m.lock.RUnlock()
	return rate5
}
1168085
func (vs VarSaw) Rate(rate int8) Input {
	CheckRate(rate)
	(&vs).defaults()
	return NewInput("VarSaw", rate, 0, 1, vs.Freq, vs.IPhase, vs.Width)
}
1011058
func (p Price) Currency(v reflect.Value) (interface{}, error) {
	return p.currency(), nil
}
1246380
func (sel Select) Rate(rate int8) Input {
	CheckRate(rate)
	inputs := append([]Input{sel.Which}, sel.Inputs...)
	return NewInput("Select", rate, 0, 1, inputs...)
}
1161191
func (rlpf RLPF) Rate(rate int8) Input {
	if rlpf.In == nil {
		panic("RLPF expects In to not be nil")
	}
	CheckRate(rate)
	(&rlpf).defaults()
	return NewInput("RLPF", rate, 0, 1, rlpf.In, rlpf.Freq, rlpf.RQ)
}
77892
func (xline XLine) Rate(rate int8) Input {
	CheckRate(rate)
	(&xline).defaults()
	return NewInput("XLine", rate, 0, 1, xline.Start, xline.End, xline.Dur, C(float32(xline.Done)))
}
806562
func (out Out) Rate(rate int8) Ugen {
	CheckRate(rate)
	u := NewUgen("Out", rate, 0, 1, out.Bus, out.Channels)
	return *u
}
916059
func unaryOpReciprocal(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpReciprocal, numOutputs, in)
}
290010
func Get(currency string, params *stripe.ExchangeRateParams) (*stripe.ExchangeRate, error) {
	return getC().Get(currency, params)
}