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