def test_003_GBBO下单(self): trade_token = api_funcs.get_trade_token(gbbo_data.gbbo_token) account_token = api_funcs.get_account_token(gbbo_data.gbbo_token) token = api_funcs.get_order_token(account_token) session = api_funcs.get_session(token, trade_token) res = api_funcs.gbbo_create_order(session, gbbo_data.gbbo_account_id) self.assertIn('', res.json())
def test_004_取消订单(self): trade_token = api_funcs.get_trade_token(gbbo_data.gbbo_token) account_token = api_funcs.get_account_token(gbbo_data.gbbo_token) token = api_funcs.get_order_token(account_token) session = api_funcs.get_session(token, trade_token) orderIds = api_funcs.get_open_list_order(token) print(len(orderIds)) for orderId in orderIds: api_funcs.cancel_order(session, orderId)
def test_005_并发下单(self): trade_token = api_funcs.get_trade_token(gbbo_data.gbbo_token) account_token = api_funcs.get_account_token(gbbo_data.gbbo_token) token = api_funcs.get_order_token(account_token) procs = [] pool = multiprocessing.Pool(processes=10) for i in range(10): session = api_funcs.get_session(token, trade_token) proc = pool.apply_async(api_funcs.gbbo_create_order, (session,)) procs.append(proc) for i in procs: i.get() for i in procs: i.wait()