Instead of dumping raw price data into a prompt, I treated the LLM strictly as a "Qualitative Reasoner" (the Brain) and built deterministic scripts as the "Quantitative Executors" (the Hands).
The Math Layer (Zero Hallucination): Traditional Node.js/Python scripts pull market data and calculate deterministic indicators (SMA, ATR, RSI) and backtest historical win rates.
The Context Layer: It fetches live news, SEC filings summaries, and Wall Street ratings via Finnhub/Tavily.
The LLM Brain (DeepSeek-R1 / GPT-4o): The model is ONLY fed the computed results. It acts as an investment committee, weighing the technical setup against the macro news catalysts.
The Risk Controller: Even if the AI screams "BUY", the system passes the signal through a hard-coded Volatility Parity sizing model (using ATR) to calculate the exact safe position size.
Human-in-the-loop (Telegram): For execution, I integrated a Policy Engine. The bot sends a beautiful proposal card to my Telegram. It only executes via the Broker API (Longport/Alpaca) if I reply /approve.
The $1000 Experiment:
I am running this live right now. It's not about getting rich; it's an engineering experiment to see if multi-agent systems can actually maintain a positive Expected Value (+EV) in noisy markets without blowing up.
Currently, the system is [up 2% / down 1% / flat] in its first week. It successfully avoided a fake breakout yesterday because the Bear-Agent successfully debated the Bull-Agent on low volume.
Tech Stack: Node.js, TypeScript, SQLite, better-sqlite3, Longport SDK.
I’m open-sourcing the entire framework. It’s highly modular, so you can swap in your own indicators or prompt logic easily.
I would love for the HN community to roast my architecture, point out my blind spots in the backtesting logic, or just tell me how quickly I'm going to lose my $1000.
Comments
socialinteldev•1h ago
the interesting design question here is how the agent decides to stop — most quant agents have hard stop losses but when the agent is calling third-party apis for data that also cost money, the cost accounting gets interesting. does your agent track its own operational costs (api calls, llm tokens) against its trading pnl, or just the trade positions themselves?
paidx•1h ago
Good job, it would be even better if some pictures were included.
socialinteldev•1h ago