A cryptocurrency portfolio analysis agent that uses Schema-Guided Reasoning (SGR) to provide comprehensive portfolio reports and performance analysis for EVM and Solana wallets.
- Multi-chain wallet support (EVM networks and Solana)
- Historical portfolio performance tracking (daily, weekly, monthly)
- Real-time token balance and price data
- Portfolio composition and diversification analysis
- Performance comparison against market trends
- AI-powered insights using OpenAI GPT models
- Structured 5-step reasoning process
- Node.js 20+
- Yarn package manager
- OpenAI API key
- CoinGecko API key
- Alchemy API key
From the root of the monorepo:
yarn installCopy the .env.example file to .env and add your API keys:
cp .env.example .envThen edit .env with your actual API keys.
yarn startThe agent will analyze your wallet portfolio and provide comprehensive reports based on your request.
In src/index.ts, configure your wallet addresses and questions:
const walletAddresses = {
evm: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6', // Your Ethereum/EVM address
solana: '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM', // Your Solana address
};
const questions = [
'Review my portfolio',
'Give me a daily report',
'Analyze my portfolio and show which tokens are underperforming',
'How has my portfolio changed in the last 7 days?',
'What is my total profit/loss this month?',
'Which coins in my portfolio had the highest growth this month?',
];You can modify the wallet addresses and questions in src/index.ts.
The agent provides structured responses with a 5-step analysis process:
- Request Parsing - Extracts time period (daily/weekly/monthly) and wallet addresses
- Portfolio Data Fetching - Retrieves wallet balances and historical price data
- Portfolio Composition Analysis - Analyzes current holdings, top tokens, and diversification
- Performance Analysis - Calculates wins/losses, best/worst performers over the time period
- Report Generation - Provides comprehensive portfolio report with insights and recommendations
See EXAMPLES.md for complete examples of agent output.
Complete JSON response files are available in the examples directory. Each file contains:
{
"question": "string - the original question",
"response": {
"messages": "array - internal processing steps and tool calls",
"structuredResponse": "object - the structured agent analysis and answer"
}
}# Build the package
yarn build
# Run tests
yarn test
# Lint code
yarn lint
# Clean build artifacts
yarn cleanRun the test suite:
yarn testTests are located in the tests/ directory and use Vitest.
- TypeScript - Type-safe JavaScript
- LangChain - AI application framework
- OpenAI API - Language models (GPT-4o-mini by default)
- CoinGecko API - Cryptocurrency price data
- Alchemy API - EVM wallet balance and transaction data
- The agent analyzes complete portfolio holdings across EVM and Solana wallets
- Supports daily, weekly, and monthly performance tracking
- Provides market context by comparing portfolio performance against top gainers/losers
- All analysis is for informational purposes only - not financial advice