Skip to content

Commit

Permalink
Fix Bittrex API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Aug 23, 2017
1 parent a4c996b commit 9bdc316
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions exchanges/bittrex/bittrex.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
10 changes: 5 additions & 5 deletions exchanges/bittrex/bittrex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down

0 comments on commit 9bdc316

Please sign in to comment.