Build your first AI-powered trading agent that combines local language models with real-time market data to make autonomous trading decisions on Uniswap V4 without persistent memory.
USE_MLX_MODEL = True
in config.py
.REBALANCE_THRESHOLD = 0.5
(50% deviation) is set high to disable automatic rebalancing and route most decisions through the LLM for learning purposes.uniswap_v4_stateless_trading_agent.py
config.py
file with these:
Error getting LLM decision
, test your model’s response time manually and increase the TRADE_INTERVAL
in config.py
if your LLM takes longer than the configured interval to respond.ollama list
.
MLX-LM:
mlx_lm.manage --scan --pattern ""
.
If responses consistently take longer than your TRADE_INTERVAL
setting, increase the interval to allow sufficient processing time.
Model response quality
fetch_pool_data.py
, fetch_pool_stats.py
, fetch_pools_stats_from_fork.py