home / skills / openclaw / skills / exchange-rates

exchange-rates skill

/skills/mrinvincible29/exchange-rates

This skill fetches live mid-market exchange rates between currencies using XE.com and returns clearly formatted results.

npx playbooks add skill openclaw/skills --skill exchange-rates

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
1.6 KB
---
name: exchange-rates
description: >
  Fetch live exchange rates between any currency pairs from XE.com.
  Use when: user asks about currency conversion, exchange rates, forex rates, or converting amounts between currencies (e.g., "USD to INR", "100 EUR in GBP", "what's the dollar rate", "how much is 500 euros").
  Don't use when: user asks about stock prices, crypto prices, or financial markets — those are web searches, not currency conversions.
  Output: JSON with rate, converted amount, and source. Present cleanly with unit rate and total.
---

# Exchange Rates (XE.com)

Fetch live mid-market exchange rates from XE.com via headless browser.

## Usage

```bash
node ~/clawd/skills/exchange-rates/scripts/xe-rate.mjs <FROM> <TO> [AMOUNT]
```

**Examples:**
```bash
node ~/clawd/skills/exchange-rates/scripts/xe-rate.mjs USD INR        # 1 USD → INR
node ~/clawd/skills/exchange-rates/scripts/xe-rate.mjs EUR USD 500    # 500 EUR → USD
node ~/clawd/skills/exchange-rates/scripts/xe-rate.mjs THB INR 1000   # 1000 THB → INR
```

**Output:** JSON with `amount`, `from`, `to`, `rate`, `converted`, `source`, `timestamp`

## Response Format

Present results cleanly:
- Show the converted amount prominently
- Include the unit rate (1 FROM = X TO)
- Mention source is XE.com mid-market rate
- For amounts > 1, show both unit rate and total conversion

## Notes

- Uses Playwright + Browserless (CDP) to scrape XE.com
- Falls back to exchangerate-api.com if XE fails
- Currency codes: standard 3-letter ISO 4217 (USD, INR, EUR, GBP, THB, JPY, etc.)
- Rates are mid-market (not buy/sell spreads)
- Script takes ~4-5 seconds per lookup (browser overhead)

Overview

This skill fetches live mid-market exchange rates from XE.com and returns clean JSON results for currency conversion. It is designed for quick, accurate checks of unit rates and converted totals when you need current forex information. The tool falls back to a secondary provider if XE is unavailable.

How this skill works

The skill uses a headless browser to scrape XE.com and extract the mid-market rate for a given currency pair. It accepts a FROM currency, a TO currency, and an optional AMOUNT, then returns JSON with amount, rate, converted total, source, and timestamp. If XE fails, it uses exchangerate-api.com as a fallback to ensure a result.

When to use it

  • Convert an amount between two currencies (e.g., 100 EUR to USD).
  • Check the current mid-market unit rate (1 FROM = X TO).
  • Populate invoices, receipts, or reports with up-to-date forex values.
  • Quick rate checks while budgeting for travel or international payments.
  • Validate pricing or model assumptions that depend on current exchange rates.

Best practices

  • Always use standard 3-letter ISO currency codes (USD, EUR, INR, GBP, JPY).
  • Provide an explicit amount when you need the converted total; otherwise request the unit rate.
  • Allow ~4–5 seconds per lookup for the headless browser to complete scraping.
  • Cache results briefly for repeated requests to reduce latency and rate pressure.
  • Treat returned rates as mid-market reference values, not buy/sell rates from a bank.

Example use cases

  • Get the unit rate for USD→INR to display '1 USD = X INR' in an app.
  • Convert 500 EUR to GBP for a travel reimbursement calculation.
  • Verify exchange rates before creating a client invoice billed in a foreign currency.
  • Batch-convert a list of amounts for financial reporting or analytics.
  • Quickly compare live mid-market rates during basic forex monitoring.

FAQ

How accurate are the rates?

Rates are mid-market quotes scraped from XE.com and are accurate as reference values. They do not include bank spreads, fees, or retail buy/sell margins.

What if XE.com is unavailable?

The skill automatically falls back to exchangerate-api.com so you still receive a rate, though the source will reflect the fallback provider.

How long does a lookup take?

Expect about 4–5 seconds per lookup due to headless browser startup and scraping. Use caching for frequent queries.