|
|
|
|
@@ -250,7 +250,7 @@ func TestSubmitOrder(t *testing.T) {
|
|
|
|
|
t.Skip(skipAuthenticatedFunctionsForMockTesting)
|
|
|
|
|
}
|
|
|
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, b, canManipulateRealOrders)
|
|
|
|
|
var orderSubmission = &order.Submit{
|
|
|
|
|
orderSubmission := &order.Submit{
|
|
|
|
|
Exchange: b.GetName(),
|
|
|
|
|
Pair: spotTradablePair,
|
|
|
|
|
Side: order.Buy,
|
|
|
|
|
@@ -373,7 +373,8 @@ func TestCancelOrder(t *testing.T) {
|
|
|
|
|
Exchange: b.Name,
|
|
|
|
|
AssetType: asset.Spot,
|
|
|
|
|
Pair: spotTradablePair,
|
|
|
|
|
OrderID: "1234"})
|
|
|
|
|
OrderID: "1234",
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -381,7 +382,8 @@ func TestCancelOrder(t *testing.T) {
|
|
|
|
|
Exchange: b.Name,
|
|
|
|
|
AssetType: asset.USDTMarginedFutures,
|
|
|
|
|
Pair: usdtMarginedTradablePair,
|
|
|
|
|
OrderID: "1234"})
|
|
|
|
|
OrderID: "1234",
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -390,7 +392,8 @@ func TestCancelOrder(t *testing.T) {
|
|
|
|
|
Exchange: b.Name,
|
|
|
|
|
AssetType: asset.CoinMarginedFutures,
|
|
|
|
|
Pair: inverseTradablePair,
|
|
|
|
|
OrderID: "1234"})
|
|
|
|
|
OrderID: "1234",
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -398,7 +401,8 @@ func TestCancelOrder(t *testing.T) {
|
|
|
|
|
Exchange: b.Name,
|
|
|
|
|
AssetType: asset.Options,
|
|
|
|
|
Pair: optionsTradablePair,
|
|
|
|
|
OrderID: "1234"})
|
|
|
|
|
OrderID: "1234",
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -466,7 +470,7 @@ func TestGetActiveOrders(t *testing.T) {
|
|
|
|
|
t.Skip(skipAuthenticatedFunctionsForMockTesting)
|
|
|
|
|
}
|
|
|
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, b)
|
|
|
|
|
var getOrdersRequestSpot = order.MultiOrderRequest{
|
|
|
|
|
getOrdersRequestSpot := order.MultiOrderRequest{
|
|
|
|
|
Pairs: currency.Pairs{spotTradablePair},
|
|
|
|
|
AssetType: asset.Spot,
|
|
|
|
|
Side: order.AnySide,
|
|
|
|
|
@@ -476,17 +480,17 @@ func TestGetActiveOrders(t *testing.T) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
var getOrdersRequestLinear = order.MultiOrderRequest{Pairs: currency.Pairs{usdtMarginedTradablePair}, AssetType: asset.USDTMarginedFutures, Side: order.AnySide, Type: order.AnyType}
|
|
|
|
|
getOrdersRequestLinear := order.MultiOrderRequest{Pairs: currency.Pairs{usdtMarginedTradablePair}, AssetType: asset.USDTMarginedFutures, Side: order.AnySide, Type: order.AnyType}
|
|
|
|
|
_, err = b.GetActiveOrders(context.Background(), &getOrdersRequestLinear)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
var getOrdersRequestInverse = order.MultiOrderRequest{Pairs: currency.Pairs{inverseTradablePair}, AssetType: asset.CoinMarginedFutures, Side: order.AnySide, Type: order.AnyType}
|
|
|
|
|
getOrdersRequestInverse := order.MultiOrderRequest{Pairs: currency.Pairs{inverseTradablePair}, AssetType: asset.CoinMarginedFutures, Side: order.AnySide, Type: order.AnyType}
|
|
|
|
|
_, err = b.GetActiveOrders(context.Background(), &getOrdersRequestInverse)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
var getOrdersRequestFutures = order.MultiOrderRequest{Pairs: currency.Pairs{optionsTradablePair}, AssetType: asset.Options, Side: order.AnySide, Type: order.AnyType}
|
|
|
|
|
getOrdersRequestFutures := order.MultiOrderRequest{Pairs: currency.Pairs{optionsTradablePair}, AssetType: asset.Options, Side: order.AnySide, Type: order.AnyType}
|
|
|
|
|
_, err = b.GetActiveOrders(context.Background(), &getOrdersRequestFutures)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
@@ -508,7 +512,7 @@ func TestGetOrderHistory(t *testing.T) {
|
|
|
|
|
t.Skip(skipAuthenticatedFunctionsForMockTesting)
|
|
|
|
|
}
|
|
|
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, b)
|
|
|
|
|
var getOrdersRequestSpot = order.MultiOrderRequest{
|
|
|
|
|
getOrdersRequestSpot := order.MultiOrderRequest{
|
|
|
|
|
Pairs: currency.Pairs{spotTradablePair},
|
|
|
|
|
AssetType: asset.Spot,
|
|
|
|
|
Type: order.AnyType,
|
|
|
|
|
@@ -518,7 +522,7 @@ func TestGetOrderHistory(t *testing.T) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
var getOrdersRequestUMF = order.MultiOrderRequest{
|
|
|
|
|
getOrdersRequestUMF := order.MultiOrderRequest{
|
|
|
|
|
Pairs: currency.Pairs{usdtMarginedTradablePair},
|
|
|
|
|
AssetType: asset.USDTMarginedFutures,
|
|
|
|
|
Type: order.AnyType,
|
|
|
|
|
@@ -534,7 +538,7 @@ func TestGetOrderHistory(t *testing.T) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
var getOrdersRequestCMF = order.MultiOrderRequest{
|
|
|
|
|
getOrdersRequestCMF := order.MultiOrderRequest{
|
|
|
|
|
Pairs: currency.Pairs{inverseTradablePair},
|
|
|
|
|
AssetType: asset.CoinMarginedFutures,
|
|
|
|
|
Type: order.AnyType,
|
|
|
|
|
@@ -544,7 +548,7 @@ func TestGetOrderHistory(t *testing.T) {
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
var getOrdersRequestFutures = order.MultiOrderRequest{
|
|
|
|
|
getOrdersRequestFutures := order.MultiOrderRequest{
|
|
|
|
|
Pairs: currency.Pairs{optionsTradablePair},
|
|
|
|
|
AssetType: asset.Options,
|
|
|
|
|
Type: order.AnyType,
|
|
|
|
|
@@ -594,7 +598,8 @@ func TestWithdrawCryptocurrencyFunds(t *testing.T) {
|
|
|
|
|
Chain: currency.LTC.String(),
|
|
|
|
|
Address: "3CDJNfdWX8m2NwuGUV3nhXHXEeLygMXoAj",
|
|
|
|
|
AddressTag: "",
|
|
|
|
|
}})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
if err != nil && err.Error() != "Withdraw address chain or destination tag are not equal" {
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -867,41 +872,51 @@ func TestPlaceOrder(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
// Spot TP/SL order
|
|
|
|
|
arg = &PlaceOrderParams{Category: "spot",
|
|
|
|
|
Symbol: spotTradablePair,
|
|
|
|
|
Side: "Buy", OrderType: "Limit",
|
|
|
|
|
arg = &PlaceOrderParams{
|
|
|
|
|
Category: "spot",
|
|
|
|
|
Symbol: spotTradablePair,
|
|
|
|
|
Side: "Buy", OrderType: "Limit",
|
|
|
|
|
OrderQuantity: 0.1, Price: 15600, TriggerPrice: 15000,
|
|
|
|
|
TimeInForce: "GTC", OrderLinkID: "spot-test-02", IsLeverage: 0, OrderFilter: "tpslOrder"}
|
|
|
|
|
TimeInForce: "GTC", OrderLinkID: "spot-test-02", IsLeverage: 0, OrderFilter: "tpslOrder",
|
|
|
|
|
}
|
|
|
|
|
_, err = b.PlaceOrder(context.Background(), arg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
// Spot margin normal order (UTA)
|
|
|
|
|
arg = &PlaceOrderParams{Category: "spot", Symbol: spotTradablePair, Side: "Buy", OrderType: "Limit",
|
|
|
|
|
OrderQuantity: 0.1, Price: 15600, TimeInForce: "IOC", OrderLinkID: "spot-test-limit", IsLeverage: 1, OrderFilter: "Order"}
|
|
|
|
|
arg = &PlaceOrderParams{
|
|
|
|
|
Category: "spot", Symbol: spotTradablePair, Side: "Buy", OrderType: "Limit",
|
|
|
|
|
OrderQuantity: 0.1, Price: 15600, TimeInForce: "IOC", OrderLinkID: "spot-test-limit", IsLeverage: 1, OrderFilter: "Order",
|
|
|
|
|
}
|
|
|
|
|
_, err = b.PlaceOrder(context.Background(), arg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
arg = &PlaceOrderParams{Category: "spot",
|
|
|
|
|
Symbol: spotTradablePair,
|
|
|
|
|
Side: "Buy", OrderType: "Market", OrderQuantity: 200,
|
|
|
|
|
arg = &PlaceOrderParams{
|
|
|
|
|
Category: "spot",
|
|
|
|
|
Symbol: spotTradablePair,
|
|
|
|
|
Side: "Buy", OrderType: "Market", OrderQuantity: 200,
|
|
|
|
|
TimeInForce: "IOC", OrderLinkID: "spot-test-04",
|
|
|
|
|
IsLeverage: 0, OrderFilter: "Order"}
|
|
|
|
|
IsLeverage: 0, OrderFilter: "Order",
|
|
|
|
|
}
|
|
|
|
|
_, err = b.PlaceOrder(context.Background(), arg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
// USDT Perp open long position (one-way mode)
|
|
|
|
|
arg = &PlaceOrderParams{Category: "linear",
|
|
|
|
|
Symbol: usdcMarginedTradablePair, Side: "Buy", OrderType: "Limit", OrderQuantity: 1, Price: 25000, TimeInForce: "GTC", PositionIdx: 0, OrderLinkID: "usdt-test-01", ReduceOnly: false, TakeProfitPrice: 28000, StopLossPrice: 20000, TpslMode: "Partial", TpOrderType: "Limit", SlOrderType: "Limit", TpLimitPrice: 27500, SlLimitPrice: 20500}
|
|
|
|
|
arg = &PlaceOrderParams{
|
|
|
|
|
Category: "linear",
|
|
|
|
|
Symbol: usdcMarginedTradablePair, Side: "Buy", OrderType: "Limit", OrderQuantity: 1, Price: 25000, TimeInForce: "GTC", PositionIdx: 0, OrderLinkID: "usdt-test-01", ReduceOnly: false, TakeProfitPrice: 28000, StopLossPrice: 20000, TpslMode: "Partial", TpOrderType: "Limit", SlOrderType: "Limit", TpLimitPrice: 27500, SlLimitPrice: 20500,
|
|
|
|
|
}
|
|
|
|
|
_, err = b.PlaceOrder(context.Background(), arg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
// USDT Perp close long position (one-way mode)
|
|
|
|
|
arg = &PlaceOrderParams{Category: "linear", Symbol: usdtMarginedTradablePair, Side: "Sell",
|
|
|
|
|
OrderType: "Limit", OrderQuantity: 1, Price: 3000, TimeInForce: "GTC", PositionIdx: 0, OrderLinkID: "usdt-test-02", ReduceOnly: true}
|
|
|
|
|
arg = &PlaceOrderParams{
|
|
|
|
|
Category: "linear", Symbol: usdtMarginedTradablePair, Side: "Sell",
|
|
|
|
|
OrderType: "Limit", OrderQuantity: 1, Price: 3000, TimeInForce: "GTC", PositionIdx: 0, OrderLinkID: "usdt-test-02", ReduceOnly: true,
|
|
|
|
|
}
|
|
|
|
|
_, err = b.PlaceOrder(context.Background(), arg)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
@@ -930,13 +945,15 @@ func TestAmendOrder(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
_, err = b.AmendOrder(context.Background(), &AmendOrderParams{
|
|
|
|
|
OrderID: "c6f055d9-7f21-4079-913d-e6523a9cfffa",
|
|
|
|
|
Category: "mycat"})
|
|
|
|
|
Category: "mycat",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errInvalidCategory) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errInvalidCategory, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.AmendOrder(context.Background(), &AmendOrderParams{
|
|
|
|
|
OrderID: "c6f055d9-7f21-4079-913d-e6523a9cfffa",
|
|
|
|
|
Category: "option"})
|
|
|
|
|
Category: "option",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, currency.ErrCurrencyPairEmpty) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", currency.ErrCurrencyPairEmpty, err)
|
|
|
|
|
}
|
|
|
|
|
@@ -948,7 +965,8 @@ func TestAmendOrder(t *testing.T) {
|
|
|
|
|
OrderQuantity: 0.15,
|
|
|
|
|
Price: 1050,
|
|
|
|
|
TakeProfitPrice: 0,
|
|
|
|
|
StopLossPrice: 0})
|
|
|
|
|
StopLossPrice: 0,
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -976,13 +994,15 @@ func TestCancelTradeOrder(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CancelTradeOrder(context.Background(), &CancelOrderParams{
|
|
|
|
|
OrderID: "c6f055d9-7f21-4079-913d-e6523a9cfffa",
|
|
|
|
|
Category: "mycat"})
|
|
|
|
|
Category: "mycat",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errInvalidCategory) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errInvalidCategory, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CancelTradeOrder(context.Background(), &CancelOrderParams{
|
|
|
|
|
OrderID: "c6f055d9-7f21-4079-913d-e6523a9cfffa",
|
|
|
|
|
Category: "option"})
|
|
|
|
|
Category: "option",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, currency.ErrCurrencyPairEmpty) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", currency.ErrCurrencyPairEmpty, err)
|
|
|
|
|
}
|
|
|
|
|
@@ -1148,7 +1168,8 @@ func TestBatchAmendOrder(t *testing.T) {
|
|
|
|
|
Symbol: optionsTradablePair,
|
|
|
|
|
OrderImpliedVolatility: "6.8",
|
|
|
|
|
OrderID: "b551f227-7059-4fb5-a6a6-699c04dbd2f2",
|
|
|
|
|
}})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errCategoryNotSet) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errCategoryNotSet, err)
|
|
|
|
|
}
|
|
|
|
|
@@ -1266,6 +1287,7 @@ func TestGetPositionInfo(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestSetLeverageLevel(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if mockTests {
|
|
|
|
|
@@ -1499,6 +1521,7 @@ func TestSetAutoAddMargin(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestAddOrReduceMargin(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if mockTests {
|
|
|
|
|
@@ -1959,6 +1982,7 @@ func TestGetDeliveryRecord(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestGetUSDCSessionSettlement(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if !mockTests {
|
|
|
|
|
@@ -2067,20 +2091,26 @@ func TestCreateInternalTransfer(t *testing.T) {
|
|
|
|
|
if !errors.Is(err, errMissingAccountType) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMissingAccountType, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CreateInternalTransfer(context.Background(), &TransferParams{TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456})
|
|
|
|
|
_, err = b.CreateInternalTransfer(context.Background(), &TransferParams{
|
|
|
|
|
TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456,
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errMissingAccountType) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMissingAccountType, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CreateInternalTransfer(context.Background(), &TransferParams{TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456, FromAccountType: "UNIFIED"})
|
|
|
|
|
_, err = b.CreateInternalTransfer(context.Background(), &TransferParams{
|
|
|
|
|
TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456, FromAccountType: "UNIFIED",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errMissingAccountType) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMissingAccountType, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CreateInternalTransfer(context.Background(), &TransferParams{TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456,
|
|
|
|
|
_, err = b.CreateInternalTransfer(context.Background(), &TransferParams{
|
|
|
|
|
TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456,
|
|
|
|
|
ToAccountType: "CONTRACT",
|
|
|
|
|
FromAccountType: "UNIFIED"})
|
|
|
|
|
FromAccountType: "UNIFIED",
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
@@ -2172,20 +2202,26 @@ func TestCreateUniversalTransfer(t *testing.T) {
|
|
|
|
|
if !errors.Is(err, errMissingAccountType) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMissingAccountType, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CreateUniversalTransfer(context.Background(), &TransferParams{TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456})
|
|
|
|
|
_, err = b.CreateUniversalTransfer(context.Background(), &TransferParams{
|
|
|
|
|
TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456,
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errMissingAccountType) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMissingAccountType, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CreateUniversalTransfer(context.Background(), &TransferParams{TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456, FromAccountType: "UNIFIED"})
|
|
|
|
|
_, err = b.CreateUniversalTransfer(context.Background(), &TransferParams{
|
|
|
|
|
TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456, FromAccountType: "UNIFIED",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errMissingAccountType) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMissingAccountType, err)
|
|
|
|
|
}
|
|
|
|
|
_, err = b.CreateUniversalTransfer(context.Background(), &TransferParams{TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456,
|
|
|
|
|
_, err = b.CreateUniversalTransfer(context.Background(), &TransferParams{
|
|
|
|
|
TransferID: transferID,
|
|
|
|
|
Coin: currency.BTC, Amount: 123.456,
|
|
|
|
|
ToAccountType: "CONTRACT",
|
|
|
|
|
FromAccountType: "UNIFIED"})
|
|
|
|
|
FromAccountType: "UNIFIED",
|
|
|
|
|
})
|
|
|
|
|
if !errors.Is(err, errMemberIDRequired) {
|
|
|
|
|
t.Fatalf("expected %v, got %v", errMemberIDRequired, err)
|
|
|
|
|
}
|
|
|
|
|
@@ -2753,6 +2789,7 @@ func TestBorrow(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRepay(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if mockTests {
|
|
|
|
|
@@ -3094,13 +3131,15 @@ func TestCancelBatchOrders(t *testing.T) {
|
|
|
|
|
t.Skip(skipAuthenticatedFunctionsForMockTesting)
|
|
|
|
|
}
|
|
|
|
|
sharedtestvalues.SkipTestIfCredentialsUnset(t, b, canManipulateRealOrders)
|
|
|
|
|
var orderCancellationParams = []order.Cancel{{
|
|
|
|
|
orderCancellationParams := []order.Cancel{{
|
|
|
|
|
OrderID: "1",
|
|
|
|
|
Pair: spotTradablePair,
|
|
|
|
|
AssetType: asset.Spot}, {
|
|
|
|
|
AssetType: asset.Spot,
|
|
|
|
|
}, {
|
|
|
|
|
OrderID: "1",
|
|
|
|
|
Pair: usdtMarginedTradablePair,
|
|
|
|
|
AssetType: asset.USDTMarginedFutures}}
|
|
|
|
|
AssetType: asset.USDTMarginedFutures,
|
|
|
|
|
}}
|
|
|
|
|
_, err := b.CancelBatchOrders(context.Background(), orderCancellationParams)
|
|
|
|
|
if !errors.Is(err, asset.ErrNotSupported) {
|
|
|
|
|
t.Errorf("expected %v, got %v", asset.ErrNotSupported, err)
|
|
|
|
|
@@ -3109,10 +3148,12 @@ func TestCancelBatchOrders(t *testing.T) {
|
|
|
|
|
OrderID: "1",
|
|
|
|
|
AccountID: "1",
|
|
|
|
|
Pair: optionsTradablePair,
|
|
|
|
|
AssetType: asset.Options}, {
|
|
|
|
|
AssetType: asset.Options,
|
|
|
|
|
}, {
|
|
|
|
|
OrderID: "2",
|
|
|
|
|
Pair: optionsTradablePair,
|
|
|
|
|
AssetType: asset.Options}}
|
|
|
|
|
AssetType: asset.Options,
|
|
|
|
|
}}
|
|
|
|
|
_, err = b.CancelBatchOrders(context.Background(), orderCancellationParams)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
@@ -3129,6 +3170,7 @@ func TestWsConnect(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestWsLinearConnect(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if mockTests {
|
|
|
|
|
@@ -3139,6 +3181,7 @@ func TestWsLinearConnect(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestWsInverseConnect(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if mockTests {
|
|
|
|
|
@@ -3149,6 +3192,7 @@ func TestWsInverseConnect(t *testing.T) {
|
|
|
|
|
t.Error(err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestWsOptionsConnect(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
if mockTests {
|
|
|
|
|
@@ -3341,7 +3385,7 @@ func TestWsTicker(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
func TestGetFeeByTypeOfflineTradeFee(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
var feeBuilder = &exchange.FeeBuilder{
|
|
|
|
|
feeBuilder := &exchange.FeeBuilder{
|
|
|
|
|
Amount: 1,
|
|
|
|
|
FeeType: exchange.CryptocurrencyTradeFee,
|
|
|
|
|
Pair: spotTradablePair,
|
|
|
|
|
|