# FOREX conversion

### What is this endpoint for? <a href="#what-is-this-endpoint-for" id="what-is-this-endpoint-for"></a>

This endpoint retrieves a Reference Rate and converts USD into a local currency of your choosing using [TP-ICAP](https://tpicap.com/tpicap/) as the source. This endpoint is for the following asset classes:

* Crypto

Available currencies are CHF / EUR / GBP / JPY / KRW.

### Endpoints

{% tabs %}
{% tab title="gRPC" %}

```url
gateway-v0-grpc.kaiko.ovh
```

{% endtab %}

{% tab title="http" %}

```url
gateway-v0-http.kaiko.ovh
```

{% endtab %}

{% tab title="API (testing)" %}
{% code overflow="wrap" %}

```url
https://gateway-v0-http.kaiko.ovh/api/stream/index_forex_rate_v1
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Request parameters

<table><thead><tr><th width="184">Parameter</th><th width="400">Description</th><th>Examples</th></tr></thead><tbody><tr><td><code>index_code</code></td><td>The Kaiko Benchmark Reference Rate ticker. You can find a full list of our tickers <a href="https://www.kaiko.com/products/rates-and-indices/kaiko-digital-asset-rates">here</a>.</td><td><code>KK_BRR_BTCUSD_EUR</code></td></tr></tbody></table>

{% hint style="info" %}
**Requesting multiple tickers at the same time**\
\
To configure multiple tickers in the same stream, provide the  `indexCode` as a comma separated list eg `KK_BRR_BTCUSD_EUR,KK_BRR_BTCUSDC_USD`\
\
Alternatively, use a wildcard by entering a `*` and you'll receive all tickers you have as part of you Kaiko subscription.
{% endhint %}

### Response fields

<table><thead><tr><th width="292.158203125">Field</th><th width="537">Description</th></tr></thead><tbody><tr><td><code>indexCode</code></td><td>The ticker identifying the rate.</td></tr><tr><td><code>commodity</code></td><td>The type of publication. Either real-time or fixings</td></tr><tr><td><code>interval_startTime</code></td><td>The start time for the interval.</td></tr><tr><td><code>interval_endTime</code></td><td>The end time for the interval.</td></tr><tr><td><code>composition_underlying_name</code></td><td>The Kaiko Reference Rate ticker.</td></tr><tr><td><code>composition_underlying_tsEvent</code></td><td>The exact time of original Reference Rate publication.</td></tr><tr><td><code>price</code></td><td>The price of the Reference Rate in the <strong>converted currency.</strong></td></tr><tr><td><code>tsEvent</code></td><td>The exact time of converted reference rate publication.</td></tr><tr><td><code>detail_underlying_name</code></td><td>The ticker of the underlying reference rate.</td></tr><tr><td><code>detail_underlying_price</code></td><td>The original published price of the Reference Rate in USD.</td></tr><tr><td><code>detail_underlying_tsEvent</code></td><td>The exact timestamp of original reference rate publication.</td></tr></tbody></table>

### Request examples

{% tabs %}
{% tab title="Python" %}
{% @github-files/github-code-block url="<https://github.com/kaikodata/kaiko-sdk-examples/blob/master/python/code-example/index_forex_rate.py>" visible="false" %}
{% endtab %}

{% tab title="cURL" %}
**cURL requests are intended for testing purposes only.**

{% code overflow="wrap" %}

```url
curl -X POST "https://gateway-v0-http.kaiko.ovh/api/stream/index_forex_rate_v1" -H "accept: application/json" -H "X-Api-Key: $KAIKO_API_KEY" -H "Content-Type: application/json" -d "{\"indexCode\": \"KK_BRR_BTCUSD\"}"
```

{% endcode %}
{% endtab %}

{% tab title="Other examples" %}
For more advanced users, you can access our full SDK [here](https://github.com/kaikodata/kaiko-sdk-examples/tree/master), where you'll find more coding languages, examples and guidance.
{% endtab %}
{% endtabs %}

## Response Example

```json
{
  "indexCode": "KK_BRR_BTCUSD_EUR",
  "commodity": "SIC_REAL_TIME",
  "interval": {
    "startTime": "2024-09-12T21:42:35Z",
    "endTime": "2024-09-12T21:42:50Z"
  },
  "composition": {
    "underlying": {
      "name": "KK_BRR_BTCUSD",
      "tsEvent": "2024-09-12T21:42:50.658126160Z"
    },
    "fxrate": {
      "name": "USD/EUR",
      "tsEvent": "2024-09-12T21:42:01.048683287Z"
    }
  },
  "price": 52215.539302000085,
  "tsEvent": "2024-09-12T21:42:50.857862111Z",
  "detail": {
    "underlying": {
      "name": "KK_BRR_BTCUSD",
      "price": 57826.099,
      "tsEvent": "2024-09-12T21:42:50.658126160Z"
    }
  }
}
```


---

# 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.kaiko.com/kaiko-indices/reference-rates/forex-conversion.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.
