Skip to content

Commit

Permalink
fix round price again
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Nov 19, 2018
1 parent 157b066 commit 2519988
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rqalpha/model/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ def get_limit_price(self):
def round_price(self, tick_size):
if tick_size:
with decimal_rounding_floor():
limit_price_decimal = round(Decimal(self.limit_price), 4)
tick_size_decimal = round(Decimal(tick_size), 4)
limit_price_decimal = Decimal("{:.4f}".format(self.limit_price))
tick_size_decimal = Decimal("{:.4f}".format(tick_size))
self.limit_price = float((limit_price_decimal / tick_size_decimal).to_integral() * tick_size_decimal)
else:
user_system_log.warn('Invalid tick size: {}'.format(tick_size))

0 comments on commit 2519988

Please sign in to comment.