Developer's trading bot KPI broke 100% due to a time-window mismatch bug
A part-time software developer discovered his trading bot's 'fulfillment rate' KPI was producing logically impossible values above 100%, such as two trades recorded against only one opportunity. The bug surfaced when automated tests threw an AssertionError, prompting him to dig into the logs and step through the code with a debugger. The root cause was a time-window mismatch: the numerator (actual trades) was pulled from real-time data, while the denominator (total opportunities) was anchored to a future end-of-month date not yet reached. This meant recent trades could inflate the numerator before corresponding opportunities appeared in the denominator. The fix was straightforward — aligning both values to the same observation timestamp, recalculating opportunities based on the actual date each trade was entered.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in