微信扫码
添加专属顾问
我要投稿
利用DeepSeek打造智能金融理财助手,开启自动数据分析新篇章。核心内容:1. AI大模型在金融领域的应用及其交互方式2. XXL-JOB与DeepSeek结合搭建定时数据分析系统3. DeepSeek模型选择及其本地部署步骤详解
阿里妹导读
本篇文章将介绍如何搭建一套基于 XXL-JOB + Deepseek 的定时数据分析系统,帮你做一个智能的金融理财助手。
概述
内容创作:比如通过你的名字给你作一首诗。比如给你生成吸引人的广告文案。
聊天机器人:比如客服答疑,比如英语口语陪练。
风险监控:定时监控系统指标,由大模型进行智能分析,发现潜在的风险。
如何搭建系统
搭建Deepseek
搭建XXL-JOB
可以定时发起AI任务请求。
可以把prompt和返回格式放在任务参数上,动态修改。
可以使用广播分片任务,把大任务拆分成多个小任务,加快AI任务运行速度。
方案一:本地部署
定时推送财经新闻
@Component
public class AIJob {
@Value("${dashscope.api.key}")
private String apiKey;
@XxlJob(value = "sinaNews")
public ReturnT<String> sinaNews() throws Exception {
String url = "https://finance.sina.com.cn/topnews/";
String model = "deepseek-r1";
// prompt
String jobParam = XxlJobContext.getXxlJobContext().getJobParam();
ReturnT<String> rtn = ReturnT.SUCCESS;
Document document = Jsoup.connect(url).get();
// 定位到“汇总榜”部分
Element summaryBlock = document.selectFirst("div.lbti:has(h2:containsOwn(汇总榜))");
if (summaryBlock != null) {
// 找到该块中的<script>标签
Element scriptTag = summaryBlock.parent().selectFirst("script[src]");
if (scriptTag != null) {
// 提取src属性值
String srcValue = scriptTag.attr("src");
HttpResponse<String> httpResponse = Unirest.get(srcValue).asString();
String news = httpResponse.getBody();
Map<String, Object> bodyMap = new HashMap<>();
bodyMap.put("model", model);
List<Map<String, String>> messagesList = new ArrayList<>();
Map<String, String> message = new HashMap<>();
message.put("role", "system");
message.put("content", jobParam);
messagesList.add(message);
message = new HashMap<>();
message.put("role", "user");
message.put("content", "这是今天的财经新闻,帮我按规则解析:" + news );
messagesList.add(message);
bodyMap.put("messages", messagesList);
String bodyJson = new Gson().toJson(bodyMap);
Unirest.setTimeouts(120000, 120000); //加大timeout,防止超时退出
HttpResponse<JsonNode> jsonHttpResponse =
Unirest.post("https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions")
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.body(bodyJson)
.asJson();
OpenAIResponse openAIResponse =
new Gson().fromJson(jsonHttpResponse.getBody().getObject().toString(), OpenAIResponse.class);
rtn.setContent(openAIResponse.getChoices().get(0).getMessage().getContent());
XxlJobHelper.log(openAIResponse.getChoices().get(0).getMessage().getContent());
//TODO 通过钉钉发送分析总结
sendMessage(openAIResponse);
} else {
rtn.setCode(ReturnT.FAIL_CODE);
rtn.setMsg("未找到汇总榜的<script>标签");
}
} else {
rtn.setCode(ReturnT.FAIL_CODE);
rtn.setMsg("未找到汇总榜部分");
}
return rtn;
}
private void sendMessage(OpenAIResponse message){
//TODO
}
}
定时做金融数据分析
总结
[1]https://www.xuxueli.com/xxl-job/
[2]https://bailian.console.aliyun.com/
[3]https://www.xuxueli.com/xxl-job/index.html#二、快速入门
[4]https://mse.console.aliyun.com/schedulerx-xxljob#/schedulerx-xxljob?region=cn-hangzhou
[5]https://free.aliyun.com/?spm=5176.mse-prod.0.0.7429142fhgTdVa&product=1371&crowd=personal
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-03-10
摩根大通CEO戴蒙:落地450个AI应用靠什么?
2025-03-08
安徽某银行基于AI大模型技术在内部审计应用方案
2025-03-01
华泰金工 | 与时偕行:AI模型如何应对数据漂移
2025-02-28
【实用帖】金融从业人员如何高效使用DeepSeek来武装自己(这篇一定会大大提高你的工作效率)
2025-02-28
深度丨金融业迎来“DeepSeek时刻”
2025-02-26
使用大模型进行自动量化交易,从专家决策中学习经验,累计收益47.98%
2025-02-25
行业新知 | DeepSeek在金融领域的典型应用场景
2025-02-24
【ai应用】DeepSeek在金融银行的应用方案
2024-07-18
2024-04-30
2024-07-10
2024-11-26
2024-07-04
2024-06-11
2024-06-20
2024-10-30
2024-03-29
2024-04-23