menikev commited on
Commit
b014f3b
·
verified ·
1 Parent(s): 826e2a6

Update crypto_analysis_agents.py

Browse files
Files changed (1) hide show
  1. crypto_analysis_agents.py +78 -34
crypto_analysis_agents.py CHANGED
@@ -1,4 +1,4 @@
1
- # crypto_analysis_agents.py - CrewAI Native Version (CORRECTED)
2
  from crewai import Agent, LLM
3
  import os
4
  from dotenv import load_dotenv
@@ -11,57 +11,72 @@ from sentiment_tools import SentimentTool
11
  load_dotenv()
12
  TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")
13
 
14
-
15
  class CryptoAnalysisAgents:
16
  def __init__(self):
17
- # OPTION 1: Llama 3.1 8B (Fast & Cost-effective)
18
  self.llm = LLM(
19
  model="together_ai/meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
20
  api_key=TOGETHER_API_KEY,
21
  base_url="https://api.together.xyz/v1",
22
  temperature=0.7,
23
- max_tokens=512,
24
  top_p=0.9
25
  )
26
-
27
- # OPTION 2: Llama 3.3 70B (Better Performance) - Uncomment to use
28
- # self.llm = LLM(
29
- # model="together_ai/meta-llama/Llama-3.3-70B-Instruct",
30
- # api_key=TOGETHER_API_KEY,
31
- # base_url="https://api.together.xyz/v1",
32
- # temperature=0.7,
33
- # max_tokens=512,
34
- # top_p=0.9
35
- # )
36
-
37
- # OPTION 3: DeepSeek R1 (Advanced Reasoning) - Uncomment to use
38
- # self.llm = LLM(
39
- # model="together_ai/deepseek-ai/DeepSeek-R1",
40
- # api_key=TOGETHER_API_KEY,
41
- # base_url="https://api.together.xyz/v1",
42
- # temperature=0.7,
43
- # max_tokens=512,
44
- # top_p=0.9
45
- # )
46
  def market_analyst(self):
47
  return Agent(
48
- role='Crypto Market Analyst',
49
- goal="Provide concise market analysis and insights for cryptocurrencies",
50
- backstory="Expert crypto analyst with focus on market trends and news impact",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  verbose=False,
52
  llm=self.llm,
53
  tools=[
54
  CryptoPriceTool(),
55
- MarketCapTool(),
56
  NewsSearchTool()
57
  ]
58
  )
59
 
60
  def technical_analyst(self):
