Our code silently replaced our own $50 daily loss limit with $142
Описание и применение
Код автоматически заменил жесткий лимит потерь в $50 на более мягкий лимит в $142, позволяя потерять до $100 за день. После исправления бот применяет более строгий лимит, предотвращая большие убытки.
Задача
A hard daily loss limit of $50 was silently overridden by a looser automatic cap of ~$142, allowing losses up to $100 without triggering the guard.
Результат
The bug allowed daily losses up to $100.26 over 42 trading days, with the $50 limit never firing. After fixing, the stricter cap rule now prevents such losses.
Рабочий процесс
- Read risk rule file at startup
- Compute automatic cap as 1.5% of balance each tick
- Unconditionally overwrite config cap with automatic cap
- Stop trading when cap reached
Доказательства
we set a hard daily loss limit of $50. For at least the 42 trading days we can measure, the number actually running was about $142.
Every tick, the bot computes a day cap from the account balance: 1.5% of the balance, which on a roughly $9,500 account is about $142. Then it assigned that value to the variable that holds the cap.
That assignment was unconditional. It did not compare the two numbers. It did not ask which one was stricter. It just wrote over whatever was there — including the $50 that our own rule file had just supplied.
The change is two lines long and the principle is one sentence: when a rule and a default disagree, take the stricter one.
Five days below a limit that was supposedly live is not a subtle discrepancy. It is a contradiction, and it had been sitting in our own data the whole time.
- Дата записи: 2026-10-09T01:41:08.701Z