>_ DevTrendsja

言語

ホーム

言語

セクション

フロントエンド バックエンド モバイル DevOps AI / ML ゲーム開発 ブロックチェーン 組み込み セキュリティ
Python

How to make seven neural networks argue about quotes: TradingAgents-astock review

Imagine you've gathered seven experts in one room: one watches charts, another reads news, a third digs through company reports, and the fourth is a government policy specialist. They argue until they're hoarse, weigh risks, and at the end hand you a ready-made action plan. That's roughly how TradingAgents-astock works — a fork of the well-known TradingAgents framework, retrained for the specifics of the Chinese stock market.

Why a Fork for China at All

The original TradingAgents project made quite a splash in financial circles (65,000 stars on GitHub speak for themselves). But it had a problem: it was "tuned" for American realities. It pulls data from Yahoo Finance, focuses on the S&P 500 index, and completely doesn't understand why a stock might freeze in place due to price change limits.

The author of TradingAgents-astock decided that simply translating the interface wasn't enough. The Chinese market (A-shares) operates by its own rules: different trading sessions, a T+1 rule in effect (bought today — sell only tomorrow), and most importantly, government policy and actions of major players — the "money masters" — play an enormous role.

Seven Analysts in One Box

In this project, the architecture is built on LangGraph. Instead of one agent trying to grasp the ungraspable, there are seven specialized roles at work.

Four of them were inherited from the original but adapted:

  • Market Analyst watches K-lines and technical indicators.
  • Sentiment Analyst monitors social networks.
  • News Analyst tracks media headlines.
  • Fundamental Analyst studies balance sheets and cash flow.

But the most interesting part is the three new characters created specifically for "Chinese specifics":

  1. Policy Analyst. In China, one word from a regulator can crash an entire sector or send it sky-high. This agent looks for signals in government directives.
  2. "Hot Money" Tracker. It monitors the actions of large private funds and speculators (the so-called "Youzi"), who often set short-term trends.
  3. Share Unlock Monitoring. When major shareholders' lock-up periods end, the market usually braces for turbulence. This agent tracks such dates.

How Decisions Are Made

The process resembles the work of a real investment bank. First, all seven analysts write their reports. Then this data goes to two researchers — "Bull" and "Bear." They start debating, trying to prove to each other whether the asset will rise or fall.

After the debate, a risk manager joins in. They run the strategy through three filters: aggressive, conservative, and neutral. And only at the very end does the final agent (Portfolio Manager) deliver the verdict: buy, hold, or sell, and what position size to allocate.

Interestingly, the author separated models by complexity. For simple tasks (analysts, debates), "fast" LLMs are used, while "deep" models like MiniMax-M2.7 or Claude handle final synthesis and decision-making.

Technical Stack and Data

The main pain point of any fintech project is where to get data. Usually, it's either expensive or requires a bunch of API keys. Here, the author implemented direct connections to open sources like East Money, Sina Finance, and Baidu. And it was done smartly: there's a built-in delay and rate-limit mechanism so Chinese servers won't ban you after the first run.

The project doesn't require Docker to run, although it's provided as an option. Just regular Python 3.10 and pip install.

You'll need API keys from neural networks to work. The project supports almost everything: from DeepSeek and Qwen to OpenAI and Anthropic. If you're in Russia and using a proxy to access foreign APIs, you can configure backend_url in the config.

Web Interface and Reports

For those who don't want to mess with the console, there's a nice UI on Streamlit. You enter a stock code (for example, 688017), select a date, and the system starts "thinking."

Web UI

The entire process is transparent: you can expand each of the seven analysts' reports and read why they consider a particular stock promising. The final report can be exported in Markdown or PDF — convenient if you keep an investment journal.

Is It Worth Trying

If you're into algorithmic trading or just interested in applying LLMs in finance, the project definitely deserves to be cloned and explored. Even if you don't trade on the Chinese market, the multi-agent debate architecture is implemented very clearly here.

However, don't forget the disclaimer: this is a research tool. AI can make mistakes, hallucinate, or misinterpret irony on social media. Using it as the sole advisor for real money is a risky endeavor. But as an assistant that gathers in 5 minutes information that would take a person half a day to compile, TradingAgents-astock works great.

The project is actively updated, the author promptly fixes font encoding bugs in PDF and adds support for new models. If you were lacking an example of how LangGraph can solve complex analytical tasks in the real world — here it is.

関連プロジェクト