Skip to content

feat(agents): implement cross-market consistency arbitrage strategy (#108) - #191

Open
ryder777777 wants to merge 1 commit into
OracleDesk:developfrom
ryder777777:feat/issue-108-cross-market-arbitrage
Open

ryder777777 wants to merge 1 commit into
OracleDesk:developfrom
ryder777777:feat/issue-108-cross-market-arbitrage

Conversation

@ryder777777

@ryder777777 ryder777777 commented Oct 20, 2026 •

Copy link
Copy Markdown

What this does

Implements cross-market consistency arbitrage (exhaustive_partition, mutually_exclusive, and monotonic_chain) and adds the off-chain calc_buy inverse (collateral_for_shares / collateralForShares) to both model/fpmm_model.py and agents/core/fpmm.ts.

  • model/fpmm_model.py & agents/core/fpmm.ts: solve the constant-product quadratic for net collateral and refine across ceiling boundaries, verified by 1,000 random pool/target property checks.
  • agents/core/arb/relations.ts: relation loader, validator, and automatic monotonic chain discovery across open price-threshold markets sharing (oracle, asset, comparison, closeTime).
  • agents/core/arb/detect.ts & agents/core/arb/execute.ts & agents/bin/arb.ts: multi-leg FPMM trade sizing (sizeDutchBook), fresh pre-quote checks across all legs, shared trace recording, and reverse-order agentSellV2 unwind if a middle leg fails.
    Tested with python3 model/fpmm_model.py and cd agents && npm test && npm run build.

Closes #108

Checklist

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test pass
  • Soroban storage keys and checked integer arithmetic verified
  • No secrets or hardcoded keys included

How this was tested

Verified unit test cases covering nominal thresholds, boundary conditions, and deterministic state transitions.

@ryder777777
ryder777777 force-pushed the feat/issue-108-cross-market-arbitrage branch 2 times, most recently from 148d902 to 31e946e Compare October 23, 2026 21:32
@ryder777777
ryder777777 force-pushed the feat/issue-108-cross-market-arbitrage branch from 31e946e to fa6bee4 Compare October 23, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a cross-market consistency arbitrage strategy for related markets

1 participant