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