From cdfd118b28007e6a4d183e7ab4397fd1976497e9 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Tue, 14 Mar 2017 16:28:24 +1100 Subject: [PATCH] Add BTCEInfo return value --- btcehttp.go | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/btcehttp.go b/btcehttp.go index 65706159..636c5748 100644 --- a/btcehttp.go +++ b/btcehttp.go @@ -165,13 +165,30 @@ func (b *BTCE) Run() { } } -func (b *BTCE) GetInfo() { +type BTCEPair struct { + DecimalPlaces int `json:"decimal_places"` + MinPrice float64 `json:"min_price"` + MaxPrice float64 `json:"max_price"` + MinAmount float64 `json:"min_amount"` + Hidden int `json:"hidden"` + Fee float64 `json:"fee"` +} + +type BTCEInfo struct { + ServerTime int64 `json:"server_time"` + Pairs map[string]BTCEPair `json:"pairs"` +} + +func (b *BTCE) GetInfo() (BTCEInfo, error) { req := fmt.Sprintf("%s/%s/%s/", BTCE_API_PUBLIC_URL, BTCE_API_PUBLIC_VERSION, BTCE_INFO) - err := SendHTTPGetRequest(req, true, nil) + resp := BTCEInfo{} + err := SendHTTPGetRequest(req, true, &resp) if err != nil { - log.Println(err) + return resp, err } + + return resp, nil } func (b *BTCE) GetTicker(symbol string) (map[string]BTCeTicker, error) {