# `Forex.Feed`
[🔗](https://github.com/greven/forex/blob/1.1.2/lib/forex/feed.ex#L1)

This module is responsible for fetching the latest exchange rates from the
European Central Bank (ECB) and parsing the XML response.

The ECB provides three different feeds:

- Latest exchange rates: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
- Exchange rates for the last ninety days: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml
- Historic exchange rates: https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.xml

For each feed, this module provides a function to fetch the rates and parse the response, respectively,
`latest_rates/1`, `last_ninety_days_rates/1`, and `historic_rates/1`.

# `api_mod`

The API module to use for fetching the exchange rates, by default uses
`Forex.Feed.Req`. The API module must implement the `Forex.Feed.API` behaviour.

This is useful for testing purposes, where you can provide a mock API module or
for using a different API module, for example, an API module that uses a different
HTTP client.

# `base_url`

The base URL for the European Central Bank (ECB) exchange rate feeds.

# `historic_rates`

```elixir
@spec historic_rates(keyword()) :: {:ok, [map()]} | {:error, {module(), term()}}
```

Fetches the historic exchange rates from the European Central Bank (ECB).

# `last_ninety_days_rates`

```elixir
@spec last_ninety_days_rates(keyword()) ::
  {:ok, [map()]} | {:error, {module(), term()}}
```

Fetches the exchange rates for the last ninety days from the European Central Bank (ECB).

# `latest_rates`

```elixir
@spec latest_rates(keyword()) :: {:ok, map()} | {:error, {module(), term()}}
```

Fetches the latest exchange rates from the European Central Bank (ECB).

# `path`

The path for the different exchange rate feeds, corresponding
to each different feed provided by the European Central Bank (ECB).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
