async def run_test(): market = 'okex' pair = 'ETH_BTC' start = int(time.time() - 3600) end = int(time.time()) lib = BitsgapClient(public_key, private_key) result = lib.ohlc(market, pair, start, end) logging.debug(result) self.assertTrue(result['status'] == 'ok') self.assertIn('data', result) data = result['data'] self.assertTrue(len(data)> 0) item = data[0] self.assertIn('open', item) self.assertIn('high', item) self.assertIn('low', item) self.assertIn('close', item) self.assertIn('time', item) self.assertIn('volume', item) volume = item['volume'] self.assertIn('buy', volume) self.assertIn('buy', volume) await asyncio.sleep(1)
async def run_test(): market = 'okex' pair = 'no_pair' start = int(time.time()) - 3600 end = int(time.time()) lib = BitsgapClient(public_key, private_key) result = lib.ohlc(market, pair, start, end) logging.debug(result) self.assertTrue(result['status'] == 'error') self.assertIn('message', result) await asyncio.sleep(1)