mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 15:10:03 +00:00
Made use of common JSON/Encoding function.
This commit is contained in:
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"strconv"
|
||||
@@ -273,7 +272,7 @@ func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[
|
||||
}
|
||||
}
|
||||
|
||||
PayloadJson, err := json.Marshal(request)
|
||||
PayloadJson, err := JSONEncode(request)
|
||||
|
||||
if err != nil {
|
||||
return errors.New("SendAuthenticatedHTTPRequest: Unable to JSON request")
|
||||
@@ -296,7 +295,7 @@ func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[
|
||||
log.Printf("Recieved raw: \n%s\n", resp)
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(resp), &result)
|
||||
err = JSONDecode([]byte(resp), &result)
|
||||
|
||||
if err != nil {
|
||||
return errors.New("Unable to JSON Unmarshal response.")
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"net/url"
|
||||
"log"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"strconv"
|
||||
"errors"
|
||||
@@ -313,7 +312,7 @@ func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, values url.Values,
|
||||
log.Printf("Recieved raw: %s\n", resp)
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(resp), &result)
|
||||
err = JSONDecode([]byte(resp), &result)
|
||||
|
||||
if err != nil {
|
||||
return errors.New("Unable to JSON Unmarshal response.")
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -711,7 +710,7 @@ func (b *BTCChina) SendAuthenticatedHTTPRequest(method string, params []interfac
|
||||
postData["method"] = method
|
||||
postData["params"] = params
|
||||
postData["id"] = 1
|
||||
data, err := json.Marshal(postData)
|
||||
data, err := JSONEncode(postData)
|
||||
|
||||
if err != nil {
|
||||
return errors.New("Unable to JSON Marshal POST data")
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"time"
|
||||
"errors"
|
||||
@@ -128,7 +127,7 @@ func QueryYahooCurrencyValues(currencies string) (error) {
|
||||
return err
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(resp), &CurrencyStore)
|
||||
err = JSONDecode([]byte(resp), &CurrencyStore)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
"encoding/json"
|
||||
"log"
|
||||
)
|
||||
|
||||
@@ -275,7 +274,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
|
||||
}
|
||||
}
|
||||
|
||||
PayloadJson, err := json.Marshal(request)
|
||||
PayloadJson, err := JSONEncode(request)
|
||||
|
||||
if err != nil {
|
||||
return errors.New("SendAuthenticatedHTTPRequest: Unable to JSON Marshal request")
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"log"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"time"
|
||||
"strings"
|
||||
@@ -545,7 +544,7 @@ func (k *Kraken) SendAuthenticatedHTTPRequest(method string, values url.Values)
|
||||
}
|
||||
|
||||
kresp := KrakenResponse{}
|
||||
err = json.Unmarshal([]byte(resp), &kresp)
|
||||
err = JSONDecode([]byte(resp), &kresp)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.New("Unable to JSON response.")
|
||||
|
||||
Reference in New Issue
Block a user