First Live Trading Day - Most of the Safety Machinery Never Fired
The first time I ran the live-order code on a real trading session, orders filled cleanly and none of the safety paths — margin retry, order cancellation — ever triggered. This is about how I decide to trust safety code that has never fired, and how I blocked a calendar edge case the code didn't know about (a special late-open exam day).
This is the English version of a post originally written in Korean for my algorithmic trading system devlog(new tab).
A first real day, with all the safety machinery already built
Last week I deployed the code that actually sends live orders.
Today (Monday) was the first time that code ran a full cycle on a day when the market was genuinely open.
Three things kept me on edge. The path that retries an order when it gets rejected for insufficient margin; the path that cancels an unfilled order in the next round and re-plans; and whether a stale order left dangling from last week had been properly closed out.
All three belong to the order-execution and safety layer(new tab). They aren't the logic that picks stocks — they're the plumbing that executes a picked result safely into a real account.
No rejections, and nothing to cancel
Here's the short version: none of those three paths fired today.
In the morning round, margin rejections were zero. So the retry path had no reason to run.
What I had added — logging reference values like volume and the prior-day close alongside each outgoing order — did get recorded correctly. That's the trail that lets me reconstruct later why I bought at that price at that moment.
In the lunchtime round, there were no unfilled orders to cancel. Everything from the morning had already filled before lunch.
So the path that actually cancels an order never got exercised today either.
A path that's still never run in production
Let me be honest about one thing. The cancel path is fully written in code, but I've still never once sent a real cancel request to the broker on a live market.
If "good days" keep stacking up — no rejections, clean fills — then paradoxically the safety machinery may never get its live test.
The saving grace is that this path is designed to fail safe. If a cancel request gets rejected, it stops right there (freezes), raises an alert, and refuses to blindly buy or sell again.
So "it hasn't been tested" is not the same statement as "it's dangerous." I nailed down in advance that the worst case, when it does fire, is "do nothing and call a human."
I also checked the stale order I'd worried about. It had already been closed cleanly last week in the lunch round — cancelled, zero fill — with nothing left unresolved.
On exam day, the bot doesn't know the market opens at ten
The other thing I touched today was this week's college-entrance-exam day.
As the exchange announced in advance, that day the market opens later than usual (10 a.m.) and closes later too.
But my code's calendar only knows "holidays," not "late-open days." The bot's first trading round is set to fire a little after nine, as usual.
The problem is that time is before the open. Before the open, the current price reads as the prior-day close, which neutralizes the filter that judges "did it spike or drop," and the order can claim a slot first and then get rejected — which can block the replacement execution that should run after ten.
So I decided to block the morning's first round entirely, just for that one day. I registered a scheduled job that turns itself on and off at fixed times, built to survive even if the machine reboots in between.
One small gauge comes with it. If the morning round is blocked, trading naturally slips to the lunch round, and a one-line alert — "the primary execution failed to commit" — is expected behavior, not an incident. I wrote down in advance that this alert is normal that day.
As a side note, the collector that gathers intraday bars stops before that day's closing single-price auction. So just for that day I added a one-off job to sweep the post-close bars once more.
The memory diet showed up as a number
Last week I did some work to cut memory use in the morning preprocessing stage, and today the first real measurement came in.
The morning job's peak memory dropped noticeably below the previous four days, and swap — spilling to disk — was flat zero. It landed inside the ceiling I'd set beforehand.
This isn't the kind of work that makes results visibly better. But having stopped the morning memory from creeping up to the edge and leaking into swap means operations got quieter(new tab).
Why this matters
Everything I touched today was about "how to execute a pick safely," not "how to pick better."
The lesson of the first live day was a little unexpected. The more carefully you build a safety mechanism, the more likely it is to fire not even once on an ordinary day.
That's both good news and homework. Good news, because it means the cycle ran clean — no rejections, no unfilled orders. Homework, because a path that never fired has never been verified in production.
So I decided not to rest my trust solely on "it's been exercised live." Instead I rest it on designing the thing to topple toward safety when it does fire — and writing that down.
The exam-day story is the same grain. Code only knows ordinary days. The gap in automation is for a human to notice first that the code doesn't know about an extraordinary day, and to block that day by hand. The holes in automation always open up exactly here — on "the day the calendar is different from usual."