Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Gemini TradingAgents

Run 4 Gemini 4 models as one hedge fund desk.

Built on TauricResearch/TradingAgents, HKUDS/Vibe-Trading and google/adk-python. Not affiliated with Google or Tauric Research. The command-line tool is called gemini-tradingagents.

One command, four Gemini 4 models. Gemini 4 Neon thinks up the trade, Hydrogen backtests it, Argon argues it like a hedge fund committee, and Carbon decides: GO, GO SMALLER or NO-GO, with entry, stop, two targets and position size. Built on three of the most-starred open-source trading projects and Google's own agent framework.

Requirements: Python 3.11, 3.12 or 3.13, and one Gemini API key on a Google project with billing enabled. Windows, macOS, Linux. Market data needs no extra keys.

Billing is required: Gemini 4 Argon, Neon and Carbon have no free tier, and Hydrogen's free tier (20 requests a day) is not enough for one report. See Cost.

gemini-tradingagents AAPL

 1. Neon     ─▶ the brain           thesis + test plan (TradingAgents, or Gemini directly)
 2. Hydrogen ─▶ Vibe-Trading        prices, fundamentals, news; backtests Neon's plan + walk-forward
 3. Argon    ─▶ committee           bull vs bear vs risk officer vs portfolio manager   (2 and 3 run at the same time)
 4. Carbon   ─▶ ADK judge           reads everything ─▶ GO / GO SMALLER / NO-GO + entry, stop, Target 1, Target 2
 5. Python   ─▶ hard risk rules + Jane Street rules   only stricter ─▶ position size ─▶ optional Alpaca PAPER order

What it is built on

JobProjectStarsLicenseGemini 4 model
The brain: thesis and test planTauricResearch/TradingAgents123,757Apache-2.0gemini-4-neon
Data pack, backtests, walk-forwardHKUDS/Vibe-Trading38,915MITgemini-4-hydrogen
Investment committee (investment_committee preset)HKUDS/Vibe-Trading38,915MITgemini-4-argon
Final judgegoogle/adk-python22,355Apache-2.0gemini-4-carbon

Optional plugin (install.ps1 -WithHedgeFund / install.sh --with-hedge-fund): virattt/ai-hedge-fund (64,851 stars, MIT), an investor committee of Graham, Buffett, Munger and earnings drift on gemini-4-argon. It runs only when FINANCIAL_DATASETS_API_KEY is set (financialdatasets.ai, $20 one-time for 1,000 requests).

Stars from the GitHub API on 2026-11-25. gemini-tradingagents installs these as separate tools and calls their command lines; it copies none of their code. This repo is MIT.

Why each model got its job

ModelGoogle's descriptionPrice per 1M tokens (in / out)Vals Finance Index
gemini-4-hydrogenfast daily driver$1.50 / $7.50#3 of 46
gemini-4-argonflagship reasoning model$2 / $10 until Nov 30 2026, then $4 / $20#4 of 46
gemini-4-neonbetween Carbon and Hydrogen$3 / $15#1 of 46 (68.31%)
gemini-4-carbonbuilt on Argon, strongest for tasks that test the limits$2 / $10 until Nov 30 2026, then $4 / $20#2 of 46

Prices: aistudio.google.com/docs/pricing. Rankings: vals.ai model pages. Both read on 2026-11-25. Any job can move to another model in .env (GD_MODEL_COLLECTOR, GD_MODEL_ANALYST, GD_MODEL_STRATEGIST, GD_MODEL_JUDGE).

Install

Python 3.11, 3.12 or 3.13.

# Windows (PowerShell)
.\install.ps1

# macOS / Linux
sh install.sh

The installer works like pipx: each tool gets its own environment, because their dependencies clash (ai-hedge-fund pins langchain-core<0.4, Vibe-Trading needs >=1.0). .venv holds gemini-tradingagents and google-adk 2.15.1; .tools/vibe holds vibe-trading-ai 0.1.19; .tools/aihf holds aihf 2.7.2 only with -WithHedgeFund / --with-hedge-fund; TradingAgents 1.0.1 comes from its official installer. gemini-tradingagents runs each tool by full path and imports none of them. Put one key in .env:

GEMINI_API_KEY=...        # aistudio.google.com

TradingAgents publishes Linux and macOS builds. On Windows the installer puts it inside WSL. If WSL has no Linux distribution yet, the installer prints the one command to run (wsl --install, once, as administrator); until then the Neon research question goes straight to Gemini and the report labels it "TradingAgents not available".

Check the setup:

gemini-tradingagents doctor        # which tools are installed, which keys are set (values never printed)
gemini-tradingagents models        # which model does which job

Use

gemini-tradingagents AAPL                       # all stages, one Markdown report in reports/
gemini-tradingagents AAPL --fast                # cheapest mode (see Cost)
gemini-tradingagents AAPL --only brain,vibe     # pick stages (brain, vibe, committee, aihf); the judge always runs
gemini-tradingagents --dry-run AAPL             # print every command that would run, call nothing
gemini-tradingagents AAPL --paper               # print the Alpaca PAPER bracket order from the latest verdict
gemini-tradingagents AAPL --paper --send        # send it to Alpaca PAPER (paper-api.alpaca.markets only)
gemini-tradingagents audit strategy.py --report backtest.txt   # Neon lists bugs, Carbon confirms each one

