mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 23:16:49 +00:00
localbitcoins fixes (#177)
* General LocalBitcoin fixes * Added override variables to config for exchange packages to allow different API URL's
This commit is contained in:
@@ -77,7 +77,12 @@ func (h *HUOBI) SetDefaults() {
|
||||
h.AssetTypes = []string{ticker.Spot}
|
||||
h.SupportsAutoPairUpdating = true
|
||||
h.SupportsRESTTickerBatching = false
|
||||
h.Requester = request.New(h.Name, request.NewRateLimit(time.Second*10, huobiAuthRate), request.NewRateLimit(time.Second*10, huobiUnauthRate), common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
|
||||
h.Requester = request.New(h.Name,
|
||||
request.NewRateLimit(time.Second*10, huobiAuthRate),
|
||||
request.NewRateLimit(time.Second*10, huobiUnauthRate),
|
||||
common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
|
||||
h.APIUrlDefault = huobiAPIURL
|
||||
h.APIUrl = h.APIUrlDefault
|
||||
}
|
||||
|
||||
// Setup sets user configuration
|
||||
@@ -109,6 +114,10 @@ func (h *HUOBI) Setup(exch config.ExchangeConfig) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = h.SetAPIURL(exch)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +143,7 @@ func (h *HUOBI) GetSpotKline(arg KlinesRequestParams) ([]KlineItem, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/%s", huobiAPIURL, huobiMarketHistoryKline)
|
||||
url := fmt.Sprintf("%s/%s", h.APIUrl, huobiMarketHistoryKline)
|
||||
|
||||
err := h.SendHTTPRequest(common.EncodeURLValues(url, vals), &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -154,7 +163,7 @@ func (h *HUOBI) GetMarketDetailMerged(symbol string) (DetailMerged, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/%s", huobiAPIURL, huobiMarketDetailMerged)
|
||||
url := fmt.Sprintf("%s/%s", h.APIUrl, huobiMarketDetailMerged)
|
||||
|
||||
err := h.SendHTTPRequest(common.EncodeURLValues(url, vals), &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -178,7 +187,7 @@ func (h *HUOBI) GetDepth(obd OrderBookDataRequestParams) (Orderbook, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/%s", huobiAPIURL, huobiMarketDepth)
|
||||
url := fmt.Sprintf("%s/%s", h.APIUrl, huobiMarketDepth)
|
||||
|
||||
err := h.SendHTTPRequest(common.EncodeURLValues(url, vals), &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -200,7 +209,7 @@ func (h *HUOBI) GetTrades(symbol string) ([]Trade, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/%s", huobiAPIURL, huobiMarketTrade)
|
||||
url := fmt.Sprintf("%s/%s", h.APIUrl, huobiMarketTrade)
|
||||
|
||||
err := h.SendHTTPRequest(common.EncodeURLValues(url, vals), &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -240,7 +249,7 @@ func (h *HUOBI) GetTradeHistory(symbol, size string) ([]TradeHistory, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/%s", huobiAPIURL, huobiMarketTradeHistory)
|
||||
url := fmt.Sprintf("%s/%s", h.APIUrl, huobiMarketTradeHistory)
|
||||
|
||||
err := h.SendHTTPRequest(common.EncodeURLValues(url, vals), &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -260,7 +269,7 @@ func (h *HUOBI) GetMarketDetail(symbol string) (Detail, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/%s", huobiAPIURL, huobiMarketDetail)
|
||||
url := fmt.Sprintf("%s/%s", h.APIUrl, huobiMarketDetail)
|
||||
|
||||
err := h.SendHTTPRequest(common.EncodeURLValues(url, vals), &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -277,7 +286,7 @@ func (h *HUOBI) GetSymbols() ([]Symbol, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/v%s/%s", huobiAPIURL, huobiAPIVersion, huobiSymbols)
|
||||
url := fmt.Sprintf("%s/v%s/%s", h.APIUrl, huobiAPIVersion, huobiSymbols)
|
||||
|
||||
err := h.SendHTTPRequest(url, &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -294,7 +303,7 @@ func (h *HUOBI) GetCurrencies() ([]string, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/v%s/%s", huobiAPIURL, huobiAPIVersion, huobiCurrencies)
|
||||
url := fmt.Sprintf("%s/v%s/%s", h.APIUrl, huobiAPIVersion, huobiCurrencies)
|
||||
|
||||
err := h.SendHTTPRequest(url, &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -311,7 +320,7 @@ func (h *HUOBI) GetTimestamp() (int64, error) {
|
||||
}
|
||||
|
||||
var result response
|
||||
url := fmt.Sprintf("%s/v%s/%s", huobiAPIURL, huobiAPIVersion, huobiTimestamp)
|
||||
url := fmt.Sprintf("%s/v%s/%s", h.APIUrl, huobiAPIVersion, huobiTimestamp)
|
||||
|
||||
err := h.SendHTTPRequest(url, &result)
|
||||
if result.ErrorMessage != "" {
|
||||
@@ -774,7 +783,7 @@ func (h *HUOBI) SendAuthenticatedHTTPRequest(method, endpoint string, values url
|
||||
privSig = append(privSig, s.Bytes()...)
|
||||
values.Set("PrivateSignature", common.Base64Encode(privSig))
|
||||
|
||||
url := fmt.Sprintf("%s%s", huobiAPIURL, endpoint)
|
||||
url := fmt.Sprintf("%s%s", h.APIUrl, endpoint)
|
||||
url = common.EncodeURLValues(url, values)
|
||||
|
||||
return h.SendPayload(method, url, headers, bytes.NewBufferString(""), result, true, h.Verbose)
|
||||
|
||||
Reference in New Issue
Block a user