world.money.conversion

Members list

Type members

Classlikes

final case class ConversionContext

Encapsulates metadata about a currency conversion or exchange rate.

Encapsulates metadata about a currency conversion or exchange rate.

Value parameters

provider

A string identifying the source of the exchange rate data (e.g. "ECB", "IMF", "MyBank-API").

rateTimestamp

Optional timestamp indicating when the rate was valid.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class ConversionQuery(base: Currency, term: Currency)

A query for requesting an exchange rate between two currencies.

A query for requesting an exchange rate between two currencies.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class ConversionRate

Represents the conversion rate between two currencies.

Represents the conversion rate between two currencies.

Value parameters

base

The base currency.

context

Optional metadata about the rate, such as its source and timestamp.

rate

The conversion factor. This is the value of the term currency that one unit of the base currency is worth.

term

The term (or counter) currency.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

A trait for providing exchange rates.

A trait for providing exchange rates.

This is the central SPI (Service Provider Interface) for currency conversion. Users can implement this trait to fetch exchange rates from any source, such as a web API, a database, or a local file.

Well-behaved implementations should handle finding direct rates (e.g., EUR -> USD), inverse rates (if only USD -> EUR is available), and potentially chained or cross-rates (e.g., KES -> ZAR via USD).

Attributes

Supertypes
class Object
trait Matchable
class Any