# Fungible token daily DEX rate

`DailyDexRate` entity represents daily average rates for fungible token pairs traded on Casper DEXes.

### Properties

The `DailyDexRate` entity has the following properties:

| Property                             | Type      | Description                                                             |
| ------------------------------------ | --------- | ----------------------------------------------------------------------- |
| `token_contract_package_hash`        | `string`  | Source fungible token contract package hash                             |
| `target_token_contract_package_hash` | `string`  | Target fungible token contract package hash                             |
| `amount`                             | `float64` | Volume-weighted average daily rate amount expressed in the target token |
| `volume`                             | `string`  | The total swap volume used to compute the daily rate                    |
| `dex_id`                             | `uint16`  | [DEX](/rest-api/dex.md) identifier                                      |
| `date`                               | `string`  | Date in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format   |

`volume` is normalized using token decimals. For example, if the summed on-chain amount is `123450000` and token decimals are `6`, the normalized value is `123.45`.

**Example**

```json
{
  "amount": "0.0025",
  "volume": "1234.567",
  "token_contract_package_hash": "0f6b7e1a8d6e4f1b5a2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef12",
  "target_token_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
  "dex_id": 1,
  "date": "2024-02-01T00:00:00Z"
}
```

### Optional properties

Depending on the endpoint, the following optional property may be included in the `DailyDexRate` entity:

| Property        | Type      | Description                                                      |
| --------------- | --------- | ---------------------------------------------------------------- |
| `ft_daily_rate` | `float32` | Daily average rate of the source token in the specified currency |

`ft_daily_rate` is a [function includer](/documentation/overview/optional-properties.md#functions) that accepts `currency_id` and `dex_id` arguments.

### Relations

The `DailyDexRate` entity has the following relations with other entities:

| Entity                                             | Mapping property                                                    | Description                                                      |
| -------------------------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [`ContractPackage`](/rest-api/contract-package.md) | `token_contract_package_hash`, `target_token_contract_package_hash` | Daily rates are tracked for fungible token pairs                 |
| [`DEX`](/rest-api/dex.md)                          | `dex_id`                                                            | Daily rates are calculated separately for different Casper DEXes |

## Endpoints

The fungible token daily DEX rate endpoints are:

* [Get the latest fungible token daily DEX rate](/rest-api/fungible-token-daily-dex-rate/get-latest-daily-token-dex-rate.md)
* [Get historical fungible token daily DEX rates](/rest-api/fungible-token-daily-dex-rate/get-daily-token-dex-rates.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cspr.cloud/rest-api/fungible-token-daily-dex-rate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
