Bithumb replace deprecated API to new one

This commit is contained in:
Adrian Gallagher
2018-07-12 12:50:46 +10:00
parent 4f8e74f6dc
commit b062fd2907
3 changed files with 13 additions and 12 deletions

View File

@@ -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 {

View File

@@ -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)
}
}

View File

@@ -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"`