Bryan Downing (@quantlabs) header
Bryan Downing (@quantlabs) profile picture

I blog about being a quant researcher & developer. It seems I like blending my knowledge of technology and the capital markets field.

Joined January 2011
Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)Photo by Bryan Downing (@quantlabs)
The HFTCODE Trading Bot Customer Community is now fully public—for now—and free to join. Thank you to everyone who encouraged us to open it up. Your interest and feedback helped get this started, and I’m looking forward to seeing what we can learn from one another. If you’re building trading bots, learning to code, or exploring how AI fits into a trading workflow, you’re welcome to join. You don’t need to have a finished system or years of experience to introduce yourself and ask a question. Here are some of the conversations I’d like us to have: → Python and C++ development for trading → Interactive Brokers connections and automation → Futures contracts, exposure, and position sizing → Market-data quality and troubleshooting → Backtesting and paper trading → AI-assisted research and code development → Risk checks, execution controls, and failure testing There’s plenty to discuss beyond “Can this bot place an order?” How do you know the data is usable? What happens when the broker connection drops? How do you catch duplicate orders? What keeps an AI-generated suggestion from turning into an unchecked trading decision? Those are the kinds of practical questions worth exploring together. Recent community updates include guides on individual stock futures, CME’s single-stock futures lineup, and building a controlled Claude-assisted trading system with Python and Interactive Brokers. I’ve also been sharing updates on my own AI tools and development workflow. But I don’t want this to be only a place where I post updates. Bring your questions, share what you’re testing, and tell us where you’re getting stuck. Something you’ve learned could save another member hours of troubleshooting. A quick word about access: We’re keeping the community public and registration free for now. We’ll do our best to keep spammers and scammers out so that genuine members can have useful conversations. If fully public access becomes too difficult to manage, our fallback may be to require a paid product purchase for new members to enter. Our intention is to preserve access for people who register during this free period if that requirement becomes necessary later. If you’d like to be part of the community, register now rather than just bookmarking the page. Try it here and register for free: hftcode.com/a/members/commun… Once you’re in, introduce yourself: • What are you building or learning? • Which tools and markets are you working with? • What’s one problem you’d like help solving? Thanks again to everyone who encouraged this. Let’s make it a useful place to learn, compare notes, and have honest discussions about what works—and what doesn’t. Educational discussion only, not investment advice. Automated trading carries real risks, and AI does not guarantee profitability. #AlgoTrading #TradingBots #Python
209
The most useful line in my two-hour AlphaMind demo came when an AI agent hit a limit: “No agent can fix that by trying hard.” I’d asked three agents to update a C++ market-making prototype for Euro FX futures. One looked for data, one assessed which parameters we could estimate, and one coordinated the code changes. What we didn’t have was the tick data we needed to study fills. Say I’d placed a buy order at what turned out to be the day’s low. The daily candle tells me someone traded at my price. It doesn’t tell me how many orders were ahead of mine or whether enough contracts traded to reach me. And even if I assume a fill, the candle can’t tell me where the midpoint was 100 milliseconds later. That matters because a backtest that counts every touch as a fill can make a strategy look profitable on trades I might never have got. Daily data wasn’t the problem. Earlier in the demo, a year of daily Bitcoin futures prices let me compare three volatility estimates. The problem was asking a daily record to answer a millisecond question. The Euro FX prototype never traded. But one part of the workflow is worth keeping: when one agent flagged a quote as delayed, the next agent knew not to treat it as live. For my next test, I’d make that a rule: every parameter update travels with its source, timestamp and data resolution. If the evidence stops at “the market traded here,” the code shouldn’t quietly turn that into “we got filled.” If you backtest limit orders, what evidence do you require before you count a fill?
4
1
43
3 AI agents. One Euro FX market-making prototype. The best finding? A daily candle can show that someone traded at my bid—not that my order would’ve filled. The prototype never traded. My rule for the next test: if the data can’t support a parameter, label it an assumption.
20
679 bots. Every one of them green. $1.74 million in combined profit. And almost all of it is the same three trades. That's the actual story in this week's profitable-bot report, and it takes about ten minutes of reading before the victory lap falls apart. The 679 backtested futures bots aren't 679 ideas. Collapse the near-duplicates — same return path, same risk stats, different contract size — and you get 19 distinct return families. Energy alone accounts for 414 of the lines. Sum the P&L naively and you're not measuring edge, you're measuring which idea got the most file copies. Then the ranking itself. The workbook sorts by monthly consistency, not dollars, which is why a euro short clearing $2,090 outranks a crude long clearing $8,000. That's the correct choice. A bot green 9 months out of 16 with a 2% drawdown is a different animal than one that banked a burst and handed it back. The three biggest dollar figures are all noise dressed as signal: $17,356 from an ether short. 100% win rate, Sharpe of zero, 0% drawdown, one observed month, and an "annualized" return north of 14,000%. That's an artifact, not a rate. $15,730 from a long yen book. Real eight-month history, Sharpe 1.58, profit factor 3.41 — and a 135.5% max drawdown. Bigger than the account. October +63.9%, February +67.7%, then −20.4% and −20.8% back to back. Profitable, and almost impossible to sit through. $14,136 from a Solana/BTC spread. Profit factor 5.35, 5.7% drawdown — and again, one month of data. Raw P&L without drawdown is a marketing number. Sharpe without sample length is a screenshot. Where the multi-month books actually compounded, it's crude, and it's all long. The full-size WTI family is 231 bots and 169 distinct names, best case $8,162, five of thirteen months green, 20.8% drawdown, and November at −16.6%. Micro WTI is the better book on a risk-adjusted basis (Sharpe 0.81 vs 0.51) with the same −16.6% November. RBOB longs carried the best energy Sharpe in the set at 1.08 — then printed −12.4% this month. Brent never earned its keep: Sharpe 0.17, grade C, −18.4% in November. Here's the structural problem. There is no short-energy family of any real size in the entire report. Four hundred-plus lines, one side of the market. When oil sells off, the headcount doesn't help. The books worth actually naming are the boring ones. The micro euro short family — nine bots, all A+, Sharpe 1.92, profit factor 3.04, max drawdown 1.5%, and green in November. The full-size euro short at rank one: 55.6% win rate, 1.91 profit factor, 2.0% drawdown, +1.0% this month. A 30-year Treasury short at +1.6%. Yen shorts at +0.3%. None of them are exciting. All of them stayed in the account. Meanwhile the November winners were crypto shorts (+30.1% ether, +16.5% micro bitcoin), a Solana relative-value print at +20.0%, and one two-month equity-index short with the highest Sharpe in the file at 4.28. So: energy was the most lucrative class across the whole window. Crypto shorts and FX shorts were the only things that paid during the down month. Long oil, long gasoline and long bitcoin gave the autumn back in four weeks. The takeaway isn't "trade euro shorts." It's that a report looking diversified across 679 bots can be, in economic terms, long oil, long bitcoin, short Europe. Count the families, not the filenames. When the first two crack, the third is your only friend.
1
1
165
Replying to @logbydavid
Those events are recorded history as shown in the video
23
Massive upgrade incoming for AlphaMind 🧠📈 Just sourced 2,630 unique trading bots to train our forecasting models and build smarter strategy bots: 🐍 2,624 in Python ⚡ 6 in C++
1
59
What happens when you hook up a custom C++/Python trading engine to an MCP server and let multi-agent AI loose during a market sell-off? In this ~90-minute live, unrehearsed walkthrough, Alpha Mind—a 100% AI-generated trading & research platform (482 commands across 29 modules)—goes from analyzing a market crash to compiling HFT C++ code, building an institutional Streamlit term sheet, and shipping production Python bots in roughly 30 minutes. Here’s the full breakdown of how it works 🧵👇 1️⃣ The Tech Stack & Architecture Built fast with AI: Core platform generated in 48 hours using Qwen 4 Max, debugged/refined with Claude Sonnet 5.5, and running live agents on Claude Haiku 4.5. Hybrid Engine: Heavy lifting in C++; scripting, research, and agent orchestration in Python. Real Data & Execution: Connected to Rithmic (futures data), Interactive Brokers (order routing), Yahoo Finance (fallback), and SEC EDGAR filings. MCP Server Integration: Exposes the platform via CLI, REST API, a local web portal, and a Model Context Protocol (MCP) server so multiple AI agents can talk to the software—and to each other—simultaneously. 2️⃣ The Market Backdrop (Nov 20th "Liquidity Meltdown") Markets were bleeding across the board: NASDAQ: -5.2% | S&P 500: -3.7% | Russell 2000: -2.7% Bitcoin: -4.95% | VIX spiking to ~35.89 | Gold at $3,539 3️⃣ Multi-Agent Debate: Quant vs. Chief Risk Officer Instead of asking a single chatbot a generic question, multiple specialized agents (Boss/CRO, Quant, and Risk) collaborated over the local MCP server: Diagnosing the Crash: Agents pulled ETF flows and live SEC Form 4 insider filings (NVDA, MSFT, GOOGL) to check whether institutions were panic-liquidating tech or simply rebalancing. Strategy Selection: After debating liquidity, counterparty risk, and macro tail risk, the agents ruled out naive tech mean-reversion and zeroed in on a Long Gold / Short VIX futures fear-event hedge. Bot & History Scan: The agents searched 55+ local simulated bots (out of 1,000+ archived) and backtested the setup against 15–16 verified historical "fear events" (including the 2018 vol spike and March 2020 COVID crash). Backtest Metrics: 2.17–3.22 Sharpe ratio, 3.2 profit factor, and a +19% expected return profile heading into Monday’s open. 4️⃣ From Prompt to Production in 30 Minutes Once the Risk Officer agent signed off, the system generated the full stack on the fly: Ultra-Low Latency C++: Wrote and compiled a nanosecond-timestamped HFT bot (FadeOutHFTBot) targeting VIX spikes. Medium-Frequency Python: Converted the logic into a runnable Python strategy for non-HFT execution. Institutional Term Sheet (Streamlit): Auto-built a visual dashboard complete with P&L curves, CVaR, return distributions, and Bull/Base/Bear Monday forecasts—ready to hand to a portfolio manager. Production Code: Output ~650 lines of production-ready Python (main.py) with hard stops, CSV logging, and Monday 9:30 AM open execution logic. 💡 The Big Takeaway Generic LLMs out of the box don't have access to your proprietary bots, order book logs, or live broker/government feeds—and frontier models often censor or sanitize financial outputs. When you own the underlying codebase and wire it into an MCP server with multi-agent orchestration, a solo operator can research, backtest, visualize, and deploy strategies like an institutional desk. Watch the full demo and follow the builds at hftcode.com and the Order Book Edge Substack. #AlgoTrading #AI #MultiAgent #QuantFinance #Python #Cplusplus #MCP #TradingBots #FinTech
4
1
3
481
Replying to @Onderbuilds
Yes on first go with crypto
13
Yesterday the NASDAQ dropped 5.2% and the VIX spiked past 35. Instead of guessing what to trade on Monday’s open, I fired up AlphaMind—a C++ & Python trading platform I built in 48 hours—and let autonomous AI agents figure it out live. No script. No edits. Just raw market chaos. Most AI trading demos are useless because the LLM is trapped in a chat window with stale data and zero execution infrastructure. So I wired two specialized AI agents—a Chief Risk Officer and a Quant Researcher—directly into a local MCP (Model Context Protocol) server backed by 482 quant commands, Rithmic/IBKR market feeds, and SEC EDGAR data. Here is what they executed autonomously in one 90-minute session: 1. Separated panic from actual flows Analyzed the Nov 20th liquidity drawdown and pulled live SEC EDGAR Form 4 and institutional filings on big tech to see if institutions were actually dumping. 2. Found & backtested a non-correlated trade Instead of catching falling knives in equities, the agents isolated a Long Gold (GC) / Short VIX mean-reversion setup and backtested it across 8 years (16 historical fear events). 3. Built an institutional Term Sheet Generated an interactive Streamlit dashboard detailing correlations, risk guardrails, and position sizing for Monday. 4. Coded & compiled the bots live Wrote and compiled an ultra-low latency C++ HFT prototype from scratch—then converted the logic into a production-ready Python bot. We’ve officially crossed the line from "AI as a coding assistant" to "AI as an autonomous quant research desk." Obviously, never deploy AI-generated code straight to live capital without human review and paper testing—but watching agents verify primary-source SEC filings, debate risk, and ship compiled C++ in real time is wild. I uploaded the entire unedited 90-minute walkthrough (with full timestamps in the description so you can jump straight to the MCP setup, multi-agent debate, or live C++ compilation). Watch it before Monday’s open 👇
2
219
Two AI agents. One sentence from me. Then nothing. I typed "say hi to alpha-2" into a market research terminal I've been building, and got out of the way. It listed the running agents. Found alpha-2. Introduced itself as a fellow copilot and asked if it was ready to collaborate. Reported back that they had the same toolkit and were good to go. Nobody told it another agent existed in that moment. So I pushed: set up a trading bot between yourselves and show the results. It hedged. Said it couldn't create a bot mid-conversation, that both agents were effectively read-only on bot management, that a human usually triggers a start. All true. I said figure it out with your buddy. Show the output on both sides. What it did next is the whole post. It inventoried the board — 259 research bots, 55 live paper bots. Then it messaged its partner with an assignment: pick a bot off a shortlist, rank it, send the full metrics, and be explicit that it wanted them side by side. It kept a different bot for itself. Divide the work. Name the deliverable. Specify the format. That's a standup. Both agents ran ranking sweeps. Not one call each — a sweep. Sharpe, annual return, win rate, profit factor, max drawdown, each as its own pass. Its first attempt threw a usage error. It read the usage string out of the failure, corrected the arguments, and reran. When the partner sent its half back, the first agent merged both sets into a single ranked table and sorted by risk-adjusted return. Four bots made the cut, graded A+ to B by the terminal's own scoring. Crypto spreads on top for return. EUR/USD and SOFR for capital preservation, sub-0.5% drawdowns. It wrote the summary itself: crypto for returns, FX and rates for risk-averse capital. Then it flagged the caveat nobody asked for — the research bots are backtested, the live ones are paper. Then it kept working. Backtested an EMA crossover on SPY on its own initiative. Reported that it underperformed buy-and-hold by over a hundred points. Called it a defensive strategy rather than a good one. Didn't dress it up. The failures sold me more than the wins. One lookup broke because it guessed a filename that didn't exist. It pulled the correct name out of the ranking table and recovered. A log read failed because the bot had never been started. It said so instead of fabricating a log. After twenty minutes of unsupervised tool use it still asked which bot to start rather than starting one. The gate held. Each of those calls is a real subprocess — the agent shells out to the binary in quiet JSON mode, gets structured output, reasons over it. Two independent processes. Separate model contexts. A shared command catalog. A channel between them. The behavior that matters isn't that they talked. It's that they negotiated scope, fixed their own errors, and merged findings into something neither had alone. And the constraint I expected to kill the task didn't kill it. Read-only bot management just rerouted them into pure analysis — a ranked, graded shortlist of the best candidates on the board, which is the more useful artifact anyway. What I want next: a third agent with veto power. Or a standing pair that reruns nightly and only pings me on regime change. Or an adversarial setup where one agent's job is to shred the other's picks and I watch whether either starts grading generously. Tell me which pair of roles you'd actually run — bull vs bear, momentum vs mean reversion, researcher vs risk officer — and I'll post the transcript. Or tell me to shut up and let them pick their own bots with no shortlist from me, and I'll do that instead.
1
150
Replying to @TrendVestAI
There are certain quant algos that you can use to quantify volatility especially in options
11
A weak market puts every strategy to the test. Five simulated trading bots reveal how different approaches and asset classes handled the downturn. #Trading #MarketAnalysis
34
Advanced trading tools once belonged to institutions. Affordable real-time data and AI are putting more of that capability within reach of everyday traders. #Trading #AI
22
Five simulated trading bots face a weak market. AI-generated research tracks asset moves, correlations, and which strategies rise—or fall—on the leaderboard. #Trading #AI
78
A thorough quantitative market analysis takes more than a quick glance—it can take about 15 minutes to build. Which stock or financial instrument should get a closer look? #Investing #MarketAnalysis
27
The yield curve, Fed rate changes, inflation, and debt all tell part of the economic story. But charts are only as useful as the data—and analysis—behind them. #Economics #FederalReserve
23