I Made an AI That Invents a New Trading Strategy Every Morning
7:40 a.m. The coffee is still dripping, and my terminal already holds a new file: strategy_research_20260807.ipynb. Four minutes earlier, a…

I Made an AI That Invents a New Trading Strategy Every Morning
7:40 a.m. The coffee is still dripping, and my terminal already holds a new file: strategy_research_20260807.ipynb. Four minutes earlier, a subagent inside opencode pulled three random trading notes from my Obsidian vault, mashed them into a brand-new quantitative strategy, backtested it on SPY. I hadn't touched a single line of code.
But before we get to the steps, one confession: this machine is only as smart as your library. The real fuel — the thing that makes every other step work — is the Obsidian vault sitting behind it. I have more than 700 articles, notes, and trading ideas saved there, a large knowledge base I’ve been quietly building for months. That library is the foundation. Without it, my subagent has nothing to synthesize; with it, every morning it can reach into seven hundred ideas and pull out combinations no human would ever file together. So if you haven’t started your vault yet, start there. The four steps build the machine. Your notes make it worth building.
Step 1 — Give the machine a room of its own
mkdir research. That's the whole step, and it's embarrassingly easy to skip.
A dedicated project folder buys you three things scattered files never will: your agent config lives in one place, every generated notebook lands in the same directory, and the whole thing can be committed to git, so future-you can answer the question “what was I testing in March?” The folder isn’t storage. It’s a paper trail.
Step 2 — Write the skill that teaches the AI your job
opencode doesn’t know anything about Bollinger Bands or Sharpe ratios out of the box. It learns the way a new hire does: someone writes down the workflow. That someone is you, and the document is a skill — a markdown file with YAML frontmatter and a body of instructions.
Create .opencode/skills/quant-strategy-researcher/SKILL.md.
---
name: quant-strategy-researcher
description: Reads trading research notes from Obsidian notes, synthesizes signal logic, and generates a fully runnable Python Jupyter Notebook (.ipynb) in VS Code to backtest the strategy. Use when the user wants to turn their strategy research notes or backtest ideas into executable code, wants a backtesting notebook, or mentions Obsidian strategy notes, trading signals, entry/exit rules, or vectorized backtests.
---
# Quant Strategy Researcher & Notebook Builder
## Overview
This skill instructs OpenCode to act as a Quantitative Trading Developer. It scans local Obsidian vault notes for strategy ideas, risk rules, and indicator parameters, translates them into vectorized Python code, and outputs a structured Jupyter Notebook (`.ipynb`) ready for execution in VS Code.
---
## Workflow Steps
### 1. Source Knowledge Extraction (Obsidian Vault)
* Prompt the user for the absolute path to their Obsidian Vault or specific strategy note directory (or search local paths if provided).
* Read and parse markdown files (`.md`) containing trading concepts, indicator definitions, entry/exit rules, or market hypotheses.
* Extract core elements:
* **Asset class & tickers** (e.g., BTC/USD, SPY, Forex pairs)
* **Signal logic** (e.g., Moving Average Cross, RSI Divergence, Mean Reversion)
* **Risk parameters** (Stop Loss %, Take Profit %, Trailing Stop, Position Sizing)
* **Timeframe** (1m, 1h, 1D)
### 2. Strategy Formalization
Before writing code, summarize the extracted strategy in clear mathematical and logical terms:
* **Indicators required** (e.g., SMA, EMA, RSI, ATR)
* **Entry Trigger**: Exact condition for Long / Short
* **Exit Trigger**: Stop Loss, Take Profit, or Signal Reversal
### 3. Notebook Generation (`.ipynb`)
Create a clean, self-contained Jupyter Notebook in the current VS Code workspace with the following structured cells:
#### Cell 1: Dependencies & Setup (Markdown & Code)
* Install/import required libraries: `pandas`, `numpy`, `yfinance` (or `vectorbt` / `backtrader`), `matplotlib` / `plotly`.
#### Cell 2: Data Fetching & Cleaning (Code)
* Fetch historical market data using `yfinance` or load local OHLCV CSVs.
* Sanitize missing values and ensure datetime indexing.
#### Cell 3: Technical Indicators & Signal Generation (Code)
* Calculate technical indicators programmatically using Pandas/NumPy.
* Compute vector signals: `1` (Long), `-1` (Short), `0` (Cash/Hold).
#### Cell 4: Vectorized Backtest & Performance Metrics (Code)
* Compute strategy returns, equity curve, Sharpe Ratio, Max Drawdown, and Win Rate.
* Account for friction (trading commissions and slippage).
#### Cell 5: Visualization (Code)
* Plot price chart with Buy/Sell markers.
* Plot Cumulative Strategy Returns vs. Benchmark (Buy & Hold).
---
## Execution Guidelines for OpenCode
1. **No External APIs Required for Data**: Default to standard `yfinance` or Pandas data structures unless specified otherwise.
2. **Interactive Kernel Ready**: Ensure all code cells use explicit `print()` or `plt.show()` so output displays seamlessly in the VS Code Jupyter extension.
3. **Traceability**: Add code comments mapping back to the original Obsidian note references (e.g., `# Logic derived from Obsidian note: Strategy_v1.md`).
The name matters for discovery. The description matters more — it’s what the AI reads when deciding whether to load the skill, so make it specific enough that the machine never confuses this with a general-purpose code skill. Then comes the body, where you do the real teaching.
Train it to:
- Read the vault’s markdown notes and extract the core trading concept
- Pull out the signal logic, the risk parameters, and the timeframe
- Formalize the strategy mathematically, in equations a human and a machine can both check
- Generate a structured 5-cell Jupyter notebook:
- Dependencies — install everything needed to run
- Data — fetch the series with yfinance
- Indicators & vector signals — the math, applied to the whole series at once
- Vectorized backtest — Sharpe ratio, max drawdown, win rate, and transaction friction
- Visualization — strategy equity plotted against buy-and-hold
Then make it global. Drop the same folder into ~/.config/opencode/skills/ and the skill follows you into every project on that machine, ready in any directory, forever. One workflow, trained once.

