This commit is contained in:
edwin 2024-09-29 22:43:08 +08:00
parent 60331c1c67
commit 5f984c55df

View File

@ -7,6 +7,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi" "github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi"
"github.com/sirupsen/logrus"
"net/url" "net/url"
"reflect" "reflect"
"regexp" "regexp"
@ -233,6 +234,15 @@ func (g *GetTradesRequest) Do(ctx context.Context) (*TradesResponse, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if limitStatus := response.Header.Get("X-Bapi-Limit-Status"); len(limitStatus) != 0 {
logrus.Infof("[bybit] limit status: %d", limitStatus)
}
if limit := response.Header.Get("X-Bapi-Limit"); len(limit) != 0 {
logrus.Infof("[bybit] rate limit: %d", limit)
}
if ts := response.Header.Get("X-Bapi-Limit-Reset-Timestamp"); len(ts) != 0 {
logrus.Infof("[bybit] rate limit ts: %d", ts)
}
var apiResponse bybitapi.APIResponse var apiResponse bybitapi.APIResponse
if err := response.DecodeJSON(&apiResponse); err != nil { if err := response.DecodeJSON(&apiResponse); err != nil {