# Fungible token DEX rate

`DexRate` entity represents rates for fungible token pairs traded on Casper DEXes.

### Properties

The `DexRate` 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` | Rate amount expressed in the target token                                              |
| `volume`                             | `string`  | The swap volume the rate was calculated on                                             |
| `dex_id`                             | `uint16`  | [DEX](/rest-api/dex.md) identifier                                                     |
| `transaction_hash`                   | `string`  | [Deploy](/rest-api/deploy.md) hash associated with this rate                           |
| `timestamp`                          | `string`  | Transaction timestamp in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format |

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

**Example**

```json
{
  "amount": "0.0025",
  "volume": "1234.567",
  "transaction_hash": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6",
  "token_contract_package_hash": "b1c2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6",
  "target_token_contract_package_hash": "ad0cd4ef3cfd9e7222706786e51773af771f063ecce4606282999a7a6d6ac495",
  "dex_id": 1,
  "timestamp": "2024-02-01T10:00:00Z"
}
```

### Optional properties

None

### Relations

The `DexRate` 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` | Rates are tracked for fungible token pairs                           |
| [`Deploy`](/rest-api/deploy.md)                    | `transaction_hash`                                                  | Rates are calculated based on transactions (deploys) on Casper DEXes |
| [`DEX`](/rest-api/dex.md)                          | `dex_id`                                                            | Rates are calculated separately for different Casper DEXes           |

## Endpoints

The fungible token DEX rate endpoints are:

* [Get the latest fungible token DEX rate](/rest-api/fungible-token-dex-rate/get-latest-token-dex-rate.md)
* [Get historical fungible token DEX rates](/rest-api/fungible-token-dex-rate/get-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-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.
