Skip to content

Commit

Permalink
Kraken: use configured endpoint for futures (thrasher-corp#1071)
Browse files Browse the repository at this point in the history
* fix: use configured endpoint for kraken futures

* cleanup

* Update kraken_futures.go

* remove redundant constant
  • Loading branch information
geseq authored Nov 3, 2022
1 parent c2d4563 commit 136dac8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions exchanges/kraken/kraken.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (

const (
krakenAPIURL = "https://api.kraken.com"
krakenFuturesURL = "https://futures.kraken.com"
futuresURL = "https://futures.kraken.com/derivatives"
krakenFuturesURL = "https://futures.kraken.com/derivatives"
krakenSpotVersion = "0"
krakenFuturesVersion = "3"
)
Expand Down
6 changes: 6 additions & 0 deletions exchanges/kraken/kraken_futures.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,12 @@ func (k *Kraken) SendFuturesAuthRequest(ctx context.Context, method, path string
"Nonce": nonce,
}

var futuresURL string
futuresURL, err = k.API.Endpoints.GetURL(exchange.RestFutures)
if err != nil {
return nil, err
}

return &request.Item{
Method: method,
Path: futuresURL + common.EncodeURLValues(path, data),
Expand Down
2 changes: 1 addition & 1 deletion exchanges/kraken/kraken_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (k *Kraken) SetDefaults() {
k.API.Endpoints = k.NewEndpoints()
err = k.API.Endpoints.SetDefaultEndpoints(map[exchange.URL]string{
exchange.RestSpot: krakenAPIURL,
exchange.RestFutures: futuresURL,
exchange.RestFutures: krakenFuturesURL,
exchange.WebsocketSpot: krakenWSURL,
})
if err != nil {
Expand Down

0 comments on commit 136dac8

Please sign in to comment.