Get FX Rates in Graphql
This query returns currency rates for a specific date and specific currency.
GraphQL 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
}
}
}
Python Example
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
date: {
exact: "2023-12-01"
}
- Matches one exact value
- Type must match schema
- Dates are strings in ISO format
Nested Filters
currency: {
user_code: {
exact: "CHF"
}
}
Common Filter Types
Typical filters you may see:
exactincontainsgte,lteisnull
Available filters depend on the field type.
Important Notes
- Filters are optional
- Multiple filters are combined with AND
- Wrong field names cause schema errors
- Always check the schema panel
This pattern applies to all list queries in Finmars GraphQL.
