Huobi Hadax no longer supports BTC-USDT; update API endpoints and config available/enabled pairs

This commit is contained in:
Adrian Gallagher
2018-10-03 17:17:23 +10:00
parent 604443fbbb
commit 9dd0474c7c
4 changed files with 49 additions and 47 deletions

File diff suppressed because one or more lines are too long

View File

@@ -20,6 +20,7 @@ import (
const (
huobihadaxAPIURL = "https://api.hadax.com"
huobihadaxAPIVersion = "1"
huobihadaxAPIName = "hadax"
huobihadaxMarketHistoryKline = "market/history/kline"
huobihadaxMarketDetail = "market/detail"
@@ -282,7 +283,7 @@ func (h *HUOBIHADAX) GetSymbols() ([]Symbol, error) {
}
var result response
url := fmt.Sprintf("%s/v%s/%s", h.APIUrl, huobihadaxAPIVersion, huobihadaxSymbols)
url := fmt.Sprintf("%s/v%s/%s/%s", h.APIUrl, huobihadaxAPIVersion, huobihadaxAPIName, huobihadaxSymbols)
err := h.SendHTTPRequest(url, &result)
if result.ErrorMessage != "" {
@@ -299,7 +300,7 @@ func (h *HUOBIHADAX) GetCurrencies() ([]string, error) {
}
var result response
url := fmt.Sprintf("%s/v%s/%s", h.APIUrl, huobihadaxAPIVersion, huobihadaxCurrencies)
url := fmt.Sprintf("%s/v%s/%s/%s", h.APIUrl, huobihadaxAPIVersion, huobihadaxAPIName, huobihadaxCurrencies)
err := h.SendHTTPRequest(url, &result)
if result.ErrorMessage != "" {
@@ -349,7 +350,7 @@ func (h *HUOBIHADAX) GetAccountBalance(accountID string) ([]AccountBalanceDetail
}
var result response
endpoint := fmt.Sprintf(huobihadaxAccountBalance, accountID)
endpoint := fmt.Sprintf("%s/%s", huobihadaxAPIName, fmt.Sprintf(huobihadaxAccountBalance, accountID))
err := h.SendAuthenticatedHTTPRequest("GET", endpoint, url.Values{}, &result)
if result.ErrorMessage != "" {
@@ -390,7 +391,8 @@ func (h *HUOBIHADAX) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
}
var result response
err := h.SendAuthenticatedHTTPPostRequest("POST", huobihadaxOrderPlace, postBodyParams, &result)
endpoint := fmt.Sprintf("%s/%s", huobihadaxAPIName, huobihadaxOrderPlace)
err := h.SendAuthenticatedHTTPPostRequest("POST", endpoint, postBodyParams, &result)
if result.ErrorMessage != "" {
return 0, errors.New(result.ErrorMessage)

View File

@@ -75,7 +75,7 @@ func TestGetFee(t *testing.T) {
func TestGetSpotKline(t *testing.T) {
t.Parallel()
_, err := h.GetSpotKline(KlinesRequestParams{
Symbol: "btcusdt",
Symbol: "hptusdt",
Period: TimeIntervalHour,
Size: 0,
})
@@ -86,7 +86,7 @@ func TestGetSpotKline(t *testing.T) {
func TestGetMarketDetailMerged(t *testing.T) {
t.Parallel()
_, err := h.GetMarketDetailMerged("btcusdt")
_, err := h.GetMarketDetailMerged("hptusdt")
if err != nil {
t.Errorf("Test failed - Huobi TestGetMarketDetailMerged: %s", err)
}
@@ -94,7 +94,7 @@ func TestGetMarketDetailMerged(t *testing.T) {
func TestGetDepth(t *testing.T) {
t.Parallel()
_, err := h.GetDepth("btcusdt", "step1")
_, err := h.GetDepth("hptusdt", "step1")
if err != nil {
t.Errorf("Test failed - Huobi TestGetDepth: %s", err)
}
@@ -102,7 +102,7 @@ func TestGetDepth(t *testing.T) {
func TestGetTrades(t *testing.T) {
t.Parallel()
_, err := h.GetTrades("btcusdt")
_, err := h.GetTrades("hptusdt")
if err != nil {
t.Errorf("Test failed - Huobi TestGetTrades: %s", err)
}
@@ -110,7 +110,7 @@ func TestGetTrades(t *testing.T) {
func TestGetLatestSpotPrice(t *testing.T) {
t.Parallel()
_, err := h.GetLatestSpotPrice("btcusdt")
_, err := h.GetLatestSpotPrice("hptusdt")
if err != nil {
t.Errorf("Test failed - Huobi GetLatestSpotPrice: %s", err)
}
@@ -118,7 +118,7 @@ func TestGetLatestSpotPrice(t *testing.T) {
func TestGetTradeHistory(t *testing.T) {
t.Parallel()
_, err := h.GetTradeHistory("btcusdt", "50")
_, err := h.GetTradeHistory("hptusdt", "50")
if err != nil {
t.Errorf("Test failed - Huobi TestGetTradeHistory: %s", err)
}
@@ -126,7 +126,7 @@ func TestGetTradeHistory(t *testing.T) {
func TestGetMarketDetail(t *testing.T) {
t.Parallel()
_, err := h.GetMarketDetail("btcusdt")
_, err := h.GetMarketDetail("hptusdt")
if err != nil {
t.Errorf("Test failed - Huobi TestGetTradeHistory: %s", err)
}
@@ -196,7 +196,7 @@ func TestSpotNewOrder(t *testing.T) {
}
arg := SpotNewOrderRequestParams{
Symbol: "btcusdt",
Symbol: "hptusdt",
AccountID: 000000,
Amount: 0.01,
Price: 10.1,
@@ -244,7 +244,7 @@ func TestGetMarginLoanOrders(t *testing.T) {
t.Skip()
}
_, err := h.GetMarginLoanOrders("btcusdt", "", "", "", "", "", "", "")
_, err := h.GetMarginLoanOrders("hptusdt", "", "", "", "", "", "", "")
if err != nil {
t.Errorf("Test failed - Huobi TestGetMarginLoanOrders: %s", err)
}
@@ -257,7 +257,7 @@ func TestGetMarginAccountBalance(t *testing.T) {
t.Skip()
}
_, err := h.GetMarginAccountBalance("btcusdt")
_, err := h.GetMarginAccountBalance("hptusdt")
if err != nil {
t.Errorf("Test failed - Huobi TestGetMarginAccountBalance: %s", err)
}

File diff suppressed because one or more lines are too long