Every run also saves the data pack (reports/<TICKER>-<time>-datapack.json and .md): Python price metrics from Yahoo Finance with their as-of date, plus Vibe-Trading's prices, fundamentals, news and backtest with sources. The committee, Neon and the judge all work from it.

The report has the final verdict, the hard-rule checks, the judge's reasons and the conflicts it found between the three systems, the position size computed in Python, the target position with Target 1 (1R) and Target 2 (the judge's target, or 2.5R if it gave none), every tool's command and output, and the cost of the direct Gemini calls.

Cost

Rough cost of one report at Google's list prices, measured from Vibe-Trading's token logs (each of its model calls carries 60-110K input tokens). Google bills cached input at a lower rate, so real bills are usually lower.

ModeWhat runsApprox. list price per report
--fastNeon plan, Vibe-Trading 4 steps, one Argon committee call, Carbon judgeunder $0.50
defaultNeon plan, Vibe-Trading 10 steps, Vibe-Trading 4-agent committee, Carbon judgeabout $1.50-2.50
--deepVibe-Trading 30 steps on 2 years of data, plus the defaultseveral dollars

Every report ends with a per-stage token and price table. Set a budget alert on your Google Cloud project (Billing > Budgets & alerts) before running it on a schedule.

Hard rules

Checked in plain Python after the judge. The judge can be stricter, never looser; the final verdict is the stricter of the two.

RuleDefault.env
Max loss at stop per trade1% of capitalGD_MAX_RISK_PCT
Max position size20% of capitalGD_MAX_POSITION_PCT
Min reward:risk1.5GD_MIN_REWARD_RISK
Stop at least this many ATR(14) away0.5GD_MIN_STOP_ATR
Entry no further from last close3%GD_MAX_ENTRY_GAP_PCT
Daily loss limit2%GD_MAX_DAILY_LOSS_PCT
Kill switcha file named KILL blocks every tradeGD_KILL_SWITCH

Jane Street rules inside

Inspired by Jane Street's public materials. Not affiliated with or endorsed by Jane Street. Jane Street offers no retail apps or accounts (fraud and impersonation warnings).

Jane Street publishes no trading rulebook. The rules below come from its public materials (the Probability & Markets guide, the podcast Signals and Threads, its tech blog), from The Laws of Trading (Wiley, 2019) by Agustin Lebron, a former Jane Street trader (paraphrased, as summarized in this review), and from standard math. Only Jane Street lines are quoted word for word. Each one runs in plain Python after the judge. Like the hard rules, they can only block a trade or shrink it, never loosen it, and a missing answer counts as NO-GO. Several "half size" rules do not compound: the size is halved once.

#RuleSource (exact quote, or "standard math")What the code does
1Fail closed on bad dataJane Street, Signals and Threads: "being sloppy with data science is fatal"NO-GO if entry, stop, targets or ATR14 are missing, or the last bar is over 4 days old
2Know why you tradeparaphrased from Agustin Lebron (ex-Jane Street), The Laws of Trading, 2019: know why you are trading before you tradeNO-GO without a thesis and an invalidation
3Explain your edgeparaphrased from Lebron: if you cannot explain your edge in a few minutes, it is not a good oneNO-GO without an edge, or with more than 5 sentences
4Who is on the other side?Jane Street guide: "Adverse selection is the idea that the trades you get to do are worse than they would appear"NO-GO unless the judge names the counterparty and why they trade with you
5Two independent yesesrepo idea (pre-trade checks)NO-GO if Neon's plan or the Argon committee points the other way; half size if the committee is neutral, split, missing, or has no real bear case (rubber stamp)
6Don't chaseJane Street guide (adverse selection)NO-GO if the entry is more than 1 ATR beyond the last close in the trade direction
7Cool offrepo idea (kill hierarchy)NO-GO for 24 h after 3 losses in a row in the journal
8Keep scorestandard math (Brier score, calibration)after 20 resolved calls, the judge's probability is scaled by hit rate / predicted rate (only ever down)
9Positive expected value after costsJane Street guide: "If you know the expected value of something, you should be happy to buy for less or sell for more." Paraphrased from Lebron: if your costs look negligible next to your edge, one of the two estimates is wrongEV in R from the judge's probability minus 0.05, half out at Target 1 and half at Target 2, minus fees (10 bps) and slippage (0.1 ATR); EV <= 0 is NO-GO
10Never pay above valueJane Street guide (expected value above); idea from RasmusCodes/figgie-botNO-GO if a long's entry is above p x Target 1 + (1 - p) x stop (mirror for shorts)
11Size by edgestandard sizing math (Kelly/Thorp)quarter Kelly; if it allows less than the 1% rule, the size is cut; Kelly <= 0 is NO-GO
12Take only paid risksparaphrased from Lebron: take only the risks you are paid for and hedge the restany unpaid risk the judge lists (earnings, macro, unlock) halves the size
13The model may remember the test periodJane Street blog, Mitigating memorization in LLMs: "A model may perform well on a historical benchmark by consulting its memorized knowledge of past outcomes"half size unless out-of-sample data runs past GD_JS_MODEL_CUTOFF (default 2026-01-01)
14Edges decaystandard practicehalf size if the backtest's recent half earned under 50% of the older half, lost money, or was not reported
15Purged walk-forwardJane Street blog, Flex Model: "The same feature code ran live and in historical mode"; embargo idea from Kaggle Jane Street solutionsHydrogen is asked for an embargo of max(lookback, holding period) bars between train and test; half size if it is shorter or not reported
16Use liquid instrumentsparaphrased from Lebron: express a risk through the most liquid instrumentposition <= 1% of 20-day average dollar volume
17Survive the unseenparaphrased from Lebron: something that never happened can still happena 2 ATR gap past the stop must cost <= 3% of capital, otherwise the size is cut
18The AI never types the orderrepo ideas (pre-trade checks; one order per symbol and side)--paper refuses if any order field differs from the Python-validated plan, the endpoint is not paper-api.alpaca.markets, existing position + open orders + the new order exceed the 20% cap, or an open order on the same symbol and side exists
19Limits are frozenrepo idea (an agent may never raise limits)limits come only from .env; any extra field in the judge's output is dropped, and the prompt says it may not propose changing limits or disabling the kill switch

