mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-16 15:09:57 +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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user