Skip to content

Commit e2553fd

Browse files
committed
Add tests for market orders
1 parent 988d049 commit e2553fd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/shipane_sdk/test_client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ def test_sell_stock(self):
8787
result = e.response.json()
8888
self.assertNotEqual(result['source'], "实盘易")
8989

90+
def test_buy_stock_at_market_price(self):
91+
try:
92+
order = self.client.buy(self.client_param, symbol='000001', type='MARKET', priceType=4, amount=100)
93+
self.assertIsNotNone(order['id'])
94+
except HTTPError as e:
95+
result = e.response.json()
96+
self.assertNotEqual(result['source'], "实盘易")
97+
98+
def test_sell_stock_at_market_price(self):
99+
try:
100+
order = self.client.sell(self.client_param, symbol='000001', type='MARKET', priceType=4, amount=100)
101+
self.assertIsNotNone(order['id'])
102+
except HTTPError as e:
103+
result = e.response.json()
104+
self.assertNotEqual(result['source'], "实盘易")
105+
90106
def test_cancel_all(self):
91107
try:
92108
self.client.cancel_all(self.client_param)

0 commit comments

Comments
 (0)