Options
All
  • Public
  • Public/Protected
  • All
Menu

exchange-rate repository

test

lookup of direct, triangulated, and derived exchange rates is tested.

Index

Variables

Const _data

_data: Map<Key, Entry[]> = new Map()

Functions

add

  • add(rate: ExchangeRate, startDate?: Date, endDate?: Date): void
  • Add an exchange rate. The given rate is valid between the given dates.

    note If two rates are given between the same currencies and with overlapping date ranges, the latest one added takes precedence during lookup.

    Parameters

    • rate: ExchangeRate
    • Default value startDate: Date = DateExt.minDate()
    • Default value endDate: Date = DateExt.maxDate()

    Returns void

addKnownRates

  • addKnownRates(): void
  • Returns void

clear

  • clear(): void
  • remove the added exchange rates

    Returns void

directLookup

fetch

hash

  • Parameters

    Returns Key

hashes

  • Parameters

    Returns boolean

lookup

  • Lookup the exchange rate between two currencies at a given date. If the given type is Direct, only direct exchange rates will be returned if available; if Derived, direct rates are still preferred but derived rates are allowed.

    warning if two or more exchange-rate chains are possible which allow to specify a requested rate, it is unspecified which one is returned.

    Parameters

    • source: Currency
    • target: Currency
    • Default value date: Date = null
    • Default value type: Type = ExchangeRate.Type.Derived

    Returns ExchangeRate

smartLookup