mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
maxapi: move some methods to the rest client level
This commit is contained in:
parent
4766f6c203
commit
51c1d47fbc
|
@ -551,7 +551,7 @@ func (e *Exchange) QueryAccount(ctx context.Context) (*types.Account, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
vipLevel, err := e.client.AccountService.NewGetVipLevelRequest().Do(ctx)
|
||||
vipLevel, err := e.client.NewGetVipLevelRequest().Do(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ type GetVipLevelRequest struct {
|
|||
client requestgen.AuthenticatedAPIClient
|
||||
}
|
||||
|
||||
func (s *AccountService) NewGetVipLevelRequest() *GetVipLevelRequest {
|
||||
return &GetVipLevelRequest{client: s.client}
|
||||
func (c *RestClient) NewGetVipLevelRequest() *GetVipLevelRequest {
|
||||
return &GetVipLevelRequest{client: c}
|
||||
}
|
||||
|
||||
//go:generate GetRequest -url "v2/members/accounts/:currency" -type GetAccountRequest -responseType .Account
|
||||
|
@ -90,8 +90,8 @@ type GetAccountRequest struct {
|
|||
currency string `param:"currency,slug"`
|
||||
}
|
||||
|
||||
func (s *AccountService) NewGetAccountRequest() *GetAccountRequest {
|
||||
return &GetAccountRequest{client: s.client}
|
||||
func (c *RestClient) NewGetAccountRequest() *GetAccountRequest {
|
||||
return &GetAccountRequest{client: c}
|
||||
}
|
||||
|
||||
//go:generate GetRequest -url "v2/members/accounts" -type GetAccountsRequest -responseType []Account
|
||||
|
|
|
@ -38,14 +38,14 @@ func TestAccountService_GetAccountRequest(t *testing.T) {
|
|||
client := NewRestClient(ProductionAPIURL)
|
||||
client.Auth(key, secret)
|
||||
|
||||
req := client.AccountService.NewGetAccountRequest()
|
||||
req := client.NewGetAccountRequest()
|
||||
req.Currency("twd")
|
||||
account, err := req.Do(ctx)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, account)
|
||||
t.Logf("account: %+v", account)
|
||||
|
||||
req2 := client.AccountService.NewGetAccountRequest()
|
||||
req2 := client.NewGetAccountRequest()
|
||||
req2.Currency("usdt")
|
||||
account, err = req.Do(ctx)
|
||||
assert.NoError(t, err)
|
||||
|
@ -64,7 +64,7 @@ func TestAccountService_GetVipLevelRequest(t *testing.T) {
|
|||
client := NewRestClient(ProductionAPIURL)
|
||||
client.Auth(key, secret)
|
||||
|
||||
req := client.AccountService.NewGetVipLevelRequest()
|
||||
req := client.NewGetVipLevelRequest()
|
||||
vipLevel, err := req.Do(ctx)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, vipLevel)
|
||||
|
|
Loading…
Reference in New Issue
Block a user