Building a Trading System That Can Recover Its State
Specify persistent identities, order reconciliation and failure handling before connecting a research rule to account actions.

Start from state, not the entry indicator
An indicator can produce a decision while the system still lacks a reliable account state. Define what is persisted: instrument identity, signal ID, version, intended action, current order status, filled quantity and remaining exposure. Separate observed broker state from the internal state the software expects. A restart should not make the process forget which instructions already produced orders. This chapter describes architecture questions, not a deployed trading engine or assurance that a particular provider implements them.
Give each account action a stable reference
Record the original instruction and the derived order request under explicit IDs. Repeated delivery or a process retry should not silently create another position. Define how a receiver recognises an already handled request and what it does when the broker response is unknown. Webhook documentation provides a transport reference, but application correctness requires its own reconciliation design. A message successfully delivered to an endpoint is not proof of a broker fill, account safety or exactly-once economic action.
Worked example: the acknowledgement is missing
Invent a system that submits an order and loses the response before recording it. On restart, its database contains the intended request but no accepted or rejected state. Sending the order again immediately could duplicate exposure if the first request succeeded. The recovery question is how to query and reconcile the broker using the saved reference, under the broker's actual interface. This fictional sequence is an engineering fixture, not a description of a tested integration. Unknown state must remain explicit until the account record resolves it.
Version the trading and execution contracts
Keep data routing, causal feature definitions, entry identity, exit policy, sizing and order translation separately versioned. A software fix can change historical or future outcomes even while the model name stays the same. Save evaluation access and the paired execution policy when validating a release. Cross-validation documentation helps define research mechanics, not production certification. Do not infer deployment from passing unit tests, a merged file or a research label; the deployed revision and subscriber route require their own evidence.
Specify failure ownership in the cloud
Name the managed service responsible for execution, durable state, scheduled checks, failure reporting and recovery. A production process should not require a personal computer, open chat or workstation tunnel to remain online. Local research and tests can prepare artifacts, but live operation needs cloud-owned execution and durable readback. Do not add an unverified fallback which changes the risk policy or creates a second publisher. A recovery plan should preserve one accountable source of account action and visible failure state.
Accept a release only against the whole contract
Test invalid inputs, duplicate requests, partial fills, rejected orders, unavailable data and restart reconciliation. Retain the expected result and observed account or sandbox state for each fixture. Software correctness tests are not independent market-validation observations. A useful release package links the research artifact, implementation revision, configuration, gates and actual cloud deployment evidence. This guide and blank state register do not claim a completed build. They define what remains to be demonstrated before a rules-based research idea can honestly be called an operating system.
Decision record
| Question | Record to retain | Decision boundary |
|---|---|---|
| Identity | Instruction and account-action references | A retry must not be mistaken for a fresh decision |
| Reconciliation | Broker responses and unresolved requests | Missing acknowledgement is not rejection |
| Policy | Entry, exit, sizing and implementation versions | A model name does not preserve execution identity |
| Operation | Cloud owner, durable state and failure evidence | Local success does not establish live continuity |
Blank working record
The worksheet contains column headings only. Enter your own dated observations, keep absent evidence marked unknown, and do not treat the file as certification.
Primary references
- TradingView: webhook delivery and configuration
- SEC: order types and execution limitations
- scikit-learn: cross-validation and temporal data
These documents support mechanisms and source definitions, not a tested trading result or a recommendation. Accessed 9 October 2026. The decision workflow and invented examples above are editorial exercises.
Keep reading
Publication methodology | Working glossary | Source and correction policy
The new packet leaves recovery authority untested
Source and data hashes, deterministic replay and checked cash are useful reference objects, but the fixture has no actual broker or subscriber route. Its production promotion field remains false. A real recovery task needs durable state, operational identity, authoritative account readback and the effective policy owner. The original state-and-recovery chapter remains intact. A managed-cloud website deployment proves only publication, while local tests and a research LIVE label do not establish deployed trading state. No monitor, schedule, workstation fallback or proprietary model control is created by this expansion.