Urgent.News

What's breaking now, across thousands of outlets.

Tech

Every line of my recovery code was correct. It failed every single time."

I run an automated trading system on a paper account. Two pipelines, a handful of small single-purpose agents, no human in the loop once it starts. It places orders, sets stop-losses, and closes positions without asking anyone. One morning a position was sitting there with no stop-loss attached to it. Unprotected. The exact state the system has a whole self-healing routine designed to prevent.…

Every line of the recovery code was verified to be correct. However, the system failed each attempt to implement the fix. The system consisted of two pipelines and single-purpose agents that operated autonomously, placing orders, setting stop-losses, and closing positions without any human intervention. A position was left unprotected, despite the system's self-healing routine being active.

The recovery routine ran for hours but failed every time, and no error message was received to indicate the issue. The recovery process included four steps, all of which were executed correctly. Despite thorough testing and no apparent issues, the bug lay in the recovery code's retry mechanism, which generated the same client_order_id for each attempt, causing a permanent failure.

The system appeared structurally sound but was logically incorrect. The issue was discovered by manually triggering the sync command and examining the broker's raw error response. To prevent similar issues, five steps are recommended: include a unique identifier in each retry attempt, verify the logic within conditional branches against real failures, implement circuit breakers for repeated risky actions, minimize the exposure window by restoring the position immediately upon failure, and thoroughly examine all near-identical components for the same pattern.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

C# Singleton basics

Introduction The Singleton pattern ensures that a class has only one instance throughout an application and provides a single, globally accessible way to retrieve it.

Tango Fuel App Expands to Five African Countries

Emma Okonji Tango Brook Technologies Limited, Nigeria’s fast-emerging energy technology and intelligence company, has expanded its footprints into five African countries within one year of its…

  • Brook Technologies expands Tango App to five African countries in one year
  • Africa Managing Director aims for pan-African presence
  • Company targets 15 African countries by 2027

Nested Arrays in JavaScript

Introduction When working with arrays in JavaScript, we usually start with a simple list of values. This works well when all the values belong to the same group.

  • Nested arrays contain multiple arrays within a single array
  • Access nested array values using multiple indices
  • Syntax: array[firstIndex][secondIndex]

More from Monday 28 September →