KosmoKrator

finance

CoinGecko Lua API for KosmoKrator Agents

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

8 functions 8 read 0 write API key auth

Lua Namespace

Agents call this integration through app.integrations.coingecko.*. Use lua_read_doc("integrations.coingecko") 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.

CoinGecko — Lua API Reference

Important: Coin IDs vs Ticker Symbols

CoinGecko tools use CoinGecko IDs (e.g. "bitcoin", "ethereum", "solana"), not ticker symbols ("BTC", "ETH"). If you only know the ticker, use search_coins first to find the correct ID.

Rate limits: free tier allows ~30 calls/min.

search_coins

Find coin IDs by name or ticker symbol.

NameTypeRequiredDescription
querystringyesCoin name or ticker (e.g. "bitcoin", "ETH")
local result = app.integrations.coingecko.search_coins({ query = "SOL" })

-- result.coins is an array of { id, name, symbol, market_cap_rank }
for _, coin in ipairs(result.coins) do
  print(coin.id .. " (" .. coin.symbol .. ") — rank #" .. (coin.market_cap_rank or "?"))
end

price

Get current price for one or more coins. Includes 24h change, volume, and market cap.

NameTypeRequiredDescription
idsstringyesComma-separated CoinGecko IDs (e.g. "bitcoin,ethereum")
currenciesstringnoComma-separated target currencies (default: "usd")
local result = app.integrations.coingecko.price({
  ids = "bitcoin,ethereum",
  currencies = "usd,eur"
})

market_rankings

Top coins ranked by market cap with full market data.

NameTypeRequiredDescription
idsstringnoFilter to specific coin IDs
currencystringnoTarget currency (default: "usd")
categorystringnoFilter by category (e.g. "decentralized-finance-defi")
per_pagestringnoResults per page (default: "20", max: 100)
pagestringnoPage number (default: "1")
price_change_percentagestringnoTimeframes (default: "24h,7d"). Options: 1h,24h,7d,14d,30d,200d,1y
local result = app.integrations.coingecko.market_rankings({
  per_page = "10",
  price_change_percentage = "24h,7d,30d"
})

for _, coin in ipairs(result.coins) do
  print("#" .. coin.market_cap_rank .. " " .. coin.name .. ": $" .. coin.current_price)
end

Examples

Search for a coin, then get its price

-- Step 1: find the coin ID
local search = app.integrations.coingecko.search_coins({ query = "Cardano" })
local coin_id = search.coins[1].id  -- "cardano"

-- Step 2: get the price
local price = app.integrations.coingecko.price({
  ids = coin_id,
  currencies = "usd,btc"
})

Top 10 coins by market cap

local result = app.integrations.coingecko.market_rankings({
  per_page = "10",
  currency = "usd"
})

for _, coin in ipairs(result.coins) do
  print(coin.name .. ": $" .. coin.current_price .. " (24h: " .. (coin.price_change_percentage_24h or "?") .. "%)")
end

Compare specific coins

local result = app.integrations.coingecko.market_rankings({
  ids = "bitcoin,ethereum,solana",
  currency = "usd",
  price_change_percentage = "1h,24h,7d"
})
Raw agent markdown
# CoinGecko — Lua API Reference

## Important: Coin IDs vs Ticker Symbols

CoinGecko tools use CoinGecko IDs (e.g. `"bitcoin"`, `"ethereum"`, `"solana"`), **not** ticker symbols (`"BTC"`, `"ETH"`). If you only know the ticker, use `search_coins` first to find the correct ID.

**Rate limits:** free tier allows ~30 calls/min.

## search_coins

Find coin IDs by name or ticker symbol.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query` | string | yes | Coin name or ticker (e.g. `"bitcoin"`, `"ETH"`) |

```lua
local result = app.integrations.coingecko.search_coins({ query = "SOL" })

-- result.coins is an array of { id, name, symbol, market_cap_rank }
for _, coin in ipairs(result.coins) do
  print(coin.id .. " (" .. coin.symbol .. ") — rank #" .. (coin.market_cap_rank or "?"))
end
```

## price

Get current price for one or more coins. Includes 24h change, volume, and market cap.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ids` | string | yes | Comma-separated CoinGecko IDs (e.g. `"bitcoin,ethereum"`) |
| `currencies` | string | no | Comma-separated target currencies (default: `"usd"`) |

```lua
local result = app.integrations.coingecko.price({
  ids = "bitcoin,ethereum",
  currencies = "usd,eur"
})
```

## market_rankings

Top coins ranked by market cap with full market data.

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `ids` | string | no | Filter to specific coin IDs |
| `currency` | string | no | Target currency (default: `"usd"`) |
| `category` | string | no | Filter by category (e.g. `"decentralized-finance-defi"`) |
| `per_page` | string | no | Results per page (default: `"20"`, max: 100) |
| `page` | string | no | Page number (default: `"1"`) |
| `price_change_percentage` | string | no | Timeframes (default: `"24h,7d"`). Options: `1h,24h,7d,14d,30d,200d,1y` |

