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:
+3
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user