execute_onchain_swap
Execute a REAL on-chain swap on Robinhood Chain via the Rialto router,
signed by Otto's server-side trading wallet. side=buy spends usd_amount
USDG to buy the ticker's Hood token; side=sell sells qty tokens back to
USDG. The server enforces hard guardrails independently of the caller:
USDG<->allowlisted-token pairs only, per-trade and daily USD caps, and a
slippage cap. On success the matching order_filled/position_closed event
(payload mode=onchain, with tx_hash) is written automatically — the
position book, performance stats and trade chart update without a
separate report_agent_status call. key: the operator's OTTO_AGENT_KEY.
agent: gap-trader | narrative-trader. Returns tx_hash, fill qty/price/usd
and pnl_bps (sells with a known entry).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| qty | No | ||
| side | Yes | ||
| agent | No | gap-trader | |
| reason | No | ||
| run_id | No | ||
| ticker | Yes | ||
| usd_amount | No | ||
| slippage_bps | No |