Block/Snippets.php
public function getExchangeRate()
    {
        try {
            $currentCurrency = $this->storeManager->getStore()->getCurrentCurrency()->getCode();
            $baseCurrency = $this->storeManager->getStore()->getBaseCurrency()->getCode();
            return (float)$this->currencyFactory->create()->load($baseCurrency)->getAnyRate($currentCurrency);
        } catch (\Exception $e) {
            throw $e;
        }
    }
public function getExchangeRate()
    {
        try {
            $currentCurrency = $this->storeManager->getStore()->getCurrentCurrency()->getCode();
            $baseCurrency = $this->storeManager->getStore()->getBaseCurrency()->getCode();
            return (float)$this->currencyFactory->create()->load($baseCurrency)->getAnyRate($currentCurrency);
        } catch (\Exception $e) {
            throw $e;
        }
    }
public function getExchangeRate ( ) { try { $ currentCurrency = $ this -> storeManager -> getStore ( ) -> getCurrentCurrency ( ) -> getCode ( ) ; $ baseCurrency = $ this -> storeManager -> getStore ( ) -> getBaseCurrency ( ) -> getCode ( ) ; return ( float ) $ this -> currencyFactory -> create ( ) -> load ( $ baseCurrency ) -> getAnyRate ( $ currentCurrency ) ; } catch ( \ Exception $ e ) { throw $ e ; } }
Get Exchange Rate

@return bool|float
@throws \Exception
Get Exchange Rate