DEX AMM adapter support - implementation feasibility
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
-
Architecture Mismatch:
- Current framework assumes CLOB (order books, limit/market orders)
- AMM uses liquidity pools with direct swaps only
-
Different Data Models:
- Order book data vs liquidity pool reserves
- Price calculation: bid/ask spreads vs mathematical formulas
-
Blockchain Complexity:
- Gas fees and network congestion
- Asynchronous transaction confirmation
- MEV protection requirements
Questions
- Roadmap: Are there plans to support DEX/AMM integration?
- Implementation: What's the recommended approach for AMM adapters?
- Complexity: Is this feasible as a community contribution?
- 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.
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.
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.
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.