KosmoKrator

data

ExchangeRate Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the ExchangeRate KosmoKrator integration.

5 functions 5 read 0 write No credentials auth

Lua Namespace

Agents call this integration through app.integrations.exchangerate.*. Use lua_read_doc("integrations.exchangerate") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Exchange Rate — Lua API Reference

No API key needed. Supports 340+ currencies: fiat, crypto, and precious metals.

convert_currency

Convert an amount from one currency to another.

NameTypeRequiredDescription
fromstringyesSource currency code (e.g. "usd", "btc", "xau")
tostringyesTarget currency code (e.g. "eur", "jpy")
amountstringnoAmount to convert (default: "1")
datestringnoDate for the rate: "YYYY-MM-DD" or "latest" (default)
local result = app.integrations.exchangerate.convert_currency({
  from = "usd",
  to = "eur",
  amount = "100"
})

print("100 USD = " .. result.result .. " EUR")

history

Compare a currency pair across multiple dates.

NameTypeRequiredDescription
fromstringyesSource currency code
tostringyesTarget currency code
datesstringyesComma-separated dates (e.g. "2026-01-01,2026-02-01,2026-03-01")
local result = app.integrations.exchangerate.history({
  from = "usd",
  to = "eur",
  dates = "2026-01-01,2026-02-01,2026-03-01"
})

for _, h in ipairs(result.history) do
  print(h.date .. ": " .. h.rate)
end
-- result.change.percentage shows overall change

list_currencies

List and search available currencies.

NameTypeRequiredDescription
querystringnoFilter by code or name (e.g. "dollar", "btc", "gold")
local result = app.integrations.exchangerate.list_currencies({ query = "gold" })

for _, c in ipairs(result.currencies) do
  print(c.code .. ": " .. c.name)
end

exchange_rates

Get all exchange rates for a base currency.

NameTypeRequiredDescription
basestringyesBase currency code (e.g. "usd")
currenciesstringnoComma-separated codes to filter (e.g. "eur,gbp,jpy")
datestringnoDate for the rate: "YYYY-MM-DD" or "latest" (default)
local result = app.integrations.exchangerate.exchange_rates({
  base = "usd",
  currencies = "eur,gbp,jpy"
})

Show commonly used currency codes. No parameters.

local result = app.integrations.exchangerate.popular_currencies({})

Examples

Convert 500 EUR to USD

local result = app.integrations.exchangerate.convert_currency({
  from = "eur",
  to = "usd",
  amount = "500"
})

Historical rate on a specific date

local result = app.integrations.exchangerate.convert_currency({
  from = "gbp",
  to = "jpy",
  amount = "1",
  date = "2025-06-15"
})

Track EUR/USD over several months

local result = app.integrations.exchangerate.history({
  from = "eur",
  to = "usd",
  dates = "2025-10-01,2025-11-01,2025-12-01,2026-01-01,2026-02-01,2026-03-01"
})

print("Change: " .. result.change.percentage .. "%")

Find a currency code

local result = app.integrations.exchangerate.list_currencies({ query = "peso" })
-- Returns matching currencies like MXN (Mexican Peso), ARS (Argentine Peso), etc.
Raw agent markdown
# Exchange Rate — Lua API Reference

No API key needed. Supports 340+ currencies: fiat, crypto, and precious metals.

## convert_currency

Convert an amount from one currency to another.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from` | string | yes | Source currency code (e.g. `"usd"`, `"btc"`, `"xau"`) |
| `to` | string | yes | Target currency code (e.g. `"eur"`, `"jpy"`) |
| `amount` | string | no | Amount to convert (default: `"1"`) |
| `date` | string | no | Date for the rate: `"YYYY-MM-DD"` or `"latest"` (default) |

```lua
local result = app.integrations.exchangerate.convert_currency({
  from = "usd",
  to = "eur",
  amount = "100"
})

print("100 USD = " .. result.result .. " EUR")
```

## history

Compare a currency pair across multiple dates.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `from` | string | yes | Source currency code |
| `to` | string | yes | Target currency code |
| `dates` | string | yes | Comma-separated dates (e.g. `"2026-01-01,2026-02-01,2026-03-01"`) |

```lua
local result = app.integrations.exchangerate.history({
  from = "usd",
  to = "eur",
  dates = "2026-01-01,2026-02-01,2026-03-01"
})

