# Triangulated Fx Rates

Reference for multi-hop / triangulated currency conversion on batch rate tapes.

- Repository: https://github.com/benchflow-ai/skillsbench (1888 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add benchflow-ai/skillsbench --skill triangulated-fx-rates -g -a claude-code -y`
Codex: `npx skills add benchflow-ai/skillsbench --skill triangulated-fx-rates -g -a codex -y`
Cursor: `npx skills add benchflow-ai/skillsbench --skill triangulated-fx-rates -g -a cursor -y`
Gemini CLI: `npx skills add benchflow-ai/skillsbench --skill triangulated-fx-rates -g -a gemini-cli -y`

## Description

Reference for multi-hop / triangulated currency conversion on batch rate tapes. When a rate row carries an explicit "via" currency, the row's rate is only one leg of the conversion, and the via currency may ITSELF be quoted through another via, so the effective rate is the product of every leg, resolved by walking the chain until a direct quote is reached. Useful when an FX feed lists some pairs directly to the reporting currency and others as triangulated (or doubly-triangulated) quotes through vehicle currencies.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Triangulated FX rates

Most rate feeds list a direct rate to the reporting currency (typically
USD). Less liquid currencies are often quoted *through* a more liquid
vehicle currency (commonly EUR or USD itself). On a batch rate tape this is
encoded as a second "via" column on the same row:

```
CCY  RATE     VIA
USD  1.0000
EUR  1.0850
GBP  1.2750
CHF  0.9200   EUR     <-- CHF -> EUR is the first hop
ZAR  0.0650   EUR     <-- ZAR -> EUR is the first hop
BRL  0.3000   ZAR     <-- BRL -> ZAR -> EUR -> USD : TWO via hops
JPY  0.0064
```

A blank `VIA` column means the row is already a direct quote against the
reporting currency. A non-blank `VIA` column means the row gives the rate
from CCY to VIA, and you still need to convert from VIA to the reporting
currency.

## The via chain can be longer than one hop

This is the part that is easy to get wrong. The via currency named on a row
is **not guaranteed to be a direct quote**, it may have its own non-blank
via column, which in turn may have another, and so on. A single via lookup
is therefore only correct when the via happens to be direct. To get a
correct effective rate you must **follow the chain**: keep multiplying in the
next leg's primary rate, moving to that leg's via, until you reach a row
whose via is blank (a true direct quote against the reporting currency).

```
effective_rate(CCY) = primary(CCY) × primary(via(CCY)) × primary(via(via(CCY))) × …
                      ────────────────────────────────────────────────────────────
                      until the via column is blank (a direct quote)
```

Worked examples against the table above:

The rest: https://github.com/benchflow-ai/skillsbench/blob/HEAD/tasks-extra/cobol-gl-batch-reconcile/environment/skills/triangulated-fx-rates/SKILL.md
