Skip to content

Commit

Permalink
added debug information to attempt to fix weight not adding to 1 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-belcher committed Jul 1, 2015
1 parent 655f361 commit aad5ea3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,12 @@ def weighted_order_choose(orders, n, feekey):
'''
minfee = feekey(orders[0])
M = int(1.5*n)
if len(orders) > M:
if len(orders) >= M:
phi = feekey(orders[M]) - minfee
else:
phi = feekey(orders[-1]) - minfee
fee = np.array([feekey(o) for o in orders])
debug('phi=' + str(phi) + ' fee=' + str(fee))
if phi > 0:
weight = np.exp(-(1.0*fee - minfee) / phi)
else:
Expand Down

0 comments on commit aad5ea3

Please sign in to comment.