fix advancedOrderCancelApi interface

This commit is contained in:
c9s 2021-01-23 17:20:26 +08:00
parent 858a8d84bb
commit 1f1e1383f3
2 changed files with 6 additions and 6 deletions

View File

@ -16,13 +16,13 @@ import (
type advancedOrderCancelApi interface {
CancelAllOrders(ctx context.Context) ([]types.Order, error)
CancelOrdersBySymbol(ctx context.Context, symbol string) ([]types.Order, error)
CancelOrdersByGroupID(ctx context.Context, groupID string) ([]types.Order, error)
CancelOrdersByGroupID(ctx context.Context, groupID int64) ([]types.Order, error)
}
func init() {
CancelCmd.Flags().String("session", "", "session to execute cancel orders")
CancelCmd.Flags().String("symbol", "", "symbol to cancel orders")
CancelCmd.Flags().String("groupID", "", "groupID to cancel orders")
CancelCmd.Flags().Int64("group-id", 0, "groupID to cancel orders")
RootCmd.AddCommand(CancelCmd)
}
@ -43,7 +43,7 @@ var CancelCmd = &cobra.Command{
return err
}
groupID, err := cmd.Flags().GetString("groupID")
groupID, err := cmd.Flags().GetInt64("group-id")
if err != nil {
return err
}
@ -97,8 +97,8 @@ var CancelCmd = &cobra.Command{
var log = logrus.WithField("session", sessionID)
e, ok := session.Exchange.(advancedOrderCancelApi)
if ok && len(groupID) > 0 {
log.Infof("canceling orders by group id: %s", groupID)
if ok && groupID > 0 {
log.Infof("canceling orders by group id: %d", groupID)
orders, err := e.CancelOrdersByGroupID(ctx, groupID)
if err != nil {

View File

@ -169,7 +169,7 @@ func (e *Exchange) CancelOrdersBySymbol(ctx context.Context, symbol string) ([]t
return toGlobalOrders(maxOrders)
}
func (e *Exchange) CancelOrdersByGroupID(ctx context.Context, groupID string) ([]types.Order, error) {
func (e *Exchange) CancelOrdersByGroupID(ctx context.Context, groupID int64) ([]types.Order, error) {
var req = e.client.OrderService.NewOrderCancelAllRequest()
req.GroupID(groupID)