async def run_test(): market = 'okex' pair = 'ETH_BTC' price = '0.015' amount = '0' side = 'buy' ord_type = 'limit' lib = BitsgapClient(public_key, private_key) result = lib.demo_orders_add(market, pair, amount, price, side, ord_type) logging.debug(result) self.assertIn('time', result) self.assertIn('status', result) self.assertTrue(result['status'] == 'error') await asyncio.sleep(1)
async def run_test(): market = 'okex' pair = 'ETH_BTC' price = '0.015' amount = '1' side = 'buy' ord_type = 'limit' lib = BitsgapClient(public_key, private_key) result = lib.demo_orders_add(market, pair, amount, price, side, ord_type) logging.debug(result) self.assertIn('status', result) self.assertTrue(result['status'] == 'ok') self.assertIn('time', result) self.assertIn('data', result) data = result['data'] self.assertIsNotNone(data) # check fields self.assertIn('id', data) self.assertIn('price', data) self.assertIn('amount', data) self.assertIn('state', data) self.assertIn('pair', data) self.assertIn('type', data) self.assertIn('side', data) self.assertIn('uts', data) self.assertIn('state', data) if 'state' in data: self.assertIn(data['state'], 'opened') await asyncio.sleep(1)