-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfin_tasks.py
70 lines (62 loc) · 3.13 KB
/
fin_tasks.py
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
from datetime import datetime
from crewai import Task
from agents import location_expert, guide_expert, planner_expert
#DuckDuckGoSearchRunTool DuckDuckGoSearchResults DuckDuckGoSearchRun
from langchain_groq import ChatGroq
from template import fin_template, news_template
# TASKS
class FinTasks():
# Task: financial data
def fin_task(self, agent, ticker):
return Task(
description=f"""
Use the financial data tool to gather the financial metrics for company {ticker}, and
Format them in tables using {fin_template} template.
""",
expected_output=f"""Here is an example of a financial report {ticker} template to use :
<Template>
{fin_template}
</Template>
""",
agent=agent,
#context=context,
output_file='financial_report.md',
)
# Task: news
def news_task(self, agent, ticker):
return Task(
description=f"""
Use the search news tool to get the last 10 news about company {ticker}.
Categorize the news into Bullish, Bearish, Neutral.
Perform an in-depth analysis of these news to establish outlook, insights, and future trends
""",
expected_output=f"""Here is an example of a financial report {ticker} template to use :
<Template>
{news_template}
</Template>
""",
agent=agent,
output_file='news_report.md',
)
# Task: reporter
def reporter_task(self, context, agent, ticker):
return Task(
description=f"""
Use both reports provided by the Financial Analyst and the News Analyst to create the final {ticker} financial report :
The current date is {datetime.now()}
Provide a summary at the beginning of the report with presentation of the company and the industry market and key takeaways for quick reference.
Present first the the Financial Analyst report and the News Analyst report in markdown format, include for each paragraph a table with related data
Look for the risks and tailwinds and identify futur trends.
Add a section on market sentiment analysis using news trends to provide a more comprehensive view.
Conduct a Highly detailed analysis of ticker's financial data.
In a Data Annexe Section : Provide a brief overview of the stock’s main finance data in table format to give the user more precices inputs.
Conculsion at the end of the report highlighting the main news and trends.
""",
expected_output="Full Financial report for {ticker} in rich markdown format, Your report should be lowlevel detailed and informative, catering to a professional audience. Make it sound professional, provide full analysis, introduction and conclusion",
agent=agent,
context=context,
output_file='global_report.md',
)
# tip section
def __tip_section(self):
return "If you do your BEST WORK, I'll tip you $1000 and grant you any wish you want!"