mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
bugfix: coinut and itbit API errors
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user