From 9bdc316ae8ff03bec2a9e7eacaba8797f6d61e76 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Wed, 23 Aug 2017 16:02:19 +1000 Subject: [PATCH] Fix Bittrex API requests Issue: https://github.com/thrasher-/gocryptotrader/issues/44 --- exchanges/bittrex/bittrex.go | 16 ++++++++-------- exchanges/bittrex/bittrex_test.go | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/exchanges/bittrex/bittrex.go b/exchanges/bittrex/bittrex.go index 56f81aff..cdcb857a 100644 --- a/exchanges/bittrex/bittrex.go +++ b/exchanges/bittrex/bittrex.go @@ -170,7 +170,7 @@ func (b *Bittrex) PlaceBuyLimit(currencyPair string, quantity, rate float64) ([] values.Set("market", currencyPair) values.Set("quantity", strconv.FormatFloat(quantity, 'E', -1, 64)) values.Set("rate", strconv.FormatFloat(rate, 'E', -1, 64)) - path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetBalances) + path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIBuyLimit) return id, b.HTTPRequest(path, true, values, &id) } @@ -187,7 +187,7 @@ func (b *Bittrex) PlaceSellLimit(currencyPair string, quantity, rate float64) ([ values.Set("market", currencyPair) values.Set("quantity", strconv.FormatFloat(quantity, 'E', -1, 64)) values.Set("rate", strconv.FormatFloat(rate, 'E', -1, 64)) - path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetBalances) + path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPISellLimit) return id, b.HTTPRequest(path, true, values, &id) } @@ -200,7 +200,7 @@ func (b *Bittrex) GetOpenOrders(currencyPair string) ([]Order, error) { if !(currencyPair == "" || currencyPair == " ") { values.Set("market", currencyPair) } - path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetBalances) + path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetOpenOrders) return orders, b.HTTPRequest(path, true, values, &orders) } @@ -210,7 +210,7 @@ func (b *Bittrex) CancelOrder(uuid string) ([]Balance, error) { var balances []Balance values := url.Values{} values.Set("uuid", uuid) - path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetBalances) + path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPICancel) return balances, b.HTTPRequest(path, true, values, &balances) } @@ -283,16 +283,16 @@ func (b *Bittrex) GetOrderHistory(currencyPair string) ([]Order, error) { return orders, b.HTTPRequest(path, true, values, &orders) } -// GetWithdrawelHistory is used to retrieve your withdrawal history. If currency +// GetWithdrawalHistory is used to retrieve your withdrawal history. If currency // omitted it will return the entire history -func (b *Bittrex) GetWithdrawelHistory(currency string) ([]WithdrawalHistory, error) { +func (b *Bittrex) GetWithdrawalHistory(currency string) ([]WithdrawalHistory, error) { var history []WithdrawalHistory values := url.Values{} if !(currency == "" || currency == " ") { values.Set("currency", currency) } - path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetOrderHistory) + path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetWithdrawalHistory) return history, b.HTTPRequest(path, true, values, &history) } @@ -306,7 +306,7 @@ func (b *Bittrex) GetDepositHistory(currency string) ([]WithdrawalHistory, error if !(currency == "" || currency == " ") { values.Set("currency", currency) } - path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetOrderHistory) + path := fmt.Sprintf("%s/%s", bittrexAPIURL, bittrexAPIGetDepositHistory) return history, b.HTTPRequest(path, true, values, &history) } diff --git a/exchanges/bittrex/bittrex_test.go b/exchanges/bittrex/bittrex_test.go index 4adedb33..adfb56ef 100644 --- a/exchanges/bittrex/bittrex_test.go +++ b/exchanges/bittrex/bittrex_test.go @@ -233,17 +233,17 @@ func TestGetOrderHistory(t *testing.T) { } } -func TestGetWithdrawelHistory(t *testing.T) { +func TestGetWithdrawalHistory(t *testing.T) { obj := Bittrex{} obj.APIKey = apiKey obj.APISecret = apiSecret - _, err := obj.GetWithdrawelHistory("") + _, err := obj.GetWithdrawalHistory("") if err == nil { - t.Error("Test Failed - Bittrex - GetWithdrawelHistory() error") + t.Error("Test Failed - Bittrex - GetWithdrawalHistory() error") } - _, err = obj.GetWithdrawelHistory("btc-ltc") + _, err = obj.GetWithdrawalHistory("btc-ltc") if err == nil { - t.Error("Test Failed - Bittrex - GetWithdrawelHistory() error") + t.Error("Test Failed - Bittrex - GetWithdrawalHistory() error") } }