Skip to content

Commit

Permalink
add func: QueryUmFuturesAggTrades
Browse files Browse the repository at this point in the history
  • Loading branch information
dwdwow committed Oct 16, 2024
1 parent fda47dd commit df7faf6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bnc/config_pub.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,20 @@ var SpotAggTradesConfig = cex.ReqConfig[SpotAggTradesParams, []SpotAggTrades]{
HTTPStatusCodeChecker: HTTPStatusCodeChecker,
RespBodyUnmarshaler: spotBodyUnmshWrapper(cex.StdBodyUnmarshaler[[]SpotAggTrades]),
}

type UmFuturesAggTradesParams SpotAggTradesParams

type UmFuturesAggTrades SpotAggTrades

var UmFuturesAggTradesConfig = cex.ReqConfig[UmFuturesAggTradesParams, []UmFuturesAggTrades]{
ReqBaseConfig: cex.ReqBaseConfig{
BaseUrl: FapiBaseUrl,
Path: FapiV1 + "/aggTrades",
Method: http.MethodGet,
IsUserData: false,
UserTimeInterval: 0,
IpTimeInterval: 0,
},
HTTPStatusCodeChecker: HTTPStatusCodeChecker,
RespBodyUnmarshaler: fuBodyUnmshWrapper(cex.StdBodyUnmarshaler[[]UmFuturesAggTrades]),
}
8 changes: 8 additions & 0 deletions bnc/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,11 @@ func QuerySpotAggTrades(symbol string) ([]SpotAggTrades, error) {
}
return data, nil
}

func QueryUmFuturesAggTrades(params UmFuturesAggTradesParams) ([]UmFuturesAggTrades, error) {
_, data, reqErr := cex.Request(emptyUser, UmFuturesAggTradesConfig, params)
if reqErr.IsNotNil() {
return nil, reqErr.Err
}
return data, nil
}
4 changes: 4 additions & 0 deletions bnc/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,7 @@ func TestQuerySpotTrades(t *testing.T) {
func TestQuerySpotAggTrades(t *testing.T) {
publicTestChecker(QuerySpotAggTrades("ETHUSDT"))
}

func TestQueryUmFuturesAggTrades(t *testing.T) {
publicTestChecker(QueryUmFuturesAggTrades(UmFuturesAggTradesParams{Symbol: "ETHUSDT", Limit: 1000}))
}

0 comments on commit df7faf6

Please sign in to comment.