Skip to main content

Fiat Currency Rates

Trezor Suite integrates multiple fiat rate providers to display cryptocurrency values in your preferred currency with real-time exchange rates.

Rate Types

Suite provides three types of fiat rates:

Current Rates

Real-time exchange rates for live balance conversions

Weekly Rates

7-day historical rates for trend indicators

Historical Rates

Transaction-time rates for accurate value tracking

Rate Providers

Blockbook (Primary)

Used for most cryptocurrencies:
  • Bitcoin and Bitcoin-like chains (BTC, LTC, DOGE, etc.)
  • Ethereum and ERC-20 tokens
  • Other main networks

CoinGecko (Secondary)

Used for:
  • XRP (Ripple)
  • SOL and SPL tokens (Solana)
  • ADA and native tokens (Cardano)
  • Fallback when Blockbook fails
Suite automatically falls back to CoinGecko if Blockbook rate fetching fails, ensuring continuous rate availability.

Current Rates

Initial Fetch

Current rates are fetched:
// On app launch
enabledNetworks.forEach(network => {
  fetchCurrentRate(network);
});

// When enabling new coin
dispatch(enableNetwork(coin));
// → triggers immediate rate fetch

Update Intervals

Automatic rate updates:
  • Check interval: Every 3 minutes
  • Refresh threshold: Rates older than 10 minutes
  • Storage: Cached in wallet.fiat reducer
// Every 3 minutes, check all stored rates
storredRates.forEach(rate => {
  if (isOlderThan(rate.timestamp, 10 * 60 * 1000)) {
    refetchRate(rate.symbol);
  }
});

ERC-20 Token Rates

Special handling for Ethereum tokens:
// Fetched on account events
ACCOUNT.CREATE // During account discovery
ACCOUNT.UPDATE // When new tokens appear

// Only tokens with definitions
if (token.definition) {
  fetchTokenRate(token.address);
}

Weekly Rates

Purpose

Provide 7-day trend indicators:
  • Green/red arrows in asset tables
  • Percentage change calculations
  • Portfolio performance tracking

Fetching Schedule

// On app launch
fetchWeeklyRates(enabledNetworks);

// When enabling new network
dispatch(enableNetwork(coin));
// → triggers weekly rate fetch

// Update interval: Every 1 hour
setInterval(() => {
  checkAndUpdateWeeklyRates();
}, 60 * 60 * 1000);

Caching Strategy

  • Cache time: 1 hour
  • Check frequency: Every hour
  • No fetch if: Recent rates exist (< 1 hour old)

Historical Rates

Transaction Rates

Exchange rates at transaction time:
// Stored with transaction
interface Transaction {
  // ... other fields
  rates: {
    [fiatCurrency: string]: number;
  };
  timestamp: number;
}

Fetching Behavior

1

Transaction Added

When a new transaction is detected or confirmed
2

Rate Fetch

Historical rate fetched for transaction timestamp
3

Store with TX

Rate stored permanently within transaction object
4

Retry on Failure

If fetch fails, retry on next BLOCKCHAIN.CONNECTED

No Updates Needed

Historical rates never need updating:
  • Exchange rate in the past cannot change
  • Stored once, used forever
  • Provides accurate historical value tracking

FiatValue Component

Simplify fiat conversions in UI:

Basic Usage

import { FiatValue } from '@suite-components';

// Simple conversion
<FiatValue 
  amount={amount} 
  symbol={assetSymbol} 
/>

// With token address
<FiatValue 
  amount={amount} 
  symbol="eth" 
  tokenAddress={token.address}
/>

Historical Rates

import { useHistoricRate } from '@suite-hooks';

const historicRate = useHistoricRate(transaction);

<FiatValue
  amount={transaction.amount}
  symbol={transaction.symbol}
  historicRate={historicRate}
  useHistoricRate
/>

Render Props Pattern

Handle missing rates gracefully:
<FiatValue amount="1" symbol={symbol}>
  {({ value, rate, timestamp }) =>
    rate && timestamp ? (
      <Tooltip
        content={
          <Translation
            id="TR_LAST_UPDATE"
            values={{
              value: (
                <FormattedRelativeTime
                  value={rateAge(timestamp) * 60}
                  numeric="auto"
                  updateIntervalInSeconds={10}
                />
              ),
            }}
          />
        }
      >
        {value}
      </Tooltip>
    ) : (
      <NoRatesTooltip />
    )
  }
</FiatValue>

Available Props

PropTypeDescription
amountstringCrypto amount to convert
symbolstringCryptocurrency symbol
tokenAddressstringToken contract address (for tokens)
historicRatenumberUse specific historical rate
useHistoricRatebooleanEnable historical rate mode
showApproximationIndicatorbooleanShow ≈ symbol
disableHiddenPlaceholderbooleanIgnore discreet mode

Rate Middleware

The fiatRatesMiddleware handles automatic rate fetching:
// Located at:
packages/suite/src/middlewares/wallet/fiatRatesMiddleware.ts

// Intercepts actions:
- ACCOUNT.CREATEfetch token rates
- ACCOUNT.UPDATEfetch new token rates  
- BLOCKCHAIN.CONNECTEDretry failed historical rates
- @wallet-settings/change-networksfetch rates for enabled coins

Error Handling

Graceful Degradation

  • Try CoinGecko as fallback
  • Display last known rate with warning
  • Retry on next interval
  • Allow user to continue using app
  • Use cached rates from storage
  • Show staleness indicator
  • Queue fetches for when online
  • Exponential backoff
  • Spread requests over time
  • Prioritize visible data

Missing Rates

When rates unavailable:
// Components should handle null rates
if (!rate) {
  return <NoRatesAvailable />;
}

// Or show crypto amount only
return <CryptoAmount amount={amount} symbol={symbol} />;

Supported Fiat Currencies

Trezor Suite supports major fiat currencies:
  • USD (US Dollar)
  • CAD (Canadian Dollar)
  • BRL (Brazilian Real)
  • ARS (Argentine Peso)

Best Practices

For Users

  • Choose your preferred fiat currency in Settings
  • Rates update automatically, no action needed
  • Historical values show accurate transaction-time prices

For Developers

  • Always use FiatValue component
  • Handle null rates gracefully
  • Don’t over-fetch rates
  • Cache and reuse rate data

Performance Considerations

Optimization Strategies

  1. Batched requests: Fetch multiple rates in single request when possible
  2. Debounced updates: Prevent excessive rate calculations
  3. Memoized selectors: Cache computed fiat values
  4. Lazy loading: Only fetch rates for visible assets

Rate Limiting Protection

// Built-in rate limiting
const RATE_LIMIT = {
  current: {
    checkInterval: 3 * 60 * 1000,     // 3 minutes
    refreshThreshold: 10 * 60 * 1000, // 10 minutes
  },
  weekly: {
    checkInterval: 60 * 60 * 1000,    // 1 hour  
    cacheTime: 60 * 60 * 1000,        // 1 hour
  },
};

Build docs developers (and LLMs) love