max: fix max v3 order cancel

This commit is contained in:
c9s 2022-06-10 02:50:39 +08:00
parent aeae2d58c9
commit 470e003867
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
5 changed files with 68 additions and 44 deletions

View File

@ -0,0 +1,19 @@
package v3
//go:generate -command GetRequest requestgen -method GET
//go:generate -command PostRequest requestgen -method POST
//go:generate -command DeleteRequest requestgen -method DELETE
import "github.com/c9s/requestgen"
func (s *OrderService) NewCancelOrderRequest() *CancelOrderRequest {
return &CancelOrderRequest{client: s.Client}
}
//go:generate DeleteRequest -url "/api/v3/order" -type CancelOrderRequest -responseType .Order
type CancelOrderRequest struct {
client requestgen.AuthenticatedAPIClient
id *uint64 `param:"id,omitempty"`
clientOrderID *string `param:"client_oid,omitempty"`
}

View File

@ -1,4 +1,4 @@
// Code generated by "requestgen -method POST -url /api/v3/order -type CancelOrderRequest -responseType .Order"; DO NOT EDIT.
// Code generated by "requestgen -method DELETE -url /api/v3/order -type CancelOrderRequest -responseType .Order"; DO NOT EDIT.
package v3
@ -146,7 +146,7 @@ func (c *CancelOrderRequest) Do(ctx context.Context) (*max.Order, error) {
apiURL := "/api/v3/order"
req, err := c.client.NewAuthenticatedRequest(ctx, "POST", apiURL, query, params)
req, err := c.client.NewAuthenticatedRequest(ctx, "DELETE", apiURL, query, params)
if err != nil {
return nil, err
}

View File

@ -0,0 +1,19 @@
package v3
//go:generate -command GetRequest requestgen -method GET
//go:generate -command PostRequest requestgen -method POST
//go:generate -command DeleteRequest requestgen -method DELETE
import "github.com/c9s/requestgen"
func (s *OrderService) NewGetOrderRequest() *GetOrderRequest {
return &GetOrderRequest{client: s.Client}
}
//go:generate GetRequest -url "/api/v3/order" -type GetOrderRequest -responseType .Order
type GetOrderRequest struct {
client requestgen.AuthenticatedAPIClient
id *uint64 `param:"id,omitempty"`
clientOrderID *string `param:"client_oid,omitempty"`
}

View File

@ -0,0 +1,28 @@
package v3
//go:generate -command GetRequest requestgen -method GET
//go:generate -command PostRequest requestgen -method POST
//go:generate -command DeleteRequest requestgen -method DELETE
import (
"time"
"github.com/c9s/requestgen"
)
func (s *OrderService) NewGetWalletTradesRequest(walletType WalletType) *GetWalletTradesRequest {
return &GetWalletTradesRequest{client: s.Client, walletType: walletType}
}
//go:generate GetRequest -url "/api/v3/wallet/:walletType/trades" -type GetWalletTradesRequest -responseType []Trade
type GetWalletTradesRequest struct {
client requestgen.AuthenticatedAPIClient
walletType WalletType `param:"walletType,slug,required"`
market string `param:"market,required"`
from *uint64 `param:"from_id"`
startTime *time.Time `param:"start_time,milliseconds"`
endTime *time.Time `param:"end_time,milliseconds"`
limit *uint64 `param:"limit"`
}

View File

@ -5,8 +5,6 @@ package v3
//go:generate -command DeleteRequest requestgen -method DELETE
import (
"time"
"github.com/c9s/requestgen"
maxapi "github.com/c9s/bbgo/pkg/exchange/max/maxapi"
@ -43,18 +41,6 @@ func (s *OrderService) NewCancelWalletOrderAllRequest(walletType WalletType) *Ca
return &CancelWalletOrderAllRequest{client: s.Client, walletType: walletType}
}
func (s *OrderService) NewGetWalletTradesRequest(walletType WalletType) *GetWalletTradesRequest {
return &GetWalletTradesRequest{client: s.Client, walletType: walletType}
}
func (s *OrderService) NewCancelOrderRequest() *CancelOrderRequest {
return &CancelOrderRequest{client: s.Client}
}
func (s *OrderService) NewGetOrderRequest() *GetOrderRequest {
return &GetOrderRequest{client: s.Client}
}
//go:generate GetRequest -url "/api/v3/wallet/:walletType/accounts" -type GetWalletAccountsRequest -responseType []Account
type GetWalletAccountsRequest struct {
client requestgen.AuthenticatedAPIClient
@ -107,31 +93,3 @@ type CancelWalletOrderAllRequest struct {
groupID *uint32 `param:"groupID"`
}
//go:generate GetRequest -url "/api/v3/wallet/:walletType/trades" -type GetWalletTradesRequest -responseType []Trade
type GetWalletTradesRequest struct {
client requestgen.AuthenticatedAPIClient
walletType WalletType `param:"walletType,slug,required"`
market string `param:"market,required"`
from *uint64 `param:"from_id"`
startTime *time.Time `param:"start_time,milliseconds"`
endTime *time.Time `param:"end_time,milliseconds"`
limit *uint64 `param:"limit"`
}
//go:generate PostRequest -url "/api/v3/order" -type CancelOrderRequest -responseType .Order
type CancelOrderRequest struct {
client requestgen.AuthenticatedAPIClient
id *uint64 `param:"id,omitempty"`
clientOrderID *string `param:"client_oid,omitempty"`
}
//go:generate GetRequest -url "/api/v3/order" -type GetOrderRequest -responseType .Order
type GetOrderRequest struct {
client requestgen.AuthenticatedAPIClient
id *uint64 `param:"id,omitempty"`
clientOrderID *string `param:"client_oid,omitempty"`
}