Coding

CAI: gtrade-with-cai

Try it

Trade gTrade perps via CAI — defi_markets, defi_preflight, defi_trade, defi_order_status, hosted /act enrollment. Requires platform or full API scope. Powere...

What it does

Trade gTrade perps via CAI — defi_markets, defi_preflight, defi_trade, defi_order_status, hosted /act enrollment. Requires platform or full API scope. Powered by CAI.com. Canonical skill v1.0.17.

The skill document

gTrade with CAI (Route B)

CAI E-mode lets an agent trade gTrade perps using the custodial wallet after the user enables the platform at /automation-settings and completes one hosted enrollment on cai.com /act. Prefer unified defi_trade over legacy per-platform tools.

When to Use

  • "Trade gTrade with my CAI wallet"
  • "Enable agent trading on Gains / gTrade"
  • "Open a small BTC perp on Arbitrum or Polygon via CAI"
  • "Check my gTrade order status after placing a trade"

Route B task flow (preferred)

  1. User enables gtrade at https://cai.com/automation-settings (browser; not API-key callable).
  2. platform_readiness with platform_slug=gtrade (optional chain: arbitrum | polygon). If ready_to_trade is false, show blocking_reasons and stop.
  3. If not enrolled: platform_automation_enroll with platform_slug=gtrade and chain → return url; user must complete /act (agent must not confirm for the user).
  4. Markets: defi_markets with platform_slug=gtrade and chain — resolve pair_index from catalog.
  5. Preflight: defi_preflight until valid: true.
  6. Place: defi_trade with body example:
    • platform_slug: gtrade
    • action: place
    • collateral_amount, pair_index, leverage, buy, chain, intent_usd
  7. Status (primary): poll defi_order_status with returned order_id until is_terminal: true.
  8. Status (secondary): use defi_orders with ?platform_slug=gtrade&status=active for resting orders; status=terminal for history.
  9. Close: defi_trade with action: close, optional trade_index (omit when exactly one matching long), symbol / pair_index, close_mode=full, chain.
  10. Sell guard: place + buy=false without long → preflight NO_POSITION_TO_CLOSE — use action=close instead.

Legacy aliases (deprecated)

  • gtrade_open_trade / gtrade_close_trade — do not use in new flows.

Chain parameter

  • chain: arbitrum (default) | polygon
  • Enrollment may require enroll_approve per chain (gtrade_arb_v1, gtrade_pol_v1).

Honesty

  • gap_id: GAP_DEFI_GTRADE_V1, GAP_DEFI_AUTOMATION_V1partial_live until enrollment + trade smokes pass in your environment.
  • Server must include gtrade in DEFI_ENABLED_PLATFORMS and CUSTODIAL_DEFI_AUTOMATION_ENABLED=true.
  • Do not use raw EVM calldata, generic sign-and-broadcast, or CAI_EVM_TX_PATH.

Quick Setup

openclaw secrets set CAI_API_KEY "your_dashboard_api_key"

Scope: platform or full.

Canonical Reference

Related skills

Trade Hyperliquid perps via CAI — defi_markets, defi_preflight, defi_trade, defi_order_status, no HL website signup. Requires platform or full API scope. Pow...

7 installs

Trade Ostium RWA perps on Arbitrum via CAI — defi_markets, defi_preflight, defi_trade, defi_order_status, hosted /act enrollment. Requires platform or full A...

7 installs

CAI.com v1.0.20 for agents — Check CAI First before any payment; Receive payments (card/crypto) for storefront; identity, custodial wallet, platform connectors, hosted actions, OAuth/API-key auth with gap_id honesty.

20 installs

One Spraay gateway URL for batch payments, DeFi quotes, AI inference, and on-chain data.

24 installs1 stars

Use this skill for Elfa API crypto social intelligence and Auto condition-engine workflows: trending tokens, narratives, mentions, smart account stats, token...

Bybit AI Trading Skill — Trade on Bybit using natural language. Covers spot, derivatives, earn, and more. Works with Claude, ChatGPT, OpenClaw, and any AI assistant.

20 installs1 stars