func (t *TradeClient) GetBalance(recv time.Duration) (interface{}, error) {
	var err error
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v2/balance", "", true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := UserBalanceResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
GetBalance get user balance
package futuresclient
import (
	"encoding/json"
	"errors"
	"fmt"
	"github.com/dirname/binance"
	"github.com/dirname/binance/futures/usd/client/define/order"
	logger "github.com/dirname/binance/logging"
	"github.com/dirname/binance/model"
	"github.com/shopspring/decimal"
	"net/http"
	"strings"
	"time"
)
type TradeClient struct {
	Builder *binance.PrivateUrlBuilder
}
func NewTradeClient(host, appKey, appSecret string) *TradeClient {
	return &TradeClient{
		Builder: binance.NewPrivateUrlBuilder(host, appKey, appSecret),
	}
}
func (t *TradeClient) PositionSideDual(dualSidePosition bool, recv time.Duration) (interface{}, error) {
	var err error
	val := ""
	if dualSidePosition == false {
		val = "false"
	} else {
		val = "true"
	}
	params := strings.Join([]string{"dualSidePosition=", val}, "")
	req, err := t.Builder.Build(http.MethodPost, "/fapi/v1/positionSide/dual", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	result := model.APIErrorResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) GetPositionSideDual(recv time.Duration) (interface{}, error) {
	var err error
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/positionSide/dual", "", true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := DualSidePositionResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) ChangeMultiAssetsMode(margin bool, recv time.Duration) (interface{}, error) {
	var err error
	val := ""
	if margin == false {
		val = "false"
	} else {
		val = "true"
	}
	params := strings.Join([]string{"multiAssetsMargin=", val}, "")
	req, err := t.Builder.Build(http.MethodPost, "/fapi/v1/multiAssetsMargin", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	result := model.APIErrorResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) GetMultiAssetsMargin(recv time.Duration) (interface{}, error) {
	var err error
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/multiAssetsMargin", "", true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := MultiAssetsMarginResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) NewOrder(symbol, side, positionSide, ordersType, reduceOnly, newClientOrderID, closePosition, timeInForce, workingType, priceProtect, newOrderRespType string, quantity, price, stopPrice, activationPrice, callbackRate decimal.Decimal, recv time.Duration) (interface{}, error) {
	var err error
	params, err := buildOrder(symbol, side, positionSide, ordersType, reduceOnly, newClientOrderID, closePosition, timeInForce, workingType, priceProtect, newOrderRespType, quantity, price, stopPrice, activationPrice, callbackRate)
	if err != nil {
		return nil, err
	}
	req, err := t.Builder.Build(http.MethodPost, "/fapi/v1/order", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	switch newOrderRespType {
	case order.Result:
		result := NewOrderResponseResult{}
		err = json.Unmarshal(res, &result)
		return result, err
	default:
		result := NewOrderResponseACK{}
		err = json.Unmarshal(res, &result)
		return parser, err
	}
	return parser, err
}
func (t *TradeClient) BatchNewOrder(batchOrders OrderBatch, recv time.Duration) (interface{}, error) {
	var err error
	if batchOrders == nil {
		err = errors.New(MissParameters)
		return nil, err
	}
	param, err := json.Marshal(batchOrders)
	if err != nil {
		return nil, err
	}
	params := fmt.Sprintf("batchOrders=%s", param)
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/batchOrders", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	result := BatchNewOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) TestNewOrder(symbol, side, positionSide, ordersType, reduceOnly, newClientOrderID, closePosition, timeInForce, workingType, priceProtect, newOrderRespType string, quantity, price, stopPrice, activationPrice, callbackRate decimal.Decimal, recv time.Duration) (interface{}, error) {
	var err error
	params, err := buildOrder(symbol, side, positionSide, ordersType, reduceOnly, newClientOrderID, closePosition, timeInForce, workingType, priceProtect, newOrderRespType, quantity, price, stopPrice, activationPrice, callbackRate)
	if err != nil {
		return nil, err
	}
	req, err := t.Builder.Build(http.MethodPost, "/fapi/v1/order/test", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	return parser, err
}
func (t *TradeClient) GetOrder(symbol, origClientOrderID string, orderID int64, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	if orderID <= 0 && origClientOrderID == "" {
		err = errors.New(MissParameters)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s", symbol)
	if origClientOrderID != "" {
		params += fmt.Sprintf("&origClientOrderId=%s", origClientOrderID)
	}
	if orderID > 0 {
		params += fmt.Sprintf("&orderId=%d", orderID)
	}
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/order", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := OrderBookResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) DeleteOrder(symbol, origClientOrderID string, orderID int64, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	if orderID <= 0 && origClientOrderID == "" {
		err = errors.New(MissParameters)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s", symbol)
	if origClientOrderID != "" {
		params += fmt.Sprintf("&origClientOrderId=%s", origClientOrderID)
	}
	if orderID > 0 {
		params += fmt.Sprintf("&orderId=%d", orderID)
	}
	req, err := t.Builder.Build(http.MethodDelete, "/fapi/v1/order", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := DeleteOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) DeleteAllOrder(symbol string, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s", symbol)
	req, err := t.Builder.Build(http.MethodDelete, "/fapi/v1/allOpenOrders", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	result := model.APIErrorResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) BatchDeleteOrder(symbol string, orderIDList []int64, origClientOrderID []string, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	if len(orderIDList) == 0 || len(origClientOrderID) == 0 {
		err = errors.New(MissParameters)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s", symbol)
	if len(orderIDList) > 0 {
		param, err := json.Marshal(orderIDList)
		if err != nil {
			return nil, err
		}
		params += fmt.Sprintf("&orderIdList=%s", param)
	}
	if len(origClientOrderID) > 0 {
		param, err := json.Marshal(orderIDList)
		if err != nil {
			return nil, err
		}
		params += fmt.Sprintf("&origClientOrderIdList=%s", param)
	}
	req, err := t.Builder.Build(http.MethodDelete, "/fapi/v1/batchOrders", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	result := BatchDeleteOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) CountDownDeleteAllOrder(symbol string, countDownTime int64, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	if countDownTime < 0 {
		err = errors.New(CountDownTimeInvalid)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s&countdownTime=%d", symbol, countDownTime)
	req, err := t.Builder.Build(http.MethodPost, "/fapi/v1/countdownCancelAll", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := CountDownDeleteOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) GetOpenOrder(symbol, origClientOrderID string, orderID int64, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	if orderID <= 0 && origClientOrderID == "" {
		err = errors.New(MissParameters)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s", symbol)
	if origClientOrderID != "" {
		params += fmt.Sprintf("&origClientOrderId=%s", origClientOrderID)
	}
	if orderID > 0 {
		params += fmt.Sprintf("&orderId=%d", orderID)
	}
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/openOrder", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := OpenOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) GetAllOpenOrder(symbol string, recv time.Duration) (interface{}, error) {
	var err error
	if symbol == "" {
		err = errors.New(SymbolEmpty)
		return nil, err
	}
	params := fmt.Sprintf("symbol=%s", symbol)
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/openOrders", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := AllOpenOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}
func (t *TradeClient) GetAllOrder(symbol string, orderID, startTime, endTime int64, limit int32, recv time.Duration) (interface{}, error) {
	var err error
	params := ""
	if symbol != "" {
		params = fmt.Sprintf("symbol=%s", symbol)
	}
	if startTime > 0 {
		params += fmt.Sprintf("&startTime=%d", startTime)
	}
	if endTime > 0 {
		params += fmt.Sprintf("&endTime=%d", endTime)
	}
	if limit > 1000 {
		limit = 1000
	}
	if limit > 0 {
		params += fmt.Sprintf("&limit=%d", limit)
	}
	if orderID > 0 {
		params += fmt.Sprintf("&orderId=%d", orderID)
	}
	req, err := t.Builder.Build(http.MethodGet, "/fapi/v1/allOrders", params, true, true, recv)
	if err != nil {
		logger.Error("Failed to build url: %s", err.Error())
	}
	res, err := binance.HttpRequest(req)
	var parser map[string]interface{}
	err = json.Unmarshal(res, &parser)
	if _, ok := parser["code"]; ok {
		result := model.APIErrorResponse{}
		err = json.Unmarshal(res, &result)
		return result, err
	}
	result := AllOrderResponse{}
	err = json.Unmarshal(res, &result)
	return result, err
}