Skip to content

Commit

Permalink
btcmarkets: remove trailing slash on markets/ticker strings and updat…
Browse files Browse the repository at this point in the history
…e endpoint paths (thrasher-corp#1530)

* btcmarkets: fix endpoint issue

* Update exchanges/btcmarkets/btcmarkets.go

Co-authored-by: Adrian Gallagher <[email protected]>

---------

Co-authored-by: shazbert <[email protected]>
Co-authored-by: Adrian Gallagher <[email protected]>
  • Loading branch information
3 people authored May 3, 2024
1 parent 0658b27 commit 0676c78
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions exchanges/btcmarkets/btcmarkets.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const (
btcMarketsAPIVersion = "/v3"

// UnAuthenticated EPs
btcMarketsAllMarkets = "/markets/"
btcMarketsGetTicker = "/ticker/"
btcMarketsAllMarkets = "/markets"
btcMarketsGetTicker = "/ticker"
btcMarketsGetTrades = "/trades?"
btcMarketOrderBook = "/orderbook?"
btcMarketsCandles = "/candles?"
Expand Down Expand Up @@ -110,7 +110,7 @@ func (b *BTCMarkets) GetMarkets(ctx context.Context) ([]Market, error) {
// symbol - example "btc" or "ltc"
func (b *BTCMarkets) GetTicker(ctx context.Context, marketID string) (Ticker, error) {
var tick Ticker
return tick, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+marketID+btcMarketsGetTicker, &tick)
return tick, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+"/"+marketID+btcMarketsGetTicker, &tick)
}

// GetTrades returns executed trades on the exchange
Expand All @@ -129,7 +129,7 @@ func (b *BTCMarkets) GetTrades(ctx context.Context, marketID string, before, aft
if limit > 0 {
params.Set("limit", strconv.FormatInt(limit, 10))
}
return trades, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+marketID+btcMarketsGetTrades+params.Encode(),
return trades, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+"/"+marketID+btcMarketsGetTrades+params.Encode(),
&trades)
}

Expand All @@ -144,7 +144,7 @@ func (b *BTCMarkets) GetOrderbook(ctx context.Context, marketID string, level in
params.Set("level", strconv.FormatInt(level, 10))
}
var temp tempOrderbook
err := b.SendHTTPRequest(ctx, btcMarketsUnauthPath+marketID+btcMarketOrderBook+params.Encode(),
err := b.SendHTTPRequest(ctx, btcMarketsUnauthPath+"/"+marketID+btcMarketOrderBook+params.Encode(),
&temp)
if err != nil {
return nil, err
Expand Down Expand Up @@ -214,7 +214,7 @@ func (b *BTCMarkets) GetMarketCandles(ctx context.Context, marketID, timeWindow
if limit > 0 {
params.Set("limit", strconv.FormatInt(limit, 10))
}
return out, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+marketID+btcMarketsCandles+params.Encode(), &out)
return out, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+"/"+marketID+btcMarketsCandles+params.Encode(), &out)
}

// GetTickers gets multiple tickers
Expand All @@ -224,7 +224,7 @@ func (b *BTCMarkets) GetTickers(ctx context.Context, marketIDs currency.Pairs) (
for x := range marketIDs {
params.Add("marketId", marketIDs[x].String())
}
return tickers, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+btcMarketsTickers+params.Encode(),
return tickers, b.SendHTTPRequest(ctx, btcMarketsUnauthPath+"/"+btcMarketsTickers+params.Encode(),
&tickers)
}

Expand All @@ -235,7 +235,7 @@ func (b *BTCMarkets) GetMultipleOrderbooks(ctx context.Context, marketIDs []stri
for x := range marketIDs {
params.Add("marketId", marketIDs[x])
}
err := b.SendHTTPRequest(ctx, btcMarketsUnauthPath+btcMarketsMultipleOrderbooks+params.Encode(),
err := b.SendHTTPRequest(ctx, btcMarketsUnauthPath+"/"+btcMarketsMultipleOrderbooks+params.Encode(),
&temp)
if err != nil {
return nil, err
Expand Down

0 comments on commit 0676c78

Please sign in to comment.