Spaces:
Running
Running
| from crewai import Task | |
| from textwrap import dedent | |
| class CryptoAnalysisTasks: | |
| def market_research(self, agent, crypto): | |
| return Task( | |
| description=dedent(f""" | |
| Conduct comprehensive market research for {crypto} cryptocurrency. | |
| REQUIRED DATA POINTS: | |
| 1. Current Price: Get exact current price in USD | |
| 2. Market Cap: Current market capitalization | |
| 3. 24h Volume: Trading volume in last 24 hours | |
| 4. Price Changes: 24h, 7d, and 30d percentage changes | |
| 5. Market Dominance: Percentage of total crypto market | |
| 6. News Analysis: 3-5 recent news headlines with impact assessment | |
| 7. Competitive Analysis: Compare to Bitcoin and Ethereum | |
| 8. Market Trends: Current market phase (bull/bear/sideways) | |
| FORMAT REQUIREMENTS: | |
| - Price: $X.XX (24h change: +/-X.X%) | |
| - Market Cap: $X.XB/M (Rank: #X) | |
| - Volume 24h: $X.XM (Volume/MCap ratio: X.X%) | |
| - 7d Change: +/-X.X%, 30d Change: +/-X.X% | |
| - Market Dominance: X.X% of total crypto market | |
| - News Impact: [List 3 key headlines with bullish/bearish/neutral impact] | |
| - Vs Bitcoin: Outperforming/Underperforming by X.X% | |
| - Vs Ethereum: Outperforming/Underperforming by X.X% | |
| - Market Phase: [Bull/Bear/Sideways] with reasoning | |
| ANALYSIS REQUIREMENTS: | |
| Provide detailed commentary on each metric and its significance for investment decisions. | |
| """), | |
| expected_output=f"Comprehensive market analysis report for {crypto} with all required data points and professional commentary", | |
| agent=agent | |
| ) | |
| def technical_analysis(self, agent, crypto): | |
| return Task( | |
| description=dedent(f""" | |
| Perform detailed technical analysis for {crypto} cryptocurrency. | |
| REQUIRED TECHNICAL INDICATORS: | |
| 1. RSI (14-day): Calculate current RSI and signal (Overbought >70, Oversold <30) | |
| 2. Moving Averages: 7-day, 20-day, 50-day, and 200-day SMAs | |
| 3. Trend Analysis: Current trend direction and strength | |
| 4. Support/Resistance: Key price levels for entry/exit | |
| 5. Volume Analysis: Volume trends and significance | |
| 6. Momentum Indicators: MACD, Stochastic if available | |
| 7. Chart Patterns: Identify any significant patterns | |
| 8. Fibonacci Levels: Key retracement/extension levels | |
| FORMAT REQUIREMENTS: | |
| - RSI: X.X (Signal: Overbought/Oversold/Neutral) | |
| - 7-day MA: $X.XX, 20-day MA: $X.XX, 50-day MA: $X.XX | |
| - Trend: Bullish/Bearish/Sideways (Strength: Strong/Moderate/Weak) | |
| - Support: $X.XX, $X.XX | Resistance: $X.XX, $X.XX | |
| - Volume Trend: Increasing/Decreasing/Stable | |
| - Entry Points: $X.XX - $X.XX (Conservative: $X.XX) | |
| - Stop Loss: $X.XX | Take Profit: $X.XX | |
| - Pattern: [Head & Shoulders/Triangle/Wedge/None] | |
| PROBABILITY ASSESSMENT: | |
| Provide probability percentages for next 7-day and 30-day price movements. | |
| """), | |
| expected_output=f"Detailed technical analysis for {crypto} with specific indicators, price levels, and probability assessments", | |
| agent=agent | |
| ) | |
| def sentiment_analysis(self, agent, crypto): | |
| return Task( | |
| description=dedent(f""" | |
| Conduct multi-source sentiment analysis for {crypto} cryptocurrency. | |
| REQUIRED SENTIMENT SOURCES: | |
| 1. Overall Market Sentiment: General market mood towards {crypto} | |
| 2. Social Media Sentiment: Twitter, Reddit, Discord community analysis | |
| 3. News Sentiment: Traditional media, crypto publications, regulatory news | |
| 4. Community Sentiment: Developer activity, governance, ecosystem growth | |
| 5. Institutional Sentiment: Corporate adoption, investment fund interest | |
| 6. Fear & Greed Index: Current market psychology | |
| ANALYSIS METHODOLOGY: | |
| - Analyze each source independently | |
| - Assign clear Positive/Negative/Neutral ratings | |
| - Provide confidence scores (High/Medium/Low) | |
| - Identify sentiment drivers and catalysts | |
| FORMAT REQUIREMENTS: | |
| - Overall Sentiment: Positive/Negative/Neutral (Confidence: High/Medium/Low) | |
| - Social Media: Positive/Negative/Neutral (Twitter: X%, Reddit: X%) | |
| - News Sentiment: Positive/Negative/Neutral (Recent headlines impact) | |
| - Community: Positive/Negative/Neutral (Developer activity, governance) | |
| - Institutional: Positive/Negative/Neutral (Corporate interest level) | |
| - Key Drivers: [List 3-5 main factors influencing sentiment] | |
| - Sentiment Score: X/10 (Weighted composite) | |
| - Change from Last Week: Improving/Deteriorating/Stable | |
| ENSURE DIFFERENTIATED ANALYSIS: | |
| Each sentiment category must be analyzed separately and may have different ratings. | |
| Do not assign the same sentiment to all categories. | |
| """), | |
| expected_output=f"Comprehensive sentiment analysis for {crypto} with differentiated ratings across all sources", | |
| agent=agent | |
| ) | |
| def recommend(self, agent, crypto): | |
| return Task( | |
| description=dedent(f""" | |
| Synthesize all analyses to provide a comprehensive investment recommendation for {crypto}. | |
| INTEGRATION REQUIREMENTS: | |
| 1. Market Analysis Summary: Key market metrics and trends | |
| 2. Technical Analysis Summary: Critical indicators and signals | |
| 3. Sentiment Analysis Summary: Weighted sentiment across sources | |
| 4. Risk Assessment: Identify and quantify key risks | |
| 5. Investment Recommendation: Clear BUY/HOLD/SELL with reasoning | |
| 6. Position Sizing: Recommended portfolio allocation percentage | |
| 7. Time Horizon: Short-term (1-3 months) vs Long-term (6-12 months) outlook | |
| 8. Exit Strategy: Clear profit-taking and stop-loss levels | |
| FORMAT REQUIREMENTS: | |
| - Recommendation: BUY/HOLD/SELL | |
| - Confidence: High/Medium/Low (with percentage if possible) | |
| - Time Horizon: Short-term/Medium-term/Long-term | |
| - Position Size: X% of portfolio (Conservative/Moderate/Aggressive) | |
| - Entry Range: $X.XX - $X.XX | |
| - Target Price: $X.XX (Timeframe: X months) | |
| - Stop Loss: $X.XX | |
| - Risk Level: Low/Moderate/High | |
| - Key Catalysts: [3-5 factors that could drive price] | |
| - Risk Factors: [3-5 main risks to monitor] | |
| - Reasoning: [Detailed explanation combining all analyses] | |
| DECISION MATRIX: | |
| Clearly explain how market, technical, and sentiment factors influenced the final recommendation. | |
| Address both bull and bear case scenarios. | |
| """), | |
| expected_output=f"Comprehensive investment recommendation for {crypto} with specific targets, risk assessment, and detailed reasoning", | |
| agent=agent | |
| ) | |