kucoin: fix kucoin rate limit

This commit is contained in:
c9s 2022-05-03 12:11:02 +08:00
parent d742aea633
commit b611a42bd9
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -17,7 +17,7 @@ import (
"github.com/c9s/bbgo/pkg/types" "github.com/c9s/bbgo/pkg/types"
) )
var marketDataLimiter = rate.NewLimiter(rate.Every(1*time.Second), 1) var marketDataLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
var queryTradeLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1) var queryTradeLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
var queryOrderLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1) var queryOrderLimiter = rate.NewLimiter(rate.Every(5*time.Second), 1)
@ -160,7 +160,9 @@ func (e *Exchange) IsSupportedInterval(interval types.Interval) bool {
} }
func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, options types.KLineQueryOptions) ([]types.KLine, error) { func (e *Exchange) QueryKLines(ctx context.Context, symbol string, interval types.Interval, options types.KLineQueryOptions) ([]types.KLine, error) {
_ = marketDataLimiter.Wait(ctx) if err := marketDataLimiter.Wait(ctx); err != nil {
return nil, err
}
req := e.client.MarketDataService.NewGetKLinesRequest() req := e.client.MarketDataService.NewGetKLinesRequest()
req.Symbol(toLocalSymbol(symbol)) req.Symbol(toLocalSymbol(symbol))