Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

The Test That Could Not Fail

Описание и применение

Реализован надёжный механизм ограничения потерь, который теперь корректно блокирует сделки, когда убытки превышают порог, подтверждённый стресс‑тестами.

Задача

Implemented a daily loss limit guard that never fired in production because it was executed too early in the trading cycle.

Результат

Implemented a robust daily loss limit guard that now correctly prevents trades when the account drawdown exceeds the threshold, validated by dose tests that force guard activation.

Рабочий процесс

  • 1. Implement daily loss limit guard before position entry check.
  • 2. Run unit tests verifying guard returns correct decision for given drawdown values.
  • 3. Ship feature; observe no failures in production for two days.
  • 4. Perform dose test by setting an absurdly tight loss limit to force guard activation.
  • 5. Discover guard never fired; identify timing issue.
  • 6. Refactor guard to run after position opening or adjust logic to block future entries.
  • 7. Add dose tests that intentionally break guard conditions to force test failures.
  • 8. Audit existing tests to ensure they cover execution timing, not just return values.
  • 9. Adopt habit of counting failures and ensuring tests can fail to validate code.
  • 10. Monitor system for guard activation and alerting.
  • 11. Iterate on tests and guard logic until reliable safety feature is achieved.

Доказательства

The results came back byte for byte identical to the run without the feature.

Источник

The check sat in the right place logically and in the wrong place temporally.

Источник

  • Дата записи: 2026-09-20T01:00:32.645Z