From b062fd290799a85a7b545dd4f12ac331cec96750 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Thu, 12 Jul 2018 12:50:46 +1000 Subject: [PATCH] Bithumb replace deprecated API to new one --- exchanges/bithumb/bithumb.go | 14 +++++++------- exchanges/bithumb/bithumb_test.go | 6 +++--- exchanges/bithumb/bithumb_types.go | 5 +++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/exchanges/bithumb/bithumb.go b/exchanges/bithumb/bithumb.go index 0d0a3f59..327adc8c 100644 --- a/exchanges/bithumb/bithumb.go +++ b/exchanges/bithumb/bithumb.go @@ -24,9 +24,9 @@ const ( // Public API requestsPerSecondPublicAPI = 20 - publicTicker = "/public/ticker/" - publicOrderBook = "/public/orderbook/" - publicRecentTransaction = "/public/recent_transactions/" + publicTicker = "/public/ticker/" + publicOrderBook = "/public/orderbook/" + publicTransactionHistory = "/public/transaction_history/" // Private API requestsPerSecondPrivateAPI = 10 @@ -198,12 +198,12 @@ func (b *Bithumb) GetOrderBook(symbol string) (Orderbook, error) { return response, nil } -// GetRecentTransactions returns recent transactions +// GetTransactionHistory returns recent transactions // // symbol e.g. "btc" -func (b *Bithumb) GetRecentTransactions(symbol string) (RecentTransactions, error) { - response := RecentTransactions{} - path := fmt.Sprintf("%s%s%s", apiURL, publicRecentTransaction, common.StringToUpper(symbol)) +func (b *Bithumb) GetTransactionHistory(symbol string) (TransactionHistory, error) { + response := TransactionHistory{} + path := fmt.Sprintf("%s%s%s", apiURL, publicTransactionHistory, common.StringToUpper(symbol)) err := b.SendHTTPRequest(path, &response) if err != nil { diff --git a/exchanges/bithumb/bithumb_test.go b/exchanges/bithumb/bithumb_test.go index 5cf6e17c..9e9e3bcb 100644 --- a/exchanges/bithumb/bithumb_test.go +++ b/exchanges/bithumb/bithumb_test.go @@ -65,11 +65,11 @@ func TestGetOrderBook(t *testing.T) { } } -func TestGetRecentTransactions(t *testing.T) { +func TestGetTransactionHistory(t *testing.T) { t.Parallel() - _, err := b.GetRecentTransactions("btc") + _, err := b.GetTransactionHistory("btc") if err != nil { - t.Error("test failed - Bithumb GetRecentTransactions() error", err) + t.Error("test failed - Bithumb GetTransactionHistory() error", err) } } diff --git a/exchanges/bithumb/bithumb_types.go b/exchanges/bithumb/bithumb_types.go index 8fa68432..653c120c 100644 --- a/exchanges/bithumb/bithumb_types.go +++ b/exchanges/bithumb/bithumb_types.go @@ -49,10 +49,11 @@ type Orderbook struct { Message string `json:"message"` } -// RecentTransactions holds history of completed transaction data -type RecentTransactions struct { +// TransactionHistory holds history of completed transaction data +type TransactionHistory struct { Status string `json:"status"` Data []struct { + ContNumber int64 `json:"cont_no,string"` TransactionDate string `json:"transaction_date"` Type string `json:"type"` UnitsTraded float64 `json:"units_traded,string"`