Spaces:
Sleeping
Sleeping
Update tasks.py
Browse files
tasks.py
CHANGED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from crewai import Agent, Task, Crew
|
2 |
+
|
3 |
+
# Task for Data Analyst Agent: Analyze Market Data
|
4 |
+
data_analysis_task = Task(
|
5 |
+
description=(
|
6 |
+
"Continuously monitor and analyze market data for "
|
7 |
+
"the selected stock ({stock_selection}). "
|
8 |
+
"Use statistical modeling and machine learning to "
|
9 |
+
"identify trends and predict market movements."
|
10 |
+
),
|
11 |
+
expected_output=(
|
12 |
+
"Insights and alerts about significant market "
|
13 |
+
"opportunities or threats for {stock_selection}."
|
14 |
+
),
|
15 |
+
agent=data_analyst_agent,
|
16 |
+
)
|
17 |
+
|
18 |
+
# Task for Trading Strategy Agent: Develop Trading Strategies
|
19 |
+
strategy_development_task = Task(
|
20 |
+
description=(
|
21 |
+
"Develop and refine trading strategies based on "
|
22 |
+
"the insights from the Data Analyst and "
|
23 |
+
"user-defined risk tolerance ({risk_tolerance}). "
|
24 |
+
"Consider trading preferences ({trading_strategy_preference})."
|
25 |
+
),
|
26 |
+
expected_output=(
|
27 |
+
"A set of potential trading strategies for {stock_selection} "
|
28 |
+
"that align with the user's risk tolerance."
|
29 |
+
),
|
30 |
+
agent=trading_strategy_agent,
|
31 |
+
)
|
32 |
+
|
33 |
+
# Task for Trade Advisor Agent: Plan Trade Execution
|
34 |
+
execution_planning_task = Task(
|
35 |
+
description=(
|
36 |
+
"Analyze approved trading strategies to determine the "
|
37 |
+
"best execution methods for {stock_selection}, "
|
38 |
+
"considering current market conditions and optimal pricing."
|
39 |
+
),
|
40 |
+
expected_output=(
|
41 |
+
"Detailed execution plans suggesting how and when to "
|
42 |
+
"execute trades for {stock_selection}."
|
43 |
+
),
|
44 |
+
agent=execution_agent,
|
45 |
+
)
|
46 |
+
|
47 |
+
# Task for Risk Advisor Agent: Assess Trading Risks
|
48 |
+
risk_assessment_task = Task(
|
49 |
+
description=(
|
50 |
+
"Evaluate the risks associated with the proposed trading "
|
51 |
+
"strategies and execution plans for {stock_selection}. "
|
52 |
+
"Provide a detailed analysis of potential risks "
|
53 |
+
"and suggest mitigation strategies."
|
54 |
+
),
|
55 |
+
expected_output=(
|
56 |
+
"A comprehensive risk analysis report detailing potential "
|
57 |
+
"risks and mitigation recommendations for {stock_selection}."
|
58 |
+
),
|
59 |
+
agent=risk_management_agent,
|
60 |
+
)
|