MCPcopy Create free account
hub / github.com/ccxt/ccxt / test_htx

Method test_htx

python/ccxt/test/tests_async.py:1502–1531  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1500 return True
1501
1502 async def test_htx(self):
1503 exchange = self.init_offline_exchange('htx')
1504 # spot test
1505 id = 'AA03022abc'
1506 spot_order_request = None
1507 try:
1508 await exchange.create_order('BTC/USDT', 'limit', 'buy', 1, 20000)
1509 except Exception as e:
1510 spot_order_request = json_parse(exchange.last_request_body)
1511 client_order_id = spot_order_request['client-order-id']
1512 id_string = str(id)
1513 assert client_order_id.startswith(id_string), 'htx - spot clientOrderId ' + client_order_id + ' does not start with id: ' + id_string
1514 # swap test
1515 swap_order_request = None
1516 try:
1517 await exchange.create_order('BTC/USDT:USDT', 'limit', 'buy', 1, 20000)
1518 except Exception as e:
1519 swap_order_request = json_parse(exchange.last_request_body)
1520 swap_inverse_order_request = None
1521 try:
1522 await exchange.create_order('BTC/USD:BTC', 'limit', 'buy', 1, 20000)
1523 except Exception as e:
1524 swap_inverse_order_request = json_parse(exchange.last_request_body)
1525 client_order_id_swap = swap_order_request['channel_code']
1526 assert client_order_id_swap.startswith(id_string), 'htx - swap channel_code ' + client_order_id_swap + ' does not start with id: ' + id_string
1527 client_order_id_inverse = swap_inverse_order_request['channel_code']
1528 assert client_order_id_inverse.startswith(id_string), 'htx - swap inverse channel_code ' + client_order_id_inverse + ' does not start with id: ' + id_string
1529 if not is_sync():
1530 await close(exchange)
1531 return True
1532
1533 async def test_woo(self):
1534 exchange = self.init_offline_exchange('woo')

Callers 1

run_broker_id_testsMethod · 0.95

Calls 5

init_offline_exchangeMethod · 0.95
json_parseFunction · 0.90
is_syncFunction · 0.90
closeFunction · 0.90
create_orderMethod · 0.45

Tested by

no test coverage detected