sell.py: fix off-by-one in queue-ahead depth

A resting order at the same price was posted first and has time
priority, so it should count as ahead too (p <= r["price"], not p <).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 19:03:35 +02:00
co-authored by Claude Sonnet 5
parent 12d26c5d68
commit dbe5cea9ae
+3 -1
View File
@@ -132,7 +132,9 @@ def main():
cutoff_price = max(recent_prices + [best_ask or 0]) * 1.1 if recent_prices else float("inf")
med_vol = med or 1
for r in rows:
ahead = sum(u for p, u in asks if p < r["price"])
# p <= (not <): a resting order AT the same price was posted first and has time
# priority over yours - it's ahead of you too, not a free pass to the front of the queue.
ahead = sum(u for p, u in asks if p <= r["price"])
# Outside the recent-traded range the queue mechanism doesn't meaningfully apply (no
# real evidence that cumulative ahead-quantity, much of it itself unreachable junk
# asks, clears at the normal rate) - that means "not a binding constraint" (0), NOT