Path: blob/master/bitget-java-sdk-api/src/test/java/com/bitget/openapi/api/MixOrderTest.java
518 views
package com.bitget.openapi.api;12import com.alibaba.fastjson.JSON;3import com.bitget.openapi.BaseTest;4import com.bitget.openapi.dto.response.ResponseResult;5import com.google.common.collect.Maps;6import org.junit.Test;78import java.io.IOException;9import java.util.Map;1011public class MixOrderTest extends BaseTest {1213@Test14public void placeOrder() throws IOException {15try {16Map<String, String> paramMap = Maps.newHashMap();17paramMap.put("symbol", "BTCUSDT_UMCBL");18paramMap.put("marginCoin", "USDT");19paramMap.put("side", "open_long");20paramMap.put("orderType", "limit");21paramMap.put("price", "27012.1");22paramMap.put("size", "0.01");23paramMap.put("timInForceValue", "normal");24ResponseResult result = bitgetRestClient.bitget().v1().mixOrder().placeOrder(paramMap);25System.out.println(JSON.toJSONString(result));26} catch (Exception e) {27System.out.println(e);28throw e;29}30}3132@Test33public void post() throws IOException {34Map<String, String> paramMap = Maps.newHashMap();35paramMap.put("symbol", "BTCUSDT_UMCBL");36paramMap.put("marginCoin", "USDT");37paramMap.put("side", "open_long");38paramMap.put("orderType", "limit");39paramMap.put("price", "27012.1");40paramMap.put("size", "0.01");41paramMap.put("timInForceValue", "normal");42ResponseResult result = bitgetRestClient.bitget().v1().request().post("/api/mix/v1/order/placeOrder", paramMap);43System.out.println(JSON.toJSONString(result));44}4546@Test47public void get() throws IOException {48Map<String, String> paramMap = Maps.newHashMap();49paramMap.put("symbol", "BTCUSDT_UMCBL");50paramMap.put("startTime", "1695632659703");51paramMap.put("endTime", "1695635659703");52ResponseResult result = bitgetRestClient.bitget().v1().request().get("/api/mix/v1/order/history", paramMap);53System.out.println(JSON.toJSONString(result));54}5556@Test57public void get_comm() throws IOException {58Map<String, String> paramMap = Maps.newHashMap();59paramMap.put("symbol", "$AIUSDT");60paramMap.put("businessType", "spot");61ResponseResult result = bitgetRestClient.bitget().v1().request().get("/api/v2/common/trade-rate", paramMap);62System.out.println(JSON.toJSONString(result));63}6465@Test66public void getWithEmptyParams() throws IOException {67ResponseResult result = bitgetRestClient.bitget().v1().request().get("/api/mix/v1/market/contract-vip-level", Maps.newHashMap());68System.out.println(JSON.toJSONString(result));6970result = bitgetRestClient.bitget().v1().request().get("/api/mix/v1/market/contract-vip-level");71System.out.println(JSON.toJSONString(result));72}73}747576