From 9f6e5e637ec382fc9405b18a2e2f8259d84f4331 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Tue, 17 Jan 2017 14:25:21 +1100 Subject: [PATCH] Fix Poloniex response unmarshaling errors Fixes issues #18 and #19 --- poloniexhttp.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/poloniexhttp.go b/poloniexhttp.go index e84fb272..0bcceb6c 100644 --- a/poloniexhttp.go +++ b/poloniexhttp.go @@ -537,7 +537,7 @@ func (p *Poloniex) GetOpenOrders(currency string) (interface{}, error) { type PoloniexAuthentictedTradeHistory struct { GlobalTradeID int64 `json:"globalTradeID"` TradeID int64 `json:"tradeID,string"` - Date string `json:"data,string"` + Date string `json:"date"` Rate float64 `json:"rate,string"` Amount float64 `json:"amount,string"` Total float64 `json:"total,string"` @@ -548,11 +548,11 @@ type PoloniexAuthentictedTradeHistory struct { } type PoloniexAuthenticatedTradeHistoryAll struct { - Data map[string][]PoloniexOrder + Data map[string][]PoloniexAuthentictedTradeHistory } type PoloniexAuthenticatedTradeHistoryResponse struct { - Data []PoloniexOrder + Data []PoloniexAuthentictedTradeHistory } func (p *Poloniex) GetAuthenticatedTradeHistory(currency, start, end string) (interface{}, error) { @@ -566,7 +566,7 @@ func (p *Poloniex) GetAuthenticatedTradeHistory(currency, start, end string) (in values.Set("end", end) } - if currency != "" { + if currency != "" && currency != "all" { values.Set("currencyPair", currency) result := PoloniexAuthenticatedTradeHistoryResponse{} err := p.SendAuthenticatedHTTPRequest("POST", POLONIEX_TRADE_HISTORY, values, &result.Data) @@ -595,7 +595,7 @@ type PoloniexResultingTrades struct { Rate float64 `json:"rate,string"` Total float64 `json:"total,string"` TradeID int64 `json:"tradeID,string"` - Type string `json:"type,string"` + Type string `json:"type"` } type PoloniexOrderResponse struct {