Skip to content

Commit e4e256d

Browse files
committed
bugfixes for bin search
1 parent 1a07d34 commit e4e256d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/watch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import math
2+
from core.bid import increment
23

34
def lowestBin(q, api, defIds):
45

@@ -12,7 +13,10 @@ def find(api, defId, buy=None, num=0):
1213
items = api.searchAuctions('player', defId=defId, max_buy=buy, page_size=50)
1314
if items:
1415
lowest = min([i['buyNowPrice'] for i in items])
15-
num = len([i['buyNowPrice'] == lowest for i in items])
16+
num = sum([i['buyNowPrice'] == lowest for i in items])
17+
# If we have 50 of the same result, go one lower
18+
if num == 50:
19+
lowest -= increment(lowest)
1620
if buy is None or lowest < buy:
1721
return find(api, defId, lowest, num)
1822
return (lowest, num)

0 commit comments

Comments
 (0)