async def run_test(): market = 'okex' lib = BitsgapClient(public_key, private_key) # get open orders result = lib.demo_orders_open(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'] == 'ok') self.assertIn('data', result_move) self.assertIn('time', result_move) data = result_move['data'] self.assertIsNotNone(data) self.assertIn('price', data) self.assertIn('pair', data) self.assertIn('state', data) self.assertIn('side', data) self.assertIn('uts', data) await asyncio.sleep(1)
async def run_test(): market = 'invalid' lib = BitsgapClient(public_key, private_key) id = 'invalid' new_price = '0.01' result_move = lib.demo_orders_move(market, id, 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)