async def run_test(): market = 'okex' lib = BitsgapClient(public_key, private_key) result = lib.demo_orders_history(market) logging.debug(result) self.assertIn('status', result) self.assertTrue(result['status'] == 'ok') self.assertIn('time', result) if 'message' in result: self.assertTrue(result['message'] == 'Data not found') # no open orders else: self.assertIn('data', result) data = result['data'] self.assertTrue(len(data) > 0) # check fields self.assertIn('id', data[0]) self.assertIn('price', data[0]) self.assertIn('amount', data[0]) self.assertIn('pair', data[0]) self.assertIn('type', data[0]) self.assertIn('time', data[0]) await asyncio.sleep(1)
async def run_test(): market = 'okex' lib = BitsgapClient(public_key, private_key) # get executed orders result = lib.demo_orders_history(market) logging.debug(result) self.assertIsNotNone(result) self.assertIn('status', result) self.assertTrue(result['status'] == 'ok') self.assertIn('time', result) self.assertIn('data', result) data = result['data'] self.assertIsNotNone(data) self.assertTrue(len(data) > 0) self.assertIn('id', data[0]) id = data[0]['id'] self.assertIsNotNone(id) old_price = data[0]['price'] self.assertIsNotNone(old_price) new_price = float(old_price) * 0.999 result_move = lib.demo_orders_move(market, id, str(new_price)) self.assertIn('status', result_move) self.assertTrue(result_move['status'] == 'error') self.assertIn('message', result_move) self.assertIn('time', result_move) await asyncio.sleep(1)
async def run_test(): market = 'okex' lib = BitsgapClient(public_key, private_key) # get executed orders result = lib.demo_orders_history(market) logging.debug(result) self.assertIsNotNone(result) self.assertIn('status', result) self.assertTrue(result['status'] == 'ok') self.assertIn('time', result) self.assertIn('data', result) data = result['data'] self.assertIsNotNone(data) self.assertTrue(len(data) > 0) self.assertIn('id', data[0]) id = data[0]['id'] self.assertIsNotNone(id) result_cancel = lib.demo_orders_cancel(market, id) self.assertIn('status', result_cancel) self.assertTrue(result_cancel['status'] == 'error') self.assertIn('message', result_cancel) self.assertIn('time', result_cancel) await asyncio.sleep(1)