Skip to content

Commit

Permalink
round price in price_validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Aug 31, 2018
1 parent d1b5d01 commit 1ee782e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def can_submit_order(self, account, order):
if order.type != ORDER_TYPE.LIMIT:
return True

limit_up = self._env.price_board.get_limit_up(order.order_book_id)
# FIXME: it may be better to round price in data source
limit_up = round(self._env.price_board.get_limit_up(order.order_book_id), 4)
if order.price > limit_up:
reason = _(
"Order Creation Failed: limit order price {limit_price} is higher than limit up {limit_up}."
Expand All @@ -40,7 +41,7 @@ def can_submit_order(self, account, order):
user_system_log.warn(reason)
return False

limit_down = self._env.price_board.get_limit_down(order.order_book_id)
limit_down = round(self._env.price_board.get_limit_down(order.order_book_id), 4)
if order.price < limit_down:
reason = _(
"Order Creation Failed: limit order price {limit_price} is lower than limit down {limit_down}."
Expand Down

0 comments on commit 1ee782e

Please sign in to comment.