> ## Documentation Index
> Fetch the complete documentation index at: https://rilwanorganization.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Historical Exchange.

> This endpoint allows you to get exchange rates record for a specific date

## Description

The `ExchangeRatesAPI.historical()` method is used to communicate with this endpoint as seen below:

`ExchangeRatesAPI.historical(base, date, Optional[target])`

## Query Parameters

Below are the query parameters for this method:

<ParamField path="base" type="String" required>
  The base currency to be converted. It must be a currency code supported by AbstractAPI.
</ParamField>

<ParamField path="date" type="String" required>
  A specific date in the past that the response must refer to.
  The acceptable date format is: YYYY-MM-DD, e.g 2005-02-30.
</ParamField>

<ParamField path="target" type="String">
  The target currency or currencies that the **base currency** is converted into.
  A list of comma separated currency codes is also permitted, e.g "target=USD,CAD,BRL".
  This argument will limit the response data to the selected currencies
</ParamField>

## Usage

Below is a code snippet to query the `ExchangeRatesAPI.historical()` method:

```python theme={null}
from abstract_python import ExchangeRatesAPI

api_key = "your-exchange-rates-api-key"

api = ExchangeRatesAPI(api_key)
base = "GBP"
date = "2024-02-10"
response = api.historical(base, date)

print(response)

```

Below is the response object:

```
{
    'base': 'GBP', 
    'date': '2024-02-10', 
    'exchange_rates': {
        'EUR': 1.170412, 
        'USD': 1.260768, 
        'JPY': 188.43633, 
        'BGN': 2.289092, 
        'CZK': 29.46161, 
        'DKK': 8.723783, 
        'HUF': 454.096442, 
        'PLN': 5.056882, 
        'RON': 5.825492, 
        'SEK': 13.204003, 
        'CHF': 1.103933, 
        'ISK': 173.338015, 
        'NOK': 13.341526, 
        'TRY': 38.684106, 
        'AUD': 1.936213, 
        'BRL': 6.277739
    }, 
    'status': 200}
```

## Response Fields

<ResponseField name="base" type="String">
  The base currency used in the request
</ResponseField>

<ResponseField name="date" type="String">
  The specific date the rates were pulled from.
</ResponseField>

<ResponseField name="exchange_rates" type="Object">
  A JSON Object with each target currency as the key and their respective rates as the value.
</ResponseField>

<ResponseField name="status" type="Integer">
  The status code of the response.
</ResponseField>

### Limit response fields

You can limit the response by specifying a comma-separated list of target currency codes in your query.\
Below is a code snippet to limit response data:

```python theme={null}
from abstract_python import ExchangeRatesAPI

api_key = "your-exchange-rates-api-key"

api = ExchangeRatesAPI(api_key)

base = "GBP"
date = "2024-02-10"
target = "EUR,USD,JPY"
response = api.historical(base, date, target=target)

```

Below is the response object:

```
{
    'base': 'GBP', 
    'date': '2024-02-10', 
    'exchange_rates': {
        'EUR': 1.170412, 
        'USD': 1.260768, 
        'JPY': 188.43633
    }, 
    'status': 200}
```
