mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 23:16:53 +00:00
GateIO: Enhance order execution limits and currency pair details (#2018)
* refactor(gateio): enhance order execution limits and currency pair details * Update exchanges/gateio/gateio_wrapper.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * REEEEEHHHHHH * linter: fix * fix GetOpenInterest when a contract is delisted * add handling for delisting end time correctly * Update exchange/order/limits/limits_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchange/order/limits/limits_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/gateio/gateio_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/gateio/gateio_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * gk: nits * gci: fix * linter: fix * gateio: Add launch and update tests (cherry-pick) * gk: nits + removed spot setting delisting as delisted because it is not a start time value * glorious: apply diff --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
This commit is contained in:
@@ -2489,11 +2489,33 @@ func TestUpdateOrderExecutionLimits(t *testing.T) {
|
||||
require.ErrorIs(t, e.UpdateOrderExecutionLimits(t.Context(), a), asset.ErrNotSupported)
|
||||
default:
|
||||
require.NoError(t, e.UpdateOrderExecutionLimits(t.Context(), a), "UpdateOrderExecutionLimits must not error")
|
||||
pairs, err := e.CurrencyPairs.GetPairs(a, true)
|
||||
require.NoError(t, err, "GetPairs must not error")
|
||||
l, err := e.GetOrderExecutionLimits(a, pairs[0])
|
||||
require.NoError(t, err, "GetOrderExecutionLimits must not error")
|
||||
assert.Positive(t, l.MinimumBaseAmount, "MinimumBaseAmount should be positive")
|
||||
avail, err := e.GetAvailablePairs(a)
|
||||
require.NoError(t, err, "GetAvailablePairs must not error")
|
||||
for _, pair := range avail {
|
||||
l, err := e.GetOrderExecutionLimits(a, pair)
|
||||
require.NoErrorf(t, err, "GetOrderExecutionLimits must not error for %s", pair)
|
||||
require.NotNilf(t, l, "GetOrderExecutionLimits %s result cannot be nil", pair)
|
||||
assert.Equalf(t, a, l.Key.Asset, "asset should equal for %s", pair)
|
||||
assert.Truef(t, pair.Equal(l.Key.Pair()), "pair should equal for %s", pair)
|
||||
assert.Positivef(t, l.MinimumBaseAmount, "MinimumBaseAmount should be positive for %s", pair)
|
||||
assert.Positivef(t, l.AmountStepIncrementSize, "AmountStepIncrementSize should be positive for %s", pair)
|
||||
|
||||
switch a {
|
||||
case asset.USDTMarginedFutures:
|
||||
assert.Positivef(t, l.MultiplierDecimal, "MultiplierDecimal should be positive for %s", pair)
|
||||
assert.NotZerof(t, l.Listed, "Listed should be populated for %s", pair)
|
||||
fallthrough
|
||||
case asset.CoinMarginedFutures:
|
||||
if !l.Delisted.IsZero() {
|
||||
assert.Truef(t, l.Delisted.After(l.Delisting), "Delisted should be after Delisting for %s", pair)
|
||||
}
|
||||
case asset.Spot:
|
||||
assert.Positivef(t, l.MinimumQuoteAmount, "MinimumQuoteAmount should be positive for %s", pair)
|
||||
assert.Positivef(t, l.QuoteStepIncrementSize, "QuoteStepIncrementSize should be positive for %s", pair)
|
||||
case asset.DeliveryFutures:
|
||||
assert.NotZerof(t, l.Expiry, "Expiry should be populated for %s", pair)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user