Forex.Options (Forex v1.1.2)

Copy Markdown View Source

Options/configuration module for the Forex.Fetcher.Supervisor and the rates functions (latest_rates/1, last_ninety_days_rates/1, etc.) in the Forex module.

Summary

Functions

Validate and return the options for the Forex.Currency module functions.

Validate and return the options for the Forex.Fetcher module functions. Supported options

Validate and return the options for the Forex.Fetcher.Supervisor module functions. Supported options

Validate and return the options for the Forex module functions.

Types

currency_option()

@type currency_option() :: {:format, term()} | {:round, integer() | nil}

fetcher_option()

@type fetcher_option() ::
  {:use_cache, boolean()}
  | {:feed_fn, {module(), atom(), [term()]}}
  | {:schedular_interval, integer()}

fetcher_supervisor_option()

@type fetcher_supervisor_option() :: {:auto_start, boolean()}

rates_option()

@type rates_option() ::
  {:base, term()}
  | {:format, term()}
  | {:round, integer() | nil}
  | {:keys, term()}
  | {:symbols, [term()] | nil}
  | {:use_cache, boolean()}
  | {:feed_fn, {module(), atom(), [term()]}}

Functions

currency_options(opts \\ [])

@spec currency_options(opts :: keyword()) ::
  validated_options :: [currency_option()] | map()

Validate and return the options for the Forex.Currency module functions.

Supported options:

  • :format - Format of rate values The default value is :decimal.

  • :round - Decimal places for rounding The default value is 5.

currency_schema()

fetcher_options(opts \\ [])

@spec fetcher_options(opts :: keyword()) ::
  validated_options :: [fetcher_option()] | map()

Validate and return the options for the Forex.Fetcher module functions. Supported options:

  • :use_cache (boolean/0) - Whether to use cached rates The default value is true.

  • :feed_fn - Optional custom feed function as {module, function, args}

  • :schedular_interval (integer/0) - Interval for the scheduler to fetch rates The default value is 43200000.

fetcher_schema()

fetcher_supervisor_options(opts \\ [])

@spec fetcher_supervisor_options(opts :: keyword()) ::
  validated_options :: [fetcher_supervisor_option()] | map()

Validate and return the options for the Forex.Fetcher.Supervisor module functions. Supported options:

  • :auto_start (boolean/0) - Whether to start the fetcher automatically The default value is true.

fetcher_supervisor_schema()

rates_options(opts \\ [])

@spec rates_options(opts :: keyword()) ::
  validated_options :: [rates_option()] | map()

Validate and return the options for the Forex module functions.

Supported options:

  • :base - The base currency to convert rates to The default value is :eur.

  • :format - Format of rate values The default value is :decimal.

  • :round - Decimal places for rounding The default value is 5.

  • :keys - Map key format The default value is :atoms.

  • :symbols - Currency codes to include

  • :use_cache (boolean/0) - Whether to use cached rates The default value is true.

  • :feed_fn - Optional custom feed function as {module, function, args}

rates_schema()