Crypto bot development: what breaks during trade execution
Crypto bot development starts not with choosing a strategy, but with how orders are actually executed. An order goes to the exchange with a delay of a fraction of a second, the price manages to move during that time, and the entry happens at a worse price.
This is price slippage: on active instruments, it eats away at the strategy result faster than an erroneous signal.
The second failure point is exchange limits. The public interface limits the number of requests and orders per unit of time; when exceeded, some orders do not go through, the response comes with an error, and the bot continues to consider the position open.
The discrepancy between the bot's accounting state and the actual account accumulates with each such error.
The third failure is connection loss. Automated trading without connection state monitoring leaves the position open and without a protective exit: the channel recovers, but the price has already passed the level at which the stop should have triggered.
Partial fills add their own issue — the volume is not fully filled, but the logic considers the trade closed.
Trade execution failures are not an emergency case, but the normal operating mode of the exchange interface: delays, limit rejections, and connection breaks happen daily.
That is why we examine how this is closed at the architecture level, rather than by a duty operator's manual reaction.
What effect does automation of trading operations provide
Manual trading is limited not by the quality of the decision, but by the speed of its execution.
While the operator reconciles positions and confirms an order, the price manages to move, and when several instruments are traded simultaneously, missed signals and extra entries appear.
Trading automation moves this routine into code and leaves the human with setting rules and controlling the result.
Speed of reaction to market events
The bot maintains a permanent channel with the exchange, recalculates the signal according to specified conditions, and places an order at the moment they are met — reaction time is reduced from seconds to tenths of a second.
One process serves a dozen instruments equally, so an increase in the number of pairs does not require new people at the terminal. The reduction in manual errors here is measurable: typos in volume and price, duplicate orders, and entries outside the strategy rules disappear.
Eliminated class of failures during connection loss
A channel break is the most expensive scenario, because the position remains open and no reaction is available. The bot keeps a local state journal, stops placing new orders during a disconnect, and after recovery reconciles actual positions with the exchange before continuing.
Stuck and partially filled orders are handled automatically, and risk control is moved to a separate layer: position limit, daily loss stop, emergency close.
When developing a crypto bot, these mechanisms are built into the foundation rather than bolted on top: resilience to connection loss and risk management rules determine the architecture.
As a result, the strategy is executed equally under any load and at any time of day, and the size of losses is limited by rules, not by the operator's reaction speed.
Ways to implement trading automation and their limitations
The choice between a ready-made solution and custom code is determined not by interface convenience, but by what limitations you are willing to accept for a year ahead. Below are three working options that are realistically chosen between, and where each starts to get in the way.
| Option | When it fits | Limitations |
|---|---|---|
| Ready-made strategy builder | Typical entry and exit rules, quick start | Logic is limited by the set of blocks: non-standard risk control and links between instruments cannot be expressed |
| Purchased trading platform | A ready-made terminal and connection to several exchanges are needed | Dependence on the vendor; custom modules can only be added through its extension points |
| Custom trading module | Non-standard logic, custom risk rules, several exchanges in one system | Longer time to production; monitoring and support are on you |
Ready-made strategy builders
A builder covers hypothesis testing: assemble a rule from blocks, run it on history, look at the result.
The ceiling comes at position management — partial entries, dynamic sizing, separate limits per instrument, and pauses during drawdown are either not expressible or require workarounds. As soon as the logic stops fitting into blocks, automation hits not the market, but the editor.
Custom module for the client's task
Here risk rules, position size, and exit logic are described explicitly and versioned together with the code. The price is responsibility for the entire trading system: fault tolerance, trade logging, discrepancy alerts, redeployment after failure.
The common limitation of automation is that it does not replace risk management: the rules remain yours, execution becomes machine-driven. That is why we start by separating mandatory checks from experimental ones, and first implement those that protect capital.
Stages of crypto bot development: from audit to handover
We run the work as a pipeline: first we fix the trading rules and limitations, then the exchange integration, and only after that we write code — this way the logic is tested on data before the first real orders.
-
Trading logic audit. We look at how you trade now: entry and exit signals, stops, behavior during partial order fills. The output is rules suitable for code and discrepancies between words and actual trades.
-
Exchange interaction scheme. We determine the required requests: quotes, placing and canceling orders, balance, history. How the bot survives connection loss, a duplicate response, and rate limits; keys are stored with trade-only permissions.
-
Setting up logic and risk management. We set position size, the limit of simultaneous trades, the daily stop, and behavior during slippage. Parameters are moved to configuration — they can be changed without editing code.
Backtesting the strategy on historical data
-
Test run of the strategy. We run the logic on history in different market regimes — growth, decline, sideways — and on the exchange test environment. The output is a report: drawdown, share of profitable trades, number of protective triggers.
-
Launch in limited mode. We start with minimal positions, compare actual execution with expected, and gradually ramp volume up to working.
Handover and support after launch
- System handover. We provide source code, documentation on the strategy and parameters, deployment instructions, and a change policy. After that we support it: we adjust logic according to an agreed procedure without breaking validated behavior.
Handover package: configurations, diagrams, policies
System handover is not an archive of source code, but a package by which the client can deploy, support, and stop trading without the code author. Below is exactly what remains in hand.
- Configurations of test and live environments: description of each parameter, safe default values, and a list of what must not be changed in live trading.
- Component and data flow diagram: bot, exchange connection, state storage, logs, failure points, and what happens during connection loss.
- Documentation for the trading system: modules, strategy logic, signal format, handling of partial fills and duplicate responses.
- Key access policies: roles, scope of permissions, issuance, rotation, and revocation procedure.
- Risk management policy: limits on position, drawdown, and order frequency, and the procedure for revising them.
- Operator instructions: startup, normal stop, emergency stop, actions on balance or position discrepancy.
- Recovery procedure: restoring from a state backup and reconciling open positions with the exchange.
Account and key access policies
Trading keys are issued with permission to place orders, but without permission to withdraw funds — this removes a separate class of losses in case of leakage. Roles are separated: the strategy trades, the operator observes but does not change amounts and limits.
Key rotation and revocation are described step by step so that a change of contractor or employee does not require disassembling the system.
Risk management and trading stop policy
The policy documents not the "correct" limits, but the procedure for when they are breached: what the bot does automatically, what a human confirms, who initiates a full trading stop.
All risk parameters are moved to configuration, so they can be changed without editing code and rebuilding — while decisions on limits remain with the client, not the developer.
Case study: how trade execution stability improved
The client is a team trading one strategy on several venues at once. The bot produced results, but they depended on who was at the terminal at that moment.
We reworked the execution loop: separated signal reception, order sending, and position reconciliation, and introduced a state journal and protection against duplicate sends.
What it was before the rework
The signal, order sending, and position accounting lived in one process, and state was kept only in memory.
Any connection loss with the exchange meant a restart with manual reconciliation: the operator opened the terminal, matched actual positions with calculated ones, and manually sent missing orders. Resending after a timeout generated duplicates — the share of erroneous trades reached 2%.
Measurements over a weekly window looked like this: up to 8% of orders were not accepted due to stale prices and limits, recovery after a failure took from 25 to 40 minutes, and the operator intervened 15–20 times per day.
Metrics after launch
An order journal with idempotent keys in PostgreSQL and a separate reconciliation process removed manual recovery work: after a disconnect, the bot pulls state itself and closes the discrepancy in 60–90 seconds.
Risk limits are moved to configuration and checked before sending an order, so "phantom" positions no longer appear.
The share of rejected orders decreased to 0.4%, erroneous trades — below 0.2%, operator interventions — 1–2 per week, and only for planned changes to strategy parameters. Downtime of the loop no longer affected the daily result.
What to do if automation is already deployed and failing
We start not with rewriting, but with diagnostics. We collect telemetry from the running system: order journal, delays between signal and order sending, venue rejections, discrepancies between calculated and actual position.
Then we run the same market conditions on historical data and compare with what the bot actually did — the discrepancy points to the bottleneck more accurately than reading code.
In auditing third-party code, we first check not the strategy math, but the plumbing: handling partial fills, resending on timeout, state recovery after restart, behavior during connection loss. Most failures live exactly here, not in entry signals.
Improving an existing bot without stopping trading is built on a shadow environment: the new logic version calculates signals without placing anything and writes them alongside live decisions.
When the discrepancy is explainable, we enable a canary launch — the new logic takes a limited share of risk, while the old one continues to run on the rest.
Migration of trading logic is needed when the distortion is architectural: state lives only in memory, risk limits are spread across the code, market data and execution are in one thread.
Then we move the strategy to a separate core, migrating open positions, trade history, and instrument settings, and keep the old version as a rollback path until the new one completes a full cycle.
If the bottleneck is in parameters — position size, slippage, entry thresholds — configuration and a separate risk control layer on top of existing logic are enough.
Stopping trading without losses is a separate procedure, not just shutting down the process: the bot is switched to close-only mode, active orders are canceled, the position is reconciled with the venue, state is recorded, and keys are revoked. This procedure eliminates abandoned orders and accounting discrepancies on the next launch.
Common technical concerns and answers
Concerns before starting are usually not about profitability, but about control: who manages the keys, what happens during a connection loss, and how to test the logic without risking capital.
How are exchange access keys stored?
Keys are created on a separate subaccount with withdrawal disabled — the bot trades but cannot withdraw the balance.
The keys themselves are stored in a secret vault, do not get into config or logs, access is limited to a list of trusted addresses, and rotation is a scheduled procedure.
What happens if connection with the exchange is lost?
Each order is tagged with its own identifier, so resending after reconnection does not create a duplicate order. Positions and open orders are reconciled with the exchange rather than taken from memory; in case of discrepancy, the strategy switches to close-only mode.
How can trading logic be tested before real trades?
First, a historical backtest taking into account commissions, spread, and slippage, then real-time replay on the exchange test environment — execution itself is tested: placement, partial fill, cancellation. The real launch begins with minimal volume.
Can an off-the-shelf bot be improved rather than rewritten from scratch?
Yes, if there is access to the exchange layer and the code is readable. We start with an audit of signal calculation, risk rules, and execution, then isolate the strategy from infrastructure: new limits are added as a separate module and do not break what works.
What happens if the project is handed over to another team?
We provide source code, deployment diagram, configurations, a test suite, and documentation on strategies and risk limits — the bot is not tied to our servers or accounts. Onboarding a new contractor takes days, not months.
Let's discuss the task and come back with a work plan
So that the estimate and work plan are based on facts, not guesses, we start with a short task review.
Send us in free form: which exchanges and markets (spot, futures), whether trading is manual with auto-fill or fully automated, and whether there are already developments and exports for past trades. This is enough to discuss the task substantively and give realistic launch timelines.
Then we clarify what most affects the architecture:
- Exchange integration requirements: list of venues, account types, required access channels, and request rate limits.
- Access: keys with trade-only permissions, no withdrawal — they are enough to build and test the integration on the exchange test environment.
- Strategy logic: entry and exit rules, position size, response to partial order fills and price slippage.
- Risk management: per-trade and daily limits, acceptable drawdown, bot behavior during exchange connection loss or sharp market movement.
- Accounting and reporting: what goes into the trade journal, what result breakdowns you want to see and in what form to receive them.
- Launch environment: where we host the system, who owns the keys and server, and how handover into your operation takes place.
- Constraints: exchange rules for trading robots, regulatory requirements, and your internal policies.
In response, you receive an estimate and work plan: stages, deliverables for each, launch timelines, and points where your decision is needed. Describe the task — we will come back with an estimate and plan.







