Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit df41f7a

Browse files
committed
get ticker: added market as argument.
1 parent be98791 commit df41f7a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

internal/getticker/getticker.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,17 @@ const (
3838
)
3939

4040
var (
41+
market string
4142
interval time.Duration
4243
)
4344

4445
// ValidateArg nothing to be validated.
4546
func ValidateArg(c *cli.Context) error {
47+
if c.NArg() != 1 {
48+
return fmt.Errorf("no market defined")
49+
}
50+
market = c.Args().First()
51+
4652
interval = c.Duration(flagInterval)
4753

4854
if interval < 0 {
@@ -78,7 +84,7 @@ func Run(cctx *cli.Context) error {
7884
func innerLoop(btrc *bittrex.Bittrex) {
7985

8086
now := time.Now().UTC()
81-
ticker, err := btrc.GetTicker("USDT-BTC")
87+
ticker, err := btrc.GetTicker(market)
8288
if err != nil {
8389
fmt.Fprintf(os.Stderr, "ERROR %s %s", time.Now().UTC().String(), err.Error())
8490
return

main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ func main() {
5252
Action: getmarketsummary.Run,
5353
},
5454
{
55-
Name: "ticker",
56-
Usage: "get the current tick values for a market",
57-
Before: getticker.ValidateArg,
58-
Action: getticker.Run,
55+
Name: "ticker",
56+
Usage: "get the current tick values for a market",
57+
ArgsUsage: "<market>",
58+
Before: getticker.ValidateArg,
59+
Action: getticker.Run,
5960
Flags: []cli.Flag{
6061
cli.DurationFlag{
6162
Name: "interval, i",

0 commit comments

Comments
 (0)