Skip to content

feat: implement trading agent with decision tracking #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 12, 2025
Merged

Conversation

lumoswiz
Copy link
Owner

Adds a complete trading agent system.

Features

  • Add pydantic-ai integration for agent decisions
  • Implement price monitoring and trade metrics computation
  • Add trade context and metrics for decision making
  • Add persistence layer for decisions and reasoning
  • Implement decision validation and order flow
  • Add performance tracking with profitable status

Add pydantic-ai to project dependencies
Update pyproject.toml and uv.lock
Setup pydantic-ai agent with Claude-3
Add system prompt for price monitoring
Integrate with block execution handler
Add TradeMetrics model to track price and volume metrics for token pairs
Add TradeContext to provide agent with market data and token balances
Add AgentDecision model to structure agent's trading decisions
Implement multicall token balance fetching for monitored tokens
Add helper to create populated TradeContext with current market state
Add load/save functions for decisions database
Add helper to save new agent decisions with metrics
Store decisions in CSV
Add error handling for Anthropic API calls
Add _build_decision helper for structured AgentDecision creation
Add valid bool to AgentDecision model
Add MINIMUM_TOKEN_BALANCES for balance validation
Add _validate_decision for token pair and balance checks
Refactor _save_decision to use AgentDecision objects
Add order submission flow with error handling
Change profitable to int (0=false, 1=true, 2=not set)
Fix None value handling in decision builder
@lumoswiz lumoswiz merged commit 21edd12 into main Feb 12, 2025
4 checks passed
@lumoswiz lumoswiz deleted the feat/agent branch February 12, 2025 15:55
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.

1 participant