()
| 2350 | } |
| 2351 | |
| 2352 | public java.util.concurrent.CompletableFuture<Object> testHtx() |
| 2353 | { |
| 2354 | |
| 2355 | return java.util.concurrent.CompletableFuture.supplyAsync(() -> { |
| 2356 | |
| 2357 | Exchange exchange = this.initOfflineExchange("htx"); |
| 2358 | // spot test |
| 2359 | Object id = "AA03022abc"; |
| 2360 | Object spotOrderRequest = null; |
| 2361 | try |
| 2362 | { |
| 2363 | (exchange.createOrder("BTC/USDT", "limit", "buy", 1, 20000)).join(); |
| 2364 | } catch(Exception e) |
| 2365 | { |
| 2366 | spotOrderRequest = jsonParse(exchange.last_request_body); |
| 2367 | } |
| 2368 | Object clientOrderId = Helpers.GetValue(spotOrderRequest, "client-order-id"); |
| 2369 | Object idString = String.valueOf(id); |
| 2370 | Assert(((String)clientOrderId).startsWith(((String)idString)), Helpers.add(Helpers.add(Helpers.add("htx - spot clientOrderId ", clientOrderId), " does not start with id: "), idString)); |
| 2371 | // swap test |
| 2372 | Object swapOrderRequest = null; |
| 2373 | try |
| 2374 | { |
| 2375 | (exchange.createOrder("BTC/USDT:USDT", "limit", "buy", 1, 20000)).join(); |
| 2376 | } catch(Exception e) |
| 2377 | { |
| 2378 | swapOrderRequest = jsonParse(exchange.last_request_body); |
| 2379 | } |
| 2380 | Object swapInverseOrderRequest = null; |
| 2381 | try |
| 2382 | { |
| 2383 | (exchange.createOrder("BTC/USD:BTC", "limit", "buy", 1, 20000)).join(); |
| 2384 | } catch(Exception e) |
| 2385 | { |
| 2386 | swapInverseOrderRequest = jsonParse(exchange.last_request_body); |
| 2387 | } |
| 2388 | Object clientOrderIdSwap = Helpers.GetValue(swapOrderRequest, "channel_code"); |
| 2389 | Assert(((String)clientOrderIdSwap).startsWith(((String)idString)), Helpers.add(Helpers.add(Helpers.add("htx - swap channel_code ", clientOrderIdSwap), " does not start with id: "), idString)); |
| 2390 | Object clientOrderIdInverse = Helpers.GetValue(swapInverseOrderRequest, "channel_code"); |
| 2391 | Assert(((String)clientOrderIdInverse).startsWith(((String)idString)), Helpers.add(Helpers.add(Helpers.add("htx - swap inverse channel_code ", clientOrderIdInverse), " does not start with id: "), idString)); |
| 2392 | if (!Helpers.isTrue(isSync())) |
| 2393 | { |
| 2394 | (close(exchange)).join(); |
| 2395 | } |
| 2396 | return true; |
| 2397 | }); |
| 2398 | |
| 2399 | } |
| 2400 | |
| 2401 | public java.util.concurrent.CompletableFuture<Object> testWoo() |
| 2402 | { |
no test coverage detected