# Get FX Rates in Graphql

---

<span style="white-space: pre-wrap;">This query returns currency rates for a </span>**specific date**<span style="white-space: pre-wrap;"> and </span>**specific currency**.

[![Screenshot 2025-12-16 at 17.19.02.png](https://docs.finmars.com/uploads/images/gallery/2025-12/scaled-1680-/screenshot-2025-12-16-at-17-19-02.png)](https://docs.finmars.com/uploads/images/gallery/2025-12/screenshot-2025-12-16-at-17-19-02.png)

---

### GraphQL Query

```graphql
query GetCurrencyHistoryList {
  currency_history(
    pagination: {
      limit: 20
      offset: 0
    }
    filters: {
      date: {
        exact: "2023-12-01"
      }
      pricing_policy: {
        user_code:{
          exact: "com.finmars.standard-pricing:standard"
        }
      }
      currency: {
        user_code: {
          exact: "CHF"
        }
      }
    }
  ) {
    id
    date
    fx_rate
    currency {
      id
      user_code
      name
    }
  }
}
```

---

### Python Example

```python
import requests

url = "https://<domain_name>/<realm_code>/<space_code>/graphql/"

headers = {
    "Authorization": "Bearer <access_token>",
    "Content-Type": "application/json"
}

payload = {
    "query": """
    query GetCurrencyHistoryList {
      currency_history(
        pagination: {
          limit: 20
          offset: 0
        }
        filters: {
          date: {
            exact: "2023-12-01"
          }
          pricing_policy: {
            user_code:{
              exact: "com.finmars.standard-pricing:standard"
            }
          }
          currency: {
            user_code: {
              exact: "CHF"
            }
          }
        }
      ) {
        id
        date
        fx_rate
        currency {
          id
          user_code
          name
        }
      }
    }
    """
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

---

## Filter Highlights

### Exact Match

```graphql
date: {
  exact: "2023-12-01"
}
```

- Matches one exact value
- Type must match schema
- Dates are strings in ISO format

---

### Nested Filters

```graphql
currency: {
  user_code: {
    exact: "CHF"
  }
}
```

- Filters on related objects
- Works through foreign keys
- Depth depends on schema rules

---

### Common Filter Types

Typical filters you may see:

- `<span class="editor-theme-code">exact</span>`
- `<span class="editor-theme-code">in</span>`
- `<span class="editor-theme-code">contains</span>`
- `<span class="editor-theme-code">gte</span>`<span style="white-space: pre-wrap;">, </span>`<span class="editor-theme-code">lte</span>`
- `<span class="editor-theme-code">isnull</span>`

Available filters depend on the field type.

---

### Important Notes

- Filters are optional
- <span style="white-space: pre-wrap;">Multiple filters are combined with </span>**AND**
- Wrong field names cause schema errors
- Always check the schema panel

This pattern applies to all list queries in Finmars GraphQL.