How gerskill/moondev-trading-ai-agents works
Purpose and Entry Points
This is an experimental Python research system for AI-assisted crypto trading analysis, monitoring, risk checks, strategy research, and optional trade-decision workflows. The primary runtime entry point is src/main.py, which enables or disables agents. Other operational surfaces include a bot-oriented runner at src/ezbot.py, an API module at src/agents/api.py, and a separate frontend application at src/frontend/main.py.
Agent Runtime and Shared Contract
Agents are organized as independently runnable domain workers under src/agents/, with common behavior likely centralized in src/agents/base_agent.py. This boundary allows market-monitoring, analysis, risk, and research capabilities to evolve separately while being orchestrated from the main runtime.
• src/agents/base_agent.py
• src/agents/__init__.py
• src/main.py
Trading, Strategy, and Risk Decision Chain
The core decision-oriented path combines token/trade analysis, strategy execution or approval, and portfolio safety controls. The trading agent produces basic trade decisions from token data; the strategy agent manages strategies placed in the strategies package; the risk agent enforces position and PnL/minimum-balance constraints. Risk is an important boundary before any execution-oriented behavior.
• src/agents/trading_agent.py
• src/agents/strategy_agent.py
• src/agents/risk_agent.py
Strategies implement a separate extension layer, anchored by a base type and examples/custom strategy location rather than being embedded in agents.
• src/strategies/base_strategy.py
• src/strategies/custom/example_strategy.py
• src/strategies/example_strategy.py
Market Intelligence and Data Collection
Monitoring agents ingest and interpret crypto market signals including funding, liquidations, open interest, whale activity, listings, and CoinGecko token information. They persist or consume local CSV histories, creating a file-backed state boundary rather than a dedicated database.
• src/agents/funding_agent.py
• src/agents/liquidation_agent.py
• src/agents/whale_agent.py
• src/data/funding_history.csv
• src/data/liquidation_history.csv
• src/data/oi_history.csv
The README identifies a Moon Dev API v2-style market-data integration for funding, liquidation, open-interest, and CopyBot data, plus CoinGecko and Hyperliquid/Solana-oriented workflows. Required secrets include Anthropic and other trading/API keys.
AI Analysis and Notification Agents
Several agents apply LLM analysis to distinct inputs: charts, Twitter sentiment, CopyBot activity, and token listings. Outputs include buy/sell/nothing recommendations, saved analyses, historical sentiment, and voice alerts. LLM-provider configuration is centralized at the application level.
• src/agents/chartanalysis_agent.py
• src/agents/sentiment_agent.py
• src/agents/copybot_agent.py
• src/agents/listingarb_agent.py
• src/config.py
Tweet generation and sentiment-related artifacts are persisted locally.
• src/agents/tweet_agent.py
• src/data/sentiment_history.csv
• src/data/tweets/
Arbitrage and Research Pipelines
Specialized agents target funding-rate arbitrage and RBI strategy research. The RBI flow takes a strategy description/video/PDF concept, uses DeepSeek for research, and produces or supports coded backtests. Research inputs, generated strategy descriptions, backtests, and packaged backtests live together under data/rbi.
• src/agents/fundingarb_agent.py
• src/agents/rbi_agent.py
• src/data/rbi/research/
• src/data/rbi/backtests/
• src/data/rbi/backtests_package/
User/API Boundary and Infrastructure
The frontend is a standalone Python-served UI with HTML, JavaScript, CSS, and static assets. Programmatic access is exposed separately through the agents API module. The repository is Python-based with dependencies declared in requirements.txt; operational data is primarily CSV and local files.
• src/frontend/main.py
• src/frontend/templates/index.html
• src/frontend/static/js/main.js
• src/agents/api.py
• requirements.txt
Main entry points: main.py Main runtime · trading_agent.py Trade analysis · base_agent.py Agent contract · strategy_agent.py Strategy manager
Components 21
Runtime
- Main runtime · Enables and disables domain agents.
src/main.py - Agent contract · Shared behavior for independently runnable agents.
src/agents/base_agent.py - App configuration · Centralizes LLM-provider configuration.
src/config.py - Python dependencies
requirements.txt
Market intelligence
- Market monitors · Funding, liquidation, and whale signal workers.
- Funding monitor
src/agents/funding_agent.py - Liquidation monitor
src/agents/liquidation_agent.py - Whale monitor
src/agents/whale_agent.py - Market CSV history · Funding, liquidation, and open-interest histories.
src/data/funding_history.csv - LLM analysis agents · Chart, sentiment, CopyBot, and listing analysis.
- Sentiment analysis
src/agents/sentiment_agent.py - Sentiment history
src/data/sentiment_history.csv
Trading decisions
- Trade analysis · Produces basic trade decisions from token data.
src/agents/trading_agent.py - Strategy manager · Executes or approves strategy workflows.
src/agents/strategy_agent.py - Strategy extension layer · Base type for built-in and custom strategies.
src/strategies/base_strategy.py - Risk controls · Enforces position, PnL, and minimum-balance constraints.
src/agents/risk_agent.py
Research pipelines
- Funding arbitrage
src/agents/fundingarb_agent.py - RBI researcher · Uses DeepSeek research to support coded backtests.
src/agents/rbi_agent.py - RBI artifacts · Research inputs, strategy descriptions, and backtests.
Interfaces
- Programmatic API
src/agents/api.py - Frontend UI · Standalone Python-served interface.
src/frontend/main.py
Connections 27
- Main runtime → Agent contract: orchestrates
- Main runtime → Market monitors: runs
- Main runtime → LLM analysis agents: runs
- Main runtime → Trade analysis: runs
- Main runtime → Strategy manager: runs
- Main runtime → Risk controls: runs
- Agent contract → Market monitors: shared contract
- Agent contract → LLM analysis agents: shared contract
- Agent contract → Trade analysis: shared contract
- Market monitors → Funding monitor: includes
- Market monitors → Liquidation monitor: includes
- Market monitors → Whale monitor: includes
- Funding monitor → Market CSV history: persists history
- Liquidation monitor → Market CSV history: persists history
- LLM analysis agents → Sentiment analysis: includes
- Sentiment analysis → Sentiment history: persists history
- App configuration → LLM analysis agents: LLM settings
- Market monitors → Trade analysis: market signals
- LLM analysis agents → Trade analysis: recommendations
- Trade analysis → Strategy manager: trade decisions
- Strategy extension layer → Strategy manager: strategy implementations
- Strategy manager → Risk controls: proposed actions
- Market CSV history → Funding arbitrage: funding data
- RBI researcher → RBI artifacts: writes research and backtests
- Programmatic API → Main runtime: programmatic access
- Frontend UI → Main runtime: user operations
- Python dependencies → Main runtime: runtime dependencies