mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
bugfixes: Backtester credentials, Binance ExecutionLimits, Mock recording (#1539)
* fix mock recording, binance, backtester * minor credential streamlining
This commit is contained in:
@@ -1233,46 +1233,46 @@ func (b *Binance) FetchExchangeLimits(ctx context.Context, a asset.Item) ([]orde
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !slices.Contains(s.Permissions, aUpper) {
|
||||
continue
|
||||
}
|
||||
|
||||
l := order.MinMaxLevel{
|
||||
Pair: cp,
|
||||
Asset: a,
|
||||
}
|
||||
|
||||
for _, f := range s.Filters {
|
||||
// TODO: Unhandled filters:
|
||||
// maxPosition, trailingDelta, percentPriceBySide, maxNumAlgoOrders
|
||||
switch f.FilterType {
|
||||
case priceFilter:
|
||||
l.MinPrice = f.MinPrice
|
||||
l.MaxPrice = f.MaxPrice
|
||||
l.PriceStepIncrementSize = f.TickSize
|
||||
case percentPriceFilter:
|
||||
l.MultiplierUp = f.MultiplierUp
|
||||
l.MultiplierDown = f.MultiplierDown
|
||||
l.AveragePriceMinutes = f.AvgPriceMinutes
|
||||
case lotSizeFilter:
|
||||
l.MaximumBaseAmount = f.MaxQty
|
||||
l.MinimumBaseAmount = f.MinQty
|
||||
l.AmountStepIncrementSize = f.StepSize
|
||||
case notionalFilter:
|
||||
l.MinNotional = f.MinNotional
|
||||
case icebergPartsFilter:
|
||||
l.MaxIcebergParts = f.Limit
|
||||
case marketLotSizeFilter:
|
||||
l.MarketMinQty = f.MinQty
|
||||
l.MarketMaxQty = f.MaxQty
|
||||
l.MarketStepIncrementSize = f.StepSize
|
||||
case maxNumOrdersFilter:
|
||||
l.MaxTotalOrders = f.MaxNumOrders
|
||||
l.MaxAlgoOrders = f.MaxNumAlgoOrders
|
||||
for i := range s.PermissionSets {
|
||||
if !slices.Contains(s.PermissionSets[i], aUpper) {
|
||||
continue
|
||||
}
|
||||
l := order.MinMaxLevel{
|
||||
Pair: cp,
|
||||
Asset: a,
|
||||
}
|
||||
for _, f := range s.Filters {
|
||||
// TODO: Unhandled filters:
|
||||
// maxPosition, trailingDelta, percentPriceBySide, maxNumAlgoOrders
|
||||
switch f.FilterType {
|
||||
case priceFilter:
|
||||
l.MinPrice = f.MinPrice
|
||||
l.MaxPrice = f.MaxPrice
|
||||
l.PriceStepIncrementSize = f.TickSize
|
||||
case percentPriceFilter:
|
||||
l.MultiplierUp = f.MultiplierUp
|
||||
l.MultiplierDown = f.MultiplierDown
|
||||
l.AveragePriceMinutes = f.AvgPriceMinutes
|
||||
case lotSizeFilter:
|
||||
l.MaximumBaseAmount = f.MaxQty
|
||||
l.MinimumBaseAmount = f.MinQty
|
||||
l.AmountStepIncrementSize = f.StepSize
|
||||
case notionalFilter:
|
||||
l.MinNotional = f.MinNotional
|
||||
case icebergPartsFilter:
|
||||
l.MaxIcebergParts = f.Limit
|
||||
case marketLotSizeFilter:
|
||||
l.MarketMinQty = f.MinQty
|
||||
l.MarketMaxQty = f.MaxQty
|
||||
l.MarketStepIncrementSize = f.StepSize
|
||||
case maxNumOrdersFilter:
|
||||
l.MaxTotalOrders = f.MaxNumOrders
|
||||
l.MaxAlgoOrders = f.MaxNumAlgoOrders
|
||||
}
|
||||
}
|
||||
limits = append(limits, l)
|
||||
break
|
||||
}
|
||||
|
||||
limits = append(limits, l)
|
||||
}
|
||||
return limits, nil
|
||||
}
|
||||
|
||||
@@ -1085,8 +1085,8 @@ func TestGetExchangeInfo(t *testing.T) {
|
||||
info, err := b.GetExchangeInfo(context.Background())
|
||||
require.NoError(t, err, "GetExchangeInfo must not error")
|
||||
if mockTests {
|
||||
exp := time.Date(2022, 2, 25, 3, 50, 40, int(601*time.Millisecond), time.UTC)
|
||||
assert.True(t, info.ServerTime.Equal(exp), "ServerTime should be correct")
|
||||
exp := time.Date(2024, 5, 10, 6, 8, 1, int(707*time.Millisecond), time.UTC)
|
||||
assert.True(t, info.ServerTime.Equal(exp), "expected %v received %v", exp.UTC(), info.ServerTime.UTC())
|
||||
} else {
|
||||
assert.WithinRange(t, info.ServerTime, time.Now().Add(-24*time.Hour), time.Now().Add(24*time.Hour), "ServerTime should be within a day of now")
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ type ExchangeInfo struct {
|
||||
IsMarginTradingAllowed bool `json:"isMarginTradingAllowed"`
|
||||
Filters []*filterData `json:"filters"`
|
||||
Permissions []string `json:"permissions"`
|
||||
PermissionSets [][]string `json:"permissionSets"`
|
||||
} `json:"symbols"`
|
||||
}
|
||||
|
||||
|
||||
230277
exchanges/binance/testdata/http.json
vendored
230277
exchanges/binance/testdata/http.json
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user