61
  return Agent(
62
- role='Crypto Technical Analyst',
63
- goal="Analyze price patterns and technical indicators quickly",
64
- backstory="Technical analysis specialist focused on key indicators",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  verbose=False,
66
  llm=self.llm,
67
  tools=[
@@ -73,9 +88,38 @@ class CryptoAnalysisAgents:
73
 
74
  def crypto_advisor(self):
75
  return Agent(
76
- role='Investment Advisor',
77
- goal="Synthesize analysis into clear investment recommendations",
78
- backstory="Investment advisor specializing in crypto portfolio recommendations",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  verbose=False,
80
  llm=self.llm,
81
  tools=[
 
1
+ # crypto_analysis_agents.py - Enhanced Professional Version
2
  from crewai import Agent, LLM
3
  import os
4
  from dotenv import load_dotenv
 
11
  load_dotenv()
12
  TOGETHER_API_KEY = os.getenv("TOGETHER_API_KEY")
13
 
 
14
  class CryptoAnalysisAgents:
15
  def __init__(self):
16
+ # Using Llama 3.1 8B for optimal performance/cost balance
17
  self.llm = LLM(
18
  model="together_ai/meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
19
  api_key=TOGETHER_API_KEY,
20
  base_url="https://api.together.xyz/v1",
21
  temperature=0.7,
22
+ max_tokens=1024, # Increased for more detailed responses
23
  top_p=0.9
24
  )
25
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  def market_analyst(self):
27
  return Agent(
28
+ role='Senior Cryptocurrency Market Analyst',
29
+ goal="""Conduct comprehensive market analysis by gathering current price data, market capitalization,
30
+ trading volume, and recent news to provide detailed market insights. Analyze price movements,
31
+ market trends, comparative performance against major cryptocurrencies, and assess market sentiment
32
+ impact. Present findings in a structured, data-rich format with specific metrics, percentages,
33
+ and actionable market intelligence.""",
34
+
35
+ backstory="""You are a seasoned cryptocurrency market analyst with 8+ years of experience in
36
+ digital asset markets. You specialize in fundamental analysis, market trend identification,
37
+ and macroeconomic impact assessment. Your methodology includes:
38
+
39
+ - Real-time price and volume analysis with historical context
40
+ - News sentiment evaluation and market impact assessment
41
+ - Comparative analysis against Bitcoin, Ethereum, and market benchmarks
42
+ - Market cap analysis and liquidity considerations
43
+ - Institutional activity and regulatory environment monitoring
44
+
45
+ You present analysis in a clear, professional format with specific data points,
46
+ percentage changes, and contextual market insights that institutional investors rely on.""",
47
+
48
  verbose=False,
49
  llm=self.llm,
50
  tools=[
51
  CryptoPriceTool(),
52
+ MarketCapTool(),
53
  NewsSearchTool()
54
  ]
55
  )
56
 
57
  def technical_analyst(self):
58
  return Agent(
59
+ role='Senior Technical Analysis Specialist',
60
+ goal="""Perform detailed technical analysis using price action, volume patterns, and key technical
61
+ indicators including RSI, moving averages, support/resistance levels, and trend analysis.
62
+ Identify trading signals, momentum indicators, and provide specific entry/exit recommendations
63
+ with risk assessment. Present technical findings with clear signal interpretation and
64
+ probability-based projections.""",
65
+
66
+ backstory="""You are an expert technical analyst with deep expertise in cryptocurrency
67
+ chart analysis and quantitative trading strategies. Your technical analysis methodology includes:
68
+
69
+ - Multi-timeframe analysis (1D, 7D, 30D, 90D perspectives)
70
+ - RSI analysis with overbought/oversold condition assessment (>70 overbought, <30 oversold)
71
+ - Moving average trend analysis and crossover signals
72
+ - Volume analysis and momentum confirmation
73
+ - Support and resistance level identification
74
+ - Pattern recognition and breakout analysis
75
+
76
+ You provide precise technical interpretations with specific numerical thresholds,
77
+ signal strength ratings, and risk-adjusted recommendations. Your analysis includes
78
+ probability assessments and clear technical reasoning for each recommendation.""",
79
+
80
  verbose=False,
81
  llm=self.llm,
82
  tools=[
 
88
 
89
  def crypto_advisor(self):
90
  return Agent(
91
+ role='Senior Cryptocurrency Investment Advisor',
92
+ goal="""Synthesize market and technical analysis to provide comprehensive investment recommendations
93
+ with detailed risk assessment, position sizing guidance, and strategic outlook. Analyze multiple
94
+ sentiment sources (social media, news, community) to provide differentiated sentiment scores
95
+ for each category. Deliver clear BUY/HOLD/SELL recommendations with confidence levels,
96
+ reasoning, and specific action steps.""",
97
+
98
+ backstory="""You are a senior cryptocurrency investment advisor with extensive experience
99
+ in digital asset portfolio management and risk assessment. Your advisory methodology includes:
100
+
101
+ - Multi-source sentiment analysis across social media, news, and community channels
102
+ - Risk-adjusted return calculations and position sizing recommendations
103
+ - Integration of fundamental and technical analysis for holistic investment views
104
+ - Market timing and entry/exit strategy optimization
105
+ - Portfolio allocation and diversification guidance
106
+ - Regulatory and macroeconomic risk assessment
107
+
108
+ You provide institutional-grade investment recommendations with:
109
+ - Clear BUY/HOLD/SELL signals with confidence ratings (High/Medium/Low)
110
+ - Differentiated sentiment analysis: Overall, Social Media, News, Community sentiment
111
+ - Specific reasoning with supporting data points
112
+ - Risk factors and mitigation strategies
113
+ - Time horizon considerations (short-term vs long-term outlook)
114
+
115
+ Your sentiment analysis specifically categorizes different sources:
116
+ - Social Media: Twitter, Reddit, Discord community sentiment
117
+ - News: Traditional media, crypto publications, regulatory announcements
118
+ - Community: Developer activity, governance participation, ecosystem growth
119
+ - Overall: Weighted composite of all sentiment sources
120
+
121
+ Each sentiment category should be distinctly analyzed and assigned Positive, Negative, or Neutral ratings.""",
122
+
123
  verbose=False,
124
  llm=self.llm,
125
  tools=[