for _, h in ipairs(result.history) do
  print(h.date .. ": " .. h.rate)
end
-- result.change.percentage shows overall change
```

## list_currencies

List and search available currencies.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query` | string | no | Filter by code or name (e.g. `"dollar"`, `"btc"`, `"gold"`) |

```lua
local result = app.integrations.exchangerate.list_currencies({ query = "gold" })

for _, c in ipairs(result.currencies) do
  print(c.code .. ": " .. c.name)
end
```

## exchange_rates

Get all exchange rates for a base currency.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `base` | string | yes | Base currency code (e.g. `"usd"`) |
| `currencies` | string | no | Comma-separated codes to filter (e.g. `"eur,gbp,jpy"`) |
| `date` | string | no | Date for the rate: `"YYYY-MM-DD"` or `"latest"` (default) |

```lua
local result = app.integrations.exchangerate.exchange_rates({
  base = "usd",
  currencies = "eur,gbp,jpy"
})
```

## popular_currencies

Show commonly used currency codes. No parameters.

```lua
local result = app.integrations.exchangerate.popular_currencies({})
```

## Examples

### Convert 500 EUR to USD

```lua
local result = app.integrations.exchangerate.convert_currency({
  from = "eur",
  to = "usd",
  amount = "500"
})
```

### Historical rate on a specific date

```lua
local result = app.integrations.exchangerate.convert_currency({
  from = "gbp",
  to = "jpy",
  amount = "1",
  date = "2025-06-15"
})
```

### Track EUR/USD over several months

```lua
local result = app.integrations.exchangerate.history({
  from = "eur",
  to = "usd",
  dates = "2025-10-01,2025-11-01,2025-12-01,2026-01-01,2026-02-01,2026-03-01"
})

print("Change: " .. result.change.percentage .. "%")
```

### Find a currency code

```lua
local result = app.integrations.exchangerate.list_currencies({ query = "peso" })
-- Returns matching currencies like MXN (Mexican Peso), ARS (Argentine Peso), etc.
```

Metadata-Derived Lua Example

local result = app.integrations.exchangerate.exchangerate_list_currencies({
  query = "example_query"
})
print(result)

Functions

exchangerate_list_currencies

List all available currencies (fiat, crypto, precious metals, stablecoins). Supports 340+ assets. Optionally filter by name or code.

Operation
Read read
Full name
exchangerate.exchangerate_list_currencies
ParameterTypeRequiredDescription
query string no Filter currencies by code or name (e.g. "dollar", "btc", "gold").

exchangerate_convert_currency

Convert an amount from one currency to another. Supports 340 fiat currencies, cryptocurrencies, and precious metals. Common codes: usd, eur, gbp, jpy, cny, chf, cad, aud, btc, eth, sol, xau, xag.

Operation
Read read
Full name
exchangerate.exchangerate_convert_currency
ParameterTypeRequiredDescription
from string yes Source currency code (e.g. "usd", "btc", "xau").
to string yes Target currency code (e.g. "eur", "jpy").
amount string no Amount to convert (default: "1").
date string no Date for the rate (default: "latest"). Format: "YYYY-MM-DD" or "latest".

exchangerate_rates

Get all exchange rates for a base currency. Optionally filter to specific target currencies. Supports 340 fiat currencies, cryptocurrencies, and precious metals.

Operation
Read read
Full name
exchangerate.exchangerate_rates
ParameterTypeRequiredDescription
base string yes Base currency code (e.g. "usd", "btc").
date string no Date for rates (default: "latest"). Format: "YYYY-MM-DD" or "latest".
currencies string no Comma-separated currency codes to filter (e.g. "eur,gbp,jpy"). Shows popular currencies if omitted.

exchangerate_history

Compare a currency pair across multiple dates to see rate changes over time. Returns each date's rate and the overall change.

Operation
Read read
Full name
exchangerate.exchangerate_history
ParameterTypeRequiredDescription
from string yes Source currency code (e.g. "usd", "btc", "xau").
to string yes Target currency code (e.g. "eur", "jpy").
dates string yes Comma-separated dates to compare (e.g. "2026-01-01,2026-02-01,2026-02-20").