Build a balance history and watch the weight come out. It runs the same pure module the service and the tests use, in your browser, with nothing fetched — a bench with its own copy of the arithmetic is a bench that agrees with itself and nothing else.
⚠ You typed these numbers. Everything to the right is arithmetic over them — not a measurement of anybody, and not a forecast.
If your closing balance of 400 had simply been held for the whole 30 days:
Set the opening balance to zero and buy an enormous amount on day 29. The area is one day's worth, however large the number. That is the whole point.
Hold 1,000 for thirty days, then try 2,000 for fifteen. The areas come out identical to the digit — the equivalence everything else rests on.
Sell to zero on day 5 and buy back on day 25. The middle earns nothing, because you held nothing. There is no memory of having held before.