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

@@ -1,6 +1,7 @@
package exchange
import (
"errors"
"log"
"net/http"
"sync"
@@ -105,6 +106,9 @@ type Base struct {
HTTPUserAgent string
WebsocketURL string
APIUrl string
APIUrlDefault string
APIUrlSecondary string
APIUrlSecondaryDefault string
RequestCurrencyPairFormat config.CurrencyPairFormatConfig
ConfigCurrencyPairFormat config.CurrencyPairFormatConfig
*request.Requester
@@ -624,3 +628,37 @@ func OrderSideBuy() OrderSide {
func OrderSideSell() OrderSide {
return "Sell"
}
// SetAPIURL sets configuration API URL for an exchange
func (e *Base) SetAPIURL(ec config.ExchangeConfig) error {
if ec.APIURL == "" || ec.APIURLSecondary == "" {
return errors.New("SetAPIURL error variable zero value")
}
if ec.APIURL != config.APIURLDefaultMessage {
e.APIUrl = ec.APIURL
}
if ec.APIURLSecondary != config.APIURLDefaultMessage {
e.APIUrlSecondary = ec.APIURLSecondary
}
return nil
}
// GetAPIURL returns the set API URL
func (e *Base) GetAPIURL() string {
return e.APIUrl
}
// GetSecondaryAPIURL returns the set Secondary API URL
func (e *Base) GetSecondaryAPIURL() string {
return e.APIUrlSecondary
}
// GetAPIURLDefault returns exchange default URL
func (e *Base) GetAPIURLDefault() string {
return e.APIUrlDefault
}
// GetAPIURLSecondaryDefault returns exchange default secondary URL
func (e *Base) GetAPIURLSecondaryDefault() string {
return e.APIUrlSecondaryDefault
}