This repository is responsible for optimizing strategy execution dynamically using AI, predicting the best yield farming moves, and performing risk analysis. The AI agent leverages Allora Network for decentralized AI predictions to provide signals for DeFi strategies.
This repo serves as a prediction and signal provider:
- Dynamic strategy optimization: AI optimizes strategy signals based on market conditions using Allora Network's price predictions
- Yield farming prediction: AI-based prediction for identifying the best yield farming opportunities
- Risk analysis & alerts: Using Allora's topic-based inferences to assess risks such as impermanent loss, liquidation risks, and more
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file with your configuration:
ALLORA_API_KEY=your_api_key_here
ALLORA_CHAIN=testnet
API_PORT=8000
- Start the API server:
uvicorn main:app --reload
GET /
: Health check and service infoGET /health
: Detailed health status of Allora connectionPOST /strategy/signals
: Get strategy signals including:- Yield predictions for BTC and ETH
- Risk analysis
- Trading signals
# Get strategy signals
curl -X POST http://localhost:8000/strategy/signals
# Check service health
curl http://localhost:8000/health
Strategy signals response example:
{
"timestamp": "2024-03-20T00:00:00Z",
"yield_data": {
"btc_prediction": {
"price": "...",
"normalized": "...",
"confidence": "..."
},
"eth_prediction": {
"price": "...",
"normalized": "...",
"confidence": "..."
},
"yield_score": 0.75
},
"risk_data": {
"risk_factors": [],
"risk_score": 0.3
},
"signals": {
"high_yield": true,
"low_risk": true
}
}
This service acts as a prediction provider that:
- Connects to Allora Network for AI predictions
- Processes and normalizes prediction data
- Calculates risk scores
- Provides clean signals via API endpoints
- Can be consumed by other services for strategy execution
This repository only handles predictions and signals. For actual strategy execution and trading, please refer to the strategy execution repository.