Calculate a cross rate from two pairs

With USD/EUR at 0.89104 and USD/IDR at 18,095.1, the EUR/IDR cross rate is 20,307.8. A cross rate between two currencies that are both quoted against the dollar is the quote of the second divided by the quote of the first.

Do it with the API

For a EUR to IDR conversion through the dollar, EUR is the source currency and IDR is the target currency. Request both dollar quotes together with GET /v1/fx/rates/USD?currencies=EUR,IDR. The response gives the quotes needed for the division in one request.

  1. Set your API key Get a free API key and put it in the environment variable NARWHAL_API_KEY. The Python script reads that variable and sends the key in the Authorization header as a Bearer token. REST and MCP use the same key.
  2. Fetch the quotes and divide Use the script to read the EUR and IDR quotes with USD as their shared base. It divides the IDR quote by the EUR quote, then requests EUR/IDR directly for comparison. The first printed result is the calculated cross; the second is the direct rate.
    Python, EUR to IDR from two dollar quotes
    import os
    import requests
    
    H = {"Authorization": f"Bearer {os.environ['NARWHAL_API_KEY']}"}
    rates = {r["currency"]: float(r["rate"]) for r in requests.get(
        "https://api.narwhalapi.com/v1/fx/rates/USD", params={"currencies": "EUR,IDR"}, headers=H, timeout=10).json()["rates"]}
    
    # USD/EUR = 0.89342 means 1 USD buys 0.89342 EUR; USD/IDR = 18107.8 means 1 USD buys 18,107.8 IDR.
    eur_idr = rates["IDR"] / rates["EUR"]
    print(f"EUR/IDR = {rates['IDR']} / {rates['EUR']} = {eur_idr:.2f}")
    
    direct = float(requests.get("https://api.narwhalapi.com/v1/fx/rates/EUR", params={"currencies": "IDR"}, headers=H, timeout=10).json()["rates"][0]["rate"])
    print(f"direct EUR/IDR = {direct}")
  3. Apply the rate to your amount Multiply the amount in EUR by the calculated EUR/IDR rate to get the amount in IDR. Keep the direction attached to the result: a EUR/IDR rate tells you how many IDR each EUR buys. An IDR to EUR conversion uses the inverse.

Do it in a sheet or without code

Put the USD/EUR quote in B1 and the USD/IDR quote in B2, then enter the formula in another cell. Keep both input quotes on the same date. The cell positions matter because the formula divides the target currency's dollar quote by the source currency's dollar quote.

EUR to IDR cross rate
=B2/B1

Label the input cells with their full pair names, including USD, so the shared base stays visible. Label the result EUR/IDR. If you swap the contents of the input cells while leaving the formula unchanged, the result becomes the inverse rate, with EUR as the amount received for IDR.

For a common pair, use the currency pages on the exchange rates page. Those pages list common pairs. The sheet route is useful when you already have both dollar quotes and want to calculate the cross from those particular inputs.

Which option to use when

SituationBest optionWhy
The pair exists on the APIAsk for it directlyRead the pair without calculating a cross from rounded quotes
The API does not list the pair, or you need a historical crossDivide dollar quotes from the same dateThe shared dollar base gives you the source and target quotes for the calculation
You need many pairsFetch the dollar quotes once and compute the crossesReuse the dollar quotes for each source and target combination

When you calculate many crosses from a set of dollar quotes, keep the source and target labels with each formula. The source determines which quote goes in the denominator; the target determines which quote goes in the numerator. The same dollar quote can be a numerator for one conversion and a denominator for another. For a historical cross, keep the date with the input quotes and the result. If the pair is available directly and you only need that pair, request it with the currency you are converting from as the base.

Why does my cross differ from the direct rate?

Rounding of the input quotes and differences in their timestamps can make the calculated cross differ from the direct rate. A cross calculation uses the dollar quotes you supply, so their precision carries into the result. Reading the pair directly gives you the direct quote rather than a value derived from those inputs.

On 23 October 2026, the calculated EUR/IDR cross was 20,267.96 and the direct EUR/IDR rate was 20,268.1, a difference of 0.14. Rounding of the dollar quotes accounts for that difference. The direct value does not have to match a calculation made from rounded inputs.

Which way do I divide the quotes?

Divide the target quote by the source quote when both pairs have the same base currency. For EUR/IDR through USD, that means IDR per USD divided by EUR per USD. The shared USD unit cancels, and the remaining units are IDR per EUR.

On 23 October 2026, USD/EUR was 0.89342, so EUR bought more USD than USD bought EUR: 1 EUR = 1/0.89342 = 1.119 USD. EUR therefore bought more IDR than USD did on that date. Dividing the EUR quote by the IDR quote reverses the units and produces EUR per IDR.

Do I need the same date for both quotes?

Yes, use quotes from the same date, because mixing dates adds noise to the cross. For a historical calculation, choose the date for both dollar pairs before dividing. The result relates the source and target currencies through their dollar quotes for that date.

If you already have a dollar quote for the source currency, pair it with the target currency's dollar quote from that same date. A quote from a different date changes the inputs to the calculation. Matching dates also leaves the timestamp and rounding differences described above as separate reasons a cross can differ from a direct quote.

Worked example: EUR to IDR, 23 October 2026

On 23 October 2026, the dollar quotes were 0.89342 EUR and 18,107.8 IDR. Start with the IDR quote as the numerator and the EUR quote as the denominator. Divide them to express the result as IDR for each EUR.

CalculationResult
USD/EUR on 23 October 20260.89342
USD/IDR on 23 October 202618,107.8
EUR/IDR on 23 October 2026: 18,107.8 / 0.8934220,267.96
500 EUR using the 23 October 2026 cross: 500 × 20,267.9610,133,980 IDR

For the 23 October 2026 example, multiply 500 EUR by the displayed cross rate of 20,267.96 to get 10,133,980 IDR. This amount uses the rounded cross rate shown in the calculation. The direct EUR/IDR quote for that date was 20,268.1, so using that quote would use a different rate.

Published .