Merge pull request #464 from c9s/c9s/refactor-ftx

fix: fix required flag marking issue
This commit is contained in:
Yo-An Lin 2022-03-03 15:48:51 +08:00 committed by GitHub
commit 9c36e59f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 19 deletions

View File

@ -5,18 +5,18 @@ import (
"fmt"
"os"
"github.com/c9s/bbgo/pkg/types"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/c9s/bbgo/pkg/types"
"github.com/c9s/bbgo/pkg/bbgo"
)
func init() {
accountCmd.Flags().String("session", "", "the exchange session name for querying information")
accountCmd.Flags().Bool("total", false, "report total asset")
accountCmd.MarkFlagRequired("config")
RootCmd.AddCommand(accountCmd)
}

View File

@ -12,11 +12,6 @@ import (
func init() {
balancesCmd.Flags().String("session", "", "the exchange session name for querying balances")
if err := balancesCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
RootCmd.AddCommand(balancesCmd)
}

View File

@ -371,25 +371,16 @@ var submitOrderCmd = &cobra.Command{
func init() {
listOrdersCmd.Flags().String("session", "", "the exchange session name for sync")
listOrdersCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
if err := listOrdersCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
getOrderCmd.Flags().String("session", "", "the exchange session name for sync")
getOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
getOrderCmd.Flags().String("order-id", "", "order id")
if err := getOrderCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
submitOrderCmd.Flags().String("session", "", "the exchange session name for sync")
submitOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
submitOrderCmd.Flags().String("side", "", "the trading side: buy or sell")
submitOrderCmd.Flags().String("price", "", "the trading price")
submitOrderCmd.Flags().String("quantity", "", "the trading quantity")
if err := submitOrderCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
executeOrderCmd.Flags().String("session", "", "the exchange session name for sync")
executeOrderCmd.Flags().String("symbol", "", "the trading pair, like btcusdt")
@ -400,9 +391,6 @@ func init() {
executeOrderCmd.Flags().Duration("update-interval", time.Second*10, "order update time")
executeOrderCmd.Flags().Duration("deadline", 0, "deadline of the order execution")
executeOrderCmd.Flags().Int("price-ticks", 0, "the number of price tick for the jump spread, default to 0")
if err := executeOrderCmd.MarkFlagRequired("config") ; err != nil {
log.WithError(err).Errorf("can not mark --config option required")
}
RootCmd.AddCommand(listOrdersCmd)
RootCmd.AddCommand(getOrderCmd)