arb.spread_matrix
Calculate net arbitrage spread between Coinbase spot and DEX pool prices after gas costs to determine if a cross-venue trade is profitable.
Instructions
CEX-DEX arbitrage spread calculator: checks whether a global reference
price (Coinbase spot, CoinGecko fallback - NOT a specific exchange
orderbook, despite internal naming) and a DEX pool price (GeckoTerminal)
diverge enough to be worth trading after an assumed flat gas cost. Returns
gross/net spread, direction, and is_profitable.
Use this before executing a cross-venue arbitrage trade, or for kimchi-style
premium checks on non-Korean venues (use market.kimchi_alert instead for the
Upbit-specific case). net_spread_pct does NOT subtract the DEX pool's own
swap fee (see pool_fee_pct, typically 0.05-1%), CEX trading fees, CEX
deposit/withdrawal availability, or slippage beyond trade_size_usd - a
spread that clears the threshold before those costs may not clear it after,
so always re-verify with live quotes before executing. Requires exactly one
of pool_address or token_address; passing neither raises "invalid_input".
Args:
symbol: Ticker symbol, e.g. "SUI", "BTC", "ETH".
network: GeckoTerminal network id (default "base").
trade_size_usd: Hypothetical trade size in USD (default 1000.0).
min_spread_threshold_pct: Net spread threshold (%) above which
is_profitable is true (default 0.8).
pool_address: A specific DEX pool contract address.
token_address: Token contract address (auto-picks the most liquid pool).
One of pool_address or token_address is required.
Returns:
On success: {"success": true, "gross_spread_pct", "net_spread_pct",
"direction", "is_profitable", ...}
On failure: {"success": false, "error": {"type", "message"}}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| network | No | base | |
| pool_address | No | ||
| token_address | No | ||
| trade_size_usd | No | ||
| min_spread_threshold_pct | No |