Building a trading bot: the parts nobody budgets for
The rules fit on a single page. Everything that keeps them running unattended is billed by somebody else, on a clock indifferent to how often you trade.
The rules fit on one page. The system does not
A strategy is a short document. An entry condition, an exit condition, a rule for size, a filter or two to keep it out of trouble. A weekend of work and cheap to abandon. That is the part the forums argue about, and on cost grounds it deserves almost none of the attention.
Then two words enter the specification, unattended and continuously, and the project quietly changes trade. You are operating a small service that has to be awake, correct and reachable while you do something else.
Everything expensive descends from those two words, and none of it makes a trading decision. What follows is not a longer strategy, it is a different kind of object.
Prices, and a machine to receive them on
Research wants history, years of it, at the resolution your rules use rather than the one you are willing to store. Running wants the present tense: a feed arriving through the hours you are asleep, honest about the moments it went quiet. Two products, two suppliers, and only the second bills for as long as the machine stays on.
The terms deserve more attention than the amount. Whether storing it counts as redistribution, whether automated consumption is covered at all, what happens to the archive when you stop paying. Those clauses decide architecture: a rule about where data may physically sit picks your hosting before you have compared providers on anything else.
A laptop is not a host. Close the lid, or let the router reboot at four in the morning, or the operating system pick tonight for an update, and your bot has an opinion and no way to express it. So a machine exists somewhere to run one process, charged by the month of its existence rather than by anything it does.
It also wants what machines want. Patching, because software nobody touches rots in place. A second route in, for the evening you break the first. None of it exotic, and none of it what somebody who wanted to write trading rules expected to spend a Sunday on.
What each line charges for, and what it charges when nothing happens
Sort this bill by what makes it grow rather than by size. Dealing costs grow with the number and size of trades, the relationship everyone has in mind. Every other line grows with elapsed time, the commodity an unattended system exists to accumulate. Automation converts a per-trade cost structure into a per-month one, whether or not the strategy is any good.
Which suggests a blunt question for any design before it is built. What does this cost in a month where it places no trades at all? Set the seven ordinary lines against what drives each, what each charges in that empty month, and how you would hear it had gone wrong.
| Line | What makes it grow | Charge in a no-trade month | How you hear it is wrong |
| The strategy code | each change and each new case | your attention only | it does something unintended |
| Historical price data | depth of history and resolution | the licence, if any | results move when the set changes |
| Live price feed | hours connected, instruments carried | in full | a gap you notice afterwards |
| The machine it runs on | months of uptime, and proximity | in full | it stops, quietly |
| Monitoring and alerting | things worth watching | in full | silence, which reads like health |
| Failure handling | ways the outside world misbehaves | nothing yet | at the least convenient hour |
| Dealing costs | number and size of trades | nothing at all | itemised, on a statement |
Seven ordinary lines in a deployment, and what each of them does in a month with no trades in it. Read the third column downwards: the bottom row is the only one that charges nothing at all, and it is the row everybody has in mind when they think about what trading costs.
The watchdog, and what it will wake you for at three in the morning
Watching the thing is a second system, and second systems are the classic omission from a build estimate. You want a heartbeat saying the process decided something recently, a check that prices are moving rather than repeating, and an alert path reaching a human willing to be woken. It has to fail independently too: a watchdog on the same machine dies in the same accident, and its silence is indistinguishable from a calm evening.
What it wakes you for is almost never the strategy. The connection dropped and returned as a session that had forgotten what was open. The venue shut for a holiday your calendar did not carry. A field arrived empty and the size calculation produced zero, or produced something. That lot is the least glamorous code in the build and the largest part of it, and it cannot be written from imagination: the world outside composes the list one incident at a time.
The second strategy does not cost half of the first
Almost nobody builds this for one rule. The case that justifies the apparatus is that a machine holds ten at once, across markets and hours a person cannot sit in front of, and that is the version worth setting against the bill above. A second rule on the same feed, venue and machine is close to free. A second rule wanting another venue, another resolution and its own way of going wrong is a second deployment in the first one’s clothes, and the reason to automate is usually the second kind.
Your own hours behave worst, because they grow with the number of systems and then again with the ways two of them interact. Ten minutes each morning confirming yesterday behaved gets longer with every addition.
Two strategies can disagree, hold positions that cancel each other, or compete for the same margin at the same moment, and none of that exists while there is one. So the portfolio arrives with an unspecified extra job, reconciling its members, and the honest version of the automation case stops where holding the rules becomes the work.
The one line with a counterparty, and the month that prices the rest
Of everything above, exactly one line is charged by a firm obliged to tell you what it charged. Dealing costs turn up on a statement, itemised, from a party you have a relationship with, which is why that end of a bot’s bill can be established by somebody else. As far as that one line goes, The Investors Centre opens and funds live accounts with its own money to test UK trading platforms rather than compiling rankings from providers’ published fee schedules.
The limit sits in what can be bought. Funding an account works because you can become somebody’s customer and read back what they billed you, and nobody sells a running deployment to become a customer of. The middle of this bill is assembled from suppliers who never see a trade, so a testing programme prices the counterparty end and can only name the rest. Naming is all this article has done: no published figure settles what a server, a feed or an engineer’s evening costs.
There is a cheap way to find most of it out. Deploy the apparatus with trading switched off. Let it connect, take prices, evaluate, write down the order it would have sent, and send nothing. Run it a month, through a holiday and one supplier’s maintenance window. You end with an invoice, the standing cost of being in this business, and a list of the ways your setup falls over, found without paying for them.
Be clear about what the month settles. It prices the apparatus and says nothing about whether the idea inside it makes money, and there is a hazard in how competent the exercise feels. A well-instrumented pipeline faithfully executing a poor strategy is a poor strategy with better logging and a larger standing charge. Know the bill because it is knowable, and go on treating the other half as unanswered.
…