Step 3 — Promote the skill to a subagent
A skill is a handbook. A subagent is a colleague who reads it. That shift in mental model is the entire trick of this step.
Create .opencode/agents/quant-strategy-researcher.md:
---
description: Use when the user wants to turn strategy research notes
into an executable backtest notebook
mode: subagent
---
You are the quant strategy researcher.
Load the quant-strategy-researcher skill and follow it exactly.
Read the Obsidian notes, synthesize a strategy, and produce the notebook.
The description tells your main agent when to delegate. mode: subagent means it runs in its own child session with fresh context. And the body of the file becomes its system prompt — the personality, the marching orders, the whole job description.
Skills live at skills/<name>/SKILL.md, but agents live at agents/<name>.md. Different folder, different filename shape, same idea.
Restart opencode. Type @quant-strategy-researcher. The name appears in the completion list like a saved contact. You now have a quant on call.
Step 4 — Ring the bell every morning
Here’s the daily prompt. You can run it by hand or schedule it, but the text never changes:
Open the Obsidian vault. Pick 3 different strategy notes at random.
Extract one key concept from each,
synthesize a brand-new quantitative strategy hypothesis,
and document the rationale.
Then generate a backtest notebook named strategy_research_YYYYMMDD.ipynb.
Report the results honestly.
Random notes. New synthesis. Honest results. Every single day.
The loop takes four minutes. You don’t watch it, and you don’t steer it. You come back to a notebook that names itself after the date.

So the notebook becomes the next morning’s starting point.
Want to see what the agent actually produced? Here’s the exact notebook it wrote for that morning’s run:
strategy_research_20260807.ipynb on Google Colab.
No hand-written cells. Open it, and you’re looking at proof the machine does the creating.
Why I trust a machine that loses money
Here’s the uncomfortable truth at the center of this whole setup: the machine is honest because it has nothing to prove.
A human researcher with a new strategy has incentive to polish it. Tune one parameter here, smooth one curve there, and suddenly the backtest looks like a rocket ship. The agent doesn’t care.
That’s worth more than a winning strategy. Anyone can find a backtest that makes money. Almost nobody can find one that tells you the truth.
And step back — the real product of this machine isn’t any single strategy. It’s the habit. Three hundred sixty-five hypotheses a year, each documented, each tested, each judged by the same cold metrics. Most will lose. Some will win. Every single one teaches you something about exposure, or risk. The market is a filter. This agent is the sieve.
The trade I’ll take every day
And if you’re worried your first strategy won’t be perfect — relax. The invented strategy is not the product. That’s your first real step toward letting an AI agent do research for you — automatically, every morning, whether you’re at your desk or not.
메타데이터
- post_id
- cb4f0b5f5d4d
- slug
- i-made-an-ai-that-invents-a-new-trading-strategy-every-morning-cb4f0b5f5d4d
- url
- https://medium.com/@wl8380/i-made-an-ai-that-invents-a-new-trading-strategy-every-morning-cb4f0b5f5d4d
- canonical_url
- https://medium.com/@wl8380/i-made-an-ai-that-invents-a-new-trading-strategy-every-morning-cb4f0b5f5d4d
- author_url
- https://medium.com/@wl8380
- status
- ok
- fetched_at
- 2026-08-07 15:35:12