```lua
local result = app.integrations.coingecko.market_rankings({
  per_page = "10",
  price_change_percentage = "24h,7d,30d"
})

for _, coin in ipairs(result.coins) do
  print("#" .. coin.market_cap_rank .. " " .. coin.name .. ": $" .. coin.current_price)
end
```

## Examples

### Search for a coin, then get its price

```lua
-- Step 1: find the coin ID
local search = app.integrations.coingecko.search_coins({ query = "Cardano" })
local coin_id = search.coins[1].id  -- "cardano"

-- Step 2: get the price
local price = app.integrations.coingecko.price({
  ids = coin_id,
  currencies = "usd,btc"
})
```

### Top 10 coins by market cap

```lua
local result = app.integrations.coingecko.market_rankings({
  per_page = "10",
  currency = "usd"
})

for _, coin in ipairs(result.coins) do
  print(coin.name .. ": $" .. coin.current_price .. " (24h: " .. (coin.price_change_percentage_24h or "?") .. "%)")
end
```

### Compare specific coins

```lua
local result = app.integrations.coingecko.market_rankings({
  ids = "bitcoin,ethereum,solana",
  currency = "usd",
  price_change_percentage = "1h,24h,7d"
})
```

Metadata-Derived Lua Example

local result = app.integrations.coingecko.coingecko_global({})
print(result)

Functions

coingecko_global

Get overall crypto market statistics — total market cap, BTC dominance, active cryptocurrencies, trading volume, and more.

Operation
Read read
Full name
coingecko.coingecko_global
ParameterTypeRequiredDescription
No parameters.

coingecko_history

Get historical price, volume, and market cap chart data for a cryptocurrency over a time period. Returns timestamped data points with summary statistics.

Operation
Read read
Full name
coingecko.coingecko_history
ParameterTypeRequiredDescription
id string yes CoinGecko coin ID (e.g. "bitcoin", "ethereum", "solana"). Use coingecko_search_coins to find IDs.
currency string no Target currency (default: "usd").
days string no Number of days of history (default: "30"). Common values: 1, 7, 14, 30, 90, 365.

coingecko_info

Get a full coin profile — description, categories, links (website, whitepaper, social), and current market data snapshot. Use `coingecko_search_coins` first to find the coin ID.

Operation
Read read
Full name
coingecko.coingecko_info
ParameterTypeRequiredDescription
id string yes CoinGecko coin ID (e.g. "bitcoin", "ethereum", "solana"). Use coingecko_search_coins to find IDs.

coingecko_markets

Get top cryptocurrencies ranked by market cap with full market data (price, volume, ATH, supply, price changes). Supports filtering by category or specific coin IDs.

Operation
Read read
Full name
coingecko.coingecko_markets
ParameterTypeRequiredDescription
ids string no Comma-separated CoinGecko coin IDs to filter to specific coins (e.g. "bitcoin,ethereum,solana").
currency string no Target currency (default: "usd"). Common: usd, eur, gbp, btc.
category string no Filter by category (e.g. "decentralized-finance-defi", "layer-1"). Use coingecko_search_coins to find category IDs.
per_page string no Number of results per page (default: "20", max: 100).
page string no Page number for pagination (default: "1").
price_change_percentage string no Comma-separated price change timeframes (default: "24h,7d"). Options: 1h, 24h, 7d, 14d, 30d, 200d, 1y.

coingecko_ohlc

Get OHLC (Open/High/Low/Close) candlestick data for a cryptocurrency for technical analysis.

Operation
Read read
Full name
coingecko.coingecko_ohlc
ParameterTypeRequiredDescription
id string yes CoinGecko coin ID (e.g. "bitcoin", "ethereum", "solana"). Use coingecko_search_coins to find IDs.
currency string no Target currency (default: "usd").
days string no Number of days of OHLC data (default: "30"). Common values: 1, 7, 14, 30, 90, 365.

coingecko_price

Get current price for one or more cryptocurrencies (by CoinGecko ID). Includes 24h change, volume, and market cap. Use `coingecko_search_coins` first to find coin IDs.

Operation
Read read
Full name
coingecko.coingecko_price
ParameterTypeRequiredDescription
ids string yes Comma-separated CoinGecko coin IDs (e.g. "bitcoin,ethereum,solana"). Use coingecko_search_coins to find IDs.
currencies string no Comma-separated target currencies (default: "usd"). E.g. "usd,eur,btc".

coingecko_search_coins

Find cryptocurrencies by name or ticker symbol (e.g. "bitcoin", "ETH", "solana"). Returns matching coin IDs which are needed for other CoinGecko tools.

Operation
Read read
Full name
coingecko.coingecko_search_coins
ParameterTypeRequiredDescription
query string yes Search query — coin name or ticker symbol (e.g. "bitcoin", "ETH").