3K+ Star!FinRobot:一个开源的金融分析AI Agent平台

欢迎关注我,持续获取更多内容,感谢&在看~

FinRobot 简介

FinRobot[1] 是一个开源的金融分析人工智能代理平台,利用大型语言模型(LLMs)为金融领域提供全面的解决方案。它超越了传统的 FinGPT,整合了多种 AI 技术,能够满足金融行业多样化的需求。

FinRobot 的核心是“AI 代理”,它通过大型语言模型作为“大脑”,感知环境、做出决策并执行操作。

FinRobot Ecosystem
FinRobot: Agent Workflow

项目特点

主要特点

  1. 多层架构:FinRobot 采用四层架构,包括金融 AI 代理层、金融 LLM 算法层、LLMOps 和 DataOps 层以及多源 LLM 基础模型层。每一层都针对金融 AI 的不同需求进行了优化。
  2. 智能调度器:通过智能调度器优化 LLM 的选择和任务分配,确保模型多样性并提高效率。
  3. 多模态数据处理:能够处理来自市场数据、新闻和经济指标的多模态金融数据。
  4. 灵活的工具集成:支持多种金融工具和 API 的集成,如 Finnhub、FinancialModelingPrep 和 SEC API。
  5. 丰富的教程和示例:提供从初学者到高级开发者的教程和示例,帮助用户快速上手。

使用场景

FinRobot 可以应用于多种金融场景,包括但不限于:

  • 市场预测:通过分析公司财务数据和市场新闻,预测股票走势。
  • 财务报告生成:根据公司 10-K 报告和市场数据生成股权研究报告。
  • 交易策略制定:利用多模态数据制定交易策略。

项目使用

安装步骤

  1. 创建虚拟环境(推荐):
conda create --name finrobot python=3.10
conda activate finrobot
  1. 克隆 FinRobot 仓库
git clone https://github.com/AI4Finance-Foundation/FinRobot.git
cd FinRobot
  1. 安装 FinRobot 及依赖
  • 从 PyPI 获取最新版本:
pip install -U finrobot
  • 或直接从源代码安装:
pip install -e .
  1. 配置 API 密钥
  • 将 OAI_CONFIG_LIST_sample 文件重命名为 OAI_CONFIG_LIST,并填入你的 OpenAI API 密钥。
  • 将 config_api_keys_sample 文件重命名为 config_api_keys,并填入你的 Finnhub、FinancialModelingPrep 和 SEC API 密钥。
  1. 开始使用教程
  • 在 tutorials_beginner 和 tutorials_advanced 文件夹中,可以找到各种示例笔记本文件,如:
  • agent_annual_report.ipynb:生成年度报告。
  • agent_fingpt_forecaster.ipynb:预测股票走势。
  • agent_trade_strategist.ipynb:制定交易策略。

示例:市场预测代理

  1. 导入模块
import autogen
from finrobot.utils import get_current_date, register_keys_from_json
from finrobot.agents.workflow import SingleAssistant
  1. 配置 LLM 和 API 密钥
llm_config = {
   "config_list": autogen.config_list_from_json(
       "../OAI_CONFIG_LIST",
       filter_dict={"model": ["gpt-4-0125-preview"]},
   ),
   "timeout"120,
   "temperature"0,
}
register_keys_from_json("../config_api_keys")
  1. 运行代理
company = "NVDA"
assistant = SingleAssistant(
   "Market_Analyst",
   llm_config,
   human_input_mode="NEVER",
)
assistant.chat(
   f"Use all the tools provided to retrieve information available for {company} upon {get_current_date()}. Analyze the positive developments and potential concerns of {company} "
   "with 2-4 most important factors respectively and keep them concise. Most factors should be inferred from company related news. "
   f"Then make a rough prediction (e.g. up/down by 2-3%) of the {company} stock price movement for next week. Provide a summary analysis to support your prediction."
)
  1. 查看结果:运行后将生成股票走势的预测分析。

参考文档

  • FinRobot 白皮书[2]
  • FinRobot 官方网站[3]

注:本文内容仅供参考,具体项目特性请参照官方 GitHub 页面的最新说明。

欢迎关注&点赞&在看,感谢你的阅读~


资源列表
[1] 

Github地址: https://github.com/AI4Finance-Foundation/FinRobot

[2] 

FinRobot 白皮书: https://arxiv.org/abs/2405.14767

[3] 

FinRobot 官方网站: https://ai4finance.org

(文:AIGC创想者)

欢迎分享

发表评论