src/RunOpenCode/ExchangeRate/Manager.php
public function historical($sourceName, $currencyCode, \DateTime $date, $rateType = RateType::MEDIAN)
    {
        $currencyCode = CurrencyCodeUtil::clean($currencyCode);

        if ($this->has($sourceName, $currencyCode, $date, $rateType)) {
            return $this->get($sourceName, $currencyCode, $date, $rateType);
        }

        if ((int) $date->format('N') === 6 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P1D')), $rateType)) {
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
        }

        if ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) {
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
        }

        throw new ExchangeRateException(sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for historical date "%s".', $currencyCode, $rateType, $sourceName, $date->format('Y-m-d')));
    }
public function historical($sourceName, $currencyCode, \DateTime $date, $rateType = RateType::MEDIAN)
    {
        $currencyCode = CurrencyCodeUtil::clean($currencyCode);

        if ($this->has($sourceName, $currencyCode, $date, $rateType)) {
            return $this->get($sourceName, $currencyCode, $date, $rateType);
        }

        if ((int) $date->format('N') === 6 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P1D')), $rateType)) {
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
        }

        if ((int) $date->format('N') === 7 && $this->has($sourceName, $currencyCode, $lastFriday = $date->sub(new \DateInterval('P2D')), $rateType)) {
            return $this->get($sourceName, $currencyCode, $lastFriday, $rateType);
        }

        throw new ExchangeRateException(sprintf('Rate for currency code "%s" of type "%s" from source "%s" is not available for historical date "%s".', $currencyCode, $rateType, $sourceName, $date->format('Y-m-d')));
    }
{@inheritdoc}

@throws \RunOpenCode\ExchangeRate\Exception\UnknownCurrencyCodeException