Build an AI-Powered Financial Data Analyzer with XXL‑JOB and Deepseek

This guide explains how to create a scheduled financial data analysis system by integrating the XXL‑JOB distributed task scheduler with the Deepseek large‑model AI, covering model selection, local and cloud deployment options, job configuration, and a complete code example for automated news processing.

Alibaba Cloud Developer
Alibaba Cloud Developer
Alibaba Cloud Developer
Build an AI-Powered Financial Data Analyzer with XXL‑JOB and Deepseek

Overview

Large‑model AI has become ubiquitous, with common scenarios such as content creation, chatbots, and logical reasoning. In addition to interactive, human‑initiated use cases, many business processes can be automated through scheduled tasks that invoke AI for risk monitoring and data analysis.

Choosing Deepseek

Deepseek is selected for its strong inference capabilities suited to data analysis, its lightweight open‑source nature, and its backing by a quantitative‑trading company, which suggests advantages in financial analysis.

Option 1: Local Deployment

Install ollama from https://ollama.com/download, then install the Deepseek‑r1 model. Choose a model size based on hardware (e.g., 7B model for a machine with 16 GB RAM) and run the installation command shown in the image.

After deployment, test the model via the OpenAI‑compatible API (default port 11434).

Option 2: Cloud Service

Alternatively, use Alibaba Cloud Bailei or the MSE XXL‑JOB managed service, which provides one‑click deployment, free quotas, and the ability to switch models on demand.

Deploy XXL‑JOB

XXL‑JOB is a popular open‑source distributed task scheduler that supports single‑machine and distributed timed tasks, offering features such as alarm monitoring, manual operation, and a dashboard. Its advantages include:

Scheduled AI task invocation.

Dynamic prompt and response format via task parameters.

Broadcast sharding to split large tasks into smaller parallel jobs.

Task dependency orchestration to build AI data‑analysis pipelines.

Demo: Scheduled Financial News

The demo shows how to schedule a job that fetches top financial news from Sina, sends the content to Deepseek for summarization, and pushes the result to DingTalk. The workflow consists of three steps: trigger the XXL‑JOB task, fetch and filter news, and invoke Deepseek with a prompt.

@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";
        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) {
            Element scriptTag = summaryBlock.parent().selectFirst("script[src]");
            if (scriptTag != null) {
                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);
                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());
                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: implement notification
    }
}

Conclusion

With Deepseek and XXL‑JOB, building an intelligent financial analysis pipeline becomes straightforward, and the same architecture can be adapted to any domain that requires automated data collection, AI‑driven analysis, and report generation.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AItask schedulingdata analysisXXL-JOBFinancial AI
Alibaba Cloud Developer
Written by

Alibaba Cloud Developer

Alibaba's official tech channel, featuring all of its technology innovations.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.