Skip to content

Commit

Permalink
optimize code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Nov 16, 2018
1 parent 88ad860 commit a339168
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions rqalpha/mod/rqalpha_mod_sys_simulation/slippage.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,14 @@ def get_trade_price(self, order, price):
temp_price = price + price * self.rate * (1 if side == SIDE.BUY else -1)
try:
temp_bar = Environment.get_instance().bar_dict[order.order_book_id]
except KeyError:
pass
else:
limit_up, limit_down = temp_bar.limit_up, temp_bar.limit_down

if is_valid_price(limit_up):
temp_price = min(temp_price, limit_up)

if is_valid_price(limit_down):
temp_price = max(temp_price, limit_down)
except KeyError:
# tick中没有涨跌停价
pass
return temp_price


Expand Down

0 comments on commit a339168

Please sign in to comment.