Quant Trading Bot Devlog

한국어로 보기

"[Sep 9] Redesigning a Brokerage Account for Shared Use — and the First Live Order"

A new brokerage account mixes personal and bot funds, so I rebuilt the safety layer around that, sent the first live order through it, and finalized a bank-transfer-free way to move funds between accounts

This is the English version of a post originally written in Korean for my algorithmic trading system devlog(new tab).

The brokerage account I'm newly bringing into live trading is different in nature from the existing one.

The old account was dedicated entirely to the bot. This new one has personal funds and bot funds sitting in the same account. The problem: every execution safety mechanism(new tab) I'd built so far assumed the whole account belonged to the bot.

Once that assumption broke, several places needed rework.

Buying-power calculations had to filter out personal funds so they wouldn't leak into the bot's available cash. Whenever an unexplained quantity showed up in the balance, I needed logic to tell whether it belonged to the bot or to me personally.

Sell orders needed a hard, code-level invariant that personal holdings are never touched. The reconciliation process and the watchdog that checks whether the system is armed also had to be retuned for a shared account.

I broke this redesign into stages and worked through them in order, finishing the last one today.

Once it was done, I had another AI review the entire implementation. It came back with a mix of findings across severity levels — all of them fixed by the end of the day.

The first live order on the new account

With the redesign done, I ran a verification: sending one real order through this account.

The goal was to confirm the whole money path — journaling, the three-way order-result classification (success/failure/unknown), reconciliation, and duplicate prevention — works correctly on this account too.

It succeeded. There was one hiccup along the way: a throwaway debugging script touched the ledger file directly and briefly broke consistency, but I caught and fixed it immediately, and later checks came back clean.

To be clear, this only verifies the order pipeline works — it doesn't mean continuous operation starts on this account yet. That still needs a separate arming step.

Fund transfer between accounts, settled on automatic conversion

How to move funds from the old account to the new one changed direction more than once today before it was settled in the evening.

The first idea was a bank transfer of cash. On review, that turned out to be unnecessary. Tomorrow morning, a portion of the holdings currently in the old account will be physically transferred (in-kind) to the new one, and once that's done the old account switches to sell-only.

For cash, instead of a bank transfer, I'm handling it as a book-only conversion. Some of the cash already sitting in the new account gets converted into the bot's operating budget to start, and from then on, any further cash freed up as the old account sells (now sell-only) gets automatically detected and credited to the new account's budget within the same trading round.

No manual back-and-forth between accounts needed — when the old account sells, the new account can buy with that money in the same round. I also added protection against double-crediting.

This only means something once tomorrow's physical transfer is actually filed and processed, so final verification carries over to tomorrow.

Also today

I stopped using a remote-desktop tool, so it's been dropped from infrastructure monitoring too.