Triangulated Fx Rates logo

Triangulated Fx Rates

OrganizationPopular
benchflow-ai
triangulated-fx-rates

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.

Overview

Publisherbenchflow-ai
Repositoryskillsbench
Skill nametriangulated-fx-rates
Stars
1.8K
Forks
367
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by benchflow-ai on GitHub. Read the source before you install it.

Installation

Install the Triangulated Fx Rates AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git /tmp/skillsbench
mkdir -p .claude/skills
cp -r /tmp/skillsbench/tasks-extra/cobol-gl-batch-reconcile/environment/skills/triangulated-fx-rates .claude/skills/triangulated-fx-rates
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Triangulated Fx Rates in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Triangulated Fx Rates on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Triangulated Fx Rates is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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:

  • One hop (CHF): CHF→EUR is 0.9200, EUR is direct (1.0850). 0.9200 × 1.0850 = 0.99820 → 0.9982 (4dp).
  • Two hops (BRL): BRL→ZAR is 0.3000, ZAR→EUR is 0.0650, EUR is direct (1.0850). 0.3000 × 0.0650 × 1.0850 = 0.0211575 → 0.0212 (4dp). Stopping after the first via (treating ZAR's 0.0650 as if it were ZAR→USD) gives 0.3000 × 0.0650 = 0.0195, wrong by the whole EUR leg.

Failure modes

Two distinct defects show up here:

  1. No multiply at all — the via is read into a field but the row rate is used verbatim. Triangulated currencies are then off by a multiplicative factor equal to the rest of the chain.
  2. Single-hop only — the first via is multiplied in, but the code assumes that via is always direct and never checks whether the via has its own via. One-hop currencies look correct; multi-hop currencies are wrong by every leg past the first. This one is subtle because the common currencies are usually one hop, so it passes casual inspection.

Rounding

Carry the running product at full precision (enough decimals that no intermediate leg is truncated — the product of N four-decimal rates has up to 4·N decimals) and round once at the end to the rate field's precision (typically 4 decimals) with COMPUTE … ROUNDED (half-away-from-zero in COBOL, matching Python Decimal ROUND_HALF_UP). Rounding each leg to the rate-field precision before the next multiply corrupts low-rate currencies.

Control flow (placeholder names)

Resolve the rate with a loop that walks the chain, not a one-shot via lookup. Sketched with generic names — substitute your own rate-table and working-storage identifiers:

cobol
       *> placeholders: acc is a wide running product, cur is the currency
       *> currently being resolved, leg/leg-via come from the matched row.
       acc := 1
       cur := <currency to price>
       REPEAT
           (leg, leg-via) := primary-rate and via of the row matching cur
           acc := acc * leg                 *> carry full precision, no per-hop round
           IF leg-via is blank
               done
           ELSE
               cur := leg-via               *> follow the chain one more hop
           END-IF
       UNTIL done
       eff := ROUND(acc) to the rate-field precision

A guard on the maximum number of hops is prudent so a malformed (cyclic) via column cannot loop forever. How you store acc/eff and which field you round into depend on your program's own declarations.

Verification tip

Pick the currency with the longest via chain and compute its effective rate by hand, multiplying every leg through to the direct quote, then reconcile against one account whose balance is entirely in that currency. If single-hop currencies reconcile but the multi-hop one is off by a clean constant factor, the chain is being cut short after the first via.

References

  • ISO 4217 currency codes used in the CCY / VIA columns
  • IBM Enterprise COBOL Language Reference for COMPUTE … ROUNDED semantics and PIC … V… decimal alignment

Frequently asked questions

What does the Triangulated Fx Rates AI skill do?

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.

Why use Triangulated Fx Rates on TypingMind?

Because you install it once and use it with any model. Triangulated Fx Rates is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Triangulated Fx Rates in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/benchflow-ai/skillsbench/tree/main/tasks-extra/cobol-gl-batch-reconcile/environment/skills/triangulated-fx-rates. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Triangulated Fx Rates?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Triangulated Fx Rates?

As many as you like. As long as a model supports skills, you can use Triangulated Fx Rates with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Triangulated Fx Rates AI skill free?

Yes. It is published on GitHub by benchflow-ai under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