Skip to content

Rate life time

Yoxira edited this page Aug 22, 2024 · 1 revision

The sources often fail to fetch the latest rates, so it's crucial to show current rates that aren't empty or outdated. You can configure the time during which prices are considered valid using rateLifetime.

{ // config.jsonc
  "rateLifetime": 30, // 30 minutes
}

This option can also be changed during a request to get the latest currency rates. For example, if you want to consider prices valid for up to two hours, specify rateLifetime of 120 minutes in the request:

/get?rateLifetime=120

CurrencyInfo backs up to older data within the rateLifetime range in the following cases:

  • The rate fails to fetch for any reason (API Key limit, Request Limit, Internal Server Error, etc.)
  • The rates significantly differ between the sources
Clone this wiki locally