A comprehensive system for monitoring and analyzing DeFi-related opinions from Telegram using AWS services and providing a real-time dashboard interface.
The heart of DeFi strategy analysis with the following workflow:
- Strategy Analysis: Analyzes investment ideas through structured output to determine:
- Tokens involved
- Smart contracts
- Potential rewards
- Risk assessment
- Complexity level
- Strategy characteristics
- Protocol Integration:
- Fetches protocol data from DeFiLlama API
- Identifies and analyzes related protocols
- Security Analysis:
- Evaluates Total Value Locked (TVL)
- Reviews protocol audits
- Provides links to social media (X.com)
- Report Generation:
- Combines all analyses into a comprehensive report
- Provides detailed protocol insights
- Includes security metrics and risk assessments
- Monitors specified Telegram channels for updates
- Captures DeFi-related messages and opinions
- Forwards messages for analysis and processing
- Flask server implementation for the DeFiLlama analysis service
- Provides REST API endpoints for the frontend
- Handles analysis requests independently from the main application
- Contains AWS Lambda function implementations
- Integrates with OpenAPI schema for standardized API interactions
- Handles serverless processing of messages and analysis requests
The project consists of two main components:
- Monitors the "@defi_opinion" Telegram channel
- Processes messages using AWS Bedrock for analysis
- Integrates with various AWS services (DynamoDB, SNS, Lambda)
- Logic for comperhansive analysis of defi ideas
- Real-time display of processed DeFi opinions
- WebSocket server for live updates
- Integration with AWS services for data retrieval
- Python 3.x
- Node.js and npm
- AWS Account with appropriate permissions
- Telegram API credentials
Create a .env
file in the root directory with the following configurations:
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_DEFAULT_REGION=your_aws_region
AWS_BUCKET_NAME=your_bucket_name
AWS_ENDPOINT=your_endpoint
AWS_DYNAMODB_TABLE=your_dynamodb_table
AWS_LAMBDA_FUNCTION=your_lambda_function
TELEGRAM_API_KEY=your_telegram_api_key
TELEGRAM_API_HASH=your_telegram_api_hash
OPENROUTER_API_KEY=your_openrouter_key
TELEGRAM_BOT_TOKEN=your_bot_token
Create a separate .env
file in the defi-opinions-app
directory for frontend-specific configurations.
- Install Python dependencies:
pip install -r requirements.txt
- Start the Telegram bot:
python telegram_scrapper.py
-
Upload lambda_function.py, tools.py, defillma.py together with dependices, setup AWS Bedrock agent with openapi-schema-v1.json to call lambda functions.
-
Optional: setup flask server to serve investments analys logic via API.
- Navigate to the frontend directory:
cd defi-opinions-app
- Install dependencies:
npm install
- Start the development server:
npm run dev
This command will start both the React application and the WebSocket server concurrently.
The frontend application runs on port 3000 by default. The WebSocket server handles real-time updates between the backend and frontend.
Backend:
python telegram_scrapper.py
- Start the Telegram botpython server.py
- Start the DeFiLlama analysis service
Frontend:
npm run dev
- Start both the React app and WebSocket server
- AWS Bedrock - For message processing and analysis
- DynamoDB - Data storage
- SNS - Notifications
- Lambda - Serverless functions
This project is licensed under the MIT License - see the LICENSE file for details.