Skip to content

Commit

Permalink
增加测试案例
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou-JiaJun committed Oct 11, 2023
1 parent 74db4b1 commit 9df4355
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/api_tests/mod/sys_simulation/test_signal_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"frequency": "1d",
"accounts": {
"stock": 1000000,
"future": 1000000
}
},
"extra": {
Expand Down Expand Up @@ -53,3 +54,23 @@ def handle_bar(context, bar_dict):
assert get_position(stock).avg_price == price

return locals()


def test_signal_open_auction():

def init(context):
context.fixed = True

def open_auction(context, bar_dict):
if context.fixed:
order_shares("000001.XSHE", 1000)
buy_open("AU1512", 1)
pos = get_position("000001.XSHE")
assert pos.quantity == 1000
assert pos.avg_price == 18.0
pos = get_position("AU1512")
assert pos.quantity == 1
assert pos.avg_price == 242.2
context.fixed = False

return locals()

0 comments on commit 9df4355

Please sign in to comment.