mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Bithumb replace deprecated API to new one
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user