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:
soxipy
2018-08-27 07:19:29 +03:00
committed by Ryan O'Hara-Reid
parent ca0c22f422
commit fb4e2d1452
35 changed files with 885 additions and 355 deletions

View File

@@ -55,7 +55,12 @@ func (i *ItBit) SetDefaults() {
i.AssetTypes = []string{ticker.Spot}
i.SupportsAutoPairUpdating = false
i.SupportsRESTTickerBatching = false
i.Requester = request.New(i.Name, request.NewRateLimit(time.Second, itbitAuthRate), request.NewRateLimit(time.Second, itbitUnauthRate), common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
i.Requester = request.New(i.Name,
request.NewRateLimit(time.Second, itbitAuthRate),
request.NewRateLimit(time.Second, itbitUnauthRate),
common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
i.APIUrlDefault = itbitAPIURL
i.APIUrl = i.APIUrlDefault
}
// Setup sets the exchange parameters from exchange config
@@ -86,6 +91,10 @@ func (i *ItBit) Setup(exch config.ExchangeConfig) {
if err != nil {
log.Fatal(err)
}
err = i.SetAPIURL(exch)
if err != nil {
log.Fatal(err)
}
}
}
@@ -101,7 +110,7 @@ func (i *ItBit) GetFee(maker bool) float64 {
// currencyPair - example "XBTUSD" "XBTSGD" "XBTEUR"
func (i *ItBit) GetTicker(currencyPair string) (Ticker, error) {
var response Ticker
path := fmt.Sprintf("%s/%s/%s/%s", itbitAPIURL, itbitMarkets, currencyPair, itbitTicker)
path := fmt.Sprintf("%s/%s/%s/%s", i.APIUrl, itbitMarkets, currencyPair, itbitTicker)
return response, i.SendHTTPRequest(path, &response)
}
@@ -110,7 +119,7 @@ func (i *ItBit) GetTicker(currencyPair string) (Ticker, error) {
// currencyPair - example "XBTUSD" "XBTSGD" "XBTEUR"
func (i *ItBit) GetOrderbook(currencyPair string) (OrderbookResponse, error) {
response := OrderbookResponse{}
path := fmt.Sprintf("%s/%s/%s/%s", itbitAPIURL, itbitMarkets, currencyPair, itbitOrderbook)
path := fmt.Sprintf("%s/%s/%s/%s", i.APIUrl, itbitMarkets, currencyPair, itbitOrderbook)
return response, i.SendHTTPRequest(path, &response)
}
@@ -122,7 +131,7 @@ func (i *ItBit) GetOrderbook(currencyPair string) (OrderbookResponse, error) {
func (i *ItBit) GetTradeHistory(currencyPair, timestamp string) (Trades, error) {
response := Trades{}
req := "trades?since=" + timestamp
path := fmt.Sprintf("%s/%s/%s/%s", itbitAPIURL, itbitMarkets, currencyPair, req)
path := fmt.Sprintf("%s/%s/%s/%s", i.APIUrl, itbitMarkets, currencyPair, req)
return response, i.SendHTTPRequest(path, &response)
}
@@ -321,7 +330,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
}
request := make(map[string]interface{})
url := itbitAPIURL + path
url := i.APIUrl + path
if params != nil {
for key, value := range params {