mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
add fills command
This commit is contained in:
parent
62fa6dd274
commit
374721a59a
45
examples/kucoin/fills.go
Normal file
45
examples/kucoin/fills.go
Normal file
|
@ -0,0 +1,45 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
fillsCmd.Flags().String("symbol", "", "symbol, BTC-USDT, LTC-USDT...etc")
|
||||
rootCmd.AddCommand(fillsCmd)
|
||||
}
|
||||
|
||||
// go run ./examples/kucoin fills
|
||||
var fillsCmd = &cobra.Command{
|
||||
Use: "fills",
|
||||
|
||||
// SilenceUsage is an option to silence usage when an error occurs.
|
||||
SilenceUsage: true,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
||||
symbol, err := cmd.Flags().GetString("symbol")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(symbol) == 0 {
|
||||
return errors.New("--symbol option is required")
|
||||
}
|
||||
|
||||
req := client.TradeService.NewGetFillsRequest()
|
||||
req.Symbol(symbol)
|
||||
|
||||
page, err := req.Do(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Infof("page: %+v", page)
|
||||
return nil
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user