LearnAIWithMe

LearnAIWithMe

I Built a Gold Trading Bot That Retrains Itself with Claude & NotebookLM

I bolted a self-improving loop onto a free gold RL model. Now it trades XAUUSD live and retrains itself every week while I sleep.

Gencay's avatar
Gencay
Jul 15, 2026
∙ Paid

Two days ago, I caught a headline.

Gold had dropped to its lowest level in months.

The same metal that printed an all-time high of $5,591 back in January was now sitting near $4,040.

It made me curious because I have been testing trading bots all year.

I built a Polymarket bot that made 2.1x in 18 days, a copy-trading bot that copies millionaires on Hyperliquid, and a crypto bot that hit a 77.8% win rate.

But I had never pointed any of this at gold.

One of the oldest currencies on earth, and I had no bot for it.

I am not a finance expert, so I did what I always do.

I went looking for someone who already cracked it.

I found a guy who trained a reinforcement learning model on 23 years of gold data. The same family of methods is used to train our LLMs.

He reports around 60% out-of-sample returns, and he gave away the code.

The prediction brain is his. I added the part he never built. Every week, NotebookLM grades the bot’s trades against trading books, and Claude retrains the model on the findings.

A dashboard shows me the live position.

Claude x Gold champion dashboard on Hermes showing paper portfolio metrics, LONG signal at $4,065, equity curve, and the self-improving loop steps trade, log, autopsy via NotebookLM, retrain, promote, repeat.
Champion view running on Hermes, the six-step loop from trade to autopsy to retrain to promote, all while you sleep.

The Gold Bot I’ve Built with Claude Code and Hermes

Let me first show you the dashboard, live.

The full live dashboard, one window showing the champion, the signal, the equity curve, the six-step self-improving loop, and the trade stream.

At the top left, you see the portfolio. It started at $10,000.

Paper portfolio metrics panel showing equity $10,555.53, total return +5.56%, win rate 54.2%, profit factor 1.36, Sharpe-like 5.1, max drawdown -3.74% over 131 trades.
Paper portfolio scorecard: +5.56% return, 54.2% win rate, 1.36 profit factor, 5.1 Sharpe-like, -3.74% max drawdown.

In the middle, you see the current signal. It comes from the RL model, trained on 23 years of gold data.

Current signal panel reading LONG, an RL deterministic decision on gold (GC=F) at $4,066.10.
The current signal comes straight from the RL model, a deterministic LONG call on gold.

On the right, the equity curve shows how the portfolio changes over time.

Equity curve panel showing the gold bot paper portfolio rising over time, low $10,259.84 and high $10,555.53.
The equity curve: paper portfolio climbing from a $10,259 low to a $10,555 high.

And below it, the gold price itself.

Live XAU/USD candlestick chart on the bot dashboard showing gold trading near $4,058 with high $4,215 and low $4,054.
Live gold price on the dashboard, XAU/USD candlesticks feeding the RL model every minute.

Every minute, the trained model reads the latest gold bars and decides. Long, Short, or sit this one out.

Every decision and every fill gets logged.

Live trade log table streaming timestamped paper trades with LONG side labels and per-trade P&L in green and red, marked paper trading for research and education.
The live trade log streams every fill, each paper trade logged with side and P&L.

The dashboard is one window. The other is Telegram, where the bot reports its position every two hours.

Every two hours the bot reports its position to Telegram, signal, equity, win rate, profit factor

Now, let me explain to you how the gold bot works.

How the Gold Bot Works

Illustrated diagram titled How the Gold Bot Works showing three components — the bot, the Hermes agent on a Mac Mini, and the NotebookLM notebook — connected in a weekly self-improving loop.
How the gold bot works: three pieces, the bot Claude Code wrote, the Hermes agent, and the NotebookLM notebook that retrains it.

The whole thing runs on three pieces.

  • The bot.

    • Claude Code wrote it. Every minute, it reads the latest gold bars and takes the RL model’s call. Long, Short, or Hold.

    • The model wrote its own trading rules by running millions of simulated trades on 23 years of gold data.

    • I never touched the math.

  • The agent.

    • The bot lives on a Hermes agent on my Mac Mini.

    • Hermes runs it on schedule, sends the reports to Telegram, and keeps the trading journal, every decision and every fill.

    • The journal matters because the third piece reads it.

  • The notebook.

    • NotebookLM holds the library, trading books, and RL papers, and answers questions against them.

    • Once a week, Claude carries the journal into the notebook.

    • What comes out trains the model.

The weekly loop is the part that the other bots never had, so it gets its own section.

The Weekly Loop: It Retrains Itself with NotebookLM

Here is my NotebookLM notebook. It holds trading books and RL papers.

NotebookLM chat where the notebook analyzes the champion bot's 3.62 Sharpe and 1.24 profit factor as backtest overfitting, citing PPO and backtesting-overfit source papers.
Weekly autopsy in action, NotebookLM flags the champion's track record as textbook backtest overfitting, citing the sources.

I customized it for one job. Reading weekly trade journals and answering hard questions about them.

NotebookLM Configure chat screen with a custom role prompt defining a quantitative trading risk analyst reviewing a PPO reinforcement-learning gold bot grounded only in attached sources.
NotebookLM customized for one job: a ruthless quant risk analyst grading the bot against PPO papers, FinRL, and overfitting research.

Every week, a Claude routine runs the autopsy. No approval from me. It fires on schedule.

The weekly autopsy fires on its own, a scheduled Claude routine every Sunday at 9AM, no approval needed.

It carries the week’s journal into the notebook and asks the hard questions.

  • Where did the model bleed?

  • Which setups failed?

  • What do the books say the model should have done?

NotebookLM answers with three concrete changes.

Then the retrain. Claude takes those changes and retrains a second model, the challenger.

Telegram alert reading Gold RL Challenger Is Live, comparing champion seed 42 (3.83% return, Sharpe 3.62, profit factor 1.24, 129 trades) against a week-1 challenger auto-retrained on trading books via NotebookLM.
The bot runs a weekly tournament: the champion keeps trading while a NotebookLM-retrained challenger fights to replace it.

The changes stack week over week, so the challenger keeps evolving while the champion, the original bot, keeps trading untouched.

Setting Up the Gold Bot

You do not write any of this from scratch.

I packaged the whole thing into one folder. Five pieces. The trained RL model, the live loop, the weekly autopsy, the dashboard, and the connection skills.

Google Drive folder showing the gold RL trading bot build kit with bot folder, hermes-skill.md and SETUP.md files.
The full gold RL bot build kit in one Google Drive folder — bot, Hermes skill, and SETUP.md.

You point Claude Code at it and answer a few questions. Three things you set up once. One, the bot. Two, the NotebookLM CLI. Three, the weekly loop.

Here is the folder.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2026 Gencay I · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture