AI Personal Learning
and practical guidance
讯飞绘镜

FinRobot: An Intelligent Body to Improve Financial Data Analysis Efficiency and Investment Research

General Introduction

FinRobot is an open source AI intelligence platform developed by AI4Finance Foundation and designed for financial analysis. It not only covers traditional language models, but also incorporates a variety of AI technologies, aiming to provide a comprehensive solution for the financial industry.FinRobot was originally designed to simplify and optimize the financial analysis process, and improve the accuracy and efficiency of the analysis through advanced AI technologies. Its core functions include market trend interpretation, economic forecasting and investment strategy provision, etc. It is suitable for all types of financial institutions and individual investors.

FinRobot:提升金融数据分析效率和投资研究的的智能体-1


 

Function List

  • Market Trend Analysis: Monitor and analyze market dynamics in real time to provide trend forecasts and investment recommendations.
  • Economic forecasts: Using big data and AI algorithms to forecast macroeconomic indicators.
  • Investment Strategy Offerings: Generate personalized investment strategies based on historical data and market analysis.
  • Multimodal data processing: Integrate market data, news and economic indicators for multi-dimensional analysis.
  • open source library (OSSL): Provides a rich library of open source code to support secondary development and functionality extensions.

 

FinRobot's architectural design

1. FinRobot ecosystem

FinRobot uses a four-tier architecture, with each tier optimized for financial AI tasks.

  • Financial AI Agent Layer: Includes market forecasting agents, document analysis agents, trading strategy agents, etc., with support for financial Chain of Thought (CoT) prompts.
  • Financial LLM Algorithmic Layer: Support financial domain-specific LLM tuning to enhance financial analysis expertise.
  • LLMOps & DataOps Layer: Provides multi-source data integration and supports dynamic adaptation of multiple LLM models.
  • Multi-source LLM base model layer: Supports Plug-and-Play LLM model calls for flexible adaptation to different tasks.

2. AI agent workflow

The FinRobot agent's workflow consists of three core components:

  • Perception: Access to market data, news, and economic indicators for multimodal parsing.
  • Thinking (Brain): Generate trading decisions using LLM combined with a financial chain thinking approach.
  • Action: Execute trades, adjust portfolios, generate reports or send alerts.

3. Intelligent Dispatch System

FinRobot:提升金融数据分析效率和投资研究的的智能体-1

FinRobot utilizes Smart Scheduler scheduling system to ensure that tasks can be assigned to the most appropriate AI agent.

  • Director Agent: Assign agents based on task characteristics.
  • Agent Registration: Manage agent registrations and track their status.
  • Agent Adaptor: Adjust agent functionality to improve task adaptability.
  • Task Manager: Stores and manages task execution for AI agents.

 

Using Help

Installation steps

(1) Creating the Python Environment

conda create --name finrobot python=3.10
conda activate finrobot

(2) Cloning code base

git clone https://github.com/AI4Finance-Foundation/FinRobot.git
cd FinRobot

(3) Installation of dependencies

pip install -U finrobot  # 或者从源码安装
pip install -e .

(4) Configuring the API Key

# 修改 OAI_CONFIG_LIST_sample 文件
mv OAI_CONFIG_LIST_sample OAI_CONFIG_LIST
vi OAI_CONFIG_LIST # 添加 OpenAI API Key

# 修改 config_api_keys_sample 文件
mv config_api_keys_sample config_api_keys
vi config_api_keys # 添加 Finnhub、SEC-API、FinancialModelingPrep API Key

2. Example applications

(1) Market forecasting agent: forecasting stock price movements

import autogen
from finrobot.utils import get_current_date, register_keys_from_json
from finrobot.agents.workflow import SingleAssistant

# 读取 OpenAI API 配置
llm_config = {
"config_list": autogen.config_list_from_json("../OAI_CONFIG_LIST"),
"timeout": 120,
"temperature": 0,
}

# 注册 API 密钥
register_keys_from_json("../config_api_keys")

# 运行预测
company = "NVDA"
assistant = SingleAssistant("Market_Analyst", llm_config, human_input_mode="NEVER")
assistant.chat(f"分析 {company} 近期市场动态,并预测未来一周股价走势。")

in the end

FinRobot:提升金融数据分析效率和投资研究的的智能体-1

(2) Financial analysis agent: automatic generation of financial reports

import os
import autogen
from finrobot.utils import register_keys_from_json
from finrobot.agents.workflow import SingleAssistantShadow
# 配置 LLM 参数
llm_config = {
"config_list": autogen.config_list_from_json("../OAI_CONFIG_LIST"),
"timeout": 120,
"temperature": 0.5,
}
# 注册 API 密钥
register_keys_from_json("../config_api_keys")
# 创建工作目录
work_dir = os.path.join("..", "report")
os.makedirs(work_dir, exist_ok=True)
# 初始化智能助手
assistant = SingleAssistantShadow("Expert_Investor", llm_config, human_input_mode="TERMINATE")
# 设定公司和年份
company = "Microsoft"
fyear = "2023"
# 生成报告请求
message = f"请基于 {company} {fyear} 年的财务数据撰写年度分析报告,并导出 PDF。"
# 运行助手并处理异常
try:
assistant.chat(message, use_cache=True, max_turns=50, summary_method="last_msg")
print(f"报告已成功生成并保存至 {work_dir}")
except Exception as e:
print(f"生成报告时出错: {e}")

in the end

FinRobot:提升金融数据分析效率和投资研究的的智能体-1

Financial Position Analysis (Financial CoT):

  1. Preliminary data collection: 10-K reports, market data, financial ratios
  2. Analyze financial statements: balance sheet, income statement, cash flow statement
  3. Company Overview and Performance: Company Description, Business Highlights, Segment Analysis
  4. Risk assessment: assessing risk
  5. Financial performance visualization: charting price-earnings ratio (PE ratio) and earnings per share (EPS)
  6. Synthesizing findings into paragraphs: integrating all parts into a coherent summary
  7. Generate PDF reports: use tools to automatically generate PDF files
  8. Quality assurance: checking word count
May not be reproduced without permission:Chief AI Sharing Circle " FinRobot: An Intelligent Body to Improve Financial Data Analysis Efficiency and Investment Research
en_USEnglish