Skip to content

Commit 9788c90

Browse files
author
Caleb Quilley
committed
Address review comments
1 parent 235511e commit 9788c90

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cogs/commands/market.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ def __init__(self, stock_name):
5252
self.last_trade = None
5353
self.open = True
5454

55-
def bid(self, price, user_id, qty, time=time.time()):
56-
heapq.heappush(self.bids, Order(price, 'bid', user_id, qty, time))
55+
def bid(self, price, user_id, qty, order_time=None):
56+
order_time = time.time() if order_time is None else order_time
57+
heapq.heappush(self.bids, Order(price, 'bid', user_id, qty, order_time))
5758
return self.match()
5859

59-
def ask(self, price, user_id, qty, time=time.time()):
60-
heapq.heappush(self.asks, Order(price, 'ask', user_id, qty, time))
60+
def ask(self, price, user_id, qty, order_time=None):
61+
order_time = time.time() if order_time is None else order_time
62+
heapq.heappush(self.asks, Order(price, 'ask', user_id, qty, order_time))
6163
return self.match()
6264

6365
def match(self):
@@ -226,7 +228,7 @@ async def bid_market(self, ctx: Context, price: float, qty: int, *, market: clea
226228

227229
@commands.hybrid_command(help=LONG_HELP_TEXT, brief=SHORT_HELP_TEXT)
228230
async def ask_market(self, ctx: Context, price: float, qty: int, *, market: clean_content):
229-
"""You would place a bid by using this command
231+
"""You would place an ask by using this command
230232
'!ask_market 123.4 15 "AAPL"'
231233
"""
232234

0 commit comments

Comments
 (0)