From 130183a6c4f5b4451950fed27dacf2f00153b0dd Mon Sep 17 00:00:00 2001 From: eynzhang <2427928+eynzhang@users.noreply.github.com> Date: Mon, 13 Jul 2020 15:11:22 +0800 Subject: [PATCH] Fix latest trade return value type --- README.md | 2 +- cmd/marketclientexample/marketclientexample.go | 8 ++++---- pkg/client/orderclient.go | 2 +- pkg/response/market/getlatesttraderesponse.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5e74149..bf1dac3 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ For array struct, you can use for/range to iterate each element ```go // Check the status of response and print some properties for _, kline := range resp { - applogger.Info("High=%f, Low=%f", kline.High, kline.Low) + applogger.Info("High=%v, Low=%v", kline.High, kline.Low) } ``` diff --git a/cmd/marketclientexample/marketclientexample.go b/cmd/marketclientexample/marketclientexample.go index 9a98c41..7e936a0 100644 --- a/cmd/marketclientexample/marketclientexample.go +++ b/cmd/marketclientexample/marketclientexample.go @@ -27,7 +27,7 @@ func getCandlestick() { applogger.Error(err.Error()) } else { for _, kline := range resp { - applogger.Info("High=%f, Low=%f", kline.High, kline.Low) + applogger.Info("High=%v, Low=%v", kline.High, kline.Low) } } } @@ -87,7 +87,7 @@ func getLatestTrade() { applogger.Error(err.Error()) } else { for _, trade := range resp.Data { - applogger.Info("Id=%d, Price=%f", trade.Id, trade.Price) + applogger.Info("Id=%v, Price=%v", trade.Id, trade.Price) } } } @@ -102,7 +102,7 @@ func getHistoricalTrade() { } else { for _, tradeData := range resp { for _, trade := range tradeData.Data { - applogger.Info("price: %f", trade.Price) + applogger.Info("price: %v", trade.Price) } } } @@ -116,6 +116,6 @@ func getLast24hCandlestick() { if err != nil { applogger.Error(err.Error()) } else { - applogger.Info("Close=%f, Open=%f", resp.Close, resp.Open) + applogger.Info("Close=%v, Open=%v", resp.Close, resp.Open) } } diff --git a/pkg/client/orderclient.go b/pkg/client/orderclient.go index d18eb48..6f9381a 100644 --- a/pkg/client/orderclient.go +++ b/pkg/client/orderclient.go @@ -221,7 +221,7 @@ func (p *OrderClient) GetHistoryOrders(request *getrequest.GetRequest) (*order.G return &result, nil } -// Returns orders based on a specific searching criteria. +// Returns orders based on a specific searching criteria (within 48 hours) func (p *OrderClient) GetLast48hOrders(request *getrequest.GetRequest) (*order.GetHistoryOrdersResponse, error) { url := p.privateUrlBuilder.Build("GET", "/v1/order/history", request) getResp, getErr := internal.HttpGet(url) diff --git a/pkg/response/market/getlatesttraderesponse.go b/pkg/response/market/getlatesttraderesponse.go index d0c4d7c..f666210 100644 --- a/pkg/response/market/getlatesttraderesponse.go +++ b/pkg/response/market/getlatesttraderesponse.go @@ -15,7 +15,7 @@ type TradeTick struct { Amount decimal.Decimal `json:"amount"` TradeId int64 `json:"trade-id"` Ts int64 `json:"ts"` - Id int64 `json:"id"` + Id decimal.Decimal `json:"id"` Price decimal.Decimal `json:"price"` Direction string `json:"direction"` }