Skip to content

Commit

Permalink
binance: add TestClient_GetDepth test
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Feb 6, 2024
1 parent 06586a2 commit 62dcbb3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions pkg/exchange/binance/binanceapi/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,19 @@ func TestClient_GetMarginBorrowRepayHistoryRequest(t *testing.T) {
assert.NotEmpty(t, res)
t.Logf("result: %+v", res)
}

func TestClient_GetDepth(t *testing.T) {
client := getTestClientOrSkip(t)
ctx := context.Background()

err := client.SetTimeOffsetFromServer(ctx)
assert.NoError(t, err)

req := client.NewGetDepthRequest().Symbol("BTCUSDT").Limit(1000)
resp, err := req.Do(ctx)
if assert.NoError(t, err) {
assert.NotNil(t, resp)
assert.NotEmpty(t, resp)
t.Logf("response: %+v", resp)
}
}
2 changes: 1 addition & 1 deletion pkg/exchange/binance/binanceapi/get_depth_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Depth struct {

//go:generate requestgen -method GET -url "/api/v3/depth" -type GetDepthRequest -responseType .Depth
type GetDepthRequest struct {
client requestgen.AuthenticatedAPIClient
client requestgen.APIClient

symbol string `param:"symbol"`
limit int `param:"limit" defaultValue:"1000"`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 62dcbb3

Please sign in to comment.