Skip to content

Commit

Permalink
Private API
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Apr 26, 2019
1 parent 64ce3e4 commit c87112a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/rest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func main() {
api := rest.New("pZai5d5lPFm4uE+raQlSHCRRqNE4MoPU/k1C8nu0/0bZZ9+iItHsiWoc", "iNYlYHYf5j4tE8EvSV+HN6VsJyX3dhkRlw/6+NLLHzDZ+9aA8j/o3ze9gpXDXyEZVnz88vtwsqF8fPZWv82egw==")
data, err1 := api.GetTradeBalance("ZUSD")
data, err1 := api.GetTradeBalance("")
if err1 != nil {
log.Fatalln(err1)
}
Expand Down
8 changes: 3 additions & 5 deletions rest/private_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ func (api *Kraken) GetAccountBalances() (*BalanceResponse, error) {

// GetTradeBalance - returns tradable balances info
func (api *Kraken) GetTradeBalance(baseAsset string) (*TradeBalanceResponse, error) {
if baseAsset == "" {
baseAsset = "ZUSD"
}
data := url.Values{
"asset": {baseAsset},
data := url.Values{}
if baseAsset != "" {
data.Set("asset", baseAsset)
}

resp, err := api.request("TradeBalance", true, data, &TradeBalanceResponse{})
Expand Down
2 changes: 1 addition & 1 deletion websocket/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package websocket
// URLs
const (
prodBaseURL = "wss://ws.kraken.com"
sandboxBaseURL = "wss://ws-sandbox.kraken.com"
sandboxBaseURL = "wss://ws-beta.kraken.com"
)

// Available channels
Expand Down
4 changes: 2 additions & 2 deletions websocket/factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ func (f *spreadFactory) Parse(data interface{}, pair string) (interface{}, error
return SpreadUpdate{Pair: pair}, fmt.Errorf("Can't parse data %#v", data)
}
return SpreadUpdate{
Ask: valToFloat64(body[0]),
Bid: valToFloat64(body[1]),
Bid: valToFloat64(body[0]),
Ask: valToFloat64(body[1]),
Time: valToTime(body[2]),
Pair: pair,
}, nil
Expand Down

0 comments on commit c87112a

Please sign in to comment.