New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
仅在交易时段内撮合 #804
仅在交易时段内撮合 #804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试也要加上
@@ -166,8 +166,16 @@ def on_tick(self, event): | |||
self._match(tick.order_book_id) | |||
|
|||
def _match(self, order_book_id=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以直接传入一个时间,避免从 env 重复取。
rqalpha/model/instrument.py
Outdated
@@ -375,6 +375,13 @@ def trading_hours(self): | |||
trading_period.append(TimeRange(start, end)) | |||
return trading_period | |||
|
|||
def during_continuous_auction(self, dt): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参数类型改成 datetime.time
@@ -166,8 +166,16 @@ def on_tick(self, event): | |||
self._match(tick.order_book_id) | |||
|
|||
def _match(self, order_book_id=None): | |||
order_filter = lambda a_and_o: not (a_and_o[1].is_final() or (order_book_id and a_and_o[1].order_book_id != order_book_id)) | |||
for account, order in filter(order_filter, self._open_orders): | |||
order_filter = lambda a_and_o: all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
合并两个 filter,然后用 and 连起来而不是 all(利用短路逻辑提升性能)。
No description provided.