mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 07:26:48 +00:00
CoinbasePro: Fix funds parameter for market orders (#1079)
* Fix funds parameter in coinbasepro wrapper for market orders * Update tests * Reorganize tests
This commit is contained in:
@@ -495,6 +495,7 @@ func TestSubmitOrder(t *testing.T) {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
// limit order
|
||||
var orderSubmission = &order.Submit{
|
||||
Exchange: c.Name,
|
||||
Pair: currency.Pair{
|
||||
@@ -505,7 +506,7 @@ func TestSubmitOrder(t *testing.T) {
|
||||
Side: order.Buy,
|
||||
Type: order.Limit,
|
||||
Price: 1,
|
||||
Amount: 1,
|
||||
Amount: 0.001,
|
||||
ClientID: "meowOrder",
|
||||
AssetType: asset.Spot,
|
||||
}
|
||||
@@ -515,6 +516,48 @@ func TestSubmitOrder(t *testing.T) {
|
||||
} else if !areTestAPIKeysSet() && err == nil {
|
||||
t.Error("Expecting an error when no keys are set")
|
||||
}
|
||||
|
||||
// market order from amount
|
||||
orderSubmission = &order.Submit{
|
||||
Exchange: c.Name,
|
||||
Pair: currency.Pair{
|
||||
Delimiter: "-",
|
||||
Base: currency.BTC,
|
||||
Quote: currency.USD,
|
||||
},
|
||||
Side: order.Buy,
|
||||
Type: order.Market,
|
||||
Amount: 0.001,
|
||||
ClientID: "meowOrder",
|
||||
AssetType: asset.Spot,
|
||||
}
|
||||
response, err = c.SubmitOrder(context.Background(), orderSubmission)
|
||||
if areTestAPIKeysSet() && (err != nil || response.Status != order.New) {
|
||||
t.Errorf("Order failed to be placed: %v", err)
|
||||
} else if !areTestAPIKeysSet() && err == nil {
|
||||
t.Error("Expecting an error when no keys are set")
|
||||
}
|
||||
|
||||
// market order from quote amount
|
||||
orderSubmission = &order.Submit{
|
||||
Exchange: c.Name,
|
||||
Pair: currency.Pair{
|
||||
Delimiter: "-",
|
||||
Base: currency.BTC,
|
||||
Quote: currency.USD,
|
||||
},
|
||||
Side: order.Buy,
|
||||
Type: order.Market,
|
||||
QuoteAmount: 1,
|
||||
ClientID: "meowOrder",
|
||||
AssetType: asset.Spot,
|
||||
}
|
||||
response, err = c.SubmitOrder(context.Background(), orderSubmission)
|
||||
if areTestAPIKeysSet() && (err != nil || response.Status != order.New) {
|
||||
t.Errorf("Order failed to be placed: %v", err)
|
||||
} else if !areTestAPIKeysSet() && err == nil {
|
||||
t.Error("Expecting an error when no keys are set")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCancelExchangeOrder(t *testing.T) {
|
||||
|
||||
@@ -549,7 +549,7 @@ func (c *CoinbasePro) SubmitOrder(ctx context.Context, s *order.Submit) (*order.
|
||||
orderID, err = c.PlaceMarketOrder(ctx,
|
||||
"",
|
||||
s.Amount,
|
||||
s.Amount,
|
||||
s.QuoteAmount,
|
||||
s.Side.Lower(),
|
||||
fpair.String(),
|
||||
"")
|
||||
|
||||
Reference in New Issue
Block a user