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

Method test_okx

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

Source from the content-addressed store, hash-verified

1348 return True
1349
1350 async def test_okx(self):
1351 exchange = self.init_offline_exchange('okx')
1352 id = '6b9ad766b55dBCDE'
1353 spot_order_request = None
1354 try:
1355 await exchange.create_order('BTC/USDT', 'limit', 'buy', 1, 20000)
1356 except Exception as e:
1357 spot_order_request = json_parse(exchange.last_request_body)
1358 client_order_id = spot_order_request[0]['clOrdId'] # returns order inside array
1359 id_string = str(id)
1360 assert client_order_id.startswith(id_string), 'okx - spot clientOrderId: ' + client_order_id + ' does not start with id: ' + id_string
1361 spot_tag = spot_order_request[0]['tag']
1362 assert spot_tag == id, 'okx - id: ' + id + ' different from spot tag: ' + spot_tag
1363 swap_order_request = None
1364 try:
1365 await exchange.create_order('BTC/USDT:USDT', 'limit', 'buy', 1, 20000)
1366 except Exception as e:
1367 swap_order_request = json_parse(exchange.last_request_body)
1368 client_order_id_swap = swap_order_request[0]['clOrdId']
1369 assert client_order_id_swap.startswith(id_string), 'okx - swap clientOrderId: ' + client_order_id_swap + ' does not start with id: ' + id_string
1370 swap_tag = swap_order_request[0]['tag']
1371 assert swap_tag == id, 'okx - id: ' + id + ' different from swap tag: ' + swap_tag
1372 if not is_sync():
1373 await close(exchange)
1374 return True
1375
1376 async def test_cryptocom(self):
1377 exchange = self.init_offline_exchange('cryptocom')

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