@param Currency $referenceCurrency
@param Currency $currency

@return string The yahoo finance endpoint to get Currency exchange rate
966886
protected function getEndpoint(Currency $referenceCurrency, Currency $currency)
    {
        $q = sprintf(
            'select * from yahoo.finance.xchange where pair in ("%s%s")',
            $referenceCurrency->getCode(),
            $currency->getCode()
        );

        $queryString = http_build_query(array(
            'q'      => $q,
            'format' => 'json',
            'env'    => 'store://datatables.org/alltableswithkeys',
        ));

        return 'https://query.yahooapis.com/v1/public/yql?'.$queryString;
    }
1301994
public function getCurrency($currencyCode) : Currency
    {
        if (isset($this->currencies[$currencyCode])) {
            return $this->currencies[$currencyCode];
        }

        if (! isset($this->currencyData[$currencyCode])) {
            if ($this->numericToCurrency === null) {
                $this->numericToCurrency = require __DIR__ . '/../data/numeric-to-currency.php';
            }

            if (isset($this->numericToCurrency[$currencyCode])) {
                return $this->getCurrency($this->numericToCurrency[$currencyCode]);
            }

            throw UnknownCurrencyException::unknownCurrency($currencyCode);
        }

        $currency = new Currency(... $this->currencyData[$currencyCode]);

        return $this->currencies[$currencyCode] = $currency;
    }
1354795
public function getTotal(string $defaultCurrency = 'DKK') : Money
    {
        $total = null;

        foreach ($this->stockMovements as $stockMovement) {
            if (!$total) {
                $total = new Money(0, new Currency($stockMovement->getCurrency()));
            }

            $total = $total->add($stockMovement->getPrice()->multiply($stockMovement->getQuantity()));
        }

        if (!$total) {
            $total = new Money(0, new Currency($defaultCurrency));
        }

        return $total;
    }
527651
protected function updateCurrencyRates(Currency $currency)
    {
        $baseExchangeRate = $this->table[$currency->getCode()];

        foreach ($this->table as $currencySymbol => $exchangeRate) {
            $rate = $this->calculateExchangeRate($baseExchangeRate, $currencySymbol);
            $this->addUpdateExchangeRate($currency->getCode(), $currencySymbol, $rate);
        }

        $this->helper->getEntityManager()->flush();
    }
1240923
public function parseCurrency($value, &$currency, &$position = NULL, $fmt, $value, &$currency, &$position = NULL)
    {
    }
141838
public function setCurrency($currency) {

        $this->checkInArray($currency, GDAXConstants::$currencyValues);
        $this->currency = $currency;
        return $this;

    }
1166263
protected function exchangeRates($baseCurrency, $defaultCurrency, array $currencyRates)
    {
        $precision = 5;
        $defaultCurrencyRate = round(1 / $currencyRates[$defaultCurrency], $precision);

        $exchangedRates = array();
        $exchangedRates[$baseCurrency] = $defaultCurrencyRate;

        unset($currencyRates[$baseCurrency], $currencyRates[$defaultCurrency]);

        foreach ($currencyRates as $currencyName => $rate) {
            $exchangedRates[$currencyName] = round($rate * $defaultCurrencyRate, $precision);
        }

        return $exchangedRates;
    }
469073
public function loadCurrency($currencyCode) {
    $filePath = $this->getCurrencyResourceDirectory() . "/$currencyCode.json";
    if (is_readable($filePath)) {
      return $this->createCurrencyFromJson(file_get_contents($filePath));
    }
    else {
      return null;
    }
  }
769153
public function getCurrency()
    {
        if (! empty($this->currency)) {
            return $this->currency;
        }

        return $this->setCurrency(config('currency.default'))->getCurrency();
    }
201960
public function formatByDecimal(Currencies $currencies = null)
    {
        $formatter = new DecimalMoneyFormatter($currencies ?: static::getCurrencies());

        return $this->formatByFormatter($formatter);
    }
358324
public function getCurrencySign($currency = false)
    {
        $locale = \Locale::getDefault();

        $format = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
        $pattern = $format->formatCurrency('123', $currency);

        preg_match('/^([^\s\xc2\xa0]*)[\s\xc2\xa0]*123(?:[,.]0+)?[\s\xc2\xa0]*([^\s\xc2\xa0]*)$/u', $pattern, $matches);

        if (!empty($matches[1])) {
            $currency_sign = $matches[1];
        } elseif (!empty($matches[2])) {
            $currency_sign = $matches[2];
        } else {
            $currency_sign = '¤';
        }

        return $currency_sign;
    }
914578
public function numericCodeFor(Currency $currency)
    {
        if (!$this->contains($currency)) {
            throw new UnknownCurrencyException('Cannot find ISO currency '.$currency->getCode());
        }

        return $this->getCurrencies()[$currency->getCode()]['numericCode'];
    }
141924
public static function parseByParser(MoneyParser $parser, $money, $forceCurrency = null)
    {
        return static::convert($parser->parse($money, $forceCurrency));
    }
462599
public function findPriceByCurrency($currency): ?PriceInterface
    {
        if ($currency instanceof \Money\Currency) {
            $currency = $currency->getCode();
        } elseif ($currency instanceof CurrencyInterface) {
            $currency = $currency->getIsoCodeAlpha();
        }

        if (!is_string($currency)) {
            throw new \InvalidArgumentException('$currency has to be a string');
        }

        foreach ($this->prices as $price) {
            if ($price->getCurrency()->getIsoCodeAlpha() === $currency) {
                return $price;
            }
        }

        return null;
    }
342872
protected function getHistoricalExchangeRate(HistoricalExchangeRateQuery $exchangeQuery): ExchangeRateContract
    {
        $currencyPair = $exchangeQuery->getCurrencyPair();
        $baseCurrency = $currencyPair->getBaseCurrency();
        $date = $exchangeQuery->getDate();
        $formattedDate = $date->format('Ymd');

        $content = $this->request(self::URL.'?'.http_build_query(['date' => $formattedDate]));
        $element = StringUtil::xmlToElement($content);

        $elements = $element->xpath('./currency[cc="'.$baseCurrency.'"]');

        if (empty($elements)) {
            if ($element->xpath('./error')) {
                throw new UnsupportedDateException($date, $this);
            }

            throw new UnsupportedCurrencyPairException($currencyPair, $this);
        }

        $item = $elements[0];

        $rate = (float) str_replace(',', '.', (string) $item->rate);

        return $this->createRate($currencyPair, $rate, $date);
    }
1324105
private function getClass(string $currency = null): string
    {
        $currency = !is_null($currency) ? strtolower($currency) : $this->provider->get();

        return $this->provider->config->get('currencies')[$currency];
    }
719804
protected function getBaseRates(string $currency, string $date)
    {
        $this->currency = $currency;
        $this->date = $date;

        if (isset($this->baseRates[strtoupper($currency)][$date])) {

            return $this->baseRates[strtoupper($currency)][$date];
        }

        return null;
    }