Every rule, its result and its numbers go into the report. Each real run appends one line to reports/journal.csv. gemini-tradingagents score resolves past calls against later daily bars (Target 1 before the stop is a win, the stop first is a loss, both in one bar is a loss) and prints the hit rate, mean predicted probability, Brier score and a calibration table. Thresholds are in .env: GD_FEE_BPS, GD_SLIPPAGE_ATR, GD_P_MARGIN, GD_KELLY_FRACTION, GD_MAX_ENTRY_ATR, GD_MAX_ADV_PCT, GD_GAP_ATR, GD_MAX_GAP_LOSS_PCT, GD_MAX_DATA_AGE_DAYS, GD_UNPAID_RISK_CUT, GD_HALF_CUT, GD_JS_MODEL_CUTOFF, GD_DECAY_RATIO, GD_MIN_RESOLVED, GD_COOLOFF_LOSSES, GD_COOLOFF_HOURS.

Ideas from (no code copied): voyager67/JaneStreet-Agentic-Skills (Apache-2.0), EnriqueKhai/JaneStreetETC22 (BSD-3-Clause), RasmusCodes/figgie-bot (MIT), scaomath/kaggle-jane-street and evgeniavolkova/kagglejanestreet (no license; ideas only).

Data and keys

StageWith only a Gemini keyOptional key
Vibe-Trading (data pack, committee)US stocks via yfinance and public APIs that need no key (Yahoo, Stooq, Sina, Eastmoney); crypto via OKX public APIFinnhub, Alpha Vantage, Tiingo, FMP, FRED
TradingAgentsworks from the data pack passed in the questionTAURIC_API_KEY lets it fetch filings, statements and news itself (tauric.ai)
ai-hedge-fund pluginoffFINANCIAL_DATASETS_API_KEY (financialdatasets.ai: $20 one-time for 1,000 requests, or $200/month) or an x402 wallet
Judge price metricsYahoo Finance chart data, computed in Pythonnone

Yahoo Finance data is for personal use. gemini-tradingagents fetches data at run time and never stores or redistributes it (reports/ and caches are git-ignored).

See it on TradingView

Every run also writes reports/<TICKER>_<time>.pine, a Pine Script v6 indicator with that run's entry, stop, Target 1, Target 2, verdict and panel filled in:

  1. Open TradingView and the Pine Editor (bottom panel).
  2. Paste the whole reports/<TICKER>_<time>.pine file.
  3. Click Add to chart.

It draws the levels with price tags, a RISK 1R box and a REWARD box from the signal bar, a LONG / SHORT label and a verdict panel. gemini_tradingagents/pine_template.pine is the same script with blank levels: paste it and type your own levels in the indicator settings.

Paper trading

--paper turns the target position into Alpaca bracket orders: limit entry, stop-loss, whole shares; half the shares take profit at Target 1, the rest at Target 2 (one share: a single bracket to Target 2). It prints by default. --send posts it to https://paper-api.alpaca.markets with ALPACA_KEY / ALPACA_SECRET from an Alpaca paper account (no deposit needed). The code contains no live-trading endpoint. It refuses dry-run results and NO-GO verdicts. Stocks only.

Credits

  • google/adk-recipes financial-advisor sample (Apache-2.0): the data → trading → execution → risk layout.
  • kweinmeister/agentic-trading (Apache-2.0): a risk guard with hard rules that can veto the trader.
  • mandates/committee.yaml follows the mandate format of ai-hedge-fund's hedge_fund/fund/example.yaml (MIT).

Research and paper trading only. Not financial advice.

关于 About

No description, website, or topics provided.

语言 Languages

Python95.5%
PowerShell3.3%
Shell1.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
19
Total Commits
峰值: 19次/周
Less
More

核心贡献者 Contributors