swap = $swap; } /** * Exchange to the latest currency rate. * * @param string $fromCurrency * @param string $toCurrency * @return float|null */ public function exchange($fromCurrency, $toCurrency) { try { return $this->swap->latest("{$fromCurrency}/{$toCurrency}")->getValue(); } catch (Exception $e) { return 1; } } }