Skip to content

Commit

Permalink
fixed the if statment that should be in the for loop in the function …
Browse files Browse the repository at this point in the history
…computeRequiredPrice
  • Loading branch information
selimamrouni committed Oct 2, 2020
1 parent ff302ad commit d071919
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions agent/OrderBookImbalanceAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,12 @@ def computeRequiredPrice (self, direction, shares, known_bids, known_asks):
t = 0

for i in range(len(book)):
p,v = book[i]
p, v = book[i]
t += v

# If we have accumulated enough shares, return this price.
if t >= shares: return p
# If we have accumulated enough shares, return this price.
if t >= shares:
return p

# Not enough shares. Just return worst price (highest ask, lowest bid).
return book[-1][0]
Expand Down

0 comments on commit d071919

Please sign in to comment.