nautilus_trader icon indicating copy to clipboard operation
nautilus_trader copied to clipboard

DEX AMM adapter support - implementation feasibility

Open learnerLj opened this issue 3 months ago • 3 comments

Background

We're interested in implementing DEX (Decentralized Exchange) AMM (Automated Market Maker) adapters for NautilusTrader to enable DEX strategies. However, we've identified some fundamental architecture differences.

Key Challenges

  1. Architecture Mismatch:

    • Current framework assumes CLOB (order books, limit/market orders)
    • AMM uses liquidity pools with direct swaps only
  2. Different Data Models:

    • Order book data vs liquidity pool reserves
    • Price calculation: bid/ask spreads vs mathematical formulas
  3. Blockchain Complexity:

    • Gas fees and network congestion
    • Asynchronous transaction confirmation
    • MEV protection requirements

Questions

  1. Roadmap: Are there plans to support DEX/AMM integration?
  2. Implementation: What's the recommended approach for AMM adapters?
  3. Complexity: Is this feasible as a community contribution?
  4. Guidance: Any architectural suggestions for bridging CLOB concepts to AMM operations?

Use Case

Enable strategies that simultaneously trade on centralized exchanges (Binance, OKX) and decentralized exchanges (Uniswap, SushiSwap) for arbitrage opportunities.

learnerLj avatar Sep 21 '25 14:09 learnerLj

Hi @learnerLj

Yes, support for DEX AMM integrations including execution is planned and being worked on at the moment. You should see progress here very soon with the addition of tick maps and improved pool profiling and state management (likely this week).

There is no concrete timeline for when this will be fully supported.

cjdsellers avatar Sep 21 '25 23:09 cjdsellers

Thank you for your answer. I am quite confused about how to add the feature by myself. It's very complicated to add new feature, for example, to adjust the price by the quantity number. It just has so many layers like the PyO3 and the FFI invocation by the Python.

learnerLj avatar Sep 22 '25 08:09 learnerLj

Hi @learnerLj

Indeed, it's not clear but all DeFi machinery is going into the v2 system only - so there is actually no FFI for it. Python bindings are via PyO3 rather than Cython.

Things are also very fluid and moving quickly so interfaces can change. I'd suggest waiting a little while before attempting any integrations for DeFi.

cjdsellers avatar Sep 22 '25 09:09 cjdsellers