基于东方财富数据库,支持自然语言搜索全网最新公告、研报、财经新闻、交易所动态及官方政策等,覆盖全球市场标的,可用于热点捕捉、舆情监控、研报速览、公告精读及投资决策等场景。Natural language search for financial information, covering authoritative sources including news, announcements, research reports, and policies. Supporting global market assets, it is applicable to event tracking, market sentiment monitoring, announcement analysis, and investment decision-making, helping users obtain authoritative financial information and capture timely market signals.
通过自然语言查询检索时效性金融信息,数据来自于妙想大模型,适用场景包括:
EM_API_KEY。EM_API_KEY 由东方财富妙想服务(https://ai.eastmoney.com/mxClaw)签发,用于其接口鉴权。llmSearchResponse).txt 文件,便于追溯与复盘| 类型 | query 示例 |
|---|---|
| 个股资讯 | 格力电器最新研报与公告、寒武纪 688256 最新动态 |
| 板块/主题 | 商业航天板块近期新闻、新能源政策解读 |
| 宏观/风险 | 美联储加息对A股影响、汇率风险相关公司案例 |
| 综合解读 | 今日大盘异动原因、北向资金流向解读 |
访问 https://ai.eastmoney.com/mxClaw 注册账号并获取API_KEY。
# macOS 添加到 ~/.zshrc,Linux 添加到 ~/.bashrc
export EM_API_KEY="your_api_key_here"
然后根据系统执行对应的命令:
macOS:
source ~/.zshrc
Linux:
source ~/.bashrc
python3 {baseDir}/scripts/get_data.py "寒武纪 688256 最新研报与公告"
输出示例
Saved: /path/to/workspace/mx_finance_search/mx_finance_search_90bf169c.txt
(随后输出资讯正文内容)
参数说明:
| 参数 | 说明 | 必填 |
|---|---|---|
query(位置参数) | 自然语言查询文本 | ✅(位置参数或 stdin 二选一) |
--no-save | 仅输出结果,不写入本地文件 | 否 |
import asyncio
from pathlib import Path
from scripts.get_data import query_financial_news
async def main():
result = await query_financial_news(
query="新能源板块近期政策与龙头公司动态",
output_dir=Path("workspace/mx_finance_search"),
save_to_file=True,
)
if "error" in result:
print(result["error"])
else:
print(result["content"])
if result.get("output_path"):
print("已保存至:", result["output_path"])
asyncio.run(main())
| 文件 | 说明 |
|---|---|
mx_finance_search_<ID>.txt | 资讯正文文本(从返回中提取) |
content:提取后的资讯正文(优先 llmSearchResponse)。output_path:当 save_to_file=True 且有内容时,返回保存路径。raw:原始接口返回,便于调试或二次处理。error:检索失败时返回错误信息。| 变量 | 说明 | 默认 |
|---|---|---|
EM_API_KEY | 新闻检索接口鉴权 key(必填) | 空 |
错误:EM_API_KEY is required.
→ 需配置EM_API_KEY,请联系官网获取并手动配置
没有传 query 时为什么直接退出?
→ 命令行会先读取位置参数 query,若为空再读取 stdin;两者都为空时打印帮助并退出。
如何只看输出,不落盘?
python3 -m scripts.get_data "商业航天板块近期新闻" --no-save