Diagnosing Live Oil Trading Bot Losses Through News FilteringDiagnosing Live Oil Trading Bot Losses Through News Filtering
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
Your trading bot isn't losing money because the strategy is bad. Here is the real reason.
I see the same post in trading forums every week: "My bot works in backtest, but it bleeds money live."
The developer assumes the strategy is wrong. They tweak the RSI. They add a moving average. It bleeds again.
The real problem is almost never the strategy. It is that the bot is trading on headlines that were never about oil in the first place—or it is trading on stale news because it fired on the first tweet it saw instead of the newest one.
When I built my autonomous oil trading system, I did not trust a keyword matcher to decide when real money moved. I put a reasoning model in front of every headline. It returns four things before a trade is allowed to fire:
Is this actually about oil? (Most aren't. They get filtered.)
Impact: BULLISH / BEARISH / NEUTRAL
Strength: 1–5, where 5 is "war, embargo, major supply shock"
Confidence: 0.0–1.0
A trade only executes if confidence passes a hard threshold. And if the reasoning API ever fails, a circuit breaker falls back to a deterministic engine—the system gets dumber for one cycle, it does not go dark.
The monitor polls every 20 seconds and primes on the first poll. It records the baseline tweet ID and does not trade on old news. That single design choice killed more false signals than any strategy tweak ever did.
This is not a script. It is a pipeline that reads the world, reasons through the noise, and executes with precision. All for $0 to run.
If your bot is bleeding in live markets and you cannot find the root cause, that is the exact problem I solve. I read the architecture, I find where the signal is leaking, and I ship a fix.
If you are stuck on an execution or signal problem, my inbox is open. Tell me the symptom, and I will tell you if it is fixable.
#AITrading #Python #LLM #BuildInPublic #QuantDev
Post image
Maksim's avatar
IDM logo
Putting a reasoning gate in front of every headline is the right call, and returning four fields keeps it auditable. My question is the latency budget: a reasoning call per headline adds hundreds of ms on the hot path. Do you run a small local model for the gate and only...
Saleh's avatar
~200–400ms/call via Groq. Fine because the monitor polls every 20s, not every tick—I'm filtering noise, not racing HFT. Headlines process sequentially, so every trade has one auditable trace. No local model yet; that's the next step.
Maksim's avatar
IDM logo
At a 20s poll the latency is fine, the cadence is what protects you. Two things I would add before a local model: a dedupe key on the headline, hash plus a short window, so a republished story does not fire twice, and a per-headline TTL so a two-minute-old item cannot trigger a...
Saleh's avatar
Maksim — genuinely appreciate you reading the architecture properly and not just skimming the post. Feedback like this is rare.
The headline point: this entire system runs at $0 cost — no paid APIs in the critical path, no managed cloud, single Docker container on Python 3.11....
Maksim's avatar
IDM logo
The $0 constraint explains the Groq choice, and it is the right trade at that poll rate. Reasoning once per headline on a 20s cadence is a rounding error against the market data cost you are avoiding. If it helps for v2, the three items as a checklist: dedupe key on the headline...
Saleh's avatar
Maksim — genuinely, thank you. This is the kind of read that saves a system months later, and I don't take it lightly.
Context you don't have: I've been in markets since 2022. This bot is live and I'm waiting on real results — is it making money or losing it — before I touch...
Maksim's avatar
IDM logo
Fair to let it run before touching execution paths. The distinction is that a 20s poll bounds arrival cadence, not item age. If the feed delays or replays a story, a stale headline still looks fresh to the loop. And an error-based breaker cannot see a hung socket, because there...
Saleh's avatar
Maksim — thank you. You named the timeout as the one that bites in production, and that's the detail that separates a review from a checklist. Most people stop at "add a timeout." You explained why it's the dangerous one: sequential processing turns a hung call into a silent...
Maksim's avatar
IDM logo
Your ordering argument is the part I would flip. TTL and dedupe cut volume, but neither bounds a single call, and that is the number that matters here: undici's default headersTimeout and bodyTimeout are both 300s, so one hung Groq call eats fifteen cycles of a 20s loop no...
Saleh's avatar
Maksim — you're right, and it's the kind of correction that only comes from someone who has actually watched a loop die in production.
The ordering was mine, and it was wrong for the reason you named: I treated TTL and dedupe as correctness fixes and the timeout as a performance...
Maksim's avatar
IDM logo
I read the diff, so two things. First, a correction on my side: I cited undici's 300s header and body timeouts, and your stack is Python requests, where the pitfall is the opposite, no default timeout at all unless one is set. Your timeout=8 has been there since Nov 9 (a4e392f),...
Saleh's avatar
Maksim — you're right on both counts, and I'll take them in order.
On the timeout history: my mistake, and an embarrassing one. timeout=8 has been in since a4e392f on Nov 9. What Nov 27 added was the impact gate in the prompt — NEW / AUTHORITATIVE / MATERIAL — not the bound. I...
Maksim's avatar
IDM logo
Honest read, and it is not the answer you want. The platform suits visual work. Designers, brand and motion people get found here; the feed, the challenges and the clients are built around that. Engineering gets read, but it rarely gets bought. Every dollar I have earned on...
Saleh's avatar
yes. what you say its the truth the platform is for designers but its good to stay here and have a profile its may works out
Thanks Maksim .
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started