-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
66 lines (60 loc) · 1.31 KB
/
main.go
File metadata and controls
66 lines (60 loc) · 1.31 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"log"
"os"
cget "github.com/leflambeur/crypto-client/cryptoget"
"github.com/urfave/cli"
)
func main() {
app := &cli.App{
Name: "crypto-client",
Usage: "Interact with crypto.com API",
Commands: []cli.Command{
{
Name: "get-instruments",
Aliases: []string{"i"},
Usage: "Get instruments from crypto.com",
Action: func(c *cli.Context) error {
instruments, err := cget.GetInstruments()
if err != nil {
log.Println(err)
}
fmt.Println(instruments)
return err
},
},
{
Name: "get-book",
Flags: []cli.Flag{
cli.StringFlag{
Name: "instrument",
Value: "CRO_BTC",
Usage: "Which instrument you wish to get the Order Book for Default: CRO_BTC",
},
cli.StringFlag{
Name: "depth",
Value: "10",
Usage: "Depth of Order Book History",
},
},
Aliases: []string{"book"},
Usage: "Get book info for Instrument from crypto.com",
Action: func(c *cli.Context) error {
//instrumentName := "CRO_BTC"
//Depth := "10"
book, err := cget.GetBook(c.String("instrument"), c.String("depth"))
if err != nil {
log.Println(err)
}
fmt.Println(book)
return err
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}