diff --git a/exchanges/coinut/coinut.go b/exchanges/coinut/coinut.go index fe52ca93..a9a75aed 100644 --- a/exchanges/coinut/coinut.go +++ b/exchanges/coinut/coinut.go @@ -2,6 +2,7 @@ package coinut import ( "bytes" + "encoding/json" "errors" "fmt" "time" @@ -38,6 +39,8 @@ const ( coinutAuthRate = 0 coinutUnauthRate = 0 + + coinutStatusOK = "OK" ) // COINUT is the overarching type across the coinut package @@ -367,7 +370,24 @@ func (c *COINUT) SendHTTPRequest(apiRequest string, params map[string]interface{ } headers["Content-Type"] = "application/json" - return c.SendPayload("POST", c.APIUrl, headers, bytes.NewBuffer(payload), result, authenticated, c.Verbose) + var rawMsg json.RawMessage + err = c.SendPayload("POST", c.APIUrl, headers, bytes.NewBuffer(payload), &rawMsg, authenticated, c.Verbose) + if err != nil { + return err + } + + var genResp GenericResponse + err = common.JSONDecode(rawMsg, &genResp) + if err != nil { + return err + } + + if genResp.Status[0] != coinutStatusOK { + return fmt.Errorf("%s SendHTTPRequest error: %s", c.Name, + genResp.Status[0]) + } + + return common.JSONDecode(rawMsg, result) } // GetFee returns an estimate of fee based on type of transaction diff --git a/exchanges/itbit/itbit_types.go b/exchanges/itbit/itbit_types.go index 8739d2f0..c3d06b07 100644 --- a/exchanges/itbit/itbit_types.go +++ b/exchanges/itbit/itbit_types.go @@ -39,7 +39,7 @@ type OrderbookResponse struct { type Trades struct { RecentTrades []struct { Timestamp string `json:"timestamp"` - MatchNumber int64 `json:"matchNumber"` + MatchNumber string `json:"matchNumber"` Price float64 `json:"price,string"` Amount float64 `json:"amount,string"` } `json:"recentTrades"`