From 7cada295b8843afed40a17e4cf58af7fc14c4dbc Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 10 Oct 2020 11:26:25 +0800 Subject: [PATCH] add max-orders example --- examples/max-orders/main.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/max-orders/main.go diff --git a/examples/max-orders/main.go b/examples/max-orders/main.go new file mode 100644 index 000000000..f2da6cd45 --- /dev/null +++ b/examples/max-orders/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "log" + "os" + + maxapi "github.com/c9s/bbgo/exchange/max/maxapi" +) + +func main() { + key := os.Getenv("MAX_API_KEY") + secret := os.Getenv("MAX_API_SECRET") + + maxRest := maxapi.NewRestClient(maxapi.ProductionAPIURL) + maxRest.Auth(key, secret) + + orders, err := maxRest.OrderService.All("maxusdt", 100, 1, maxapi.OrderStateDone) + if err != nil { + log.Fatal(err) + } + + for _, order := range orders { + log.Printf("%+v", order) + } +}