base_currency = $base_currency; $this->swap = $swap; } /** * Updates the exchange rate of the given currency using the globally configured providers. * @param Currency $currency * @return Currency */ public function update(Currency $currency): Currency { $rate = $this->swap->latest($currency->getIsoCode().'/'.$this->base_currency); $currency->setExchangeRate(BigDecimal::of($rate->getValue())); return $currency; } }