Note
π Zero-cost autonomous trading is here
No OpenAI subscription. No Brave API key. No hidden costs. One command:
npx llm-trader-opencode --continuousYour agent gets a free model, keyless web search, and FRED macro confluence β then trades Alpaca's paper market on its own.
Tip
Fully automated. Fully free.
The agent sleeps nights, weekends, and holidays. It wakes at the opening bell, checks macro confluence, scans news sentiment, and only pulls the trigger when at least 2 of 3 signals agree.
Total LLM bill after months of continuous running: $0.00.
npm i -g llm-trader-opencode && llm-trader --continuousYou juggle charting tools, news feeds, macro calendars, and gut feelings. You second-guess entries. You chase moves that already happened.
We already did that work. Tested every signal combination. Kept only what actually gates a bad trade.
Install LLM Trader. Type llm-trader --continuous. Done.
We are past the era of reading documentation. Just paste this into your agent:
Read this and tell me if this free AI trading agent is legit or vaporware:
https://raw.githubusercontent.com/Parithosh-Varma/llm_trader-opencode/main/README.md
Copy and paste this prompt into your LLM agent (Claude Code, OpenCode, Cursor, etc.):
Install and configure the llm-trader trading agent by following these steps:
1. Run: npm i -g llm-trader-opencode
2. Create a free API key at https://opencode.ai
3. Create a free paper trading account at https://app.alpaca.markets/paper/dashboard/overview
4. Write a .env file with OPENCODE_API_KEY, ALPACA_API_KEY, ALPACA_SECRET_KEY,
MODEL=x-preview-f-free, PROFILE_NAME=opencode
5. Run: llm-trader --continuous
Or follow the Quick Start below β but seriously, let your agent do it. Humans make config mistakes.
npx llm-trader-opencode # single session
npx llm-trader-opencode --continuous # every 30 min during market hours| Feature | What It Does | |
|---|---|---|
| π | Zero LLM Cost | Powered by x-preview-f-free via OpenCode Zen β no credit card, no token metering |
| π | Keyless Web Search | DuckDuckGo HTML scraping β no API key, no quotas, no setup |
| π | Macro Confluence | FRED integration checks rates, inflation, unemployment, VIX & yield curve before every trade |
| π§ | 2-of-3 Signal Rule | Trades execute only when macro + news + price action agree |
| π° | Alpaca Paper Trading | $100K virtual capital on real market data |
| β° | Market-Hours Scheduler | Sleeps nights and weekends, wakes at the open, handles timezone conversion automatically |
| π | Auto Reporting | Portfolio dashboard, per-trade P&L, and CSV reports refresh after every session |
| π³ | Docker Ready | One-command deployment with persistent volumes |
The agent doesn't guess. Before executing any trade it checks three independent signal sources:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1οΈβ£ MACRO (FRED) β
β β’ Federal Funds Rate trend β
β β’ CPI / inflation level β
β β’ Unemployment rate β
β β’ VIX fear index β
β β’ Yield curve shape (10Yβ2Y spread) β
β β
β 2οΈβ£ NEWS SENTIMENT (DuckDuckGo) β
β β’ Real-time stock-specific headlines β
β β’ Market mood from search results β
β β
β 3οΈβ£ PRICE ACTION (Yahoo Finance) β
β β’ Current price vs recent movement β
β β’ Momentum indicators β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΌ
At least 2 of 3 agree β EXECUTE TRADE
Fewer than 2 agree β STAY IN CASH
This dramatically reduces false signals and prevents the agent from trading blind.
| Service | Cost | Sign Up |
|---|---|---|
| OpenCode Zen | Free | Get your API key |
| Alpaca Paper | Free | Instant paper account ($100k virtual) |
| FRED | Free (optional) | For macro confluence |
Total cost: $0
git clone https://github.com/Parithosh-Varma/llm_trader-opencode.git
cd llm_trader-opencode
npm install
# Create .env
cat > .env << 'EOF'
OPENCODE_API_KEY=your_key_here
ALPACA_API_KEY=your_alpaca_key_id
ALPACA_SECRET_KEY=your_alpaca_secret_key
FRED_API_KEY=your_fred_key_here
MODEL=x-preview-f-free
PROFILE_NAME=opencode
ALPACA_BASE_URL=https://paper-api.alpaca.markets
EOF
# Run a single trading session
npm startnpm i -g llm-trader-opencode
# Create your .env in whatever directory you want to trade from
cat > .env << 'EOF'
OPENCODE_API_KEY=your_key_here
ALPACA_API_KEY=your_alpaca_key_id
ALPACA_SECRET_KEY=your_alpaca_secret_key
FRED_API_KEY=your_fred_key_here
MODEL=x-preview-f-free
PROFILE_NAME=opencode
ALPACA_BASE_URL=https://paper-api.alpaca.markets
EOF
llm-trader # single session
llm-trader --continuous # every 30 min during market hours
llm-trader --continuous --interval=120 # custom interval (minutes)docker-compose up --build -d
docker logs -f priced-in-opencode# Required
OPENCODE_API_KEY= # Your OpenCode Zen key
ALPACA_API_KEY= # Paper trading key ID
ALPACA_SECRET_KEY= # Paper trading secret
# Optional
FRED_API_KEY= # Enables macro confluence
MODEL=x-preview-f-free # Default free model
PROFILE_NAME=opencode # Results directory name
OPENCODE_BASE_URL= # Override endpoint if needed- β Runs every 30 minutes during market hours (9:30 AM β 4:00 PM ET)
- β Automatically sleeps nights, weekends, and holidays
- β Wakes up at market open each trading day
- β Handles timezone conversion automatically
Every session writes to results/{profile}/:
README-{profile}.mdβ live dashboard: portfolio value, CAGR, holdings, last 10 trades with P&Lpnl_{model}_{date}.csvβ per-trade P&L reports for cross-model comparisonthread-{profile}.jsonβ persisted conversation history for session continuityagent-{profile}.logβ full activity log
npm test # All 37 tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportArchitecture
OpenCode Zen API ββββΊ Agent SDK (@openai/agents) ββββΊ Alpaca Paper Trading
β β β
β Tool Execution Loop β
β β β
βΌ βΌ βΌ
x-preview-f-free FRED + DuckDuckGo + Yahoo Market Orders
(Chat Completions) (Confluence Signals) (Buy/Sell/Short)
To remove llm-trader:
-
Remove the global CLI
npm uninstall -g llm-trader-opencode
-
Stop containers (if using Docker)
docker-compose down
-
Delete trading data (optional)
rm -rf results/ logs/
I wanted an autonomous trading agent that actually runs every single day β without a $200/month subscription and without juggling five API keys.
OpenCode Zen gave the model away free. DuckDuckGo gave search away free. Alpaca gave the broker away free. So I built on top of all three.
Every problem I hit running agents continuously β schema validation crashes, thread corruption, market-hours scheduling, rate limits β is already solved in this codebase. Clone it and let it work.
Not affiliated with any of the services mentioned above. Just personal experiments. Paper trading only β never real money.
Warning
Disclaimer
This software executes trades on Alpaca's paper trading platform using virtual money. It does not trade real capital. Past performance does not guarantee future results. Always do your own research before investing real money.
MIT