mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 07:26:50 +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:
@@ -58,7 +58,12 @@ func (a *ANX) SetDefaults() {
|
||||
a.AssetTypes = []string{ticker.Spot}
|
||||
a.SupportsAutoPairUpdating = true
|
||||
a.SupportsRESTTickerBatching = false
|
||||
a.Requester = request.New(a.Name, request.NewRateLimit(time.Second, anxAuthRate), request.NewRateLimit(time.Second, anxUnauthRate), common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
|
||||
a.Requester = request.New(a.Name,
|
||||
request.NewRateLimit(time.Second, anxAuthRate),
|
||||
request.NewRateLimit(time.Second, anxUnauthRate),
|
||||
common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
|
||||
a.APIUrlDefault = anxAPIURL
|
||||
a.APIUrl = a.APIUrlDefault
|
||||
}
|
||||
|
||||
//Setup is run on startup to setup exchange with config values
|
||||
@@ -89,6 +94,10 @@ func (a *ANX) Setup(exch config.ExchangeConfig) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = a.SetAPIURL(exch)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +105,7 @@ func (a *ANX) Setup(exch config.ExchangeConfig) {
|
||||
// and cryptocurrencies)
|
||||
func (a *ANX) GetCurrencies() (CurrenciesStore, error) {
|
||||
var result CurrenciesStaticResponse
|
||||
path := fmt.Sprintf("%sapi/3/%s", anxAPIURL, anxCurrencies)
|
||||
path := fmt.Sprintf("%sapi/3/%s", a.APIUrl, anxCurrencies)
|
||||
|
||||
err := a.SendHTTPRequest(path, &result)
|
||||
if err != nil {
|
||||
@@ -117,7 +126,7 @@ func (a *ANX) GetFee(maker bool) float64 {
|
||||
// GetTicker returns the current ticker
|
||||
func (a *ANX) GetTicker(currency string) (Ticker, error) {
|
||||
var ticker Ticker
|
||||
path := fmt.Sprintf("%sapi/2/%s/%s", anxAPIURL, currency, anxTicker)
|
||||
path := fmt.Sprintf("%sapi/2/%s/%s", a.APIUrl, currency, anxTicker)
|
||||
|
||||
return ticker, a.SendHTTPRequest(path, &ticker)
|
||||
}
|
||||
@@ -125,7 +134,7 @@ func (a *ANX) GetTicker(currency string) (Ticker, error) {
|
||||
// GetDepth returns current orderbook depth.
|
||||
func (a *ANX) GetDepth(currency string) (Depth, error) {
|
||||
var depth Depth
|
||||
path := fmt.Sprintf("%sapi/2/%s/%s", anxAPIURL, currency, anxDepth)
|
||||
path := fmt.Sprintf("%sapi/2/%s/%s", a.APIUrl, currency, anxDepth)
|
||||
|
||||
return depth, a.SendHTTPRequest(path, &depth)
|
||||
}
|
||||
@@ -391,5 +400,5 @@ func (a *ANX) SendAuthenticatedHTTPRequest(path string, params map[string]interf
|
||||
headers["Rest-Sign"] = common.Base64Encode([]byte(hmac))
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
return a.SendPayload("POST", anxAPIURL+path, headers, bytes.NewBuffer(PayloadJSON), result, true, a.Verbose)
|
||||
return a.SendPayload("POST", a.APIUrl+path, headers, bytes.NewBuffer(PayloadJSON), result, true, a.Verbose)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user