mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
binance: add TestClient_GetDepth test
This commit is contained in:
parent
0cf028d192
commit
d015670d63
|
@ -244,3 +244,19 @@ func TestClient_NewPlaceMarginOrderRequest(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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"`
|
||||
|
|
|
@ -148,7 +148,7 @@ func (g *GetDepthRequest) Do(ctx context.Context) (*Depth, error) {
|
|||
|
||||
apiURL = g.GetPath()
|
||||
|
||||
req, err := g.client.NewAuthenticatedRequest(ctx, "GET", apiURL, query, params)
|
||||
req, err := g.client.NewRequest(ctx, "GET", apiURL, query, params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user