Skip to content

[strategy] Spot(AMM)–perp(GMX) basis & funding-rate arbitrage agent #30

Description

@adachi-440

Motivation

The GMX perp mark is pinned to the on-chain fair price every block, while AMM pools (Uniswap/Balancer/Curve) drift away from fair under orderflow. This creates a real, tradable spot–perp basis, and capturing it delta-neutrally is exactly the α-style edge the environment is meant to reward (ADR 0007).

Proposal

A spot(AMM)–perp(GMX) basis arbitrage agent:

  • Monitor basis = AMM spot price (per-venue observation, e.g. priceUsdcPerWeth) vs GMX mark (protocols.gmx.marketPriceUsd).
  • When |basis| exceeds total cost (AMM swap fee + GMX open/close + execution fee + expected keeper delay), open a delta-neutral pair: trade the mispriced AMM leg and take the opposite GMX position.
  • Close on convergence; size by basis magnitude vs cost, respecting keeper-latency risk (GMX orders execute asynchronously — avoid stacking duplicate opens while an order is pending).
  • Ship as example/agents/<id>/ with both agent.ts and prompt.md per ADR 0015.

Funding-rate (FR) leg — currently blocked on env support

Funding is not modeled today: the local GMX deployment leaves fundingFactor/borrowingFactor at 0, and no funding/OI fields are surfaced in GmxObservation. The strategy should treat funding as 0 for now, but be structured so an FR carry signal (harvest funding by holding the cheap side while delta-neutral) can slot in once the environment models funding and exposes it in the observation. That env work is out of scope for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststrategyAgent/strategy work (example/agents, trading logic)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions