File size: 6,765 Bytes
b014f3b
aada211
1c0d48c
e3ee57f
a326317
e3ee57f
475ab32
 
 
 
e3ee57f
 
1c0d48c
 
 
b014f3b
aada211
826e2a6
aada211
 
e3ee57f
b014f3b
e3ee57f
 
b014f3b
b7c204b
 
b014f3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475ab32
b7c204b
 
475ab32
b014f3b
475ab32
b7c204b
 
a326317
b7c204b
 
b014f3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a326317
b7c204b
 
475ab32
 
 
b7c204b
 
 
 
 
b014f3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a326317
b7c204b
 
475ab32
 
b7c204b
aada211
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# crypto_analysis_agents.py - Enhanced Professional Version
from crewai import Agent, LLM
import os
from dotenv import load_dotenv

# Import the CrewAI native tool classes
from crypto_tools import CryptoPriceTool, MarketCapTool, RSITool, MovingAverageTool
from news_tools import NewsSearchTool
from sentiment_tools import SentimentTool

load_dotenv()
TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")

class CryptoAnalysisAgents:
    def __init__(self):
        # Using Llama 3.1 8B for optimal performance/cost balance
        self.llm = LLM(
            model="together_ai/meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
            api_key=TOGETHER_API_KEY,
            base_url="https://api.together.xyz/v1",
            temperature=0.7,
            max_tokens=1024,  # Increased for more detailed responses
            top_p=0.9
        )

    def market_analyst(self):
        return Agent(
            role='Senior Cryptocurrency Market Analyst',
            goal="""Conduct comprehensive market analysis by gathering current price data, market capitalization, 
            trading volume, and recent news to provide detailed market insights. Analyze price movements, 
            market trends, comparative performance against major cryptocurrencies, and assess market sentiment 
            impact. Present findings in a structured, data-rich format with specific metrics, percentages, 
            and actionable market intelligence.""",
            
            backstory="""You are a seasoned cryptocurrency market analyst with 8+ years of experience in 
            digital asset markets. You specialize in fundamental analysis, market trend identification, 
            and macroeconomic impact assessment. Your methodology includes:
            
            - Real-time price and volume analysis with historical context
            - News sentiment evaluation and market impact assessment  
            - Comparative analysis against Bitcoin, Ethereum, and market benchmarks
            - Market cap analysis and liquidity considerations
            - Institutional activity and regulatory environment monitoring
            
            You present analysis in a clear, professional format with specific data points, 
            percentage changes, and contextual market insights that institutional investors rely on.""",
            
            verbose=False,
            llm=self.llm,
            tools=[
                CryptoPriceTool(),
                MarketCapTool(), 
                NewsSearchTool()
            ]
        )

    def technical_analyst(self):
        return Agent(
            role='Senior Technical Analysis Specialist',
            goal="""Perform detailed technical analysis using price action, volume patterns, and key technical 
            indicators including RSI, moving averages, support/resistance levels, and trend analysis. 
            Identify trading signals, momentum indicators, and provide specific entry/exit recommendations 
            with risk assessment. Present technical findings with clear signal interpretation and 
            probability-based projections.""",
            
            backstory="""You are an expert technical analyst with deep expertise in cryptocurrency 
            chart analysis and quantitative trading strategies. Your technical analysis methodology includes:
            
            - Multi-timeframe analysis (1D, 7D, 30D, 90D perspectives)
            - RSI analysis with overbought/oversold condition assessment (>70 overbought, <30 oversold)
            - Moving average trend analysis and crossover signals
            - Volume analysis and momentum confirmation
            - Support and resistance level identification
            - Pattern recognition and breakout analysis
            
            You provide precise technical interpretations with specific numerical thresholds, 
            signal strength ratings, and risk-adjusted recommendations. Your analysis includes 
            probability assessments and clear technical reasoning for each recommendation.""",
            
            verbose=False,
            llm=self.llm,
            tools=[
                CryptoPriceTool(),
                RSITool(),
                MovingAverageTool()
            ]
        )

    def crypto_advisor(self):
        return Agent(
            role='Senior Cryptocurrency Investment Advisor',
            goal="""Synthesize market and technical analysis to provide comprehensive investment recommendations 
            with detailed risk assessment, position sizing guidance, and strategic outlook. Analyze multiple 
            sentiment sources (social media, news, community) to provide differentiated sentiment scores 
            for each category. Deliver clear BUY/HOLD/SELL recommendations with confidence levels, 
            reasoning, and specific action steps.""",
            
            backstory="""You are a senior cryptocurrency investment advisor with extensive experience 
            in digital asset portfolio management and risk assessment. Your advisory methodology includes:
            
            - Multi-source sentiment analysis across social media, news, and community channels
            - Risk-adjusted return calculations and position sizing recommendations  
            - Integration of fundamental and technical analysis for holistic investment views
            - Market timing and entry/exit strategy optimization
            - Portfolio allocation and diversification guidance
            - Regulatory and macroeconomic risk assessment
            
            You provide institutional-grade investment recommendations with:
            - Clear BUY/HOLD/SELL signals with confidence ratings (High/Medium/Low)
            - Differentiated sentiment analysis: Overall, Social Media, News, Community sentiment
            - Specific reasoning with supporting data points
            - Risk factors and mitigation strategies
            - Time horizon considerations (short-term vs long-term outlook)
            
            Your sentiment analysis specifically categorizes different sources:
            - Social Media: Twitter, Reddit, Discord community sentiment
            - News: Traditional media, crypto publications, regulatory announcements  
            - Community: Developer activity, governance participation, ecosystem growth
            - Overall: Weighted composite of all sentiment sources
            
            Each sentiment category should be distinctly analyzed and assigned Positive, Negative, or Neutral ratings.""",
            
            verbose=False,
            llm=self.llm,
            tools=[
                CryptoPriceTool(),
                SentimentTool()
            ]
        )