Skip to content

Commit

Permalink
added decrement for situations where we are on the cap
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterjm committed Dec 1, 2015
1 parent b5a954c commit 406aae0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion core/bid.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ def increment(bid):
else:
return 1000

def decrement(bid):
if bid <= 1000:
return 50
elif bid <= 10000:
return 100
elif bid <= 50000:
return 250
elif bid <= 100000:
return 500
else:
return 1000

def roundBid(bid):
return int(increment(bid) * round(float(bid)/increment(bid)))
Expand Down Expand Up @@ -97,7 +108,7 @@ def bid(q, api, playerList, settings):
# Search first 50 items in my price range to bid on within 5 minutes
if not settings['snipeOnly']:
bidon = 0
subtract = increment(bidDetails[defId]['maxBid'])
subtract = decrement(bidDetails[defId]['maxBid'])
for item in api.searchAuctions('player', defId=defId, max_price=bidDetails[defId]['maxBid']-subtract, start=0, page_size=50):
# player safety checks for every possible bid
# Let's look at last 5 minutes for now and bid on 5 players max
Expand Down
4 changes: 2 additions & 2 deletions core/watch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
from core.bid import increment
from core.bid import decrement

def lowestBin(q, api, defIds):

Expand All @@ -16,7 +16,7 @@ def find(api, defId, buy=None, num=0):
num = sum([i['buyNowPrice'] == lowest for i in items])
# If we have 50 of the same result, go one lower
if num == 50:
lowest -= increment(lowest)
lowest -= decrement(lowest)
if buy is None or lowest < buy:
return find(api, defId, lowest, num)
return (lowest, num)
Expand Down

0 comments on commit 406aae0

Please sign in to comment.