-
-
Notifications
You must be signed in to change notification settings - Fork 283
/
fills.go
45 lines (34 loc) · 842 Bytes
/
fills.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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
},
}